/* Still There — design system (hand-rolled, no build step) */

/* Distinctive display face (Bricolage Grotesque, OFL) for page titles, the brand
   mark, and the landing hero. Body/labels stay on the system UI sans. Vendored
   for offline use (same no-Node policy as alpine.js / chart.js). It is a variable
   font (wght 300–800, opsz 12–96) — the browser auto-selects the display cut for
   large headings via font-optical-sizing. */
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/static/fonts/bricolage-grotesque.woff2") format("woff2");
}

:root {
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --bg: #f3f4f6;
  --fg: #191b20;
  --muted: #4b505a;
  --faint: #5c626d;
  --card: #ffffff;
  --card-soft: #f5f6f8;
  --border: #e4e6ea;
  --border-strong: #cfd2d9;
  --accent: #2f4bd6;
  --accent-soft: #eaeefc;
  --accent-fg: #2740b8;
  --ok: #157f3d;
  --ok-soft: #e9f5ee;
  --ok-border: #bfe4cc;
  --bad: #c81e1e;
  --bad-soft: #fbeceb;
  --bad-border: #f3c6c6;
  --warn: #92400e;
  --warn-soft: #fdf3e2;
  --warn-border: #eddcb2;
  --heat-good: #2f9e44;
  --heat-warn: #e0a13a;
  --heat-bad: #e03131;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 6px rgba(15, 23, 42, 0.04);
}
.dark {
  --bg: #0b0c10;
  --fg: #e9ebf0;
  --muted: #9aa2b1;
  --faint: #858d9c;
  --card: #16181f;
  --card-soft: #1c1f28;
  --border: #272a34;
  --border-strong: #3b3f4c;
  --accent: #4c5fe0;
  --accent-soft: #19203f;
  --accent-fg: #9aa9ff;
  --ok: #4ade80;
  --ok-soft: #0f2a1a;
  --ok-border: #1d4a2f;
  --bad: #f87171;
  --bad-soft: #2c1418;
  --bad-border: #5a262c;
  --warn: #fbbf24;
  --warn-soft: #292110;
  --warn-border: #4c3d1d;
  --heat-good: #3fb950;
  --heat-warn: #d29922;
  --heat-bad: #f85149;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 1px 10px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
[x-cloak] { display: none !important; }
html { font-size: 16px; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1 { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.2; margin: 0 0 0.3rem; overflow-wrap: anywhere; }
h2 { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.3; margin: 0; }
h3 { font-size: 1rem; font-weight: 600; margin: 1.4rem 0 0.5rem; }
p { margin: 0.35rem 0; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: var(--card-soft);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  padding: 0.1rem 0.4rem;
  overflow-wrap: anywhere;
}
strong { font-weight: 650; }

/* ---------- links ---------- */
a { color: var(--accent-fg); text-decoration: none; }
/* Links whose text *is* a URL (public status URL) break instead of overflowing. */
a.url { overflow-wrap: anywhere; }
a:hover { text-decoration: underline; }
a:focus-visible, .nav-user-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 0.25rem; }

/* WCAG 2.4.1: keyboard users bypass the nav straight to the content. Visually
   absent until focused. */
.skip-link {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 100;
  padding: 0.55rem 1rem;
  background: var(--accent);
  color: #fff;
  border-radius: 0.6rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow);
  transform: translateY(-300%);
}
.skip-link:focus-visible { transform: none; outline: 2px solid var(--accent); outline-offset: 2px; }
/* WCAG 2.4.11 (Minimum): when the browser scrolls a focused element into view,
   keep it clear of the sticky nav instead of sliding it underneath. */
:focus-visible { scroll-margin-top: 7.5rem; }
.btn:hover, .brand:hover { text-decoration: none; }

/* ---------- top navigation ---------- */
/* The sticky top bar wraps the nav and (for trial owners) the trial banner, so the
   banner stays pinned flush under the header while scrolling. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
}
/* flex-wrap + row-gap: on narrow viewports the bar reflows onto a second row
   (right-hand cluster drops down) instead of forcing horizontal page scroll. */
.nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem 1.25rem;
  row-gap: 0.35rem;
  padding: 0.6rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(8px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: var(--fg);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 0.5rem;
  background: var(--accent);
  color: #fff;
  flex: none;
}
.nav-links { display: flex; align-items: center; gap: 0.25rem; }
.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.35rem 0.7rem;
  border-radius: 0.5rem;
}
.nav-link:hover { color: var(--fg); background: var(--card-soft); text-decoration: none; }
.spacer { flex: 1; }

/* ---------- user dropdown (settings / admin / sign out) ---------- */
.nav-user-menu { position: relative; display: inline-block; }
.nav-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
  max-width: 12rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-family: inherit;
  padding: 0.35rem 0.6rem;
  border: 0;
  border-radius: 0.5rem;
  background: none;
  cursor: pointer;
}
/* the email ellipsises; the chevron stays visible (it used to be clipped) */
.nav-user-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-user-btn:hover { color: var(--fg); background: var(--card-soft); }
.user-menu {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  min-width: 11rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
  padding: 0.3rem;
  z-index: 60;
}
/* the logout form must be a block box or the full-width button collapses */
.user-menu form { display: block; }
.user-menu-sep { border: 0; border-top: 1px solid var(--border); margin: 0.25rem 0.35rem; }
.user-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.65rem;
  border-radius: 0.5rem;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--fg);
  text-decoration: none;
}
a.user-menu-item:hover,
.user-menu-btn:hover { background: var(--card-soft); }
.user-menu-btn {
  border: 0;
  background: none;
  cursor: pointer;
  font-weight: 500;
}

/* ---------- Grafana dashboards page (near-full-viewport iframe) ---------- */
/* The whole page below the app header is the Grafana frame: the body becomes a
   column flexbox so #main fills the leftover viewport height, and the container
   constraints (max-width + padding) are dropped for this page only. */
body.page-fullframe {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}
body.page-fullframe #main.main-full {
  flex: 1 1 auto;
  min-height: 0;
  max-width: none;
  width: 100%;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.grafana-frame {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
}
.grafana-frame iframe {
  flex: 1 1 auto;
  min-height: 0;
  display: block;
  width: 100%;
  border: 0;
  background: #fff;
}

/* ---------- sub-nav tabs (admin area: overview / workers) ---------- */
.subnav {
  display: flex;
  gap: 0.25rem;
  margin: 0.9rem 0 1.35rem;
  border-bottom: 1px solid var(--border);
}
.subnav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.45rem 0.65rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.subnav-link:hover { color: var(--fg); }
.subnav-link.active { color: var(--fg); border-bottom-color: var(--accent); }

/* ---------- page shell ---------- */
.container {
  max-width: 50rem;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3.5rem;
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.page-head h1 { margin-bottom: 0.1rem; }
.page-sub { color: var(--muted); font-size: 0.95rem; margin: 0; }
.page-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.9rem 1.15rem;
  border-bottom: 1px solid var(--border);
}
.card-head .card-sub { margin-top: 0.1rem; }
.card-sub { color: var(--muted); font-size: 0.85rem; }
.card-pad { padding: 1.15rem; }
.card-pad > :first-child { margin-top: 0; }
.card-pad > :last-child { margin-bottom: 0; }
.card-table { padding: 0.25rem 0.5rem 0.5rem; overflow-x: auto; }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; margin: 0; font-size: 0.95rem; }
.table th {
  text-align: left;
  padding: 0.55rem 0.75rem;
  color: var(--faint);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  text-align: left;
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td, .table tr:last-child td { border-bottom: none; }
.table tr { transition: background 0.12s ease; }
.table tbody tr:hover { background: var(--card-soft); }
.table .row-link { font-weight: 600; }
/* Long values (URLs, hosts) may break instead of forcing the row wider. */
.table td, .table code { overflow-wrap: anywhere; }

/* ---------- stacked tables (narrow screens) ----------
   A `.table.stack` reflows below 720px: the header row hides and each row
   becomes a bordered card. Every cell keeps its value in normal flow
   (right-aligned) and shows its column header — from data-label — pinned at
   the left. No horizontal scrolling anywhere. */
@media (max-width: 720px) {
  .card-table.stack { overflow: visible; padding: 0.5rem 0.75rem 0.75rem; }
  /* browsers insert an anonymous <tbody>, so match tr/td as descendants */
  .table.stack, .table.stack tbody { display: block; }
  .table.stack tr { display: block; }
  .table.stack tr:first-child { display: none; }
  .table.stack tr:not(:first-child) {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    margin-bottom: 0.75rem;
    overflow: hidden;
  }
  .table.stack tr:not(:first-child):hover { background: var(--card); }
  .table.stack td {
    position: relative;
    display: block;
    padding: 0.55rem 0.9rem 0.55rem 7.5rem;
    border-bottom: 1px solid var(--border);
    text-align: right;
    vertical-align: top;
  }
  .table.stack td:last-child { border-bottom: none; }
  .table.stack td::before {
    content: attr(data-label);
    position: absolute;
    left: 0.9rem;
    top: 0.55rem;
    width: 6.25rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--faint);
    line-height: 1.4;
  }
  .table.stack td[data-label=""] { padding-left: 0.9rem; }
  .table.stack td[data-label=""]::before { content: none; }
  .table.stack .badge { white-space: normal; }
  .table.stack td.row-actions {
    white-space: normal;
    border-top: 1px solid var(--border);
    background: var(--card-soft);
  }
  .table.stack td.row-actions .inline-form { display: inline-block; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  padding: 0.5rem 0.95rem;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  background: var(--accent);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.3;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.12s ease, background 0.12s ease, border-color 0.12s ease, transform 0.05s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-ghost {
  background: var(--card);
  color: var(--fg);
  border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--card-soft); filter: none; }
.btn-danger { background: var(--bad); }
.btn-danger:hover { filter: brightness(1.08); }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.85rem; border-radius: 0.5rem; }
.inline-form { display: inline; }

/* ---------- text helpers ---------- */
.hint { color: var(--muted); font-size: 0.95rem; }
.error { color: var(--bad); font-weight: 500; }
code.url { word-break: break-all; }

/* ---------- banners ---------- */
.warning {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  color: var(--warn);
  padding: 0.7rem 0.9rem;
  border-radius: 0.75rem;
  font-size: 0.95rem;
  margin: 0.75rem 0;
}
.warning a { color: inherit; font-weight: 600; }
.error-banner {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  background: var(--bad-soft);
  border: 1px solid var(--bad-border);
  color: var(--bad);
  padding: 0.7rem 0.9rem;
  border-radius: 0.75rem;
  font-size: 0.95rem;
  margin: 0.75rem 0;
}
/* A full-width band pinned under the nav (inside .topbar), not a card in the content. */
.trial-banner {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.6rem 1.25rem;
  font-size: 0.95rem;
}
.trial-banner a { color: inherit; font-weight: 600; }
.trial-banner.trial-active {
  background: color-mix(in srgb, var(--warn) 18%, var(--warn-soft));
  border-bottom: 1px solid var(--warn-border);
  color: var(--warn);
}
.trial-banner.trial-ended {
  background: color-mix(in srgb, var(--bad) 16%, var(--bad-soft));
  border-bottom: 1px solid var(--bad-border);
  color: var(--bad);
}

/* ---------- status dots & badges ---------- */
.status-dot {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--faint);
  flex: none;
}
.status-dot.up { background: var(--ok); }
.status-dot.down { background: var(--bad); }
.status-dot.warn { background: var(--warn); }
.status-dot.none { background: var(--faint); opacity: 0.55; }
.status-dot.maintenance { background: var(--warn); }
.dots { display: inline-flex; gap: 0.3rem; align-items: center; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.18rem 0.6rem;
  border-radius: 999rem;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--card-soft);
  color: var(--muted);
  white-space: nowrap;
}
.badge .status-dot { width: 0.55rem; height: 0.55rem; }
.badge.ok { background: var(--ok-soft); border-color: var(--ok-border); color: var(--ok); }
.badge.fail { background: var(--bad-soft); border-color: var(--bad-border); color: var(--bad); }
.badge.warn { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn); }
.badge.warn .status-dot { background: var(--warn); }
.badge.mute { background: var(--card-soft); border-color: var(--border); color: var(--muted); }
.badge.mute .status-dot { background: var(--faint); }
.badge.maintenance { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn); }
.badge.maintenance .status-dot { background: var(--warn); }
.badge.accent { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-fg); }
.maint-banner { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.maint-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.maint-list li { display: flex; align-items: center; gap: 0.5rem; }
.maint-list .inline-form { margin-left: auto; }
.maint-when { font-variant-numeric: tabular-nums; }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 1rem; max-width: 28rem; }
.form label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.form input, .form select, .form textarea, .cond-row input, .cond-row select, .plan-form select {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: 0.5rem;
  background-color: var(--card);
  color: var(--fg);
  font-size: 0.95rem;
  font-family: inherit;
  width: 100%;
}
.form textarea { resize: vertical; min-height: 4rem; }
.form input::placeholder, .form textarea::placeholder, .cond-row input::placeholder { color: var(--faint); }
.form input:disabled, .form textarea:disabled { opacity: 0.55; }
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.25rem;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20width=%2716%27%20height=%2716%27%20viewBox=%270%200%2024%2024%27%20fill=%27none%27%20stroke=%27%235c626d%27%20stroke-width=%272%27%20stroke-linecap=%27round%27%20stroke-linejoin=%27round%27%3E%3Cpolyline%20points=%276%209%2012%2015%2018%209%27/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 1rem;
  cursor: pointer;
}
.dark select {
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20width=%2716%27%20height=%2716%27%20viewBox=%270%200%2024%2024%27%20fill=%27none%27%20stroke=%27%23858d9c%27%20stroke-width=%272%27%20stroke-linecap=%27round%27%20stroke-linejoin=%27round%27%3E%3Cpolyline%20points=%276%209%2012%2015%2018%209%27/%3E%3C/svg%3E");
}
.form input:focus, .form select:focus, .form textarea:focus,
.cond-row input:focus, .cond-row select:focus,
.plan-form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.form-row { flex-direction: row; align-items: center; gap: 0.75rem; }
.form-row input, .form-row select { flex: 1; min-width: 0; }
.accent-field { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.accent-field input[type="color"] {
  width: 2.75rem;
  height: 2.3rem;
  padding: 0.18rem;
  border: 1px solid var(--border-strong);
  border-radius: 0.375rem;
  background: var(--card);
  cursor: pointer;
}
.drag-handle { cursor: grab; color: var(--faint); user-select: none; }
tr.dragging { opacity: 0.45; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 1rem; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
.checkbox { display: flex; align-items: center; gap: 0.55rem; font-size: 0.95rem; font-weight: 500; color: var(--fg); cursor: pointer; }
.checkbox input { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); cursor: pointer; flex: none; }

/* ---------- API keys (settings) ---------- */
.key-form { display: flex; align-items: flex-end; gap: 0.75rem; max-width: 30rem; margin-bottom: 1.25rem; }
.key-form label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; font-weight: 600; color: var(--muted); flex: 1; }
.key-form input {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: 0.5rem;
  background-color: var(--card);
  color: var(--fg);
  font-size: 0.95rem;
  font-family: inherit;
  width: 100%;
}
.key-form input::placeholder { color: var(--faint); }
.key-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.key-reveal { display: flex; align-items: stretch; gap: 0.6rem; }
.key-value {
  flex: 1;
  font-size: 0.95rem;
  padding: 0.6rem 0.8rem;
  background: var(--card-soft);
  border: 1px solid var(--accent);
  border-radius: 0.5rem;
  word-break: break-all;
}
.worker-form { max-width: 34rem; }
.rotate-form { margin-top: 1rem; }
.cred-field { margin-bottom: 1rem; }
.cred-field:last-child { margin-bottom: 0; }
.cred-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--muted); margin-bottom: 0.3rem; }
.env-block {
  flex: 1;
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  padding: 0.6rem 0.8rem;
  background: var(--card-soft);
  border: 1px solid var(--accent);
  border-radius: 0.5rem;
  overflow-x: auto;
  white-space: pre;
}
.row-actions { text-align: right; white-space: nowrap; }
.row-actions .inline-form + .inline-form { margin-left: 0.2rem; }
.block-preview { color: var(--muted); }

.activity-detail { font-weight: 400; color: var(--muted); }

/* ---------- tags ---------- */
.tag-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.35rem 0 0; }
.tags-inline { margin-top: 0.25rem; }
.tag-chip {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.1rem 0.5rem;
  border-radius: 999rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--accent-fg);
  text-decoration: none;
}
a.tag-chip:hover { background: var(--accent); color: #fff; }
.tag-filter select {
  font-size: 0.85rem;
  padding: 0.35rem 0.6rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
}

/* ---------- conditions editor ---------- */
.conditions { border-top: 1px solid var(--border); padding-top: 1rem; }
.cond-label { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.cond-row { display: flex; gap: 0.5rem; align-items: center; margin: 0.5rem 0; flex-wrap: wrap; }
.cond-row select { flex: 1.4; min-width: 9rem; }
.cond-row input { flex: 1; min-width: 7rem; }
.cond-row .btn { flex: none; }

/* ---------- theme toggle ---------- */
#theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease;
}
#theme-toggle:hover { color: var(--fg); border-color: var(--border-strong); }
#theme-toggle .icon-sun { display: none; }
.dark #theme-toggle .icon-sun { display: block; }
.dark #theme-toggle .icon-moon { display: none; }

/* ---------- misc components ---------- */
.invite-code {
  background: var(--card-soft);
  border-color: var(--border);
  color: var(--fg);
  user-select: all;
  overflow-wrap: anywhere;
}
.meta { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin: 0.25rem 0 0; }
.meta-item { font-size: 0.95rem; color: var(--muted); }
.meta-item strong { color: var(--fg); font-weight: 600; }
.pill-list { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.pill {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999rem;
  background: var(--card);
  font-size: 0.85rem;
  font-weight: 550;
  color: var(--fg);
}
.pill:hover { border-color: var(--accent); color: var(--accent-fg); text-decoration: none; }

/* ---------- empty states ---------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
}
.empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--card-soft);
  border: 1px dashed var(--border-strong);
  color: var(--faint);
  margin-bottom: 0.4rem;
}
.empty-title { font-size: 1rem; font-weight: 600; color: var(--fg); }

/* ---------- dashboard: at-a-glance summary + secondary card grid ---------- */
.dash-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: -0.55rem 0 1.25rem;
}
.dash-sum-total { color: var(--muted); font-size: 0.85rem; margin-left: 0.1rem; }
.dash-grid { display: grid; gap: 1.25rem; grid-template-columns: 1fr; margin-bottom: 1.25rem; }
.dash-grid > .card { margin-bottom: 0; }
@media (min-width: 55rem) {
  .dash-grid { grid-template-columns: 1fr 1fr; align-items: start; }
}

/* ---------- plan & billing ---------- */
.plans-wrap { border-top: 1px solid var(--border); }
.plans-grid { display: grid; gap: 0.9rem; grid-template-columns: 1fr; }
@media (min-width: 55rem) {
  .plans-grid { grid-template-columns: repeat(3, 1fr); align-items: stretch; }
}
.plan-card {
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--card);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.plan-card.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan-card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.plan-card-head h3 { margin: 0; }
.plan-price { margin: 0; font-size: 1.15rem; font-weight: 650; }
.plan-price .hint { font-weight: 400; font-size: 0.85rem; }
.plan-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.plan-form { display: flex; flex-direction: column; gap: 0.5rem; margin-top: auto; }

/* ---------- charts ---------- */
.range-row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.9rem; }
.range-group { display: flex; gap: 0.35rem; align-items: center; flex-wrap: wrap; }
.range-row .btn { padding: 0.28rem 0.75rem; font-size: 0.85rem; font-weight: 550; }
.range-row .btn.active {
  background: var(--accent-soft);
  color: var(--accent-fg);
  border-color: var(--accent);
}
/* Standard chart auto-refresh controls (see chart_auto.html / withAutoRefresh in charts.js). */
.chart-auto { display: flex; gap: 0.5rem; align-items: center; margin-left: auto; }
.auto-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.auto-toggle input { width: 1rem; height: 1rem; margin: 0; accent-color: var(--accent); cursor: pointer; }
.chart-auto select {
  padding: 0.28rem 1.9rem 0.28rem 0.6rem;
  font-size: 0.85rem;
  border-radius: 0.5rem;
}
.chart-box {
  position: relative;
  height: 13rem;
  margin-bottom: 1.25rem;
  background: var(--card-soft);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.65rem;
}
.chart-box:last-child { margin-bottom: 0; }

/* ---------- wizard ---------- */
.wizard-steps { display: flex; gap: 0.6rem; align-items: center; margin-bottom: 1.5rem; color: var(--faint); font-size: 0.85rem; }
.wstep {
  padding: 0.32rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999rem;
  background: var(--card);
  color: var(--muted);
  font-weight: 550;
}
.wstep.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.wstep.done { color: var(--faint); }
.warrow { opacity: 0.5; }
.wizard-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1.25rem; }

/* ---------- webhook wizard ---------- */
.channel-opt {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--card);
  color: var(--fg);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.channel-opt:hover { border-color: var(--accent); transform: translateY(-2px); }
.channel-opt-name { font-weight: 650; font-size: 1rem; }
.channel-opt-desc { color: var(--muted); font-size: 0.85rem; line-height: 1.4; }
.howto { margin: 0; padding-left: 1.25rem; display: grid; gap: 0.5rem; line-height: 1.55; }
.howto code { font-size: 0.85em; }
.sample-payload {
  margin: 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--card-soft);
  font-size: 0.8rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.snippet-bar { display: flex; justify-content: flex-end; margin: 0.4rem 0 0.3rem; }
.secret-row { display: flex; gap: 0.5rem; align-items: center; }
.secret-row input { flex: 1; min-width: 0; }

/* ---------- auth / landing ---------- */
.auth-card h1 { font-size: 1.3rem; }
.auth-card {
  max-width: 24rem;
  margin: 3rem auto 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
  padding: 1.75rem;
}
.auth-card .form { max-width: none; }
.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.1rem;
}
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.6rem;
  padding: 4.5rem 1rem 0;
}
.hero .logo { width: 3.25rem; height: 3.25rem; border-radius: 0.75rem; margin-bottom: 0.5rem; }
.hero .btn { margin-top: 0.75rem; }
.auth-sub { margin: 0.1rem 0 1rem; }
.auth-foot { margin-top: 1.1rem; }

/* ---------- landing preview (signed-out sample strip) ---------- */
.landing-tag {
  align-self: center; margin-top: 0.45rem; padding: 0.32rem 0.85rem;
  border: 1px solid var(--border); border-radius: 999rem; background: var(--card);
  color: var(--muted); font-size: 0.75rem; font-weight: 600;
}
.landing .hero h1 { font-size: clamp(2.1rem, 5vw, 3rem); letter-spacing: -0.03em; max-width: none; }
.landing .hero p { font-size: 1.15rem; max-width: 42rem; }
.landing-cta { display: flex; gap: 0.6rem; margin-top: 0.75rem; }
.landing-preview { max-width: 30rem; margin: 3rem auto 0; text-align: left; }
.lpv-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.9rem 1.15rem; border-bottom: 1px solid var(--border);
}
.lpv-title { font-weight: 650; }
.lpv-list { list-style: none; margin: 0; padding: 0.4rem; }
.lpv-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.7rem; }
.lpv-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.95rem; }
.lpv-strip { display: flex; flex-wrap: wrap; gap: 3px; padding: 0.9rem 1.15rem 1.15rem; border-top: 1px solid var(--border); }
.lpv-strip .heat-cell { width: 0.55rem; height: 1.15rem; border-radius: 0.25rem; }
.landing-note { text-align: center; margin-top: 0.75rem; }

/* ---------- last-result card ---------- */
.result-line { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-size: 0.95rem; }
.result-line .badge { margin-right: 0.2rem; }

/* ---------- live updates (nav pill + status-dot flash) ---------- */
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid var(--ok-border);
  background: var(--ok-soft);
  color: var(--ok);
  white-space: nowrap;
}
.live-pill.offline { border-color: var(--warn-border); background: var(--warn-soft); color: var(--warn); }
.live-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.live-pill.offline .live-dot { opacity: 0.7; }
@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.72); }
}
.status-dot.flash { animation: dot-flash 1s ease-out; }
@keyframes dot-flash {
  0% { transform: scale(1); box-shadow: 0 0 0 0 color-mix(in srgb, var(--fg) 45%, transparent); }
  55% { transform: scale(1.55); box-shadow: 0 0 0 0.42rem color-mix(in srgb, var(--fg) 10%, transparent); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 transparent; }
}

/* ---------- incident banner (dashboard) ---------- */
.incident-banner { background: var(--bad-soft); border-color: var(--bad-border); color: var(--bad); }
.incident-banner a { color: inherit; font-weight: 600; }
.incident-sep { opacity: 0.5; margin: 0 0.2rem; font-weight: 400; }

/* ---------- heatmaps (uptime calendar + dashboard ribbon) ---------- */
.heat-cell {
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 0.25rem;
  background: var(--card-soft);
  border: 1px solid var(--border);
  flex: none;
}
.heat-cell.none { background: var(--card-soft); }
.heat-cell.good { background: var(--heat-good); border-color: transparent; }
.heat-cell.warn { background: var(--heat-warn); border-color: transparent; }
.heat-cell.bad { background: var(--heat-bad); border-color: transparent; }
.heat.calendar {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 1fr);
  gap: 3px;
  width: fit-content;
  max-width: 100%;
}
.heat.ribbon { display: flex; flex-wrap: wrap; gap: 3px; }
.heat.ribbon .heat-cell { width: 0.5rem; height: 1.1rem; border-radius: 0.25rem; }
.heat-legend { display: flex; align-items: center; gap: 0.45rem; margin-top: 0.85rem; flex-wrap: wrap; }
.heat-legend .heat-cell { width: 0.7rem; height: 0.7rem; }

/* ---------- incident timeline (service page) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item {
  position: relative;
  padding: 0.55rem 0.25rem 0.55rem 0;
  border-left: 2px solid var(--border);
  margin-left: 0.5rem;
  padding-left: 1.15rem;
}
.timeline-item .timeline-dot {
  position: absolute;
  left: -0.5rem;
  top: 0.85rem;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: var(--bad);
  border: 2px solid var(--card);
  box-shadow: 0 0 0 1px var(--bad-border);
}
.timeline-item.ongoing .timeline-dot { animation: live-pulse 1.4s ease-in-out infinite; }
.timeline-title { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin: 0.1rem 0; }

/* ---------- public status page (unauthenticated) ---------- */
.status-page { max-width: 44rem; }
.status-page .card-head h1 { margin-bottom: 0; }
.status-site-name {
  margin: 0 0 0.15rem;
  font-size: 1rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
}
.status-page .card-pad:first-of-type .status-site-name { border-top: none; padding-top: 0; }
.status-list { list-style: none; margin: 0; padding: 0; }
.status-list li { padding: 0.7rem 0; border-bottom: 1px solid var(--border); }
.status-list li:last-child { border-bottom: none; }
.status-name { font-weight: 600; }
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.status-meta { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.status-uptime {
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.status-heat { margin-top: 0.6rem; max-width: 100%; }
.status-legend { margin-top: 0.9rem; }
.status-logo { height: 2.2rem; width: auto; max-width: 12rem; margin-bottom: 0.45rem; border-radius: 0.375rem; }
.incident-posts { list-style: none; margin: 0.55rem 0 0; padding: 0; display: grid; gap: 0.45rem; }
.incident-post { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.incident-post-text { flex: 1; min-width: 10rem; }
.status-note { margin-bottom: 1rem; }
.status-note:last-child { margin-bottom: 0; }
.status-note-title { margin: 0 0 0.2rem; font-size: 0.95rem; }
.status-note-text { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.status-foot { text-align: center; margin-top: 0.25rem; }

/* ---------- command palette (⌘K) ---------- */
.cmdk-trigger {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.35rem 0.55rem; border: 1px solid var(--border-strong);
  border-radius: 0.5rem; background: var(--card); color: var(--muted);
  font-size: 0.85rem; font-weight: 500; font-family: inherit; cursor: pointer;
}
.cmdk-trigger:hover { background: var(--card-soft); color: var(--fg); }
.cmdk-trigger kbd {
  font-family: inherit; font-size: 0.75rem; color: var(--faint);
  background: var(--card-soft); border: 1px solid var(--border); border-radius: 0.375rem;
  padding: 0 0.35rem; line-height: 1.55;
}
.cmdk-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 1rem 1rem;
}
.cmdk-panel {
  width: 100%; max-width: 38rem; background: var(--card);
  border-radius: 0.75rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25); overflow: hidden;
}
.cmdk-panel > input {
  width: 100%; border: none; outline: none; background: transparent;
  color: var(--fg); font-size: 1rem; font-family: inherit;
  padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--border);
}
.cmdk-list { list-style: none; margin: 0; padding: 0.4rem; max-height: 18rem; overflow-y: auto; }
.cmdk-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.5rem 0.7rem; border-radius: 0.5rem; cursor: pointer;
  color: var(--fg); font-size: 0.95rem;
}
.cmdk-icon { display: inline-flex; color: var(--faint); flex: none; }
.cmdk-active { background: var(--accent-soft); }
.cmdk-active .cmdk-icon { color: var(--accent-fg); }
.cmdk-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-meta { color: var(--muted); font-size: 0.85rem; max-width: 38%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-tag {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--faint); border: 1px solid var(--border); border-radius: 0.5rem;
  padding: 0 0.35rem; flex: none;
}
.cmdk-empty { color: var(--muted); font-size: 0.95rem; margin: 0; padding: 1.1rem; text-align: center; }

/* ---------- toasts & micro-interactions ---------- */
.toast-region {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 60;
  display: flex; flex-direction: column; gap: 0.5rem; max-width: min(24rem, calc(100vw - 2rem));
}
.toast {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.65rem 0.9rem; border-radius: 0.75rem; border: 1px solid var(--border);
  background: var(--card); color: var(--fg); box-shadow: var(--shadow);
  font-size: 0.95rem; font-weight: 500;
  animation: toast-in 0.25s ease;
}
.toast-out { opacity: 0; transform: translateY(0.5rem); transition: opacity 0.3s ease, transform 0.3s ease; }
.toast-ok { background: var(--ok-soft); border-color: var(--ok-border); color: var(--ok); }
.toast-error { background: var(--bad-soft); border-color: var(--bad-border); color: var(--bad); }
.toast-info { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-fg); }
@keyframes toast-in { from { opacity: 0; transform: translateY(0.5rem); } to { opacity: 1; transform: none; } }
/* Animated theme crossfade when the theme class flips. */
body, .card, .nav, .badge, .btn, .toast { transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease; }
@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
  .status-dot.flash { animation: none; }
  .timeline-item.ongoing .timeline-dot { animation: none; }
  body, .card, .nav, .badge, .btn, .toast { transition: none; }
  .tour-spot { transition: none; }
}

/* ---------- guided tour (first-run coachmarks) ---------- */
#tour-overlay { position: fixed; inset: 0; z-index: 70; }
.tour-spot {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 0.75rem;
  box-shadow: 0 0 0 9999px color-mix(in srgb, var(--bg) 65%, transparent), 0 0 0 2px var(--accent);
  transition: transform 0.2s ease;
}
.tour-bubble {
  position: absolute; max-width: calc(100vw - 2rem); background: var(--card);
  border-radius: 0.75rem; padding: 1rem 1.1rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.tour-title { margin: 0 0 0.25rem; font-size: 1rem; }
.tour-text { margin: 0 0 0.9rem; color: var(--muted); font-size: 0.95rem; }
.tour-nav { display: flex; gap: 0.5rem; justify-content: flex-end; }
.tour-back:disabled { opacity: 0.45; cursor: default; }

/* ---------- fleet map (workers page) ---------- */
.fleet-map { display: block; width: 100%; height: auto; }
.fleet-grid line { stroke: var(--border); stroke-width: 1; }
.fleet-land path { fill: var(--card-soft); stroke: var(--border); stroke-width: 1; }
.fleet-dot.stale { fill: var(--faint); opacity: 0.55; }
.fleet-dot.live { fill: var(--ok); animation: fleet-pulse 2s ease-in-out infinite; }
@keyframes fleet-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.fleet-legend { display: flex; align-items: center; gap: 0.45rem; margin-top: 0.6rem; }
.fleet-key { width: 0.7rem; height: 0.7rem; border-radius: 50%; display: inline-block; }
.fleet-key.live { background: var(--ok); }
.fleet-key.stale { background: var(--faint); opacity: 0.6; }
@media (prefers-reduced-motion: reduce) {
  .fleet-dot.live { animation: none; }
}

/* ---------- SLO error-budget ring ---------- */
.slo-wrap { display: flex; align-items: center; gap: 1.75rem; flex-wrap: wrap; }
.slo-ring { width: 132px; height: 132px; flex: none; }
.slo-track { fill: none; stroke: var(--border); stroke-width: 9; }
.slo-arc { fill: none; stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset 0.6s ease; }
.slo-ring.ok .slo-arc { stroke: var(--ok); }
.slo-ring.warn .slo-arc { stroke: var(--warn); }
.slo-ring.bad .slo-arc { stroke: var(--bad); }
.slo-label { text-anchor: middle; font-size: 19px; font-weight: 700; fill: var(--fg); }
.slo-stats { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; margin: 0; }
@media (prefers-reduced-motion: reduce) {
  .slo-arc { transition: none; }
}

/* ---------- narrow screens ---------- */
@media (max-width: 900px) {
  .cmdk-trigger .cmdk-trigger-label { display: none; }
  .nav { gap: 0.4rem 0.75rem; padding: 0.5rem 1rem; }
  .nav-links { gap: 0.1rem; }
  .nav-link { padding: 0.35rem 0.55rem; font-size: 0.9rem; }
}

/* Phone-width pass: nothing scrolls sideways; tap targets grow to ~44px;
   form fields stay at 16px so iOS Safari does not zoom on focus. */
@media (max-width: 720px) {
  .container { padding: 1.25rem 1rem 3rem; }

  .page-head { flex-direction: column; align-items: flex-start; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }

  .btn { padding: 0.68rem 1.05rem; }
  .btn-sm { padding: 0.42rem 0.7rem; }
  .nav-link { padding: 0.55rem 0.6rem; }
  .subnav-link { padding: 0.55rem 0.7rem; }
  .user-menu-item { padding: 0.6rem 0.75rem; }
  .wizard-actions .btn { padding: 0.6rem 1rem; }
  .cmdk-trigger { padding: 0.5rem 0.6rem; }
  #theme-toggle { width: 2.5rem; height: 2.5rem; }

  .form { max-width: none; }
  .form input, .form select, .form textarea,
  .cond-row input, .cond-row select,
  .key-form input { font-size: 1rem; }
  .form-row { flex-wrap: wrap; }
  .form-row > * { flex: 1 1 100%; min-width: 0; }
  .form-row > .btn { flex: 0 0 auto; }
  .form-grid { grid-template-columns: 1fr; }
  .cond-row .btn { flex: 1 1 100%; }
  .key-reveal { flex-direction: column; align-items: stretch; }
  .key-reveal .btn { width: 100%; }
  .maint-list li { flex-wrap: wrap; }

  .wizard-steps { flex-wrap: wrap; gap: 0.4rem 0.5rem; }
  .wizard-actions { flex-direction: column-reverse; align-items: stretch; }
  .wizard-actions .btn { text-align: center; }

  .slo-wrap { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .slo-stats { width: 100%; }

  /* the 90-day calendar is wider than a phone — contained scroll, not page scroll */
  .heat-scroll { overflow-x: auto; padding-bottom: 0.25rem; -webkit-overflow-scrolling: touch; }

  .auth-card { margin: 1.5rem auto 0; padding: 1.25rem 1rem; }
  .hero { padding: 2.5rem 1rem 0; }
  .landing-cta { flex-wrap: wrap; }

  .toast-region { left: 1rem; right: 1rem; bottom: 0.75rem; max-width: none; }
  .toast { width: 100%; }
}

@media (max-width: 600px) {
  .nav { gap: 0.35rem 0.5rem; padding: 0.5rem 0.75rem; }
  .nav-link { font-size: 0.85rem; }
}
