/* ============================================================
   Uptime Tracker — design system
   Dark-first, light theme via [data-theme="light"]
   ============================================================ */

:root {
  --font: "Inter", "SF Pro Text", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* brand */
  --brand-h: 224;   /* indigo-blue */
  --brand-s: 82%;
  --brand-l: 58%;
  --brand: hsl(var(--brand-h) var(--brand-s) var(--brand-l));
  --brand-strong: hsl(var(--brand-h) calc(var(--brand-s) * 1.05) calc(var(--brand-l) - 8%));
  --brand-soft: hsl(var(--brand-h) var(--brand-s) var(--brand-l) / 0.14);
  --accent: hsl(168 84% 56%);
  --accent-soft: hsl(168 84% 56% / 0.13);

  /* status */
  --up: #22c55e;
  --up-soft: hsl(142 76% 45% / 0.13);
  --down: #ef4444;
  --down-soft: hsl(0 84% 60% / 0.13);
  --warn: #f59e0b;
  --warn-soft: hsl(38 92% 50% / 0.13);
  --muted-status: #94a3b8;
  --muted-soft: hsl(215 16% 47% / 0.14);

  /* surfaces — dark */
  --bg: #0b0e17;
  --bg-soft: #10141f;
  --surface: #151a28;
  --surface-2: #1b2133;
  --surface-3: #222a3f;
  --border: #262e45;
  --border-soft: #1e2540;

  --text: #e7eaf3;
  --text-2: #a3adc7;
  --text-3: #6b7591;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
  --shadow-md: 0 8px 24px -6px rgb(0 0 0 / .5);
  --shadow-lg: 0 24px 60px -12px rgb(0 0 0 / .6);
  --glow-up: 0 0 18px hsl(142 76% 45% / .35);
  --glow-down: 0 0 18px hsl(0 84% 60% / .35);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;

  --grad-brand: linear-gradient(135deg, hsl(224 82% 62%), hsl(262 70% 62%));
  --grad-hero: radial-gradient(1200px 500px at 20% -10%, hsl(224 80% 60% / .22), transparent 60%),
               radial-gradient(900px 420px at 85% -20%, hsl(262 78% 60% / .16), transparent 55%);

  --sidebar-w: 244px;
  --topbar-h: 60px;
}

[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-soft: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f7f9fd;
  --surface-3: #eef1f9;
  --border: #dfe4f0;
  --border-soft: #e9edf6;

  --text: #10162b;
  --text-2: #46506e;
  --text-3: #818aa5;

  --shadow-sm: 0 1px 2px rgb(16 22 43 / .06);
  --shadow-md: 0 10px 30px -10px rgb(16 22 43 / .14);
  --shadow-lg: 0 30px 70px -20px rgb(16 22 43 / .2);
  --glow-up: 0 4px 18px hsl(142 76% 45% / .28);
  --glow-down: 0 4px 18px hsl(0 84% 60% / .28);
  --grad-hero: radial-gradient(1200px 500px at 20% -10%, hsl(224 82% 62% / .12), transparent 60%),
               radial-gradient(900px 420px at 85% -20%, hsl(262 78% 60% / .10), transparent 55%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: hsl(var(--brand-h) var(--brand-s) 60% / .35); }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; }
*::-webkit-scrollbar-track { background: transparent; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; cursor: pointer; }

input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px hsl(var(--brand-h) var(--brand-s) var(--brand-l) / .18);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
textarea { resize: vertical; min-height: 74px; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23818aa5' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
label { font-size: 12.5px; font-weight: 600; color: var(--text-2); display: block; margin-bottom: 6px; letter-spacing: .02em; }
.field { margin-bottom: 16px; }
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 5px; font-weight: 400; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600; font-size: 13.5px;
  padding: 9px 16px;
  border-radius: 10px;
  transition: all .15s;
  white-space: nowrap;
  user-select: none;
}
.btn:hover { background: var(--surface-3); border-color: var(--border); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: 15px; height: 15px; }

.btn-primary {
  background: var(--grad-brand);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 16px -4px hsl(var(--brand-h) var(--brand-s) var(--brand-l) / .5);
}
.btn-primary:hover { filter: brightness(1.08); background: var(--grad-brand); }

.btn-danger { background: hsl(0 84% 60% / .12); border-color: hsl(0 84% 60% / .35); color: #f87171; }
.btn-danger:hover { background: hsl(0 84% 60% / .2); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { padding: 12px 22px; font-size: 15px; border-radius: 12px; }

/* dropdown */
/* The actions block is lifted into its own stacking context so the open menu
   always paints above the monitor cards below it (positioned cards with
   transforms/hover effects can otherwise cover it). */
.page-head .actions { position: relative; z-index: 100; }
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 180px; z-index: 110;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 11px; box-shadow: var(--shadow-md); padding: 5px;
  display: none;
}
.dropdown.open .dropdown-menu { display: block; animation: fadeIn .12s ease; }
.dropdown-item {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  background: none; border: none; color: var(--text);
  padding: 8px 11px; border-radius: 8px; font-size: 13px; font-weight: 550;
}
.dropdown-item:hover { background: var(--surface-3); }
.dropdown-item svg { width: 15px; height: 15px; color: var(--text-3); }
.dropdown-item .k { margin-left: auto; font-size: 10.5px; color: var(--text-3); font-weight: 700; letter-spacing: .04em; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-2);
  transition: all .15s;
}
.icon-btn:hover { color: var(--text); background: var(--surface-3); }
.icon-btn svg { width: 16px; height: 16px; }

/* ---------- app shell ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-soft);
  border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  padding: 18px 14px;
  z-index: 40;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 4px 8px 18px;
  font-weight: 700; font-size: 16px; letter-spacing: -.01em;
}
.brand[role="button"] { cursor: pointer; border-radius: 10px; transition: opacity .15s, background .15s; }
.brand[role="button"]:hover { opacity: .88; background: var(--surface-2); }
.brand[role="button"]:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--grad-brand);
  display: grid; place-items: center;
  box-shadow: 0 4px 14px -2px hsl(var(--brand-h) var(--brand-s) var(--brand-l) / .55);
  flex-shrink: 0;
}
.brand-logo svg { width: 20px; height: 20px; color: #fff; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-3); padding: 14px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: 10px;
  color: var(--text-2); font-weight: 550; font-size: 13.5px;
  transition: all .13s; cursor: pointer; border: none; background: none; text-align: left; width: 100%;
}
.nav-item svg { width: 17px; height: 17px; opacity: .85; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); }
.nav-item.active svg { opacity: 1; }
.nav-badge {
  margin-left: auto; font-size: 11px; font-weight: 700;
  background: var(--surface-3); color: var(--text-2);
  border-radius: 20px; padding: 1px 8px;
}
.nav-badge.danger { background: var(--down-soft); color: var(--down); }

.sidebar-foot { border-top: 1px solid var(--border-soft); padding-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.sidebar-foot .user { display: flex; align-items: center; gap: 10px; padding: 6px 8px; color: var(--text-2); font-size: 12.5px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--grad-brand); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 26px;
  border-bottom: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 30;
}
.topbar-title { font-weight: 650; font-size: 15.5px; }
.topbar-spacer { flex: 1; }
.topbar .pill { font-size: 12px; padding: 5px 11px; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); display: inline-flex; gap: 7px; align-items: center; }

.content { padding: 26px; max-width: 1280px; width: 100%; margin: 0 auto; flex: 1; }

/* ---------- hero / header ---------- */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; position: relative; z-index: 50; }
.page-head h1 { font-size: 23px; font-weight: 750; letter-spacing: -.02em; }
.page-head .sub { color: var(--text-2); font-size: 13.5px; margin-top: 3px; }
.page-head .actions { margin-left: auto; display: flex; gap: 9px; }

.hero {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  overflow: hidden;
  margin-bottom: 22px;
}
.hero::before { content: ""; position: absolute; inset: 0; background: var(--grad-hero); pointer-events: none; }
.hero > * { position: relative; }

.hero-top { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 15px;
  padding: 9px 16px; border-radius: 30px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.hero-badge.good { color: var(--up); border-color: hsl(142 76% 45% / .35); background: var(--up-soft); box-shadow: var(--glow-up); }
.hero-badge.bad  { color: var(--down); border-color: hsl(0 84% 60% / .35); background: var(--down-soft); box-shadow: var(--glow-down); }
.hero-badge.warn { color: var(--warn); border-color: hsl(38 92% 50% / .35); background: var(--warn-soft); }
.hero-stats { display: flex; gap: 12px; margin-left: auto; flex-wrap: wrap; }

.stat-chip {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 16px; min-width: 108px;
}
.stat-chip .v { font-size: 20px; font-weight: 750; letter-spacing: -.02em; }
.stat-chip .k { font-size: 11px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }
.stat-chip .v.green { color: var(--up); }
.stat-chip .v.red { color: var(--down); }
.stat-chip .v.amber { color: var(--warn); }

.hero-big { margin-top: 20px; display: flex; align-items: flex-end; gap: 26px; flex-wrap: wrap; }
.hero-uptime { display: flex; align-items: center; gap: 18px; }
.hero-uptime .num { font-size: 44px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.hero-uptime .cap { color: var(--text-3); font-size: 12.5px; max-width: 240px; margin-top: 6px; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h3 { font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; }
.card-head .spacer { flex: 1; }
.card-head .tag { font-size: 11px; color: var(--text-3); font-weight: 600; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1100px) { .grid-4, .grid-stats { grid-template-columns: repeat(2, minmax(0,1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 680px)  { .grid-2, .grid-3, .grid-4, .grid-stats { grid-template-columns: 1fr; } }

/* ---------- monitor cards ---------- */
.monitor-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }

/* status filter chips */
.filter-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }

/* bulk edit */
.mc-check { display: none; align-items: center; }
.bulk-mode .mc-check { display: inline-flex; }
.bulk-mode .monitor-card { cursor: pointer; }
.monitor-card.selected { outline: 2px solid var(--brand); outline-offset: 2px; }
.bulk-bar {
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: 12px;
  background: var(--brand-soft); border: 1px solid var(--brand);
}
.bulk-bar .bulk-count { font-weight: 750; font-size: 13px; color: var(--brand); }
.bulk-bar .spacer { flex: 1; }
.bulk-bar .btn { padding: 5px 11px; font-size: 12px; }
.bulk-bar:not(.has-sel) .needs-selection { opacity: .45; pointer-events: none; }
.be-row { display: grid; grid-template-columns: auto 1fr 190px; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px dashed var(--border-soft); }
.be-row:last-child { border-bottom: none; }
.be-row label { margin: 0; }
.be-row input[type="checkbox"] { width: auto; }.filter-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px; border-radius: 20px; font-size: 12.5px; font-weight: 650;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
  cursor: pointer; transition: all .15s; user-select: none;
}
.filter-chip:hover { border-color: var(--brand); color: var(--text); transform: translateY(-1px); }
.filter-chip .n {
  font-size: 11px; font-weight: 700; line-height: 1;
  background: var(--surface-3); border-radius: 20px; padding: 3px 7px; min-width: 20px; text-align: center;
}
.filter-chip.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.filter-chip.active .n { background: var(--brand); color: #fff; }
.filter-chip[data-key="up"].active { background: var(--up-soft); border-color: var(--up); color: var(--up); }
.filter-chip[data-key="up"].active .n { background: var(--up); }
.filter-chip[data-key="down"].active { background: var(--down-soft); border-color: var(--down); color: var(--down); }
.filter-chip[data-key="down"].active .n { background: var(--down); }
.filter-chip[data-key="paused"].active { background: var(--muted-soft); border-color: var(--muted-status); color: var(--text-2); }
.filter-chip[data-key="paused"].active .n { background: var(--muted-status); color: #fff; }
.monitor-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  transition: transform .16s, box-shadow .16s, border-color .16s;
  position: relative; overflow: hidden;
}
.monitor-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border); }
.monitor-card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--muted-status);
}
.monitor-card.up::before { background: var(--up); box-shadow: var(--glow-up); }
.monitor-card.down::before { background: var(--down); box-shadow: var(--glow-down); }
.monitor-card.paused { opacity: .72; }
.monitor-card.paused::before { background: var(--muted-status); box-shadow: none; }

.mc-top { display: flex; align-items: center; gap: 10px; }
.mc-name { font-weight: 700; font-size: 14.5px; letter-spacing: -.01em; }
.mc-url { color: var(--text-3); font-size: 12px; font-family: var(--mono); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-top .spacer { flex: 1; }

.status-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  background: var(--muted-status);
}
.status-dot.up { background: var(--up); box-shadow: 0 0 0 3px var(--up-soft), var(--glow-up); }
.status-dot.down { background: var(--down); box-shadow: 0 0 0 3px var(--down-soft), var(--glow-down); }
.status-dot.unknown { background: var(--muted-status); box-shadow: 0 0 0 3px var(--muted-soft); }
.pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .03em;
  padding: 3.5px 10px; border-radius: 20px; text-transform: uppercase;
}
.status-pill.up { color: var(--up); background: var(--up-soft); }
.status-pill.down { color: var(--down); background: var(--down-soft); }
.status-pill.unknown { color: var(--text-2); background: var(--muted-soft); }
.status-pill.paused { color: var(--text-2); background: var(--muted-soft); }

.mc-body { display: flex; align-items: flex-end; gap: 16px; margin-top: 12px; }
.mc-chart { flex: 1; height: 44px; min-width: 0; }
.mc-numbers { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0; }
.mc-uptime { font-size: 17px; font-weight: 750; letter-spacing: -.02em; }
.mc-latency { font-size: 11.5px; color: var(--text-3); font-family: var(--mono); }
.mc-foot { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding-top: 11px; border-top: 1px dashed var(--border-soft); font-size: 12px; color: var(--text-3); }
.mc-foot .spacer { flex: 1; }
.mc-foot .btn { padding: 3px 9px; font-size: 11.5px; }

/* ---------- status table ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-3); font-weight: 700; padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table .mono { font-family: var(--mono); font-size: 12.5px; }
.table .rowlink { cursor: pointer; }
.table .rowlink:hover td { background: var(--surface-2); }

/* ---------- charts ---------- */
.chart-box { position: relative; width: 100%; }
.chart-box svg { display: block; width: 100%; height: 100%; }
.area-fill { fill: url(#areaGrad); }
.area-line { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.down-band { fill: hsl(0 84% 60% / .13); }
.down-line { stroke: var(--down); stroke-width: 1.2; stroke-dasharray: 3 3; opacity: .8; }

.donut-wrap { display: flex; align-items: center; gap: 22px; }
.donut { position: relative; width: 130px; height: 130px; flex-shrink: 0; }
.donut svg { transform: rotate(-90deg); }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.donut-center .pct { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.donut-center .lbl { font-size: 10px; color: var(--text-3); font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.donut-track { stroke: var(--surface-3); }
.donut-val { stroke: var(--brand); stroke-linecap: round; transition: stroke-dashoffset .8s cubic-bezier(.22,1,.36,1); }
.donut-val.up { stroke: var(--up); }
.donut-val.down { stroke: var(--down); }
.donut-val.warn { stroke: var(--warn); }

.legend { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; color: var(--text-2); }
.legend .row { display: flex; align-items: center; gap: 8px; }
.legend .swatch { width: 10px; height: 10px; border-radius: 3px; }
.legend .row .v { margin-left: auto; font-weight: 700; color: var(--text); font-family: var(--mono); font-size: 12px; }

.chart-tooltip {
  position: absolute; pointer-events: none; z-index: 20;
  background: var(--surface-3); color: var(--text);
  border: 1px solid var(--border);
  border-radius: 9px; padding: 8px 11px; font-size: 12px;
  box-shadow: var(--shadow-md); white-space: nowrap;
  transform: translate(-50%, -110%);
  opacity: 0; transition: opacity .12s;
}
.chart-tooltip.show { opacity: 1; }
.chart-tooltip .tt-t { font-weight: 700; margin-bottom: 2px; }
.chart-tooltip .tt-d { color: var(--text-2); }

/* uptime daily bars */
.daily-bars { display: flex; gap: 3px; align-items: flex-end; height: 74px; }
.daily-bar {
  flex: 1; min-width: 3px; border-radius: 3px 3px 1px 1px;
  background: var(--surface-3); position: relative; transition: background .2s;
}
.daily-bar:hover { filter: brightness(1.3); }
.daily-bar.good { background: hsl(142 76% 45%); }
.daily-bar.mid { background: hsl(38 92% 50%); }
.daily-bar.bad { background: hsl(0 84% 60%); }
.daily-bar.empty { background: var(--surface-3); opacity: .5; }
.daily-bar .tip {
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--surface-3); border: 1px solid var(--border);
  padding: 5px 9px; border-radius: 7px; font-size: 11px; white-space: nowrap;
  opacity: 0; transition: opacity .12s; pointer-events: none; z-index: 10;
}
.daily-bar:hover .tip { opacity: 1; }

/* ---------- incidents / timeline ---------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--border); border-radius: 2px; }
.tl-item { position: relative; padding: 0 0 22px 14px; }
.tl-item::before {
  content: ""; position: absolute; left: -26px; top: 4px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--down);
}
.tl-item.resolved::before { border-color: var(--up); }
.tl-item.warn::before { border-color: var(--warn); }
.tl-item .tl-title { font-weight: 650; font-size: 13.5px; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.tl-item .tl-time { font-size: 12px; color: var(--text-3); font-family: var(--mono); margin-top: 2px; }
.tl-item .tl-desc { font-size: 13px; color: var(--text-2); margin-top: 6px; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgb(4 7 15 / .6);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .18s;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  padding: 24px 26px;
  transform: translateY(10px) scale(.98);
  transition: transform .18s cubic-bezier(.22,1,.36,1);
}
.modal-backdrop.open .modal { transform: none; }
.modal.wide { max-width: 680px; }
.modal h2 { font-size: 18px; font-weight: 750; letter-spacing: -.01em; margin-bottom: 4px; }
.modal .m-sub { color: var(--text-2); font-size: 13px; margin-bottom: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 620px) { .form-grid { grid-template-columns: 1fr; } }

/* ---------- login / setup ---------- */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center;
  padding: 24px; position: relative; overflow: hidden;
}
.auth-wrap::before {
  content: ""; position: absolute; inset: 0;
  background: var(--grad-hero), var(--bg);
}
.auth-card {
  position: relative; width: 100%; max-width: 400px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 34px 34px 30px;
  box-shadow: var(--shadow-lg);
}
.auth-card .brand { justify-content: center; padding: 0 0 6px; font-size: 17px; }
.auth-card h1 { font-size: 20px; font-weight: 750; text-align: center; letter-spacing: -.02em; margin-top: 6px; }
.auth-card .a-sub { text-align: center; color: var(--text-2); font-size: 13px; margin: 6px 0 24px; }
.auth-error {
  background: var(--down-soft); color: #f87171; border: 1px solid hsl(0 84% 60% / .3);
  border-radius: 10px; padding: 10px 13px; font-size: 13px; margin-bottom: 16px; display: none;
}
.auth-error.show { display: block; }
.auth-ok {
  background: var(--up-soft); color: var(--up); border: 1px solid hsl(142 76% 45% / .3);
  border-radius: 10px; padding: 10px 13px; font-size: 13px; margin-bottom: 16px;
}

/* ---------- toast ---------- */
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--surface-3); color: var(--text);
  border: 1px solid var(--border); border-left: 3px solid var(--brand);
  border-radius: 11px; padding: 12px 16px; min-width: 240px; max-width: 360px;
  font-size: 13.5px; box-shadow: var(--shadow-md);
  display: flex; gap: 10px; align-items: flex-start;
  animation: toastIn .25s cubic-bezier(.22,1,.36,1);
}
.toast.ok { border-left-color: var(--up); }
.toast.err { border-left-color: var(--down); }
.toast.out { animation: toastOut .3s forwards; }
@keyframes toastIn { from { transform: translateX(30px); opacity: 0; } }
@keyframes toastOut { to { transform: translateX(30px); opacity: 0; } }

/* ---------- switch ---------- */
.switch { position: relative; display: inline-block; width: 40px; height: 23px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; border-radius: 20px;
  background: var(--surface-3); border: 1px solid var(--border);
  transition: .2s; cursor: pointer;
}
.switch .slider::before {
  content: ""; position: absolute; width: 17px; height: 17px; border-radius: 50%;
  left: 2px; top: 2px; background: var(--text-2); transition: .2s;
}
.switch input:checked + .slider { background: var(--brand); border-color: var(--brand); }
.switch input:checked + .slider::before { transform: translateX(17px); background: #fff; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; }
.switch-row + .switch-row { border-top: 1px dashed var(--border-soft); }
.switch-row .sw-label { font-weight: 600; font-size: 13.5px; }
.switch-row .sw-desc { font-size: 12px; color: var(--text-3); margin-top: 1px; }

/* ---------- misc ---------- */
.empty {
  border: 1.5px dashed var(--border); border-radius: var(--radius);
  padding: 44px 24px; text-align: center; color: var(--text-3);
}
.empty .e-icon { font-size: 30px; margin-bottom: 10px; }
.empty h3 { color: var(--text-2); font-weight: 650; font-size: 15px; margin-bottom: 5px; }
.empty p { font-size: 13px; max-width: 380px; margin: 0 auto 16px; }

.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--brand);
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.badge-row { display: flex; gap: 7px; flex-wrap: wrap; }
.tag {
  font-size: 11px; font-weight: 650; padding: 3px 9px; border-radius: 6px;
  background: var(--surface-3); color: var(--text-2); letter-spacing: .02em;
}

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 16px; font-size: 13px; }
.kv .k { color: var(--text-3); font-weight: 600; }
.kv .v { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }

.section-gap { height: 22px; }

.mono { font-family: var(--mono); }
.muted { color: var(--text-3); }
.small { font-size: 12px; }

.text-up { color: var(--up); }
.text-down { color: var(--down); }
.text-warn { color: var(--warn); }

.fade-in { animation: fadeIn .25s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } }

.shimmer { position: relative; overflow: hidden; }
.shimmer::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / .05), transparent);
  animation: shimmer 1.6s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.collapse { max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.collapse.open { max-height: 400px; }

/* mobile */
@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%); transition: transform .2s;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .content { padding: 18px 14px; }
  .topbar { padding: 0 16px; }
  .menu-btn { display: inline-flex !important; }
  .hero { padding: 20px; }
  .hero-stats { margin-left: 0; width: 100%; }
  .hero-big { flex-direction: column; align-items: flex-start; }
}
.menu-btn { display: none; }
