/* Lead OS website. Based on the local automation dashboard styles, with a sidebar layout added at the end.
   All styling lives here: the service sends style-src 'self' with no
   'unsafe-inline', so style attributes and <style> blocks are blocked.
   Light mode only, single column, as little chrome as possible. */

/* Montserrat (SIL Open Font License), served from this folder so the page needs no outside requests. */
@font-face {
  font-family: Montserrat;
  src: url("fonts/montserrat.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f4f6f6;
  --card: #ffffff;
  --sunk: #f7f9f8;
  --line: #e3e8e7;
  --line-mid: #ccd5d3;
  --text: #1a2b30;
  --muted: #687876;
  --ink: #17272c;
  --accent: #f15c62;
  --accent-deep: #cf3f47;
  --accent-wash: #fdf0f1;
  --go: #298568;
  --go-deep: #1f6b53;
  --go-wash: #ecf5f2;
  --warn: #8a5d08;
  --warn-wash: #fdf5e7;
  --warn-line: #ecd9b2;
  --focus: #c97a00;
  --font: Montserrat, "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, Consolas, "Cascadia Mono", monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2 { margin: 0; font-weight: 600; letter-spacing: -.012em; line-height: 1.3; }
p { margin: 0; overflow-wrap: anywhere; }
ul, ol { margin: 0; padding: 0; list-style: none; }
code { font-family: var(--mono); font-size: .9em; }
[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 1.05em; height: 1.05em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}

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

/* -------------------------------------------------------------- masthead -- */
.masthead { position: sticky; top: 0; z-index: 10; background: var(--card); border-bottom: 1px solid var(--line); }
.masthead-inner, .steps-inner, .page { width: 100%; max-width: 780px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.masthead-inner { display: flex; align-items: center; gap: 12px; padding-top: 16px; padding-bottom: 14px; }

.wordmark { flex: 1; display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.wordmark strong { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.wordmark span { font-size: 12.5px; color: var(--muted); white-space: nowrap; }

.pill, .run-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
}
.pill-practice { background: var(--go-wash); color: var(--go-deep); border-color: #bfded3; }
.pill-live { background: var(--accent-wash); color: var(--accent-deep); border-color: #f3c2c5; }

.run-chip { background: var(--sunk); border-color: var(--line); color: var(--muted); }
.run-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.run-chip[data-state="running"] { background: var(--go-wash); border-color: #bfded3; color: var(--go-deep); }
.run-chip[data-state="running"]::before { animation: blink 1.6s ease-in-out infinite; }
.run-chip[data-state="paused"], .run-chip[data-state="starting"], .run-chip[data-state="stopping"] { background: var(--warn-wash); border-color: var(--warn-line); color: var(--warn); }
.run-chip[data-state="failed"], .run-chip[data-state="interrupted"] { background: var(--accent-wash); border-color: #f3c2c5; color: var(--accent-deep); }
.run-chip[data-state="completed"] { background: var(--go-wash); border-color: #bfded3; color: var(--go-deep); }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .2; } }
@media (prefers-reduced-motion: reduce) { .run-chip::before { animation: none !important; } }

/* ----------------------------------------------------------------- steps -- */
.steps-inner { display: flex; gap: 4px; }
.steps button {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 13px 13px;
  font: inherit; font-size: 14px; font-weight: 500;
  color: var(--muted); background: none; border: 0;
  border-bottom: 2.5px solid transparent; cursor: pointer;
}
.steps button:hover { color: var(--text); }
.steps button b {
  display: grid; place-items: center; width: 20px; height: 20px;
  font-size: 11.5px; font-weight: 600; border-radius: 50%;
  background: var(--sunk); border: 1px solid var(--line-mid); color: var(--muted);
}
.steps button[aria-current] { color: var(--text); font-weight: 600; border-bottom-color: var(--ink); }
.steps button[aria-current] b { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ------------------------------------------------------------------ page -- */
.page { padding-top: 22px; padding-bottom: 80px; }
.tab { display: flex; flex-direction: column; gap: 14px; }

h1 { font-size: 24px; }
.lede { margin: -6px 0 2px; color: var(--muted); font-size: 14px; }
.footnote { margin-top: 32px; font-size: 12px; color: var(--muted); text-align: center; }

#notice {
  margin-bottom: 18px; padding: 11px 15px; border-radius: 10px;
  font-size: 13.5px;
  background: #eef2f6; border: 1px solid #d8e2ea;
}
#notice.error { background: var(--accent-wash); border-color: #f3c2c5; color: var(--accent-deep); font-weight: 500; }

/* ---------------------------------------------------------------- blocks -- */
.block { padding: 20px 22px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.block h2 { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.block h2 b {
  display: grid; place-items: center; width: 23px; height: 23px; flex: none;
  font-size: 12px; font-weight: 600; border-radius: 50%;
  background: var(--ink); color: #fff;
}
.block-sub { margin-top: 7px; font-size: 13.5px; color: var(--muted); line-height: 1.5; }

/* Spacing inside a block. Everything that can follow the heading or its
   caption is listed, so nothing ends up flush against the text above it. */
.block > .block-sub + .choices, .block > .block-sub + .feature, .block > .block-sub + .persona,
.block > .block-sub + .field, .block > .block-sub + .turns { margin-top: 16px; }
.block > h2 + .field, .block > h2 + .choices, .block > h2 + .checklist,
.block > h2 + .summary, .block > h2 + .tiles, .block > h2 + .events,
.block > h2 + .feature, .block > h2 + .note, .block > h2 + div { margin-top: 14px; }
.block > .block-sub + .tiles, .block > .block-sub + .events,
.block > .block-sub + .checklist, .block > .block-sub + div { margin-top: 14px; }
.block > .row:not(.row-main) { margin-top: 15px; }

.flag {
  margin-left: auto; padding: 2.5px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 500;
  background: var(--sunk); border: 1px solid var(--line); color: var(--muted);
}
.elapsed { margin-left: auto; font-size: 13px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }

.note {
  margin-top: 13px; padding: 10px 14px; border-radius: 9px;
  font-size: 13px; line-height: 1.55;
  background: var(--sunk); border: 1px solid var(--line); color: var(--muted);
}
.note:empty { display: none; }
.note-live { background: var(--accent-wash); border-color: #f3c2c5; color: var(--accent-deep); font-weight: 500; }
.note-warn { background: var(--warn-wash); border-color: var(--warn-line); color: var(--warn); }

/* ------------------------------------------------------------------ form -- */
#settingsForm { display: flex; flex-direction: column; gap: 14px; }

.field { margin-top: 14px; min-width: 0; }
.field > label { display: block; margin-bottom: 5px; font-size: 13.5px; font-weight: 500; }

.two-up { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-top: 14px; }
.two-up .field { margin-top: 0; }

input[type="text"], input[type="password"], input[type="number"], input:not([type]), textarea, select {
  display: block; width: 100%;
  padding: 9px 12px;
  font: inherit; font-size: 14px;
  color: var(--text); background: var(--card);
  border: 1px solid var(--line-mid); border-radius: 9px;
}
input:hover, textarea:hover, select:hover { border-color: var(--muted); }
input:focus, textarea:focus, select:focus { border-color: var(--ink); }
textarea { resize: vertical; line-height: 1.6; }
textarea.code { font-family: var(--mono); font-size: 12.5px; }
::placeholder { color: #9fadab; }
input:disabled, textarea:disabled, select:disabled { background: var(--sunk); color: var(--muted); cursor: not-allowed; }

.unit { display: flex; align-items: center; gap: 10px; }
.unit input { width: 96px; font-variant-numeric: tabular-nums; }
.unit span { font-size: 13.5px; color: var(--muted); white-space: nowrap; }

.hint { margin-top: 6px; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.hint:empty { display: none; }

/* ----------------------------------------------------------------- modes -- */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.choice { position: relative; display: block; padding: 14px 16px; border-radius: 10px; background: var(--sunk); border: 1.5px solid var(--line); cursor: pointer; }
.choice input { position: absolute; opacity: 0; width: 0; height: 0; }
.choice:hover { border-color: var(--line-mid); }
.choice-body { display: flex; flex-direction: column; gap: 4px; }
.choice-title { position: relative; padding-left: 28px; font-size: 14.5px; font-weight: 600; line-height: 1.4; }
.choice-title::before {
  content: ""; position: absolute; left: 0; top: 1px;
  width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid var(--line-mid); background: var(--card);
}
/* The description lines up under the title, not under the dot. */
.choice-text { padding-left: 28px; font-size: 12.5px; line-height: 1.5; color: var(--muted); }

/* Checked: a filled centre with a ring of card colour around it, the way a
   radio button normally reads. A thick border alone looks like a donut. */
.choice input:checked ~ .choice-body .choice-title::before { box-shadow: inset 0 0 0 3.5px var(--card); }
.choice-safe:has(input:checked) { border-color: var(--go); background: var(--go-wash); }
.choice-safe input:checked ~ .choice-body .choice-title::before { border-color: var(--go); background: var(--go); }
.choice-live:has(input:checked) { border-color: var(--accent); background: var(--accent-wash); }
.choice-live input:checked ~ .choice-body .choice-title::before { border-color: var(--accent); background: var(--accent); }
.choice input:focus-visible ~ .choice-body .choice-title::before { outline: 2.5px solid var(--focus); outline-offset: 2px; }

/* --------------------------------------------------------------- toggles -- */
.feature { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.feature:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }

.switch { display: flex; align-items: flex-start; gap: 13px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track { position: relative; flex: none; width: 40px; height: 23px; margin-top: 2px; border-radius: 999px; background: var(--line-mid); transition: background .15s; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.22); transition: transform .15s; }
.switch input:checked ~ .switch-track { background: var(--go); }
.switch input:checked ~ .switch-track::after { transform: translateX(17px); }
.switch input:focus-visible ~ .switch-track { outline: 2.5px solid var(--focus); outline-offset: 2px; }
.switch input:disabled ~ .switch-track { opacity: .5; }
.switch-text { display: flex; flex-direction: column; gap: 1px; }
.switch-title { font-size: 14.5px; font-weight: 600; }
.switch-sub { font-size: 12.5px; line-height: 1.5; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .switch-track, .switch-track::after { transition: none; } }

.feature-body { margin: 2px 0 0 53px; }
.feature.is-off .feature-body { display: none; }

.confirm { display: flex; align-items: flex-start; gap: 11px; margin-top: 16px; font-size: 13.5px; cursor: pointer; }
.confirm input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--go); }

/* --------------------------------------------------------------- persona -- */
.persona { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 13px; margin-top: 14px; }
.persona .field { margin-top: 0; }
.wide { grid-column: 1 / -1; }
/* A section that is not in use says so with its flag chip rather than being
   dimmed, so every value stays readable. */

/* ------------------------------------------------------------ disclosure -- */
.more { margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.more > summary { padding: 11px 15px; font-size: 13.5px; font-weight: 500; cursor: pointer; list-style: none; color: var(--muted); }
.more > summary::-webkit-details-marker { display: none; }
.more > summary::before { content: "+ "; font-weight: 600; }
.more[open] > summary::before { content: "- "; }
.more[open] > summary { border-bottom: 1px solid var(--line); color: var(--text); }
.more-body { padding: 15px; }
.more-body > .hint:first-child, .more-body > .field:first-child { margin-top: 0; }

/* --------------------------------------------------------------- buttons -- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px;
  font: inherit; font-size: 13.5px; font-weight: 500;
  color: var(--text); background: var(--card);
  border: 1px solid var(--line-mid); border-radius: 9px;
  cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover:not(:disabled) { background: var(--sunk); border-color: var(--muted); }
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.btn-dark:hover:not(:disabled) { background: #22393f; border-color: #22393f; }
.btn-go { background: var(--go); border-color: var(--go); color: #fff; font-weight: 600; padding: 11px 26px; font-size: 15px; }
.btn-go:hover:not(:disabled) { background: var(--go-deep); border-color: var(--go-deep); }
.btn-danger { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-danger:hover:not(:disabled) { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn-quiet { background: none; border-color: var(--line); color: var(--muted); }
.btn-quiet:hover:not(:disabled) { color: var(--text); }

.row { display: flex; flex-wrap: wrap; gap: 8px; }
.row-main { margin-top: 16px; padding-top: 15px; border-top: 1px solid var(--line); align-items: center; }
.save-bar { display: flex; gap: 8px; }

/* ---------------------------------------------------- checklist & checks -- */
.checklist { display: flex; flex-direction: column; gap: 2px; }
.checklist button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 9px; font: inherit; font-size: 13.5px; text-align: left;
  background: none; border: 0; border-radius: 7px; cursor: pointer; color: var(--text);
}
.checklist button:hover { background: var(--sunk); }
.checklist .icon { width: 17px; height: 17px; stroke-width: 2.2; }
.checklist .is-done .icon { color: var(--go); }
.checklist .is-todo { color: var(--muted); }
.checklist .is-todo .icon { color: var(--line-mid); }

.checks:empty { display: none; }
.checks { display: flex; flex-direction: column; gap: 2px; padding: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.check-row { display: flex; align-items: flex-start; gap: 10px; padding: 9px 11px; border-radius: 8px; font-size: 13.5px; }
.check-row .icon { width: 16px; height: 16px; margin-top: 3px; stroke-width: 2.2; }
.check-row strong { font-weight: 600; }
.check-row span { color: var(--muted); }
.check-ok { background: var(--go-wash); }
.check-ok .icon { color: var(--go); }
.check-bad { background: var(--accent-wash); }
.check-bad .icon { color: var(--accent); }

/* ------------------------------------------------------------- run panel -- */
.summary { font-size: 14.5px; line-height: 1.6; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 9px; margin: 0; }
.tiles div { padding: 12px 14px; background: var(--sunk); border: 1px solid var(--line); border-radius: 10px; }
.tiles dt { font-size: 12px; color: var(--muted); }
.tiles dd { margin: 2px 0 0; font-size: 23px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

.events { max-height: 330px; overflow-y: auto; }
.events:empty::after { content: "Nothing yet."; display: block; font-size: 13.5px; color: var(--muted); }
.event { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; font-size: 13.5px; border-top: 1px solid var(--line); }
.event:first-child { border-top: 0; }
.event-dot { flex: none; width: 6px; height: 6px; margin-top: 8px; border-radius: 50%; background: var(--line-mid); }
.event time { flex: none; width: 62px; padding-top: 1px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.event-label { flex: 1; min-width: 0; }
.event-meta { flex: none; font-size: 12px; color: var(--muted); }
.event-count { flex: none; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--sunk); border: 1px solid var(--line); color: var(--muted); font-variant-numeric: tabular-nums; }
.event[data-kind="wait"] .event-dot { background: #d5a53e; }
.event[data-kind="wait"] .event-label { color: var(--warn); }
.event[data-kind="end"] .event-dot { background: var(--go); }
.event[data-kind="end"] .event-label { font-weight: 600; }
.event[data-tone="bad"] .event-dot { background: var(--accent); }
.event[data-tone="bad"] .event-label { color: var(--accent-deep); }

.run-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.run-row:first-child { border-top: 0; }
.run-row time { flex: none; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.run-outcome { font-weight: 600; }
.run-detail { color: var(--muted); }

/* --------------------------------------------------------------- records -- */
.records { display: flex; flex-wrap: wrap; gap: 7px; }
.empty { font-size: 13.5px; color: var(--muted); }
.record {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  max-width: 100%; padding: 8px 13px;
  font: inherit; text-align: left; cursor: pointer; color: var(--text);
  background: var(--sunk); border: 1px solid var(--line); border-radius: 9px;
}
.record:hover { background: var(--card); border-color: var(--line-mid); }
.record-name { max-width: 30ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 500; }
.record-sub { font-size: 11.5px; color: var(--muted); }

pre {
  margin: 0; padding: 13px;
  font-family: var(--mono); font-size: 12px; line-height: 1.6;
  white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--sunk); border: 1px solid var(--line); border-radius: 9px;
  max-height: 460px; overflow: auto;
}

/* ------------------------------------------------------------- chat test -- */
.turns { display: flex; flex-direction: column; gap: 9px; margin-top: 14px; }
.turn { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; gap: 9px; align-items: start; }
.turn select { padding: 8px 10px; font-size: 13.5px; }
.turn textarea { min-height: 58px; }
.turn-remove { display: grid; place-items: center; width: 35px; height: 35px; padding: 0; background: none; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); cursor: pointer; }
.turn-remove:hover { color: var(--accent); border-color: var(--accent); }
.turn-remove .icon { width: 15px; height: 15px; }

.chat-status { margin-top: 12px; font-size: 13.5px; color: var(--muted); }
.chat-status:empty { display: none; }

.decision { margin-left: auto; padding: 3px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--sunk); border: 1px solid var(--line); color: var(--muted); }
.decision[data-value="ALLOW"] { background: var(--go-wash); border-color: #bfded3; color: var(--go-deep); }
.decision[data-value="MANUAL_REVIEW"] { background: var(--warn-wash); border-color: var(--warn-line); color: var(--warn); }
.decision[data-value="STOP"] { background: var(--accent-wash); border-color: #f3c2c5; color: var(--accent-deep); }

.proposed {
  margin: 14px 0 0; padding: 14px 16px;
  font-size: 14.5px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--sunk); border: 1px solid var(--line); border-left: 3px solid var(--go); border-radius: 9px;
}
.proposed:empty { display: none; }

.codes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.codes:empty { display: none; }
.codes li { padding: 2.5px 8px; border-radius: 6px; font-family: var(--mono); font-size: 11px; background: var(--sunk); border: 1px solid var(--line); color: var(--muted); }

/* ------------------------------------------------------------ responsive -- */
@media (max-width: 680px) {
  .masthead-inner, .steps-inner, .page { padding-left: 15px; padding-right: 15px; }
  .masthead-inner { flex-wrap: wrap; gap: 8px; }
  .wordmark { flex: 1 1 100%; }
  .steps-inner { overflow-x: auto; }
  .steps button { padding-left: 9px; padding-right: 9px; }
  .block { padding: 17px 16px; }
  .feature-body { margin-left: 0; }
  .turn { grid-template-columns: minmax(0, 1fr); }
  .turn-remove { justify-self: end; }
  .row .btn { flex: 1 1 auto; }
}

/* ================================================================ sidebar layout --
   Added for the backend website. Desktop: fixed sidebar on the left. Phones: the
   sidebar becomes a top bar with a scrolling row of pages. */
.shell { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }
.page { max-width: 860px; margin: 0; padding: 30px 36px 80px; width: 100%; }
.page > .tab { max-width: 860px; }

.sidebar {
  position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 18px;
  padding: 20px 14px; background: var(--ink); color: #dfe7e6;
}
.sidebar .wordmark { flex: none; display: flex; align-items: center; gap: 10px; padding: 2px 8px; }
.wordmark-text { display: flex; flex-direction: column; line-height: 1.15; }
.sidebar .wordmark strong { font-size: 17px; font-weight: 700; letter-spacing: -.02em; color: #fff; }
.wordmark-text small { font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #8fa3a1; }
.logo {
  display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(140deg, #ff7a6e 0%, var(--accent) 45%, var(--accent-deep) 100%);
  box-shadow: 0 4px 14px rgba(241, 92, 98, .35), inset 0 1px 0 rgba(255,255,255,.25);
  color: #fff;
}
.logo svg { width: 24px; height: 24px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.logo svg .fill { fill: #fff; stroke: none; }
.side-label { display: block; padding: 0 10px; margin: 6px 0 2px; font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #8fa3a1; }
.side-account { padding: 12px; border-radius: 11px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); }
.side-account .side-label { padding: 0; margin: 0 0 2px; }
/* Account menu (custom dropdown) */
.acct { position: relative; margin-top: 4px; }
.acct-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 9px;
  font: inherit; text-align: left; color: #fff; cursor: pointer;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.16); border-radius: 10px;
}
.acct-btn:hover, .acct-btn[aria-expanded="true"] { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); }
.acct-name { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-caret { width: 16px; height: 16px; color: #8fa3a1; transform: rotate(90deg); transition: transform .15s; }
.acct-btn[aria-expanded="true"] .acct-caret { transform: rotate(-90deg); }
.acct-avatar {
  display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 8px;
  font-size: 11.5px; font-weight: 700; color: #fff; background: #4b5f63;
}
.acct-avatar[data-mode="live"] { background: var(--accent); }
.acct-avatar[data-mode="practice"] { background: var(--go); }

.acct-menu {
  position: fixed; z-index: 60; width: 300px; max-width: calc(100vw - 24px);
  padding: 6px; background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 40px rgba(10, 25, 30, .28);
}
.acct-head { display: block; padding: 6px 9px 4px; font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.acct-menu hr { margin: 5px 4px; border: 0; border-top: 1px solid var(--line); }
.acct-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 9px;
  font: inherit; text-align: left; color: var(--text); background: none; border: 0; border-radius: 8px; cursor: pointer;
}
.acct-item:hover, .acct-item:focus-visible { background: var(--sunk); outline: none; }
.acct-item[aria-selected="true"] { background: var(--go-wash); }
.acct-item .acct-avatar:not([data-mode="live"]):not([data-mode="practice"]) { background: var(--sunk); color: var(--muted); border: 1px dashed var(--line-mid); }
.acct-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.acct-text strong { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-text span { font-size: 11.5px; color: var(--muted); }
.acct-tag { flex: none; padding: 1px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; }
.acct-tag.live { background: var(--accent-wash); color: var(--accent-deep); border: 1px solid #f3c2c5; }
.acct-tag.practice { background: var(--go-wash); color: var(--go-deep); border: 1px solid #bfded3; }
.acct-item .icon { width: 16px; height: 16px; color: var(--go); stroke-width: 2.4; }
@media (prefers-reduced-motion: reduce) { .acct-caret { transition: none; } }
.side-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.side-chips .pill, .side-chips .run-chip { font-size: 11px; padding: 3px 9px; }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav button {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 10px; border: 0; border-radius: 9px; background: none;
  font: inherit; font-size: 14px; font-weight: 500; color: #c3d0ce; cursor: pointer; text-align: left;
}
.side-nav button .icon { width: 18px; height: 18px; stroke-width: 1.9; color: #8fa3a1; }
.side-nav button span { flex: 1; }
.side-nav button:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-nav button[aria-current] { background: rgba(255,255,255,.12); color: #fff; font-weight: 600; }
.side-nav button[aria-current] .icon { color: var(--accent); }
.side-nav b {
  display: grid; place-items: center; width: 19px; height: 19px; border-radius: 50%;
  font-size: 10.5px; font-weight: 600; border: 1px solid rgba(255,255,255,.25); color: #c3d0ce;
}
.side-nav .count { font-style: normal; min-width: 20px; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; text-align: center; }
.side-foot { margin-top: auto; padding: 0 10px; font-size: 11.5px; color: #8fa3a1; }

/* Page heading with something on the right (filter, totals). */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .lede { margin: 4px 0 0; }
.page-head select { width: auto; min-width: 170px; }
.meta { font-size: 12.5px; color: var(--muted); }
.save-state { align-self: center; margin-left: 6px; font-size: 12.5px; color: var(--muted); }

/* List rows (reviews, chats, runs) */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 13px; width: 100%;
  padding: 12px 10px; border: 0; border-top: 1px solid var(--line); border-radius: 0;
  background: none; font: inherit; color: var(--text); text-align: left; cursor: pointer;
}
.list-row:first-child { border-top: 0; }
.list-row:hover { background: var(--sunk); border-radius: 9px; }
.list-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list-top strong { font-size: 14.5px; margin-right: 2px; }
.list-body .meta { overflow: hidden; text-overflow: ellipsis; }
.list-arrow { color: var(--line-mid); width: 18px; height: 18px; }
.list-row:hover .list-arrow { color: var(--muted); }

.avatar {
  display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent-wash); color: var(--accent-deep); font-size: 12.5px; font-weight: 700; border: 1px solid #f3c2c5;
}
.badge {
  display: inline-flex; align-items: center; padding: 1.5px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: var(--sunk); border: 1px solid var(--line); color: var(--muted);
}
.badge[data-tone="go"] { background: var(--go-wash); border-color: #bfded3; color: var(--go-deep); }
.badge[data-tone="warn"] { background: var(--warn-wash); border-color: var(--warn-line); color: var(--warn); }
.badge[data-tone="bad"] { background: var(--accent-wash); border-color: #f3c2c5; color: var(--accent-deep); }
.block h2 .badge { margin-left: 4px; }

.back { margin-bottom: 14px; padding: 6px 12px; }
.note-good { background: var(--go-wash); border-color: #bfded3; color: var(--go-deep); }

/* Chat transcript */
.transcript { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; padding: 14px; max-height: 520px; overflow-y: auto; background: var(--sunk); border: 1px solid var(--line); border-radius: 11px; }
.bubble { max-width: 78%; align-self: flex-start; padding: 9px 13px; border-radius: 14px 14px 14px 4px; background: var(--card); border: 1px solid var(--line); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.outbound { align-self: flex-end; border-radius: 14px 14px 4px 14px; background: var(--accent-wash); border-color: #f3c2c5; }
.bubble small { display: block; margin-top: 3px; font-size: 11px; color: var(--muted); }

/* Profiles table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { padding: 8px 10px; text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--sunk); }
.name-cell { display: flex; align-items: center; gap: 10px; }
.name-cell .avatar { width: 30px; height: 30px; font-size: 11px; }
.score { display: inline-grid; place-items: center; min-width: 36px; padding: 2px 8px; border-radius: 8px; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--sunk); border: 1px solid var(--line); }
.score[data-high="true"] { background: var(--go-wash); border-color: #bfded3; color: var(--go-deep); }

#login .block { max-width: 420px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; }
  .side-account { display: flex; align-items: center; gap: 10px; padding: 6px 10px; flex: 1; min-width: 0; }
  .sidebar { overflow: visible; }
  .acct { flex: 1; min-width: 0; margin-top: 0; }
  .side-account .side-label { display: none; }
  .side-chips { margin-top: 0; flex-wrap: nowrap; }
  .side-nav { flex: 1 1 100%; flex-direction: row; overflow-x: auto; gap: 4px; }
  .side-nav .side-label, .side-nav b, .side-foot { display: none; }
  .side-nav button { width: auto; flex: none; padding: 7px 11px; white-space: nowrap; }
  .page { padding: 20px 16px 70px; }
}

/* ---------------------------------------------------------------- loading -- */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block; flex: none; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid var(--line); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
.loading { display: flex; align-items: center; justify-content: center; gap: 11px; padding: 34px 0; font-size: 13.5px; color: var(--muted); }
.loading .spinner { width: 22px; height: 22px; border-width: 3px; }
.records .loading, #reviewRecords .loading { justify-content: flex-start; padding: 6px 0; }

#notice.is-loading { display: flex; align-items: center; gap: 10px; }
#notice.is-loading::before {
  content: ""; flex: none; width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid #c9d5df; border-top-color: var(--ink); animation: spin .7s linear infinite;
}

/* A button that is working shows a spinner in front of its text. */
.btn.is-busy { position: relative; opacity: 1 !important; cursor: progress; }
.btn.is-busy::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%; flex: none;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
.btn.is-busy .icon { display: none; }

/* A list row being opened swaps its arrow for a spinner. */
.list-row.is-busy { cursor: progress; background: var(--sunk); border-radius: 9px; }
.list-row.is-busy .list-arrow { display: none; }
.list-row.is-busy::after {
  content: ""; flex: none; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .7s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .spinner, #notice.is-loading::before, .btn.is-busy::before, .list-row.is-busy::after { animation-duration: 2s; }
}
/* Status capsules (mode and run state) at the top right of every page. */
.statusbar { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin: -8px 0 16px; }
.statusbar-label { margin-right: 2px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.statusbar .pill, .statusbar .run-chip { font-size: 12px; padding: 4px 12px; }
.acct-avatar .spinner { width: 14px; height: 14px; border-width: 2px; border-color: rgba(255,255,255,.3); border-top-color: #fff; }
/* Browser connection status line */
.browser-status { margin-top: 12px; padding: 10px 14px; border-radius: 9px; font-size: 13.5px; font-weight: 500; background: var(--sunk); border: 1px solid var(--line); color: var(--muted); }
.browser-status:empty { display: none; }
.browser-status[data-state="good"] { background: var(--go-wash); border-color: #bfded3; color: var(--go-deep); }
.browser-status[data-state="busy"] { background: var(--warn-wash); border-color: var(--warn-line); color: var(--warn); }
.browser-status[data-state="bad"] { background: var(--accent-wash); border-color: #f3c2c5; color: var(--accent-deep); }
/* Run state banner and the sidebar dot */
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(41,133,104,.55); } 70% { box-shadow: 0 0 0 9px rgba(41,133,104,0); } 100% { box-shadow: 0 0 0 0 rgba(41,133,104,0); } }
.run-banner { display: flex; align-items: center; gap: 13px; margin-top: 14px; padding: 13px 16px; border-radius: 11px; border: 1px solid var(--line); background: var(--sunk); }
.run-banner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; font-size: 13.5px; }
.run-banner-text strong { font-size: 14.5px; }
.run-banner-text span { color: inherit; opacity: .85; overflow-wrap: anywhere; }
.run-banner-meta { flex: none; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; opacity: .8; }
.run-banner-icon { flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); }
.run-banner[data-tone="run"] { background: var(--go-wash); border-color: #bfded3; color: var(--go-deep); }
.run-banner[data-tone="run"] .run-banner-icon { background: var(--go); animation: pulse 1.6s infinite; }
.run-banner[data-tone="wait"] { background: var(--warn-wash); border-color: var(--warn-line); color: var(--warn); }
.run-banner[data-tone="wait"] .run-banner-icon { width: 18px; height: 18px; background: none; border: 2.5px solid #ecd9b2; border-top-color: var(--warn); animation: spin .8s linear infinite; }
.run-banner[data-tone="done"] { background: var(--go-wash); border-color: #bfded3; color: var(--go-deep); }
.run-banner[data-tone="done"] .run-banner-icon { width: 20px; height: 20px; background: var(--go); }
.run-banner[data-tone="done"] .run-banner-icon::after { content: ""; display: block; width: 5px; height: 9px; margin: 3px 0 0 7px; border: solid #fff; border-width: 0 2.2px 2.2px 0; transform: rotate(45deg); }
.run-banner[data-tone="bad"] { background: var(--accent-wash); border-color: #f3c2c5; color: var(--accent-deep); }
.run-banner[data-tone="bad"] .run-banner-icon { width: 20px; height: 20px; background: var(--accent); }
.run-banner[data-tone="bad"] .run-banner-icon::after { content: "!"; display: block; text-align: center; color: #fff; font-weight: 800; font-size: 13px; line-height: 20px; }
.run-banner[data-tone="idle"] { color: var(--muted); }

.side-nav .nav-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: #8fa3a1; }
.side-nav .nav-dot[data-tone="run"] { background: #3fc394; animation: pulse 1.6s infinite; }
.side-nav .nav-dot[data-tone="wait"] { background: #f0b544; }
.side-nav .nav-dot[data-tone="bad"] { background: var(--accent); }
@media (prefers-reduced-motion: reduce) { .run-banner-icon, .side-nav .nav-dot { animation: none !important; } }
/* Keep short values like ethnicity on one line where there is room. */
td { white-space: normal; }
td:nth-child(4), td:nth-child(3) { min-width: 120px; }

/* ---------------------------------------------------------------------------
   Overview, Leads, Weekly plan, Accounts, run options (added for the 12-point spec)
   --------------------------------------------------------------------------- */
input[type="date"], input[type="time"] {
  display: block; width: 100%; padding: 8px 12px; font: inherit; font-size: 14px; color: var(--text);
  background: var(--card); border: 1px solid var(--line-mid); border-radius: 8px;
}
.btn-small { padding: 6px 12px; font-size: 13px; }
.statusbar .btn-small { padding: 4px 12px; font-size: 12px; }
.estop-pill { cursor: pointer; font: inherit; font-weight: 600; }
.estop-on { border-color: #f3c2c5; }
.estop-on .note { margin-top: 12px; }
.estop-off .row { margin-top: 14px; }
.head-btn { margin-left: auto; }
.switch-inner { margin-top: 16px; }
.picker-row { margin-top: 8px; align-items: center; }
.picker-row select { width: auto; flex: 1; min-width: 220px; }

/* Segmented buttons (time range, lead detail tabs) */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.seg button { padding: 6px 13px; font: inherit; font-size: 13px; font-weight: 500; color: var(--muted); background: none; border: 0; border-radius: 7px; cursor: pointer; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.block > .seg { margin-top: 14px; }

/* Overview */
.tiles div[data-tone="go"] dd { color: var(--go-deep); }
.tiles div[data-tone="bad"] dd { color: var(--accent-deep); }
.tiles div[data-tone="warn"] dd { color: var(--warn); }
.tab > .tiles div { background: var(--card); }
.block h2 .meta { margin-left: auto; font-weight: 500; }
.acct-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.acct-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; background: var(--sunk); border: 1px solid var(--line); border-radius: 10px; }
.acct-card[data-status="archived"], .acct-card[data-status="disabled"] { opacity: .65; }
.acct-card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.acct-card-top strong { font-size: 14.5px; }
.acct-card-state { font-size: 13.5px; font-weight: 500; }
.acct-card-state[data-tone="run"] { color: var(--go-deep); }
.acct-card .note { font-size: 12.5px; padding: 7px 10px; }
.acct-card .btn { align-self: flex-start; margin-top: auto; }

/* Run options and readiness */
.readiness { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.readiness:empty { display: none; }
.readiness li { display: flex; align-items: flex-start; gap: 8px; padding: 8px 12px; border-radius: 9px; font-size: 13.5px; border: 1px solid var(--line); background: var(--sunk); }
.readiness li .icon { margin-top: 3px; }
.readiness li[data-tone="bad"] { background: var(--accent-wash); border-color: #f3c2c5; color: var(--accent-deep); }
.readiness li[data-tone="warn"] { background: var(--warn-wash); border-color: var(--warn-line); color: var(--warn); }
.readiness li[data-tone="go"] { background: var(--go-wash); border-color: #bfded3; color: var(--go-deep); }

/* Run results */
.results { margin-top: 14px; }
.result-line { font-size: 13.5px; margin-top: 4px; }
.result-links { margin-top: 10px; }

/* Leads */
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: end; }
.filters .field { margin-top: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0 6px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 11px; font: inherit; font-size: 12.5px; color: var(--text); background: var(--sunk); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.chip b { font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
#leadDetail > .row { margin-top: 12px; }
.lead-panel { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.kv { display: grid; grid-template-columns: minmax(120px, 200px) 1fr; gap: 6px 16px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* Weekly plan */
.plan-form .two-up { margin-top: 10px; }
.days { display: flex; flex-wrap: wrap; gap: 6px; }
.day { position: relative; cursor: pointer; }
.day input { position: absolute; opacity: 0; width: 0; height: 0; }
.day span { display: inline-block; min-width: 50px; padding: 7px 10px; text-align: center; font-size: 13px; font-weight: 500; border: 1px solid var(--line-mid); border-radius: 8px; background: var(--card); }
.day input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.day input:focus-visible + span { outline: 2.5px solid var(--focus); outline-offset: 2px; }
.overrides { border-collapse: collapse; font-size: 13px; }
.overrides th, .overrides td { padding: 4px 6px; text-align: left; }
.overrides thead th { font-weight: 500; color: var(--muted); font-size: 12px; }
.overrides .small { width: 90px; padding: 5px 8px; font-size: 13px; }
.plan-form .confirm { margin-top: 14px; }
.preview { margin-top: 12px; }
.preview:empty { display: none; }

/* Accounts and connection status */
.acct-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.acct-row:first-child { border-top: 0; }
.acct-row > .row { flex: none; }
.conn { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.conn li { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 9px 12px; background: var(--sunk); border: 1px solid var(--line); border-radius: 9px; font-size: 13.5px; }
.conn li .meta { flex-basis: 100%; padding-left: 26px; }
.conn li[data-state="ok"] .icon { color: var(--go); }
.conn li[data-state="error"] .icon, .conn li[data-state="missing"] .icon { color: var(--accent); }

@media (max-width: 700px) {
  .kv { grid-template-columns: 1fr; }
  .page-head .seg { width: 100%; }
}
.readiness .spinner { width: 14px; height: 14px; border-width: 2px; margin-top: 3px; flex: none; }
