/* ============================================================
   Flood Monitor dashboard styles
   Mobile first. Light and dark themes via prefers-color-scheme.
   ============================================================ */

:root {
  color-scheme: light dark;

  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f0f3f7;
  --border: #e2e7ee;
  --text: #0f172a;
  --text-2: #475467;
  --text-3: #5b6676;
  --focus: #1d4ed8;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-text: #ffffff;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 16px rgba(15, 23, 42, .05);

  --safe-bg: #ecfdf3;
  --safe-border: #abefc6;
  --safe-text: #05603a;
  --safe-icon: #079455;

  --warn-bg: #fef3f2;
  --warn-border: #fecdca;
  --warn-text: #b42318;
  --warn-icon: #d92d20;
  --warn-glow: rgba(217, 45, 32, .28);

  --amber-bg: #fffaeb;
  --amber-border: #fedf89;
  --amber-text: #93370d;
  --amber-icon: #dc6803;

  --off-bg: #f2f4f7;
  --off-border: #d0d5dd;
  --off-text: #344054;
  --off-icon: #667085;

  --water: #3b82f6;
  --water-2: #93c5fd;
  --water-off: #98a2b3;
  --flood: #d92d20;

  --skeleton: #e7ebf0;
  --skeleton-shine: #f3f5f8;

  --radius: 16px;
  --radius-sm: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1220;
    --surface: #131b2c;
    --surface-2: #1a2438;
    --border: #26324a;
    --text: #e8edf5;
    --text-2: #a9b4c6;
    --text-3: #98a3b6;
    --focus: #8ab4ff;
    --primary: #3b6ff5;
    --primary-hover: #5684f7;
    --primary-text: #ffffff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);

    --safe-bg: #0d2a1d;
    --safe-border: #175c3a;
    --safe-text: #75e0a7;
    --safe-icon: #47cd89;

    --warn-bg: #3a1311;
    --warn-border: #7a271a;
    --warn-text: #fda29b;
    --warn-icon: #f97066;
    --warn-glow: rgba(249, 112, 102, .3);

    --amber-bg: #33220a;
    --amber-border: #7a4510;
    --amber-text: #fec84b;
    --amber-icon: #fdb022;

    --off-bg: #1c2435;
    --off-border: #344054;
    --off-text: #cfd6e2;
    --off-icon: #98a2b3;

    --water: #4c8df6;
    --water-2: #1e3a6b;
    --water-off: #475467;
    --flood: #f97066;

    --skeleton: #1e2940;
    --skeleton-shine: #26334d;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
button, input { font: inherit; color: inherit; }
svg { display: block; }
[hidden] { display: none !important; }

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

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

.skip-link {
  position: absolute; left: 12px; top: -200px;
  background: var(--surface); color: var(--text);
  padding: 10px 14px; border-radius: 8px; z-index: 10;
}
.skip-link:focus { top: 12px; box-shadow: var(--shadow); }

.wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- Demo banner ---------- */
.demo-banner {
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  justify-content: center; align-items: center;
  padding: 8px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  font-size: 14px;
  text-align: center;
}
.demo-banner a {
  color: var(--primary); font-weight: 600;
  min-height: 32px; display: inline-flex; align-items: center;
}

/* ---------- Header ---------- */
.site-header { padding: 20px 0 8px; }
.header-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand > div { min-width: 0; }
.brand-icon {
  width: 40px; height: 40px; flex: none;
  padding: 9px; border-radius: 12px;
  background: var(--primary); fill: #fff;
}
.brand-title {
  font-size: 20px; line-height: 1.25; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.pill {
  flex: none;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 32px; padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px; font-weight: 600;
  color: var(--text-2);
}
.pill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--off-icon); }
.pill-live { color: var(--safe-text); border-color: var(--safe-border); background: var(--safe-bg); }
.pill-live .pill-dot { background: var(--safe-icon); box-shadow: 0 0 0 3px color-mix(in srgb, var(--safe-icon) 25%, transparent); }
.pill-offline .pill-dot { background: var(--off-icon); }

/* ---------- Network banner ---------- */
.net-banner { margin: 8px 0 0; }
.net-banner .wrap {
  display: flex; align-items: flex-start; gap: 10px;
}
.net-banner .wrap {
  padding-top: 10px; padding-bottom: 10px;
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  color: var(--amber-text);
  border-radius: var(--radius-sm);
  font-size: 15px;
  max-width: calc(1200px - 32px);
  width: calc(100% - 32px);
}
.net-banner svg { width: 20px; height: 20px; flex: none; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  padding-top: 12px;
  padding-bottom: 24px;
}
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

@media (min-width: 960px) {
  .site-header { padding-top: 28px; }
  .layout {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 20px;
  }
  .col { gap: 20px; }
  .col-chart .chart-card { flex: 1; }
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
@media (min-width: 640px) { .card { padding: 24px; } }

.card-title { font-size: 18px; line-height: 1.3; font-weight: 700; }
.card-sub { margin-top: 4px; color: var(--text-2); font-size: 15px; }
.card-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px;
}

/* ---------- Status card ---------- */
.status-card {
  --s-bg: var(--surface); --s-border: var(--border); --s-text: var(--text); --s-icon: var(--text-3);
  background: var(--s-bg);
  border-color: var(--s-border);
  padding: 24px 20px;
  transition: background-color .3s, border-color .3s;
}
@media (min-width: 640px) { .status-card { padding: 28px; } }

.status-card.state-safe    { --s-bg: var(--safe-bg);  --s-border: var(--safe-border);  --s-text: var(--safe-text);  --s-icon: var(--safe-icon); }
.status-card.state-warning { --s-bg: var(--warn-bg);  --s-border: var(--warn-border);  --s-text: var(--warn-text);  --s-icon: var(--warn-icon); }
.status-card.state-sensor  { --s-bg: var(--amber-bg); --s-border: var(--amber-border); --s-text: var(--amber-text); --s-icon: var(--amber-icon); }
.status-card.state-offline { --s-bg: var(--off-bg);   --s-border: var(--off-border);   --s-text: var(--off-text);   --s-icon: var(--off-icon); }

.status-card.state-warning {
  border-width: 2px;
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: var(--shadow), 0 0 0 0 var(--warn-glow); }
  50%      { box-shadow: var(--shadow), 0 0 0 10px transparent; }
}

.status-top { display: flex; align-items: flex-start; gap: 14px; }
.status-icon {
  flex: none;
  width: 52px; height: 52px;
  border-radius: 14px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--s-icon) 14%, transparent);
  color: var(--s-icon);
}
.status-icon svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.is-loading .status-icon { background: var(--skeleton); }

.status-headline {
  font-size: 28px;
  line-height: 1.2;
  font-weight: 750;
  letter-spacing: -.01em;
  color: var(--s-text);
  min-height: 52px;
  display: flex; align-items: center;
  flex: 1; min-width: 0;
}
@media (min-width: 640px) { .status-headline { font-size: 32px; } }

.status-facts {
  margin: 20px 0 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.fact {
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1px solid color-mix(in srgb, var(--s-border) 70%, transparent);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  min-width: 0;
}
.fact dt { font-size: 13px; color: var(--text-2); }
.fact dd { margin: 2px 0 0; font-size: 20px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.fact dd.muted { font-size: 16px; font-weight: 600; color: var(--text-2); padding-top: 3px; }

.status-alert-note, .status-hint {
  margin-top: 14px;
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 15px; color: var(--text);
}
.status-alert-note svg, .status-hint svg { width: 18px; height: 18px; flex: none; margin-top: 2px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.status-alert-note { font-weight: 600; color: var(--s-text); }
.status-hint { color: var(--text-2); }

/* ---------- Gauge ---------- */
.gauge-wrap {
  margin-top: 16px;
  display: flex; align-items: flex-end; justify-content: center; gap: 24px;
}
.gauge { width: 150px; flex: none; }
.gauge-sensor {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 12px; font-weight: 600; color: var(--text-2);
  margin-bottom: 6px;
}
.gauge-sensor svg { width: 34px; height: 34px; fill: var(--surface-2); stroke: var(--text-2); stroke-width: 1.5; }
.gauge-tank {
  position: relative;
  height: 220px;
  border: 2px solid var(--border);
  border-top: 4px solid var(--text-3);
  border-radius: 4px 4px 18px 18px;
  background: var(--surface-2);
  overflow: hidden;
}
.gauge-water {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 0%;
  background: linear-gradient(180deg, color-mix(in srgb, var(--water) 85%, #fff) 0%, var(--water) 100%);
  transition: height .8s cubic-bezier(.2, .7, .2, 1), background .3s;
}
.gauge-wave {
  position: absolute; left: 0; right: 0; top: 0; height: 6px;
  background: color-mix(in srgb, #fff 35%, transparent);
}
.gauge.is-offline .gauge-water,
.gauge.is-sensor .gauge-water { background: var(--water-off); }
.gauge.is-loading .gauge-water { height: 0 !important; }
.gauge.is-loading .gauge-flood-line { visibility: hidden; }

.gauge-flood-line {
  position: absolute; left: 0; right: 0;
  border-top: 2px dashed var(--flood);
  z-index: 2;
}
.gauge-flood-line span {
  position: absolute; left: 6px; top: 2px;
  font-size: 11px; font-weight: 700; color: var(--flood);
  background: color-mix(in srgb, var(--surface-2) 85%, transparent);
  padding: 0 4px; border-radius: 4px;
}
.gauge-level-tag {
  position: absolute; right: 6px;
  transform: translateY(-50%);
  font-size: 12px; font-weight: 700;
  padding: 2px 6px; border-radius: 6px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  z-index: 3;
  font-variant-numeric: tabular-nums;
}

.gauge-legend {
  list-style: none; margin: 0 0 8px; padding: 0;
  display: grid; gap: 8px;
  font-size: 14px; color: var(--text-2);
}
.gauge-legend li { display: flex; align-items: center; gap: 8px; }
.key { width: 16px; height: 10px; border-radius: 3px; display: inline-block; }
.key-water { background: var(--water); }
.key-flood { height: 0; border-top: 2px dashed var(--flood); border-radius: 0; }

.gauge-caption {
  margin-top: 16px;
  text-align: center;
  font-size: 16px; font-weight: 600;
}

/* ---------- Chart ---------- */
.chart-card { display: flex; flex-direction: column; }
.segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.seg {
  min-height: 44px; min-width: 72px;
  padding: 0 12px;
  border: 0; border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  font-size: 15px; font-weight: 600;
  cursor: pointer;
}
.seg:hover { color: var(--text); }
.seg[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .12);
}
.chart-caption {
  margin-top: 10px;
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; color: var(--text-2);
}
.chart-caption svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart-box {
  position: relative;
  margin-top: 12px;
  height: 280px;
  flex: 1;
  min-height: 260px;
}
@media (min-width: 960px) { .chart-box { min-height: 340px; } }
.chart-box canvas { width: 100% !important; height: 100% !important; }
.chart-empty, .chart-loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 16px;
}
.chart-empty { background: color-mix(in srgb, var(--surface) 88%, transparent); border-radius: var(--radius-sm); }
.chart-loading { background: var(--surface); }

/* ---------- Empty states ---------- */
.empty {
  margin-top: 16px;
  padding: 20px 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
}
.empty-title { font-weight: 600; color: var(--text); }
.empty-text { color: var(--text-2); font-size: 15px; margin-top: 4px; }

/* ---------- Form ---------- */
.add-form {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 560px) {
  .add-form { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) auto; align-items: start; }
  .add-form .btn { margin-top: 26px; }
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 14px; font-weight: 600; }
.optional { font-weight: 400; color: var(--text-2); }
.field input {
  min-height: 48px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 16px;
  width: 100%;
}
.field input::placeholder { color: var(--text-3); opacity: .8; }
.field input:focus-visible { outline-offset: 0; border-color: var(--focus); }
.field input[aria-invalid="true"] { border-color: var(--warn-icon); }
.field-error {
  font-size: 14px; font-weight: 600; color: var(--warn-text);
  min-height: 0;
}
.field-error:empty { display: none; }

.btn {
  min-height: 48px;
  padding: 0 20px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}
.btn:disabled { opacity: .65; cursor: progress; }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-ghost {
  background: transparent; color: var(--text-2);
  border-color: var(--border);
  min-height: 44px; padding: 0 14px;
}
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-danger { background: var(--warn-icon); color: #fff; min-height: 44px; padding: 0 16px; }
.btn-danger:hover { filter: brightness(.95); }

.fine-print { margin-top: 12px; font-size: 13px; color: var(--text-2); }

/* ---------- Recipients ---------- */
.list-error {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--warn-bg); border: 1px solid var(--warn-border);
  color: var(--warn-text); font-size: 15px; font-weight: 600;
}
.list-loading { margin-top: 16px; display: grid; gap: 10px; }
.recipients, .alerts { list-style: none; margin: 16px 0 0; padding: 0; }
.recipients:empty, .alerts:empty { display: none; }

.recipient {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  min-height: 68px;
}
.recipient:first-child { border-top: 0; }
.recipient.is-pending { opacity: .6; }
.recipient-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar {
  flex: none;
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-2); color: var(--text-2);
  font-weight: 700; font-size: 15px;
  text-transform: uppercase;
}
.recipient-text { min-width: 0; }
.recipient-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recipient-email { color: var(--text-2); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recipient-name + .recipient-email { font-size: 14px; }
.recipient-meta { color: var(--text-3); font-size: 13px; }
.recipient-actions { flex: none; display: flex; align-items: center; gap: 8px; }
.confirm-text { font-size: 15px; font-weight: 600; }

@media (max-width: 420px) {
  .recipient-email { font-size: 14px; }
  .recipient-actions .btn-ghost { padding: 0 12px; }
  .recipient.is-confirming { flex-wrap: wrap; }
  .recipient.is-confirming .recipient-actions { width: 100%; justify-content: flex-end; }
}

/* ---------- Alerts ---------- */
.alert-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.alert-item:first-child { border-top: 0; }
.alert-badge {
  flex: none;
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
}
.alert-badge svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.alert-badge.kind-warning  { background: var(--warn-bg);  color: var(--warn-icon); }
.alert-badge.kind-recovery { background: var(--safe-bg);  color: var(--safe-icon); }
.alert-badge.kind-test     { background: var(--surface-2); color: var(--primary); }
.alert-text { flex: 1; min-width: 0; }
.alert-kind { font-weight: 600; }
.alert-time { color: var(--text-2); font-size: 14px; }
.alert-sent { flex: none; font-size: 14px; color: var(--text-2); text-align: right; }
.alert-sent.is-partial { color: var(--amber-text); font-weight: 600; }

/* ---------- Readings table ---------- */
.readings-card { padding: 0; }
.readings-card summary {
  list-style: none;
  display: flex; align-items: center; justify-content: space-between;
  min-height: 60px;
  padding: 0 20px;
  font-weight: 650; font-size: 17px;
  cursor: pointer;
  border-radius: var(--radius);
}
@media (min-width: 640px) { .readings-card summary { padding: 0 24px; } }
.readings-card summary::-webkit-details-marker { display: none; }
.chev { width: 22px; height: 22px; fill: none; stroke: var(--text-2); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
details[open] .chev { transform: rotate(180deg); }
.table-wrap { padding: 0 20px 16px; overflow-x: auto; }
@media (min-width: 640px) { .table-wrap { padding: 0 24px 20px; } }
.readings { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.readings th {
  text-align: left; font-size: 13px; font-weight: 600; color: var(--text-2);
  padding: 8px 8px 8px 0; border-bottom: 1px solid var(--border);
}
.readings td { padding: 9px 8px 9px 0; border-bottom: 1px solid var(--border); white-space: nowrap; }
.readings tr:last-child td { border-bottom: 0; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600;
}
.tag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.tag-safe { color: var(--safe-text); }
.tag-warning { color: var(--warn-text); }
.tag-sensor_error { color: var(--amber-text); }

/* ---------- Footer ---------- */
.site-footer {
  padding: 8px 0 40px;
  color: var(--text-2);
  font-size: 14px;
  text-align: center;
}
.site-footer p + p { margin-top: 2px; }

/* ---------- Skeletons ---------- */
.skeleton {
  display: block;
  background: linear-gradient(90deg, var(--skeleton) 0%, var(--skeleton-shine) 50%, var(--skeleton) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: 8px;
}
.skeleton-line { height: 18px; width: 70%; margin: 4px auto 4px 0; }
.gauge-caption .skeleton-line { margin: 4px auto; width: 60%; }
.skeleton-lg { height: 30px; width: 85%; }
.skeleton-sm { height: 22px; width: 60%; }
.skeleton-row { height: 52px; width: 100%; }
.skeleton-block { width: 100%; height: 100%; }
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ---------- Setup / error screens ---------- */
.screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
}
.screen-card {
  width: 100%; max-width: 600px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 22px;
}
@media (min-width: 640px) { .screen-card { padding: 36px; } }
.screen-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--surface-2); color: var(--primary);
  margin-bottom: 16px;
}
.screen-icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.screen-card.is-danger .screen-icon { background: var(--warn-bg); color: var(--warn-icon); }
.screen-card h1 { font-size: 26px; line-height: 1.25; }
.screen-card > p { margin-top: 10px; color: var(--text-2); }
.screen-card ol { margin: 20px 0 0; padding-left: 22px; display: grid; gap: 12px; }
.screen-card li { padding-left: 4px; }
.screen-card code, .screen-card pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  background: var(--surface-2);
  border-radius: 6px;
}
.screen-card code { padding: 1px 6px; overflow-wrap: anywhere; }
.screen-card pre { margin: 8px 0 0; padding: 12px 14px; overflow-x: auto; line-height: 1.6; }
.screen-card .screen-actions { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 12px; }
.screen-card .screen-actions a {
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none;
}
.screen-card .btn-ghost { color: var(--text); }

@media (prefers-color-scheme: dark) {
  .seg[aria-pressed="true"] { background: #2c3a56; box-shadow: none; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .status-card.state-warning { animation: none; box-shadow: var(--shadow), 0 0 0 4px var(--warn-glow); }
  .skeleton { animation: none; }
}
