/* SmarterClaims console, clickthrough stylesheet, revised 2 Oct 2026.
   Brand colours: Navy #1B2B4F, Burgundy #8B2635, Charcoal #2D2A27, Cream #F3EFE9, Off-white #F8F6F3.
   Radii as on smarterclaims.co.uk: 8px for buttons and controls, 12px for cards, 100px for small tags.
   Type: Segoe UI where present, otherwise the system face. Sizes in rem so the page scales with the screen. */

:root {
  --page: #F6F4F0;
  --panel: #FFFFFF;
  --cream: #F3EFE9;
  --cream-2: #EBE6DD;
  --line: #E6DCC8;
  --line-soft: #EEE8DD;
  --ink: #1B2B4F;
  --text: #2D2A27;
  --muted: #5C5249;
  --faint: #8A7F73;
  --burgundy: #8B2635;
  --burgundy-soft: rgba(139, 38, 53, 0.08);
  --navy-soft: rgba(27, 43, 79, 0.07);
  --ok: #2F6B4F;
  --ok-soft: rgba(47, 107, 79, 0.10);
  --shadow: 0 1px 2px rgba(27, 43, 79, 0.05), 0 6px 18px rgba(27, 43, 79, 0.06);
  --on-ink: #FFFFFF;
  --chart-soft: #E6DCC8;
  --chart-mid: #628FC7;
  --sans: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --r-ctl: 8px;
  --r-card: 12px;
  --r-tag: 100px;
  --side: 15.5rem;
  --side-min: 4.25rem;
  color-scheme: light;
}
:root[data-theme="dark"], body:has(#theme-dark:checked) {
  --on-ink: #1B1A18;
  --chart-soft: #4A443D;
  --chart-mid: #7FA6D9;
  --page: #1B1A18;
  --panel: #24221F;
  --cream: #2D2A27;
  --cream-2: #36322E;
  --line: #3D3833;
  --line-soft: #343029;
  --ink: #F3EFE9;
  --text: #EDE7DD;
  --muted: #BDB3A5;
  --faint: #8A7F73;
  --burgundy: #C7505F;
  --burgundy-soft: rgba(199, 80, 95, 0.14);
  --navy-soft: rgba(243, 239, 233, 0.08);
  --ok: #7FB89A;
  --ok-soft: rgba(127, 184, 154, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #1B1A18; --panel: #24221F; --cream: #2D2A27; --cream-2: #36322E; --line: #3D3833; --line-soft: #343029;
    --ink: #F3EFE9; --text: #EDE7DD; --muted: #BDB3A5; --faint: #8A7F73; --burgundy: #C7505F;
    --burgundy-soft: rgba(199, 80, 95, 0.14); --navy-soft: rgba(243, 239, 233, 0.08); --ok: #7FB89A; --ok-soft: rgba(127, 184, 154, 0.14);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px rgba(0, 0, 0, 0.25); color-scheme: dark;
    --on-ink: #1B1A18; --chart-soft: #4A443D; --chart-mid: #7FA6D9;
  }
  :root:not([data-theme="light"]) .wordmark .primary { display: none; }
  :root:not([data-theme="light"]) .wordmark .reversed { display: block; }
}

/* The page scales with the screen: 14px at a laptop, 18px on a large monitor. */
html { font-size: clamp(14px, 0.45vw + 7.6px, 18px); }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--page); color: var(--text); font-family: var(--sans); font-size: 1rem; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { font-weight: 600; color: var(--ink); margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; line-height: 1.2; }
h2 { font-size: 1.1rem; line-height: 1.3; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.6rem; }
.sr { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 0.86rem; }
/* Icons are stroked line drawings; diagrams and charts set their own strokes. */
svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.journey svg, .chart { stroke: none; stroke-width: 1; }
.journey svg text, .chart text { stroke: none; }

/* ---------- Shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--side); flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--line);
  padding: 1.1rem 0.9rem 1rem; display: flex; flex-direction: column; gap: 1.1rem;
  position: sticky; top: 0; height: 100vh; transition: width .18s ease; z-index: 30; /* its menus open over the main column */
}
.side-top { display: flex; align-items: center; justify-content: space-between; min-height: 2.2rem; padding: 0 0.35rem; }
.wordmark img { display: block; height: auto; }
.wordmark .primary, .wordmark .reversed { width: 8.4rem; }
.wordmark .reversed, .wordmark .mark { display: none; }
:root[data-theme="dark"] .wordmark .primary { display: none; }
:root[data-theme="dark"] .wordmark .reversed { display: block; }
body:has(#theme-dark:checked) .wordmark .primary { display: none; }
body:has(#theme-dark:checked) .wordmark .reversed { display: block; }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: var(--r-ctl); color: var(--muted); cursor: pointer; }
.iconbtn:hover { background: var(--cream); color: var(--ink); }

/* Collapsed navigation: icons only, the s. mark in place of the wordmark. */
body:has(#nav-collapsed:checked) .sidebar { width: var(--side-min); padding-left: 0.6rem; padding-right: 0.6rem; }
body:has(#nav-collapsed:checked) .lbl, body:has(#nav-collapsed:checked) .nav .count, body:has(#nav-collapsed:checked) .wordmark .primary, body:has(#nav-collapsed:checked) .wordmark .reversed,
body:has(#nav-collapsed:checked) .switcher, body:has(#nav-collapsed:checked) .env b { display: none; }
body:has(#nav-collapsed:checked) .wordmark .mark { display: block; width: 1.9rem; }
body:has(#nav-collapsed:checked) .side-top { flex-direction: column; gap: 0.6rem; }
body:has(#nav-collapsed:checked) .nav a { justify-content: center; padding: 0.6rem 0; }
body:has(#nav-collapsed:checked) .foot { align-items: center; }
body:has(#nav-collapsed:checked) .env { justify-content: center; }

/* Agent switcher: one slim row. */
.switcher { position: relative; }
.switcher summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.6rem; border: 1px solid var(--line); border-radius: var(--r-ctl); color: var(--ink); }
.switcher summary::-webkit-details-marker { display: none; }
.switcher summary svg { margin-left: auto; color: var(--faint); }
.switcher[open] summary svg { transform: rotate(180deg); }
.switcher .agent { font-weight: 600; }
.live, .draft { font-size: 0.72rem; font-weight: 600; padding: 0.1rem 0.5rem; border-radius: var(--r-tag); }
.live { color: var(--ok); background: var(--ok-soft); }
.draft { color: var(--muted); background: var(--cream-2); }
.switcher .menu, .user .menu { position: absolute; z-index: 20; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 0.4rem; min-width: 100%; }
.switcher .menu { left: 0; right: 0; top: calc(100% + 0.35rem); }
.switcher .menu a, .user .menu a { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.5rem 0.6rem; border-radius: var(--r-ctl); color: var(--text); }
.switcher .menu a:hover, .user .menu a:hover { background: var(--cream); text-decoration: none; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 0.35rem 0; }

.nav { display: flex; flex-direction: column; gap: 0.15rem; }
.nav a { display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 0.7rem; border-radius: var(--r-ctl); color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--cream); color: var(--ink); text-decoration: none; }
.nav a.active { color: var(--ink); background: var(--navy-soft); }
.nav a svg { color: inherit; }
.nav .count { margin-left: auto; font-size: 0.75rem; font-weight: 600; color: var(--burgundy); background: var(--burgundy-soft); padding: 0.05rem 0.5rem; border-radius: var(--r-tag); }
.foot { margin-top: auto; display: flex; flex-direction: column; gap: 0.6rem; padding: 0; }
.foot .env { padding: 0 0.5rem; }
.env { font-size: 0.82rem; color: var(--faint); display: flex; justify-content: space-between; }
.env b { color: var(--burgundy); font-weight: 600; }
.theme { display: flex; align-items: center; gap: 0.6rem; font-size: 0.86rem; color: var(--muted); cursor: pointer; }
.theme .sw, .toggle .sw, .envrow .sw { width: 2rem; height: 1.15rem; border-radius: var(--r-tag); background: var(--cream-2); border: 1px solid var(--line); position: relative; flex-shrink: 0; }
.theme .sw::after, .toggle .sw::after, .envrow .sw::after { content: ""; position: absolute; top: 0.1rem; left: 0.1rem; width: 0.8rem; height: 0.8rem; border-radius: 50%; background: var(--faint); transition: left .15s; }
body:has(#theme-dark:checked) .theme .sw { background: var(--ink); border-color: var(--ink); }
body:has(#theme-dark:checked) .theme .sw::after { left: calc(100% - 0.95rem); background: var(--page); }

.main { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; }
.anchor { position: absolute; top: 0; left: 0; width: 0; height: 0; }
.topbar { background: var(--panel); border-bottom: 1px solid var(--line); padding: 0.9rem 2.2rem; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-height: 4.1rem; }
.tb-left { display: flex; flex-direction: column; gap: 0.15rem; }
.tb-left h1 { display: inline; }
.h1-meta { display: inline-block; margin-left: 0.7rem; font-size: 0.9rem; color: var(--muted); }
.crumbs { font-size: 0.82rem; color: var(--faint); display: flex; align-items: center; gap: 0.4rem; }
.crumbs a { color: var(--muted); }
.crumbs .sep { color: var(--line); }
.gsearch { position: relative; width: min(34rem, 42vw); }
.gsearch .search { width: 100%; min-width: 0; }
.gsearch .results { display: none; position: absolute; left: 0; right: 0; top: calc(100% + 0.4rem); z-index: 30; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 0.6rem; }
.gsearch:focus-within .results { display: block; }
.gsearch .results .group { font-size: 0.74rem; font-weight: 600; color: var(--faint); padding: 0.5rem 0.6rem 0.2rem; }
.gsearch .results a { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.5rem 0.6rem; border-radius: var(--r-ctl); color: var(--text); font-size: 0.93rem; }
.gsearch .results a:hover { background: var(--cream); text-decoration: none; }
.gsearch .results a span.where { font-size: 0.8rem; color: var(--faint); white-space: nowrap; }
.gsearch .results .hint { font-size: 0.8rem; color: var(--faint); padding: 0.5rem 0.6rem 0.2rem; border-top: 1px solid var(--line-soft); margin-top: 0.3rem; }
.user { position: relative; }
.user summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.55rem; padding: 0.4rem 0.5rem 0.4rem 0.4rem; border-radius: var(--r-ctl); }
.user .uname, .user .urole { white-space: nowrap; }
body:has(#nav-collapsed:checked) .user .uname, body:has(#nav-collapsed:checked) .user .urole, body:has(#nav-collapsed:checked) .user summary svg { display: none; }
body:has(#nav-collapsed:checked) .user summary { justify-content: center; padding: 0.4rem 0; }
body:has(#nav-collapsed:checked) .user .menu { left: calc(100% + 0.5rem); bottom: 0; }
body:has(#nav-collapsed:checked) .user .menu .lbl { display: inline; } /* the menu keeps its words when the rail loses its labels */
.user summary::-webkit-details-marker { display: none; }
.user summary:hover { background: var(--cream); }
.user summary svg { color: var(--faint); margin-left: auto; }
.avatar { width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--ink); color: var(--page); font-size: 0.72rem; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.uname { font-weight: 500; }
.urole { font-size: 0.78rem; color: var(--muted); }
.user .menu { left: 0; bottom: calc(100% + 0.4rem); min-width: 16rem; }
.user .menu label.theme { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.5rem 0.6rem; border-radius: var(--r-ctl); font-size: 0.93rem; color: var(--text); }
.user .menu label.theme:hover { background: var(--cream); }
.user .menu label.theme .lbl { display: inline; }
.user .menu .envrow { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.5rem 0.6rem; font-size: 0.93rem; color: var(--text); white-space: nowrap; }
.user .menu .envrow a.sw { display: inline-block; }
.user .menu .envrow.off { cursor: not-allowed; }
.user .menu .envrow .sw.off { opacity: 0.45; }
.user .menu .envrow .sw.on { background: var(--ink); border-color: var(--ink); }
.user .menu .envrow .sw.on::after { left: calc(100% - 0.95rem); background: var(--page); }
.user .menu .who { padding: 0.5rem 0.6rem; display: flex; flex-direction: column; gap: 0.1rem; font-size: 0.86rem; }
.user .menu .who span { color: var(--muted); }
.content { padding: 1.6rem 2.2rem 2.5rem; display: flex; flex-direction: column; gap: 1.6rem; }
.content > .screen { display: flex; flex-direction: column; gap: 1.6rem; flex: 1; } /* each screen is swapped in whole; it carries the same rhythm as the column it sits in */
.asof { margin-top: auto; padding-top: 1.5rem; font-size: 0.82rem; color: var(--faint); }

/* ---------- Layout helpers ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; }
.grid-wide { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(18rem, 1fr); gap: 1.4rem; }
.row { display: flex; align-items: center; gap: 0.8rem; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 0.5rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card); padding: 1.2rem 1.4rem; }
.card.cream { background: var(--cream); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.9rem; }
.card-head p { margin: 0.2rem 0 0; font-size: 0.86rem; color: var(--muted); }
.note { font-size: 0.86rem; color: var(--muted); }
.defn { font-size: 0.82rem; color: var(--faint); }

/* ---------- Stat cards: whole card is the link ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; }
a.stat, .stat { display: flex; flex-direction: column; gap: 0.35rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card); padding: 1.1rem 1.3rem; color: inherit; transition: border-color .12s, box-shadow .12s, transform .12s; }
a.stat:hover { text-decoration: none; border-color: var(--ink); box-shadow: var(--shadow); transform: translateY(-1px); }
.stat .t { font-size: 0.86rem; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 0.5rem; }
.stat .t svg { color: var(--ink); }
.stat .v { font-size: 2rem; font-weight: 600; color: var(--ink); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .v .unit { font-size: 0.95rem; font-weight: 500; color: var(--muted); margin-left: 0.3rem; }
.stat .c { font-size: 0.86rem; color: var(--muted); }
.stat .c b { color: var(--burgundy); font-weight: 600; }
.stat .open { margin-top: 0.4rem; font-size: 0.82rem; font-weight: 600; color: var(--ink); }
.stat.hot { border-color: var(--burgundy); }
.stat.hot .v { color: var(--burgundy); }

/* ---------- Tables ---------- */
.toolbar { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.search { display: inline-flex; align-items: center; gap: 0.5rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 0 0.7rem; min-width: 18rem; color: var(--faint); }
.search input[type="search"] { border: 0; background: transparent; padding: 0.5rem 0; width: 100%; font: inherit; color: var(--text); outline: none; border-radius: 0; }
.search input[type="search"]:focus { outline: none; border: 0; }
.search:focus-within { border-color: var(--ink); box-shadow: 0 0 0 2px var(--navy-soft); }
.filters { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.sortctl { margin-left: auto; display: inline-flex; align-items: center; gap: 0.4rem; color: var(--faint); }
.sortctl select { width: auto; }
.tablewrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
thead th { text-align: left; font-size: 0.78rem; font-weight: 600; color: var(--muted); padding: 0.7rem 1rem; border-bottom: 1px solid var(--line); background: var(--cream); white-space: nowrap; }
thead th.sorted { color: var(--ink); }
thead th.sorted svg { width: 0.9rem; height: 0.9rem; vertical-align: -0.15rem; margin-left: 0.2rem; }
tbody td { padding: 0.8rem 1rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.link { cursor: pointer; }
tbody tr.link:hover td { background: var(--cream); }
td.r, th.r { text-align: right; white-space: nowrap; }
.ref { font-weight: 600; color: var(--ink); white-space: nowrap; }
.contact { display: flex; flex-direction: column; gap: 0.05rem; font-size: 0.86rem; color: var(--muted); }
.contact .num { white-space: nowrap; }
.sub { display: block; font-size: 0.82rem; color: var(--faint); margin-top: 0.15rem; }
.age { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.age.late { color: var(--burgundy); font-weight: 600; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 0.7rem 1rem; border-top: 1px solid var(--line); font-size: 0.86rem; color: var(--muted); }
table.plain { font-size: 0.93rem; }
table.plain thead th { background: transparent; padding-left: 0; }
table.plain tbody td { padding-left: 0; }

/* State words with a small mark. */
.state { display: inline-flex; align-items: center; gap: 0.5rem; white-space: nowrap; }
.state::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--faint); flex-shrink: 0; }
.state.person { color: var(--burgundy); font-weight: 600; }
.state.person::before { background: var(--burgundy); }
.state.working::before { background: var(--ink); }
.state.customer::before { background: transparent; border: 1.5px solid var(--faint); width: 0.4rem; height: 0.4rem; }
.state.done::before { background: var(--ok); }
.tag { display: inline-block; font-size: 0.74rem; font-weight: 600; padding: 0.1rem 0.55rem; border-radius: var(--r-tag); background: var(--cream-2); color: var(--muted); white-space: nowrap; }
.tag.hot { background: var(--burgundy-soft); color: var(--burgundy); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.navy { background: var(--navy-soft); color: var(--ink); }

/* ---------- Buttons and inputs (8px, as on the site) ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; font: inherit; font-size: 0.93rem; font-weight: 600; padding: 0.55rem 1.1rem; border-radius: var(--r-ctl); border: 1px solid var(--ink); background: var(--ink); color: var(--on-ink); cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; filter: brightness(1.12); }
.btn.danger { background: var(--burgundy); border-color: var(--burgundy); color: #FFFFFF; }
.btn.secondary { background: var(--panel); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { border-color: var(--ink); filter: none; }
.btn.quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn.quiet:hover { color: var(--ink); background: var(--cream); filter: none; }
.btn.small { font-size: 0.84rem; padding: 0.38rem 0.8rem; }
.btn.google { background: var(--panel); color: var(--text); border-color: var(--line); font-weight: 500; }
.actions { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
input[type="text"], input[type="number"], input[type="search"], input[type="email"], input[type="date"], input[type="time"], select, textarea { font: inherit; font-size: 0.93rem; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 0.5rem 0.7rem; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--navy-soft); border-color: var(--ink); }
input[type="number"] { width: 5.5rem; font-variant-numeric: tabular-nums; }
textarea { min-height: 5rem; line-height: 1.5; resize: vertical; }
select { appearance: none; -webkit-appearance: none; padding-right: 1.9rem; background-image: linear-gradient(45deg, transparent 50%, var(--faint) 50%), linear-gradient(135deg, var(--faint) 50%, transparent 50%); background-position: calc(100% - 0.95rem) 55%, calc(100% - 0.65rem) 55%; background-size: 0.3rem 0.3rem; background-repeat: no-repeat; width: auto; }
.field { display: grid; grid-template-columns: 16rem 1fr; gap: 1.5rem; padding: 1rem 0; border-bottom: 1px solid var(--line-soft); align-items: start; }
.field:last-of-type { border-bottom: 0; }
.field .n { font-weight: 600; color: var(--ink); }
.field .d { font-size: 0.84rem; color: var(--muted); margin-top: 0.15rem; line-height: 1.45; }
.field .ctl { display: flex; flex-direction: column; gap: 0.5rem; }
.inline { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; }
.inline label { font-size: 0.86rem; color: var(--muted); display: inline-flex; align-items: center; gap: 0.4rem; }
.toggle { display: inline-flex; align-items: center; gap: 0.6rem; }
.toggle.on .sw { background: var(--ink); border-color: var(--ink); }
.toggle.on .sw::after { left: calc(100% - 0.95rem); background: var(--page); }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 0.2rem; gap: 0.2rem; }
.seg a, .seg span { font-size: 0.86rem; font-weight: 500; color: var(--muted); padding: 0.3rem 0.8rem; border-radius: 6px; white-space: nowrap; }
.seg.wrap { flex-wrap: wrap; max-width: 100%; } /* many groups wrap onto more rows instead of pushing the page wider */
.seg .on { background: var(--ink); color: var(--on-ink); }
.seg a:hover { text-decoration: none; color: var(--ink); }
.seg a.on:hover { color: var(--on-ink); }

/* ---------- Tabs and views ---------- */
.tabs { display: flex; gap: 0.2rem; border-bottom: 1px solid var(--line); }
.tabs a { padding: 0.6rem 0.9rem; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--ink); }
.tabs a .n { font-size: 0.78rem; font-weight: 600; color: var(--muted); margin-left: 0.4rem; background: var(--cream-2); padding: 0 0.45rem; border-radius: var(--r-tag); }
.tabs a .n.hot { color: var(--burgundy); background: var(--burgundy-soft); }
.panels .panel { display: none; }
.panels .panel.default { display: block; }
.main:has(.anchor:target) .panels .panel.default { display: none; }
.main:has(.anchor:target) .tabs a.on { color: var(--muted); border-bottom-color: transparent; }
.main:has(#conversation:target) .panel[data-panel="conversation"], .main:has(#journey:target) .panel[data-panel="journey"], .main:has(#documents:target) .panel[data-panel="documents"],
.main:has(#governance:target) .panel[data-panel="governance"], .main:has(#activity:target) .panel[data-panel="activity"],
.main:has(#claims:target) .panel[data-panel="claims"], .main:has(#policy:target) .panel[data-panel="policy"] { display: block; }
.main:has(#conversation:target) .tabs a[href="#conversation"], .main:has(#journey:target) .tabs a[href="#journey"], .main:has(#documents:target) .tabs a[href="#documents"],
.main:has(#governance:target) .tabs a[href="#governance"], .main:has(#activity:target) .tabs a[href="#activity"],
.main:has(#claims:target) .tabs a[href="#claims"], .main:has(#policy:target) .tabs a[href="#policy"] { color: var(--ink); border-bottom-color: var(--ink); }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 1rem; align-items: baseline; padding: 0.65rem 0; border-bottom: 1px solid var(--line-soft); font-size: 0.93rem; }
.list li:last-child { border-bottom: 0; }
.list .when { color: var(--faint); font-size: 0.82rem; width: 7.5rem; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.hbar { display: grid; grid-template-columns: 1fr 8rem 3.5rem; gap: 0.9rem; align-items: center; padding: 0.55rem 0; border-bottom: 1px solid var(--line-soft); font-size: 0.93rem; }
.hbar:last-child { border-bottom: 0; }
.hbar .track { height: 0.55rem; background: var(--chart-soft); border-radius: var(--r-tag); overflow: hidden; }
.hbar .track i { display: block; height: 100%; background: var(--ink); border-radius: var(--r-tag); }
.hbar .track i.alt { background: var(--burgundy); }
.hbar .v { font-variant-numeric: tabular-nums; text-align: right; color: var(--muted); }
a.hbar { color: inherit; }
a.hbar:hover { text-decoration: none; background: var(--cream); }

/* ---------- Conversation ---------- */
.thread { display: flex; flex-direction: column; gap: 0.8rem; max-width: 52rem; }
.msg { max-width: 76%; }
.msg .b { padding: 0.65rem 0.9rem; border-radius: 12px; font-size: 0.93rem; line-height: 1.5; white-space: pre-wrap; }
.msg.in { align-self: flex-start; }
.msg.in .b { background: var(--cream); border-bottom-left-radius: 4px; }
.msg.out { align-self: flex-end; }
.msg.out .b { background: var(--panel); border: 1px solid var(--line); border-bottom-right-radius: 4px; }
.msg .m { font-size: 0.78rem; color: var(--faint); margin-top: 0.25rem; display: flex; gap: 0.6rem; }
.msg.out .m { justify-content: flex-end; }
.msg .m .who { color: var(--burgundy); font-weight: 600; }
.daymark { font-size: 0.78rem; color: var(--faint); text-align: center; margin: 0.4rem 0; }
.doc-chip { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.86rem; padding: 0.4rem 0.7rem; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--panel); }
.doc-chip .tag { font-size: 0.68rem; }

/* ---------- Journey map (the state diagram) ---------- */
.journey svg { width: 100%; max-width: 40rem; height: auto; display: block; font-family: var(--sans); }
.journey .jn rect { fill: var(--panel); stroke: var(--line); stroke-width: 1.2; rx: 7; }
.journey .jn text { font-weight: 400; }
.journey .jn text { fill: var(--muted); text-anchor: middle; dominant-baseline: middle; font-size: 11px; }
.journey .jn.done rect { fill: var(--navy-soft); stroke: var(--ink); }
.journey .jn.done text { fill: var(--ink); }
.journey .jn.current rect { fill: var(--burgundy-soft); stroke: var(--burgundy); stroke-width: 2; }
.journey .jn.current text { fill: var(--burgundy); font-weight: 600; }
.journey .jn.skipped rect { stroke-dasharray: 3 3; opacity: 0.5; }
.journey .jn.skipped text { opacity: 0.6; }
.journey .jn.exit rect { stroke-dasharray: 2 3; opacity: 0.65; }
.journey .jn .jt { font-size: 9.5px; fill: var(--faint); }
.journey .je { stroke: #C9C1B3; stroke-width: 1.2; fill: none; }
.journey .je.traversed { stroke-width: 1.8; }
.journey .je.exit { stroke-dasharray: 3 3; }
.journey marker .jm { fill: #C9C1B3; }
.journey marker .jm.on { fill: var(--ink); }
.journey .je.traversed { stroke: var(--ink); }
.jlegend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.2rem; font-size: 0.82rem; color: var(--muted); margin-top: 0.8rem; }
.jlegend .sw { display: inline-block; width: 1.4rem; height: 0.8rem; border-radius: 4px; border: 1.2px solid var(--line); background: var(--panel); vertical-align: -0.1rem; margin-right: 0.4rem; }
.jlegend .sw.done { background: var(--navy-soft); border-color: var(--ink); }
.jlegend .sw.current { background: var(--burgundy-soft); border-color: var(--burgundy); border-width: 2px; }
.jlegend .sw.skipped { border-style: dashed; opacity: 0.55; }
.jlegend .sw.exit { border-style: dotted; opacity: 0.7; }
.jsub { display: grid; grid-template-columns: 8rem 1fr; gap: 0.3rem 1rem; font-size: 0.9rem; }
.jsub .k { color: var(--muted); }
.jsub .v { color: var(--text); }
.jsub .v.next { color: var(--burgundy); font-weight: 600; }

/* ---------- Letter and governance check ---------- */
.letter { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card); padding: 2.4rem 2.6rem; font-family: Georgia, "Times New Roman", serif; font-size: 1rem; line-height: 1.75; color: var(--text); }
.letter .head { font-family: var(--sans); font-size: 0.82rem; font-weight: 600; color: var(--muted); margin-bottom: 1.4rem; }
.letter p { margin: 0 0 0.9rem; }
.flag { background: var(--burgundy-soft); border-bottom: 2px solid var(--burgundy); }
.flag sup { font-family: var(--sans); font-size: 0.65rem; color: var(--burgundy); font-weight: 600; margin-left: 0.15rem; }
.claims { list-style: none; margin: 0; padding: 0; }
.claims li { padding: 0.8rem 0; border-bottom: 1px solid var(--line-soft); display: grid; grid-template-columns: 1.6rem 1fr auto; gap: 0.8rem; }
.claims li:last-child { border-bottom: 0; }
.claims .n { font-size: 0.78rem; font-weight: 600; color: var(--burgundy); padding-top: 0.15rem; }
.claims .q { font-weight: 500; color: var(--ink); }
.claims .why { font-size: 0.86rem; color: var(--muted); margin-top: 0.2rem; }
.claims .src { font-size: 0.8rem; color: var(--faint); margin-top: 0.2rem; }
.claims .verdict { text-align: right; white-space: nowrap; font-size: 0.86rem; }
.claims .verdict .conf { display: block; font-size: 0.78rem; color: var(--faint); margin-top: 0.15rem; }
.verdict.ok { color: var(--ok); font-weight: 600; }
.verdict.flagged { color: var(--burgundy); font-weight: 600; }
.summary-line { font-size: 1.1rem; font-weight: 600; color: var(--ink); margin: 0 0 0.3rem; }
.summary-line b { color: var(--burgundy); }

/* ---------- Charts ---------- */
.chart { width: 100%; max-width: 44rem; height: auto; display: block; stroke: none; }
.chart text { font-family: var(--sans); font-size: 10.5px; fill: var(--muted); }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .bar { fill: var(--ink); }
.chart .bar.alt { fill: var(--burgundy); }
.chart .bar.soft { fill: var(--chart-soft); }
.chart .line { fill: none; stroke: var(--ink); stroke-width: 1.8; }
.chart .line.alt { stroke: var(--burgundy); }
.chart .pt { fill: var(--panel); stroke: var(--ink); stroke-width: 1.8; }
.chart .pt.alt { stroke: var(--burgundy); }
.chart .seg1 { fill: var(--ink); } .chart .seg2 { fill: var(--chart-mid); } .chart .seg3 { fill: var(--chart-soft); } .chart .seg4 { fill: var(--burgundy); }
.chart text.inbar { fill: var(--on-ink); } .chart text.inbar.onsoft { fill: var(--muted); }
.legend { display: flex; gap: 1.1rem; flex-wrap: wrap; font-size: 0.82rem; color: var(--muted); margin-top: 0.6rem; }
.legend i { display: inline-block; width: 0.7rem; height: 0.7rem; margin-right: 0.4rem; vertical-align: -0.05rem; background: var(--ink); border-radius: 2px; }
.legend i.alt { background: var(--burgundy); }
.legend i.c2 { background: var(--chart-mid); } .legend i.c3 { background: var(--chart-soft); border: 1px solid var(--line); }

/* ---------- Settings ---------- */
.settings { display: grid; grid-template-columns: 13rem 1fr; gap: 2rem; align-items: start; }
.subnav { display: flex; flex-direction: column; gap: 0.15rem; position: sticky; top: 1.2rem; }
.subnav a { padding: 0.5rem 0.7rem; border-radius: var(--r-ctl); color: var(--muted); font-weight: 500; }
.subnav a:hover { background: var(--cream); text-decoration: none; }
.subnav a.on { color: var(--ink); background: var(--navy-soft); }
.subnav .group { font-size: 0.78rem; font-weight: 600; color: var(--faint); margin: 0.8rem 0 0.3rem 0.7rem; }
.spanels .spanel { display: none; }
.spanels .spanel.default { display: block; }
.main:has(.anchor:target) .spanels .spanel.default { display: none; }
.main:has(.anchor:target) .subnav a.on { color: var(--muted); background: transparent; }
.publish { display: flex; align-items: center; justify-content: space-between; gap: 1.2rem; margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.publish .v { font-size: 0.86rem; color: var(--muted); }
.copykey { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 1rem; padding: 0.8rem 0; border-bottom: 1px solid var(--line-soft); align-items: start; }
.copykey > *, .grid-wide > *, .settings > * { min-width: 0; } /* a text field shrinks with its column; nothing forces a horizontal scroll */
.copykey textarea { max-width: 100%; }
.copykey:last-of-type { border-bottom: 0; }
.copykey .k { font-weight: 500; color: var(--ink); }
.copykey .k small { display: block; font-size: 0.78rem; color: var(--faint); margin-top: 0.1rem; font-weight: 400; }
.preview { background: var(--cream); border-radius: var(--r-card); padding: 1rem; }
.preview .b { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; border-bottom-left-radius: 4px; padding: 0.65rem 0.9rem; font-size: 0.93rem; }
.preview .m { font-size: 0.78rem; color: var(--faint); margin-top: 0.4rem; }
.diff { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.84rem; }
.diff .del { color: var(--burgundy); text-decoration: line-through; }
.diff .add { color: var(--ink); background: var(--navy-soft); padding: 0 0.2rem; }
.people td .avatar { margin-right: 0.6rem; vertical-align: middle; }

/* ---------- Setup ---------- */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.4rem; }
a.step { color: inherit; }
a.step:hover { text-decoration: none; border-color: var(--ink); box-shadow: var(--shadow); }
.step { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card); padding: 0.9rem 1.1rem; }
.step.on { border-color: var(--burgundy); }
.step.done { border-color: var(--ink); }
.step .k { font-size: 0.78rem; font-weight: 600; color: var(--faint); }
.step.on .k { color: var(--burgundy); }
.step .t { font-weight: 600; color: var(--ink); margin-top: 0.15rem; }
.step .s { font-size: 0.84rem; color: var(--muted); }
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.9rem; }
.choice { border: 1px solid var(--line); border-radius: var(--r-card); padding: 1rem 1.1rem; background: var(--panel); }
.choice.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--navy-soft); }
.choice.off { opacity: .55; }
.choice .t { font-weight: 600; color: var(--ink); }
.choice .s { font-size: 0.84rem; color: var(--muted); margin-top: 0.2rem; }

/* ---------- Sign in ---------- */
.signin { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--page); }
.signin .brand { background: #1B2B4F; color: #F3EFE9; padding: 3rem; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 0.9rem; }
.signin .brand img { width: 14rem; height: auto; }
.signin .brand h2 { color: #F3EFE9; font-size: 1.5rem; font-weight: 600; line-height: 1.25; margin: 0; }
.signin .form { display: flex; align-items: center; justify-content: center; padding: 3rem 2rem; }
.signin .box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card); padding: 2.4rem; width: 26rem; max-width: 100%; display: flex; flex-direction: column; gap: 1rem; align-items: flex-start; box-shadow: var(--shadow); }
.signin .box h1 { font-size: 1.4rem; }
.signin .btn.google { background: var(--ink); color: var(--on-ink); border-color: var(--ink); width: 100%; padding: 0.7rem 1rem; }
.signin .refused { color: var(--burgundy); font-weight: 500; }
@media (max-width: 900px) { .signin { grid-template-columns: 1fr; } .signin .brand { padding: 2rem; } }

@media (max-width: 1100px) {
  .grid-2, .grid-3, .grid-wide, .settings { grid-template-columns: 1fr; }
  .steps, .choices { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .sidebar { width: auto; height: auto; position: static; }
  .topbar, .content { padding-left: 1rem; padding-right: 1rem; }
  .steps, .choices { grid-template-columns: 1fr; }
  .field, .copykey { grid-template-columns: 1fr; gap: 0.5rem; }
  .msg { max-width: 92%; }
  .search { min-width: 0; width: 100%; }
}
