/* Ikwe HQ v2, "Desk" direction: calm cards, Newsreader headings, Work Sans text. */
:root {
  --bg: #F2EFE9;
  --card: #FFFFFF;
  --ink: #22262A;
  --muted: #4F565C;
  --soft: #6B7177;
  --line: #E2DCD0;
  --line-strong: #CFC8BB;
  --accent: #2F4F46;
  --accent-ink: #FFFFFF;
  --owe: #8A4510;
  --owe-bg: #FBEBDD;
  --wait: #1E40AF;
  --wait-bg: #E3EAFB;
  --ok: #2F6B3A;
  --danger: #9B2C2C;
  --radius: 14px;
  --serif: 'Newsreader', Georgia, serif;
  --sans: 'Work Sans', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1B1D1F; --card: #24272A; --ink: #ECE8E1; --muted: #B5B1A8; --soft: #9A968E;
    --line: #34373A; --line-strong: #44484C; --accent: #8FC2B2; --accent-ink: #12201C;
    --owe: #F0A868; --owe-bg: #3A2B1E; --wait: #9DB6F5; --wait-bg: #232C42; --ok: #8BC79A;
    --danger: #F09A9A; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1B1D1F; --card: #24272A; --ink: #ECE8E1; --muted: #B5B1A8; --soft: #9A968E;
  --line: #34373A; --line-strong: #44484C; --accent: #8FC2B2; --accent-ink: #12201C;
  --owe: #F0A868; --owe-bg: #3A2B1E; --wait: #9DB6F5; --wait-bg: #232C42; --ok: #8BC79A;
  --danger: #F09A9A; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.5; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.brand { font-family: var(--serif); font-size: 28px; font-weight: 500; }
.h1 { font-family: var(--serif); font-weight: 500; font-size: 36px; margin: 0; line-height: 1.15; }
.h2 { font-family: var(--serif); font-weight: 500; font-size: 22px; margin: 0 0 10px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
input, select, textarea {
  font: inherit; font-size: 15px; color: var(--ink); background: var(--card);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
textarea { resize: vertical; min-height: 96px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.btn {
  font: inherit; font-weight: 600; min-height: 44px; padding: 10px 16px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--card); color: var(--accent);
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn:disabled { opacity: .55; cursor: default; }
.linkish { background: none; border: 0; padding: 4px 0; font: inherit; color: var(--accent); cursor: pointer; text-align: left; text-decoration: underline; }
.msg { min-height: 20px; margin: 4px 0 0; font-size: 14px; }
.msg.error { color: var(--danger); }
.msg.good { color: var(--ok); }
code { font-size: 13px; word-break: break-all; }

/* Outside (sign-in) */
.outside { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.outside-card { width: 100%; max-width: 420px; background: var(--card); border-radius: var(--radius); padding: 32px 28px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.outside-sub { margin: 4px 0 24px; }
.outside-foot { margin: 20px 0 0; }
.qr { display: grid; place-items: center; padding: 8px; background: #fff; border-radius: 10px; }
.qr img { width: 180px; height: 180px; }

/* Inside */
.inside { display: flex; min-height: 100vh; }
nav { width: 230px; flex: none; padding: 28px 16px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.nav-brand { padding: 0 12px 22px; }
nav a { color: var(--muted); padding: 12px; border-radius: 10px; text-decoration: none; display: flex; justify-content: space-between; align-items: center; }
nav a:hover { color: var(--ink); }
nav a.active { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.nav-foot { margin-top: auto; padding: 0 12px; }
.badge { background: var(--owe); color: #fff; border-radius: 10px; padding: 1px 8px; font-size: 12px; font-weight: 600; }
.menu-toggle { display: none; }
main { flex: 1; min-width: 0; padding: 32px 32px 48px 8px; outline: none; }

.page-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: flex-end; margin-bottom: 20px; }
.page-head p { margin: 6px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.split { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.split > .primary-col { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.split > aside { flex: 1 1 280px; max-width: 360px; }
.panel { background: var(--card); border-radius: var(--radius); padding: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.card { background: var(--card); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; border: 1px solid transparent; }
a.card:hover { border-color: var(--line-strong); }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.card-name { font-family: var(--serif); font-size: 21px; color: var(--accent); line-height: 1.2; }
.card p { margin: 4px 0 0; }
.rank { font-weight: 600; }
.ball-owe { color: var(--owe); }
.ball-wait { color: var(--wait); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.pill.owe { background: var(--owe-bg); color: var(--owe); }
.pill.wait { background: var(--wait-bg); color: var(--wait); }
.pill.none { background: var(--bg); color: var(--muted); }
.legend { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.filters label { flex: 1 1 160px; }
.table-wrap { background: var(--card); border-radius: var(--radius); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); }
td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: top; }
td .sub { color: var(--muted); font-size: 13px; }

.board { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.col { background: rgba(255,255,255,.45); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; min-width: 220px; }
:root[data-theme="dark"] .col { background: rgba(255,255,255,.04); }
.col h3 { margin: 0 4px 4px; font-size: 14px; display: flex; justify-content: space-between; }
.mini { background: var(--card); border-radius: 10px; padding: 10px 12px; text-decoration: none; color: inherit; display: block; }
.mini b { color: var(--accent); font-weight: 600; }

.profile { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 24px; margin: 0; }
.profile dt { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.profile dd { margin: 2px 0 0; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.timeline li { border-left: 3px solid var(--line-strong); padding: 2px 0 2px 14px; }
.timeline .when { font-size: 13px; color: var(--muted); }
.timeline p { margin: 4px 0 0; white-space: pre-wrap; }
.empty { color: var(--muted); padding: 12px 0; }
.ask-results { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ask-results li { font-size: 14px; }

dialog { border: 0; border-radius: var(--radius); padding: 24px; width: min(520px, calc(100vw - 32px)); background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(20, 22, 24, .45); }
.loading { position: fixed; inset: 0; display: grid; place-items: center; color: var(--muted); background: var(--bg); }

@media (max-width: 760px) {
  .inside { flex-direction: column; }
  .menu-toggle { display: block; margin: 12px 16px 0; align-self: flex-start; font: inherit; font-weight: 600; min-height: 44px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); }
  nav { width: auto; height: auto; position: static; padding: 8px 16px; display: none; }
  nav.open { display: flex; }
  main { padding: 16px 16px 40px; }
  .split > aside { max-width: none; }
  .h1 { font-size: 30px; }
}
.stack > p, .stack > .h2 { margin: 0; }

/* ---------- v2 CRM additions ---------- */
:root { --unc: #9A6B00; --unc-bg: #FFF4D6; --meet: #2F6B3A; --meet-bg: #E3F0E5; --voice: #1E5AA8; --voice-bg: #E2ECFA; --msg: #6B4E9B; --msg-bg: #EEE7F7; --chg: #6B7177; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --unc: #F2C766; --unc-bg: #3A3018; --meet: #8BC79A; --meet-bg: #20322A; --voice: #9DB6F5; --voice-bg: #212B40; --msg: #C7B2EE; --msg-bg: #2E2640; --chg: #9A968E; } }
:root[data-theme="dark"] { --unc: #F2C766; --unc-bg: #3A3018; --meet: #8BC79A; --meet-bg: #20322A; --voice: #9DB6F5; --voice-bg: #212B40; --msg: #C7B2EE; --msg-bg: #2E2640; --chg: #9A968E; }

.nowrap { white-space: nowrap; }
.q { color: var(--unc); font-weight: 700; margin-left: 3px; cursor: help; }
.empty { color: var(--muted); font-style: italic; }
.chip { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; margin: 0 4px 4px 0; border: 1px solid var(--line-strong); white-space: nowrap; }
.chip.unc { border: 1px dashed var(--unc); background: var(--unc-bg); }
.tier { font-weight: 600; }
.nextcol { max-width: 300px; }
.dots { display: inline-flex; gap: 3px; align-items: center; white-space: nowrap; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); }
.dot.miss { background: transparent; border: 1.5px solid var(--line-strong); }
.dots .small { margin-left: 4px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tab { font: inherit; font-size: 13px; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); border-radius: 999px; padding: 6px 12px; cursor: pointer; min-height: 36px; }
.tab.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tab .n { opacity: .7; margin-left: 5px; font-variant-numeric: tabular-nums; }
.notice { border: 1px solid var(--unc); background: var(--unc-bg); }
.btn.tiny { min-height: 30px; padding: 3px 10px; font-size: 12.5px; border-radius: 8px; }
.msg.inline { margin-left: 8px; font-size: 12.5px; }
td.derived { font-style: italic; color: var(--muted); }

/* Network map: priority rows x warmth columns */
.mapwrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); padding: 8px; }
.netmap { display: grid; min-width: 1060px; }
.mrow { display: grid; grid-template-columns: 130px repeat(6, minmax(140px, 1fr)); border-top: 1px solid var(--line); }
.mrow.mhead { border-top: 0; }
.mt { padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.mh { padding: 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; display: flex; flex-direction: column; gap: 2px; }
.mh .small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.mh.end, .mc.end { background: var(--meet-bg); }
.mc { padding: 8px; display: flex; flex-wrap: wrap; gap: 4px; align-content: flex-start; min-height: 46px; border-left: 1px solid var(--line); }
.who { font-size: 12.5px; padding: 3px 8px; border-radius: 8px; background: var(--bg); color: var(--ink); text-decoration: none; border: 1px solid var(--line); line-height: 1.3; }
.who:hover { border-color: var(--accent); color: var(--accent); }
.who.unc { border-style: dashed; border-color: var(--unc); }
.who.sample { display: inline-block; }

/* Person page */
.person-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 980px) { .person-grid { grid-template-columns: 1fr; } }
.ef dd { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ef dd.editing .view, .ef dd.editing > .btn { display: none; }
.editform { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.editform input { flex: 1 1 220px; min-height: 36px; padding: 6px 10px; }
.ef select { min-height: 36px; padding: 6px 10px; }
.relpick { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.relopt { flex-direction: row; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.relopt input { min-height: 0; padding: 0; }
.pre { white-space: pre-wrap; margin: 2px 0 0; }

/* History timeline with channel icons */
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -4px; }
.timeline .ev { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; border-left: 0; padding: 0; }
.evi { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); color: var(--muted); }
.ev.meet .evi { background: var(--meet-bg); color: var(--meet); }
.ev.voice .evi { background: var(--voice-bg); color: var(--voice); }
.ev.msg .evi { background: var(--msg-bg); color: var(--msg); }
.ev.intro .evi, .ev.doc .evi { background: var(--owe-bg); color: var(--owe); }
.ev.change .evi { background: transparent; border: 1px dashed var(--line-strong); color: var(--chg); }
.ev.added .evi { background: var(--accent); color: var(--accent-ink); }
.ev-key { display: inline-flex; align-items: center; gap: 4px; }
.ev-key.meet { color: var(--meet); } .ev-key.voice { color: var(--voice); } .ev-key.msg { color: var(--msg); } .ev-key.intro { color: var(--owe); } .ev-key.change { color: var(--chg); }
.sugg { border: 1px dashed var(--unc); background: var(--unc-bg); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }

/* Touchpoint type picker */
.typepick { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.typepick legend { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.typeopt { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 13.5px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.typeopt input { min-height: 0; padding: 0; }
.typeopt:has(input:checked) { border-color: var(--accent); background: var(--bg); }
.nextcol { min-width: 280px; max-width: 360px; }
.filters label { max-width: 420px; }
td .sub { max-width: 280px; }
table { min-width: 1080px; }
.stack > dl.profile { margin-top: 4px; }

/* v2.1: continuous-use workflow */
table.compact { min-width: 760px; }
table.compact td { padding: 10px 12px; vertical-align: middle; }
table.compact select { min-height: 36px; padding: 6px 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.bulkbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.bulkbar .relopt { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--owe); color: #fff; }

.preview-bar { border: 1px dashed var(--accent); background: var(--card); border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 14px; }
.previewing [data-open], .previewing [data-edit], .previewing [data-saverel], .previewing [data-confirm], .previewing select[data-field], .previewing .relpick input { opacity: .45; pointer-events: none; }
.nav-foot #btn-preview { margin-bottom: 10px; width: 100%; }

.verdict { font-size: 16px; border-left: 4px solid var(--owe); }
.verdict.ok { border-left-color: var(--ok); }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.chk { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.chk > div { min-width: 0; }
.chk-mark { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--accent-ink); }
.chk.ok .chk-mark { background: var(--ok); border-color: var(--ok); }
.bar { height: 6px; background: var(--line); border-radius: 3px; margin: 8px 0 6px; max-width: 420px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.chk.ok .bar span { background: var(--ok); }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
table.compact td:has(> select) { white-space: nowrap; }
table.compact td > select + .q { margin-left: 6px; }
.pill.stale { background: var(--unc-bg); color: var(--ink); border: 1px dashed var(--unc); }
.group { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: color-mix(in srgb, var(--card) 60%, transparent); }
.group-head { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; }
.sugg .evidence { border-left: 3px solid var(--line-strong); padding-left: 8px; color: var(--muted); font-style: italic; }
/* v2.2: board editing and read-only access */
.cellbtn { background: none; border: 0; padding: 2px 6px; margin: -2px -6px; font: inherit; color: inherit; border-radius: 6px; cursor: pointer; text-decoration: underline dotted var(--line-strong); text-underline-offset: 3px; }
.cellbtn:hover { background: var(--bg); }
a.who[draggable="true"] { cursor: grab; }
a.who.dragging { opacity: .4; }
.mc.over { outline: 2px dashed var(--accent); outline-offset: -4px; background: var(--card); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .grid2 { grid-template-columns: 1fr; } }
fieldset.relpick { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.readonly [data-open], .readonly [data-edit], .readonly [data-saverel], .readonly [data-confirm], .readonly select[data-field], .readonly .relpick input, .readonly .editform { display: none !important; }
.readonly .relpick label:not(:has(input:checked)) { display: none; }

/* v2.3: HQ assistant */
.ask-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
@media (max-width: 980px) { .ask-grid { grid-template-columns: 1fr; } }
.chatcol { min-width: 0; }
.thread { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; min-height: 340px; max-height: 64vh; overflow-y: auto; display: grid; gap: 18px; align-content: start; }
.turn { display: grid; gap: 8px; }
.turn .q { justify-self: end; max-width: 85%; background: var(--accent); color: var(--accent-ink); padding: 10px 14px; border-radius: 14px 14px 4px 14px; white-space: pre-wrap; }
.who-tag { display: block; font-size: 11px; opacity: .75; margin-bottom: 2px; }
.turn .a { max-width: 92%; line-height: 1.55; }
.turn .a p { margin: 0 0 8px; }
.turn .a ul { margin: 4px 0 8px; padding-left: 20px; }
.turn-meta { margin-top: 6px; }
.props { display: grid; gap: 8px; margin-top: 8px; }
.sugg.prop.done { opacity: .65; }
.askbar { display: flex; gap: 10px; align-items: flex-end; }
.askbar textarea { flex: 1; min-height: 48px; resize: vertical; }
.empty-chat .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.chip-btn:hover { border-color: var(--accent); }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 14px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
.mini-table { width: 100%; min-width: 0; font-size: 13px; border-collapse: collapse; }
.mini-table th, .mini-table td { padding: 6px 4px; text-transform: none; letter-spacing: 0; }
.convs { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.btn.ghost { border-style: dashed; }
.change-edit { margin-top: 8px; }
.change-edit textarea, .change-edit select, .change-edit input { width: 100%; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ctx-bar { border: 1px dashed var(--accent); border-radius: 10px; padding: 8px 12px; background: var(--bg); }
/* v2.4: admin, problem reports */
.nav-foot #btn-report { margin-bottom: 10px; width: 100%; }
img.shot { max-width: 100%; border: 1px solid var(--line); border-radius: 8px; max-height: 220px; object-fit: contain; object-position: top; background: var(--bg); }
.pre { white-space: pre-wrap; word-break: break-word; max-height: 160px; overflow: auto; background: var(--bg); padding: 8px; border-radius: 8px; }
.toast-link { color: inherit; margin-left: 6px; }
code { font-size: .92em; background: var(--bg); padding: 1px 5px; border-radius: 5px; word-break: break-all; }
#admin-body { display: grid; gap: 22px; }

/* ---------- Relationship action items ---------- */
.items { display: flex; flex-direction: column; gap: 8px; }
.item { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-start; }
.item.cap { border: 1px dashed var(--unc); background: var(--unc-bg); }
.item.closed { opacity: .72; }
.item-main { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.item-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.item-action { font-weight: 600; word-break: break-word; }
.item.closed .item-action { text-decoration: line-through; text-decoration-color: var(--soft); }
.item.notdoing { opacity: .6; }
.item.notdoing .item-action { text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: var(--muted); }
.tag.sugg { color: var(--unc); border: 1px solid var(--unc); background: var(--unc-bg); }
.tag.who { color: var(--muted); border: 1px solid var(--line-strong); }
.struck { text-decoration: line-through; color: var(--muted); }
details.archived { margin-top: 8px; }
details.archived summary { cursor: pointer; font-weight: 600; }
details.archived li { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 4px 0; }
.item .evidence { border-left: 3px solid var(--line-strong); padding-left: 8px; color: var(--muted); font-style: italic; }
.item-acts { flex: 0 1 auto; align-self: center; }
.isel { width: 20px; height: 20px; min-height: 0; margin-top: 4px; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 12px; font-weight: 600; border: 1px solid transparent; }
.tag.cap { color: var(--unc); border: 1px dashed var(--unc); background: var(--unc-bg); }
.tag.conf { color: var(--ok); border-color: var(--ok); background: var(--card); }
.filterbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.filterbar .tabs { margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden; }
.seg-b { font: inherit; font-size: 13px; border: 0; background: var(--card); color: var(--ink); padding: 6px 14px; min-height: 36px; cursor: pointer; }
.seg-b.on { background: var(--accent); color: var(--accent-ink); }
.followup { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; margin: 0; }
details summary { cursor: pointer; padding: 6px 0; }

/* ---------- Shared filter bar, Team, Glossary, Messages ---------- */
.tabs-label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); align-self: center; margin-right: 4px; }
.teamgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.teamcard .h2 { margin: 0; }
.teamcard ul.plain { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
table.gloss { min-width: 0; }
table.gloss th { width: 32%; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--ink); vertical-align: top; border-top: 1px solid var(--line); border-bottom: 0; }
.intro p { margin: 0; max-width: 68ch; }
.intro .steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; max-width: 68ch; }
nav a.navsmall { font-size: 13px; padding-block: 8px; }
.msggrid { display: grid; grid-template-columns: minmax(240px, 320px) 1fr; gap: 16px; align-items: start; }
.msggrid > * { min-width: 0; }
.threads { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.thread-btn { width: 100%; text-align: left; font: inherit; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.thread-btn.on { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.t-who { font-weight: 600; display: flex; gap: 6px; align-items: center; }
.t-snip { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msglist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.msglist .msg { background: var(--bg); border-radius: 12px; padding: 10px 12px; max-width: 90%; }
.msglist .msg.mine { align-self: flex-end; background: color-mix(in srgb, var(--accent) 12%, var(--card)); }
.msglist .pre { white-space: pre-wrap; word-break: break-word; max-height: none; background: none; padding: 0; overflow: visible; }
.mention { color: var(--accent); }
@media (max-width: 720px) { .msggrid { grid-template-columns: 1fr; } }

/* ---------- Issues ---------- */
.issue { background: var(--card); border: 1px solid var(--line); border-left-width: 4px; border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.issue.sev-high { border-left-color: var(--owe); }
.issue.sev-medium { border-left-color: var(--wait); }
.issue.sev-low { border-left-color: var(--line-strong); }
.issue form.resolve { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.issue form.resolve input { flex: 1 1 220px; min-height: 36px; padding: 6px 10px; }

/* ---------- UI pass Nov 2: one menu, one page frame, everything fits or scrolls ---------- */
nav { overflow-y: auto; padding-block: 22px; gap: 2px; scrollbar-width: thin; }
nav a { padding: 9px 12px; }
nav a.nav-primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; margin-bottom: 6px; }
nav a.nav-primary.active, nav a.nav-primary:hover { color: var(--accent-ink); filter: brightness(1.08); }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--soft); padding: 14px 12px 4px; }
.nav-foot { padding-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.nav-foot #btn-preview, .nav-foot #btn-report { margin-bottom: 0; }
.topbar { display: none; }
.backlink { display: inline-block; font-size: 14px; margin-bottom: 8px; }
.page-head .h1 + p, .page-head p.muted { max-width: 72ch; }
dialog { max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; }
code, .pre { overflow-wrap: anywhere; }
.askbox { display: flex; gap: 8px; align-items: stretch; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.askbox input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 16px; }
.askbox input:focus { outline: none; }
.askbox:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.table-wrap, .mapwrap { overflow-x: auto; max-width: 100%; }
.thread { max-height: min(62vh, 640px); overflow-y: auto; }
@media (max-width: 760px) {
  .topbar { display: flex; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; align-items: center; gap: 10px; padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
  body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 21; background: var(--bg); }
  .topbar .menu-toggle { display: block; margin: 0; }
  .topbar-title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-ask { white-space: nowrap; }
  nav { max-height: calc(100dvh - 70px); }
  nav .nav-brand { display: none; }
  /* Filter chips scroll sideways instead of filling the screen. */
  .tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
  .tabs .tab, .tabs .tabs-label { flex: none; }
  .thread { max-height: 55vh; }
}
dl.kv { grid-template-columns: auto minmax(0, 1fr); }
dl.kv dd { min-width: 0; overflow-wrap: anywhere; }
.panel, section { min-width: 0; }

a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.side-convs { order: -1; }
.side-details summary { cursor: pointer; list-style: none; font-size: 18px; }
.side-details summary::-webkit-details-marker { display: none; }
.side-details summary::after { content: " +"; color: var(--muted); }
.side-details[open] summary::after { content: " −"; }
.side-details[open] summary { margin-bottom: 10px; }
.side-details:not([open]) { gap: 0; }

/* ---------- Collapsible menu (Nov 2) ---------- */
nav details.nav-sec { border-radius: 10px; }
nav details.nav-sec > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; color: var(--ink); font-weight: 600; font-size: 14px; }
nav details.nav-sec > summary::-webkit-details-marker { display: none; }
nav details.nav-sec > summary::before { content: "\203A"; display: inline-block; width: 10px; color: var(--muted); transition: transform .15s; }
nav details.nav-sec[open] > summary::before { transform: rotate(90deg); }
nav details.nav-sec > summary:hover { background: var(--card); }
nav details.nav-sec > summary .sec-badge { margin-left: auto; }
nav details.nav-sec[open] > summary .sec-badge { display: none; }
nav details.nav-sec.has-active:not([open]) > summary { background: var(--card); }
nav details.nav-sec > a, nav details.nav-sec > .navbtn { margin-left: 18px; padding: 8px 12px; font-size: 14px; }
nav details.nav-sec[open] { padding-bottom: 6px; }
nav .navbtn { display: block; width: calc(100% - 18px); text-align: left; background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; border-radius: 10px; }
nav .navbtn:hover { color: var(--ink); }
nav .nav-foot { margin-top: auto; }

/* Plates (Nov 9, 2026) */
.platecard.focus { outline: 2px solid currentColor; outline-offset: 2px; }
.platecard details summary { cursor: pointer; font-weight: 600; }
.calrows > li { margin-bottom: 6px; }
.datelist { display: flex; flex-direction: column; gap: 12px; }
.datelist > li { border-left: 3px solid var(--line, #ddd); padding-left: 12px; }
.datelist > li.today { border-left-color: var(--accent); }
.datelist .dl-day { margin-bottom: 4px; }
.datelist ul.plain li { margin: 3px 0; }
.msglist.board { max-height: 420px; overflow-y: auto; }
