/* BFS Desk theme. Tokens and rules copied verbatim from bfsdesk/prototype/index.html (white, navy #1f3167, tan #c7b7a2, dark theme). Additions for the web app are at the end under 'web app additions'. */
:root {
  color-scheme: light;
  --tabbar-h: 57px;
  --okall-h: 66px;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #fbfaf7;
  --surface-3: #f6f3ee;
  --border: #ebe6de;
  --border-strong: #d6cbbb;
  --text: #1b2238;
  --text-2: #4a5068;
  --text-3: #747a8e;
  --accent: #1f3167;
  --accent-hover: #16244d;
  --accent-soft: #eef0f6;
  --accent-ink: #ffffff;
  --good: #0a7a0a;
  --good-soft: #e5f3e5;
  --warn-ink: #7f4a00;
  --warn-soft: #fff2d9;
  --warn-line: #eab04a;
  --crit: #b3261e;
  --crit-soft: #fdebea;
  --muted-soft: #eeeeeb;
  --bar: #1f3167;
  --bar-muted: #c5cde2;
  --ref-line: #b3261e;
  --stage-1: #c5cde2;
  --stage-2: #8e9cc4;
  --stage-3: #56689f;
  --stage-4: #1f3167;
  --stage-5: #0a7a0a;
  --stage-6: #a7a197;
  --shadow: none;
  --shadow-lift: 0 8px 24px rgba(31, 49, 103, .14);
  --radius: 2px;
  --radius-sm: 0px;
  --font: "Montserrat", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --brand-navy: #1f3167;
  --brand-tan: #c7b7a2;
  --brand-tan-soft: #f3eee6;
  --font-head: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --logo-filter: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1326;
    --surface: #141c33;
    --surface-2: #18213c;
    --surface-3: #202a49;
    --border: #29335a;
    --border-strong: #3d4873;
    --text: #eef0f6;
    --text-2: #b8bed2;
    --text-3: #8a91aa;
    --accent: #c7b7a2;
    --accent-hover: #d9ccbb;
    --accent-soft: #2e2b2a;
    --accent-ink: #141c33;
    --good: #5cc45c;
    --good-soft: #1f3320;
    --warn-ink: #f5c26b;
    --warn-soft: #3a2e17;
    --warn-line: #b8862c;
    --crit: #f07b73;
    --crit-soft: #3d201e;
    --muted-soft: #2b2b29;
    --bar: #c7b7a2;
    --bar-muted: #3d4873;
    --ref-line: #f07b73;
    --stage-1: #3d4873;
    --stage-2: #5b6aa0;
    --stage-3: #8e9cc4;
    --stage-4: #c7b7a2;
    --stage-5: #5cc45c;
    --stage-6: #75746f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 3px 10px rgba(0, 0, 0, .25);
    --shadow-lift: 0 6px 22px rgba(0, 0, 0, .5);
    --brand-tan-soft: #2e2b2a;
  --logo-filter: brightness(0) invert(1);
}
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1326;
  --surface: #141c33;
  --surface-2: #18213c;
  --surface-3: #202a49;
  --border: #29335a;
  --border-strong: #3d4873;
  --text: #eef0f6;
  --text-2: #b8bed2;
  --text-3: #8a91aa;
  --accent: #c7b7a2;
  --accent-hover: #d9ccbb;
  --accent-soft: #2e2b2a;
  --accent-ink: #141c33;
  --good: #5cc45c;
  --good-soft: #1f3320;
  --warn-ink: #f5c26b;
  --warn-soft: #3a2e17;
  --warn-line: #b8862c;
  --crit: #f07b73;
  --crit-soft: #3d201e;
  --muted-soft: #2b2b29;
  --bar: #c7b7a2;
  --bar-muted: #3d4873;
  --ref-line: #f07b73;
  --stage-1: #3d4873;
  --stage-2: #5b6aa0;
  --stage-3: #8e9cc4;
  --stage-4: #c7b7a2;
  --stage-5: #5cc45c;
  --stage-6: #75746f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 3px 10px rgba(0, 0, 0, .25);
  --shadow-lift: 0 6px 22px rgba(0, 0, 0, .5);
  --brand-tan-soft: #2e2b2a;
  --logo-filter: brightness(0) invert(1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico.sm { width: 15px; height: 15px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar ---------- */
.topbar {
  height: 54px; display: flex; align-items: center; gap: 12px;
  padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: relative; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 16px; letter-spacing: -.01em; white-space: nowrap; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-size: 12px; font-weight: 700; letter-spacing: .02em;
}
.chip-proto { font-size: 11.5px; font-weight: 600; color: var(--warn-ink); background: var(--warn-soft); border: 1px solid var(--warn-line); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.chip-travel { font-size: 11.5px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 3px 9px; border-radius: 999px; display: inline-flex; gap: 5px; align-items: center; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.viewas { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; }
.viewas select { padding: 5px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
.tb-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); font-size: 13px; white-space: nowrap;
}
.tb-btn:hover { background: var(--surface-3); }
.tb-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.tb-count { background: var(--accent); color: var(--accent-ink); border-radius: 999px; font-size: 11px; padding: 0 6px; font-weight: 700; }

/* ---------- BFS brand (Blueprint for Financial Success) ---------- */
.topbar { border-bottom: 3px solid var(--brand-tan); }
.brand-logo { height: 26px; width: auto; display: block; filter: var(--logo-filter); }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 17px; color: var(--accent); letter-spacing: .01em; }
.brand-sep { width: 1px; height: 24px; background: var(--border-strong); }
.brand-tag { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }
h1.page { font-family: var(--font-head); font-weight: 700; letter-spacing: .01em; color: var(--accent); }
.section-title { letter-spacing: .06em; text-transform: uppercase; font-size: 11.5px; }
.btn, .tb-btn { border-radius: var(--radius-sm); }
.btn.primary { text-transform: uppercase; letter-spacing: .1em; font-size: 12px; font-weight: 600; }
.nav-btn { border-radius: 2px; }
.nav-btn[aria-current="page"] { box-shadow: inset 3px 0 0 var(--brand-tan); }

@media (max-width: 1440px) { .brand-tag { display: none; } }
@media (max-width: 900px) { .brand-sep { display: none; } }
.viewas { white-space: nowrap; }
/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); height: calc(100vh - 54px); }
.rail { background: var(--surface); border-right: 1px solid var(--border); padding: 12px 10px; overflow-y: auto; }
.rail-section { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin: 16px 10px 6px; }
.nav-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 1px 0;
  border: 0; background: transparent; border-radius: 8px; text-align: left; color: var(--text-2);
}
.nav-btn:hover { background: var(--surface-3); color: var(--text); }
.nav-btn[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-btn .nb-label { flex: 1; }
.nav-badge { font-size: 11px; font-weight: 700; min-width: 20px; text-align: center; padding: 1px 6px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }
.nav-badge.hot { background: var(--crit); color: #fff; }
.rail-foot { margin: 18px 10px 4px; font-size: 12px; color: var(--text-3); }
main#main { overflow: auto; min-width: 0; }
.viewport { container-type: inline-size; container-name: vp; padding: 22px 26px 40px; max-width: 1500px; }

/* ---------- common ---------- */
h1.page { font-size: 22px; font-weight: 650; letter-spacing: -.015em; margin: 0 0 4px; }
.page-sub { color: var(--text-2); margin: 0 0 18px; max-width: 820px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 16px 18px; }
.section-title { font-size: 13px; font-weight: 700; color: var(--text-2); margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grow { flex: 1; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); font-size: 13px; font-weight: 600; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
/* a write on its way: the tapped button (or the ⋯ of its menu) says Saving… and takes no second tap */
.btn.saving, .btn.saving:disabled { opacity: 1; cursor: progress; }
.btn.saving::before, .row-more > summary.saving::before { content: ""; width: 11px; height: 11px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.row-more > summary.saving { display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: progress; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.good { border-color: var(--good); color: var(--good); }
.btn.good:hover { background: var(--good-soft); }
.btn.bad { border-color: var(--crit); color: var(--crit); }
.btn.bad:hover { background: var(--crit-soft); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent); padding-left: 6px; padding-right: 6px; }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.sm { padding: 3px 9px; font-size: 12.5px; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 6px 12px; font-size: 13px; color: var(--text-2); border-right: 1px solid var(--border); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.toggle { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; }
.toggle input { accent-color: var(--accent); width: 15px; height: 15px; }
.input, .select, textarea.input {
  padding: 6px 9px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); font-size: 13px; min-width: 0;
}
textarea.input { width: 100%; resize: vertical; min-height: 64px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 16px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 650; padding: 2px 8px;
  border-radius: 999px; background: var(--muted-soft); color: var(--text-2); white-space: nowrap; border: 1px solid transparent;
}
.badge.unconf { background: var(--warn-soft); color: var(--warn-ink); border-color: var(--warn-line); }
.badge.urgent { background: var(--crit-soft); color: var(--crit); }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.outline { background: transparent; border-color: var(--border-strong); }
.lock { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-3); }
.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty strong { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 4px; }
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--radius); margin: 0 0 16px; font-size: 13px; border: 1px solid; }
.banner.info { background: var(--accent-soft); border-color: transparent; color: var(--text); }
.banner.warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--text); }
.avatar {
  width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: inline-grid; place-items: center; font-size: 10.5px; font-weight: 700; flex: none;
}
.due { font-size: 12px; color: var(--text-2); white-space: nowrap; }
.due.over { color: var(--crit); font-weight: 650; }
.quote {
  margin: 6px 0 0; padding: 7px 10px; border-left: 3px solid var(--border-strong); background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 13px; color: var(--text-2);
}
.quote .ts { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); margin-right: 6px; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th { text-align: left; font-size: 12px; font-weight: 650; color: var(--text-2); padding: 8px 10px; border-bottom: 1px solid var(--border-strong); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
table.grid th button { border: 0; background: none; font-weight: 650; color: inherit; padding: 0; display: inline-flex; gap: 4px; align-items: center; }
table.grid td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.grid tr:hover td { background: var(--surface-2); }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }

/* ---------- decisions ---------- */
.meeting { margin-bottom: 18px; overflow: hidden; }
.meeting-head { padding: 14px 18px 10px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.meeting-title { font-weight: 650; font-size: 15px; }
.meeting-sum { margin: 8px 0 0; color: var(--text-2); font-size: 13px; max-width: 900px; }
.dec-item { padding: 12px 18px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 18px; align-items: start; }
.dec-item:last-of-type { border-bottom: 0; }
.dec-title { font-weight: 600; margin: 4px 0 0; }
.dec-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; min-width: 220px; }
.dec-actions .row { justify-content: flex-end; flex-wrap: nowrap; }
.dec-actions .input { width: 100%; }
.meeting-foot { padding: 10px 18px; display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--surface-2); border-top: 1px solid var(--border); flex-wrap: wrap; }

/* ---------- pipeline board ---------- */
.board { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 12px; min-height: 420px; }
.lane { flex: 1 0 200px; max-width: 300px; background: var(--surface-3); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 230px); }
.lane-head { padding: 10px 12px 8px; display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 13px; }
.lane-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.lane-count { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--text-3); }
.lane-total { padding: 0 12px 8px; font-size: 12px; color: var(--text-3); }
.lane-body { padding: 4px 8px 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 80px; border-radius: 0 0 var(--radius) var(--radius); transition: background .12s; }
.drop-on { background: var(--accent-soft); outline: 2px dashed var(--accent); outline-offset: -4px; }
.lane-foot { padding: 6px 12px 10px; font-size: 11.5px; color: var(--text-3); }
.lane-parked {
  flex: 0 0 52px; min-height: 260px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 10px; padding: 14px 4px; color: var(--text-3);
}
.lane-parked span.vt { writing-mode: vertical-rl; transform: rotate(180deg); font-weight: 650; font-size: 13px; letter-spacing: .02em; }
.pcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px; box-shadow: var(--shadow);
  cursor: grab; display: flex; flex-direction: column; gap: 4px; text-align: left;
}
.pcard:hover { border-color: var(--border-strong); }
.pcard.dragging { opacity: .45; }
.pcard.locked { cursor: pointer; }
/* a move on its way (drag): the card stays where it was, dimmed, until the move is saved */
.pcard.saving { opacity: .55; cursor: progress; border-style: dashed; }
.pc-client { font-weight: 650; font-size: 13px; }
.pc-title { font-size: 12.5px; color: var(--text-2); }
.pc-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 2px; }
.pc-amt { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pc-amt small { font-weight: 500; color: var(--text-3); }
.pc-next { font-size: 12px; color: var(--text-2); border-top: 1px solid var(--border); padding-top: 5px; margin-top: 2px; }
.pc-next.over { color: var(--crit); }

/* ---------- side panel, modal, drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(10, 10, 10, .32); z-index: 20; }
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(430px, 100vw); background: var(--surface); z-index: 21;
  box-shadow: var(--shadow-lift); display: flex; flex-direction: column; border-left: 1px solid var(--border);
}
.panel-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: flex-start; }
.panel-head h2 { margin: 0; font-size: 17px; }
.panel-body { padding: 14px 18px 24px; overflow-y: auto; flex: 1; }
.panel-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
.x-btn { margin-left: auto; border: 0; background: none; font-size: 20px; line-height: 1; color: var(--text-3); padding: 2px 6px; border-radius: 6px; }
.x-btn:hover { background: var(--surface-3); color: var(--text); }
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field label, .field .lbl { font-size: 12px; font-weight: 650; color: var(--text-2); }
.field .val { font-size: 13.5px; }
.field-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.hist { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.hist li { position: relative; padding: 0 0 10px 14px; font-size: 12.5px; }
.hist li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.modal {
  position: fixed; z-index: 31; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100vw - 32px));
  background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lift); border: 1px solid var(--border); max-height: calc(100vh - 40px); display: flex; flex-direction: column;
}
.modal .panel-body { padding-top: 12px; }
.modal-scrim { z-index: 30; }
.drawer { width: min(560px, 100vw); }
.log-ev { border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; margin-bottom: 8px; font-size: 12.5px; background: var(--surface-2); }
.log-ev .hash { font-family: var(--mono); font-size: 11px; color: var(--text-3); word-break: break-all; }
.log-ev .ev-type { font-weight: 700; }
.ev-line { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--text); }
.log-ev .tech { margin-top: 4px; }
.log-ev .tech > summary { cursor: pointer; font-size: 11.5px; color: var(--text-3); }
.log-ev .tech[open] > summary { margin-bottom: 4px; }

/* ---------- client 360 ---------- */
.c360 { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
.client-list { padding: 10px; position: sticky; top: 0; max-height: calc(100vh - 120px); overflow-y: auto; }
.client-list .input { width: 100%; margin-bottom: 8px; }
.cl-btn { width: 100%; border: 0; background: none; text-align: left; padding: 7px 9px; border-radius: 8px; display: flex; gap: 8px; align-items: center; }
.cl-btn:hover { background: var(--surface-3); }
.cl-btn[aria-current="true"] { background: var(--accent-soft); }
.cl-btn .cl-name { font-weight: 600; font-size: 13px; }
.cl-btn .cl-sub { font-size: 11.5px; color: var(--text-3); }
.client-select { display: none; width: 100%; margin-bottom: 12px; }
.c-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.c-avatar { width: 46px; height: 46px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: 16px; flex: none; }
.c-head h2 { margin: 0; font-size: 19px; letter-spacing: -.01em; }
.c-facts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tl { list-style: none; margin: 0; padding: 0; }
.tl-row { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.tl-row:last-child { border-bottom: 0; }
.tl-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.tl-ico.k-meeting { background: var(--accent-soft); color: var(--accent); }
.tl-ico.k-item { background: var(--warn-soft); color: var(--warn-ink); }
.tl-ico.k-stage { background: var(--good-soft); color: var(--good); }
.tl-when { font-size: 11.5px; color: var(--text-3); }
.tl-head { font-weight: 600; font-size: 13px; }
.tl-detail { font-size: 12.5px; color: var(--text-2); }
.mini-list { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.mini-list li { padding: 5px 0; border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.mini-list li:last-child { border-bottom: 0; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.fchip { border: 1px solid var(--border-strong); background: var(--surface); padding: 3px 10px; border-radius: 999px; font-size: 12px; color: var(--text-2); }
.fchip[aria-pressed="true"] { background: var(--text); color: var(--surface); border-color: var(--text); }

/* ---------- dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.hbar { display: grid; grid-template-columns: 150px minmax(0, 1fr) 118px; gap: 10px; align-items: center; padding: 5px 0; font-size: 13px; }
.hbar-track { height: 14px; position: relative; }
.hbar-fill { height: 100%; background: var(--bar); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar-val { text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.vchart { position: relative; height: 180px; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 14px; align-items: end; padding: 0 4px; border-bottom: 1px solid var(--border-strong); }
.vbar-wrap { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; cursor: default; }
.vbar { width: 60%; max-width: 44px; background: var(--bar); border-radius: 4px 4px 0 0; min-height: 2px; }
.vbar.none { background: transparent; border: 1px dashed var(--border-strong); border-bottom: 0; height: 6px; }
.vref { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--ref-line); pointer-events: none; }
.vref span { position: absolute; right: 0; top: -19px; font-size: 11px; color: var(--text-2); background: var(--surface); padding: 0 4px; }
.vlabels { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 14px; padding: 6px 4px 0; font-size: 11.5px; color: var(--text-3); text-align: center; }
#tip {
  position: fixed; z-index: 60; pointer-events: none; background: var(--text); color: var(--surface); font-size: 12px; padding: 6px 9px;
  border-radius: 6px; box-shadow: var(--shadow-lift); max-width: 260px; display: none; white-space: pre-line;
}

/* ---------- admin ---------- */
.admin-note { font-size: 12.5px; color: var(--text-3); margin-top: 10px; }
.travel-card { max-width: 720px; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px 14px; }

/* ---------- toasts ---------- */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--text); color: var(--surface); border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow-lift); font-size: 13px; animation: tin .18s ease-out; }
.toast.error { background: var(--crit); color: #fff; }
.toast ol { margin: 4px 0 0; padding-left: 18px; }
.toast .t-title { font-weight: 650; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* container queries: the same screens reflow in a narrow window or on a phone */
@container vp (max-width: 560px) {
  h1.page { font-size: 19px; }
  .dec-item { grid-template-columns: 1fr; }
  .dec-actions { min-width: 0; }
  .dec-actions .row { justify-content: stretch; }
  .dec-actions .row .btn { flex: 1; justify-content: center; }
  .trow { grid-template-columns: 24px minmax(0, 1fr); }
  .trow-act { grid-column: 2; justify-content: flex-start; }
  .c360 { grid-template-columns: 1fr; }
  .client-list { display: none; }
  .client-select { display: block; }
  .meeting-head, .dec-item, .meeting-foot { padding-left: 12px; padding-right: 12px; }
  .hbar { grid-template-columns: 100px minmax(0, 1fr) 90px; }
}
@container vp (max-width: 900px) {
  .dash-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- BFS white layout (matches bfs-partners.com) ---------- */
.topbar { border-bottom: 2px solid var(--brand-tan); }
.rail { background: var(--surface); border-right: 1px solid var(--border); }
.rail-section { color: var(--accent); letter-spacing: .12em; }
.nav-btn { color: var(--text-2); }
.nav-btn:hover { background: var(--surface-2); color: var(--accent); }
.nav-btn[aria-current="page"] { background: var(--surface); color: var(--accent); font-weight: 700; box-shadow: inset 3px 0 0 var(--accent); }
.viewport { padding: 32px 40px 56px; }
h1.page { font-family: var(--font-head); font-size: 30px; font-weight: 700; letter-spacing: 0; line-height: 1.15; color: var(--accent); margin: 0; }
h1.page::after { content: ""; display: block; width: 120px; height: 2px; background: var(--brand-tan); margin: 16px 0 14px; }
.page-sub { color: var(--text-2); font-size: 14.5px; line-height: 1.7; margin-bottom: 28px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: none; }
.section-title { color: var(--accent); }
.lane { background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--accent); border-radius: var(--radius); }
.lane-head { color: var(--accent); text-transform: uppercase; letter-spacing: .08em; font-size: 12px; }
table.grid th { background: var(--surface); color: var(--accent); text-transform: uppercase; letter-spacing: .06em; font-size: 11.5px; border-bottom: 2px solid var(--accent); }
.table-wrap { border-radius: var(--radius); }
.btn, .tb-btn { border-radius: 0; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); text-transform: uppercase; letter-spacing: .14em; font-size: 12px; font-weight: 500; padding: 8px 18px; }
.chip-proto { color: var(--accent); background: var(--brand-tan-soft); border-color: var(--brand-tan); border-radius: 0; }
.seg { border-radius: 0; }
.nav-btn { border-radius: 0; }
:root[data-theme="dark"] .nav-btn[aria-current="page"] { box-shadow: inset 3px 0 0 var(--accent); }

/* ---------- web app additions (api mode: sign-in indicator, loading, list links) ---------- */
.whoami { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; white-space: nowrap; }
.whoami strong { color: var(--text); font-weight: 650; }
.whoami .avatar { width: 26px; height: 26px; font-size: 11px; }
[hidden] { display: none !important; }
.skeleton { max-width: 560px; margin: 48px auto; text-align: center; color: var(--text-2); }
.skeleton .bar { height: 3px; background: var(--brand-tan-soft); overflow: hidden; border-radius: 2px; margin: 18px auto 0; max-width: 260px; }
.skeleton .bar::after { content: ""; display: block; width: 40%; height: 100%; background: var(--accent); animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.list-links { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; font-size: 13px; }
.list-links a { color: var(--accent); text-decoration: none; }
.list-links a:hover { text-decoration: underline; }
.row-link { color: var(--accent); text-decoration: none; font-size: 12px; white-space: nowrap; }
.row-link:hover { text-decoration: underline; }
.toast .t-actions { margin-top: 8px; display: flex; gap: 6px; }
.toast .t-actions button { border: 1px solid var(--surface); background: transparent; color: var(--surface); padding: 3px 9px; font-size: 12px; border-radius: 0; }
.toast .t-actions button:hover { background: var(--surface); color: var(--text); }
.chip-warn { font-size: 11.5px; font-weight: 600; color: var(--warn-ink); background: var(--warn-soft); border: 1px solid var(--warn-line); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }

/* ---------- Phase A: Today, rows, tab bar, phone layout (html[data-layout] is set by app.js) ---------- */
.rail-sep { height: 1px; background: var(--border); margin: 10px 8px; }
.page-head { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.page-head h1.page { flex: 0 1 auto; }
.help { position: relative; margin-top: 4px; }
.help > summary { list-style: none; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border-strong); display: grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--text-2); cursor: pointer; }
.help > summary::-webkit-details-marker { display: none; }
.help-body { position: absolute; z-index: 10; top: 32px; left: 0; width: min(380px, calc(100vw - 48px)); background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lift); padding: 10px 12px; font-size: 13px; color: var(--text-2); }
.today-head { margin-bottom: 10px; }
.today-head h1.page::after { margin: 12px 0 8px; }
.today-sub { margin: 0; color: var(--text-2); font-size: 14px; }
.today-section { margin: 22px 0 0; }
.today-section > h2.section-title, .today-section > summary.section-title { margin: 0 0 10px; }
.today-section > summary { cursor: pointer; list-style: none; }
.today-section > summary::-webkit-details-marker { display: none; }
.today-section > summary::before { content: "▸"; margin-right: 4px; }
.today-section[open] > summary::before { content: "▾"; }
.section-title .count { color: var(--text-3); font-weight: 600; }
.sub-title { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin: 14px 0 6px; }
.trows { border: 1px solid var(--border); background: var(--surface); }
.trow { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.trow:last-child { border-bottom: 0; }
.trow-ico { color: var(--accent); display: grid; place-items: center; }
.trow-main { min-width: 0; }
.trow-title { font-weight: 600; overflow-wrap: anywhere; }
.trow-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.trow-owner { font-weight: 650; color: var(--text); }
.trow-act { display: flex; align-items: center; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.trow-act .select { max-width: 200px; }
.check-strip { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; background: var(--warn-soft); border: 1px solid var(--warn-line); font-size: 13px; }
.linkish { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; font-size: inherit; text-decoration: underline; text-underline-offset: 2px; }
.chip { font-size: 11.5px; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.tag { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 650; padding: 1px 8px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.tag-urgent { background: var(--crit-soft); color: var(--crit); }
.tag-check { background: var(--warn-soft); color: var(--warn-ink); border-color: var(--warn-line); }
.tag-held { background: var(--muted-soft); color: var(--text-2); }
.row-more { position: relative; }
.row-more > summary { list-style: none; min-width: 44px; min-height: 44px; display: grid; place-items: center; cursor: pointer; color: var(--text-2); }
.row-more > summary::-webkit-details-marker { display: none; }
.row-more > summary:hover { color: var(--accent); background: var(--surface-3); }
.row-more .menu { position: absolute; right: 0; top: 100%; z-index: 15; min-width: 190px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lift); display: flex; flex-direction: column; }
.row-more .menu button, .row-more .menu .menu-link { border: 0; background: none; text-align: left; padding: 10px 14px; font-size: 13px; color: var(--text); text-decoration: none; }
.row-more .menu button:hover, .row-more .menu .menu-link:hover { background: var(--surface-3); }
.show-more { margin-top: 6px; }
.ok-card .meeting-head { padding-bottom: 10px; }
.ok-card .dec-item { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.ok-card .dec-actions { flex-direction: row; align-items: center; min-width: 0; gap: 8px; }
.ok-card .dec-actions .btn { min-width: 64px; justify-content: center; }
.ok-card .pick-client { margin: 10px 18px; }
.ok-all { justify-content: flex-end; }
.team-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 6px 0 12px; }
.team-tile { border: 1px solid var(--border); border-top: 3px solid var(--accent); background: var(--surface); padding: 12px 14px; text-align: left; display: flex; flex-direction: column; gap: 2px; }
.team-tile.on { background: var(--accent-soft); }
.team-tile .tt-num { font-family: var(--font-head); font-size: 26px; font-weight: 700; color: var(--accent); line-height: 1.1; }
.team-tile .tt-label { font-size: 12.5px; color: var(--text-2); }
.team-people { display: flex; flex-direction: column; border: 1px solid var(--border); background: var(--surface); margin-bottom: 14px; }
.team-person { border: 0; border-bottom: 1px solid var(--border); background: none; text-align: left; padding: 10px 14px; font-size: 13px; color: var(--text-2); min-height: 44px; }
.team-person:last-child { border-bottom: 0; }
.team-person strong { color: var(--text); }
.team-person .over { color: var(--crit); font-weight: 650; }
.team-person.on { background: var(--accent-soft); }
.team-detail { margin-bottom: 14px; }
.team-charts > summary { cursor: pointer; margin: 10px 0; }
.admin-sec { margin-bottom: 16px; }
.away-cats { margin-top: 6px; }
.away-cats > summary { cursor: pointer; font-size: 13px; font-weight: 650; color: var(--text-2); margin-bottom: 8px; }
.admin-settings > summary { cursor: pointer; margin: 0; }
.sheet { display: flex; flex-direction: column; }
.sheet-btn { display: flex; align-items: center; gap: 12px; border: 0; border-bottom: 1px solid var(--border); background: none; text-align: left; padding: 12px 4px; min-height: 48px; font-size: 15px; color: var(--text); }
.sheet-btn:last-child { border-bottom: 0; }
.sheet-btn .ico { color: var(--accent); }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); z-index: 40;
}
.tabbar button { min-height: 56px; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11.5px; color: var(--text-3); position: relative; }
.tabbar button[aria-current="page"] { color: var(--accent); font-weight: 650; }
.tabbar .nav-badge { position: absolute; top: 6px; left: calc(50% + 6px); font-size: 10.5px; padding: 0 5px; min-width: 18px; }
html[data-layout="phone"] .rail { display: none; }
html[data-layout="phone"] .shell { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 54px); height: calc(100dvh - 54px); }
html[data-standalone="1"][data-layout="phone"] .shell { height: calc(100vh - 54px - env(safe-area-inset-top)); height: calc(100dvh - 54px - env(safe-area-inset-top)); }
html[data-layout="phone"] .viewport { padding: 14px 16px calc(var(--tabbar-h) + var(--okall-h) + 16px + env(safe-area-inset-bottom)); }
html[data-layout="phone"] h1.page { font-size: 24px; }
html[data-layout="phone"] .topbar { gap: 8px; padding: 0 12px; overflow: hidden; }
html[data-layout="phone"] .brand-name { display: none; }
html[data-layout="phone"] .tb-btn, html[data-layout="phone"] .brand-sep, html[data-layout="phone"] .brand-tag, html[data-layout="phone"] .chip-proto, html[data-layout="phone"] #travelChip, html[data-layout="phone"] .whoami { display: none; }
html[data-layout="phone"] .viewas { font-size: 12px; }
html[data-layout="phone"] .viewas select { max-width: 150px; }
html[data-layout="phone"] .dec-actions .btn, html[data-layout="phone"] .trow-act .btn, html[data-layout="phone"] .ok-all .btn { min-height: 44px; min-width: 64px; }
html[data-layout="phone"] .ok-all { position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); background: var(--surface); z-index: 5; border-top: 1px solid var(--border); box-shadow: 0 -6px 12px -8px rgba(0, 0, 0, .15); }
html[data-layout="phone"] .ok-card .dec-item { grid-template-columns: 1fr; }
html[data-layout="phone"] .ok-card .dec-actions { justify-content: flex-start; }
html[data-layout="phone"] .trow { grid-template-columns: 24px minmax(0, 1fr); padding: 10px 12px; }
html[data-layout="phone"] .trow-act { grid-column: 2; justify-content: flex-start; }
html[data-layout="phone"] .team-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* phone: toasts at the top, clear of OK all and the tab bar, and they never take a tap (only their buttons do) */
html[data-layout="phone"] #toasts { top: calc(62px + env(safe-area-inset-top)); bottom: auto; right: 16px; pointer-events: none; }
html[data-layout="phone"] .toast .t-actions, html[data-layout="phone"] .toast .t-actions button { pointer-events: auto; }
html[data-standalone="1"] .topbar { padding-top: env(safe-area-inset-top); height: calc(54px + env(safe-area-inset-top)); }

/* Clients: the agenda first, the history collapsed */
.agenda { border-top: 3px solid var(--accent); margin-bottom: 14px; }
.agenda h3 { margin: 0 0 4px; font-size: 15px; }
.agenda-block { margin-top: 16px; }
.agenda-block h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.agenda-block .btn { margin-top: 8px; }
.agenda-owner { font-size: 12.5px; font-weight: 650; margin: 8px 0 2px; }
.flag-line { font-size: 12px; color: var(--crit); font-weight: 600; margin-top: 2px; }
.flag-line .linkish { color: inherit; font-weight: inherit; }
.history > summary { cursor: pointer; margin: 0; }
.history[open] > summary { margin-bottom: 10px; }
/* Pipeline: View menu, phone stack, panel presets */
.pipe-search { width: 230px; }
.view-menu { position: relative; }
.view-menu > summary { list-style: none; cursor: pointer; }
.view-menu > summary::-webkit-details-marker { display: none; }
.view-menu .menu { position: absolute; left: 0; top: 100%; z-index: 15; min-width: 170px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lift); display: flex; flex-direction: column; padding: 4px 0; }
.view-menu .menu button { border: 0; background: none; text-align: left; padding: 10px 14px; font-size: 13px; color: var(--text); min-height: 40px; }
.view-menu .menu button[aria-pressed="true"] { color: var(--accent); font-weight: 700; }
.view-menu .menu .toggle { padding: 10px 14px; }
.stack-title { margin-top: 16px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack .pcard { cursor: pointer; }
.next-presets { margin: -4px 0 12px; }
/* Admin: Who handles what as cards, Settings as a list */
.route-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.route-card { border: 1px solid var(--border); padding: 12px 14px; background: var(--surface); }
.route-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.route-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0 10px; align-items: end; }
.route-fields .select, .route-fields .input { width: 100%; }
.route-foot { align-items: flex-start; }
.route-more > summary { cursor: pointer; font-size: 12.5px; font-weight: 650; color: var(--text-2); padding: 6px 0; }
.route-more .toggle { margin: 0 0 12px; }
.setting-list { list-style: none; margin: 10px 0 0; padding: 0; }
.setting-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.setting-row:last-child { border-bottom: 0; }
.setting-value { display: flex; gap: 8px; align-items: center; min-width: 0; }
.setting-value .input { flex: 1; }
html[data-layout="phone"] .setting-row { grid-template-columns: 1fr; }
html[data-layout="phone"] .route-cards { grid-template-columns: 1fr; }
html[data-layout="phone"] .pipe-search { width: 100%; }
html[data-layout="phone"] .toolbar .grow { display: none; }
html[data-layout="phone"] .c360 { grid-template-columns: 1fr; }
html[data-layout="phone"] .client-list { display: none; }
html[data-layout="phone"] .client-select { display: block; }
html[data-layout="phone"] .c-head { flex-wrap: wrap; }
html[data-layout="phone"] .dash-grid { grid-template-columns: 1fr; }
html[data-layout="phone"] .hbar { grid-template-columns: 100px minmax(0, 1fr) 90px; }
html[data-layout="phone"] .panel-foot .btn, html[data-layout="phone"] .next-presets .btn, html[data-layout="phone"] .row-more > summary { min-height: 44px; }
/* a sticky OK all needs the card not to clip (overflow: hidden would make the card its scroll box) */
html[data-layout="phone"] .ok-card { overflow: visible; }
.linkish { text-align: left; }
.team-charts > summary, .history > summary, .admin-settings > summary { list-style: none; }
.team-charts > summary::-webkit-details-marker, .history > summary::-webkit-details-marker, .admin-settings > summary::-webkit-details-marker { display: none; }
.team-charts > summary::before, .history > summary::before, .admin-settings > summary::before { content: "▸"; margin-right: 4px; }
.team-charts[open] > summary::before, .history[open] > summary::before, .admin-settings[open] > summary::before { content: "▾"; }
/* Phase A review fixes: nothing under the tab bar, 44 px targets on a phone, popovers inside the screen */
html[data-layout="phone"] .panel { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
html[data-layout="phone"] .modal { max-height: calc(100vh - 2 * (var(--tabbar-h) + 12px)); max-height: calc(100dvh - 2 * (var(--tabbar-h) + 12px)); }
html[data-layout="phone"] .check-strip .btn, html[data-layout="phone"] .show-more, html[data-layout="phone"] .pick-client .btn, html[data-layout="phone"] .pick-client .select,
html[data-layout="phone"] .admin-sec .btn, html[data-layout="phone"] .route-card .select, html[data-layout="phone"] .route-card .input, html[data-layout="phone"] .view-menu > summary, html[data-layout="phone"] .toolbar .btn,
html[data-layout="phone"] .toolbar .seg button, html[data-layout="phone"] .route-more > summary, html[data-layout="phone"] .away-cats > summary { min-height: 44px; }
html[data-layout="phone"] .check-strip .btn { min-width: 64px; justify-content: center; }
html[data-layout="phone"] .today-section > summary.section-title, html[data-layout="phone"] .team-charts > summary, html[data-layout="phone"] .history > summary, html[data-layout="phone"] .admin-settings > summary { min-height: 44px; display: flex; align-items: center; }
html[data-layout="phone"] .toggle { min-height: 44px; }
html[data-layout="phone"] .toggle input { width: 20px; height: 20px; }
html[data-layout="phone"] .trow .linkish { padding: 12px 0; margin: -12px 0; }
html[data-layout="phone"] .flag-line .linkish { padding: 12px 0; margin: -12px 0; }
/* the "?" popover hangs from the page head, not from the button, so it never runs past the right edge (tablet widths) */
.page-head { position: relative; }
.help { position: static; }
.help-body { left: 0; top: 100%; width: min(380px, 100%); max-width: none; }
html[data-layout="phone"] .help-body { right: 0; width: auto; }
/* the View and ⋯ menus open toward the side with room (app.js placeMenu): #main scrolls and clips anything past its edges, so a
   menu hanging left from a button near the rail was cut off under it */
html[data-layout] .view-menu .menu.menu-start, html[data-layout] .row-more .menu.menu-start { left: 0; right: auto; }
html[data-layout] .view-menu .menu.menu-end, html[data-layout] .row-more .menu.menu-end { left: auto; right: 0; }
.setting-locked { overflow-wrap: anywhere; min-width: 0; }
.setting-value { flex-wrap: wrap; }
/* the Activity record lives in the rail on a desk and in More on a phone */
html[data-layout="desk"] #btnLog { display: none; }
/* row buttons: outlined and in normal case so the list stays calm; overdue and urgent rows keep the filled button */
.trow-act > .btn.primary { background: var(--surface); color: var(--accent); border-color: var(--accent); text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.trow-act > .btn.primary:hover { background: var(--accent-soft); }
.today-section[data-section="overdue"] .trow-act > .btn.primary, .trow:has(.tag-urgent) .trow-act > .btn.primary { background: var(--accent); color: var(--accent-ink); }
.today-section[data-section="overdue"] .trow-act > .btn.primary:hover, .trow:has(.tag-urgent) .trow-act > .btn.primary:hover { background: var(--accent-hover); }
.team-tile:focus-visible, .team-person:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* phone: the last row clears the sticky OK all and the tab bar (end padding above), and a row brought into view
   (keyboard focus, scrollIntoView) stops above both; every ⋯ and View menu entry is a 44 px target */
html[data-layout="phone"] main#main { scroll-padding-bottom: calc(var(--tabbar-h) + var(--okall-h) + 8px + env(safe-area-inset-bottom)); }
html[data-layout="phone"] .row-more .menu button, html[data-layout="phone"] .row-more .menu .menu-link,
html[data-layout="phone"] .view-menu .menu button, html[data-layout="phone"] .view-menu .menu .toggle { min-height: 44px; display: flex; align-items: center; }
/* ---------- the task view: one Action Item or client request opened from a link or a row title ---------- */
.trow-title.linkish, .dec-title.linkish { display: block; color: var(--text); text-decoration: none; text-align: left; font-weight: 600; cursor: pointer; }
.trow-title.linkish:hover, .dec-title.linkish:hover { color: var(--accent); text-decoration: underline; }
.panel-head .row-more { margin-left: auto; }
.panel-head .row-more + .x-btn { margin-left: 0; }
.panel.task .panel-head > .grow { min-width: 0; }
.panel.task h2 { overflow-wrap: anywhere; margin-top: 2px; }
.task-sub { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.task-fact { grid-template-columns: 120px minmax(0, 1fr); align-items: baseline; gap: 2px 12px; margin-bottom: 10px; }
.task-fact .val { min-width: 0; overflow-wrap: anywhere; }
.task-quote { margin: 0; unicode-bidi: plaintext; }
.task-notes { white-space: pre-wrap; }
.task-lock { display: flex; margin: 0 0 14px; font-size: 13px; }
.task-body { margin: 0 0 14px; color: var(--text-2); }
.panel.task .skeleton { margin: 12px 0; text-align: left; }
.panel.task .skeleton .bar { margin: 0; }
.panel.task .banner .row { margin-top: 8px; }
.panel.task .check-strip { margin-top: 4px; }
.panel.task .task-reassign .select { min-width: 0; }
.panel.task .panel-foot { flex-wrap: wrap; align-items: center; }
/* the ⋯ menu sits in the footer: it opens upwards, inside the panel */
.panel.task .panel-foot .row-more .menu { top: auto; bottom: 100%; }
html[data-layout="phone"] .panel.task { left: 0; width: 100%; border-left: 0; }
html[data-layout="phone"] .panel.task .btn, html[data-layout="phone"] .panel.task .select, html[data-layout="phone"] .panel.task .linkish { min-height: 44px; }
html[data-layout="phone"] .task-fact { grid-template-columns: 1fr; }
/* a thumb-sized close; the negative margin keeps the header height */
html[data-layout="phone"] .panel .x-btn { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; margin-top: -10px; margin-right: -10px; flex: none; }
/* the client link keeps its 44 px target without a gap under the name */
html[data-layout="phone"] .task-fact .linkish { display: inline-flex; align-items: center; margin: -12px 0; }
/* ---------- View as and the Admin panel (People, Messages) ---------- */
/* View as: one calm strip on every screen, kept in view while the screen scrolls */
.viewas-banner { position: sticky; top: 0; z-index: 12; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; padding: 8px 12px;
  background: var(--warn-soft); border: 1px solid var(--warn-line); border-radius: var(--radius); font-size: 13px; color: var(--text); }
.viewas-banner .ico { color: var(--warn-ink); flex: none; }
/* the same notice on top of the task view and the card panel, which cover the screen on the phone */
.viewas-strip { display: flex; align-items: center; gap: 8px; flex: none; padding: 6px 12px 6px 18px; background: var(--warn-soft);
  border-bottom: 1px solid var(--warn-line); font-size: 12.5px; color: var(--text); }
.viewas-strip .ico { color: var(--warn-ink); flex: none; }
.person-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.person-card { border: 1px solid var(--border); padding: 12px 14px; background: var(--surface); display: flex; flex-direction: column; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.person-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.person-counts { font-weight: 600; color: var(--text-2); }
.person-warn { color: var(--warn-ink); display: flex; align-items: center; gap: 4px; }
.person-actions { margin-top: 6px; }
.msg-switches { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; }
.msg-switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.msg-status { margin: 4px 0 12px; font-size: 13.5px; }
.msg-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 12px; margin: 14px 0 6px; }
.msg-filter { display: flex; flex-direction: column; gap: 2px; margin: 0; }
.msg-filter .select { width: 100%; }
.msg-list { list-style: none; margin: 8px 0 0; padding: 0; }
.msg-row { border-bottom: 1px solid var(--border); padding: 8px 0; }
.msg-row:last-child { border-bottom: 0; }
.msg-head { display: flex; flex-direction: column; gap: 2px; width: 100%; border: 0; background: none; padding: 0; text-align: left; color: var(--text); cursor: pointer; min-width: 0; overflow-wrap: anywhere; }
.msg-state { color: var(--text-2); }
.msg-failed, .msg-stale { color: var(--crit); }
.msg-row .row { margin-top: 6px; }
/* message text: shown as text (never HTML), wrapped on any width */
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 13px; margin: 8px 0 0; padding: 10px 12px; background: var(--accent-soft); border-radius: var(--radius-sm); }
.preview-msg { margin: 0 0 12px; }
html[data-layout="phone"] .person-cards { grid-template-columns: 1fr; }
html[data-layout="phone"] .msg-filters { grid-template-columns: 1fr 1fr; }
html[data-layout="phone"] .viewas-banner .btn, html[data-layout="phone"] .viewas-strip .btn, html[data-layout="phone"] .msg-head, html[data-layout="phone"] .msg-filter .select, html[data-layout="phone"] .modal .row .btn { min-height: 44px; }
/* Recordings to sort (FF1): chips for the suggested clients, the consent strip, the client picker; Admin > Fireflies */
.rec-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip-btn { border: 1px solid var(--accent); cursor: pointer; font-size: 12.5px; padding: 4px 10px; white-space: normal; text-align: left; min-height: 32px; }
.chip-btn:hover { background: var(--accent); color: var(--accent-ink); }
.rec-text { margin: 2px 0 0; font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.rec-ftitle { margin-top: 2px; overflow-wrap: anywhere; }
.rec-mismatch { margin-top: 4px; color: var(--warn-ink); overflow-wrap: anywhere; }
.rec-strip { margin-top: 8px; padding: 8px 10px; background: var(--warn-soft); border: 1px solid var(--warn-line); font-size: 13px; }
.rec-strip p { margin: 0 0 6px; overflow-wrap: anywhere; }
.rec-strip .row, .rec-picker .row { margin-top: 6px; }
.rec-picker { margin-top: 8px; padding: 8px 10px; border: 1px solid var(--border); background: var(--surface-2); }
.rec-picks { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; max-height: 240px; overflow-y: auto; }
.rec-bulk { margin: 6px 0 4px; }
.ff-status { margin: 0 0 6px; overflow-wrap: anywhere; }
.ff-error { color: var(--crit); min-height: 1em; margin: 6px 0 0; }
html[data-layout="phone"] .rec-row .btn, html[data-layout="phone"] .chip-btn, html[data-layout="phone"] .rec-picker .input, html[data-layout="phone"] .rec-bulk .btn,
html[data-layout="phone"] .rec-strip .linkish, html[data-layout="phone"] .modal .panel-foot .btn { min-height: 44px; }
html[data-layout="phone"] .rec-row { grid-template-columns: 24px minmax(0, 1fr); }
html[data-layout="phone"] .rec-row .trow-act { grid-column: 1 / -1; justify-content: flex-start; }
/* Today > Tasks to hand out: one chip per person, the category's usual person first */
.ho-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip-usual { font-weight: 600; }
.chip-btn:disabled { cursor: default; opacity: .6; }
.chip-btn:disabled:hover { background: var(--accent-soft); color: var(--accent); }
.ho-picker { margin-top: 8px; gap: 6px; }
html[data-layout="phone"] .ho-row { grid-template-columns: 24px minmax(0, 1fr); }
html[data-layout="phone"] .ho-row .btn { min-height: 44px; }
/* By date | By client (Today), By person | By client (Team): the switch, then one heading per client over the usual
   rows (name as a link, "n open", the overdue count in red); headings wrap and long names break, so a phone never scrolls sideways */
.view-switch { margin: 22px 0 0; }
.view-switch + .today-section { margin-top: 10px; }
.team-tiles + .view-switch { margin: 0 0 12px; }
.client-group + .client-group { margin-top: 14px; }
.cg-head { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--text-2); overflow-wrap: anywhere; }
.cg-head .cg-name { font-size: 14px; }
.cg-head .over { color: var(--crit); font-weight: 650; }
.team-clients { margin-bottom: 14px; }
/* an overdue row keeps the filled button it has under Overdue */
.today-section[data-section="byclient"] .trow:has(.due.over) .trow-act > .btn.primary { background: var(--accent); color: var(--accent-ink); }
.today-section[data-section="byclient"] .trow:has(.due.over) .trow-act > .btn.primary:hover { background: var(--accent-hover); }
html[data-layout="phone"] .view-switch .seg button, html[data-layout="phone"] .cg-head .linkish { min-height: 44px; }
html[data-layout="phone"] .cg-head .linkish { display: inline-flex; align-items: center; }
/* Two-person tasks (ui/waits.js): "Waiting on Matt: …" until the part a task waits for is done, then "Ready: … done
   Oct 5". They carry a whole task title, so unlike the short tags they wrap: a phone never scrolls sideways */
.tag-wait, .tag-ready { display: inline-block; white-space: normal; overflow-wrap: anywhere; max-width: 100%; border-radius: 8px; text-align: left; }
.tag-wait { background: var(--muted-soft); color: var(--text-2); border-color: var(--border); }
.tag-ready { background: var(--good-soft); color: var(--good); }
.wait-line { margin-top: 3px; }
/* Admin > Recording consent: one line per client without an answer (the box ticked = Recording OK, unticked = Said no),
   the count, Confirm for all; the clients already decided collapsed. Long names wrap: a phone never scrolls sideways */
.consent-count { margin: 4px 0 8px; font-size: 13.5px; }
/* a Confirm for all that stopped: "Not finished: n clients are not recorded yet · Retry" until its Retry goes through */
.consent-retry { margin: 8px 0 10px; }
html[data-layout="phone"] .consent-retry .linkish { display: inline-flex; align-items: center; padding: 12px 0; margin: -12px 0; }
.consent-list { list-style: none; margin: 6px 0 10px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0 18px; }
.consent-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.consent-row .toggle { color: var(--text); min-width: 0; }
.consent-name { overflow-wrap: anywhere; min-width: 0; }
.consent-when { flex: none; text-align: right; }
.tag-consent-ok { background: var(--good-soft); color: var(--good); }
.tag-consent-no { background: var(--warn-soft); color: var(--warn-ink); border-color: var(--warn-line); }
.consent-done > summary { cursor: pointer; list-style: none; font-size: 13px; font-weight: 650; color: var(--text-2); margin: 8px 0 4px; }
.consent-done > summary::-webkit-details-marker { display: none; }
.consent-done > summary::before { content: "▸"; margin-right: 4px; }
.consent-done[open] > summary::before { content: "▾"; }
html[data-layout="phone"] .consent-list { grid-template-columns: 1fr; }
html[data-layout="phone"] .consent-done > summary { min-height: 44px; display: flex; align-items: center; }
/* Upcoming meetings (plan 3.2, ui/booking.js): the Next week sheet, Add meeting, Move; existing tokens only */
.section-head { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; }   /* the h2 and its buttons side by side, the buttons outside the heading */
.today-section .section-head > h2.section-title { margin: 0; }
.section-actions { display: inline-flex; gap: 2px; margin-left: 2px; }
.btn[aria-disabled="true"], .menu button[aria-disabled="true"] { opacity: .45; }   /* a booking control under View as: dimmed, a tap says why */
.book-client.book-unpicked { border-style: dashed; border-color: var(--warn-line); }   /* typed, not picked: the line is blank until a pick */
.book-unpicked-note { flex-basis: 100%; color: var(--warn-ink); }   /* the words under that field: the dashed border alone says nothing */
.section-actions .btn.ghost.sm { text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.trow-note { color: var(--text-2); }
.book-empty { margin: 0 0 8px; }
.modal.wide { width: min(760px, calc(100vw - 32px)); }
.book-note { margin: 0 0 10px; }
.book-day { border-top: 1px solid var(--border); padding: 10px 0 6px; }
.book-day:first-of-type { border-top: 0; }
.book-day-title { margin: 0 0 6px; font-size: 14px; font-weight: 650; }
.book-already-label { text-transform: uppercase; letter-spacing: .05em; font-size: 11px; margin: 2px 0; }
.book-existing { padding: 2px 0; }
.book-line { padding: 6px 0 4px; }
.book-controls { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; }
.book-client-wrap { position: relative; flex: 1 1 220px; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.book-client { flex: 1 1 160px; min-width: 0; }
.book-when { display: flex; gap: 6px; flex: 0 1 auto; }
.book-remove { min-width: 32px; justify-content: center; font-size: 16px; line-height: 1; }
.book-list { list-style: none; margin: 0; padding: 4px 0; width: 100%; flex-basis: 100%; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow-lift); max-height: 240px; overflow-y: auto; }
.book-list li { padding: 6px 10px; font-size: 13px; cursor: pointer; display: flex; gap: 6px; align-items: center; }
.book-list li[role="option"]:hover, .book-list li.hi { background: var(--accent-soft); }
.book-list li.book-new { border-top: 1px solid var(--border); color: var(--accent); font-weight: 600; }
.book-list li.book-none { cursor: default; }
.book-facts { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 4px; }
.book-facts .select { padding: 2px 6px; font-size: 12.5px; }
.book-clash { color: var(--crit); margin-top: 2px; }
.book-sameday, .book-next, .book-exists, .book-declined { margin-top: 2px; }
.book-consent-row { margin-top: 4px; }
.book-cap { margin: 6px 0 0; }
.book-line-add { font-size: 12.5px; margin-top: 2px; }
.book-dates { margin-bottom: 6px; }
.book-date-input { max-width: 200px; }
.book-current { margin: 0 0 12px; font-weight: 600; }
.next-meeting { display: flex; align-items: flex-start; gap: 8px; }
.next-meeting > .small { flex: 1; min-width: 0; }
.next-meeting .btn.ghost.sm { margin-left: 4px; text-transform: none; letter-spacing: 0; font-size: 12.5px; }
/* phone: 44 px targets, time and type side by side, the × on the client's row, nothing sideways at 390 px */
html[data-layout="phone"] .section-title, html[data-layout="phone"] .section-head { flex-wrap: wrap; }
html[data-layout="phone"] .section-actions { flex-basis: 100%; margin-left: 0; gap: 6px; }
html[data-layout="phone"] .section-actions .btn, html[data-layout="phone"] .next-meeting .btn, html[data-layout="phone"] .modal .input, html[data-layout="phone"] .modal .select,
html[data-layout="phone"] .modal .fchip, html[data-layout="phone"] .book-line .btn, html[data-layout="phone"] .book-list li, html[data-layout="phone"] .book-line-add, html[data-layout="phone"] .book-facts .linkish { min-height: 44px; }
html[data-layout="phone"] .book-remove { min-width: 44px; }
html[data-layout="phone"] .book-existing .linkish { padding: 12px 0; margin: -12px 0; }   /* the client name under "Already booked": a 44 px target without a taller line */
html[data-layout="phone"] .book-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
html[data-layout="phone"] .book-client-wrap { grid-column: 1; }
html[data-layout="phone"] .book-remove { grid-column: 2; grid-row: 1; }
html[data-layout="phone"] .book-when { grid-column: 1 / -1; }
html[data-layout="phone"] .book-when .select { flex: 1; min-width: 0; }
html[data-layout="phone"] .book-facts { grid-column: 1 / -1; }
html[data-layout="phone"] .book-facts .select { min-height: 44px; }
html[data-layout="phone"] .modal.wide { width: calc(100vw - 32px); }
/* the week sheet's This week | Next week switch */
.book-week-switch { margin: 0 0 10px; }
html[data-layout="phone"] .book-week-switch button { min-height: 44px; }
