/* ============================================================
   DockLift Gateway — "Harbor Instrument" design system
   Marine control surface: high-legibility, sunlight + dusk ready.
   Every class here maps to existing template markup; safety logic
   and routes are untouched.
   ============================================================ */

:root {
  color-scheme: light dark;

  /* Brand: cornamusa = a dock cleat. Harbor teal identity. */
  --teal: #0e7c72;
  --teal-strong: #0a5d56;
  --teal-soft: #dcefec;

  /* Surfaces & ink (light / day) */
  --bg: #e9eeed;
  --bg-grad-top: #eef3f2;
  --bg-grad-bottom: #dbe5e3;
  --surface: #ffffff;
  --surface-2: #f4f8f7;
  --ink: #0c2024;
  --ink-2: #2b3f43;
  --muted: #5d7075;
  --line: #d2ddda;
  --hairline: rgba(12, 32, 36, 0.08);

  /* Command semantics — directional + universal stop */
  --raise: #1f6fb2;       /* up / sky / azure */
  --raise-ink: #ffffff;
  --lower: #d99425;       /* down / caution amber */
  --lower-ink: #2a1f08;
  --stop: #cf2e1d;        /* universal emergency red */
  --stop-ink: #ffffff;
  --stop-glow: rgba(207, 46, 29, 0.32);

  /* Safety states */
  --safe: #0e7c72;
  --safe-soft: #e0f1ee;
  --warn: #b5821b;
  --warn-soft: #fbeecb;
  --danger: #b21f12;
  --danger-soft: #fbe4e1;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(12, 32, 36, 0.08);
  --shadow: 0 8px 24px rgba(12, 32, 36, 0.10), 0 1px 2px rgba(12, 32, 36, 0.06);
  --shadow-lg: 0 18px 48px rgba(12, 32, 36, 0.16);

  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  --ff-display: "Archivo Expanded", "Archivo", system-ui, sans-serif;
  --ff-body: "Archivo", system-ui, -apple-system, sans-serif;
  --ff-mono: "Spline Sans Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --page-max: 940px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --teal: #2bc0b0;
    --teal-strong: #18a596;
    --teal-soft: #0e2b2a;

    --bg: #060f10;
    --bg-grad-top: #0a181a;
    --bg-grad-bottom: #050c0d;
    --surface: #0f2023;
    --surface-2: #122a2d;
    --ink: #e7f2f0;
    --ink-2: #bcd0cd;
    --muted: #87a09f;
    --line: #21383b;
    --hairline: rgba(231, 242, 240, 0.08);

    --raise: #3a93d6;
    --raise-ink: #04121d;
    --lower: #eaa837;
    --lower-ink: #2a1f08;
    --stop: #f04434;
    --stop-ink: #160403;
    --stop-glow: rgba(240, 68, 52, 0.4);

    --safe: #2bc0b0;
    --safe-soft: #0d2c2a;
    --warn: #e0b04a;
    --warn-soft: #2e2510;
    --danger: #f0594a;
    --danger-soft: #34110d;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 22px 54px rgba(0, 0, 0, 0.6);
    --hairline: rgba(231, 242, 240, 0.06);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--ff-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 80% -10%, var(--teal-soft) 0%, transparent 55%),
    linear-gradient(180deg, var(--bg-grad-top) 0%, var(--bg) 38%, var(--bg-grad-bottom) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--teal-strong); text-decoration-thickness: 1.5px; text-underline-offset: 2px; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--surface);
  font-weight: 600;
}
.skip-link:focus { left: 12px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(14px, 4vw, 28px);
  border-bottom: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(150deg, var(--teal) 0%, var(--teal-strong) 100%);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.brand-mark svg { width: 24px; height: 24px; }

.brand-text { display: grid; line-height: 1; }
.brand-name {
  font-family: var(--ff-display);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.01em;
}
.brand-sub {
  margin-top: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  flex: none;
  padding: 8px 13px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }

.role-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: linear-gradient(165deg, var(--teal), var(--teal-strong));
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.role-chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
}

/* ---------- Safety banner ---------- */
.safety-banner {
  position: sticky;
  top: 63px;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 11px clamp(14px, 4vw, 28px);
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-align: center;
  border-bottom: 1px solid var(--hairline);
}
.banner-msg { display: inline-flex; align-items: center; gap: 9px; }
.banner-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.safety-banner.dry {
  background: linear-gradient(180deg, #103b33, #0d2b2a);
  color: #d6f5ec;
}
.safety-banner.dry .banner-dot { background: #5fd6b6; }

.safety-banner.live {
  background: linear-gradient(180deg, #a51d10, #7f1207);
  color: #fff;
}
.safety-banner.live .banner-dot {
  background: #ffd9d2;
  animation: pulse-dot 1.05s ease-in-out infinite;
}
.safety-banner.caution {
  background: linear-gradient(180deg, #f6e2ab, #f0d488);
  color: #4a380e;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 217, 210, 0.7); }
  50% { transform: scale(1.35); box-shadow: 0 0 0 7px rgba(255, 217, 210, 0); }
}

.banner-safety-form { margin: 0; }
.banner-action {
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius-pill);
  padding: 7px 15px;
  min-height: 34px;
  font-family: var(--ff-body);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  transition: transform 0.08s ease, background 0.15s ease;
}
.banner-action:hover { background: rgba(255, 255, 255, 0.24); }
.banner-action.lock { background: rgba(255, 255, 255, 0.92); color: #7f1207; border-color: transparent; }
.safety-banner.caution .banner-action { color: #4a380e; border-color: rgba(74, 56, 14, 0.4); }

/* ---------- Layout ---------- */
.page {
  width: min(var(--page-max), 100%);
  margin: 0 auto;
  padding: clamp(18px, 4vw, 34px) clamp(14px, 4vw, 28px) 8px;
  animation: rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.section { margin: 0 0 24px; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

h1, h2, h3 { margin: 0 0 12px; color: var(--ink); }
h1 {
  font-family: var(--ff-display);
  font-weight: 800;
  font-size: clamp(28px, 5vw, 38px);
  letter-spacing: -0.02em;
  line-height: 1.05;
}
h2 { font-family: var(--ff-display); font-weight: 700; font-size: 20px; letter-spacing: -0.01em; }
h3 { font-weight: 700; font-size: 16px; }

.muted, .empty { color: var(--muted); }
.empty {
  padding: 14px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.notice {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--teal-soft);
  color: var(--teal-strong);
  font-size: 13px;
  font-weight: 600;
}

.split {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

/* ---------- Badges / chips ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  background: var(--safe-soft);
  color: var(--safe);
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}

/* ---------- Disclaimer ---------- */
.disclaimer {
  display: flex;
  gap: 10px;
  padding: 13px 15px;
  margin: 16px 0;
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 14.5px;
}

/* ---------- Alerts ---------- */
.alert {
  margin: 14px 0;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 600;
}
.alert:focus-visible { outline: 3px solid color-mix(in srgb, var(--raise) 45%, transparent); outline-offset: 2px; }
.alert.success { border-color: color-mix(in srgb, var(--safe) 45%, var(--line)); background: var(--safe-soft); color: var(--safe); }
.alert.error { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); background: var(--danger-soft); color: var(--danger); }

/* Customer "lift not active yet" note */
.setup-note {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 16px auto 0;
  width: min(520px, 100%);
  padding: 13px 16px;
  border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--line));
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: color-mix(in srgb, var(--warn) 80%, var(--ink));
  font-size: 14.5px;
  font-weight: 500;
}

.panel-link { margin: 14px 0 0; }
.panel-link a { font-weight: 700; text-decoration: none; }
.panel-link a:hover { text-decoration: underline; }

/* ============================================================
   Command controls — the heart of the app.
   Owner control screen stacks Raise (up) / Stop / Lower (down)
   to mirror real lift motion. Admin uses .compact (a test strip).
   ============================================================ */
.button-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  width: min(520px, 100%);
  margin: 22px auto;
}
.button-grid.is-submitting form:not(.is-submitting) .command-button { opacity: 0.42; }

.command-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  min-height: 96px;
  border: 0;
  border-radius: var(--radius);
  padding: 16px 20px;
  font-family: var(--ff-display);
  font-weight: 800;
  font-size: 26px;
  letter-spacing: 0.01em;
  text-align: center;
  text-decoration: none;
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform 0.08s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.command-button .cmd-icon { width: 30px; height: 30px; flex: none; }
.command-button:hover { filter: brightness(1.05); }
.command-button:active { transform: translateY(2px); box-shadow: var(--shadow-sm); }
.command-button:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.command-button:disabled { cursor: wait; opacity: 0.7; }

.command-button.raise { background: linear-gradient(165deg, color-mix(in srgb, var(--raise) 88%, #fff), var(--raise)); color: var(--raise-ink); }
.command-button.lower { background: linear-gradient(165deg, color-mix(in srgb, var(--lower) 90%, #fff), var(--lower)); color: var(--lower-ink); }
.command-button.stop {
  min-height: 132px;
  font-size: 34px;
  background: linear-gradient(165deg, color-mix(in srgb, var(--stop) 88%, #fff), var(--stop));
  color: var(--stop-ink);
  box-shadow: 0 12px 30px var(--stop-glow), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.command-button.stop .cmd-icon { width: 38px; height: 38px; }

form.is-submitting .command-button,
form.is-submitting .safety-control-button,
form.is-submitting .banner-action { transform: translateY(2px); }

/* Admin compact test strip */
.button-grid.compact {
  grid-template-columns: repeat(3, 1fr);
  width: 100%;
  margin: 16px 0;
}
.button-grid.compact .command-button { min-height: 66px; font-size: 19px; }
.button-grid.compact .command-button.stop { min-height: 66px; font-size: 19px; }

/* ---------- Generic buttons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 50px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 13px 18px;
  font-family: var(--ff-body);
  font-weight: 700;
  font-size: 15px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease, background 0.15s ease;
}
.button:active { transform: translateY(1px); }
.button:focus-visible { outline: 3px solid color-mix(in srgb, var(--teal) 50%, transparent); outline-offset: 2px; }
.button:disabled { cursor: wait; opacity: 0.7; }
.button.primary { background: linear-gradient(165deg, var(--teal), var(--teal-strong)); color: #fff; box-shadow: var(--shadow-sm); }
.button.primary:hover { filter: brightness(1.06); }
.button.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: var(--shadow-sm); }
.button.secondary:hover { background: var(--surface-2); }
.button.small { width: auto; min-height: 38px; padding: 8px 12px; font-size: 13px; border-radius: var(--radius-sm); }

/* ---------- Panels, lists, tiles ---------- */
.panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.list { display: grid; gap: 10px; }
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
a.list-row:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--teal) 40%, var(--line)); }
.list-row strong { font-weight: 700; }
.list-row span { color: var(--muted); text-align: right; }
.list-row.stacked { align-items: stretch; flex-direction: column; }
.list-row.stacked span { display: block; margin-top: 4px; text-align: left; }
a.list-row::after { content: none; }

.admin-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tile {
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 104px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--teal) 40%, var(--line)); }
.tile strong { font-family: var(--ff-display); font-weight: 700; font-size: 23px; }
.tile span { color: var(--muted); font-size: 14px; }

/* ---------- Status cards ---------- */
.status-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 18px 0; }
.status-card {
  display: grid;
  gap: 5px;
  align-content: start;
  min-height: 112px;
  padding: 18px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--muted);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.status-card span { color: var(--muted); font-weight: 700; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; }
.status-card strong { font-family: var(--ff-display); font-weight: 700; font-size: 22px; letter-spacing: -0.01em; }
.status-card small { color: var(--muted); font-size: 13.5px; }
.status-card.safe { border-left-color: var(--safe); }
.status-card.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.status-card.live { border-left-color: var(--danger); background: var(--danger-soft); }
.status-card.bad { border-left-color: var(--danger); background: var(--danger-soft); }
.status-card.bad strong { color: var(--danger); }

/* ---------- Safety control panels ---------- */
.safety-control,
.live-switch-panel {
  border: 1px solid var(--line);
  border-left: 4px solid var(--safe);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.safety-control { display: grid; gap: 9px; min-width: min(100%, 300px); padding: 16px; }
.safety-control.live,
.live-switch-panel.live { border-left-color: var(--danger); background: var(--danger-soft); color: var(--ink); }

.safety-control-label { font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.safety-control strong { font-family: var(--ff-display); font-size: 19px; font-weight: 700; }

.safety-control form,
.banner-safety-form,
.live-switch-panel form { margin: 0; }
.safety-action-stack { display: grid; gap: 10px; }

.safety-control-button {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: 17px;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
}
.safety-control-button:hover { filter: brightness(1.05); }
.safety-control-button.large { min-height: 74px; font-size: 22px; }
.safety-control-button.arm { background: linear-gradient(165deg, #d2362a, var(--stop)); color: #fff; box-shadow: 0 8px 22px var(--stop-glow); }
.safety-control-button.lock { background: linear-gradient(165deg, var(--teal), var(--teal-strong)); color: #fff; }
.safety-control-button:disabled,
.banner-action:disabled { cursor: wait; opacity: 0.72; }

.live-switch-panel { display: grid; grid-template-columns: 1fr; gap: 16px; margin: 16px 0; padding: 20px; }
.live-switch-panel h2, .live-switch-panel p { margin: 0; }
.live-switch-panel p { color: var(--muted); }
.live-switch-panel.live p { color: var(--danger); }

/* ---------- Forms ---------- */
.form { display: grid; gap: 14px; margin-bottom: 16px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; color: var(--ink-2); }
input, select, textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea { resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 22%, transparent);
}
.check-row { grid-template-columns: auto 1fr; align-items: center; font-weight: 600; }
.check-row input { width: auto; min-height: auto; accent-color: var(--teal); }

.detail-grid, .setup-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.detail-grid div, .setup-form {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface-2);
}
.detail-grid span { display: block; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.detail-grid strong { display: block; margin-top: 5px; font-family: var(--ff-display); font-weight: 700; }
.setup-panel h3 { margin: 0; }

.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-grid code { padding: 6px 10px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }

.action-row, .inline-form { display: grid; gap: 10px; }
.action-row { margin: 16px 0; }
.inline-form { grid-template-columns: 1fr; }
.map-actions { display: grid; grid-template-columns: 1fr; gap: 8px; min-width: 180px; }

code { font-family: var(--ff-mono); font-size: 0.92em; }

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
}
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }

.status {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 12.5px;
  text-transform: capitalize;
}
.status.dry_run, .status.success { background: var(--safe-soft); color: var(--safe); border-color: transparent; }
.status.failure, .status.denied { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.error-text { color: var(--danger); font-weight: 600; }

.code {
  overflow-x: auto;
  padding: 16px;
  border-radius: var(--radius);
  background: #08191c;
  color: #cdeae4;
  font-family: var(--ff-mono);
  font-size: 13px;
  border: 1px solid var(--line);
}

details.section summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink-2);
  padding: 8px 0;
}

/* ---------- Live countdown readout ---------- */
[data-live-countdown] {
  font-family: var(--ff-mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------- Footer ---------- */
.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 26px 18px 40px;
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
}
.footer-mark { opacity: 0.6; }

/* ---------- Submit feedback toast ---------- */
.submit-feedback {
  position: fixed;
  right: 14px;
  bottom: 14px;
  left: 14px;
  z-index: 50;
  display: none;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 18px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--ink);
  box-shadow: var(--shadow-lg);
  color: #fff;
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: 16px;
  text-align: center;
  animation: toast-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.submit-feedback.visible { display: flex; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ============================================================
   Responsive
   ============================================================ */
@media (min-width: 760px) {
  .status-grid { grid-template-columns: repeat(3, 1fr); }
  .live-switch-panel { grid-template-columns: 1fr minmax(220px, 300px); align-items: center; }
  .detail-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 620px) {
  .split { flex-direction: column; align-items: stretch; }
  .safety-control { width: 100%; }
  .safety-banner { justify-content: center; }
  .admin-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 380px) {
  .brand-sub { display: none; }
}

/* ============================================================
   Marketing / landing surface
   ============================================================ */
.nav-cta {
  background: linear-gradient(165deg, var(--teal), var(--teal-strong));
  color: #fff !important;
}
.nav-cta:hover { filter: brightness(1.06); background: linear-gradient(165deg, var(--teal), var(--teal-strong)); }

.narrow { width: min(620px, 100%); margin: 0 auto; }

.hero {
  text-align: center;
  padding: clamp(28px, 6vw, 64px) 0 clamp(20px, 4vw, 36px);
}
.hero-eyebrow {
  display: inline-block;
  margin-bottom: 16px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--teal-soft);
  color: var(--teal-strong);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.hero-title {
  font-family: var(--ff-display);
  font-weight: 800;
  font-size: clamp(34px, 6vw, 56px);
  line-height: 1.04;
  letter-spacing: -0.025em;
  margin: 0 0 18px;
}
.hero-sub {
  max-width: 620px;
  margin: 0 auto 26px;
  color: var(--ink-2);
  font-size: clamp(16px, 2.4vw, 19px);
  line-height: 1.55;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.hero-btn { width: auto; min-width: 200px; min-height: 54px; font-size: 16px; }
.hero-note { margin-top: 22px; color: var(--muted); font-size: 13.5px; }

.center-head { text-align: center; margin-bottom: 24px; }

.how { padding-top: 8px; }
.how-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.how-step {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.how-num {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 12px;
  border-radius: 11px;
  background: var(--teal-soft);
  color: var(--teal-strong);
  font-family: var(--ff-display);
  font-weight: 800;
  font-size: 18px;
}
.how-step strong { display: block; font-family: var(--ff-display); font-size: 18px; margin-bottom: 6px; }
.how-step p { margin: 0; color: var(--muted); }

.pricing-grid { display: grid; grid-template-columns: 1fr; gap: 16px; max-width: 760px; margin: 0 auto; }
.price-card {
  position: relative;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.price-card.featured { border-color: color-mix(in srgb, var(--teal) 55%, var(--line)); box-shadow: var(--shadow-lg); }
.price-tag {
  display: inline-block;
  margin-bottom: 14px;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.price-card.featured .price-tag { background: var(--teal-soft); color: var(--teal-strong); }
.price { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.price-amount { font-family: var(--ff-display); font-weight: 800; font-size: 46px; letter-spacing: -0.03em; color: var(--ink); }
.price-unit { color: var(--muted); font-weight: 600; font-size: 15px; }
.price-desc { margin: 0 0 16px; color: var(--ink-2); }
.price-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.price-list li { position: relative; padding-left: 26px; color: var(--ink-2); }
.price-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--teal);
  font-weight: 800;
}
.pricing-cta { text-align: center; margin-top: 24px; display: grid; gap: 10px; justify-items: center; }
.pricing-cta .button { width: auto; min-width: 220px; }

.pricing-mini {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  margin: 4px 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.pricing-mini strong { font-family: var(--ff-display); font-size: 18px; }
.pricing-mini-plus { color: var(--muted); font-weight: 700; }
.pricing-mini-note { color: var(--muted); font-size: 13px; }

.small { font-size: 13px; }

.confirm { text-align: center; padding: 16px 0 8px; }
.confirm-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--safe-soft);
  color: var(--safe);
}
.confirm-icon svg { width: 34px; height: 34px; }

.pay-spec { margin-top: 22px; }
.pay-spec-label { display: block; margin-bottom: 12px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.pay-steps { margin: 0 0 18px; padding-left: 20px; display: grid; gap: 8px; color: var(--ink-2); }
.pay-summary { display: grid; gap: 8px; margin-bottom: 18px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.pay-row { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.pay-row strong { font-family: var(--ff-display); font-size: 18px; }
.pay-spec .button { width: auto; min-width: 240px; }

@media (min-width: 720px) {
  .how-grid { grid-template-columns: repeat(3, 1fr); }
  .pricing-grid { grid-template-columns: 1fr 1fr; }
}

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

/* Sign out sits in the nav but must be a POST form, so it needs to look like
   the anchors beside it rather than a button. */
.nav-signout { margin: 0; display: inline-flex; }
.nav-signout-button {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  opacity: 0.85;
}
.nav-signout-button:hover { opacity: 1; text-decoration: underline; }
