/* ---------- Tokens (Klenty palette: purple/lavender) ---------- */
:root {
  --brand: #6E2EFF;        /* Klenty vivid purple */
  --brand-dark: #4F1ABF;   /* hover / pressed */
  --brand-deeper: #1A0F40; /* dark purple header strip */
  --brand-soft: #EDE4FF;   /* lavender surface */
  --brand-softer: #F6F1FF; /* very light lavender bg */

  --text: #14102A;          /* tinted near-black */
  --text-muted: #5A5673;
  --text-faint: #8B86A3;

  --surface: #FFFFFF;
  --bg: #F4F1FB;            /* faint lavender wash */
  --bg-deep: #E7E1F4;
  --border: #E3DEEF;
  --border-strong: #C9C1E0;

  --ok: #16A34A;
  --ok-strong: #15803D;
  --ok-soft: #DCFCE7;
  --ok-bg: #F0FDF4;
  --info: #6E2EFF;
  --info-soft: #EDE4FF;
  --warn: #F59E0B;
  --warn-strong: #B45309;
  --warn-soft: #FEF3C7;
  --warn-bg: #FFFBEB;
  --bad: #DC2626;
  --bad-soft: #FEE2E2;
  --bad-bg: #FEF2F2;

  --radius: 6px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow: 0 6px 20px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.04);

  --container-max: 920px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
button { font: inherit; }

.container { max-width: var(--container-max); margin: 0 auto; padding: 0 24px; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.link { color: var(--brand); }
.link:hover { color: var(--brand-dark); text-decoration: underline; }

/* ---------- Top promo bar (Klenty purple) ---------- */
.top-bar {
  background: linear-gradient(90deg, #1A0F40 0%, #2E1A5F 45%, #4F1ABF 100%);
  color: #fff;
  font-size: 13px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}
.top-bar-inner {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 24px;
  justify-content: center;
  flex-wrap: wrap;
}
.top-bar-pill {
  background: linear-gradient(135deg, #22C55E 0%, #16A34A 100%);
  color: #fff;
  padding: 3px 9px; border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  display: inline-flex; align-items: center; gap: 4px;
}
.top-bar-text { color: rgba(255,255,255,0.92); }
.top-bar-link {
  color: #C7B2FF; font-weight: 500; margin-left: 8px;
}
.top-bar-link:hover { color: #fff; }

/* ---------- Header / Footer ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 17px; color: var(--text);
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 28px; height: 28px; border-radius: 7px;
  background: linear-gradient(135deg, var(--brand) 0%, #4D1AE6 100%);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px;
  letter-spacing: 0;
  box-shadow: 0 4px 12px rgba(110, 46, 255, 0.28);
}
.brand-logo { height: 26px; width: auto; display: block; }
.brand-logo-white { filter: brightness(0) invert(1); opacity: 0.95; }
.brand-sub {
  color: var(--text-muted); font-size: 13px; font-weight: 500;
  padding-left: 10px; margin-left: 8px;
  border-left: 1px solid var(--border-strong);
  letter-spacing: 0.01em;
}
.admin-header .brand-sub {
  color: rgba(255, 255, 255, 0.72);
  border-left-color: rgba(255, 255, 255, 0.22);
}
.login-logo { height: 30px; margin: 0 auto 16px; }
.nav { display: flex; gap: 18px; align-items: center; }
.nav a, .nav .link-button {
  color: var(--text-muted); font-size: 14px; font-weight: 500;
  transition: color 0.12s;
}
.nav a:hover { color: var(--text); }

/* Header action buttons (Report an issue / Get updates) */
.header-action {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font: inherit; font-size: 14px; font-weight: 500;
  padding: 8px 14px; border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.header-action:hover { background: var(--bg); border-color: var(--brand); color: var(--brand); }
.header-action-primary {
  background: var(--brand); border-color: var(--brand); color: #fff;
}
.header-action-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }

.admin-header .header-action {
  background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.9);
}
.admin-header .header-action:hover { background: rgba(255,255,255,0.18); color: #fff; border-color: rgba(255,255,255,0.32); }

.site-footer {
  padding: 40px 0 32px; color: var(--text-muted); font-size: 13px;
  margin-top: 56px; border-top: 1px solid var(--border);
}
.site-footer .container {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--text); }

/* ---------- Banner ---------- */
.banner {
  display: flex; align-items: center; gap: 18px;
  border-radius: var(--radius-lg); padding: 28px 32px;
  margin: 36px 0 28px;
  box-shadow: var(--shadow-sm);
  border: 1px solid transparent;
}
.banner h1 { font-size: 26px; margin: 0; font-weight: 600; letter-spacing: -0.015em; }
.banner-dot {
  width: 14px; height: 14px; border-radius: 50%; flex: 0 0 14px;
  position: relative;
}
.banner-dot::after {
  content: ''; position: absolute; inset: -6px; border-radius: 50%;
  background: currentColor; opacity: 0.18;
}
.banner-ok    { background: var(--ok-bg);  border-color: rgba(22, 163, 74, 0.25); color: var(--ok-strong); }
.banner-ok    .banner-dot { background: var(--ok); color: var(--ok); }
.banner-info  { background: var(--info-soft); border-color: rgba(110, 46, 255, 0.25); color: var(--brand-dark); }
.banner-info  .banner-dot { background: var(--info); color: var(--info); }
.banner-warn  { background: var(--warn-bg); border-color: rgba(245, 158, 11, 0.35); color: var(--warn-strong); }
.banner-warn  .banner-dot { background: var(--warn); color: var(--warn); }
.banner-bad   { background: var(--bad-bg); border-color: rgba(220, 38, 38, 0.3); color: var(--bad); }
.banner-bad   .banner-dot { background: var(--bad); color: var(--bad); }

/* ---------- Card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px 26px; margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); margin: 0 0 14px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px;
}
.card-title::before {
  content: ''; display: inline-block; width: 3px; height: 14px;
  background: var(--brand); border-radius: 2px;
}

/* ---------- Components ---------- */
.components { display: flex; flex-direction: column; gap: 16px; margin-bottom: 28px; }
.component-group {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 10px 26px;
  box-shadow: var(--shadow-sm);
}
.group-title {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); margin: 16px 0 4px; font-weight: 600;
}
.component { padding: 16px 0; border-top: 1px solid var(--border); }
.component:first-of-type { border-top: 0; }
.component-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
}
.component-name { font-weight: 500; color: var(--text); }
.component-desc { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

/* ---------- Status pills ---------- */
.status-pill {
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 500;
  border: 1px solid transparent; white-space: nowrap;
}
.status-operational    { background: var(--ok-soft);   color: var(--ok);   border-color: rgba(22, 163, 74, 0.18); }
.status-maintenance    { background: var(--info-soft); color: var(--info); border-color: rgba(110, 46, 255, 0.2); }
.status-degraded       { background: var(--warn-soft); color: #B45309;     border-color: rgba(245, 158, 11, 0.25); }
.status-partial_outage { background: var(--warn-soft); color: #B45309;     border-color: rgba(245, 158, 11, 0.35); }
.status-major_outage   { background: var(--bad-soft);  color: var(--bad);  border-color: rgba(220, 38, 38, 0.25); }

/* ---------- Uptime bars ---------- */
.bars {
  display: flex; gap: 2px; margin-top: 14px;
  background: var(--border); padding: 0; border-radius: 3px; overflow: hidden;
}
.bar { flex: 1; height: 30px; background: var(--ok); transition: opacity 0.12s, transform 0.12s; cursor: pointer; }
.bar:hover { opacity: 0.78; transform: scaleY(1.08); }
.bar-operational    { background: var(--ok); }
.bar-maintenance    { background: var(--info); }
.bar-degraded       { background: var(--warn); }
.bar-partial_outage { background: var(--warn); }
.bar-major_outage   { background: var(--bad); }
.bars-legend {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--text-muted); margin-top: 8px;
}
.bars-legend strong { color: var(--text); font-weight: 500; }

/* ---------- Incidents ---------- */
.incident { padding: 16px 0; border-top: 1px solid var(--border); }
.incident:first-of-type { border-top: 0; padding-top: 4px; }
.incident-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.incident-title {
  font-weight: 500; color: var(--text); font-size: 15px;
}
.incident-title:hover { color: var(--brand); }
.incident-meta { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.incident-update { margin: 10px 0 0; font-size: 14px; color: var(--text); }
.incident-resolved .incident-title { color: var(--text-muted); }

.badge {
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 4px;
  background: #EEF1F5; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-none      { background: #EEF1F5; color: var(--text-muted); }
.badge-minor     { background: var(--warn-soft); color: #B45309; }
.badge-major     { background: var(--warn-soft); color: #B45309; }
.badge-critical  { background: var(--bad-soft);  color: var(--bad); }
.badge-resolved      { background: var(--ok-soft);   color: var(--ok); }
.badge-investigating { background: var(--bad-soft);  color: var(--bad); }
.badge-identified    { background: var(--warn-soft); color: #B45309; }
.badge-monitoring    { background: var(--info-soft); color: var(--info); }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item { display: flex; gap: 16px; padding: 16px 0; border-top: 1px solid var(--border); }
.timeline-item:first-child { border-top: 0; padding-top: 8px; }
.timeline-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--text-muted);
  margin-top: 8px; flex: 0 0 10px;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.06);
}
.timeline-investigating .timeline-dot { background: var(--bad); }
.timeline-identified    .timeline-dot { background: var(--warn); }
.timeline-monitoring    .timeline-dot { background: var(--info); }
.timeline-resolved      .timeline-dot { background: var(--ok); }
.timeline-body { flex: 1; }
.timeline-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.timeline-head strong { font-weight: 600; }
.timeline-body p { margin: 4px 0 0; color: var(--text); }

/* ---------- History page ---------- */
.month-block { margin-bottom: 32px; }
.month-title {
  font-size: 16px; font-weight: 600; margin: 0 0 8px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.page-title {
  font-size: 26px; margin: 36px 0 20px; font-weight: 600; letter-spacing: -0.015em;
}

/* ---------- Admin shell ---------- */
body.admin { background: var(--bg); }
.admin-header {
  background: linear-gradient(135deg, var(--brand-deeper) 0%, #2E1A5F 100%);
  color: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.25);
  position: relative;
}
.admin-header::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--brand) 0%, #9B6BFF 100%);
}
.admin-header .brand { color: #fff; }
.admin-header .nav a, .admin-header .nav .link-button {
  color: rgba(255, 255, 255, 0.72); font-weight: 500;
}
.admin-header .nav a:hover, .admin-header .nav .link-button:hover { color: #fff; }
.link-button { background: none; border: 0; padding: 0; cursor: pointer; color: inherit; }

.page-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin: 32px 0 20px; gap: 12px; flex-wrap: wrap;
}
.page-head h1 { font-size: 26px; margin: 0; font-weight: 600; letter-spacing: -0.015em; }
.page-sub { margin: 4px 0 0; font-size: 14px; }
.actions { display: flex; gap: 8px; }

/* ---------- KPI tiles ---------- */
.kpi-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 24px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.kpi::before {
  content: '';
  position: absolute; top: 0; left: 0; width: 3px; height: 100%;
  background: var(--border-strong);
}
.kpi-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); font-weight: 600;
}
.kpi-value {
  margin-top: 6px; font-size: 30px; font-weight: 600; letter-spacing: -0.02em;
  line-height: 1.1; color: var(--text);
  display: flex; align-items: baseline; gap: 2px;
}
.kpi-of { font-size: 16px; color: var(--text-muted); font-weight: 500; margin-left: 2px; }
.kpi-hint { margin-top: 4px; font-size: 12px; color: var(--text-muted); }
.kpi-ok::before    { background: var(--ok); }
.kpi-ok .kpi-value { color: var(--ok-strong); }
.kpi-warn::before  { background: var(--warn); }
.kpi-warn .kpi-value { color: var(--warn-strong); }
.kpi-bad::before   { background: var(--bad); }
.kpi-bad .kpi-value { color: var(--bad); }
.kpi-brand::before { background: linear-gradient(180deg, var(--brand) 0%, #9B6BFF 100%); }
.kpi-brand .kpi-value { color: var(--brand); }

@media (max-width: 720px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 16px; border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  cursor: pointer; font-size: 14px; font-weight: 500;
  transition: background 0.12s, border-color 0.12s, transform 0.05s;
}
.btn:hover { background: #F0F3F8; border-color: #B9C2CE; color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--brand); color: #fff; border-color: var(--brand);
}
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn.danger { color: var(--bad); border-color: rgba(220, 38, 38, 0.3); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.danger { color: var(--bad); }
.link-button.danger:hover { color: var(--bad); }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: left; padding: 12px 10px; border-top: 1px solid var(--border);
  font-size: 14px; vertical-align: middle;
}
.table th {
  font-size: 11px; text-transform: uppercase; color: var(--text-muted);
  letter-spacing: 0.06em; border-top: 0; font-weight: 600;
}
.table tr:hover td { background: var(--bg); }

/* ---------- Forms ---------- */
form label {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 16px; font-size: 13px; font-weight: 500; color: var(--text);
}
form input, form select, form textarea {
  font: inherit; padding: 9px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  transition: border-color 0.12s, box-shadow 0.12s;
  width: 100%;
}
form input:focus, form select:focus, form textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(110, 46, 255, 0.15);
}
form .row { display: flex; gap: 14px; }
form .row label { flex: 1; }
.form-actions { display: flex; gap: 8px; margin-top: 8px; }
.hint { font-size: 12px; color: var(--text-muted); font-weight: 400; margin-top: 2px; }
.inline { display: inline; }

.alert {
  background: var(--bad-soft); color: var(--bad);
  padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px;
  font-size: 14px; border: 1px solid rgba(220, 38, 38, 0.2);
}

/* ---------- Login ---------- */
.login-page {
  background: linear-gradient(135deg, var(--brand-deeper) 0%, #2E1A5F 50%, #4F1ABF 100%);
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-box {
  background: #fff; padding: 32px; border-radius: var(--radius-lg);
  width: 360px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
.login-box h1 { margin: 0 0 4px; font-size: 20px; font-weight: 600; }
.login-box form { margin-top: 22px; }
.login-box .btn-primary { width: 100%; padding: 11px; }

.incident-detail header { margin-bottom: 18px; }
.incident-detail h1 { font-size: 24px; margin: 8px 0; font-weight: 600; letter-spacing: -0.01em; }

/* ---------- Chip multi-select ---------- */
.chip-select {
  position: relative;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); padding: 6px 8px;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  min-height: 42px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.chip-select.is-focused {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(110, 46, 255, 0.15);
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--brand-soft); color: var(--brand);
  border: 1px solid rgba(110, 46, 255, 0.25);
  padding: 4px 4px 4px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 500;
  line-height: 1;
}
.chip-remove {
  width: 18px; height: 18px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--brand); border: 0; cursor: pointer;
  font-size: 14px; line-height: 1; padding: 0;
  transition: background 0.12s;
}
.chip-remove:hover { background: rgba(110, 46, 255, 0.18); }
.chip-select-input {
  flex: 1; min-width: 140px;
  border: 0; outline: none; background: transparent;
  padding: 6px 4px; font: inherit; color: var(--text);
}
.chip-select-input::placeholder { color: var(--text-faint); }
.chip-select-dropdown {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow);
  max-height: 240px; overflow-y: auto; z-index: 50;
  display: none;
}
.chip-select.is-open .chip-select-dropdown { display: block; }
.chip-select-option {
  padding: 9px 14px; cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: space-between;
}
.chip-select-option:hover,
.chip-select-option.is-active { background: var(--brand-soft); color: var(--brand); }
.chip-select-option.is-empty {
  color: var(--text-muted); font-style: italic; cursor: default;
}
.chip-select-option.is-empty:hover { background: transparent; color: var(--text-muted); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 32px;
  transform: translateX(-50%) translateY(20px);
  background: #fff; color: var(--text);
  padding: 14px 22px; border-radius: var(--radius-lg);
  box-shadow: 0 18px 50px rgba(15, 12, 40, 0.22), 0 4px 10px rgba(15, 12, 40, 0.1);
  font-size: 14px; z-index: 2000;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  border: 1px solid var(--border);
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Subscribe popover (Get updates) ---------- */
.subscribe-popover {
  position: absolute;
  top: 0; left: 0;
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 50px rgba(15, 12, 40, 0.18), 0 4px 10px rgba(15, 12, 40, 0.08);
  padding: 18px 20px;
  z-index: 1500;
  opacity: 0; pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.subscribe-popover.is-visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.subscribe-popover h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.subscribe-popover p { margin: 4px 0 12px; font-size: 13px; }
.subscribe-form { display: flex; gap: 6px; }
.subscribe-form input {
  flex: 1; padding: 9px 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius); background: var(--surface); font: inherit;
  min-width: 0;
}
.subscribe-form input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(110, 46, 255, 0.15); }
.subscribe-form .btn { padding: 9px 14px; white-space: nowrap; }
.subscribe-status { margin-top: 10px; font-size: 13px; min-height: 18px; color: var(--text-muted); }
.subscribe-status.is-ok { color: var(--ok-strong); }
.subscribe-status.is-bad { color: var(--bad); }

/* ---------- History pagination nav ---------- */
.history-nav {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin: 8px 0 18px;
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.history-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  color: var(--brand); text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}
.history-btn:hover { background: var(--brand-softer); border-color: var(--border-strong); color: var(--brand-dark); }
.history-btn.is-disabled {
  color: var(--text-faint); cursor: default; background: transparent;
  border-color: transparent;
}
.history-current {
  font-size: 13px; color: var(--text-muted); font-weight: 500;
}
@media (max-width: 560px) {
  .history-nav { flex-wrap: wrap; justify-content: center; text-align: center; }
}

/* ---------- Bar hover popover (public uptime bars) ---------- */
.bar-popover {
  position: absolute;
  top: 0; left: 0;
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(15, 12, 40, 0.18), 0 4px 10px rgba(15, 12, 40, 0.08);
  padding: 16px 18px;
  z-index: 100;
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
  font-size: 14px;
}
.bar-popover.is-visible {
  opacity: 1; transform: translateY(0); pointer-events: auto;
}
.bar-pop-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.bar-pop-date { font-weight: 600; font-size: 15px; color: var(--text); }
.bar-pop-component { font-size: 12px; margin-top: 2px; }
.bar-pop-status {
  font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap;
  border: 1px solid transparent;
}
.bar-pop-status-ok   { background: var(--ok-soft);  color: var(--ok-strong); border-color: rgba(22, 163, 74, 0.2); }
.bar-pop-status-info { background: var(--info-soft); color: var(--brand-dark); border-color: rgba(110, 46, 255, 0.22); }
.bar-pop-status-warn { background: var(--warn-soft); color: var(--warn-strong); border-color: rgba(245, 158, 11, 0.3); }
.bar-pop-status-bad  { background: var(--bad-soft);  color: var(--bad); border-color: rgba(220, 38, 38, 0.25); }

.bar-pop-section { display: flex; flex-direction: column; gap: 8px; }
.bar-pop-section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); font-weight: 600;
}
.bar-pop-incident {
  display: block; padding: 10px 12px; border-radius: var(--radius);
  background: var(--bg); border: 1px solid var(--border);
  text-decoration: none; color: var(--text);
  transition: border-color 0.12s, background 0.12s;
}
.bar-pop-incident:hover { border-color: var(--brand); background: var(--brand-softer); }
.bar-pop-incident-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.bar-pop-incident-head strong { font-weight: 600; font-size: 13px; }
.bar-pop-incident-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.bar-pop-incident p {
  margin: 6px 0 0; font-size: 13px; color: var(--text-muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.bar-pop-empty { font-size: 13px; padding: 4px 0; }

/* ---------- Incident hover modal ---------- */
.incident-row { cursor: pointer; }
.incident-row:hover td { background: var(--bg) !important; }
.incident-row:focus { outline: 2px solid var(--brand); outline-offset: -2px; }

body.has-modal { overflow: hidden; }

.incident-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 16, 42, 0.55);
  backdrop-filter: blur(2px);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
}
.incident-modal-backdrop.is-visible {
  opacity: 1; pointer-events: auto;
}

.incident-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -48%);
  width: min(540px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 80px rgba(15, 12, 40, 0.4), 0 8px 24px rgba(15, 12, 40, 0.15);
  padding: 26px 28px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.incident-modal.is-visible {
  opacity: 1; pointer-events: auto;
  transform: translate(-50%, -50%);
}

.modal-close {
  position: absolute; top: 12px; right: 14px;
  width: 30px; height: 30px; border-radius: 50%;
  background: transparent; border: 0;
  color: var(--text-muted); font-size: 22px; line-height: 1;
  cursor: pointer; transition: background 0.12s, color 0.12s;
}
.modal-close:hover { background: var(--bg); color: var(--text); }

.modal-head {
  display: flex; flex-direction: column; gap: 12px;
  padding: 0 32px 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.modal-head h2 {
  margin: 0; font-size: 20px; font-weight: 600;
  letter-spacing: -0.015em; line-height: 1.3;
  color: var(--text);
}
.modal-badges { display: flex; gap: 6px; flex-wrap: wrap; }

.modal-body { display: flex; flex-direction: column; gap: 18px; }
.modal-rows { display: flex; flex-direction: column; gap: 6px; }
.modal-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 8px; font-size: 14px;
}
.modal-section { display: flex; flex-direction: column; gap: 8px; }
.modal-section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); font-weight: 600;
}
.modal-update {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.modal-update-head { display: flex; align-items: center; gap: 10px; }
.modal-update p { margin: 0; color: var(--text); font-size: 14px; line-height: 1.55; }
.modal-update .small { font-size: 12px; }

.modal-foot {
  margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end;
}

/* Read-only chip cluster (for displaying affected components) */
.chip-cluster { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-static {
  display: inline-flex; align-items: center;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border-strong);
  padding: 4px 10px; border-radius: 999px;
  font-size: 13px;
}
