/* Never Miss a Lead - dashboard visual system.
 *
 * Served from the same local /dashboard/static mount as the vendored htmx: no
 * CDN, no web font, nothing this page needs that a third party could take away.
 *
 * Layers, in order: tokens -> reset -> layout -> components -> print.
 * Both colour schemes are defined explicitly rather than inverted, because the
 * status colours (booked / escalated / at-risk) have to keep their meaning and
 * their contrast in each one.
 */

/* ---------- tokens ---------- */

:root {
  color-scheme: light dark;

  /* type scale (1.18 ratio, capped so a phone never gets a giant heading) */
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-md: 1.0625rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;

  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;

  /* spacing scale */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.10), 0 1px 2px rgba(16, 24, 40, 0.06);

  /* light palette */
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --surface-3: #e4e9f0;
  --border: #dde3ea;
  --border-strong: #c3ccd8;
  --text: #16202c;
  --text-muted: #5a6675;
  --accent: #17549e;
  --accent-hover: #113f78;
  --accent-soft: #e8f0fb;
  --focus: #17549e;

  --ok: #1c6b46;
  --ok-soft: #e2f4ea;
  --warn: #8a5a04;
  --warn-soft: #fbf0da;
  --danger: #a32424;
  --danger-soft: #fbe6e6;
  --info: #1a5b8f;
  --info-soft: #e4f1fa;
  --neutral: #4d5967;
  --neutral-soft: #eaeef3;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1319;
    --surface: #161d26;
    --surface-2: #1d2531;
    --surface-3: #26303d;
    --border: #28313d;
    --border-strong: #3b4756;
    --text: #e7edf5;
    --text-muted: #9aa8b8;
    --accent: #7ab8ff;
    --accent-hover: #a3cfff;
    --accent-soft: #16283c;
    --focus: #7ab8ff;

    --ok: #63d09a;
    --ok-soft: #12301f;
    --warn: #e2b25a;
    --warn-soft: #33260c;
    --danger: #ff8a8a;
    --danger-soft: #391818;
    --info: #7cc0ee;
    --info-soft: #12293a;
    --neutral: #a7b4c3;
    --neutral-soft: #222b36;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  }
}

/* ---------- reset / 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-ui);
  font-size: var(--text-base);
  line-height: 1.5;
}

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

h1, h2, h3 { line-height: 1.25; margin: 0; font-weight: 620; letter-spacing: -0.01em; }

p { margin: 0 0 var(--sp-3); }

.mono { font-family: var(--font-mono); font-size: 0.94em; }
.muted { color: var(--text-muted); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: var(--sp-3); top: -3rem; z-index: 20;
  background: var(--surface); color: var(--text); padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: top 0.12s ease-in;
}
.skip-link:focus { top: var(--sp-3); }

/* ---------- app frame ---------- */

.app-header {
  display: flex; align-items: center; gap: var(--sp-4);
  flex-wrap: wrap;
  padding: var(--sp-3) var(--sp-5);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: var(--text-md); font-weight: 640; color: var(--text);
  text-decoration: none; letter-spacing: -0.015em;
}
.brand:hover { color: var(--text); }
.brand .mark {
  width: 1.6rem; height: 1.6rem; border-radius: var(--radius-sm);
  display: grid; place-items: center;
  background: var(--accent); color: var(--surface);
  font-size: var(--text-xs); font-weight: 700; letter-spacing: 0;
}

.app-nav { display: flex; gap: var(--sp-1); align-items: center; flex-wrap: wrap; }
.app-nav a {
  color: var(--text-muted); font-size: var(--text-sm); text-decoration: none;
  padding: var(--sp-1) var(--sp-3); border-radius: var(--radius-pill);
}
.app-nav a:hover { color: var(--text); background: var(--surface-2); }
.app-nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); font-weight: 600; }

.header-spacer { flex: 1 1 auto; }

.who {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: var(--text-sm); color: var(--text-muted);
}
.who .who-name { color: var(--text); font-weight: 560; }

.app-header form { margin: 0; }

main {
  padding: var(--sp-5);
  max-width: 78rem;
  margin: 0 auto;
}

.page-head { margin-bottom: var(--sp-5); }
.page-head h1 { font-size: var(--text-xl); }
.page-head .sub { color: var(--text-muted); font-size: var(--text-sm); margin: var(--sp-2) 0 0; }

.breadcrumb {
  font-size: var(--text-sm); margin: 0 0 var(--sp-3);
}
.breadcrumb a { text-decoration: none; color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); text-decoration: underline; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--sp-5);
  overflow: hidden;
}
.panel > header {
  display: flex; align-items: baseline; gap: var(--sp-3); flex-wrap: wrap;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.panel > header h2 {
  font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-muted); font-weight: 660;
}
.panel-body { padding: var(--sp-4); }
.panel-body > :last-child { margin-bottom: 0; }

.caption { color: var(--text-muted); font-size: var(--text-sm); margin: var(--sp-3) 0 0; }
.empty { color: var(--text-muted); font-style: italic; }

/* ---------- buttons ---------- */

button, .button {
  font: inherit; font-size: var(--text-sm); font-weight: 560;
  padding: var(--sp-2) var(--sp-4); cursor: pointer;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  text-decoration: none; display: inline-block;
}
button:hover, .button:hover { background: var(--surface-2); color: var(--text); }

button.primary, .button.primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
button.primary:hover, .button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }

@media (prefers-color-scheme: dark) {
  button.primary, .button.primary { color: #0c1620; }
  button.primary:hover, .button.primary:hover { color: #0c1620; }
}

/* ---------- stat cards ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: var(--sp-3);
  margin: 0 0 var(--sp-5);
}
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius); padding: var(--sp-3) var(--sp-4);
  box-shadow: var(--shadow-sm);
}
.stat .label {
  display: block; color: var(--text-muted); font-size: var(--text-xs);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 620;
}
.stat .value { display: block; margin-top: var(--sp-1); font-size: var(--text-xl); font-weight: 660; letter-spacing: -0.02em; }
.stat.clear { border-left-color: var(--ok); }
.stat.attention { border-left-color: var(--warn); }
.stat.critical { border-left-color: var(--danger); }
.stat.info { border-left-color: var(--info); }

/* ---------- tables ---------- */

/* Wide content scrolls inside its own container; the page itself never
   scrolls sideways on a phone. */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.grid { border-collapse: collapse; width: 100%; min-width: 34rem; }
table.grid caption { text-align: left; padding: 0 var(--sp-4) var(--sp-2); color: var(--text-muted); font-size: var(--text-sm); }
table.grid th, table.grid td {
  text-align: left; padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border); vertical-align: top;
}
table.grid thead th {
  color: var(--text-muted); font-size: var(--text-xs); font-weight: 660;
  text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid tbody tr:hover td { background: var(--surface-2); }
table.grid td.tight { white-space: nowrap; }

.row-title { font-weight: 560; }
.row-sub { color: var(--text-muted); font-size: var(--text-sm); }

/* ---------- badges ---------- */

.badge {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: 0.1rem 0.55rem; border-radius: var(--radius-pill);
  font-size: var(--text-xs); font-weight: 600; white-space: nowrap;
  background: var(--neutral-soft); color: var(--neutral);
  border: 1px solid transparent;
}
.badge.state-booked, .badge.type-booking_created, .badge.outcome-success { background: var(--ok-soft); color: var(--ok); }
.badge.state-escalated, .badge.type-escalation, .badge.type-error, .badge.outcome-failure { background: var(--danger-soft); color: var(--danger); }
.badge.state-opted_out, .badge.type-opt_out, .badge.state-booking_fallback { background: var(--warn-soft); color: var(--warn); }
.badge.state-link_sent, .badge.type-text_back_sent, .badge.type-missed_call { background: var(--info-soft); color: var(--info); }

/* Risk. A low score is an ordinary lead and must not look like an incident. */
.badge.risk-low { background: var(--neutral-soft); color: var(--neutral); }
.badge.risk-medium { background: var(--warn-soft); color: var(--warn); }
.badge.risk-high { background: var(--danger-soft); color: var(--danger); }
.badge.unverified { background: var(--warn-soft); color: var(--warn); }
.badge.verified { background: var(--ok-soft); color: var(--ok); }

.flag-list { list-style: none; margin: var(--sp-2) 0 0; padding: 0; display: grid; gap: var(--sp-2); }
.flag-list li {
  display: flex; gap: var(--sp-2); align-items: baseline; flex-wrap: wrap;
  font-size: var(--text-sm);
}
.flag-code { font-weight: 600; text-transform: capitalize; }
.flag-detail { color: var(--text-muted); overflow-wrap: anywhere; }
.flag-weight { color: var(--text-muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }

/* ---------- event feed ---------- */

ul.feed { list-style: none; margin: 0; padding: 0; }
ul.feed li {
  padding: var(--sp-3) 0; border-bottom: 1px solid var(--border);
  display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: baseline;
}
ul.feed li:last-child { border-bottom: 0; }
.time { color: var(--text-muted); font-size: var(--text-sm); white-space: nowrap; font-variant-numeric: tabular-nums; }
.payload { color: var(--text-muted); font-size: var(--text-sm); overflow-wrap: anywhere; flex: 1 1 16rem; }

/* ---------- conversation thread ---------- */
/* The thing the tenant actually reads. Direction is carried by three signals
   at once - side, colour and a written label - so it survives a colourblind
   reader, a screen reader, and a printed page. */

ol.thread { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-4); }
ol.thread > li { display: grid; gap: var(--sp-1); max-width: 42rem; }
ol.thread > li.outbound { margin-left: auto; justify-items: end; }

.msg-meta {
  display: flex; gap: var(--sp-2); align-items: baseline;
  font-size: var(--text-xs); color: var(--text-muted);
}
.msg-who { font-weight: 640; text-transform: uppercase; letter-spacing: 0.05em; }

ol.thread .body {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface-2);
  white-space: pre-wrap; overflow-wrap: anywhere;
  margin: 0;
}
ol.thread li.inbound .body { border-bottom-left-radius: var(--radius-sm); }
li.outbound ol.thread .body {
  background: var(--accent-soft); border-color: var(--accent-soft);
  border-bottom-right-radius: var(--radius-sm);
}
li.system ol.thread .body {
  background: transparent; border-style: dashed; color: var(--text-muted);
  font-size: var(--text-sm);
}

/* ---------- filter bar ---------- */

.filter-bar {
  display: flex; gap: var(--sp-4); align-items: end; flex-wrap: wrap;
  padding: var(--sp-4);
}
.filter-bar label { display: grid; gap: var(--sp-1); color: var(--text-muted); font-size: var(--text-xs); font-weight: 620; text-transform: uppercase; letter-spacing: 0.05em; }
.filter-bar select {
  min-width: 9rem; padding: var(--sp-2); font: inherit; font-size: var(--text-sm);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}

/* ---------- login ---------- */

.auth-shell {
  min-height: 100dvh; display: grid; place-items: center; padding: var(--sp-5);
}
.auth-card {
  width: min(24rem, 100%);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: var(--sp-6);
}
.auth-card h1 { font-size: var(--text-lg); margin-bottom: var(--sp-1); }
.auth-card .sub { color: var(--text-muted); font-size: var(--text-sm); margin-bottom: var(--sp-5); }
.field { display: grid; gap: var(--sp-1); margin-bottom: var(--sp-4); }
.field label { font-size: var(--text-sm); font-weight: 580; }
.field input {
  padding: var(--sp-3); font: inherit; font-size: var(--text-base);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  width: 100%;
}
.auth-card button { width: 100%; padding: var(--sp-3); font-size: var(--text-base); }
.form-error {
  background: var(--danger-soft); color: var(--danger);
  border-radius: var(--radius-sm); padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm); margin: 0 0 var(--sp-4);
}
details.alt-auth { margin-top: var(--sp-5); border-top: 1px solid var(--border); padding-top: var(--sp-4); }
details.alt-auth summary { font-size: var(--text-sm); color: var(--text-muted); cursor: pointer; }
details.alt-auth summary:hover { color: var(--text); }
details.alt-auth > form { margin-top: var(--sp-4); }

/* ---------- report ---------- */

.report-actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: center; margin-bottom: var(--sp-5); }

.notice {
  border-radius: var(--radius); padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border); background: var(--surface-2);
  font-size: var(--text-sm); margin-bottom: var(--sp-5);
}
.notice.safe { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.notice.sensitive { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

textarea.markdown-source {
  width: 100%; min-height: 22rem; resize: vertical;
  font-family: var(--font-mono); font-size: var(--text-sm); line-height: 1.5;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: var(--sp-3);
}

/* ---------- responsive ---------- */

@media (max-width: 40rem) {
  main { padding: var(--sp-4) var(--sp-3); }
  .app-header { padding: var(--sp-3); gap: var(--sp-3); }
  .who .who-role { display: none; }
  table.grid th, table.grid td { padding: var(--sp-2) var(--sp-3); }
  .page-head h1 { font-size: var(--text-lg); }
  ol.thread > li { max-width: 100%; }
  ol.thread > li.outbound { margin-left: var(--sp-5); }
}

/* ---------- print (the report is meant to be printed) ---------- */

@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #fff; --border: #999; --text: #000; --text-muted: #333; }
  .app-header, .page-locator, .report-actions, .no-print, textarea.markdown-source { display: none !important; }
  body { background: #fff; color: #000; font-size: 10.5pt; }
  main { max-width: none; padding: 0; }
  .panel { break-inside: avoid; box-shadow: none; border: 1px solid #999; }
  table.grid { min-width: 0; font-size: 9.5pt; }
  a { color: #000; text-decoration: underline; }
}

/* ===========================================================================
   GTM DIGITAL OPERATOR CONSOLE

   This override moves the dashboard into the same visual language as the
   public GTM Digital site: wet-asphalt ink, quiet paper, signal green, and a
   utilitarian data face. The signature is the three-bar signal mark: a lead
   moves from missed call, to conversation, to a clear next action.
   ========================================================================== */

:root {
  color-scheme: light;
  --font-ui: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-display: "Archivo", "Arial Black", "Helvetica Neue", sans-serif;
  --font-mono: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  --bg: #f7f8fc;
  --surface: #ffffff;
  --surface-2: #f0f4ef;
  --surface-3: #e4ece4;
  --border: #ccd8ce;
  --border-strong: #9db09f;
  --text: #111827;
  --text-muted: #414e63;
  --accent: #16843a;
  --accent-hover: #0f6d2e;
  --accent-soft: #e5f3e7;
  --focus: #0f1922;
  --ok: #16714f;
  --ok-soft: #e3f8ee;
  --warn: #8a5a04;
  --warn-soft: #fbf0da;
  --danger: #b42336;
  --danger-soft: #fde9ed;
  --info: #155e9b;
  --info-soft: #e7f2fb;
  --neutral: #3f4b5d;
  --neutral-soft: #e6ebf1;
  --radius-sm: 0.55rem;
  --radius: 1rem;
  --radius-lg: 1.45rem;
  --shadow-sm: 0 1px 1px rgb(15 25 34 / 3%), 0 10px 26px rgb(15 25 34 / 4%);
  --shadow: 0 22px 58px rgb(15 25 34 / 13%);
}

body.dashboard-shell {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 6% -12%, rgb(22 132 58 / 10%), transparent 27rem),
    radial-gradient(circle at 94% 8%, rgb(15 25 34 / 6%), transparent 25rem),
    var(--bg);
}

h1, h2, h3, .brand-copy strong, .command-hero h1, .setup-hero h1, .created-hero h1 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.052em;
}

.mono, .client-code, .eyebrow, .step-number, .brand-kicker, .setup-status {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums slashed-zero;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 5.2rem;
  padding: 0.7rem clamp(1rem, 3vw, 2.5rem);
  gap: clamp(0.7rem, 2vw, 1.6rem);
  background: rgb(250 251 248 / 94%);
  border: 0;
  border-bottom: 1px solid #dbe0da;
  box-shadow: 0 8px 26px rgb(15 25 34 / 5%);
  backdrop-filter: blur(18px);
}

.app-header::before {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, #16843a 0 17%, transparent 17% 23%, #16843a 23% 100%);
  content: "";
}

.brand { gap: 0.7rem; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-copy { display: grid; line-height: 1; gap: 0.18rem; }
.brand-copy strong { font-size: 1.05rem; }
.brand-kicker { color: #3f4b60; font-size: 0.63rem; font-weight: 700; letter-spacing: 0.11em; text-transform: uppercase; }
.brand .mark {
  display: flex;
  align-items: end;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  gap: 0.12rem;
  padding: 0.42rem;
  border: 1px solid #cddacb;
  border-radius: 0.68rem;
  background: #e8f2e8;
}
.brand .mark i { display: block; width: 0.22rem; border-radius: 99px; background: #16843a; }
.brand .mark i:nth-child(1) { height: 0.52rem; }.brand .mark i:nth-child(2) { height: 0.88rem; }.brand .mark i:nth-child(3) { height: 1.27rem; }

/* Each destination is a real control: its own surface, its own border, and
   ink dark enough to read without hovering. A flat tinted word is not a
   button, and an operator should not have to discover that it was one. */
.app-nav { gap: 0.4rem; }
.app-nav a {
  padding: 0.55rem 0.95rem;
  border: 1px solid #a9bcac;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 0 rgb(15 25 34 / 7%);
  color: #1c2635;
  font-size: 0.83rem;
  font-weight: 700;
  white-space: nowrap;
}
.app-nav a:hover { border-color: #16843a; background: #ecf6ee; color: #0d5c28; }
.app-nav a:active { box-shadow: none; translate: 0 1px; }
/* The page you are on is filled, not tinted, so the answer to "where am I" is
   legible from across the room rather than from the address bar. */
.app-nav a[aria-current="page"] {
  border-color: #0f1922;
  background: #0f1922;
  box-shadow: inset 0 -3px #2ac984;
  color: #fff;
}
.app-nav a[aria-current="page"]:hover { border-color: #0f1922; background: #1c2b36; color: #fff; }
.app-nav .nav-add { border-color: #12742f; background: #16843a; color: #fff; box-shadow: 0 1px 0 rgb(15 25 34 / 12%); }
.app-nav .nav-add:hover { border-color: #0b5323; background: #0f6d2e; color: #fff; }
.app-nav .nav-add[aria-current="page"] { border-color: #0f1922; background: #0f1922; color: #fff; }
.who { gap: 0.45rem; padding-left: 0.7rem; border-left: 1px solid var(--border); }
.who .who-name { font-size: 0.78rem; font-weight: 700; }.who .who-role { font-family: var(--font-mono); font-size: 0.67rem; text-transform: uppercase; letter-spacing: 0.07em; }
.signout-form { margin-left: -0.35rem !important; }

.button, button, .button-quiet {
  border-radius: 999px;
  border-color: #cbd6cb;
  background: #fff;
  color: #263342;
  font-weight: 700;
  box-shadow: none;
}
.button:hover, button:hover, .button-quiet:hover { background: #edf4ed; border-color: #b6c7b6; color: #0f6d2e; }
.button-quiet { padding: 0.54rem 0.85rem; }
.signout-form .button-quiet { padding: 0.48rem 0.66rem; color: #414e63; border-color: transparent; background: transparent; }
.signout-form .button-quiet:hover { color: #b42336; background: #fde9ed; }
.action-button {
  display: inline-flex;
  min-height: 2.8rem;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 0 1.15rem;
  border: 1px solid #0f1922;
  border-radius: 999px;
  background: #0f1922;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 750;
  line-height: 1;
  text-decoration: none;
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}
.action-button:hover { background: #1c2b36; color: #fff; box-shadow: 0 14px 30px rgb(15 25 34 / 18%); transform: translateY(-2px); }
button.action-button { cursor: pointer; font: inherit; }

.dashboard-main { width: min(100%, 83rem); max-width: none; padding: clamp(1.25rem, 3.4vw, 3.6rem) clamp(1rem, 4vw, 3rem) 4rem; }
.eyebrow { margin: 0; color: #414e63; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.11em; line-height: 1.3; text-transform: uppercase; }

/* Operator desk */
.command-hero { position: relative; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(17rem, 0.65fr); gap: clamp(1.5rem, 5vw, 5.5rem); overflow: hidden; margin-bottom: clamp(2.5rem, 5vw, 4.5rem); padding: clamp(1.7rem, 4.5vw, 4rem); border: 1px solid #d5dfd4; border-radius: 1.7rem; background: #f7f8fc; box-shadow: 0 28px 80px rgb(15 25 34 / 9%); }
.command-hero::before { position: absolute; inset: 0; pointer-events: none; background-image: radial-gradient(circle at 14% 12%, rgb(22 132 58 / 16%), transparent 25rem), radial-gradient(circle at 82% 9%, rgb(15 25 34 / 10%), transparent 20rem), linear-gradient(115deg, transparent 0 48%, rgb(22 132 58 / 8%) 48% 48.8%, transparent 48.8% 100%); content: ""; }
.command-hero-copy, .command-pulse { position: relative; z-index: 1; }
.command-hero h1 { max-width: 12ch; margin: 0.85rem 0 1.25rem; font-size: clamp(2.8rem, 5vw, 5.4rem); line-height: 0.88; }
.command-hero h1 em { color: #16843a; font-style: normal; }
.command-hero-copy > p:not(.eyebrow) { max-width: 37rem; margin-bottom: 1.75rem; color: #2f3b4e; font-size: clamp(1rem, 1rem + .18vw, 1.15rem); line-height: 1.58; }
.command-pulse { align-self: end; padding: 1.25rem; border: 1px solid #d5dfd4; border-radius: 1.15rem; background: rgb(255 255 255 / 88%); box-shadow: 0 14px 34px rgb(15 25 34 / 8%); backdrop-filter: blur(8px); }
.pulse-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.35rem; margin-top: 1rem; }
.pulse-grid div { min-width: 0; padding: 0.2rem 0.4rem 0.45rem 0; border-right: 1px solid #dce4dc; }.pulse-grid div:last-child { border: 0; }
.pulse-grid strong { display: block; font-family: var(--font-display); font-size: clamp(1.7rem, 3vw, 2.3rem); letter-spacing: -0.07em; line-height: 1; }.pulse-grid span { display: block; margin-top: 0.4rem; color: #414e63; font-family: var(--font-mono); font-size: 0.64rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.pulse-note { display: flex; align-items: center; gap: 0.5rem; margin: 1rem 0 0; padding-top: 0.85rem; border-top: 1px solid #e0e6e0; color: #3f4b5d; font-size: 0.76rem; }.pulse-dot { width: 0.46rem; height: 0.46rem; flex: 0 0 auto; border-radius: 50%; background: #2ac984; box-shadow: 0 0 0 0.22rem rgb(42 201 132 / 14%); }

.client-section { max-width: 74rem; margin: 0 auto; }.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }.section-heading h2 { margin-top: 0.4rem; font-size: clamp(1.55rem, 3vw, 2.25rem); line-height: 0.98; }.text-action { color: #16714f; font-size: 0.84rem; font-weight: 750; text-decoration: none; white-space: nowrap; }.text-action:hover { color: #0f6d2e; }
.client-list { display: grid; border-top: 1px solid #dfe5df; }.client-card { display: grid; grid-template-columns: minmax(12rem, 1.1fr) minmax(13rem, 0.9fr) auto; gap: 1.5rem; align-items: center; padding: 1.55rem 0; border-bottom: 1px solid #dfe5df; transition: padding 180ms ease, background 180ms ease; }.client-card:hover { padding-inline: 1rem; background: rgb(235 243 235 / 70%); }.client-code { margin: 0 0 0.45rem; color: #3f4b60; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; }.client-card h3 { margin: 0; font-size: clamp(1.35rem, 2.3vw, 1.9rem); line-height: 1; }.client-card h3 a { color: #111827; text-decoration: none; }.client-card h3 a:hover { color: #16843a; }.client-detail { margin: 0.7rem 0 0; color: #414e63; font-size: 0.8rem; }.client-state > p { max-width: 21rem; margin: 0.55rem 0 0; color: #414e63; font-size: 0.78rem; line-height: 1.45; }.setup-status { display: inline-flex; padding: 0.28rem 0.55rem; border-radius: 999px; font-size: 0.66rem; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; }.setup-status-ready { background: #e3f8ee; color: #16714f; }.setup-status-attention { background: #fbf0da; color: #805204; }.setup-status-draft { background: #edf0f4; color: #3f4b5d; }.setup-status-legacy { background: #e7f2fb; color: #155e9b; }.client-card-actions { display: grid; justify-items: end; gap: 0.65rem; }.client-open { color: #0f1922; font-size: 0.78rem; font-weight: 750; text-decoration: none; white-space: nowrap; }.client-open:hover { color: #16843a; }.empty-workspace { display: grid; justify-items: start; max-width: 37rem; margin: 1.3rem 0; padding: clamp(1.5rem, 4vw, 3rem); border: 1px dashed #bfcdbf; border-radius: 1.2rem; background: rgb(255 255 255 / 62%); }.empty-workspace-mark { display: grid; width: 2.2rem; height: 2.2rem; place-items: center; border-radius: 0.7rem; background: #e8f2e8; color: #16843a; font-family: var(--font-mono); font-size: 1.2rem; }.empty-workspace h3 { margin: 1rem 0 0; font-size: 1.5rem; }.empty-workspace p { max-width: 29rem; margin: 0.6rem 0 1.25rem; color: #414e63; }

/* Universal dashboard surfaces: tenant lead pages, diagnostics, and reports. */
.page-head { max-width: 48rem; margin: 0 0 2rem; }.page-head h1 { font-size: clamp(2rem, 4vw, 3.2rem); line-height: 0.95; }.page-head .sub { margin-top: 0.8rem; color: #414e63; font-size: 0.92rem; line-height: 1.55; }.breadcrumb { display: flex; gap: 0.45rem; align-items: center; margin-bottom: 1.1rem; color: #3f4b60; font-family: var(--font-mono); font-size: 0.69rem; }.breadcrumb a { color: #414e63; font-weight: 650; }.breadcrumb a:hover { color: #16843a; }
.panel { margin-bottom: 1.35rem; border-color: #dbe4dc; border-radius: 1rem; box-shadow: var(--shadow-sm); }.panel > header { padding: 0.9rem 1.15rem; background: #fff; }.panel > header h2 { color: #3a4658; font-family: var(--font-mono); font-size: 0.71rem; font-weight: 750; letter-spacing: 0.09em; }.panel-body { padding: 1.15rem; }.stat-grid { gap: 0.8rem; margin-bottom: 1.35rem; }.stat { border-left-width: 0; border-color: #dbe4dc; border-radius: 0.9rem; box-shadow: var(--shadow-sm); }.stat .label { color: #414e63; font-family: var(--font-mono); font-size: 0.69rem; letter-spacing: 0.08em; }.stat .value { font-family: var(--font-display); font-size: clamp(1.7rem, 3vw, 2.25rem); font-weight: 800; letter-spacing: -0.065em; }.stat.clear { background: #fbfffc; border-top: 3px solid #57c495; }.stat.attention { border-top: 3px solid #e2b25a; }.stat.critical { border-top: 3px solid #e97583; }.stat.info { border-top: 3px solid #6aa9d8; }
table.grid { min-width: 38rem; }.table-scroll { border-radius: 0 0 1rem 1rem; }table.grid thead th { background: #eef4ee; color: #2f3b4e; font-family: var(--font-mono); font-size: 0.69rem; letter-spacing: 0.08em; }table.grid th, table.grid td { padding: 0.88rem 1.1rem; border-color: #e5eae5; }table.grid tbody tr:hover td { background: #f5faf5; }.badge { font-family: var(--font-mono); font-size: 0.69rem; font-weight: 700; letter-spacing: 0.02em; }.caption { color: #414e63; font-size: 0.8rem; }.filter-bar { padding: 1rem 1.15rem; }.filter-bar label { color: #414e63; font-family: var(--font-mono); font-size: 0.69rem; }.filter-bar select { border-color: #cbd6cb; border-radius: 0.55rem; }
ol.thread li.outbound .body { background: #e5f3e7; border-color: #d2e8d5; border-bottom-right-radius: var(--radius-sm); }

/* Client configuration */
.setup-hero { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(15rem, 0.7fr); gap: 2rem; align-items: end; max-width: 74rem; margin-bottom: 2rem; padding: clamp(1.3rem, 3vw, 2.5rem); border-radius: 1.35rem; background: #0f1922; color: #fff; }.setup-hero .eyebrow { color: #a8d5af; }.setup-hero h1 { max-width: 17ch; margin: 0.8rem 0; font-size: clamp(2rem, 4vw, 3.6rem); line-height: 0.93; }.setup-hero > div > p:last-child { max-width: 39rem; margin: 0; color: #c9d2dc; line-height: 1.55; }.setup-aside { padding: 1rem; border: 1px solid #35425b; border-radius: 0.9rem; background: #1c2b36; }.setup-aside strong { display: block; margin: 0.6rem 0 1rem; color: #eff5fa; font-size: 0.88rem; line-height: 1.45; }.setup-aside .text-action { color: #72c783; }.setup-form { display: grid; gap: 1.15rem; max-width: 74rem; }.form-panel { overflow: hidden; border: 1px solid #dbe4dc; border-radius: 1rem; background: #fff; box-shadow: var(--shadow-sm); }.form-panel > header { display: grid; grid-template-columns: 2.1rem 1fr; gap: 0.75rem; align-items: start; padding: 1.1rem 1.2rem; border-bottom: 1px solid #e3e8e3; background: #f7faf7; }.step-number { display: grid; width: 1.75rem; height: 1.75rem; place-items: center; border-radius: 0.55rem; background: #e8f2e8; color: #16843a; font-size: 0.61rem; font-weight: 800; }.form-panel h2 { font-size: 1.1rem; line-height: 1; }.form-panel header div > p { margin: 0.35rem 0 0; color: #414e63; font-size: 0.79rem; }.optional { color: #3f4b60; font-family: var(--font-mono); font-size: 0.58rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; padding: 1.2rem; }.field { gap: 0.4rem; margin: 0; color: #263342; font-size: 0.78rem; font-weight: 750; }.field-wide { grid-column: 1 / -1; }.field input { min-height: 2.75rem; padding: 0.55rem 0.7rem; border-color: #cbd6cb; border-radius: 0.55rem; background: #fff; color: #111827; font-size: 0.92rem; font-weight: 450; }.field input[readonly] { cursor: not-allowed; background: #f0f4ef; color: #414e63; }.field small, .check-field small { color: #414e63; font-size: 0.69rem; font-weight: 450; line-height: 1.35; }.form-panel-dark { border-color: #0f1922; background: #0f1922; color: #fff; }.form-panel-dark > header { border-color: #35425b; background: #0f1922; }.form-panel-dark .step-number { background: #1b3d28; color: #72c783; }.form-panel-dark header div > p { color: #b4c0cd; }.form-panel-dark .field { color: #eaf1f5; }.form-panel-dark .field input { border-color: #405362; background: #1c2b36; color: #fff; }.form-panel-dark .field input::placeholder { color: #9aa7b1; }.form-panel-dark .field small { color: #b4c0cd; }.check-field { display: flex; gap: 0.7rem; align-items: flex-start; margin: 0; padding: 0 1.2rem 1.2rem; color: inherit; }.check-field input { width: 1rem; height: 1rem; margin: 0.16rem 0 0; accent-color: #16843a; }.check-field strong, .check-field small { display: block; }.check-field strong { font-size: 0.83rem; }.check-field small { margin-top: 0.17rem; }.form-panel-dark .check-field { color: #fff; }.form-panel-dark .check-field small { color: #b4c0cd; }.launch-bar { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; margin-top: 0.35rem; padding: 1.2rem; border: 1px solid #dbe4dc; border-radius: 1rem; background: #f7faf7; }.launch-bar .check-field { max-width: 38rem; padding: 0; }.launch-actions { display: flex; flex: 0 0 auto; gap: 0.7rem; align-items: center; }.form-error, .form-success { max-width: 74rem; margin: 0 0 1rem; border-radius: 0.75rem; font-size: 0.82rem; font-weight: 650; }.form-error { border: 1px solid #f0b9c2; background: #fde9ed; color: #9e1e30; }.form-success { padding: 0.7rem 0.85rem; border: 1px solid #b7e5c6; background: #e9f8ee; color: #166b45; }

/* One-time credential screen. It intentionally carries no copy button or JS. */
.created-hero, .credential-reveal, .next-steps { max-width: 50rem; margin-inline: auto; }.created-hero { margin-bottom: 1.3rem; padding: clamp(1.6rem, 5vw, 3.8rem); border-radius: 1.4rem; background: #0f1922; color: #fff; }.created-hero .eyebrow { color: #a8d5af; }.created-hero h1 { max-width: 14ch; margin: 0.8rem 0; font-size: clamp(2.4rem, 6vw, 4.3rem); line-height: 0.9; }.created-hero > p:last-child { max-width: 38rem; margin: 0; color: #c9d2dc; line-height: 1.55; }.credential-reveal { margin-bottom: 1.3rem; padding: 1.4rem; border: 1px solid #d9b56e; border-radius: 1.15rem; background: #fff9ec; }.credential-reveal h2, .next-steps h2 { margin: 0.5rem 0; font-size: 1.6rem; }.credential-reveal p:not(.eyebrow), .next-steps > p:not(.eyebrow) { color: #414e63; line-height: 1.5; }.credential-reveal dl { display: grid; grid-template-columns: 1fr 1.35fr; gap: 0.75rem; margin: 1.15rem 0 0; }.credential-reveal dl div { padding: 0.8rem; border: 1px solid #ead8ae; border-radius: 0.7rem; background: #fff; }.credential-reveal dt { color: #414e63; font-family: var(--font-mono); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; }.credential-reveal dd { margin: 0.4rem 0 0; color: #16202c; font-size: 0.95rem; font-weight: 700; overflow-wrap: anywhere; }.password-reveal { font-size: 1.05rem !important; letter-spacing: 0.04em; }.next-steps { padding: clamp(1.4rem, 4vw, 2.5rem); border: 1px solid #dbe4dc; border-radius: 1.15rem; background: #fff; box-shadow: var(--shadow-sm); }.next-steps ol { display: grid; gap: 1rem; margin: 1.4rem 0; padding: 0; list-style: none; }.next-steps li { display: grid; grid-template-columns: 2rem 1fr; gap: 0.75rem; }.next-steps li > span { color: #16843a; font-family: var(--font-mono); font-size: 0.64rem; font-weight: 800; }.next-steps li strong { display: block; color: #263342; font-size: 0.9rem; line-height: 1.4; }.next-steps li p { margin: 0.3rem 0 0; color: #414e63; font-size: 0.78rem; line-height: 1.45; }.created-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; }

/* Login shares the branded product shell without needing a network-loaded font. */
.auth-shell { position: relative; overflow: hidden; background: radial-gradient(circle at 18% 18%, rgb(22 132 58 / 16%), transparent 24rem), #f7f8fc; }.auth-shell::before { position: absolute; width: min(48vw, 34rem); aspect-ratio: 1; right: -15rem; bottom: -16rem; border: 1px solid rgb(22 132 58 / 14%); border-radius: 50%; box-shadow: 0 0 0 4rem rgb(22 132 58 / 4%), 0 0 0 8rem rgb(22 132 58 / 3%); content: ""; }.auth-card { position: relative; z-index: 1; width: min(27rem, 100%); padding: 2rem; border-color: #d5dfd4; border-radius: 1.25rem; box-shadow: 0 24px 70px rgb(15 25 34 / 14%); }.auth-card h1 { font-size: 2rem; line-height: 0.94; }.auth-card .primary { border-color: #0f1922; background: #0f1922; color: #fff; }.auth-card .primary:hover { background: #1c2b36; color: #fff; }.auth-card .field input { border-color: #cbd6cb; border-radius: 0.55rem; }.auth-card .field input:focus { border-color: #16843a; outline: 3px solid rgb(22 132 58 / 15%); outline-offset: 0; }

@media (prefers-reduced-motion: no-preference) {
  .command-hero { animation: operator-rise 620ms cubic-bezier(.2,.75,.2,1) both; }.command-pulse { animation: operator-rise 620ms 120ms cubic-bezier(.2,.75,.2,1) both; }.client-card { animation: operator-rise 360ms both; }.client-card:nth-child(2) { animation-delay: 60ms; }.client-card:nth-child(3) { animation-delay: 120ms; }.client-card:nth-child(4) { animation-delay: 180ms; }
}
@keyframes operator-rise { from { opacity: 0; transform: translateY(0.65rem); } to { opacity: 1; transform: none; } }

/* At small-laptop widths the full operator nav no longer shares a row cleanly
   with both account identity and sign-out. Keep the account controls beside
   the brand, and give navigation one intentional, scrollable row of its own. */
@media (min-width: 52.01rem) and (max-width: 85rem) {
  .app-header { align-items: center; }
  .app-nav {
    order: 4;
    width: 100%;
    flex: 1 0 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    padding-bottom: 0.1rem;
    scrollbar-width: thin;
  }
  .header-spacer { display: block; flex: 1 1 auto; }
  .who { flex: 0 1 auto; margin-left: auto; }
  .signout-form { flex: 0 0 auto; }
}

@media (max-width: 52rem) {
  .app-header { align-items: center; }.app-nav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 0.1rem; }.header-spacer { display: none; }.who { margin-left: auto; }.command-hero, .setup-hero { grid-template-columns: 1fr; }.command-pulse { max-width: 29rem; }.client-card { grid-template-columns: 1fr auto; }.client-state { grid-column: 1 / -1; }.client-card-actions { grid-column: 2; grid-row: 1; }.form-grid { grid-template-columns: 1fr; }.field-wide { grid-column: auto; }.launch-bar { align-items: stretch; flex-direction: column; }.launch-actions { justify-content: flex-end; }.credential-reveal dl { grid-template-columns: 1fr; }
}

@media (max-width: 35rem) {
  .dashboard-main { padding-inline: 0.8rem; }.app-header { padding-inline: 0.8rem; }.brand-copy strong { font-size: 0.95rem; }.who { display: none; }.app-nav a { padding-inline: 0.56rem; font-size: 0.73rem; }.command-hero { padding: 1.25rem; border-radius: 1.15rem; }.command-hero h1 { font-size: 2.6rem; }.client-card { gap: 0.8rem; }.client-card-actions .button { padding-inline: 0.65rem; }.client-open { display: none; }.setup-hero { padding: 1.25rem; }.setup-hero h1 { font-size: 2.15rem; }.form-panel > header { padding-inline: 0.9rem; }.form-grid { padding: 0.95rem; }.launch-actions { flex-direction: column-reverse; align-items: stretch; }.launch-actions > * { text-align: center; }.created-hero, .credential-reveal, .next-steps { border-radius: 1rem; }
}

/* Operator data inspector. The evidence path is the visual signature: each
   record traces capture -> state -> stored scratch data -> source thread. */
.inspector-hero,
.analysis-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(17rem, 0.65fr);
  gap: clamp(1.5rem, 5vw, 5rem);
  align-items: end;
  margin-bottom: 1rem;
  padding: clamp(1.5rem, 4vw, 3.4rem);
  border-radius: 1.45rem;
  background: #0f1922;
  color: #fff;
  box-shadow: 0 24px 60px rgb(15 25 34 / 16%);
}
.inspector-hero .eyebrow, .analysis-hero .eyebrow { color: #8bd399; }
.inspector-hero h1, .analysis-hero h1 { max-width: 13ch; margin: 0.75rem 0 1rem; font-size: clamp(2.5rem, 5vw, 4.7rem); line-height: 0.9; }
.inspector-hero > div > p:last-child, .analysis-hero > div > p:last-child { max-width: 42rem; margin: 0; color: #c9d2dc; font-size: 0.96rem; line-height: 1.6; }
.inspector-safety, .analysis-safety { padding: 1.15rem; border: 1px solid #354657; border-radius: 1rem; background: #1a2935; }
.inspector-safety strong, .analysis-safety strong { display: block; margin: 0.9rem 0 0.4rem; color: #f5f8fa; font-size: 0.92rem; }
.inspector-safety p, .analysis-safety p { color: #b9c5cf; font-size: 0.78rem; line-height: 1.5; }
.inspector-safety a, .analysis-safety a { color: #8bd399; font-size: 0.78rem; font-weight: 750; }

.inspector-modes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 1rem; border: 1px solid #dbe4dc; border-radius: 1rem; background: #fff; overflow: hidden; }
.inspector-modes a { display: flex; align-items: center; min-height: 3.4rem; padding: 0.8rem 1rem; border-right: 1px solid #e2e8e2; color: #2f3b4e; font-size: 0.78rem; font-weight: 750; text-decoration: none; }
.inspector-modes a:last-child { border-right: 0; }
.inspector-modes a:hover { background: #f2f8f3; color: #16843a; }
.inspector-modes a[aria-current="page"] { background: #e8f4e9; color: #126b30; box-shadow: inset 0 -3px #16843a; }
.inspector-filter-panel, .analysis-filter-panel { margin-bottom: clamp(2rem, 4vw, 3rem); }
.inspector-filters, .analysis-filters { align-items: end; }
.inspector-filters button, .analysis-filters button { min-height: 2.45rem; }

.inspector-section-head { display: flex; gap: 1.5rem; align-items: end; justify-content: space-between; margin-bottom: 1rem; }
.inspector-section-head h2 { margin-top: 0.38rem; font-size: clamp(1.45rem, 3vw, 2.15rem); line-height: 1; }
.inspector-section-head > p { max-width: 28rem; margin: 0; color: #414e63; font-size: 0.78rem; text-align: right; }
.evidence-list { display: grid; gap: 0.9rem; margin: 0; padding: 0; list-style: none; }
.evidence-record { overflow: hidden; border: 1px solid #dbe4dc; border-radius: 1rem; background: #fff; box-shadow: var(--shadow-sm); }
.evidence-record.evidence-attention { border-left: 4px solid #e2b25a; }
.evidence-record > header, .operation-card > header { display: flex; gap: 1rem; align-items: center; justify-content: space-between; padding: 1rem 1.15rem; }
.record-id { margin: 0 0 0.3rem; color: #414e63; font-family: var(--font-mono); font-size: 0.66rem; font-weight: 750; letter-spacing: 0.08em; }
.evidence-record h3, .operation-card h3 { margin: 0; font-size: 1.08rem; line-height: 1.1; }
.evidence-path { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-block: 1px solid #e5eae5; background: #f7faf7; }
.evidence-path::before { position: absolute; top: 1.25rem; right: 12.5%; left: 12.5%; height: 1px; background: #b9c9ba; content: ""; }
.evidence-path div { position: relative; z-index: 1; min-width: 0; padding: 0.85rem 1rem; }
.evidence-path div::before { display: block; width: 0.48rem; height: 0.48rem; margin-bottom: 0.7rem; border: 3px solid #f7faf7; border-radius: 50%; background: #16843a; box-shadow: 0 0 0 1px #8bb292; content: ""; }
.evidence-path span { display: block; color: #3f4b60; font-family: var(--font-mono); font-size: 0.64rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.evidence-path strong, .evidence-path a { display: block; margin-top: 0.28rem; color: #263342; font-size: 0.72rem; line-height: 1.4; overflow-wrap: anywhere; }
.evidence-path a { color: #126b30; font-weight: 750; }
.evidence-summary { margin: 0; padding: 1rem 1.15rem 0.55rem; color: #2b3646; font-size: 0.88rem; line-height: 1.55; }
.evidence-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0 1.15rem 1rem; }
.scratchpad { border-top: 1px solid #e5eae5; background: #fbfcfb; }
.scratchpad summary { padding: 0.78rem 1.15rem; color: #2f3b4e; cursor: pointer; font-family: var(--font-mono); font-size: 0.65rem; font-weight: 700; overflow-wrap: anywhere; }
.scratchpad summary:hover { color: #126b30; }
.scratchpad pre, .inspector-payload { max-height: 24rem; margin: 0; padding: 1rem 1.15rem; overflow: auto; background: #14212c; color: #dce8e0; font-family: var(--font-mono); font-size: 0.7rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.evidence-list-compact .evidence-record > header { border-bottom: 1px solid #e5eae5; }
.inspector-empty { display: grid; gap: 0.35rem; padding: 2rem; border: 1px dashed #bfcdbf; border-radius: 1rem; color: #414e63; background: rgb(255 255 255 / 55%); }
.inspector-empty strong { color: #1c2635; }

.operation-timeline { position: relative; display: grid; gap: 0; margin: 0; padding: 0 0 0 1.2rem; list-style: none; }
.operation-timeline::before { position: absolute; top: 1.3rem; bottom: 1.3rem; left: 0.28rem; width: 1px; background: #b9c9ba; content: ""; }
.operation-record { position: relative; padding: 0 0 0.9rem; }
.operation-marker { position: absolute; top: 1.3rem; left: -1.2rem; width: 0.58rem; height: 0.58rem; border: 3px solid #f7f8fc; border-radius: 50%; background: #57c495; box-shadow: 0 0 0 1px #8bb292; }
.operation-record.outcome-failure .operation-marker { background: #e97583; box-shadow: 0 0 0 1px #cf8893; }
.operation-card { overflow: hidden; border: 1px solid #dbe4dc; border-radius: 0.9rem; background: #fff; }
.operation-facts { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; padding: 0.7rem 1.15rem; border-block: 1px solid #e5eae5; background: #f7faf7; color: #414e63; font-family: var(--font-mono); font-size: 0.69rem; }
.operation-cause { margin: 0; padding: 0.85rem 1.15rem 0.3rem; color: #4a3441; font-size: 0.8rem; overflow-wrap: anywhere; }
.operation-card > a { display: inline-block; padding: 0.65rem 1.15rem 0.9rem; color: #126b30; font-size: 0.76rem; font-weight: 750; }
.inspector-config-grid td .row-sub { display: block; margin-top: 0.42rem; line-height: 1.5; }
.inspector-config-grid td > .badge + .row-sub { margin-top: 0.5rem; }
.inspector-pagination { display: flex; flex-wrap: wrap; gap: 0.9rem; align-items: center; justify-content: flex-end; margin-top: 1.2rem; }
.inspector-pagination > a:not(.button) { color: #414e63; font-size: 0.76rem; font-weight: 700; }

@media (max-width: 52rem) {
  .inspector-hero, .analysis-hero { grid-template-columns: 1fr; }
  .inspector-safety, .analysis-safety { max-width: 34rem; }
  .inspector-modes { grid-template-columns: repeat(2, 1fr); }
  .inspector-modes a:nth-child(2) { border-right: 0; }
  .inspector-modes a:nth-child(-n+2) { border-bottom: 1px solid #e2e8e2; }
  .evidence-path { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .evidence-path::before { display: none; }
  .inspector-section-head { align-items: start; flex-direction: column; }
  .inspector-section-head > p { text-align: left; }
}

@media (max-width: 35rem) {
  .inspector-hero, .analysis-hero { padding: 1.25rem; border-radius: 1.05rem; }
  .inspector-hero h1, .analysis-hero h1 { font-size: 2.6rem; }
  .inspector-modes a { padding-inline: 0.7rem; }
  .evidence-record > header, .operation-card > header { align-items: flex-start; flex-direction: column; }
  .evidence-path { grid-template-columns: 1fr; }
  .evidence-path div { border-bottom: 1px solid #e5eae5; }
  .evidence-path div:last-child { border-bottom: 0; }
  .inspector-pagination { align-items: stretch; flex-direction: column; }
  .inspector-pagination .button { text-align: center; }
}

/* Operator data analysis. It reuses the inspector's hero, filter bar and empty
   state on purpose - the two pages are one job - and adds only the shapes a
   count needs: a ranked conclusion, a funnel, and proportion bars. */
.finding-list { display: grid; gap: 0.7rem; margin: 0 0 clamp(2rem, 4vw, 3rem); padding: 0; list-style: none; }
.finding { display: grid; grid-template-columns: 0.28rem minmax(0, 1fr); overflow: hidden; border: 1px solid #dbe4dc; border-radius: 1rem; background: #fff; box-shadow: var(--shadow-sm); }
.finding-mark { background: #b9c9ba; }
.finding-alert .finding-mark { background: #d1495b; }
.finding-watch .finding-mark { background: #e2b25a; }
.finding-steady .finding-mark { background: #16843a; }
.finding-body { padding: 1rem 1.15rem; }
.finding-body > header { display: flex; gap: 1rem; align-items: baseline; justify-content: space-between; }
.finding-body h3 { margin: 0; font-size: 1.02rem; line-height: 1.2; }
.finding-body p { margin: 0.5rem 0 0; color: #333f52; font-size: 0.85rem; line-height: 1.6; }
.finding-body > a { display: inline-block; margin-top: 0.7rem; color: #126b30; font-size: 0.76rem; font-weight: 750; }
.badge.severity-alert { border-color: #e3b8bf; color: #8d2437; background: #fbeef0; }
.badge.severity-watch { border-color: #e4d0a8; color: #7a5613; background: #fcf5e6; }
.badge.severity-steady { border-color: #b6d8bd; color: #126b30; background: #edf7ef; }

.analysis-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1.5rem, 4vw, 3rem); margin-bottom: clamp(2rem, 4vw, 3rem); }

.funnel { display: grid; gap: 0.9rem; margin: 0; padding: 0; list-style: none; }
.funnel-head { display: flex; gap: 1rem; align-items: baseline; justify-content: space-between; }
.funnel-head strong { font-size: 0.86rem; }
.funnel-count { color: #263342; font-family: var(--font-mono); font-size: 0.86rem; font-weight: 750; }
.funnel-share { margin-left: 0.3rem; color: #414e63; font-size: 0.7rem; font-weight: 700; }
.funnel-track { height: 0.62rem; margin-top: 0.42rem; overflow: hidden; border-radius: 0.4rem; background: #e7ece7; }
.funnel-fill { display: block; height: 100%; border-radius: 0.4rem; background: linear-gradient(90deg, #16843a, #57c495); }
.funnel-meaning { margin: 0.4rem 0 0; color: #414e63; font-size: 0.74rem; line-height: 1.5; }
.analysis-note { margin: 1rem 0 0; padding-top: 0.9rem; border-top: 1px solid #e2e8e2; color: #333f52; font-size: 0.82rem; }

/* Legend for the lost-lead breakdown: the label alone says what happened, the
   definition says what an operator should do about it. Same ink as
   `.analysis-note`, which is the established weight for explanatory text. */
.analysis-legend { display: grid; grid-template-columns: minmax(8rem, auto) 1fr; gap: 0.35rem 0.9rem; margin: 0.9rem 0 0; font-size: 0.78rem; }
.analysis-legend dt { color: #1c2635; font-weight: 700; }
.analysis-legend dd { margin: 0; color: #333f52; line-height: 1.5; }
@media (max-width: 40rem) {
  .analysis-legend { grid-template-columns: 1fr; gap: 0.15rem; }
  .analysis-legend dd { margin-bottom: 0.5rem; }
}

.distribution { display: grid; gap: 0.6rem; margin: 0; padding: 0; list-style: none; }
.distribution > li:not(.inspector-empty) { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(4rem, 0.9fr) auto; gap: 0.7rem; align-items: center; }
.distribution-label { color: #1c2635; font-size: 0.8rem; overflow-wrap: anywhere; }
.distribution-label .row-sub { display: block; margin-top: 0.2rem; color: #414e63; font-size: 0.68rem; line-height: 1.45; }
.distribution-bar { height: 0.5rem; overflow: hidden; border-radius: 0.35rem; background: #e7ece7; }
.distribution-bar span { display: block; height: 100%; border-radius: 0.35rem; background: #57c495; }
.distribution-bar span.bar-short { background: #e2b25a; }
.distribution-count { color: #263342; font-family: var(--font-mono); font-size: 0.76rem; font-weight: 750; text-align: right; white-space: nowrap; }
.distribution-count .muted { margin-left: 0.3rem; font-size: 0.68rem; font-weight: 700; }
.analysis-operation-grid td { font-size: 0.78rem; white-space: nowrap; }

@media (max-width: 52rem) {
  .analysis-columns { grid-template-columns: 1fr; }
}

@media (max-width: 35rem) {
  .finding-body > header { align-items: flex-start; flex-direction: column; gap: 0.45rem; }
  .distribution > li:not(.inspector-empty) { grid-template-columns: minmax(0, 1fr) auto; }
  .distribution-bar { display: none; }
}

/* ===========================================================================
   READABILITY LAYER

   Two things the console kept failing to answer at a glance: "is that a
   button?" and "which page am I on?". Everything here exists to answer one of
   them, or to stop a label being the lightest thing on a white page.
   ========================================================================== */

/* Where you are, in words, for the operator tools that are not reached through
   a client. The client pages carry their own breadcrumb to the client they
   belong to, so they are left alone. */
.page-locator {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 1.15rem;
  color: #3f4b60;
  font-family: var(--font-mono);
  font-size: 0.73rem;
  font-weight: 650;
}
.page-locator strong {
  padding: 0.2rem 0.6rem;
  border: 1px solid #c3d2c5;
  border-radius: 999px;
  background: #eaf3eb;
  color: #0f1922;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.page-locator-sep { color: #7b8896; }

/* Who a conversation is with. The name leads, a four-character handle tells
   two people of the same name apart, and the phone number - which nobody
   recognises on sight - drops to the supporting line it always was. */
.customer-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
}
.customer-name {
  color: #111827;
  font-size: 0.97rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.customer-name.is-unknown { color: #3f4b60; font-style: italic; font-weight: 650; }
.customer-ref {
  display: inline-block;
  padding: 0.08rem 0.42rem;
  border: 1px solid #bccbbe;
  border-radius: 0.4rem;
  background: #f1f6f1;
  color: #2f3b4e;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.customer-phone {
  display: block;
  margin-top: 0.3rem;
  color: #3f4b60;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}
/* As a page heading the name keeps the heading's own type - only the handle
   beside it stays small. */
.page-head h1.customer-line { align-items: baseline; gap: 0.65rem; margin-bottom: 0.15rem; }
.page-head h1 .customer-name {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}
.page-head h1 .customer-name.is-unknown { color: #3f4b60; font-style: italic; }
.page-head .customer-ref { padding: 0.18rem 0.6rem; font-size: 0.9rem; }
ul.feed .customer-line { flex: 0 0 auto; }
ul.feed .customer-name { font-size: 0.86rem; }
ul.feed .customer-phone { display: inline; margin: 0; }

/* A table row's leading cell is the thing being scanned; 560 was not enough
   weight to separate it from the data beside it. */
.row-title { color: #111827; font-weight: 750; }
.row-sub { color: #3f4b60; }

/* The inspector's view switcher is the same promise as the header nav, so it
   keeps the same tells: a raised inactive state, a filled current one. */
.inspector-modes a { background: #fbfdfb; color: #1c2635; font-size: 0.82rem; }
.inspector-modes a:hover { background: #ecf6ee; color: #0d5c28; }
.inspector-modes a[aria-current="page"] {
  background: #0f1922;
  color: #fff;
  box-shadow: inset 0 -3px #2ac984;
}

/* Trails back out of a page were the same weight as the page's own quiet
   captions, which made them read as decoration. */
.breadcrumb { font-size: 0.76rem; font-weight: 650; }
.breadcrumb a { color: #2f3b4e; text-decoration: underline; text-underline-offset: 3px; }
.breadcrumb a:hover { color: #0d5c28; }

/* Keyboard focus has to survive the filled states above. */
.app-nav a:focus-visible,
.inspector-modes a:focus-visible {
  outline: 3px solid #16843a;
  outline-offset: 2px;
}

/* --- problem reports ------------------------------------------------------
   The client's own words, and the operator's queue of them. Deliberately the
   same ink and weights as the rest of the desk: a report is ordinary content,
   not an alarm, and styling it as one would make the channel feel like an
   escalation nobody wants to use. */
.problem-form { display: grid; gap: 0.75rem; max-width: 44rem; }
.problem-form textarea { resize: vertical; min-height: 5rem; }
.problem-form .button { justify-self: start; }

.subhead { margin: 1.6rem 0 0.6rem; color: #1c2635; font-size: 0.9rem; }

.problem-list { display: grid; gap: 0.9rem; margin: 0; padding: 0; list-style: none; }
.problem-list > li { padding: 0.9rem 1rem; border: 1px solid #dfe6df; border-radius: 0.6rem; background: #fff; }
.problem-head { display: flex; gap: 0.6rem; align-items: center; justify-content: space-between; }
.problem-head strong { color: #1c2635; font-size: 0.87rem; }
/* `pre-wrap` because a report is typed prose: the line breaks the client put
   in are part of what they are telling us. */
.problem-body { margin: 0.5rem 0 0; color: #243043; font-size: 0.84rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.problem-meta { margin: 0.4rem 0 0; font-size: 0.74rem; }
.problem-note { margin: 0.6rem 0 0; padding: 0.55rem 0.7rem; border-left: 3px solid #57c495; border-radius: 0 0.35rem 0.35rem 0; background: #f2f8f4; color: #243043; font-size: 0.8rem; }

.pill { padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.7rem; font-weight: 700; white-space: nowrap; }
.pill-open { border: 1px solid #e2b25a; background: #fdf6e8; color: #6b4c12; }
.pill-done { border: 1px solid #a9bcac; background: #f1f5f1; color: #33503f; }

.problem-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: end; margin-top: 0.8rem; padding-top: 0.8rem; border-top: 1px solid #eef2ee; }
.problem-actions .field-inline { display: grid; flex: 1 1 18rem; gap: 0.25rem; color: #414e63; font-size: 0.74rem; }
.problem-buttons { display: flex; gap: 0.5rem; }

.notice-good { margin: 0 0 0.9rem; padding: 0.6rem 0.8rem; border: 1px solid #9fd6bb; border-radius: 0.5rem; background: #f2f8f4; color: #23503c; font-size: 0.82rem; }
.notice-bad { margin: 0 0 0.9rem; padding: 0.6rem 0.8rem; border: 1px solid #e6b3ad; border-radius: 0.5rem; background: #fdf3f2; color: #7a2f26; font-size: 0.82rem; }
