/* ============================================================
   Pulsegrid design system
   Display: Space Grotesk · Body: Inter · Data: JetBrains Mono
   ============================================================ */

:root {
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --brand-start: #0EA5E9;
  --brand-end: #14B8A6;
  --brand-gradient: linear-gradient(135deg, var(--brand-start), var(--brand-end));

  --success: #10B981;
  --success-bg: rgba(16, 185, 129, 0.14);
  --warning: #F59E0B;
  --warning-bg: rgba(245, 158, 11, 0.14);
  --danger: #EF4444;
  --danger-bg: rgba(239, 68, 68, 0.14);
  --info: #6366F1;
  --info-bg: rgba(99, 102, 241, 0.14);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px -8px rgba(15, 23, 42, 0.18);
  --shadow-lg: 0 16px 48px -12px rgba(15, 23, 42, 0.28);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 420ms;

  --sidebar-w: 264px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 64px;
}

[data-theme="dark"] {
  --bg: #0B1220;
  --bg-elevated: #0F1830;
  --surface: #111B2E;
  --surface-2: #16223B;
  --surface-hover: #1B2A47;
  --border: #223252;
  --border-soft: #1A2740;
  --text: #E7ECF7;
  --text-secondary: #94A3B8;
  --text-tertiary: #64748B;
  --overlay: rgba(4, 8, 18, 0.68);
}

[data-theme="light"] {
  --bg: #F5F7FB;
  --bg-elevated: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F1F5F9;
  --surface-hover: #EAF1F8;
  --border: #E2E8F0;
  --border-soft: #EEF2F7;
  --text: #0F172A;
  --text-secondary: #475569;
  --text-tertiary: #94A3B8;
  --overlay: rgba(15, 23, 42, 0.45);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition: background var(--dur-base) var(--ease), color var(--dur-base) var(--ease);
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: rgba(14,165,233,0.28); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 1000;
  background: var(--brand-start); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 2px solid var(--brand-start);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--radius-md); border: 1px solid transparent;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), background var(--dur-fast), box-shadow var(--dur-fast), border-color var(--dur-fast);
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--brand-gradient); color: #fff; box-shadow: 0 4px 14px -4px rgba(14,165,233,0.5); }
.btn-primary:hover { box-shadow: 0 6px 20px -4px rgba(14,165,233,0.65); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-hover); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Form controls ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.field-hint { font-size: 12px; color: var(--text-tertiary); }
.input, select.input, textarea.input {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font-size: 14px; font-family: inherit;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.input:focus { border-color: var(--brand-start); box-shadow: 0 0 0 3px rgba(14,165,233,0.18); outline: none; }
.input-group { position: relative; }
.input-group .input { padding-right: 40px; }
.input-affix { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--text-tertiary); cursor: pointer; font-size: 13px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); }

/* ---------- Cards / surfaces ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px;
  border-radius: 999px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-up { background: var(--success-bg); color: var(--success); }
.badge-down { background: var(--danger-bg); color: var(--danger); }
.badge-degraded { background: var(--warning-bg); color: var(--warning); }
.badge-maintenance { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: var(--surface-2); color: var(--text-secondary); }

/* ============================================================
   AUTH SCREENS
   ============================================================ */
.auth-shell {
  min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr;
}
.auth-visual {
  background: radial-gradient(120% 120% at 20% 20%, #0F2A46 0%, #0B1220 55%), var(--bg);
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 48px;
}
.auth-visual::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(circle, rgba(14,165,233,0.16) 1px, transparent 1px);
  background-size: 26px 26px; opacity: 0.6;
}
.auth-brand { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.auth-brand img { width: 36px; height: 36px; border-radius: 10px; }
.auth-brand span { font-family: var(--font-display); font-weight: 700; font-size: 20px; color: #fff; }
.auth-quote { position: relative; z-index: 1; color: #fff; max-width: 460px; }
.auth-quote h2 { font-size: 30px; line-height: 1.25; margin-bottom: 16px; }
.auth-quote p { color: rgba(255,255,255,0.7); font-size: 15px; line-height: 1.6; }
.auth-pulse-line { position: relative; z-index: 1; height: 90px; }
.auth-form-side {
  display: flex; align-items: center; justify-content: center; padding: 32px; background: var(--bg);
}
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 26px; margin-bottom: 8px; }
.auth-card .sub { color: var(--text-secondary); font-size: 14px; margin-bottom: 28px; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text-tertiary); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-foot { margin-top: 22px; text-align: center; font-size: 13px; color: var(--text-secondary); }
.auth-foot a { color: var(--brand-start); font-weight: 600; }
.company-mock-list { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; position: relative; z-index: 1; }
.company-chip {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); color: rgba(255,255,255,0.85); font-size: 12.5px;
}
.company-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.otp-row { display: flex; gap: 10px; margin-bottom: 20px; }
.otp-row input {
  width: 46px; height: 54px; text-align: center; font-size: 20px; font-family: var(--font-mono);
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
.otp-row input:focus { border-color: var(--brand-start); outline: none; box-shadow: 0 0 0 3px rgba(14,165,233,0.18); }

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
}

/* ============================================================
   APP SHELL
   ============================================================ */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.app-shell.collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

.sidebar {
  background: var(--bg-elevated); border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column; padding: 16px 12px; position: sticky; top: 0; height: 100vh;
  transition: width var(--dur-base) var(--ease);
}
.sidebar-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 20px; }
.sidebar-head img { width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; }
.sidebar-head .brand-name { font-family: var(--font-display); font-weight: 700; font-size: 16px; white-space: nowrap; }
.sidebar-collapse-btn { margin-left: auto; }
.collapsed .sidebar-head .brand-name, .collapsed .nav-label, .collapsed .sidebar-collapse-btn { display: none; }
.collapsed .sidebar-head { justify-content: center; }

.workspace-switcher {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 10px;
  border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  margin-bottom: 18px; text-align: left;
}
.workspace-switcher:hover { background: var(--surface-hover); }
.workspace-avatar {
  width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.workspace-meta { display: flex; flex-direction: column; overflow: hidden; }
.workspace-meta strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workspace-meta span { font-size: 11.5px; color: var(--text-tertiary); }
.workspace-switcher .chev { margin-left: auto; color: var(--text-tertiary); }
.collapsed .workspace-switcher { justify-content: center; }
.collapsed .workspace-meta, .collapsed .workspace-switcher .chev { display: none; }

.nav-section { margin-bottom: 4px; }
.nav-section-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-tertiary); padding: 14px 12px 6px; font-weight: 700; }
.collapsed .nav-section-label { display: none; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 13.5px; font-weight: 500; cursor: pointer; position: relative;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--surface-2); color: var(--brand-start); font-weight: 700; }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 3px; background: var(--brand-gradient);
}
.nav-item .icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item .count { margin-left: auto; font-size: 11px; background: var(--surface-2); color: var(--text-secondary); padding: 1px 7px; border-radius: 999px; font-weight: 700; }
.collapsed .nav-item { justify-content: center; }
.collapsed .nav-item .count { display: none; }

.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border-soft); }

.topbar {
  height: var(--topbar-h); border-bottom: 1px solid var(--border-soft); background: var(--bg-elevated);
  display: flex; align-items: center; gap: 14px; padding: 0 22px; position: sticky; top: 0; z-index: 20;
}
.topbar-search {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-tertiary); font-size: 13px;
  width: 320px; cursor: pointer;
}
.topbar-search kbd {
  margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; background: var(--surface); border: 1px solid var(--border);
  padding: 2px 6px; border-radius: 5px; color: var(--text-tertiary);
}
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); border: 1px solid transparent; cursor: pointer; position: relative;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.icon-btn .dot-badge { position: absolute; top: 5px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--bg-elevated); }
.profile-btn { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px; border-radius: 999px; }
.profile-btn:hover { background: var(--surface-2); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--brand-gradient); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0;
}

.main-content { padding: 26px 30px 60px; max-width: 1400px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; }
.page-head .sub { color: var(--text-secondary); font-size: 13.5px; margin-top: 4px; }
.page-head-actions { display: flex; gap: 10px; }

.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-tertiary); margin-bottom: 10px; }
.breadcrumb a:hover { color: var(--brand-start); }

/* ---------- Bottom nav (mobile) ---------- */
.bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: var(--bg-elevated); border-top: 1px solid var(--border-soft);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  align-items: center; justify-content: space-around;
}
.bottom-nav-item { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--text-tertiary); font-size: 10.5px; padding: 4px 10px; border-radius: 10px; }
.bottom-nav-item.active { color: var(--brand-start); }
.mobile-topbar { display: none; }

@media (max-width: 900px) {
  .app-shell, .app-shell.collapsed { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .bottom-nav { display: flex; }
  .topbar-search { width: 100%; }
  .main-content { padding: 18px 16px 90px; }
  .topbar { padding: 0 14px; }
}

/* ============================================================
   WIDGETS / DASHBOARD
   ============================================================ */
.grid { display: grid; gap: 18px; }
.grid-stats { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: 2fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1100px) { .grid-stats { grid-template-columns: repeat(2, 1fr); } .grid-2, .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .grid-stats { grid-template-columns: 1fr 1fr; } }

.stat-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-label { font-size: 12.5px; color: var(--text-secondary); font-weight: 600; }
.stat-icon { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.stat-value { font-family: var(--font-mono); font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.stat-trend { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; }
.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }

.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title h3 { font-size: 15.5px; }
.section-title .link { font-size: 12.5px; color: var(--brand-start); font-weight: 600; cursor: pointer; }

.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.list-row:last-child { border-bottom: none; }
.list-row-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.list-row-main { flex: 1; min-width: 0; }
.list-row-main strong { display: block; font-size: 13.5px; font-weight: 600; }
.list-row-main span { font-size: 12px; color: var(--text-tertiary); }
.list-row-meta { text-align: right; font-size: 12px; color: var(--text-tertiary); white-space: nowrap; }

.region-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.region-cell { padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); display: flex; flex-direction: column; gap: 6px; }
.region-cell .rc-top { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; font-weight: 600; }
.region-cell .rc-latency { font-family: var(--font-mono); font-size: 18px; }

/* ============================================================
   WEBSITES
   ============================================================ */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar-search { flex: 1; min-width: 200px; }
.segmented { display: flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; }
.segmented button { border: none; background: transparent; padding: 6px 12px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); cursor: pointer; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.filter-chip {
  display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); font-size: 12.5px; color: var(--text-secondary); cursor: pointer; font-weight: 600;
}
.filter-chip:hover { border-color: var(--brand-start); }
.filter-chip.active { background: var(--brand-gradient); color: #fff; border-color: transparent; }

.website-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.website-card { padding: 18px; cursor: pointer; transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast); }
.website-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border); }
.wc-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.wc-favicon { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex-shrink: 0; }
.wc-title { flex: 1; min-width: 0; }
.wc-title strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wc-title span { font-size: 11.5px; color: var(--text-tertiary); }
.wc-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.wc-metric { text-align: center; padding: 8px 4px; border-radius: var(--radius-sm); background: var(--surface-2); }
.wc-metric b { display: block; font-family: var(--font-mono); font-size: 14.5px; }
.wc-metric span { font-size: 10.5px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.03em; }
.sparkline { width: 100%; height: 34px; }
.wc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; font-size: 11.5px; color: var(--text-tertiary); }
.website-list-row { display: grid; grid-template-columns: 2.2fr 1fr 1fr 1fr 1fr 0.8fr; align-items: center; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--border-soft); cursor: pointer; font-size: 13px; }
.website-list-row:hover { background: var(--surface-2); }
.website-list-head { display: grid; grid-template-columns: 2.2fr 1fr 1fr 1fr 1fr 0.8fr; gap: 12px; padding: 0 18px 10px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-tertiary); font-weight: 700; }
@media (max-width: 900px) { .website-list-row, .website-list-head { grid-template-columns: 2fr 1fr 1fr; } .wl-hide { display: none; } }

/* ---------- Website detail ---------- */
.score-ring-row { display: flex; gap: 22px; flex-wrap: wrap; }
.score-ring { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.score-ring span { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.detail-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.kv-item span { display: block; font-size: 11.5px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 3px; }
.kv-item strong { font-size: 14px; font-family: var(--font-mono); font-weight: 600; }

/* ============================================================
   TABS
   ============================================================ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-soft); margin-bottom: 20px; overflow-x: auto; }
.tab-btn { padding: 11px 16px; font-size: 13.5px; font-weight: 600; color: var(--text-secondary); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--brand-start); border-color: var(--brand-start); }

/* ============================================================
   INCIDENTS / TIMELINE
   ============================================================ */
.incident-row { display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--border-soft); cursor: pointer; }
.incident-row:hover .incident-title { color: var(--brand-start); }
.incident-sev { width: 8px; border-radius: 4px; flex-shrink: 0; align-self: stretch; }
.incident-title { font-size: 14.5px; font-weight: 700; margin-bottom: 4px; }
.incident-meta { font-size: 12px; color: var(--text-tertiary); display: flex; gap: 10px; flex-wrap: wrap; }

.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-bottom: 22px; }
.timeline-item::before { content: ""; position: absolute; left: -26px; top: 3px; width: 13px; height: 13px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand-start); }
.timeline-item time { font-size: 11.5px; color: var(--text-tertiary); font-family: var(--font-mono); }
.timeline-item p { font-size: 13.5px; margin-top: 4px; line-height: 1.5; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert-row { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: var(--radius-md); border: 1px solid var(--border-soft); margin-bottom: 10px; }
.alert-row.unread { background: var(--surface-2); }
.alert-channel { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--surface-2); }
.alert-main { flex: 1; min-width: 0; }
.alert-main strong { font-size: 13.5px; }
.alert-main p { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }
.alert-time { font-size: 11.5px; color: var(--text-tertiary); white-space: nowrap; }

/* ============================================================
   TEAM
   ============================================================ */
.member-row { display: grid; grid-template-columns: 2.5fr 1fr 1fr 1fr; align-items: center; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.member-row-head { display: grid; grid-template-columns: 2.5fr 1fr 1fr 1fr; gap: 12px; padding: 0 18px 10px; font-size: 11px; text-transform: uppercase; color: var(--text-tertiary); font-weight: 700; letter-spacing: 0.04em; }
.member-id { display: flex; align-items: center; gap: 10px; }
.member-id strong { display: block; font-size: 13.5px; }
.member-id span { font-size: 11.5px; color: var(--text-tertiary); }
@media (max-width: 700px) { .member-row, .member-row-head { grid-template-columns: 2fr 1fr; } .mr-hide { display: none; } }

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-layout { display: grid; grid-template-columns: 220px 1fr; gap: 26px; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 84px; }
.settings-nav button { text-align: left; padding: 9px 12px; border-radius: var(--radius-sm); border: none; background: transparent; color: var(--text-secondary); font-size: 13.5px; font-weight: 500; cursor: pointer; }
.settings-nav button:hover { background: var(--surface-2); color: var(--text); }
.settings-nav button.active { background: var(--surface-2); color: var(--brand-start); font-weight: 700; }
@media (max-width: 800px) { .settings-layout { grid-template-columns: 1fr; } .settings-nav { position: static; flex-direction: row; overflow-x: auto; } }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border-soft); }
.row-between:last-child { border-bottom: none; }
.row-between strong { font-size: 13.5px; display: block; }
.row-between p { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }

.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: var(--border); border-radius: 999px; cursor: pointer; transition: background var(--dur-fast); }
.slider::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform var(--dur-fast); }
.switch input:checked + .slider { background: var(--brand-gradient); }
.switch input:checked + .slider::before { transform: translateX(18px); }

.theme-options { display: flex; gap: 12px; }
.theme-opt { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px; cursor: pointer; width: 96px; }
.theme-opt.active { border-color: var(--brand-start); box-shadow: 0 0 0 3px rgba(14,165,233,0.18); }
.theme-opt .swatch { height: 46px; border-radius: 7px; margin-bottom: 8px; }
.theme-opt span { font-size: 12px; font-weight: 600; }

.api-key-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--border-soft); border-radius: var(--radius-sm); margin-bottom: 10px; }
.api-key-row code { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-secondary); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.integration-card { display: flex; align-items: center; gap: 12px; padding: 16px; }
.integration-card .ic-logo { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--surface-2); }
.integration-card .ic-main { flex: 1; }
.integration-card .ic-main strong { font-size: 13.5px; display: block; }
.integration-card .ic-main span { font-size: 12px; color: var(--text-tertiary); }

/* ============================================================
   PUBLIC STATUS PAGE
   ============================================================ */
.status-public { min-height: 100vh; background: var(--bg); }
.status-header { max-width: 860px; margin: 0 auto; padding: 48px 20px 20px; text-align: center; }
.status-header img { width: 44px; height: 44px; border-radius: 12px; margin-bottom: 14px; }
.status-banner { max-width: 860px; margin: 0 auto 24px; padding: 18px 20px; border-radius: var(--radius-lg); display: flex; align-items: center; gap: 12px; font-weight: 700; }
.status-banner.ok { background: var(--success-bg); color: var(--success); }
.status-banner.warn { background: var(--warning-bg); color: var(--warning); }
.status-body { max-width: 860px; margin: 0 auto; padding: 0 20px 60px; }
.status-service-row { display: flex; align-items: center; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--border-soft); }
.status-service-row .ssr-name { flex: 1; font-size: 14px; font-weight: 600; }
.uptime-bars { display: flex; gap: 2px; height: 30px; align-items: flex-end; }
.uptime-bar { flex: 1; min-width: 2px; border-radius: 2px; background: var(--success); }
.status-region-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 12px; margin: 24px 0; }

/* ============================================================
   MODALS / DRAWERS / OVERLAYS
   ============================================================ */
.overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 90; opacity: 0; pointer-events: none; transition: opacity var(--dur-base) var(--ease); backdrop-filter: blur(2px); }
.overlay.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 460px; max-width: 92vw; background: var(--bg-elevated);
  border-left: 1px solid var(--border-soft); z-index: 95; transform: translateX(100%); transition: transform var(--dur-slow) var(--ease);
  overflow-y: auto; box-shadow: var(--shadow-lg);
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border-soft); position: sticky; top: 0; background: var(--bg-elevated); z-index: 2; }
.drawer-body { padding: 22px; }

.modal-center { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 96; pointer-events: none; padding: 20px; }
.modal-box { background: var(--bg-elevated); border: 1px solid var(--border-soft); border-radius: var(--radius-lg); width: 100%; max-width: 460px; box-shadow: var(--shadow-lg); transform: scale(0.96) translateY(8px); opacity: 0; transition: transform var(--dur-base) var(--ease), opacity var(--dur-base); pointer-events: none; }
.modal-center.open .modal-box { transform: scale(1) translateY(0); opacity: 1; pointer-events: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border-soft); }
.modal-body { padding: 20px; }
.modal-foot { padding: 16px 20px; border-top: 1px solid var(--border-soft); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Command palette ---------- */
.command-palette { max-width: 560px; align-items: flex-start; margin-top: 10vh; }
.command-palette .modal-box { max-width: 560px; }
.cp-input-row { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border-soft); }
.cp-input-row input { flex: 1; border: none; background: transparent; font-size: 15px; color: var(--text); outline: none; }
.cp-results { max-height: 380px; overflow-y: auto; padding: 8px; }
.cp-group-label { font-size: 11px; text-transform: uppercase; color: var(--text-tertiary); font-weight: 700; padding: 10px 10px 4px; }
.cp-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13.5px; }
.cp-item:hover, .cp-item.sel { background: var(--surface-2); }
.cp-item .cp-icon { width: 28px; height: 28px; border-radius: 7px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cp-item kbd { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-tertiary); }

/* ---------- Notification panel ---------- */
.notif-panel { position: fixed; top: 68px; right: 22px; width: 360px; max-width: 90vw; background: var(--bg-elevated); border: 1px solid var(--border-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); z-index: 92; max-height: 70vh; overflow-y: auto; opacity: 0; transform: translateY(-6px); pointer-events: none; transition: all var(--dur-base) var(--ease); }
.notif-panel.open { opacity: 1; transform: translateY(0); pointer-events: auto; }

/* ---------- Toasts ---------- */
.toast-region { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.toast { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-radius: var(--radius-md); background: var(--bg-elevated); border: 1px solid var(--border-soft); box-shadow: var(--shadow-lg); font-size: 13.5px; min-width: 260px; animation: toast-in var(--dur-base) var(--ease); }
.toast .ti { width: 20px; height: 20px; flex-shrink: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.toast.leaving { animation: toast-out var(--dur-base) var(--ease) forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px) scale(0.98); } }

/* ---------- Offline banner ---------- */
.offline-banner { position: sticky; top: 0; z-index: 210; background: var(--warning); color: #1b1400; font-size: 13px; font-weight: 700; padding: 9px 16px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.offline-dot { width: 8px; height: 8px; border-radius: 50%; background: #1b1400; animation: pulse-dot 1.4s infinite; }
@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ---------- Install prompt ---------- */
.install-prompt { position: fixed; bottom: 20px; left: 20px; z-index: 150; display: flex; align-items: center; gap: 12px; background: var(--bg-elevated); border: 1px solid var(--border-soft); box-shadow: var(--shadow-lg); border-radius: var(--radius-lg); padding: 14px; max-width: 360px; animation: toast-in var(--dur-slow) var(--ease); }
.install-copy { display: flex; flex-direction: column; font-size: 12.5px; }
.install-copy strong { font-size: 13.5px; }
.install-copy span { color: var(--text-secondary); }
@media (max-width: 700px) { .install-prompt { left: 12px; right: 12px; bottom: 78px; max-width: none; } }

/* ---------- Empty states / skeletons ---------- */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.empty-state .es-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.empty-state h3 { font-size: 16px; margin-bottom: 6px; color: var(--text); }
.empty-state p { font-size: 13.5px; max-width: 340px; margin-bottom: 16px; }

.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-hover) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: skeleton-loading 1.4s ease infinite; border-radius: var(--radius-sm); }
@keyframes skeleton-loading { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Tooltip ---------- */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); font-size: 11.5px; font-weight: 600; padding: 5px 9px; border-radius: 6px;
  white-space: nowrap; z-index: 60; pointer-events: none;
}

/* ---------- Chart legend ---------- */
.legend { display: flex; gap: 16px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; }

/* ---------- FAB ---------- */
.fab { position: fixed; bottom: 26px; right: 26px; width: 52px; height: 52px; border-radius: 50%; background: var(--brand-gradient); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 26px -8px rgba(14,165,233,0.6); cursor: pointer; z-index: 40; border: none; }
@media (max-width: 900px) { .fab { bottom: 84px; } }

/* ---------- Utility ---------- */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-mono { font-family: var(--font-mono); }
.text-sm { font-size: 12.5px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.w-full { width: 100%; }
.fade-in { animation: fade-in var(--dur-slow) var(--ease); }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Confetti */
.confetti-piece { position: fixed; top: -10px; z-index: 300; border-radius: 2px; pointer-events: none; animation: confetti-fall linear forwards; }
@keyframes confetti-fall { to { transform: translateY(105vh) rotate(540deg); opacity: 0.4; } }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }
