:root {
  color-scheme: light;

  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-raised: #ffffff;
  --surface-sunken: #f2f1ed;
  --ink: #0b0b0b;
  --ink-secondary: #52514e;
  --ink-muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --border-strong: rgba(11, 11, 11, 0.18);
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --accent-wash: rgba(42, 120, 214, 0.10);
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.05), 0 4px 12px rgba(11, 11, 11, 0.04);
  --shadow-raised: 0 8px 28px rgba(11, 11, 11, 0.12);

  --state-up: #0ca30c;
  --state-degraded: #fab219;
  --state-down: #d03b3b;
  --state-maintenance: #5b7fc7;
  --state-paused: #898781;
  --state-pending: #c3c2b7;
  --state-empty: #e6e5e0;

  --up-wash: rgba(12, 163, 12, 0.12);
  --degraded-wash: rgba(250, 178, 25, 0.16);
  --down-wash: rgba(208, 59, 59, 0.12);
  --maintenance-wash: rgba(91, 127, 199, 0.14);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --gap: 16px;

  --float-bg: rgba(252, 252, 251, 0.78);
  --float-border: rgba(11, 11, 11, 0.07);
  --float-shadow:
    0 1px 2px rgba(11, 11, 11, 0.04),
    0 10px 24px -10px rgba(11, 11, 11, 0.18),
    0 24px 56px -28px rgba(11, 11, 11, 0.22);
  --shadow-pop: 0 2px 6px rgba(11, 11, 11, 0.06), 0 16px 40px -12px rgba(11, 11, 11, 0.22);
  --chip-active: #ffffff;
  --hover: rgba(11, 11, 11, 0.045);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-raised: #232322;
    --surface-sunken: #141413;
    --ink: #ffffff;
    --ink-secondary: #c3c2b7;
    --ink-muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.18);
    --accent: #3987e5;
    --accent-wash: rgba(57, 135, 229, 0.16);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-raised: 0 8px 28px rgba(0, 0, 0, 0.55);
    --float-bg: rgba(32, 32, 31, 0.72);
    --float-border: rgba(255, 255, 255, 0.09);
    --float-shadow:
      0 1px 2px rgba(0, 0, 0, 0.5),
      0 10px 26px -10px rgba(0, 0, 0, 0.6),
      0 26px 60px -30px rgba(0, 0, 0, 0.7);
    --shadow-pop: 0 2px 8px rgba(0, 0, 0, 0.5), 0 18px 44px -14px rgba(0, 0, 0, 0.65);
    --chip-active: rgba(255, 255, 255, 0.10);
    --hover: rgba(255, 255, 255, 0.06);
    --state-maintenance: #7b9ae0;
    --state-pending: #4a4a47;
    --state-empty: #262625;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-raised: #232322;
  --surface-sunken: #141413;
  --ink: #ffffff;
  --ink-secondary: #c3c2b7;
  --ink-muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --accent: #3987e5;
  --accent-wash: rgba(57, 135, 229, 0.16);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-raised: 0 8px 28px rgba(0, 0, 0, 0.55);
  --float-bg: rgba(32, 32, 31, 0.72);
  --float-border: rgba(255, 255, 255, 0.09);
  --float-shadow:
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 10px 26px -10px rgba(0, 0, 0, 0.6),
    0 26px 60px -30px rgba(0, 0, 0, 0.7);
  --shadow-pop: 0 2px 8px rgba(0, 0, 0, 0.5), 0 18px 44px -14px rgba(0, 0, 0, 0.65);
  --chip-active: rgba(255, 255, 255, 0.10);
  --hover: rgba(255, 255, 255, 0.06);
  --state-maintenance: #7b9ae0;
  --state-pending: #4a4a47;
  --state-empty: #262625;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; }
h1 { font-size: 1.5rem; letter-spacing: -0.015em; }
h2 { font-size: 1.125rem; letter-spacing: -0.01em; }
h3 { font-size: 0.9375rem; }
p { margin: 0 0 0.75em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ── Floating chrome ─────────────────────────────────────────────────────
   The shell is one scrolling column. Everything else — brand, navigation,
   the cog and the user menu — floats above it in a fixed bar.            */

.app-frame { min-height: 100vh; }

.float-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 18px 14px;
  pointer-events: none;
}

.float-bar > * { pointer-events: auto; }
.bar-left { justify-self: start; min-width: 0; }
.bar-centre { justify-self: center; }
.bar-right { justify-self: end; display: flex; align-items: center; gap: 10px; }

.float {
  position: relative;
  border-radius: 999px;
  background: var(--float-bg);
  border: 1px solid var(--float-border);
  box-shadow: var(--float-shadow);
}

/* A floating control must not become a stacking context, or the halo below
   it paints in front of its own background. */
.float:active:not(:disabled) { transform: none; }

/* ── Radial halo ─────────────────────────────────────────────────────────
   Blurs the page behind each floating control and fades that blur out in a
   soft ring around it, so the control reads as hovering. To remove the
   effect, set data-halo="off" on <html> in index.html. Nothing else
   depends on it.                                                         */
@supports (mask-image: radial-gradient(#000, transparent)) or (-webkit-mask-image: radial-gradient(#000, transparent)) {
  :root:not([data-halo="off"]) .float::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: -20px -26px;
    border-radius: inherit;
    backdrop-filter: blur(14px) saturate(1.3);
    -webkit-backdrop-filter: blur(14px) saturate(1.3);
    -webkit-mask-image: radial-gradient(ellipse at center, #000 34%, rgba(0, 0, 0, 0.5) 64%, transparent 100%);
    mask-image: radial-gradient(ellipse at center, #000 34%, rgba(0, 0, 0, 0.5) 64%, transparent 100%);
    pointer-events: none;
  }
}

:root[data-halo="off"] .float {
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
}

.brand-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 18px 6px 6px;
  color: var(--ink);
  font-weight: 650;
  font-size: 0.9375rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
}

.brand-pill:hover { text-decoration: none; }
.brand-pill span { overflow: hidden; text-overflow: ellipsis; }

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--state-up);
  display: grid;
  place-items: center;
  color: #fff;
  flex: none;
}

.nav-pill { display: flex; align-items: center; gap: 3px; padding: 5px; }

.nav-pill a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--ink-secondary);
  font-size: 0.875rem;
  font-weight: 550;
  white-space: nowrap;
  transition: background 0.14s, color 0.14s;
}

.nav-pill a:hover { background: var(--hover); color: var(--ink); text-decoration: none; }

.nav-pill a[aria-current="page"] {
  background: var(--chip-active);
  color: var(--ink);
  font-weight: 650;
  box-shadow: 0 1px 2px rgba(11, 11, 11, 0.07);
}

.nav-pill svg { flex: none; opacity: 0.75; }
.nav-pill a[aria-current="page"] svg { opacity: 1; }

.float.orb {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: inherit;
  font-weight: 650;
  color: var(--ink-secondary);
  flex: none;
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
}

.float.orb:hover { color: var(--ink); text-decoration: none; }
.float.orb.avatar { background: var(--accent); border-color: transparent; color: var(--accent-ink); font-size: 0.8125rem; }
.float.orb.avatar:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); color: var(--accent-ink); }
.orb .connection-dot { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border: 2px solid var(--page); }

.menu-wrap { position: relative; display: flex; }

.menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  min-width: 238px;
  padding: 6px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-pop);
  z-index: 70;
  animation: menu-in 0.14s ease;
}

@keyframes menu-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.menu-id { display: grid; gap: 2px; padding: 10px 12px 13px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-id strong { font-size: 0.875rem; }
.menu-id span { color: var(--ink-muted); font-size: 0.75rem; }
.menu-id strong, .menu-id span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.menu-label {
  padding: 6px 12px 5px;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  font-weight: 650;
}

.menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  justify-content: flex-start;
  gap: 10px;
  padding: 9px 12px;
  border: none;
  background: transparent;
  border-radius: 10px;
  font: inherit;
  font-weight: 550;
  color: var(--ink-secondary);
  cursor: pointer;
  text-align: left;
}

.menu-item:hover:not(:disabled) { background: var(--surface-sunken); color: var(--ink); text-decoration: none; }
.menu-item svg { flex: none; opacity: 0.8; }
.menu-item.danger { color: var(--state-down); }
.menu-item.danger:hover:not(:disabled) { background: var(--down-wash); }

.theme-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  margin: 0 6px 6px;
  padding: 3px;
  background: var(--surface-sunken);
  border-radius: 11px;
}

.theme-switch button { border: none; background: transparent; padding: 7px 4px; border-radius: 8px; color: var(--ink-muted); }
.theme-switch button:hover:not(:disabled) { background: transparent; color: var(--ink-secondary); }
.theme-switch button[aria-pressed="true"] { background: var(--surface-raised); color: var(--ink); box-shadow: var(--shadow); }

.content {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: calc(94px + env(safe-area-inset-top, 0px)) 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Each route renders into one custom element, which is inline by default.
   Without this the sections inside a view stack with no space between them. */
dashboard-view,
incidents-view,
settings-view,
account-view,
monitor-detail,
monitor-form,
settings-notifications {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
}

/* An inline-flex control would otherwise be stretched by the column above. */
dashboard-view > .segmented,
incidents-view > .segmented,
monitor-detail > .segmented,
settings-notifications > .segmented { align-self: flex-start; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.625rem; }
.page-head .subtitle { display: block; margin-top: 4px; color: var(--ink-muted); font-size: 0.875rem; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.card-body { padding: 20px; }
.card-body.tight { padding: 14px 20px; }

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 17px 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  font-weight: 600;
}

.stat-value { font-size: 1.75rem; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; }
.stat-value.small { font-size: 1.25rem; }
.stat-note { font-size: 0.8125rem; color: var(--ink-secondary); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge svg { flex: none; }
.badge.up { background: var(--up-wash); color: #067506; border-color: rgba(12, 163, 12, 0.3); }
.badge.degraded { background: var(--degraded-wash); color: #8a6000; border-color: rgba(250, 178, 25, 0.45); }
.badge.down { background: var(--down-wash); color: #b02a2a; border-color: rgba(208, 59, 59, 0.3); }
.badge.maintenance { background: var(--maintenance-wash); color: #3f5da0; border-color: rgba(91, 127, 199, 0.35); }
.badge.paused, .badge.pending { background: var(--surface-sunken); color: var(--ink-secondary); border-color: var(--border); }

:root[data-theme="dark"] .badge.up,
:root:not([data-theme="light"]) .badge.up { color: #4ade4a; }
:root[data-theme="dark"] .badge.degraded,
:root:not([data-theme="light"]) .badge.degraded { color: #fab219; }
:root[data-theme="dark"] .badge.down,
:root:not([data-theme="light"]) .badge.down { color: #f08585; }
:root[data-theme="dark"] .badge.maintenance,
:root:not([data-theme="light"]) .badge.maintenance { color: #9db5e9; }

button, .button {
  font: inherit;
  font-weight: 550;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-raised);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.06s;
  white-space: nowrap;
}

button:hover:not(:disabled), .button:hover { background: var(--surface-sunken); text-decoration: none; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
button.primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--accent); }

button.danger { color: var(--state-down); border-color: rgba(208, 59, 59, 0.4); }
button.danger:hover:not(:disabled) { background: var(--down-wash); }
button.ghost { border-color: transparent; background: transparent; }
button.ghost:hover:not(:disabled) { background: var(--surface-sunken); }
button.small { padding: 5px 11px; font-size: 0.8125rem; }
button.icon { padding: 8px; }

input, select, textarea {
  font: inherit;
  width: 100%;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-raised);
  color: var(--ink);
  transition: border-color 0.12s, box-shadow 0.12s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

textarea { min-height: 84px; resize: vertical; font-family: var(--mono); font-size: 0.8125rem; }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: 0.8125rem; }
.field .help { font-size: 0.75rem; color: var(--ink-muted); line-height: 1.4; }
.field.inline { flex-direction: row; align-items: center; gap: 9px; }
.field.inline label { font-weight: 500; }

/* auto-fill, not auto-fit: a group of two fields keeps the same column
   width as a group of five, so every row of the settings lines up. */
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px 20px;
  align-items: start;
}

.field-grid > .field { margin-bottom: 0; }
.field-grid > .field.wide { grid-column: 1 / -1; }

/* Label, control and help text share a row, so neighbouring fields agree
   on where each of the three sits however long their help text runs. */
@supports (grid-template-rows: subgrid) {
  .field-grid { grid-auto-rows: auto; }
  .field-grid > .field:not(.inline) {
    display: grid;
    grid-template-rows: subgrid;
    grid-row: span 3;
    row-gap: 6px;
  }
}

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

.monitor-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 17px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s;
  box-shadow: var(--shadow);
  text-align: left;
  align-items: stretch;
  justify-content: flex-start;
  width: 100%;
  font: inherit;
  color: inherit;
  text-decoration: none;
}

.monitor-card:hover { text-decoration: none; }

.monitor-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-raised); transform: translateY(-1px); background: var(--surface); }
.monitor-card.is-down { border-left: 3px solid var(--state-down); }
.monitor-card.is-degraded { border-left: 3px solid var(--state-degraded); }
.monitor-card.is-up { border-left: 3px solid var(--state-up); }
.monitor-card.is-maintenance { border-left: 3px solid var(--state-maintenance); }

.monitor-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.monitor-name { font-weight: 650; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.monitor-target { font-size: 0.75rem; color: var(--ink-muted); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.monitor-meta { display: flex; gap: 8px 16px; row-gap: 7px; font-size: 0.75rem; color: var(--ink-secondary); flex-wrap: wrap; }
.monitor-meta b { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }

.tag-row { display: flex; gap: 5px; flex-wrap: wrap; }
.tag {
  font-size: 0.6875rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-sunken);
  color: var(--ink-secondary);
  border: 1px solid var(--border);
  font-weight: 550;
}

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .search { flex: 1 1 220px; max-width: 320px; }
.toolbar select { width: auto; min-width: 130px; }

.segmented {
  display: inline-flex;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.segmented button {
  border: none;
  background: transparent;
  padding: 6px 13px;
  font-size: 0.8125rem;
  border-radius: 7px;
  color: var(--ink-secondary);
  font-weight: 550;
}

.segmented button[aria-pressed="true"] { background: var(--surface-raised); color: var(--ink); box-shadow: var(--shadow); }

table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
th {
  text-align: left;
  font-weight: 650;
  color: var(--ink-muted);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td { padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-sunken); }
td.numeric, th.numeric { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

.empty {
  padding: 52px 24px;
  text-align: center;
  color: var(--ink-muted);
}
.empty h3 { color: var(--ink-secondary); margin-bottom: 6px; }

.legend { display: flex; gap: 10px 18px; flex-wrap: wrap; font-size: 0.75rem; color: var(--ink-secondary); align-items: center; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-swatch { width: 11px; height: 11px; border-radius: 3px; flex: none; border: 1px solid rgba(0,0,0,0.12); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 11, 11, 0.45);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 100;
  backdrop-filter: blur(3px);
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-raised);
  width: min(680px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}

.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--page);
}

.login-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-raised);
}

.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; font-size: 1.125rem; font-weight: 650; }

.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  margin-bottom: 14px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  border: 1px solid transparent;
}
.alert svg { flex: none; margin-top: 1px; }
.alert.error { background: var(--down-wash); color: #a82626; border-color: rgba(208, 59, 59, 0.3); }
.alert.success { background: var(--up-wash); color: #067506; border-color: rgba(12, 163, 12, 0.3); }
.alert.info { background: var(--accent-wash); color: var(--accent); border-color: rgba(42, 120, 214, 0.25); }
.alert.warning { background: var(--degraded-wash); color: #8a6000; border-color: rgba(250, 178, 25, 0.4); }

:root[data-theme="dark"] .alert.error, :root:not([data-theme="light"]) .alert.error { color: #f08585; }
:root[data-theme="dark"] .alert.success, :root:not([data-theme="light"]) .alert.success { color: #4ade4a; }
:root[data-theme="dark"] .alert.warning, :root:not([data-theme="light"]) .alert.warning { color: #fab219; }

.toast-stack { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 12px 15px;
  box-shadow: var(--shadow-raised);
  font-size: 0.8125rem;
  max-width: 340px;
  animation: slide-in 0.2s ease;
}
.toast.error { border-left: 3px solid var(--state-down); }
.toast.success { border-left: 3px solid var(--state-up); }

@keyframes slide-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

.settings-layout { display: grid; grid-template-columns: 200px 1fr; gap: 26px; align-items: start; }
.settings-layout > * { min-width: 0; }
.table-wrap { max-width: 100%; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 104px; }
.settings-nav button {
  justify-content: flex-start;
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  padding: 9px 12px;
  font-weight: 550;
}
.settings-nav button:hover { background: var(--surface-sunken); }
.settings-nav button[aria-pressed="true"] { background: var(--accent-wash); color: var(--accent); font-weight: 650; }

.section-title { margin-bottom: 5px; }
.section-hint { color: var(--ink-muted); font-size: 0.8125rem; margin-bottom: 18px; max-width: 68ch; }

.connection-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--state-up); flex: none; }
.connection-dot.offline { background: var(--state-down); }
.connection-dot.connecting { background: var(--state-degraded); }

.mono { font-family: var(--mono); font-size: 0.8125rem; }
.muted { color: var(--ink-muted); }
.secondary-ink { color: var(--ink-secondary); }
.nowrap { white-space: nowrap; }
.numeric { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.tight { gap: 7px; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }

.skeleton {
  background: linear-gradient(90deg, var(--surface-sunken) 25%, var(--grid) 50%, var(--surface-sunken) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
  height: 14px;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.code-block {
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 0.75rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

@media (max-width: 900px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .settings-nav button { white-space: nowrap; }
}

/* On a narrow screen the brand steps aside and the navigation pill takes
   the left edge, so the two floating clusters fit on one line. */
@media (max-width: 720px) {
  .float-bar {
    grid-template-columns: auto 1fr;
    gap: 8px;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px;
  }
  .bar-left { display: none; }
  .bar-centre { justify-self: start; }
  .bar-right { grid-column: 2; }
  .nav-pill a { padding: 8px 13px; }
  .orb { width: 38px; height: 38px; }
  .content { padding: calc(80px + env(safe-area-inset-top, 0px)) 16px 64px; gap: 20px; }
  .page-head h1, .detail-head h1 { font-size: 1.375rem; }
  .card-body { padding: 16px; }
  .card-head { padding: 14px 16px; }

  /* Wide controls and tables scroll inside their own box rather than
     squeezing a column down to one word per line. */
  .segmented { max-width: 100%; overflow-x: auto; }
  .table-wrap > table { min-width: 620px; }
  .toolbar > * { min-width: 0; }
}

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

.strip-wrap { position: relative; }
.strip-svg { width: 100%; height: 34px; display: block; }
.strip-svg rect { cursor: crosshair; transition: opacity 0.1s; }
.strip-empty { padding: 18px 0; font-size: 0.8125rem; }

.strip-axis {
  display: flex;
  justify-content: space-between;
  font-size: 0.6875rem;
  color: var(--ink-muted);
  margin-top: 5px;
  font-variant-numeric: tabular-nums;
}

.strip-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-raised);
  padding: 8px 11px;
  font-size: 0.75rem;
  pointer-events: none;
  z-index: 30;
  min-width: 160px;
  white-space: nowrap;
}

.strip-tooltip-time { font-weight: 650; margin-bottom: 4px; }
.strip-tooltip-row { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.strip-tooltip-row .numeric { margin-left: auto; font-variant-numeric: tabular-nums; }
.strip-tooltip-counts { color: var(--ink-secondary); font-variant-numeric: tabular-nums; }

.chart-wrap { position: relative; }
.latency-svg { width: 100%; height: auto; display: block; cursor: crosshair; }
.axis-text { fill: var(--ink-muted); font-size: 10px; font-family: var(--font); font-variant-numeric: tabular-nums; }

.chart-tooltip {
  position: absolute;
  top: 4px;
  transform: translateX(-50%);
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-raised);
  padding: 7px 10px;
  font-size: 0.75rem;
  pointer-events: none;
  z-index: 30;
  white-space: nowrap;
}

.card-error {
  font-size: 0.75rem;
  color: var(--state-down);
  background: var(--down-wash);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
:root[data-theme="dark"] .card-error, :root:not([data-theme="light"]) .card-error { color: #f08585; }

.detail-head h1 { font-size: 1.625rem; }

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.provider-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.provider-chip {
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--ink-secondary);
  font-weight: 550;
}
.provider-chip:hover { border-style: solid; color: var(--accent); border-color: var(--accent); background: var(--accent-wash); }

table input, table select { padding: 6px 9px; font-size: 0.8125rem; }
details summary::-webkit-details-marker { color: var(--ink-muted); }

.nav-count {
  background: var(--state-down);
  color: #fff;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 0.6875rem;
  font-weight: 700;
  min-width: 19px;
  text-align: center;
  line-height: 1.45;
}

.public-shell { max-width: 780px; margin: 0 auto; padding: 48px 20px 80px; }
.public-head { text-align: center; margin-bottom: 26px; }
.public-overall { display: inline-flex; align-items: center; gap: 9px; margin: 12px 0 4px; font-weight: 600; }
.public-row { padding: 18px 20px; border-bottom: 1px solid var(--border); }
.public-row:last-child { border-bottom: none; }
.public-strip { display: flex; gap: 2px; height: 26px; }
.public-cell { flex: 1; border-radius: 2px; background: var(--state-empty); min-width: 2px; }
.public-cell.state-up { background: var(--state-up); }
.public-cell.state-degraded { background: var(--state-degraded); }
.public-cell.state-down {
  background: repeating-linear-gradient(45deg, var(--state-down), var(--state-down) 2px, rgba(255,255,255,0.55) 2px, rgba(255,255,255,0.55) 4px);
}
.public-cell.state-maintenance { background: var(--state-maintenance); }

.sign-in-methods { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.sign-in-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 4px 0 14px; font-size: 0.75rem; color: var(--ink-muted);
}
.sign-in-divider::before, .sign-in-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}
button.link {
  border: none; background: none; padding: 4px 0;
  color: var(--accent); font-size: 0.8125rem; font-weight: 500; width: auto;
}
button.link:hover:not(:disabled) { background: none; text-decoration: underline; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

.users-table { min-width: 820px; }
.users-table th:nth-child(2) { min-width: 140px; }
.users-table th:nth-child(3), .users-table th:nth-child(4) { min-width: 132px; }
.users-table td:last-child { white-space: nowrap; text-align: right; }
