/* Control panel. The same tokens as the playground (playground/static/style.css), light and dark. */

/* Geist, bundled (fonts/OFL.txt), so the text looks the same on every computer. */
@font-face {
  font-family: "Geist"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fonts/geist.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Geist"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fonts/geist-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface-1: #fcfcfb;
  --surface-2: #f2f1ed;
  --text-primary: #0b0b0b;
  --text-secondary: #45443f;
  --text-muted: #5f5d57;
  --axis-muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --border-strong: rgba(11, 11, 11, 0.18);
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --accent-wash: rgba(42, 120, 214, 0.10);
  --good: #0ca30c;
  --good-text: #006300;
  --good-wash: rgba(12, 163, 12, 0.10);
  --warning: #fab219;
  --warning-text: #8a5a00;
  --critical: #d03b3b;
  --critical-text: #b02a2a;
  --critical-wash: rgba(208, 59, 59, 0.12);
  --highlight: rgba(250, 178, 25, 0.22);
  --radius: 12px;
  --font: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface-1: #1a1a19;
    --surface-2: #232321;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted: #a3a197;
    --grid: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.18);
    --accent: #3987e5;
    --accent-ink: #86b6ef;
    --accent-wash: rgba(57, 135, 229, 0.16);
    --good-text: #3ec43e;
    --good-wash: rgba(12, 163, 12, 0.16);
    --warning-text: #fab219;
    --critical-text: #f07070;
    --critical-wash: rgba(208, 59, 59, 0.18);
    --highlight: rgba(250, 178, 25, 0.16);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface-1: #1a1a19;
  --surface-2: #232321;
  --text-primary: #f0efec;
  --text-secondary: #c3c2b7;
  --text-muted: #a3a197;
  --grid: #2c2c2a;
  --baseline: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --accent: #3987e5;
  --accent-ink: #86b6ef;
  --accent-wash: rgba(57, 135, 229, 0.16);
  --good-text: #3ec43e;
  --good-wash: rgba(12, 163, 12, 0.16);
  --warning-text: #fab219;
  --critical-text: #f07070;
  --critical-wash: rgba(208, 59, 59, 0.18);
  --highlight: rgba(250, 178, 25, 0.16);
}

* { box-sizing: border-box; }
body {
  margin: 0; font: 15px/1.5 var(--font); color: var(--text-primary); background: var(--page);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 18px; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
h4 { font-size: 15px; }
p { margin: 0; }
a { color: var(--accent-ink); }
code { font: 13px var(--mono); overflow-wrap: anywhere; }
.muted { color: var(--text-muted); }
.small { font-size: 13px; }
.lead { color: var(--text-secondary); max-width: 780px; margin: 0 0 16px; }
.lead.small { margin-bottom: 12px; }
.hint { margin: 0 0 12px; font-size: 13px; color: var(--text-muted); max-width: 900px; }
.hint.block { display: block; margin: 6px 0 0; }
.error-text { color: var(--critical-text); font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; } /* or a class's display wins over the hidden attribute */

/* Header, navigation and banner */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--surface-1);
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.logo {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 21px;
}
.top-right { display: flex; align-items: center; gap: 10px; }
.nav { padding: 0 14px; background: var(--surface-1); overflow-x: auto; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); }
.tabs button {
  background: none; border-radius: 8px 8px 0 0; padding: 12px 16px; color: var(--text-secondary);
  border-bottom: 3px solid transparent; font-size: 15px;
}
.tabs button:hover { color: var(--text-primary); background: var(--surface-2); }
.tabs button[aria-selected="true"] { color: var(--text-primary); font-weight: 600; border-bottom-color: var(--accent); }
/* On a phone the tabs wrap onto more rows, rather than hiding the last ones off the edge. */
@media (max-width: 600px) { .tabs { flex-wrap: wrap; } .tabs button { padding: 10px 12px; } }
.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 20px; background: var(--accent-wash); border-bottom: 1px solid var(--border); font-weight: 500;
}
.banner[data-kind="error"] { background: var(--critical-wash); }
.banner[data-kind="error"] #banner-text::before { content: "⚠ "; color: var(--critical); }
.notice { padding: 10px 14px; border-radius: 10px; background: var(--critical-wash); margin: 0 0 12px; list-style: none; }
.notice.warn { background: var(--highlight); }

.pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 600; background: var(--surface-2); color: var(--text-secondary); white-space: nowrap;
}
a.pill { text-decoration: none; color: var(--text-primary); }
.pill::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--axis-muted); }
.pill[data-state="good"]::before { background: var(--good); }
.pill[data-state="thinking"]::before, .pill[data-state="warn"]::before { background: var(--warning); }
.pill[data-state="bad"]::before { background: var(--critical); }
.pill[data-state="bad"] { background: var(--critical-wash); }
.pill[data-state="warn"] { background: var(--highlight); }

.badges { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.badge {
  display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--text-secondary); white-space: nowrap;
}
.badge.bad { background: var(--critical-wash); color: var(--critical-text); }
.badge.warn { background: var(--highlight); color: var(--text-primary); }

/* A round icon: ✓, !, ✕, i, or a spinner while waiting. */
.state-icon {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px;
  border-radius: 50%; background: var(--surface-2); color: var(--text-secondary); font-size: 14px; font-weight: 700;
}
.state-icon::before { content: "–"; }
.state-icon[data-state="good"] { background: var(--good); color: #fff; }
.state-icon[data-state="good"]::before { content: "✓"; }
.state-icon[data-state="warn"] { background: var(--warning); color: #3a2600; }
.state-icon[data-state="warn"]::before { content: "!"; }
.state-icon[data-state="bad"] { background: var(--critical); color: #fff; }
.state-icon[data-state="bad"]::before { content: "✕"; }
.state-icon[data-state="note"] { background: var(--accent-wash); color: var(--accent-ink); font-family: Georgia, serif; }
.state-icon[data-state="note"]::before { content: "i"; }
.state-icon[data-state="thinking"] { background: transparent; color: var(--accent); }
.state-icon[data-state="thinking"]::before {
  content: ""; width: 70%; height: 70%; border: 3px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin 0.9s linear infinite;
}
.state-icon.big { width: 56px; height: 56px; font-size: 30px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .state-icon[data-state="thinking"]::before { animation: none; border-right-color: currentColor; opacity: 0.5; } }

/* Layout */
.page { padding: 20px 20px 48px; max-width: 1400px; margin: 0 auto; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 8px 0 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 1fr); gap: 14px; align-items: start; }
@media (max-width: 900px) { .grid-2, .split { grid-template-columns: 1fr; } }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; min-width: 0; }
.card > h3 { margin-bottom: 10px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.detail { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
@media (max-width: 900px) { .detail { position: static; max-height: none; } }
.empty-state { color: var(--text-muted); text-align: center; padding: 22px 12px; list-style: none; }

/* Controls */
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-1);
}
textarea { resize: vertical; font-family: var(--mono); font-size: 13px; }
textarea.masked { -webkit-text-security: disc; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, .pick:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
input:disabled { color: var(--text-muted); background: var(--surface-2); }
button, a.button {
  cursor: pointer; border-radius: 8px; padding: 9px 16px; border: 1px solid transparent; background: var(--surface-2);
  white-space: nowrap; font-weight: 500; line-height: 1.3;
}
a.button { display: inline-flex; align-items: center; text-decoration: none; color: inherit; }
button:disabled { cursor: not-allowed; opacity: 0.5; }
button.primary, a.button.primary { background: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover:not(:disabled), a.button.primary:hover { filter: brightness(1.08); }
button.secondary, a.button.secondary { background: var(--surface-1); border-color: var(--border-strong); }
button.secondary:hover:not(:disabled), a.button.secondary:hover { background: var(--surface-2); }
button.danger { color: var(--critical-text); }
button.ghost, a.button.ghost { background: transparent; color: var(--accent-ink); }
button.ghost:hover:not(:disabled), a.button.ghost:hover { background: var(--surface-2); }
button.icon { padding: 4px 10px; font-size: 18px; color: var(--text-secondary); }
button.link { background: none; border: 0; padding: 0; color: var(--accent-ink); font-size: 13px; text-decoration: underline; font-weight: 500; }
button.small, a.button.small { padding: 5px 11px; font-size: 13px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.row select, .row input { width: auto; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; white-space: nowrap; }
.check input { width: auto; }

/* The in-page "are you sure?" box */
.confirm {
  flex-basis: 100%; width: 100%; margin-top: 10px; padding: 12px 14px; border-radius: 10px;
  background: var(--highlight); border: 1px solid var(--border-strong); white-space: normal; text-align: left;
}
.confirm p { margin: 0 0 10px; font-weight: 500; max-width: 640px; }

/* Home */
.hero {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 22px 24px; margin-bottom: 14px;
  border-radius: 16px; border: 1px solid var(--border); background: var(--surface-1);
}
.hero[data-level="good"] { background: var(--good-wash); }
.hero[data-level="warn"], .hero[data-level="setup"] { background: var(--highlight); }
.hero[data-level="bad"], .hero[data-level="offline"] { background: var(--critical-wash); }
.hero-text { flex: 1; min-width: 240px; }
.hero h2 { font-size: 26px; }
.hero p { margin-top: 4px; font-size: 16px; color: var(--text-secondary); }

.issues { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 10px; }
.issue {
  display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface-1); border: 1px solid var(--border); border-left: 5px solid var(--warning);
}
.issue[data-level="bad"] { border-left-color: var(--critical); }
.issue[data-level="note"] { border-left-color: var(--accent); }
.issue-text { flex: 1; min-width: 240px; }
.issue-text strong { display: block; font-size: 16px; }
.issue-text p { color: var(--text-secondary); margin-top: 2px; }
.issue-text .badge { margin-bottom: 4px; }
.issue > .row { margin-left: auto; }

.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
@media (max-width: 1100px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tiles .notice { grid-column: 1 / -1; }
.tile {
  display: block; width: 100%; text-align: left; white-space: normal; font-weight: 400;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px;
}
button.tile:hover { border-color: var(--accent); background: var(--surface-1); }
.tile .label { font-size: 14px; color: var(--text-secondary); font-weight: 500; }
.tile .value { font-size: 28px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile .sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.tile[data-level="warn"] { border-color: var(--warning); }
.tile[data-level="warn"] .value { color: var(--warning-text); }

.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list > li { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--grid); }
.plain-list > li:last-child { border-bottom: 0; }
.plain-list .name { font-weight: 500; }
#sync-list > li { justify-content: flex-start; align-items: flex-start; flex-wrap: nowrap; }

/* Calls */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 14px; }
.filters .grow { flex: 1; }
.filters input[type="search"] { width: min(360px, 100%); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border-radius: 999px; padding: 7px 14px; background: var(--surface-1); border: 1px solid var(--border-strong); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

.call-list { list-style: none; margin: 0; padding: 0; }
.call-row {
  display: flex; justify-content: space-between; gap: 12px; padding: 12px 10px; border-bottom: 1px solid var(--grid);
  border-radius: 8px; cursor: pointer;
}
.call-row:last-child { border-bottom: 0; }
.call-row:hover { background: var(--surface-2); }
#calls-list .call-row[aria-selected="true"] { background: var(--accent-wash); } /* only beside the open call, not on Home */
.call-main { min-width: 0; flex: 1; }
.call-who { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.call-who strong { font-size: 16px; }
.call-who .muted { font-size: 13px; }
.call-what { color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.call-side { display: grid; gap: 6px; justify-items: end; align-content: start; }
.call-when { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }

.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.detail-head h3 { font-size: 20px; }
.detail .summary { margin: 12px 0; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); font-size: 15px; }
.detail .facts { margin-bottom: 14px; }
.detail h4 { margin: 18px 0 10px; }
.transcript { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 88%; padding: 8px 12px; border-radius: 14px; background: var(--surface-2); }
.msg .who { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 2px; }
.msg.caller { align-self: flex-end; background: var(--accent-wash); }
.msg.agent { align-self: flex-start; }
.errors { margin: 8px 0 0; padding-left: 18px; color: var(--critical-text); font-size: 13px; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--text-secondary); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.business .facts dd { white-space: pre-line; } /* the opening hours, a line a day */
@media (max-width: 500px) { .facts { grid-template-columns: 1fr; } .facts dd { margin-bottom: 6px; } }

/* Folded technical parts */
details.tech { margin-top: 14px; }
details.tech > summary, .fold > summary { cursor: pointer; color: var(--text-secondary); font-weight: 600; padding: 4px 0; }
details.tech[open] > summary { margin-bottom: 10px; }
.fold > summary { font-size: 16px; }
.fold[open] > summary { margin-bottom: 12px; }

/* Businesses */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(380px, 100%), 1fr)); gap: 14px; margin-bottom: 14px; }
.cards .card { margin-bottom: 0; }
.business[data-active="false"] { opacity: 0.75; }
.pill[data-state="off"]::before { background: var(--axis-muted); }
.cards .card .actions { margin-bottom: 0; }
/* A business's test link, under its buttons */
.test-link { margin-top: 12px; padding: 14px 16px; border-radius: 10px; background: var(--surface-2); }
.test-link p { margin: 0 0 10px; }
.test-link-about { max-width: 640px; }
.test-link-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.test-link-row input { flex: 1 1 220px; min-width: 0; font-family: var(--mono); font-size: 13px; background: var(--surface-1); }
.test-link .row { margin-top: 4px; }
.preset .card-head h3 { flex: 1; }

/* The preset and business forms */
.editor .back { display: inline-block; margin-top: 4px; font-size: 14px; }
.editor .view-head { margin-top: 4px; }
.editor .lead { margin-bottom: 14px; }
.editor .fold { margin-bottom: 14px; }
.ed-field { padding: 12px 0; border-bottom: 1px solid var(--grid); max-width: 900px; }
.ed-field:last-child { border-bottom: 0; }
.ed-field > label:not(.check), .ed-label { display: block; font-weight: 600; margin-bottom: 6px; }
.ed-field .help { margin-top: 6px; font-size: 13px; color: var(--text-muted); max-width: 720px; }
.ed-field select { width: auto; min-width: 260px; max-width: 100%; }
.ed-field input.narrow { width: 120px; }
.ed-field .checklist { margin-top: 8px; }
.ed-note { margin: 12px 0 0; max-width: 900px; }
.group > .notice { margin: 12px 0 0; max-width: 900px; }
textarea.prose { font: 15px/1.5 var(--font); }
.list-rows { display: grid; gap: 8px; margin-bottom: 10px; }
.list-row {
  display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 8px 12px; align-items: start;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2);
}
.row-number { font-weight: 600; color: var(--text-muted); padding-top: 9px; }
.list-row .ed-field { padding: 0 0 10px; border-bottom: 0; }
.list-row .ed-field:last-child { padding-bottom: 0; }
.list-row .ed-field > label:not(.check) { font-size: 14px; margin-bottom: 4px; }
.list-row input, .list-row textarea { background: var(--surface-1); }
.list-row input.narrow { width: 100%; }
.list-row.inline .list-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 12px; }
.list-row.inline .ed-field { padding: 0; }
.list-row.questions .list-fields { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); }
.list-row.services .list-fields { grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr) minmax(0, 1.2fr) 90px; }
.list-row.staff .list-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
/* Side by side, the labels are on the first row only. */
@media (min-width: 761px) {
  .list-row.inline + .list-row.inline .ed-field > label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .list-row.inline + .list-row.inline .row-number { padding-top: 9px; }
  .list-row.inline:first-child .row-number, .list-row.inline:first-child > .row { padding-top: 26px; }
}
@media (max-width: 760px) { .list-row.inline .list-fields { grid-template-columns: 1fr; } }
.hours { display: grid; gap: 6px; }
.hours-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 40px; }
.hours-row .check { width: 72px; }
.hours-row input[type="time"] { width: auto; }
.save-bar .problems { flex-basis: 100%; margin: 0; }
.problems ul { margin: 6px 0 0; padding-left: 20px; }

/* Bookings and usage */
.table-wrap.full { max-height: none; margin-bottom: 0; }
table.data tfoot td { font-weight: 600; border-top: 1px solid var(--baseline); border-bottom: 0; }
#usage-month { width: auto; }

/* Settings */
.groups { display: grid; gap: 14px; }
fieldset.group { margin: 0; }
.group legend { float: left; width: 100%; padding: 0; font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.group legend + * { clear: both; }
.group .lead { margin-bottom: 4px; }
.group h4.sub { margin: 18px 0 0; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.field { padding: 14px 0 14px 14px; margin-left: -14px; border-left: 3px solid transparent; border-bottom: 1px solid var(--grid); }
.field:last-child { border-bottom: 0; }
.field[data-changed="true"] { border-left-color: var(--accent); }
.field[data-invalid="true"] { border-left-color: var(--critical); }
.field-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.field-head label { font-weight: 600; }
.field-head .key { margin-left: auto; font-size: 11px; color: var(--text-muted); }
.field .help { margin-top: 6px; font-size: 13px; color: var(--text-muted); max-width: 720px; }
.field-error { margin-top: 6px; font-size: 13px; color: var(--critical-text); font-weight: 600; }
.field select { width: auto; min-width: 260px; max-width: 100%; }
.input-row { display: flex; align-items: center; gap: 8px; }
.input-row input, .input-row textarea { max-width: 620px; }
.input-row input.narrow { width: 120px; }
.unit { color: var(--text-secondary); }
.secret { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.secret.open { display: grid; gap: 8px; }
.secret .status { font-weight: 600; margin-right: 6px; color: var(--text-muted); }
.secret .status.good { color: var(--good-text); }
.secret .status.warn { color: var(--warning-text); }

.settings { display: grid; gap: 8px; margin-bottom: 14px; }
.setting { display: grid; grid-template-columns: minmax(200px, 300px) minmax(0, 1fr); gap: 4px 16px; padding: 12px 14px; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); }
.setting[data-changed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.setting .name { font: 600 13px var(--mono); overflow-wrap: anywhere; }
.setting .help { grid-column: 1; font-size: 13px; color: var(--text-muted); }
.setting .input { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 6px; align-items: flex-start; }
.setting .input input { font-family: var(--mono); font-size: 13px; }
@media (max-width: 760px) { .setting { grid-template-columns: 1fr; } .setting .input { grid-column: 1; grid-row: auto; } }
.add-setting input:first-of-type { width: 220px; font-family: var(--mono); }
.add-setting input:nth-of-type(2) { flex: 1; min-width: 180px; }
.save-bar {
  position: sticky; bottom: 12px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 14px; padding: 12px 16px; background: var(--surface-1); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
}

/* Passwords */
.password-form { display: grid; gap: 6px; margin-top: 16px; max-width: 440px; }
.password-form label { font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.password-form button[type="submit"] { justify-self: start; margin-top: 6px; }
.made { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: var(--highlight); }
.new-password { font: 600 15px var(--mono); padding: 6px 10px; background: var(--surface-1); border-radius: 8px; display: inline-block; margin-top: 8px; user-select: all; }
.facts code#pg-password { font-size: 14px; margin-right: 8px; }
.facts dd button.link + button.link { margin-left: 8px; }
#admins-list { margin-bottom: 4px; }

/* System health */
.parts, .checklist { list-style: none; margin: 0; padding: 0; }
.part { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--grid); }
.part:last-child { border-bottom: 0; }
.part-text { flex: 1; min-width: 200px; display: grid; }
.part-text strong { font-size: 16px; }
.part-state { display: grid; justify-items: end; text-align: right; font-weight: 500; }
.part[data-state="bad"] .part-state, .part[data-state="stopped"] .part-state, .part[data-state="missing"] .part-state { color: var(--critical-text); }
.checklist > li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--grid); }
.checklist > li:last-child { border-bottom: 0; }
.checklist > li > div { min-width: 0; }
.steps { margin: 0; padding-left: 22px; display: grid; gap: 12px; }
.steps li > button { margin-left: 8px; }
.report { margin-top: 10px; }

/* Tables (technical details) */
.table-wrap { overflow: auto; max-height: 460px; margin-bottom: 8px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; font-weight: 600; color: var(--text-secondary); padding: 6px 8px; border-bottom: 1px solid var(--baseline); position: sticky; top: 0; background: var(--surface-1); white-space: nowrap; }
table.data td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--grid); vertical-align: top; }
table.data th.num, table.data td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data td.when { white-space: nowrap; color: var(--text-secondary); }
table.data td.dim { color: var(--text-muted); }
table.data td.acts { white-space: nowrap; text-align: right; }
table.data td.acts button + button { margin-left: 4px; }
.empty-row td { color: var(--text-muted); text-align: center; padding: 18px; }

/* Logs and the job card */
.logs {
  margin: 0; padding: 12px; border-radius: 10px; background: var(--surface-2); max-height: 60vh; overflow: auto;
  font: 12px/1.5 var(--mono); white-space: pre-wrap; word-break: break-word;
}
.logs.short { max-height: 260px; }
.job { border-color: var(--border-strong); border-left: 5px solid var(--accent); }
.job[data-state="good"] { border-left-color: var(--good); }
.job[data-state="bad"] { border-left-color: var(--critical); }
.job-main { display: flex; align-items: center; gap: 14px; }
.job-text { flex: 1; min-width: 0; }
.job-text p { margin-top: 2px; }
.job details.tech { margin-top: 10px; }

/* The sign-in page (login.html) and signing out */
.signin-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.signin { width: 100%; max-width: 400px; }
.signin-brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 18px; }
.signin-card { display: grid; gap: 16px; padding: 26px 26px 24px; margin: 0; }
.signin-card h2 { font-size: 21px; }
.signin-field { display: grid; gap: 6px; }
.signin-field label { font-weight: 600; font-size: 14px; }
.signin-field .hint { margin: 0; color: var(--warning-text); font-weight: 500; }
.signin-card .check { white-space: normal; align-items: flex-start; color: var(--text-secondary); }
.signin-card .check input { margin-top: 3px; }
.password-box { position: relative; }
.password-box input { padding-right: 70px; }
.password-box button { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); }
.signin-note, .signin-error { padding: 10px 12px; border-radius: 8px; font-weight: 500; }
.signin-note { background: var(--accent-wash); }
.signin-error { background: var(--critical-wash); color: var(--critical-text); }
.signin-submit { width: 100%; padding: 11px 16px; font-size: 16px; }
.signin-help { text-align: center; margin-top: 16px; padding: 0 8px; }
.who { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) { .who { display: none; } }
