/* Colours are tokens; dark set under prefers-color-scheme. */
:root {
  --bg: #f7f2ea;
  --surface: #ffffff;
  --sunken: #efe8dc;
  --rail: #f2ebe0;
  --fg: #231f1a;
  --muted: #6c6358;
  --line: #e5dccd;
  --accent: #3b5a7a;
  --accent-fg: #ffffff;
  --ink: #2b2723;
  --ink-fg: #ffffff;
  --attn: #c4553a;
  --attn-soft: #f9e6df;
  --taste: #8a4a78;
  --call: #5f6e7d;
  --run: #4a8a5a;
  --ok: #2f7a47;
  --ok-soft: #e3f1e5;
  --ok-line: #8cc49b;
  --p-teal: #1f8f8f; --p-ochre: #e3a21a; --p-plum: #9a4f96; --p-slate: #5f6e7d; --p-terracotta: #c4553a; --p-olive: #7d8a3a; --p-sage: #6fa07a; --p-rose: #d2677f;
  --zzz: #6c6358;
  --heart: #d2457a;
  --gold: #c8901a;
  --cos-bg: #f8ecd0; --cos-bg-hover: #f3e2bb;
  --wait-bg: #ece5d8; --wait-line: #e0d6c5; --wait-pill: #ddd3c1;
  --disc: #eadfcf;
  --disc-small: #f3ece0;
  --shadow: 0 1px 2px rgba(60, 40, 20, 0.06), 0 2px 8px rgba(60, 40, 20, 0.05);
  --shadow-modal: 0 20px 60px rgba(30, 20, 10, 0.35);
  --backdrop: rgba(35, 28, 20, 0.5);
  --veil: rgba(255, 255, 255, 0.74);
  --viewer-bg: #14100c;
  --font-ui: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, Consolas, "SFMono-Regular", monospace;
  --t-attn: #fbefe9; --t-taste: #f6edf4; --t-call: #edf0f3; --z-left: #f0e8da; --z-flight: #ece4d6; --z-main: #f5eee3;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --t-attn: #261a15; --t-taste: #231a22; --t-call: #1b1e22; --z-left: #181410; --z-flight: #1c1813; --z-main: #14110d;
    --bg: #15120e; --surface: #1e1a15; --sunken: #28231c; --rail: #1a1612; --fg: #ede6da; --muted: #a39887;
    --line: #342d24; --accent: #8fb4d9; --accent-fg: #15120e; --ink: #ede6da; --ink-fg: #15120e;
    --attn: #ee8266; --attn-soft: #3a2119; --taste: #c58ab3; --call: #9aa9b8; --run: #6dbb80;
    --ok: #74c68b; --ok-soft: #1c3024; --ok-line: #3d7a52; --disc: #3b342a; --disc-small: #484034; --p-teal: #4cc0bf; --p-ochre: #f0bd4a; --p-plum: #c58ab3; --p-slate: #9aa9b8; --p-terracotta: #ee8266; --p-olive: #b0bd62; --p-sage: #8cc79a; --p-rose: #ea8fa5; --zzz: #d6ccba; --heart: #ee8fb0; --gold: #f0bd4a; --cos-bg: #2a2215; --cos-bg-hover: #33291a;
    --wait-bg: #191611; --wait-line: #2a241c; --wait-pill: #2c261e; 
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.7); --backdrop: rgba(0, 0, 0, 0.62); --veil: rgba(30, 26, 21, 0.78); --viewer-bg: #000; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --t-attn: #261a15; --t-taste: #231a22; --t-call: #1b1e22; --z-left: #181410; --z-flight: #1c1813; --z-main: #14110d;
  --bg: #15120e; --surface: #1e1a15; --sunken: #28231c; --rail: #1a1612; --fg: #ede6da; --muted: #a39887;
  --line: #342d24; --accent: #8fb4d9; --accent-fg: #15120e; --ink: #ede6da; --ink-fg: #15120e;
  --attn: #ee8266; --attn-soft: #3a2119; --taste: #c58ab3; --call: #9aa9b8; --run: #6dbb80;
  --ok: #74c68b; --ok-soft: #1c3024; --ok-line: #3d7a52; --disc: #3b342a; --disc-small: #484034; --p-teal: #4cc0bf; --p-ochre: #f0bd4a; --p-plum: #c58ab3; --p-slate: #9aa9b8; --p-terracotta: #ee8266; --p-olive: #b0bd62; --p-sage: #8cc79a; --p-rose: #ea8fa5; --zzz: #d6ccba; --heart: #ee8fb0; --gold: #f0bd4a; --cos-bg: #2a2215; --cos-bg-hover: #33291a;
  --wait-bg: #191611; --wait-line: #2a241c; --wait-pill: #2c261e; 
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.7); --backdrop: rgba(0, 0, 0, 0.62); --veil: rgba(30, 26, 21, 0.78); --viewer-bg: #000; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--font-ui); font-size: 15px; line-height: 1.5; overflow-x: hidden; }
body.noscroll { overflow: hidden; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--font-mono); }

/* Layout: rail left, content right */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 100vh; }
.rail { display: flex; gap: 10px; overflow-x: auto; padding: 6px 16px 14px; scroll-snap-type: x proximity; }
.main { min-width: 0; padding: 16px 16px 72px; }
.content { container-type: inline-size; container-name: board; max-width: 1700px; margin: 0 auto; display: flex; flex-direction: column; gap: 26px; }
@media (min-width: 900px) {
  .layout { align-items: start; }
  .rail { flex-direction: column; overflow-x: hidden; overflow-y: auto; padding: 0 0 16px; gap: 0; flex: 1; scroll-snap-type: none; }
  .main { padding: 18px 28px 72px; }
}

/* Sign-in: full window at every breakpoint */
body.signedout .layout, body.signedout .modal, body.signedout .hmodal, body.signedout .viewer, body.signedout .mdrawer, body.signedout .mback { display: none; }
.signin { min-height: 100vh; min-height: 100dvh; width: 100%; display: flex; align-items: center; justify-content: center; padding: 32px 16px; box-sizing: border-box; background: linear-gradient(165deg, color-mix(in srgb, var(--accent) 12%, var(--bg)) 0%, var(--bg) 38%, color-mix(in srgb, var(--taste) 12%, var(--bg)) 100%); }
.signin-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-modal); overflow: hidden; }
.signin-bar { height: 5px; background: linear-gradient(90deg, var(--accent), var(--taste)); }
.signin-body { display: flex; flex-direction: column; align-items: stretch; gap: 24px; padding: clamp(24px, 5vw, 36px); text-align: center; }
.signin-mark { width: 88px; height: 88px; object-fit: contain; align-self: center; }
.signin-title { margin: 0; font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; color: var(--accent); }
.signin-btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 56px; padding: 14px 24px; border-radius: 10px; background: var(--accent); color: var(--accent-fg); font-size: 1.1rem; font-weight: 600; text-decoration: none; box-shadow: var(--shadow); }
.signin-btn:hover { filter: brightness(1.08); }
.signin-btn:focus-visible { outline: 3px solid var(--fg); outline-offset: 3px; }

/* Top bar */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--fg); background: var(--sunken); border-radius: 7px; padding: 2px 9px; max-width: 100%; overflow-wrap: anywhere; text-decoration: none; }
.chip.mono { font-family: var(--font-mono); font-size: 0.75rem; }
.chip.link { color: var(--accent); }
.chip.verdict.pass { color: var(--ok); background: var(--ok-soft); }
.chip.verdict.fail { color: var(--bad, #b3382c); background: var(--bad-soft, #f7e3e0); }
.chip.link:hover { text-decoration: underline; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--call); flex: none; display: inline-block; }
.k-decision .dot { background: var(--attn); }
.k-taste .dot { background: var(--taste); }
.filter { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.9rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 5px 10px 5px 16px; box-shadow: var(--shadow); }
select { font: inherit; font-size: 0.92rem; color: var(--fg); background: transparent; border: 0; padding: 4px 6px; max-width: 220px; cursor: pointer; }
select option { background: var(--surface); color: var(--fg); }
.banner { background: var(--sunken); border-radius: 8px; padding: 10px 14px; color: var(--muted); margin: 10px 16px 0; flex: none; }
.banner[hidden] { display: none; }
#banner-live { flex: none; }
.banner a { color: var(--accent); font-weight: 600; }

/* Sections */
section { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
h2 { margin: 0; font-size: 1.3rem; font-weight: 700; letter-spacing: -0.01em; display: flex; gap: 8px; align-items: baseline; }
h2 .count { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 500; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 16px; align-items: start; }
.board { display: grid; grid-template-columns: minmax(0, 1fr); gap: 26px 20px; align-items: start; }
@container board (min-width: 640px) {
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board > section:first-child { grid-column: 1 / -1; }
}
@container board (min-width: 900px) {
  .board { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .board > section:first-child { grid-column: auto; }
}
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.tiles:empty, .col:empty { display: none; }

/* Tiles */
.tile { --kc: var(--call); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 10px; min-width: 0; box-shadow: var(--shadow); }
.tile.decision, .mini.decision, .dialog.kind-decision { --kc: var(--attn); }
.tile.taste, .mini.taste, .dialog.kind-taste { --kc: var(--taste); }
.tile.call, .mini.call, .dialog.kind-call { --kc: var(--call); }
.tile.note, .mini.note, .dialog.kind-note { --kc: var(--muted); }
.tile.staff_request { --kc: var(--taste); }
.tile.staff_request .staff-open { display: inline-flex; align-items: center; min-height: 36px; padding: 6px 16px; text-decoration: none; }
.tile.clickable { cursor: pointer; }
.tile.clickable:hover { border-color: var(--kc); }
.tile.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile.answered { background: var(--wait-bg); box-shadow: none; border-color: var(--wait-line); color: var(--muted); }
.tile.answered .title, .tile.answered .body, .tile.answered .thead { color: var(--muted); }
.tile.answered .bird { filter: grayscale(0.7); opacity: 0.7; }
.wait-pill { font-size: 0.78rem; font-weight: 600; color: var(--muted); background: var(--wait-pill); border-radius: 999px; padding: 2px 10px; }
.thead, .mhead { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 600; color: var(--kc); }
.thead .dot, .mhead .dot { background: var(--kc); }
.src { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.bird { width: 28px; height: 28px; object-fit: contain; flex: none; }
.bird.sm { width: 26px; height: 26px; }
.title { margin: 0; font-size: 1.12rem; font-weight: 700; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.body { margin: 0; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.tfoot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }
.age { font-size: 0.82rem; color: var(--muted); }
.status { font-size: 0.88rem; color: var(--muted); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.status .sent { color: var(--ok); font-weight: 600; }
.status.big { font-size: 0.95rem; padding: 12px 14px; background: var(--ok-soft); border-radius: 10px; }
.status .note-q { font-style: italic; }
.err { color: var(--attn); font-size: 0.85rem; margin: 0; }
.linkbtn { font: inherit; font-size: 0.88rem; font-weight: 600; background: none; border: 0; padding: 4px 0; color: var(--accent); cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }
.linkbtn:disabled { opacity: 0.5; cursor: default; }

/* Buttons */
.btn { font: inherit; font-weight: 600; font-size: 0.92rem; border-radius: 10px; padding: 8px 18px; cursor: pointer; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-fg); min-height: 38px; }
.btn.ink { background: var(--ink); border-color: var(--ink); color: var(--ink-fg); }
.btn.primary { background: var(--attn); border-color: var(--attn); color: #fff; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.go { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); padding: 9px 12px; }
.btn.go:hover:not(:disabled) { border-color: var(--ok); }
.go-label { color: var(--fg); overflow-wrap: anywhere; }
.ico-tick { width: 14px; height: 14px; flex: none; position: relative; }
.ico-tick::after { content: ""; position: absolute; left: 3px; top: 0; width: 5px; height: 10px; border: solid var(--ok); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.btn.fine-quick { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; min-height: 34px; padding: 5px 14px; background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.btn.fine-quick:hover:not(:disabled) { border-color: var(--ok); }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, .dialog:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.optcard:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Agent chats, closed */
.foldbar { gap: 0; }
.foldhead { display: flex; align-items: center; gap: 12px; width: 100%; font: inherit; font-weight: 600; color: var(--fg); background: var(--sunken); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; cursor: pointer; text-align: left; }
.foldhead .count { font-family: var(--font-mono); font-weight: 500; color: var(--muted); }
.chev { width: 8px; height: 8px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(-45deg); margin: 0 4px; transition: transform 0.15s; flex: none; }
.foldhead[aria-expanded="true"] .chev { transform: rotate(45deg); }
.fold-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 8px; margin-top: 10px; }
.fold-item { display: flex; align-items: center; gap: 12px; font-size: 0.9rem; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow-wrap: anywhere; min-width: 0; }
.fold-item .t { font-weight: 600; }
.fold-item .r { color: var(--muted); margin-left: 8px; }
.fold-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fold-main .arrow { color: var(--muted); }
.hand { display: flex; align-items: center; gap: 4px; flex: none; }
.dash { width: 34px; height: 0; border-top: 2px dashed var(--muted); position: relative; opacity: 0.7; }
.dash::after { content: ""; position: absolute; right: -1px; top: -5px; width: 7px; height: 7px; border: solid var(--muted); border-width: 2px 2px 0 0; transform: rotate(45deg); }
.st { font-family: var(--font-mono); font-size: 0.75rem; }
.st.open { color: var(--attn); }
.st.claimed { color: var(--accent); }
.st.answered, .st.closed { color: var(--ok); }
/* Phones: birds and from -> to chips share one row above the title; names truncate, never break. */
@media (max-width: 600px) {
  .fold-item:has(> .hand) { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 6px 8px; padding: 8px 10px; }
  .fold-item:has(> .hand) > .fold-main { display: contents; }
  .fold-item > .hand { grid-row: 1; grid-column: 1; gap: 2px; }
  .fold-item .hand .bird.sm { width: 20px; height: 20px; }
  .fold-item .hand .dash { width: 14px; }
  .fold-item .fold-main > .src { grid-row: 1; grid-column: 2; flex-wrap: wrap; gap: 4px 6px; }
  .fold-item .fold-main > .t { grid-row: 2; grid-column: 1 / -1; overflow-wrap: break-word; }
  .fold-item .fold-main > .rcpt { grid-row: 3; grid-column: 1 / -1; }
  .fold-item .src > * { min-width: 0; max-width: 100%; }
  .fold-item .src > .chip, .fold-item .src > .st { flex: 0 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .fold-item .src > .chip:not(.agtag):not(.pchip) { display: block; }
  .fold-item .chip.agtag .lbl { display: block; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .fold-item .chip.agtag .an { display: none; }
  .fold-item .src .arrow, .fold-item .src .age { flex: none; white-space: nowrap; }
}

.bar { height: 6px; background: var(--sunken); border-radius: 3px; overflow: hidden; flex: 1; min-width: 0; }
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--run); transition: width 0.3s; }
.prog { display: flex; align-items: center; gap: 10px; }

.cnt { font-family: var(--font-mono); font-size: 0.8rem; font-weight: 500; color: var(--muted); white-space: nowrap; }

/* Rail stations */
.station { --s: 84px; position: relative; display: grid; grid-template-columns: var(--s) minmax(0, 1fr); gap: 14px; align-items: center; text-align: left; font: inherit; color: var(--fg); background: transparent; border: 0; border-bottom: 1px solid var(--line); padding: 12px 20px; cursor: pointer; width: 100%; }
.station:hover { background: var(--sunken); }
.station.cos { background: var(--cos-bg); }
.station.cos:hover { background: var(--cos-bg-hover); }
.stage { --s: 84px; position: relative; width: var(--s); height: var(--s); flex: none; }
.station .stage { --s: 84px; }
.stage.lg { --s: 250px; }
.disc { position: absolute; border-radius: 50%; background: var(--disc); }
.disc.big { inset: 12% 8% 4% 6%; }
.disc.small { width: 40%; height: 40%; right: -2%; bottom: -2%; background: var(--disc-small); box-shadow: 0 0 0 2px var(--rail); }
.worker { position: absolute; left: 4%; top: 0; width: 80%; height: 80%; object-fit: contain; }
.critter-slot { position: absolute; right: -2%; bottom: -2%; width: 40%; height: 40%; }
.critter { position: absolute; inset: 0; }
.crit-img { width: 100%; height: 100%; display: block; object-fit: contain; }
.who { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.who-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nm { font-family: var(--font-mono); font-weight: 500; font-size: 0.84rem; overflow-wrap: anywhere; line-height: 1.25; }
.badge { font-size: 0.7rem; color: var(--muted); background: var(--sunken); border-radius: 6px; padding: 1px 8px; font-family: var(--font-mono); white-space: nowrap; }
.station .step { font-size: 0.86rem; color: var(--fg); overflow-wrap: anywhere; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.station.idle .step, .station.quiet .step { color: var(--muted); }
.station.idle .bar i { background: var(--line); }
.station.idle .worker { opacity: 0.9; }
.station.idle .disc.small, .station.nocrit .disc.small { display: none; }
.tick { position: absolute; left: 0; bottom: 4%; width: 22px; height: 22px; border-radius: 50%; background: var(--ok); color: var(--surface); display: none; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 700; }
.station.done .tick { display: flex; }
.alert { position: absolute; right: 2%; top: 4%; width: 13px; height: 13px; border-radius: 50%; background: var(--attn); display: none; border: 2px solid var(--rail); }
.station.blocked .alert { display: block; }
.zzz { position: absolute; left: 66%; top: -4%; font-family: var(--font-mono); font-size: 0.8rem; font-weight: 700; color: var(--muted); display: none; letter-spacing: 1px; }
.station.idle .zzz { display: block; }
.stage.nocrit .disc.small { display: none; }
@media (max-width: 899px) {
  .station { flex: 0 0 236px; --s: 56px; grid-template-columns: var(--s) minmax(0, 1fr); gap: 10px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; scroll-snap-align: start; }
  .station:hover { background: var(--surface); }
  .station .stage { --s: 56px; }
  .station .step { -webkit-line-clamp: 1; line-clamp: 1; font-size: 0.8rem; }
  .tick, .zzz { display: none !important; }
  .tiles { grid-template-columns: minmax(0, 1fr); }
  .fold-list { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: no-preference) {
  .tile { transition: border-color 0.15s, opacity 0.2s; }
  .station.working .worker.work { animation: type 0.5s ease-in-out infinite alternate; }
  .station.working .critter .crit-img { animation: bob 1.6s ease-in-out infinite; }
  .station.idle .worker { animation: breathe 4s ease-in-out infinite; }
  .station.idle .zzz { animation: zzz 3s ease-in-out infinite; }
  .station.blocked.shake .stage { animation: shake 0.5s ease-in-out 1; }
  .critter.enter { animation: walk-in 0.9s ease-out both; }
  .station .critter.enter .crit-img { animation: stepbob 0.3s steps(2, end) 3; }
  .critter.leave { animation: walk-out 0.5s ease-in both; }
  .dialog { animation: pop 0.16s ease-out; }
  .dialog.still { animation: none; }
}
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes type { from { transform: translateY(0); } to { transform: translateY(1.5px) rotate(0.6deg); } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.025); } }
@keyframes zzz { 0%, 100% { opacity: 0.35; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-4px); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-4px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }
@keyframes walk-in { from { transform: translateX(80px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes walk-out { from { transform: translateX(0); opacity: 1; } to { transform: translateX(80px); opacity: 0; } }
@keyframes stepbob { from { transform: translateY(0); } to { transform: translateY(-4px); } }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Images: thumbnails on tiles, grid in the detail modal, full-screen viewer */
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.thumb { width: 76px; height: 56px; padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--sunken); cursor: pointer; flex: none; position: relative; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb:hover { border-color: var(--accent); }
.thumb.plus { font: inherit; font-weight: 700; font-size: 0.95rem; color: var(--muted); }
.imggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.thumb.grid { width: 100%; height: auto; aspect-ratio: 4 / 3; }
.viewer { position: fixed; inset: 0; z-index: 40; background: var(--viewer-bg); }
.vbtn { font: inherit; font-weight: 600; font-size: 0.92rem; min-height: 40px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; }
.vbtn.approve.on { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.vbtn.changes.on { background: var(--attn-soft); border-color: var(--attn); color: var(--attn); }

/* Modals */
.modal, .hmodal { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 5vh 12px; }
.backdrop { position: fixed; inset: 0; background: var(--backdrop); }
.dialog { --kc: var(--call); position: relative; width: 100%; max-width: 760px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-modal); padding: 24px 28px 22px; display: flex; flex-direction: column; gap: 14px; margin: auto 0; }
.dialog.wide { max-width: 820px; }
.dialog.compose-dlg { max-width: 520px; }
.dialog.task-dlg { width: min(720px, 94vw); max-width: 94vw; }
.task-dlg textarea.note { min-height: 240px; }
.dialog.dropping { outline: 3px dashed var(--accent); outline-offset: -3px; }
.dialog.dropping::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--accent); opacity: 0.12; pointer-events: none; }
.close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; cursor: pointer; }
.close:hover { background: var(--sunken); }
.close::before, .close::after { content: ""; position: absolute; left: 10px; top: 17px; width: 16px; height: 2px; background: var(--fg); border-radius: 1px; transform: rotate(45deg); }
.close::after { transform: rotate(-45deg); }
.linkbtn.copylink { position: absolute; top: 14px; right: 56px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--fg); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.linkbtn.copylink:hover { background: var(--sunken); }
.linkbtn.copylink:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.linkbtn.copylink .linkico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.linkbtn.copylink.copied { color: var(--ok); }
.mhead { font-size: 1rem; padding-right: 44px; }
.mhead .dot { width: 14px; height: 14px; }
.mtitle { font-size: 1.7rem; line-height: 1.2; padding-right: 36px; display: block; overflow-wrap: anywhere; }
.context { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1rem; line-height: 1.55; }
.kv { display: flex; align-items: flex-start; gap: 18px; min-width: 0; }
.kv > .k { flex: 0 0 52px; color: var(--muted); font-size: 0.95rem; padding-top: 7px; }
.kv > .v { padding-top: 6px; min-width: 0; overflow-wrap: break-word; }
.kv > .note, .kv > input { flex: 1; min-width: 0; }
.dialog > .kv:first-of-type { }
.options { display: flex; flex-direction: column; gap: 10px; }
.optcard { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; cursor: pointer; }
.optcard:hover { border-color: var(--muted); }
.optcard input { position: absolute; opacity: 0; width: 0; height: 0; }
.radio { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 2px solid var(--muted); position: relative; background: var(--surface); }
.optcard:has(input:checked) { border-color: var(--ok); background: var(--ok-soft); box-shadow: inset 0 0 0 1px var(--ok); }
.optcard input:checked + .radio { border-color: var(--ok); }
.optcard input:checked + .radio::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--ok); }
.otext { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lbl { font-weight: 600; font-size: 1.05rem; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; overflow-wrap: anywhere; }
.rec { font-family: var(--font-mono); font-size: 0.74rem; font-weight: 500; color: var(--ok); background: var(--ok-soft); border: 1px solid var(--ok-line); border-radius: 6px; padding: 0 8px; }
.optcard:has(input:checked) .rec { background: var(--surface); }
.det { font-size: 0.9rem; color: var(--muted); }
textarea, input[type="text"] { font: inherit; font-size: 0.95rem; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; width: 100%; }
textarea { min-height: 42px; resize: none; overflow-y: auto; line-height: 1.45; }
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.links .chip { font-size: 0.88rem; font-family: var(--font-ui); padding: 6px 12px; border: 1px solid var(--line); background: var(--surface); }
.mfoot { display: flex; align-items: center; justify-content: flex-end; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.mfoot .send { min-width: 140px; }
.sub { margin: 6px 0 0; font-size: 1.1rem; }

/* Agent modal */
.ag-top { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: center; }
@media (min-width: 640px) { .ag-top { grid-template-columns: 270px minmax(0, 1fr); gap: 24px; } }
.ag-left { display: flex; justify-content: center; }
.ag-right { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding-right: 30px; align-items: flex-start; }
.stage.lg .disc.small { box-shadow: 0 0 0 3px var(--surface); }
.ag-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.agname { font-family: var(--font-mono); font-weight: 500; font-size: 1.6rem; display: block; overflow-wrap: anywhere; }
.where, .seen { margin: 0; color: var(--muted); font-size: 0.95rem; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px; border-radius: 10px; font-weight: 600; font-size: 0.92rem; background: var(--sunken); }
.pill.working { background: var(--ok-soft); }
.pill.working .dot { background: var(--run); }
.pill.blocked { background: var(--attn-soft); }
.pill.blocked .dot { background: var(--attn); }
.pill.waiting .dot { background: var(--taste); }
.pill.done .dot { background: var(--ok); }
.pill.quiet .dot { background: var(--muted); }
.nowrows { width: 100%; display: flex; flex-direction: column; }
.nowrows .kv { padding: 8px 0; border-top: 1px solid var(--line); gap: 14px; }
.nowrows .kv > .k { flex-basis: 44px; padding-top: 0; color: var(--fg); font-weight: 600; }
.nowrows .kv > .v { padding-top: 0; }
.ag-right .prog { width: 100%; }
.ag-right .bar { height: 10px; border-radius: 5px; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { position: relative; display: flex; align-items: baseline; gap: 12px; padding: 5px 0 5px 34px; min-width: 0; }
.tl-dot { position: absolute; left: 2px; top: 6px; width: 20px; height: 20px; border-radius: 50%; background: var(--ok); }
.tl-dot::after { content: ""; position: absolute; left: 7px; top: 3px; width: 4px; height: 9px; border: solid var(--surface); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.timeline li:not(:last-child)::before { content: ""; position: absolute; left: 11px; top: 26px; bottom: -6px; width: 2px; background: var(--ok-line); }
.tl-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tl-when { color: var(--muted); font-size: 0.88rem; white-space: nowrap; }
.cells { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--sunken); border-radius: 12px; }
.cell { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; min-width: 0; }
.cell + .cell { border-left: 1px solid var(--line); }
.cell .k { font-size: 0.85rem; color: var(--muted); }
.cell .v { overflow-wrap: anywhere; font-size: 0.95rem; }
.cell a { color: var(--accent); }
@media (max-width: 560px) { .cells { grid-template-columns: minmax(0, 1fr); } .cell + .cell { border-left: 0; border-top: 1px solid var(--line); } .dialog { padding: 20px 18px; } .kv { flex-direction: column; gap: 4px; } .kv > .k { padding-top: 0; flex-basis: auto; } }
.posted { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.mini { --kc: var(--call); font: inherit; color: var(--fg); text-align: left; display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; min-width: 0; }
.mini:hover { border-color: var(--kc); }
.mini .title { font-size: 0.95rem; -webkit-line-clamp: 2; line-clamp: 2; }
.mini .thead { font-size: 0.78rem; }
.mini .thead .dot { width: 9px; height: 9px; }

/* Project colours: a class sets --pc, dots and edges read it */
.pc-teal { --pc: var(--p-teal); } .pc-ochre { --pc: var(--p-ochre); } .pc-plum { --pc: var(--p-plum); } .pc-slate { --pc: var(--p-slate); }
.pc-terracotta { --pc: var(--p-terracotta); } .pc-olive { --pc: var(--p-olive); } .pc-sage { --pc: var(--p-sage); } .pc-rose { --pc: var(--p-rose); }
.pc-none { --pc: var(--muted); }
.pdot { width: 10px; height: 10px; border-radius: 50%; background: var(--pc, var(--call)); flex: none; display: inline-block; }
.pchip { border-radius: 999px; padding: 2px 10px 2px 8px; background: var(--surface); border: 1px solid var(--line); font-weight: 600; }
.pfill { background: var(--pc, var(--run)); }
.picon { width: 16px; height: 16px; border-radius: 3px; flex: none; display: inline-block; object-fit: cover; }
.stpr-slot { position: absolute; right: 12px; bottom: 8px; z-index: 1; }
.stpr-slot:empty { display: none; }
.stwrap:has(.stpr-slot:not(:empty)) .station { padding-bottom: 38px; }

/* Top bar menus */
.menu { position: relative; }
.menubtn { font: inherit; color: var(--fg); cursor: pointer; display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 9px 14px 9px 16px; min-height: 44px; }
.menubtn[aria-expanded="true"] { border-color: var(--accent); }
.caret { width: 7px; height: 7px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-2px, -2px); flex: none; margin-left: 4px; }
.person { margin-left: auto; }
.qcount { font-family: var(--font-mono); font-weight: 600; color: var(--muted); }
.qcount:empty { display: none; }
.who-btn { background: transparent; border-color: transparent; box-shadow: none; padding: 4px 8px; }
.who-btn:hover { background: var(--sunken); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--call); color: var(--surface); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.95rem; flex: none; }
.pname-wrap { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; text-align: left; }
.pname-wrap small { color: var(--muted); font-size: 0.8rem; }
.pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 10; min-width: 250px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-modal); padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.pop.right { left: auto; right: 0; min-width: 380px; }
.pop.right .pname { white-space: nowrap; overflow-wrap: normal; }
.prow { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; cursor: pointer; color: var(--fg); text-decoration: none; font-size: 0.95rem; }
.prow:hover { background: var(--sunken); }
.prow input { position: absolute; opacity: 0; width: 0; height: 0; }
.cbx { width: 20px; height: 20px; flex: none; border-radius: 5px; border: 2px solid var(--muted); background: var(--surface); position: relative; }
.prow input:checked + .cbx { background: var(--accent); border-color: var(--accent); }
.prow input:indeterminate + .cbx { background: var(--accent); border-color: var(--accent); }
.prow input:indeterminate + .cbx::after { content: ""; position: absolute; left: 3px; top: 7px; width: 10px; height: 2px; background: var(--accent-fg); }
.prow input:checked + .cbx::after { content: ""; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px; border: solid var(--accent-fg); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.prow:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.pname { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pcount { font-family: var(--font-mono); font-size: 0.85rem; color: var(--muted); }
.alabel { color: var(--muted); }
.psep { height: 1px; background: var(--line); margin: 6px 4px; }
.ico-out { width: 18px; height: 18px; flex: none; border: 2px solid var(--fg); border-right: 0; border-radius: 3px 0 0 3px; position: relative; margin: 0 2px; }
.ico-out::after { content: ""; position: absolute; left: 4px; top: 4px; width: 14px; height: 2px; background: var(--fg); }

/* Rail groups and stations */
.rhead { display: flex; align-items: center; gap: 10px; padding: 14px 22px 6px; font-weight: 600; font-size: 0.95rem; }
.rhead:first-child { padding-top: 4px; }
.runsubs { list-style: none; margin: 0; padding: 4px 20px 12px 46px; display: flex; flex-direction: column; gap: 4px; border-bottom: 1px solid var(--line); font-size: 0.82rem; min-width: 0; }
.runsub { display: flex; flex-wrap: wrap; gap: 2px 8px; min-width: 0; }
.rs-task { color: var(--muted); overflow-wrap: anywhere; }
.rs-more { color: var(--muted); }
/* A station's claimed jobs, under it in the rail: each title opens its card. */
.rj-t { font: inherit; color: var(--muted); background: none; border: 0; padding: 0; text-align: left; cursor: pointer; min-width: 0; display: -webkit-box; -webkit-line-clamp: 1; line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
button.rj-t:hover { color: var(--fg); text-decoration: underline; }
.agjob-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.agjob { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.agjob-t { flex: 1; min-width: 0; font: inherit; color: var(--fg); background: none; border: 0; padding: 0; text-align: left; overflow-wrap: anywhere; }
button.agjob-t { cursor: pointer; }
button.agjob-t:hover { text-decoration: underline; }
.agjob-w { color: var(--muted); font-size: 0.88rem; white-space: nowrap; }
.rname { overflow-wrap: anywhere; }
.step-row { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.sdot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; margin-top: 5px; }
.station.blocked .sdot { background: var(--attn); }
.station.working .sdot { background: var(--run); }
.badge.acct { color: var(--fg); }
.zzz { color: var(--zzz); }
.shead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
@media (max-width: 899px) {
  .rhead { flex: none; align-self: center; padding: 4px 6px 4px 12px; white-space: nowrap; }
  .runsubs { flex: 0 0 auto; max-width: 236px; padding: 6px 10px; border: 0; justify-content: center; }
  .menubtn { padding: 6px 10px; min-height: 40px; }
  .pname-wrap { display: none; }
  .pop.right { min-width: 0; max-width: calc(100vw - 32px); }
  .pop.right .pname { white-space: normal; overflow-wrap: anywhere; }
  .top { gap: 8px; }
}

/* Modal refinements */
.sect { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.slabel { font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.more-context { margin: 0.5rem 0; }
.more-context > summary { cursor: pointer; }
.more-context[open] > summary { margin-bottom: 0.35rem; }
.costrow { display: flex; align-items: baseline; gap: 14px; padding: 9px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.src .age { margin-left: auto; }
.pname-c { color: var(--pc, var(--fg)); font-weight: 600; }
.ag-left { background: var(--sunken); border-radius: 18px; padding: 14px; align-self: stretch; align-items: center; }
.nowbar { width: 100%; display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; }
.nowbar .nowrows { flex: 1; min-width: 0; }
.msgbtn { flex: none; }
.cells { background: transparent; border: 1px solid var(--line); }
.cell .k { font-size: 0.75rem; }
.ag-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
@media (min-width: 700px) { .ag-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.agcard { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.agcard .sub { margin-top: 0; font-size: 1rem; margin-bottom: 6px; }
.agcard .posted { grid-template-columns: minmax(0, 1fr); }

/* Empty states */
.tile.empty { border-style: dashed; background: transparent; box-shadow: none; min-height: 168px; align-items: center; justify-content: center; text-align: center; color: var(--muted); }
.doze { position: relative; width: 72px; height: 72px; }
.doze-img { width: 100%; height: 100%; object-fit: contain; filter: grayscale(0.6); opacity: 0.55; transform: rotate(-6deg) translateY(4px); }
.doze .zzz { display: block; left: 70%; top: -6%; }
.empty-line { margin: 0; font-size: 0.95rem; }

/* Agent modal header */
.ag-head { padding-right: 44px; }
.btn.ghost { background: transparent; border-color: var(--line, currentColor); color: var(--fg); }
.ag-head .msgbtns { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
@media (max-width: 560px) { .ag-head .msgbtns { flex-basis: 100%; margin-left: 0; } }
.foldtoggle { display: flex; align-items: center; gap: 10px; width: 100%; font: inherit; color: var(--fg); background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.foldtoggle .sub { margin: 0; font-size: 1rem; font-weight: 700; }
.foldtoggle[aria-expanded="true"] .chev { transform: rotate(45deg); }
.foldtoggle[aria-expanded="true"] + .posted { margin-top: 10px; }
.ag-cols { align-items: start; }

/* receipt hearts, labelled agents */
.heart { width: 1em; height: 1em; fill: currentColor; flex: none; }
.recv { display: inline-flex; align-items: center; gap: 6px; color: var(--heart); font-weight: 600; }
.rcpt { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--muted); }
.rcpt.seen { color: var(--ok); font-weight: 600; }
.rcpt.seen span { color: var(--fg); font-weight: 500; }
.eye { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.recv span { color: var(--fg); font-weight: 500; }
.heart-badge { position: absolute; left: 0; top: 4%; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); color: var(--heart); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 0.8rem; box-shadow: var(--shadow); }
.heart-inline { display: none; }
.heart-badge .heart { width: 13px; height: 13px; }
.an { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); overflow-wrap: anywhere; line-height: 1.25; }
.nm.labelled { font-family: var(--font-ui); font-weight: 600; font-size: 0.95rem; }
.chip.agtag { gap: 6px; }
.chip.agtag .lbl { font-weight: 600; }
.agnamebox { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0; }
.agname.labelled { font-family: var(--font-ui); font-weight: 700; }
.pencil { width: 28px; height: 28px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; align-self: center; }
.pencil:hover, .pencil:focus-visible { background: var(--sunken); color: var(--fg); }
.pen-ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.mailbtn[aria-pressed="true"] { color: var(--accent); }
.agmail { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0; }
.agmail .err { flex-basis: 100%; }
.aglabel-in.agmail-in { font-size: 0.95rem; font-weight: 400; width: 100%; }
.mailaddr { overflow-wrap: anywhere; }
.aglabel { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0; }
.aglabel .err { flex-basis: 100%; }
.aglabel-in { font: inherit; font-size: 1.3rem; font-weight: 700; color: var(--fg); background: var(--surface); border: 1px solid var(--accent); border-radius: 8px; padding: 4px 10px; min-width: 14ch; max-width: 100%; }
.sent-list { margin-top: 10px; }
@media (prefers-reduced-motion: no-preference) {
  .heart-badge.heart-pop { animation: heartpop 0.45s ease-out both; }
}
@keyframes heartpop { 0% { transform: scale(0.2); opacity: 0; } 70% { transform: scale(1.2); opacity: 1; } 100% { transform: scale(1); } }

/* In flight rail: a right column from 1600px, a drawer below */
.flight { background: var(--rail); border-left: 1px solid var(--line); min-width: 0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.fl-head { position: relative; display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 12px; }
.fl-title { font-size: 1.5rem; }
.fl-close { display: none; top: 16px; right: 14px; }
.fl-scroll { flex: 1; min-width: 0; overflow-x: hidden; overflow-y: auto; padding-bottom: 16px; }
.fl-list { display: flex; flex-direction: column; }
.fl-list:empty { display: none; }
.fl-empty { padding: 12px 22px; color: var(--muted); font-size: 0.9rem; }
.frow { --kc: var(--call); display: flex; flex-direction: column; justify-content: center; gap: 1px; width: 100%; min-height: 60px; text-align: left; font: inherit; color: var(--fg); background: transparent; border: 0; border-bottom: 1px solid var(--line); padding: 6px 18px 6px 22px; cursor: pointer; min-width: 0; }
.frow:hover { background: var(--sunken); }
.frow.decision { --kc: var(--attn); }
.frow.taste { --kc: var(--taste); }
.frow.call { --kc: var(--call); }
.frow.note { --kc: var(--ink); }
.ft { font-size: 0.88rem; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.fs { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--muted); line-height: 1.3; min-width: 0; white-space: nowrap; }
.fwho { overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 0; }
.fwho::after { content: " \b7"; }
.fstate { flex: none; }
.fs .fstate.note { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.fstate.recv { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.fstate.recv span { color: var(--muted); font-weight: 500; }
.fl-done { padding: 10px 14px 0; }
.fl-done .foldhead { padding: 8px 12px; border-radius: 10px; }
.fl-done .fl-list { margin-top: 6px; margin-left: -14px; margin-right: -14px; }
.fl-back { position: fixed; inset: 0; z-index: 14; background: var(--backdrop); }
/* Bot capacity: one card per busy bot lane, active jobs then the queue */
.fl-title { margin-right: auto; }
.cap-menu { position: relative; flex: none; }
.capbtn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.capbtn:hover, .capbtn[aria-expanded="true"] { background: var(--sunken); color: var(--fg); }
.cap-ico, .nx-ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.cap-ico circle { fill: var(--z-flight); }
.cap-pop { left: auto; right: 0; min-width: 250px; padding: 10px; }
.cap-form { display: flex; flex-direction: column; gap: 8px; max-height: 70vh; overflow-y: auto; }
.caprow { display: grid; grid-template-columns: minmax(0, 1fr) 72px 38px; gap: 8px; }
.cap-credit { width: 38px; min-height: 38px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); cursor: pointer; display: grid; place-items: center; padding: 0; }
.cap-credit svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.cap-credit[aria-pressed="true"] { background: var(--sunken); color: var(--fg); border-color: var(--fg); }
.caprow input { font: inherit; font-size: 0.92rem; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-width: 0; min-height: 38px; }
.caprow input:focus { border-color: var(--accent); }
.cap-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 2px; }
.cap { display: flex; flex-direction: column; gap: 10px; padding: 0 14px 12px; }
.cap:empty { display: none; }
.cap, .fl-list { min-width: 0; }
.cap, #flight-list { max-width: 100%; }
.cap-pool { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.cap-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 9px 12px; min-width: 0; }
.cap-name { margin: 0; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; max-width: 100%; }
.cap-meter { display: flex; gap: 3px; flex: none; }
.cap-meter .slot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--run); }
.cap-meter .slot.on { background: var(--run); }
.cap-nums { margin-left: auto; max-width: 100%; display: flex; gap: 10px; flex: none; font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.cap-act.full { color: var(--attn); font-weight: 600; }
.cap-q { color: var(--fg); font-weight: 600; }
.cap-list .frow { min-height: 52px; padding: 6px 12px; border-bottom: 0; border-top: 1px solid var(--line); }
.cap-list div.frow { cursor: default; }
.jobwrap { position: relative; }
.jobwrap.queued .frow { padding-right: 52px; }
.jobwrap.queued .ft { color: var(--muted); }
.fstate.next { color: var(--run); font-weight: 600; }
.nextbtn { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.nextbtn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.nextbtn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.nextbtn:disabled { opacity: 0.5; cursor: default; }
@media (max-width: 1599px) { .cap-menu { margin-right: 40px; } }

.flight-btn { display: none; }
@media (min-width: 1600px) {
  .layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .fl-back { display: none !important; }
}
@media (max-width: 1599px) {
  .flight-btn { display: flex; }
  .flight { display: none; position: fixed; top: 0; right: 0; bottom: 0; height: auto; width: min(340px, 100vw); z-index: 15; box-shadow: var(--shadow-modal); }
  .flight.open { display: flex; }
  .fl-close { display: block; }
}
@media (max-width: 560px) { .flight { width: 100vw; } }

/* Grouping by tinted panels, no coloured edges */
.rail { background: transparent; }
.main { background: var(--z-main); }
.flight { background: var(--z-flight); }
.board > section { border-radius: 16px; padding: 14px 14px 16px; }
.board > section:nth-child(1) { background: var(--t-attn); }
.board > section:nth-child(2) { background: var(--t-taste); }
.board > section:nth-child(3) { background: var(--t-call); }
.preset-board > section.k-decision, .preset-board > section.k-request { background: var(--t-attn); }
.preset-board > section.k-taste { background: var(--t-taste); }
.preset-board > section.k-call { background: var(--t-call); }
@container board (min-width: 640px) { .preset-board > section:first-child { grid-column: auto; } }
@container board (min-width: 900px) { .preset-board { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); } }
.pop button.prow { font: inherit; background: none; border: 0; text-align: left; width: 100%; }
.pop button.prow:hover { background: var(--sunken); }
.pop button.preset-row[aria-pressed="true"] { font-weight: 700; background: var(--sunken); }
.gh-list { display: flex; flex-direction: column; gap: 2px; max-height: 40vh; overflow-y: auto; }
.gh-list .prow input:disabled + .cbx { opacity: 0.6; }
.tile.empty { background: transparent; }
.fr { display: flex; align-items: center; gap: 5px; font-size: 0.75rem; color: var(--muted); line-height: 1.3; min-width: 0; white-space: nowrap; }
.frbird { width: 20px; height: 20px; object-fit: contain; flex: none; }
.frcrit { width: 16px; height: 16px; object-fit: contain; flex: none; }
.fr .fwho { flex: 0 1 auto; }
.fr .fwho::after { content: none; }
.frt { flex: none; }
.frt::before { content: "\b7"; margin-right: 5px; }

/* Chief of staff star */
.stwrap { position: relative; }
.cosbtn { position: absolute; right: 10px; top: 8px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; opacity: 0; }
.cosbtn.lg { position: static; width: 34px; height: 34px; opacity: 1; align-self: center; }
.stwrap:hover .cosbtn, .cosbtn:focus-visible, .cosbtn[aria-pressed="true"] { opacity: 1; }
.cosbtn:hover, .cosbtn:focus-visible { background: var(--sunken); color: var(--fg); }
.star { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.cosbtn.lg .star { width: 22px; height: 22px; }
.cosbtn[aria-pressed="true"] { color: var(--gold); }
.cosbtn[aria-pressed="true"] .star, .cosmark .star { fill: var(--gold); stroke: var(--gold); }
.cosmark { display: inline-flex; align-items: center; margin-right: 4px; vertical-align: middle; flex: none; }
.cosmark .star { width: 13px; height: 13px; }
.cos-head .cosmark .star { width: 16px; height: 16px; }
@media (max-width: 899px) {
  .stwrap { flex: 0 0 236px; scroll-snap-align: start; }
  .stwrap .station { width: 100%; }
  .cosbtn { opacity: 1; }
}
.cosbtn.shared[aria-pressed="true"] { color: var(--muted); opacity: 1; }
.cosbtn.shared[aria-pressed="true"] .star { fill: var(--muted); stroke: var(--muted); }

/* Sub-agent teams: the bird of an agent with a team toggles a nested list of smaller birds */
.teambtn { --s: 84px; position: absolute; left: 20px; top: calc(50% - var(--s) / 2); width: var(--s); height: var(--s); padding: 0; border: 0; border-radius: 14px; background: transparent; cursor: pointer; z-index: 1; }
.teambtn:hover { background: color-mix(in srgb, var(--fg) 6%, transparent); }
.teampill { position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 0.7rem; font-weight: 600; line-height: 1.5; white-space: nowrap; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; box-shadow: var(--shadow); }
.teampill .chev { width: 6px; height: 6px; margin: 0 0 3px 0; border-color: currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.teambtn[aria-expanded="true"] .teampill { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.teambtn[aria-expanded="true"] .chev { transform: rotate(-135deg); margin: 3px 0 0 0; }
.stwrap.teamopen .station { border-bottom-color: transparent; }
.team { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 10px 10px 12px 26px; border-bottom: 1px solid var(--line); }
.team[hidden] { display: none !important; }
.team::before { content: ""; position: absolute; left: 31px; top: 0; bottom: 34px; border-left: 2px dotted var(--line); }
.tmate { position: relative; display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 10px; align-items: center; padding: 6px 8px 6px 16px; border-radius: 10px; min-width: 0; }
.tmate::before { content: ""; position: absolute; left: 6px; top: 50%; width: 9px; border-top: 2px dotted var(--line); }
.tmate:hover { background: var(--sunken); }
.tm-stage { position: relative; width: 42px; height: 42px; }
.tm-stage .disc.big { inset: 12% 8% 4% 6%; }
.tm-stage .worker { left: 4%; width: 84%; height: 84%; }
.tm-crit { position: absolute; right: -6px; bottom: -4px; width: 20px; height: 20px; object-fit: contain; }
.tm-who { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tm-top { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.tm-nm { flex: 1 1 auto; min-width: 0; font-family: var(--font-mono); font-weight: 600; font-size: 0.78rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-age { flex: none; font-size: 0.72rem; color: var(--muted); white-space: nowrap; }
.tmate .step { font-size: 0.8rem; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tmate .sdot { width: 8px; height: 8px; margin-top: 4px; }
.tmate.working .sdot { background: var(--run); }
.tmate.blocked .sdot { background: var(--attn); }
.tmate.idle .step, .tmate.idle .tm-nm, .tmate.quiet .step { color: var(--muted); }
.tm-meta { display: flex; flex-wrap: wrap; gap: 4px; }
.tm-meta .chip { font-size: 0.7rem; padding: 0 7px; }
.tm-meta .tm-st { color: var(--muted); }
.tmate.blocked .tm-st { color: var(--attn); }
.tmate .prog { gap: 8px; }
.tmate .bar { height: 4px; }
.tmate .cnt { font-size: 0.72rem; }
@media (prefers-reduced-motion: no-preference) {
  .tmate.working .worker.work { animation: type 0.5s ease-in-out infinite alternate; }
  .tmate.idle .worker { animation: breathe 4s ease-in-out infinite; }
}
@media (max-width: 899px) {
  .teambtn { --s: 56px; left: 12px; }
  .team { flex: none; flex-direction: row; align-items: stretch; gap: 8px; padding: 0; border: 0; }
  .team::before, .tmate::before { display: none; }
  .tmate { flex: 0 0 210px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; scroll-snap-align: start; }
  .tmate:hover { background: var(--surface); }
  .stwrap.teamopen .station { border-bottom-color: var(--line); }
}
body.phone .team { flex-direction: column; padding: 0 0 0 28px; }
body.phone .tmate { flex: none; }

/* between-agents thread */
.fold-item.clickable { cursor: pointer; }
.fold-item.clickable:hover { border-color: var(--accent); }
.bird.xs { width: 20px; height: 20px; }
.thread { display: flex; flex-direction: column; gap: 12px; max-height: 58vh; overflow-y: auto; padding: 4px 2px; min-width: 0; }
.tmsg { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.tmsg .tbody { background: var(--sunken); border-radius: 12px; padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; max-width: 100%; }
.tmsg.reply { flex-direction: row-reverse; }
.tmsg.reply .tbody { background: var(--ok-soft); border: 1px solid var(--ok-line); }
.tmsg .thd { display: flex; gap: 10px; align-items: baseline; font-size: 0.85rem; }
.tmsg .choice { margin: 0; font-weight: 600; }
.tevent { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--muted); padding-left: 4px; }
.tclosed { display: flex; gap: 10px; align-items: baseline; font-weight: 600; font-size: 0.9rem; border-top: 1px solid var(--line); padding-top: 10px; }


/* Markdown text: long words wrap, code scrolls inside its own box */
.md { min-width: 0; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 0.6em; }
.md ul, .md ol { margin: 0 0 0.6em; padding-left: 1.4em; }
.md li { margin: 0.1em 0; }
.md p.md-h { margin-top: 0.8em; }
.md code { font-family: var(--font-mono); font-size: 0.9em; background: var(--sunken); border-radius: 4px; padding: 0 4px; }
.md pre { margin: 0 0 0.6em; padding: 8px 10px; background: var(--sunken); border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; max-width: 100%; overflow-wrap: normal; }
.md pre code { background: transparent; padding: 0; white-space: pre; font-size: 0.85em; }
.md a { color: var(--accent); text-decoration: underline; overflow-wrap: anywhere; }
.md.context { white-space: normal; }
.md.body p { margin-bottom: 0.2em; }
.md.body pre { max-height: 4.5em; overflow-y: hidden; }
.note-q { overflow-wrap: anywhere; }
.note-q code { font-family: var(--font-mono); font-size: 0.9em; }

/* Compose: agent avatar beside To, pasted image thumbnails */
.to-wrap { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.to-wrap input { flex: 1; min-width: 0; }
.to-av .stage { --s: 56px; }
.ntools { display: flex; justify-content: flex-start; margin-top: -6px; }
.addpic .star { width: 20px; height: 20px; }
.pics { display: flex; flex-wrap: wrap; gap: 8px; }
.pic { position: relative; width: 84px; height: 62px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--sunken); }
.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pic-x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--backdrop); cursor: pointer; padding: 0; }
.pic-x::before, .pic-x::after { content: ""; position: absolute; left: 5px; top: 10px; width: 12px; height: 2px; background: var(--accent-fg); transform: rotate(45deg); }
.pic-x::after { transform: rotate(-45deg); }
.pic-x:hover, .pic-x:focus-visible { outline: 2px solid var(--accent); }
/* The image button sits at the left of an answer's or a comment's footer, Send at the right. */
.mfoot .addpic { margin-right: auto; }
.v-sheet.dropping, .tcomment.dropping { outline: 3px dashed var(--accent); outline-offset: -3px; }
.ans-thumbs { margin-top: 2px; }

/* Thumbnails under an In flight row */
.frwrap { border-bottom: 1px solid var(--line); }
.frwrap .frow { border-bottom: 0; }
.fthumbs { padding: 0 18px 8px 22px; }

/* needs-you rail inside the open item's card */
.railframe { position: relative; display: flex; align-items: stretch; width: min(1200px, 94vw); height: 88vh; margin: auto 0; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-modal); overflow: hidden; }
.railframe .dialog { flex: 1 1 auto; min-width: 0; width: auto; max-width: none; margin: 0; height: 100%; overflow-y: auto; background: transparent; box-shadow: none; border-radius: 0; padding-inline: max(28px, calc((100% - 760px) / 2)); }
.needsrail { flex: 0 0 300px; width: 300px; display: flex; flex-direction: column; overflow-y: auto; background: var(--rail); border-right: 1px solid var(--line); }
.ntabs { display: flex; position: sticky; top: 0; z-index: 1; background: var(--rail); border-bottom: 1px solid var(--line); }
.ntab { --kc: var(--attn); flex: 1 1 auto; display: flex; align-items: center; justify-content: center; gap: 5px; font: inherit; font-size: 0.82rem; font-weight: 600; color: var(--muted); background: transparent; border: 0; border-bottom: 3px solid transparent; padding: 13px 6px 10px; cursor: pointer; white-space: nowrap; }
.ntab.taste { --kc: var(--taste); }
.ntab.call { --kc: var(--call); }
.ntab:hover { color: var(--fg); }
.ntab.on { color: var(--fg); border-bottom-color: var(--kc); }
.ntab .count { font-family: var(--font-mono); font-weight: 500; font-size: 0.78rem; color: var(--muted); }
.nhd { padding: 16px 16px 10px; font-size: 0.95rem; font-weight: 700; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--rail); }
.nhd .count { font-family: var(--font-mono); font-weight: 500; color: var(--muted); }
.nrow { --kc: var(--attn); display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; font: inherit; color: var(--fg); background: transparent; border: 0; border-bottom: 1px solid var(--line); padding: 10px 14px; cursor: pointer; min-width: 0; }
.nrow:hover { background: var(--sunken); }
.nrow.taste { --kc: var(--taste); }
.nrow.call { --kc: var(--call); }
.nrow.current { background: color-mix(in srgb, var(--kc) 20%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--kc) 45%, var(--line)); }
.nrow .nhead { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; font-weight: 600; color: var(--kc); }
.nrow .nhead .dot { background: var(--kc); width: 8px; height: 8px; }
.nrow .nhead .age { margin-left: auto; font-weight: 400; font-size: 0.75rem; }
@media (max-width: 899px) {
  .needsrail { display: none; }
  .railframe { width: 100%; max-width: 760px; height: auto; overflow: visible; }
  .railframe .dialog { height: auto; overflow: visible; padding-inline: 28px; }
}

/* Phone layout (below 600px): top bar, menu drawer, one list, agents folded. Desktop and tablet never see these. */
.mmenubtn, .mdrawer, .mback { display: none; }
body.phone { --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px); }
body.phone .mmenubtn { display: flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; padding: 0; background: transparent; border: 0; cursor: pointer; color: var(--fg); }
.ham, .ham::before, .ham::after { display: block; width: 24px; height: 2px; background: var(--fg); border-radius: 1px; position: relative; }
.ham::before, .ham::after { content: ""; position: absolute; left: 0; }
.ham::before { top: -7px; }
.ham::after { top: 7px; }
body.phone .main { padding: 4px calc(var(--safe-r) + 16px) calc(var(--safe-b) + 40px) calc(var(--safe-l) + 16px); }
body.phone .content { gap: 18px; }
body.phone .top { display: none; }
body.phone .board { gap: 18px; }
body.phone .board > section { padding: 12px; border-radius: 16px; }
body.phone .board h2 { font-size: 1.25rem; }
body.phone .board > section:has(.col > .tile.empty), body.phone .board > section.tabhide { display: none; }
.ptabs { display: none; }
body.phone .ptabs { display: flex; gap: 8px; margin: 0 0 14px; }
body.phone .ptabs[hidden] { display: none; }
body.phone .ptab { flex: 1 1 0; min-width: 0; min-height: 48px; padding: 8px 6px; font: inherit; font-size: 0.95rem; font-weight: 600; color: var(--muted); background: var(--sunken); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
body.phone .ptab[hidden] { display: none; }
body.phone .ptab .pn { font-family: var(--font-mono); font-weight: 500; }
body.phone .ptab[aria-selected="true"] { color: var(--accent-fg); background: var(--accent); border-color: var(--accent); }
body.phone .ptab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body.phone .tile { padding: 14px; gap: 12px; border-radius: 14px; }
body.phone .tile .title { font-size: 1.15rem; -webkit-line-clamp: 3; line-clamp: 3; }
body.phone .tile .bird { width: 36px; height: 36px; }
body.phone .tile .more { display: none; }
body.phone .tfoot { justify-content: flex-start; }
body.phone .btn.fine-quick { min-height: 44px; padding: 8px 18px; font-size: 1rem; }
body.phone .mopts { display: flex; flex-direction: column; gap: 10px; }
body.phone .mopt { display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; min-height: 52px; padding: 10px 14px; text-align: left; font-size: 1rem; background: var(--sunken); border-color: var(--line); color: var(--fg); }
body.phone .mopt.go { background: var(--ok-soft); border-color: var(--ok-line); }
body.phone .mopt.review { background: var(--t-taste); border-color: var(--taste); color: var(--taste); justify-content: center; }
body.phone .mopt.review .go-label { color: var(--taste); }

body.phone .foldhead { min-height: 52px; }
body.phone .rail { flex-direction: column; overflow: visible; padding: 0; gap: 10px; scroll-snap-type: none; }
body.phone .stwrap, body.phone .rail .station { flex: none; width: 100%; }
body.phone #between-wrap, body.phone .md-body > section { margin: 0; }

body.phone .mback { display: block; position: fixed; inset: 0; z-index: 30; background: var(--backdrop); }
body.phone .mback[hidden] { display: none; }
body.phone .mdrawer { display: flex; flex-direction: column; position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 92vw); z-index: 31; background: var(--bg); border-left: 1px solid var(--line); box-shadow: var(--shadow-modal); padding-top: var(--safe-t); padding-bottom: var(--safe-b); }
body.phone .mdrawer[hidden] { display: none; }
body.phone .md-head { position: relative; display: flex; align-items: center; min-height: 60px; padding: 0 16px; font-size: 1.2rem; }
body.phone .md-head .close { top: 12px; right: 8px; width: 44px; height: 44px; }
body.phone .md-head .close::before, body.phone .md-head .close::after { left: 14px; top: 21px; }
body.phone .md-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 4px 16px 24px; }
body.phone .md-body .menu { width: 100%; }
body.phone .md-body .menubtn { width: 100%; min-height: 48px; justify-content: space-between; }
body.phone .md-body .pname-wrap { display: flex; flex-direction: column; margin-right: auto; }
body.phone .md-body .pop, body.phone .md-body .pop.right { position: static; min-width: 0; max-width: none; margin-top: 6px; box-shadow: none; }
body.phone .md-body .prow { min-height: 44px; }
body.phone .flight-btn { display: none; }
body.phone .md-body .flight-fold { margin-top: 10px; }
body.phone #flight-wrap { position: relative; }
body.phone #flight-wrap .cap-menu { position: absolute; top: 4px; right: 8px; margin-right: 0; z-index: 2; }
body.phone #flight-wrap .foldhead { padding-right: 64px; }
body.phone .md-body .pop.cap-pop { position: absolute; top: calc(100% + 6px); left: auto; right: 0; margin-top: 0; min-width: 250px; box-shadow: var(--shadow-modal); }
body.phone .md-body .cap, body.phone .md-body .fl-done { padding-left: 0; padding-right: 0; }
body.phone .md-body .fl-done .fl-list { margin-left: 0; margin-right: 0; }
body.phone .tile .src { flex-wrap: nowrap; }
body.phone .tile .src .bird { width: 32px; height: 32px; }
body.phone .tile .src .agtag { flex: 0 1 auto; min-width: 0; flex-wrap: wrap; }
body.phone .mtxt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
body.phone .mdet { font-size: 0.82rem; font-weight: 400; color: var(--muted); overflow-wrap: anywhere; }
body.phone .mexcerpt { font-size: 0.95rem; }

/* Theme control: System / Light / Dark. A cycle button (treatment A) or a 3-segment group (B). */
.themectl { display: flex; align-items: center; }
.themectl .tbtn { font: inherit; color: var(--fg); cursor: pointer; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.themectl .tbtn:hover { background: var(--sunken); }
.themectl .tbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.themectl .tico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.themectl .tseg { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 3px; gap: 0; }
.themectl .tseg .tbtn { width: 32px; height: 36px; border: 0; border-radius: 9px; box-shadow: none; background: transparent; color: var(--muted); }
.themectl .tseg .tbtn:hover { background: var(--sunken); color: var(--fg); }
.themectl .tseg .tbtn[aria-checked="true"] { background: var(--ink); color: var(--ink-fg); }

/* Saving: a card or dialog whose answer is being saved sits under a spinner. */
.tile.saving { position: relative; }
/* A staff request's product (products.js): a letter mark (placeholder until real product icons) and a chip. */
.pmark { --pm: var(--p-teal); display: inline-flex; align-items: center; justify-content: center; flex: none; width: 16px; height: 16px; border-radius: 4px; background: var(--pm); color: var(--surface); font-size: 0.66rem; font-weight: 800; line-height: 1; }
.pmark.p-mypymble { --pm: var(--accent); }
.pmark.p-other { --pm: var(--p-slate); }
.pmark.lg { width: 30px; height: 30px; border-radius: 8px; font-size: 1rem; }
.pchip { display: inline-flex; align-items: center; gap: 5px; flex: none; font-size: 0.74rem; font-weight: 600; line-height: 1.5; color: var(--muted); background: var(--sunken); border-radius: 999px; padding: 1px 8px 1px 3px; white-space: nowrap; max-width: 100%; }
.pchip .pmark { width: 14px; height: 14px; font-size: 0.6rem; }
.saving-veil { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; background: var(--veil); border-radius: inherit; cursor: progress; }
.saving-anim { width: 96px; height: 96px; display: flex; align-items: center; justify-content: center; }
.saving-anim.has-anim .saving-ring { display: none; }
.saving-anim svg { display: block; }
.saving-ring { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); }
.tile.saving { box-shadow: none; }
@media (prefers-reduced-motion: no-preference) {
  .saving-ring { animation: saving-turn 0.8s linear infinite; }
  .saving-veil { animation: saving-in 0.12s ease-out; }
}
@keyframes saving-turn { to { transform: rotate(360deg); } }
@keyframes saving-in { from { opacity: 0; } to { opacity: 1; } }
.dialog .saving-anim { width: 128px; height: 128px; }

/* Job thread: the owner's comments and the box to add one. */
.tmsg.mine { flex-direction: row-reverse; }
.tmsg.comment .tbody { background: var(--surface); border: 1px solid var(--accent); }
.avatar.sm { width: 30px; height: 30px; font-size: 0.75rem; }
.trecv { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--muted); }
.trecv.recv { font-weight: 600; }
.trecv.recv span { color: var(--muted); font-weight: 500; }
.tcomment { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.fcomments { display: inline-flex; align-items: center; gap: 3px; flex: none; }
.cm-ico { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }

/* Waiting for you: a bell beside the brand with the count of items not yet settled. */
.pendbtn { position: relative; flex: none; margin-right: 8px; display: flex; align-items: center; gap: 4px; min-width: 44px; height: 44px; padding: 0 8px; font: inherit; color: var(--fg); background: transparent; border: 0; border-radius: 22px; cursor: pointer; }
.pendbtn:hover { background: var(--sunken); }
.pendbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pend-ico { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.pend-n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 0.75rem; font-weight: 700; line-height: 1; color: var(--accent-fg); background: var(--attn); }
.dialog.pend-dlg { max-width: 560px; padding: 22px 0 10px; gap: 10px; }
.pend-title { margin: 0; padding: 0 64px 0 22px; display: flex; align-items: baseline; gap: 8px; }
.pend-title .count { font-family: var(--font-mono); font-size: 0.9rem; font-weight: 500; color: var(--muted); }
.pend-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.pend-list .nrow { padding: 12px 18px 12px 22px; min-height: 64px; }
.pend-list .nrow:last-child { border-bottom: 0; }
.pend-list .nrow .ft { font-weight: 600; overflow-wrap: anywhere; }
.pend-list .nrow .fs { font-size: 0.82rem; color: var(--muted); overflow-wrap: anywhere; }

/* Agent contact: consent card and the who-can-chat dialog */
.tile.consent_request .consent-meta, .tile.staff_request .consent-meta { margin: 0; color: var(--muted); font-size: 0.9rem; }
.consent-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.consent-btns .btn { flex: 1 1 120px; justify-content: center; text-align: center; min-height: 44px; }
.contact-dlg .contact-ind { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.contact-dlg .contact-ind[hidden], .contact-dlg input[hidden] { display: none; }
.contact-dlg .contact-ind { flex-direction: column; flex-wrap: nowrap; }
.contact-dlg .pick-row { display: flex; flex-wrap: wrap; gap: 10px; }
.contact-dlg .pick-row input { flex: 1 1 220px; width: auto; }
.contact-dlg .pick-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.contact-dlg .pick-chip { font-size: 0.88rem; padding: 4px 4px 4px 10px; gap: 4px; }
.contact-dlg .pick-x { border: 0; background: transparent; color: var(--fg); font-size: 1.1rem; line-height: 1; min-width: 44px; min-height: 44px; margin: -8px 0; border-radius: 6px; cursor: pointer; }
.contact-dlg .pick-x:hover { background: var(--line); }
.contact-dlg .pick-found { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; }
.contact-dlg .pick-found[hidden], .contact-dlg .pick-chips[hidden] { display: none; }
.contact-dlg .pick-opt { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 8px 12px; min-height: 44px; border: 0; background: transparent; color: var(--fg); text-align: left; cursor: pointer; font: inherit; }
.contact-dlg .pick-opt:hover, .contact-dlg .pick-opt:focus-visible { background: var(--sunken); }
.contact-dlg .pick-sub { font-size: 0.8rem; color: var(--muted, var(--fg)); opacity: 0.7; }
.contact-dlg .otext { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.contact-dlg .otext .sub { font-size: 0.82rem; color: var(--muted); }
.contact-dlg .faces { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.contact-dlg .face { width: 32px; height: 32px; min-width: 32px; padding: 0; border: 0; cursor: pointer; font-size: 0.7rem; }
.contact-dlg .face::after { content: ""; position: absolute; inset: -6px; }
.contact-dlg .face { position: relative; }
.contact-dlg .faces .more { font-size: 0.8rem; color: var(--muted); }
.contact-dlg .reach { display: block; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.contact-dlg .reach .fill { display: block; height: 100%; background: var(--fg); border-radius: 2px; transition: width 0.2s; }
.contact-dlg .effect { margin: 12px 0 0; font-size: 0.92rem; }
.contact-dlg .effect[hidden] { display: none; }
.contact-dlg .pick-sugg { margin-top: 2px; }
.contact-dlg .pick-sugg[hidden] { display: none; }
.contact-dlg .pick-add { cursor: pointer; min-height: 44px; font: inherit; font-size: 0.88rem; border: 1px solid var(--line); background: transparent; color: var(--fg); }
.contact-dlg .preview { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.contact-dlg .preview input[hidden] { display: none; }
.contact-dlg .linkbtn { align-self: flex-start; border: 0; background: transparent; color: var(--fg); text-decoration: underline; cursor: pointer; font: inherit; min-height: 44px; padding: 0; }
.contact-sub { font-size: 0.95rem; margin: 18px 0 6px; }
.grant-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.grant-name { min-width: 0; overflow-wrap: anywhere; }
.prow.contactrow { width: 100%; border: 0; background: transparent; font: inherit; text-align: left; }
.fprs { padding: 0 18px 8px 22px; margin: 0; }

/* The image viewer and the compare view: the picture owns the screen; one thin strip holds where you
   are, the tick, Send, zoom and close. Answer forms fold away into a sheet over the picture. */
:root { --viewer-fg: #f4efe6; --viewer-ink: #231f1a; --viewer-chip: rgba(255, 255, 255, 0.14); --viewer-chip-hi: rgba(255, 255, 255, 0.28); --viewer-line: rgba(255, 255, 255, 0.32); }
.v-box, .cmp-box { height: 100%; display: flex; flex-direction: column; min-height: 0; color: var(--viewer-fg); }
.v-box:focus, .cmp-box:focus { outline: none; }
.v-top { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 5px 8px 5px 14px; color: var(--viewer-fg); }
.v-where { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex: 1 1 auto; overflow: hidden; white-space: nowrap; }
.v-count { font-size: 0.9rem; font-weight: 700; flex: none; }
.v-cap { font-size: 0.88rem; opacity: 0.8; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.v-tools { display: flex; align-items: center; gap: 6px; flex: 0 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.v-tools::-webkit-scrollbar { display: none; }
.v-tool { flex: none; white-space: nowrap; min-width: 38px; height: 36px; padding: 0 10px; border: 0; border-radius: 18px; background: var(--viewer-chip); color: var(--viewer-fg); font: inherit; font-weight: 600; cursor: pointer; }
.v-tool:hover, .v-tool.on { background: var(--viewer-chip-hi); }
.v-wide { padding: 0 14px; }
.v-close { flex: none; position: relative; width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; cursor: pointer; }
.v-close:hover { background: var(--viewer-chip); }
.v-close::before, .v-close::after { content: ""; position: absolute; left: 11px; top: 18px; width: 16px; height: 2px; background: var(--viewer-fg); border-radius: 1px; transform: rotate(45deg); }
.v-close::after { transform: rotate(-45deg); }
.v-tick { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px 0 10px; border: 1px solid var(--viewer-line); border-radius: 18px; background: transparent; color: var(--viewer-fg); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.v-tick .ico-tick { opacity: 0.35; }
.v-tick:hover { background: var(--viewer-chip); }
.v-tick.on { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.v-tick.on .ico-tick { opacity: 1; }
.v-tick:disabled { cursor: default; opacity: 0.6; }
.v-send { flex: none; height: 36px; min-height: 36px; padding: 0 16px; white-space: nowrap; }
.v-err { color: var(--viewer-fg); font-size: 0.85rem; }
.v-main { position: relative; flex: 1; min-height: 0; display: flex; }
.v-stage { position: relative; flex: 1; min-width: 0; min-height: 0; overflow: hidden; touch-action: none; cursor: zoom-in; }
.v-stage.zoomed { cursor: grab; }
.v-img { display: block; width: 100%; height: 100%; object-fit: contain; transform-origin: center; user-select: none; }
.v-nav { position: absolute; top: 50%; width: 44px; height: 44px; margin-top: -22px; border-radius: 50%; border: 0; background: var(--viewer-chip); cursor: pointer; opacity: 0.55; transition: opacity 0.15s; }
.v-stage:hover .v-nav, .v-nav:focus-visible { opacity: 1; }
.v-nav:hover { background: var(--viewer-chip-hi); }
.v-nav.prev { left: 8px; }
.v-nav.next { right: 8px; }
.v-nav::after { content: ""; position: absolute; top: 15px; width: 12px; height: 12px; border: solid var(--viewer-fg); border-width: 0 0 3px 3px; }
.v-nav.prev::after { left: 17px; transform: rotate(45deg); }
.v-nav.next::after { left: 13px; transform: rotate(-135deg); }
.v-rail { flex: none; width: 84px; display: flex; flex-direction: column; gap: 6px; padding: 0 6px 8px 8px; overflow-y: auto; scrollbar-width: thin; }
.v-rthumb { width: 100%; height: auto; aspect-ratio: 4 / 3; border-width: 2px; opacity: 0.7; }
.v-rthumb img { object-fit: contain; }
.v-rthumb.on { border-color: var(--viewer-fg); opacity: 1; }
.v-rthumb.picked { border-color: var(--ok-line); }
.v-rtick { position: absolute; right: 3px; bottom: 3px; padding: 2px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); }
.v-sheet { position: absolute; right: 12px; bottom: 12px; z-index: 2; width: min(440px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow-y: auto; cursor: auto; touch-action: auto;
  display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: 14px; background: var(--surface); color: var(--fg); box-shadow: var(--shadow-modal); }
.v-sheet .options { gap: 6px; }
.v-verdicts { display: flex; flex-wrap: wrap; gap: 8px; }
.compare { z-index: 39; }
.cmp-send { display: flex; align-items: center; gap: 8px; flex: 0 1 auto; min-width: 0; }
.cmp-send .note { width: clamp(160px, 28vw, 420px); height: 36px; min-height: 36px; padding: 7px 12px; resize: none; }
.cmp-send .send { height: 36px; min-height: 36px; padding: 0 16px; white-space: nowrap; }
.cmp-send .err { color: var(--viewer-fg); font-size: 0.85rem; }
.cmp-grid { flex: 1; min-height: 0; display: grid; grid-auto-rows: minmax(0, 1fr); gap: 10px; padding: 0 10px 10px; }
.cmp-col { position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0; min-height: 0; padding: 6px; border-radius: 12px; border: 2px solid transparent; background: var(--viewer-chip); }
.cmp-col.focus { border-color: var(--viewer-chip); }
.cmp-col.picked { border-color: var(--ok-line); }
.cmp-head { flex: none; display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.cmp-head::-webkit-scrollbar { display: none; }
.cmp-letter { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--viewer-fg); color: var(--viewer-ink); font-weight: 700; flex: none; }
.cmp-label { font-weight: 700; min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: auto; }
.cmp-head .rec, .cmp-pr, .cmp-state, .cmp-revs, .cmp-dots { flex: none; }
.cmp-pr { font-size: 0.78rem; }
.cmp-stage { position: relative; flex: 1; min-height: 0; display: block; padding: 0; border: 0; border-radius: 8px; background: transparent; cursor: zoom-in; overflow: hidden; }
.cmp-stage img { display: block; width: 100%; height: 100%; object-fit: contain; }
.cmp-stage:disabled { cursor: default; }
.cmp-none { color: var(--viewer-fg); opacity: 0.7; }
.cmp-dots, .cmp-pager, .cmp-revs { display: flex; justify-content: center; gap: 4px; }
.cmp-pager { padding: 4px 0 8px; }
.cmp-dot { width: 24px; height: 24px; padding: 0; border: 0; background: transparent; cursor: pointer; position: relative; }
.cmp-dot::after { content: ""; position: absolute; left: 8px; top: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--viewer-fg); opacity: 0.35; }
.cmp-dot.on::after { opacity: 1; }
.cmp-rev { border: 1px solid transparent; cursor: pointer; font: inherit; font-size: 0.8rem; }
.cmp-rev.on { border-color: var(--accent); }
.cmp-note-btn { height: 30px; padding: 0 12px; font-size: 0.85rem; }
.cmp-note-btn.has { box-shadow: inset 0 0 0 1px var(--viewer-fg); }
.cmp-pick { height: 30px; padding: 0 12px 0 8px; font-size: 0.85rem; }
.cmp-cap { position: absolute; left: 12px; bottom: 12px; max-width: calc(100% - 24px); margin: 0; padding: 2px 8px; border-radius: 6px; background: var(--viewer-bg); font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
.cmp-more { position: absolute; left: 6px; right: 6px; bottom: 6px; z-index: 1; max-height: 70%; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--surface); color: var(--fg); box-shadow: var(--shadow-modal); }
.cmp-detail { font-size: 0.88rem; }
.cmp-more .note { width: 100%; resize: vertical; }
.cmp-state { background: var(--viewer-chip); color: var(--viewer-fg); }
.cmp-foot { flex: none; display: flex; align-items: flex-end; gap: 10px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)); background: var(--surface); color: var(--fg); }
.cmp-foot .note { flex: 1; resize: none; }
.cmp-foot .err { align-self: center; }
.cmp-entry { display: flex; flex-direction: column; gap: 10px; }
.thumb-tag { position: absolute; left: 4px; top: 4px; min-width: 18px; padding: 0 4px; border-radius: 6px; background: var(--surface); color: var(--fg); font-size: 0.75rem; font-weight: 700; text-align: center; }
body.phone .v-top { padding-left: 10px; gap: 6px; }
body.phone .v-cap, body.phone .v-zoom, body.phone .v-cmp { display: none; }
body.phone .v-where { flex: 0 1 auto; }
body.phone .v-tick { padding: 0 12px 0 10px; }
body.phone .v-top .v-tw { display: none; }
body.phone .v-main { flex-direction: column; }
body.phone .v-nav { display: none; }
body.phone .v-rail { order: 2; width: auto; height: 64px; flex-direction: row; gap: 6px; padding: 6px 10px calc(6px + env(safe-area-inset-bottom, 0px)); overflow-x: auto; overflow-y: hidden; }
body.phone .v-rthumb { width: auto; height: 100%; flex: none; }
body.phone .v-sheet { left: 0; right: 0; bottom: 0; width: auto; max-height: 75%; border-radius: 14px 14px 0 0; }
body.phone .cmp-grid { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr); padding: 0; }
body.phone .cmp-col { border-radius: 0; border-width: 0; background: transparent; }
body.phone .cmp-col:not(.focus) { display: none; }
body.phone .cmp-pick { height: 40px; }

/* Threads tab: section tabs, thread list, conversation, proposal card */
.vtabs { display: flex; gap: 4px; padding: 8px 16px; background: var(--z-left); border-bottom: 1px solid var(--line); }
.vtabs[hidden] { display: none; }
.vtabs a { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.95rem; color: var(--muted); text-decoration: none; padding: 7px 14px; border-radius: 10px; min-height: 36px; box-sizing: border-box; }
.vtabs a[aria-current="page"] { background: var(--ink); color: var(--ink-fg); }
.vtabs a:focus-visible, .trow:focus-visible, .back:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.vtabs .cnt, .cnt-pill { font-size: 0.75rem; font-weight: 700; line-height: 1.4; min-width: 20px; text-align: center; border-radius: 999px; padding: 0 6px; background: var(--attn); color: #fff; }
body.view-threads .layout, body.view-threads .flight { display: none; }
body.view-threads { background: var(--z-main); display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
.threads { display: grid; grid-template-columns: 400px minmax(0, 1fr); flex: 1; min-height: 0; background: var(--z-main); }
.threads[hidden] { display: none; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.sm { width: 14px; height: 14px; }
.ico { display: inline-flex; }
.av-me { background: var(--p-teal); }
.av-pn { background: var(--p-plum); }
.bot-av { width: 34px; height: 34px; border-radius: 10px; flex: none; display: flex; align-items: center; justify-content: center; color: var(--bc, var(--accent)); background: color-mix(in srgb, var(--bc, var(--accent)) 14%, var(--surface)); border: 1.5px solid color-mix(in srgb, var(--bc, var(--accent)) 55%, var(--surface)); }
.bot-av svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.bot-av.sm { width: 26px; height: 26px; border-radius: 8px; }
.bot-av.sm svg { width: 16px; height: 16px; }
.bot-av.mine { --bc: var(--accent); }
.bot-av.theirs { --bc: var(--p-plum); }
.pair { display: flex; flex: none; }
.pair > * + * { margin-left: -8px; box-shadow: -2px 0 0 var(--surface); }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; border-radius: 6px; padding: 1px 6px; line-height: 1.5; }
.tag.bot { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.tag.hum { color: var(--ok); background: var(--ok-soft); }
.tag.you { color: var(--p-teal); background: color-mix(in srgb, var(--p-teal) 14%, var(--surface)); }
.tag.flag { color: var(--attn); background: var(--attn-soft); }
.udot { width: 10px; height: 10px; border-radius: 50%; background: var(--attn); flex: none; }

.a-list { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.a-lh { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.a-lh h2 { margin: 0; font-size: 1.1rem; }
.a-lh .cnt-pill { margin-left: auto; }
.lh-bot { display: inline-flex; }
.lh-bot:empty { display: none; }
.a-rows { overflow-y: auto; flex: 1; }
.trow { display: grid; grid-template-columns: 14px 44px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; width: 100%; box-sizing: border-box; text-align: left; font: inherit; color: inherit; background: transparent; border: 0; border-bottom: 1px solid var(--line); padding: 12px 16px 12px 16px; cursor: pointer; }
.trow.on { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, var(--line)); }
.trow .un { display: flex; justify-content: center; }
.trow .tw { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.trow .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow.unread .t { font-weight: 800; }
.trow .o { font-size: 0.82rem; color: var(--muted); display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; overflow: hidden; }
.trow .o b { color: var(--fg); font-weight: 600; }
.trow .l { font-size: 0.86rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow.unread .l { color: var(--fg); }
.trow .rt { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font-size: 0.82rem; color: var(--muted); }
.chip-prop { display: inline-flex; align-items: center; gap: 4px; font-size: 0.72rem; font-weight: 700; color: var(--attn); background: var(--attn-soft); border-radius: 999px; padding: 1px 8px; white-space: nowrap; }

.a-det { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--z-main); }
.a-dh { padding: 14px 28px 12px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.a-dh h2 { margin: 0; font-size: 1.25rem; line-height: 1.3; }
.a-dh .back { display: none; }
.a-dh .tl { display: flex; align-items: center; gap: 10px; }
.parts { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.pt { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.pt .fw { color: var(--muted); }
.th-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.th-note { text-align: center; }
body.phone .th-acts .btn.sm { min-height: 44px; }
.th-note::before, .th-note::after { min-width: 16px; }
.a-scroll { flex: 1; overflow-y: auto; padding: 18px 28px; min-height: 0; }
.a-scroll .convo { max-width: 760px; margin: 0 auto; }
.a-bar { background: var(--surface); border-top: 1px solid var(--line); padding: 12px 28px 16px; }
.a-bar .composer { max-width: 760px; margin: 0 auto; }
.th-err { max-width: 760px; margin: 8px auto 0; }

.convo { display: flex; flex-direction: column; gap: 16px; }
.msg { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; align-items: start; }
.msg > div { min-width: 0; }
.msg .mh { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 0.85rem; color: var(--muted); }
.msg .mh b { color: var(--fg); font-weight: 700; }
.msg .mh .age { margin-left: auto; }
.msg .mb, .msg .mreq { margin: 4px 0 0; padding: 9px 13px; border-radius: 4px 14px 14px 14px; background: var(--surface); border: 1px solid var(--line); overflow-wrap: anywhere; white-space: pre-wrap; }
.msg .mreq { color: var(--muted); font-size: 0.9rem; }
.msg.bot .mb { background: color-mix(in srgb, var(--bc, var(--accent)) 7%, var(--surface)); border: 1px solid color-mix(in srgb, var(--bc, var(--accent)) 35%, var(--line)); }
.msg.bot.theirs { --bc: var(--p-plum); }
.msg.bot.mine { --bc: var(--accent); }
.msg.hum .mb { background: var(--ok-soft); border-color: var(--ok-line); }
.msg.you { grid-template-columns: minmax(0, 1fr) 34px; }
.msg.you .av { order: 2; }
.msg.you .mh { justify-content: flex-end; }
.msg.you .mh .age { margin-left: 0; order: -1; }
.msg.you .mb { border-radius: 14px 4px 14px 14px; background: color-mix(in srgb, var(--p-teal) 12%, var(--surface)); border-color: color-mix(in srgb, var(--p-teal) 45%, var(--line)); margin-left: auto; max-width: 92%; width: fit-content; }
.day { display: flex; align-items: center; gap: 12px; font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.day::before, .day::after { content: ""; height: 1px; flex: 1; background: var(--line); }

.prop { margin: 6px 0 0; background: color-mix(in srgb, var(--attn) 6%, var(--surface)); border: 1px solid color-mix(in srgb, var(--attn) 40%, var(--line)); border-radius: 12px; box-shadow: var(--shadow); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.prop .ph { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 600; color: var(--attn); }
.prop .when { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.prop .when b { font-size: 1.15rem; line-height: 1.25; overflow-wrap: anywhere; }
.prop .when span { color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.prop .agreed { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.85rem; font-weight: 600; color: var(--ok); }
.prop .pb { display: flex; gap: 10px; }
.prop .pb .btn { flex: 1 1 0; padding: 8px 10px; font-size: 0.88rem; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; }
.btn.yes { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.btn.alt { background: var(--surface); border-color: var(--line); color: var(--fg); }

.composer { display: flex; align-items: flex-end; gap: 10px; }
.composer textarea { flex: 1; min-height: 44px; max-height: 160px; resize: none; box-sizing: border-box; font: inherit; }
.composer .btn { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; }

@media (max-width: 600px) {
  .vtabs { padding: 6px 8px; }
  .vtabs a { padding: 6px 9px; font-size: 0.88rem; }
  .threads { display: block; }
  .a-list, .a-det { height: 100%; border: 0; }
  .threads[data-view="detail"] .a-list, .threads:not([data-view="detail"]) .a-det { display: none; }
  .a-dh { padding: 10px 16px; gap: 6px; }
  .a-dh .back { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-left: -10px; border: 0; background: transparent; color: var(--fg); border-radius: 50%; flex: none; cursor: pointer; }
  .a-dh h2 { font-size: 1.05rem; }
  .a-scroll { padding: 14px 16px; }
  .a-bar { padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
  .prop .pb { flex-direction: column; }
  .trow { padding-left: 12px; }
}

.follows { align-self: flex-start; cursor: pointer; border: 0; }
.chain { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.chain li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chain li.here .chain-t { font-weight: 700; }
.chain-t { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; text-align: left; cursor: pointer; }
.chain li.here .chain-t { color: var(--fg); cursor: default; }
/* Health check panel on the rail (health.js): one row per rule, a dot with a symbol, a count */
#health { padding: 0 16px 8px; min-width: 0; font-size: 0.8rem; color: var(--muted); }
#health[hidden] { display: none; }
@media (min-width: 900px) { #health { padding: 0 22px 12px; } }
#health .hl-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#health .hl-h { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 0.78rem; font-weight: 600; color: var(--fg); }
#health .hl-run { min-width: 32px; min-height: 32px; background: none; border: 1px solid transparent; border-radius: 8px; color: var(--muted); font: inherit; font-size: 0.95rem; cursor: pointer; }
#health .hl-run:hover, #health .hl-run:focus-visible { border-color: var(--line); color: var(--fg); }
#health .hl-run:disabled { opacity: 0.5; cursor: default; }
#health ul { list-style: none; margin: 0; padding: 0; }
#health .hl-line { display: flex; align-items: center; gap: 6px; min-width: 0; min-height: 28px; }
#health summary.hl-line { cursor: pointer; list-style: none; }
#health summary.hl-line::-webkit-details-marker { display: none; }
#health summary.hl-line:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 4px; }
#health .hl-name { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--fg); }
#health .hl-row.lv-muted .hl-name { color: var(--muted); }
#health .hl-n { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
#health .hl-issue { font-size: 0.72rem; color: var(--accent); white-space: nowrap; }
#health .hl-issue.muted { color: var(--muted); }
#health .hdot { --hc: var(--muted); display: inline-grid; place-items: center; flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--hc); color: var(--bg); font-size: 0.62rem; font-weight: 700; line-height: 1; }
#health .hdot.lv-ok { --hc: var(--ok); }
#health .hdot.lv-warn { --hc: var(--gold); }
#health .hdot.lv-bad { --hc: var(--attn); }
#health .hdot.lv-muted { background: var(--sunken); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
#health .hl-ids { display: grid; gap: 4px; padding: 2px 0 6px 20px; }
#health .hl-ids li { display: flex; flex-wrap: wrap; gap: 2px 8px; min-width: 0; }
#health .hl-ids a, #health .hl-ids .mono { font-size: 0.72rem; overflow-wrap: anywhere; min-width: 0; }
#health .hl-ids a { color: var(--accent); }
#health .hl-d { font-size: 0.72rem; overflow-wrap: anywhere; }
/* Claude allowance fuel gauges on the rail: slim bars that drain; details on hover, focus or tap */
#allow { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 4px 16px 8px; }
#allow[hidden] { display: none; }
@media (min-width: 900px) { #allow { padding: 0 22px 12px; } }
#allow .fgauge { --fc: var(--ok); position: static; display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 4px 0; background: none; border: 0; color: var(--muted); font: inherit; text-align: left; cursor: default; border-radius: 4px; }
/* Continuous: red at 0, amber at 50, green at 100, from --pct set by renderAllowance; theme tokens keep both themes right */
#allow .fgauge[style*="--pct"]:not(.stale) { --fc: color-mix(in oklab, var(--gold) calc(var(--pct) * 2%), var(--attn)); }
#allow .fgauge.hi[style*="--pct"]:not(.stale) { --fc: color-mix(in oklab, var(--ok) calc((var(--pct) - 50) * 2%), var(--gold)); }
#allow .fgauge:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#allow .fg-nm { font-family: var(--font-mono); font-size: 0.62rem; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#allow .fg-bar { display: block; height: 4px; border-radius: 2px; background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
#allow .fg-bar i { display: block; height: 100%; background: var(--fc); border-radius: 2px; transition: width 0.4s ease; }
/* No reading or an old one: muted and hatched */
#allow .fgauge.lv-none .fg-bar, #allow .fgauge.stale .fg-bar { background: repeating-linear-gradient(135deg, var(--line) 0 3px, var(--sunken) 3px 6px); }
#allow .fgauge.stale .fg-bar i { background: repeating-linear-gradient(135deg, var(--muted) 0 3px, var(--sunken) 3px 6px); opacity: 0.7; }
/* Opacity on the parts, not the gauge, so the tooltip is not trapped under the agent rows */
#allow .fgauge.lv-none :is(.fg-nm, .fg-bar), #allow .fgauge.stale :is(.fg-nm, .fg-bar) { opacity: 0.75; }
#allow .fg-cd { font-size: 0.62rem; line-height: 1.2; color: var(--attn); overflow-wrap: anywhere; }
#allow .fgauge.stale .fg-cd { color: var(--muted); }
#allow .fg-rd { font-size: 0.62rem; line-height: 1.2; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#allow .fg-tip { display: none; position: absolute; left: 16px; right: 16px; top: 100%; z-index: 30; margin-top: 2px; padding: 8px 10px; background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-modal); flex-direction: column; gap: 2px; font-size: 0.78rem; pointer-events: none; }
@media (min-width: 900px) { #allow .fg-tip { left: 22px; right: 22px; } }
#allow .fgauge:hover .fg-tip, #allow .fgauge:focus-visible .fg-tip, #allow .fgauge.open .fg-tip { display: flex; }
#allow .ft-h { font-weight: 600; }
#allow .ft-l { color: var(--muted); }
.badge.bot-allow { color: var(--run); }
.badge.bot-allow.stale { color: var(--muted); }
.badge.bot-allow.out { white-space: normal; }
.badge.bot-allow.low { color: var(--attn); background: var(--attn-soft); }

/* Calendar meeting FYI card */
.tile.cal { --kc: var(--p-teal); background: color-mix(in srgb, var(--p-teal) 8%, var(--surface)); border-color: color-mix(in srgb, var(--p-teal) 40%, var(--line)); }
.cal-top { display: flex; align-items: center; gap: 12px; }
.caldate { width: 46px; flex: none; border-radius: 10px; overflow: hidden; background: var(--surface); border: 1px solid color-mix(in srgb, var(--p-teal) 55%, var(--line)); text-align: center; line-height: 1; box-shadow: var(--shadow); }
.caldate i { display: block; font-style: normal; background: var(--p-teal); color: var(--surface); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.1em; padding: 4px 0 3px; }
.caldate b { display: block; font-size: 1.3rem; padding: 4px 0 5px; }
.cal-top .when { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cal-top .when .lead { font-size: 0.85rem; font-weight: 700; color: var(--p-teal); display: flex; align-items: center; gap: 6px; }
.cal-top .when .tm { font-family: var(--font-mono); font-size: 0.92rem; font-weight: 600; }
.cal-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tile.cal .acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.tile.cal .acts .push { margin-left: auto; }
.btn.snooze, .btn.join { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.btn.snooze { background: var(--surface); color: var(--fg); border-color: color-mix(in srgb, var(--p-teal) 55%, var(--line)); }
.btn.snooze .ic { color: var(--p-teal); }
.btn.join { background: var(--p-teal); border-color: var(--p-teal); color: var(--surface); }
.btn.dismiss { background: transparent; color: var(--muted); border-color: var(--line); }
.cal-chips .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile.cal.clickable { cursor: pointer; }
.meet-detail { display: flex; flex-direction: column; gap: 10px; min-width: 0; margin: 6px 0 4px; }
.meet-detail .costrow { border: 0; padding: 0; }
.meet-detail .costrow .slabel { flex: 0 0 84px; }
.meet-detail .agenda { white-space: pre-wrap; overflow-wrap: anywhere; }
.meet-detail .outlook { align-self: flex-start; }
.meet-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.meet-acts .btn.sm { min-height: 40px; padding: 7px 16px; }
body.phone .meet-detail .costrow { flex-direction: column; gap: 2px; }
body.phone .meet-detail .costrow .slabel { flex-basis: auto; }
body.phone .tile.cal .btn { min-height: 44px; }
body.phone .tile.cal .acts .push { flex-basis: 100%; margin-left: 0; }
.tile.cal .btn.sm { min-height: 34px; padding: 5px 12px; font-size: 0.88rem; }
body.phone .tile.cal .btn.sm { min-height: 44px; padding: 8px 16px; }
/* Meeting negotiation cards: times in the viewer's zone, a count for the organiser, the organiser's note */
.meet-block { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.meet-block .chip { font-family: var(--font-mono); font-size: 0.78rem; }
.meet-block .chip.on { background: var(--ok-soft); color: var(--ok); }
.meet-state { font-size: 0.82rem; color: var(--muted); align-self: center; }
.meet-note { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; background: color-mix(in srgb, var(--p-teal) 7%, var(--sunken)); border: 1px solid color-mix(in srgb, var(--p-teal) 30%, var(--line)); border-radius: 8px; font-size: 0.9rem; overflow-wrap: anywhere; }
.meet-note .from { font-size: 0.75rem; font-weight: 700; color: var(--muted); }
body:not(.phone) .mopts.meet { display: flex; flex-wrap: wrap; gap: 8px; }
body:not(.phone) .mopts.meet .mopt { display: inline-flex; align-items: center; min-height: 36px; padding: 6px 12px; font-family: var(--font-mono); font-size: 0.85rem; background: var(--sunken); border-color: var(--line); color: var(--fg); }
.mopts.meet .mopt:not(.decline):hover { background: var(--ok-soft); border-color: var(--ok-line); }
body:not(.phone) .mopts.meet .mopt.decline, body.phone .mopts.meet .mopt.decline { background: transparent; color: var(--muted); font-family: inherit; }
/* Account block and Hooks sit at the right of the section tab bar */
.vtabs { align-items: center; }
.vtabs .hooks-btn { margin-left: auto; position: relative; background: transparent; border-color: transparent; box-shadow: none; min-height: 44px; padding: 0 12px; gap: 8px; font-weight: 600; font-size: 0.92rem; }
.vtabs .hooks-btn:not([hidden]) ~ .person { margin-left: 0; }
.vtabs .person { margin-left: auto; }
.vtabs .who-btn { padding: 2px 6px; }
.vtabs .avatar { width: 34px; height: 34px; font-size: 0.85rem; }
.pname-wrap small:empty { display: none; }
.hooks-btn:hover, .hooks-btn[aria-expanded="true"] { background: var(--sunken); }
.hooks-btn .ic, .hk-dh .ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.sm { width: 15px; height: 15px; }
.hk-n { font-size: 0.75rem; font-weight: 700; line-height: 1.4; min-width: 20px; text-align: center; border-radius: 999px; padding: 0 6px; background: var(--attn); color: #fff; }

/* Hooks drawer (desktop) and bottom sheet (phone) */
.hk-scrim { position: fixed; inset: 0; background: var(--backdrop); z-index: 40; }
.hk-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-modal); z-index: 41; display: flex; flex-direction: column; }
.hk-dh { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.hk-dh h2 { margin: 0; font-size: 1.2rem; }
.hk-x { margin-left: auto; width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--fg); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.hk-x:hover { background: var(--sunken); }
.hk-db { flex: 1; overflow-y: auto; padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 18px; background: var(--z-main); min-height: 0; }
.hk-sect { display: flex; flex-direction: column; gap: 0; }
.hk-h3 { margin: 0 0 8px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.hk-state { margin: 0 0 8px; font-size: 0.85rem; color: var(--muted); }
.hk-err { margin: 8px 0 0; font-size: 0.85rem; color: var(--attn); }
.hk-conn { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.cn { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px; display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center; box-shadow: var(--shadow); min-width: 0; }
.cn .hk-ico { width: 32px; height: 32px; }
.cn .hk-ico .ic { width: 18px; height: 18px; }
.cn.ok { border-color: var(--ok-line); }
.cn b { font-size: 0.95rem; }
.cn .cst { display: flex; flex-direction: column; gap: 2px; align-items: center; }
.cn .cns { font-size: 0.8rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.cn .cns .d { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.cn .cns .d.off { background: var(--muted); opacity: 0.6; }
.cn .btn { width: 100%; margin-top: auto; padding: 5px 4px; font-size: 0.8rem; }
.cn .done { margin-top: auto; width: 100%; min-height: 30px; display: flex; align-items: center; justify-content: center; gap: 6px; border-radius: 10px; background: var(--ok-soft); color: var(--ok); font-weight: 600; font-size: 0.86rem; }
.btn.sm { min-height: 34px; padding: 5px 14px; font-size: 0.86rem; }
.hk-ico { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex: none; color: var(--hc, var(--accent)); background: color-mix(in srgb, var(--hc, var(--accent)) 14%, var(--surface)); }
.hk-ico .ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hk-ico.cal { --hc: var(--p-teal); }
.hk-ico.mail { --hc: var(--accent); }
.hk-ico.teams { --hc: var(--p-plum); }
.hk-ico.docs { --hc: var(--p-ochre); }
.hk-ico.sun { --hc: var(--p-ochre); }
.hk-ico.eod { --hc: var(--p-terracotta); }
.hk-ico.slip { --hc: var(--attn); }
.hk-ico.plus { --hc: var(--muted); }
.hk-mail { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 4px 8px; }
.hk-custom { margin-top: 10px; }
.hk-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; min-height: 52px; color: var(--fg); }
.hk-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; text-align: left; }
.hk-txt b { font-size: 0.95rem; font-weight: 600; overflow-wrap: anywhere; }
.hk-txt small { font-size: 0.8rem; color: var(--muted); font-family: var(--font-mono); }
.hk-edit { font: inherit; color: inherit; background: transparent; border: 0; padding: 0; cursor: pointer; }
.hk-edit b { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hk-del { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.hk-del:hover { background: var(--sunken); color: var(--attn); }
.hk-del .ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sw { width: 40px; height: 24px; border-radius: 999px; background: var(--disc); border: 1px solid var(--line); position: relative; flex: none; cursor: pointer; padding: 0; }
.sw::after { content: ""; position: absolute; left: 2px; top: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); }
.sw.on { background: var(--ok); border-color: var(--ok); }
.sw.on::after { left: 18px; }
.sw:disabled { cursor: default; }
.hk-sug { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.hk-eco { display: flex; flex-direction: column; gap: 16px; }
.hk-grp { display: flex; flex-direction: column; gap: 8px; }
.hk-eh { margin: 0; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.sg { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); min-width: 0; font: inherit; color: var(--fg); text-align: left; }
.sg.on { border-color: var(--ok-line); background: color-mix(in srgb, var(--ok-soft) 55%, var(--surface)); }
.sg.dis { opacity: 0.5; }
.sg.own { border-width: 1.5px; border-color: var(--muted); box-shadow: var(--shadow); background: var(--surface); cursor: pointer; justify-content: space-between; }
.sg.own:disabled { opacity: 0.5; cursor: default; }
.sg .top { display: flex; align-items: center; gap: 10px; }
.sg .top .sw { margin-left: auto; }
.sg .sgt { display: flex; flex-direction: column; gap: 2px; }
.sg b { font-size: 0.95rem; line-height: 1.25; }
.sg .tm { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); }
.sg .ab { margin: 4px 0 0; font-size: 0.85rem; line-height: 1.4; color: var(--fg); }
.sg .nd { margin-top: 4px; font-size: 0.78rem; color: var(--muted); }
.sg .nd.warn { color: var(--attn); }
.hk-ico.inbox, .hk-ico.reply { --hc: var(--attn); }
.hk-ico.bell { --hc: var(--p-plum); }
.hk-hrow { display: flex; align-items: baseline; gap: 10px; }
.hk-hrow .hk-more { margin-left: auto; }
.hk-more { font: inherit; font-size: 0.85rem; font-weight: 600; color: var(--accent); background: transparent; border: 0; padding: 4px 2px; cursor: pointer; }
.hk-moreconn { display: flex; justify-content: flex-end; margin-bottom: 4px; }
.hk-morelink { font-size: 0.85rem; font-weight: 600; color: var(--accent); text-decoration: none; padding: 4px 2px; }
.hk-morelink:hover { text-decoration: underline; }
.hk-more:hover { text-decoration: underline; }
.hk-search { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.hk-search input { flex: 1; min-width: 0; font: inherit; padding: 8px 12px; min-height: 42px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--fg); }
.hk-back { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--fg); display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.hk-back:hover { background: var(--sunken); }
.hk-back .ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hk-drawer.full { left: 0; width: auto; border-left: 0; }
.hk-drawer.full .hk-db { padding-left: max(20px, calc((100vw - 1100px) / 2)); padding-right: max(20px, calc((100vw - 1100px) / 2)); }
.hk-drawer.full .hk-sug { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.hk-form { margin-top: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.hk-form textarea, .hk-form > input[type=text] { font: inherit; width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--fg); }
.hk-form textarea { resize: vertical; min-height: 84px; }
.hk-frow { display: flex; flex-wrap: wrap; gap: 10px; }
.hk-f { display: flex; flex-direction: column; gap: 3px; font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.hk-f select, .hk-f input { font: inherit; font-size: 0.92rem; font-weight: 400; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; min-height: 38px; max-width: none; }
.hk-acts { display: flex; gap: 8px; }

body.phone .hk-drawer { top: calc(var(--safe-t) + 56px); left: 0; width: auto; border-left: 0; border-radius: 18px 18px 0 0; padding-bottom: var(--safe-b); }
body.phone .hk-dh { padding: 10px 16px; }
body.phone .hk-db { padding: 12px 16px 24px; gap: 14px; background: var(--surface); }
body.phone .hk-conn { display: flex; flex-direction: column; gap: 0; }
body.phone .cn { flex-direction: row; align-items: center; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; padding: 8px 0; gap: 12px; background: transparent; }
body.phone .cn { text-align: left; }
body.phone .cn .hk-ico { width: 38px; height: 38px; }
body.phone .cn .cst { flex: 1; align-items: flex-start; }
body.phone .cn .btn, body.phone .cn .done { width: auto; margin: 0; padding: 5px 14px; font-size: 0.86rem; }
body.phone .hk-mail { border: 0; box-shadow: none; padding: 0; background: transparent; }
body.phone .hk-row { padding: 5px 0; }
body.phone .hk-sug { display: flex; flex-direction: column; gap: 0; }
body.phone .sg { flex-direction: row; align-items: center; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; padding: 8px 0; background: transparent; gap: 12px; width: 100%; }
body.phone .sg.on { background: transparent; }
body.phone .sg .top { display: contents; }
body.phone .sg .sgt { flex: 1; min-width: 0; }
body.phone .sg .top .sw { margin-left: 0; order: 3; }
body.phone .sg.own { border-style: solid; border-width: 0 0 1px; }
body.phone .hk-drawer.full { top: 0; border-radius: 0; padding-top: var(--safe-t); }
body.phone .hk-drawer.full .hk-sug { display: flex; }
body.phone .sg .top .hk-ico { align-self: flex-start; }
body.phone .hk-form { border: 0; box-shadow: none; padding: 12px 0 4px; background: transparent; }
body.phone .md-body .hooks-btn { width: 100%; min-height: 48px; justify-content: flex-start; margin: 0; background: var(--surface); border-color: var(--line); }
body.phone .md-body .hooks-btn .hk-n { margin-left: auto; }

/* The card "More" link is inline in its footer; the icon-button rule above positioned it against the page */
.linkbtn.more { position: static; width: auto; height: auto; border-radius: 0; display: inline; padding: 4px 0; margin-left: auto; font-size: 0.88rem; font-weight: 600; color: var(--accent); }
.linkbtn.more:hover { background: none; text-decoration: underline; }

/* Phone rail rows: just the bot's name and what it is doing now. */
body.phone .rail .station .who-top .badge, body.phone .rail .station .an { display: none; }

/* A staff request opened in the board: triage in place (bottom sheet on a phone). */
.rq-dlg { --kc: var(--taste); }
.rq-dlg .rq-imgs { display: flex; flex-wrap: wrap; gap: 8px; }
.rq-dlg .rq-imgbtn { padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 8px; }
.rq-dlg .rq-img { max-width: 160px; max-height: 120px; border-radius: 8px; border: 1px solid var(--line); object-fit: cover; }
.rq-dlg .rq-also { margin: 0; color: var(--muted); font-size: 0.9rem; }
.rq-dlg .rq-stage.rq-s-approved { background: var(--ok-bg, transparent); }
.rq-acts { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--line); padding-top: 14px; }
.rq-row { display: flex; flex-wrap: wrap; gap: 8px; }
.rq-row .btn { min-height: 40px; }
.rq-row:has(.rq-seg) { align-items: center; flex-wrap: nowrap; }
.rq-do { font-weight: 700; flex: none; }
.rq-seg { display: flex; flex: 1 1 auto; min-width: 0; }
.rq-seg .btn { flex: 1 1 0; border-radius: 0; margin-left: -1px; }
.rq-seg .btn:first-child { border-radius: 10px 0 0 10px; margin-left: 0; }
.rq-seg .btn:last-child { border-radius: 0 10px 10px 0; }
.rq-who { display: inline-flex; align-items: center; gap: 8px; }
.rq-who .consent-meta { margin: 0; }
.rq-form { display: flex; flex-direction: column; gap: 10px; }
.rq-form textarea { min-height: 84px; }
.rq-matches { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 40vh; overflow-y: auto; }
.rq-match { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.rq-mt { display: flex; flex-direction: column; min-width: 0; }
.rq-mt b { overflow-wrap: anywhere; }
.rq-mw, .rq-none { color: var(--muted); font-size: 0.85rem; }
.rq-note { margin: 0; color: var(--muted); font-size: 0.9rem; }
.rq-out.declined { color: var(--attn); }
.tile.staff_request.clickable { cursor: pointer; }
@media (max-width: 560px) {
  .modal:has(.rq-dlg) { align-items: flex-end; padding: 0; }
  .dialog.rq-dlg { max-width: none; margin: 0; border-radius: 16px 16px 0 0; max-height: 92vh; overflow-y: auto; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  .rq-row .btn { flex: 1 1 100%; }
  .rq-seg .btn { flex: 1 1 0; }
}

/* Threads: group-chat view and phone fit (own block; the colours are the tokens above) */
body.view-threads { height: var(--th-h, 100dvh); }
.a-det { overflow: hidden; }
.a-dh { flex: none; }
.th-more, .th-sum { display: none; }
.a-scroll { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.msg .mb { border-radius: 4px 16px 16px 16px; }
.msg.you .mb { border-radius: 16px 4px 16px 16px; }
.msg:not(.you) .mb, .msg .mreq { max-width: 92%; }
.a-bar { position: relative; flex: none; }
.composer textarea { padding: 10px 14px; border-radius: 22px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); }
@media (max-width: 600px) {
  .a-dh { padding: 6px 12px 8px; gap: 2px; }
  .a-dh .tl { gap: 4px; }
  .a-dh h2 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .th-more { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-right: -8px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); flex: none; cursor: pointer; }
  .th-more .ic { transition: transform 0.15s; }
  .th-more[aria-expanded="true"] .ic { transform: rotate(180deg); }
  .th-sum { display: block; margin: 0 0 0 36px; font-size: 0.85rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .a-dh.open .th-sum { display: none; }
  .th-info { display: none; max-height: 40dvh; overflow-y: auto; flex-direction: column; gap: 10px; padding: 6px 0 4px 36px; }
  .a-dh.open .th-info { display: flex; }
  .a-scroll { padding: 10px 10px 8px; }
  .convo { gap: 10px; }
  .msg { grid-template-columns: 28px minmax(0, 1fr); gap: 6px; }
  .msg.you { grid-template-columns: minmax(0, 1fr) 28px; }
  .msg .avatar { width: 28px; height: 28px; font-size: 0.72rem; }
  .msg .mb { max-width: 94%; }
  .a-bar { padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)); }
  .composer { gap: 8px; }
  .composer .btn { padding: 0 14px; border-radius: 22px; }
}
/* Style picker: a palette button in the toolbar opening Playful / Corporate; a segmented pair in the person menu (phone). */
.stylectl { position: relative; margin-right: 8px; }
.stylectl .tbtn[aria-expanded="true"] { border-color: var(--accent); }
.spop { position: absolute; top: calc(100% + 6px); right: 0; z-index: 12; min-width: 170px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-modal); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.sopt { font: inherit; font-size: 0.92rem; color: var(--fg); background: none; border: 0; border-radius: 8px; padding: 9px 12px; min-height: 40px; text-align: left; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.sopt:hover { background: var(--sunken); }
.sopt[aria-checked="true"] { font-weight: 600; }
.sopt::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.sopt[aria-checked="true"]::before { background: var(--accent); }
.sopt:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.styrow { display: none; cursor: default; padding: 4px 6px; }
.styrow:hover { background: none; }
.sseg { display: flex; width: 100%; gap: 4px; background: var(--sunken); border-radius: 10px; padding: 3px; }
.sseg .sopt { flex: 1; justify-content: center; padding: 8px 6px; }
.sseg .sopt::before { display: none; }
.sseg .sopt[aria-checked="true"] { background: var(--ink); color: var(--ink-fg); }
body.phone .styrow { display: flex; }
body.phone .stylectl { display: none; }

/* Corporate style: calmer, flatter, squarer, denser. Tokens first, then a few targeted rules. */
:root[data-style="corporate"] {
  --bg: #f4f5f7; --surface: #ffffff; --sunken: #eceef1; --rail: #eef0f3; --fg: #1c2330; --muted: #5d6675; --line: #d9dde3;
  --accent: #1f4e79; --accent-fg: #ffffff; --ink: #1f2937; --ink-fg: #ffffff;
  --attn: #b3402a; --attn-soft: #f6e4df; --taste: #5b5f97; --call: #5d6675; --run: #2f6f4f;
  --ok: #2f6f4f; --ok-soft: #e4efe8; --ok-line: #8db79f;
  --cos-bg: #e6edf5; --cos-bg-hover: #dbe5f0; --wait-bg: #eceef1; --wait-line: #d9dde3; --wait-pill: #dfe2e7;
  --disc: #dfe3e9; --disc-small: #e8ebef; --zzz: #5d6675; --heart: #5d6675; --gold: #8a6d1d;
  --t-attn: #f8f0ee; --t-taste: #f1f1f7; --t-call: #f1f2f4; --z-left: #eef0f3; --z-flight: #eceef1; --z-main: #f4f5f7;
  --shadow: none; --shadow-modal: 0 8px 28px rgba(15, 23, 42, 0.22); --backdrop: rgba(15, 23, 42, 0.45);
}
@media (prefers-color-scheme: dark) {
  :root[data-style="corporate"]:not([data-theme="light"]) {
    --bg: #14171c; --surface: #1b1f26; --sunken: #232830; --rail: #181c22; --fg: #e6e9ee; --muted: #9aa3b0; --line: #2d333c;
    --accent: #7fb0e0; --accent-fg: #0f1318; --ink: #e6e9ee; --ink-fg: #0f1318;
    --attn: #e8806a; --attn-soft: #33201b; --taste: #a3a6e0; --call: #9aa3b0; --run: #6dbb90; --ok: #74c69c; --ok-soft: #1b2e24; --ok-line: #3d7a58;
    --cos-bg: #1e2a38; --cos-bg-hover: #243246; --wait-bg: #181c22; --wait-line: #262c34; --wait-pill: #262c34;
    --disc: #2b313a; --disc-small: #343b46; --zzz: #9aa3b0; --heart: #9aa3b0; --gold: #d9b95a;
    --t-attn: #221a19; --t-taste: #1d1d27; --t-call: #1b1f25; --z-left: #181c22; --z-flight: #1a1e25; --z-main: #14171c;
    --shadow: none; --shadow-modal: 0 8px 28px rgba(0, 0, 0, 0.6); --backdrop: rgba(0, 0, 0, 0.6);
  }
}
:root[data-style="corporate"][data-theme="dark"] {
  --bg: #14171c; --surface: #1b1f26; --sunken: #232830; --rail: #181c22; --fg: #e6e9ee; --muted: #9aa3b0; --line: #2d333c;
  --accent: #7fb0e0; --accent-fg: #0f1318; --ink: #e6e9ee; --ink-fg: #0f1318;
  --attn: #e8806a; --attn-soft: #33201b; --taste: #a3a6e0; --call: #9aa3b0; --run: #6dbb90; --ok: #74c69c; --ok-soft: #1b2e24; --ok-line: #3d7a58;
  --cos-bg: #1e2a38; --cos-bg-hover: #243246; --wait-bg: #181c22; --wait-line: #262c34; --wait-pill: #262c34;
  --disc: #2b313a; --disc-small: #343b46; --zzz: #9aa3b0; --heart: #9aa3b0; --gold: #d9b95a;
  --t-attn: #221a19; --t-taste: #1d1d27; --t-call: #1b1f25; --z-left: #181c22; --z-flight: #1a1e25; --z-main: #14171c;
  --shadow: none; --shadow-modal: 0 8px 28px rgba(0, 0, 0, 0.6); --backdrop: rgba(0, 0, 0, 0.6);
}
/* Squarer corners */
[data-style="corporate"] .tile, [data-style="corporate"] .dialog, [data-style="corporate"] .signin-card, [data-style="corporate"] .menubtn,
[data-style="corporate"] .pop, [data-style="corporate"] .spop, [data-style="corporate"] .foldhead, [data-style="corporate"] .fold-item,
[data-style="corporate"] .themectl .tbtn, [data-style="corporate"] .themectl .tseg, [data-style="corporate"] .station,
[data-style="corporate"] .banner, [data-style="corporate"] .optcard, [data-style="corporate"] textarea, [data-style="corporate"] input[type="text"],
[data-style="corporate"] .btn, [data-style="corporate"] .vbtn, [data-style="corporate"] .signin-btn, [data-style="corporate"] .pill,
[data-style="corporate"] .status.big { border-radius: 4px; }
[data-style="corporate"] .themectl .tseg .tbtn, [data-style="corporate"] .prow, [data-style="corporate"] .sopt, [data-style="corporate"] .sseg,
[data-style="corporate"] .badge, [data-style="corporate"] .chip, [data-style="corporate"] .rec, [data-style="corporate"] .thumb { border-radius: 3px; }
[data-style="corporate"] .wait-pill, [data-style="corporate"] .hk-n { border-radius: 4px; }
[data-style="corporate"] .signin-bar { height: 4px; }
/* Denser */
[data-style="corporate"] .tile { padding: 10px 12px 9px; gap: 7px; }
[data-style="corporate"] .station { padding: 8px 14px; gap: 10px; --s: 44px; }
[data-style="corporate"] .station .stage { --s: 44px; }
[data-style="corporate"] .btn { padding: 5px 14px; min-height: 32px; font-size: 0.88rem; }
[data-style="corporate"] .filter, [data-style="corporate"] .menubtn { padding-top: 4px; padding-bottom: 4px; min-height: 38px; }
[data-style="corporate"] .themectl .tbtn { width: 38px; height: 38px; }
[data-style="corporate"] .themectl .tseg .tbtn { width: 30px; height: 32px; }
[data-style="corporate"] .optcard { padding: 9px 12px; }
/* No mascots: a plain initials tile stands in for the bird and critter on stages; birds on cards are dropped */
[data-style="corporate"] .worker, [data-style="corporate"] .critter-slot, [data-style="corporate"] .disc.small, [data-style="corporate"] .zzz,
[data-style="corporate"] img.bird, [data-style="corporate"] img.frbird, [data-style="corporate"] img.kb-act-bird, [data-style="corporate"] .signin-mark { display: none !important; }
[data-style="corporate"] .disc.big { inset: 0; border-radius: 4px; background: var(--sunken); border: 1px solid var(--line); }
[data-style="corporate"] .stage[data-ini]::before { content: attr(data-ini); position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: calc(var(--s) * 0.34); letter-spacing: 0.02em; color: var(--muted); }
[data-style="corporate"] .tm-stage .disc.big { inset: 0; }
/* Agent rows: no initials tile; the row spans the full width */
[data-style="corporate"] .station { grid-template-columns: minmax(0, 1fr); }
[data-style="corporate"] .station > .stage { display: none; }
[data-style="corporate"] .station.done .sdot { background: var(--ok); }
[data-style="corporate"] .heart-inline { display: inline-flex; align-items: center; color: var(--heart); }
[data-style="corporate"] .heart-inline .heart { width: 13px; height: 13px; }
[data-style="corporate"] .teambtn { left: 14px; right: auto; top: auto; bottom: 7px; width: auto; height: 26px; padding: 0 2px; border-radius: 999px; }
[data-style="corporate"] .teambtn:hover { background: transparent; }
[data-style="corporate"] .teampill { position: static; transform: none; box-shadow: none; }
[data-style="corporate"] .stwrap:has(.teambtn:not([hidden])) .station { padding-bottom: 38px; }
[data-style="corporate"] .avatar { border-radius: 4px; }

/* ---------- Queue: bot lanes and the Kanban board ---------- */
.cap-where { flex: none; font-size: 0.68rem; font-weight: 600; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; line-height: 1.5; }
.cap-pool .cap-head { flex-wrap: wrap; row-gap: 2px; }
.cap-pool .cap-name { flex: none; max-width: 100%; }
.kb-max { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.kb-max:hover { background: var(--sunken); color: var(--fg); }
.cap-menu:has(.kb-max) { display: flex; gap: 2px; }
body.phone #flight-wrap:has(.kb-max) .foldhead { padding-right: 100px; }
/* The Kanban board: a full-screen sheet over the page. */
/* Jobs: the queue as a section of its own, the rail beside it on a laptop */
.kb { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--z-main); color: var(--fg); }
body.view-jobs { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
body.view-jobs .layout { flex: 1; min-height: 0; grid-template-rows: auto minmax(0, 1fr); }
body.view-jobs .main, body.view-jobs .flight, body.view-jobs .fl-back { display: none !important; }
@media (min-width: 900px) {
  body.view-jobs .layout { grid-template-rows: minmax(0, 1fr); align-items: stretch; }
}
body.phone.view-jobs .layout { grid-template-rows: minmax(0, 1fr); }
.kb-head { display: flex; align-items: center; gap: 14px; padding: 12px 20px 0; position: relative; flex: none; }
.kb-head h2 { margin: 0; font-size: 1.35rem; }
.kb-seg { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.kb-seg button { font: inherit; font-size: 0.86rem; font-weight: 600; color: var(--muted); background: transparent; border: 0; border-radius: 7px; padding: 5px 14px; min-height: 32px; cursor: pointer; }
.kb-seg button[aria-pressed="true"] { background: var(--ink); color: var(--ink-fg); }
.kb-cols { flex: 1; min-height: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 14px; padding: 16px 20px 20px; overflow-x: auto; overflow-y: hidden; }
.kb-col { display: flex; flex-direction: column; min-height: 0; background: var(--z-flight); border: 1px solid var(--line); border-radius: 14px; transition: box-shadow 0.12s, opacity 0.12s; }
.kb-ch { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; padding: 11px 12px 9px; min-width: 0; }
.kb-ch h3 { margin: 0; font-size: 0.82rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.kb-ch .count { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); }
.kb-nums { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.kb-al { --fc: var(--ok); font-size: 0.72rem; font-weight: 600; color: var(--fc); border: 1px solid currentColor; border-radius: 999px; padding: 0 7px; line-height: 1.5; }
.kb-al.lv-warn { --fc: var(--gold); }
.kb-al.lv-low { --fc: var(--attn); }
.kb-al.lv-none { --fc: var(--muted); }
.kb-al.stale { border-style: dashed; }
.kb-list { list-style: none; margin: 0; padding: 2px 10px 12px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; min-height: 60px; }
.kb-card { cursor: pointer; position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 9px 44px 9px 12px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.kb-card[draggable="true"] { cursor: grab; }
.kb-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.kb-card.active { border-color: color-mix(in srgb, var(--run) 45%, var(--line)); }
.kb-card.dragging { opacity: 0.45; }
.kb-open { font: inherit; font-weight: 600; font-size: 0.92rem; line-height: 1.3; color: var(--fg); background: none; border: 0; padding: 0; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.kb-open:hover { text-decoration: underline; }
/* A short heading: two lines at most (flight.shortTitle cuts long ones; the full title is its hover). */
.kb-open { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
/* Running work: the agent on it and the step it last reported. */
.kb-act { display: flex; flex-direction: column; gap: 2px; min-width: 0; margin-top: 1px; }
.kb-act-who { display: flex; align-items: center; gap: 5px; font-size: 0.75rem; color: var(--muted); line-height: 1.3; min-width: 0; white-space: nowrap; }
.kb-act-bird { width: 20px; height: 20px; object-fit: contain; flex: none; }
.kb-act-crit { width: 16px; height: 16px; object-fit: contain; flex: none; }
.kb-act-name { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--fg); font-weight: 600; }
.kb-act-t { flex: none; color: var(--run); font-weight: 600; }
.kb-act-t::before { content: "\b7"; margin-right: 5px; color: var(--muted); font-weight: 400; }
.kb-act-step { font-size: 0.8rem; line-height: 1.35; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.kb-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 0.8rem; color: var(--muted); min-width: 0; }
.kb-meta > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.kb-st.run { color: var(--run); font-weight: 600; }
.kb-st.next { color: var(--run); }
.kb-why { color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-pin { font-size: 0.7rem; font-weight: 600; border-radius: 999px; padding: 0 7px; line-height: 1.6; background: var(--sunken); color: var(--fg); }
.kb-pin.pri { background: var(--accent); color: var(--accent-fg); }
.kb-move { position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.kb-move:hover, .kb-move[aria-expanded="true"] { background: var(--sunken); color: var(--fg); }
.kb-move svg { width: 18px; height: 18px; fill: currentColor; }
.kb-menu { left: auto; right: 6px; top: 40px; min-width: 210px; z-index: 5; }
.kb-mh { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); padding: 4px 10px 2px; }
.kb-menu button { font: inherit; font-size: 0.92rem; text-align: left; background: none; border: 0; border-radius: 8px; padding: 8px 10px; min-height: 38px; color: var(--fg); cursor: pointer; }
.kb-menu button:hover, .kb-menu button:focus-visible { background: var(--sunken); outline: none; }
.kb-cols.dragging .kb-col.drop-no { opacity: 0.5; }
/* The chief of staff's lane: an even gold outline and a gold tint over the whole column. */
.kb-col.kb-cos { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 9%, var(--z-flight)); }
.kb-cos .kb-ch .cosmark { margin-right: 0; }
.kb-cos .kb-ch .cosmark .star { width: 16px; height: 16px; }
.kb-col.drop-on { box-shadow: 0 0 0 2px var(--accent) inset; }
/* The insertion line: it takes no room (its height and the list gap cancel), so cards never jump under the pointer. */
.kb-slot { list-style: none; height: 3px; margin: -5.5px 0; flex: none; border-radius: 2px; background: var(--accent); }
/* A held card's bots on the rail: their fuel gauges take the drop */
#allow.dragging .fgauge { opacity: 0.45; }
#allow.dragging .fgauge.drop-ok { opacity: 1; outline: 2px dashed var(--accent); outline-offset: 3px; }
#allow.dragging .fgauge.drop-on { background: color-mix(in srgb, var(--accent) 14%, transparent); outline-style: solid; }
.kb-err { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 19; background: var(--ink); color: var(--ink-fg); border-radius: 10px; padding: 9px 16px; font-size: 0.9rem; box-shadow: var(--shadow-modal); max-width: calc(100vw - 32px); }
@media (max-width: 599px) {
  .kb-head { padding: 10px 16px 4px; gap: 10px; }
  .kb-cols { display: flex; flex-direction: column; overflow-x: hidden; overflow-y: auto; padding: 4px 0 24px; gap: 0; }
  .kb-col { background: none; border: 0; border-radius: 0; min-height: auto; flex: none; border-bottom: 1px solid var(--line); }
  .kb-col.kb-cos { border: 0; border-bottom: 1px solid var(--line); }  /* no card on a phone: the tint alone marks it */
  .kb-ch { padding: 12px 16px 6px; }
  .kb-list { overflow: visible; flex: none; padding: 2px 16px 14px; min-height: 0; }
  .kb-list:empty { display: none; }
}

/* ---------- Staff-request cards: their own colour, the requester's initials, "<Name>'s request" ---------- */
:root { --req: #6d3fb0; --req-soft: #efe8f8; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --req: #b794e6; --req-soft: #251d33; } }
:root[data-theme="dark"] { --req: #b794e6; --req-soft: #251d33; }
:root[data-style="corporate"] { --req: #6d3fb0; --req-soft: #efe8f8; }
@media (prefers-color-scheme: dark) { :root[data-style="corporate"]:not([data-theme="light"]) { --req: #b794e6; --req-soft: #251d33; } }
:root[data-style="corporate"][data-theme="dark"] { --req: #b794e6; --req-soft: #251d33; }
.tile.staff_request { --kc: var(--req); background: var(--req-soft); border-color: color-mix(in srgb, var(--req) 40%, var(--line)); }
.rq-head { gap: 10px; }
.avatar.rq-av { width: 34px; height: 34px; font-size: 0.8rem; background: var(--req); color: var(--surface); }
.avatar.has-photo { overflow: hidden; }
.avatar > img.avatar-img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.tile.staff_request .rq-head .kind { font-size: 0.95rem; }
.kb-card.staff-req { background: var(--req-soft); border-color: color-mix(in srgb, var(--req) 40%, var(--line)); }
.kb-pin.req { background: var(--req); color: var(--surface); }
.frow.job.staff-req { background: var(--req-soft); }
.frow .kb-pin.req { align-self: flex-start; }
.frow-tags > * { max-width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frow-tags { display: flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; }

/* One theme control, in the section bar, on every section. */
.vtabs .themectl[data-theme-ctl="desk"] { margin-left: auto; margin-right: 8px; }
.vtabs .themectl[data-theme-ctl="desk"] ~ .hooks-btn { margin-left: 0; }
.vtabs .themectl[data-theme-ctl="desk"] ~ .person { margin-left: 0; }
.vtabs .themectl[data-theme-ctl="desk"] ~ .hooks-btn:not([hidden]) { margin-left: 0; }

/* The top bar carries the project filter (an icon with a dot while it narrows) and the style picker beside the theme control. */
.vtabs #proj-menu { margin-left: auto; }
.vtabs #proj-menu ~ .themectl[data-theme-ctl="desk"] { margin-left: 0; }
.vtabs #proj-menu, .vtabs #preset-menu { margin-right: 8px; }
.vtabs #proj-pop { left: auto; right: 0; }
.projbtn { position: relative; font: inherit; color: var(--fg); cursor: pointer; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.projbtn:hover { background: var(--sunken); }
.projbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.projbtn[aria-expanded="true"], .projbtn.on { border-color: var(--accent); color: var(--accent); }
.projbtn .tico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.projbtn.on .tico { fill: color-mix(in srgb, var(--accent) 22%, transparent); }
.projdot { position: absolute; top: -5px; right: -5px; min-width: 12px; height: 12px; border-radius: 999px; background: var(--accent); color: var(--accent-fg); font-size: 0.66rem; font-weight: 700; line-height: 12px; text-align: center; padding: 0; box-shadow: 0 0 0 2px var(--z-left); }
.projdot:not(:empty) { min-width: 16px; height: 16px; line-height: 16px; padding: 0 4px; top: -7px; right: -7px; }
.vtabs .stylectl { margin-right: 8px; }
.vtabs .jcnt { font-family: var(--font-mono); font-size: 0.78rem; font-weight: 600; opacity: 0.75; }
.vtabs .jcnt:empty { display: none; }
[data-style="corporate"] .projbtn { width: 38px; height: 38px; border-radius: 4px; box-shadow: none; }
@media (max-width: 599px) {
  .vtabs { gap: 2px; }
  .vtabs a { padding: 6px 7px; gap: 5px; }
  .vtabs #proj-menu { margin-right: 4px; }
  .projbtn { width: 40px; height: 40px; }
  .vtabs .themectl[data-theme-ctl="desk"] { margin-right: 0; }
  .vtabs #proj-pop { position: fixed; top: 52px; left: 8px; right: 8px; min-width: 0; }
}
@media (max-width: 399px) {
  .vtabs { padding: 6px 6px; }
  .vtabs a { padding: 6px 5px; gap: 4px; font-size: 0.84rem; }
  .vtabs .cnt { min-width: 18px; padding: 0 5px; }
}

/* The filter popover: search above the projects */
.prows { display: flex; flex-direction: column; gap: 2px; }
.psearch { display: flex; align-items: center; gap: 6px; padding: 2px 8px; margin-bottom: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--sunken); }
.psearch:focus-within { border-color: var(--accent); }
.psearch .tico { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.psearch input { flex: 1; min-width: 0; font: inherit; font-size: 0.92rem; color: var(--fg); background: transparent; border: 0; padding: 8px 0; outline: none; }
.psearch input::-webkit-search-cancel-button { display: none; }
.pclear { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.pclear:hover { background: var(--surface); color: var(--fg); }
.pclear .tico { stroke: currentColor; }

/* Working now vs up next: running work is tinted and locked; queued work has a grip and a Prioritise button */
.kb-card.active { background: color-mix(in srgb, var(--run) 9%, var(--surface)); }
.kb-card.staff-req.active { background: color-mix(in srgb, var(--run) 9%, var(--req-soft)); }
.kb-lock { display: inline-flex; align-items: center; gap: 4px; font-size: 0.72rem; font-weight: 700; color: var(--run); background: color-mix(in srgb, var(--run) 14%, transparent); border-radius: 999px; padding: 0 8px 0 6px; line-height: 1.6; }
.kb-lock svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.kb-sub { list-style: none; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); padding: 4px 2px 0; }
.kb-card.movable { padding-left: 24px; padding-right: 76px; }
.kb-grip { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); width: 10px; height: 16px; color: var(--muted); opacity: 0.6; }
.kb-grip svg { width: 10px; height: 16px; fill: currentColor; display: block; }
.kb-card.movable:hover .kb-grip { opacity: 1; }
.kb-pri { position: absolute; top: 6px; right: 40px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.kb-card:not(.movable) .kb-pri { right: 6px; }
.kb-card.active { padding-right: 44px; }
.kb-pri:hover:not(:disabled) { background: var(--sunken); color: var(--accent); }
.kb-pri:disabled { cursor: not-allowed; opacity: 0.45; }
.kb-pri svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: none) { .kb-grip { display: none; } .kb-card.movable { padding-left: 12px; } }
body.phone .kb-grip { display: none; }
body.phone .kb-card.movable { padding-left: 12px; }
.jobwrap:not(.queued) .nextbtn:disabled { cursor: not-allowed; }
.jobwrap:not(.queued) .frow { padding-right: 52px; }

/* In flight in the top bar below 1600 px (Home only): the panel opens as a drawer */
.vtabs #fl-btn { display: none; margin-right: 8px; }
@media (max-width: 1599px) { body:not(.view-jobs):not(.view-threads) .vtabs #fl-btn { display: flex; } }
@media (max-width: 599px) {
  .vtabs #fl-btn { margin-right: 4px; }
  .vtabs .projbtn, .vtabs .themectl[data-theme-ctl="desk"] .tbtn { width: 36px; height: 36px; border-radius: 10px; }
}
/* Paused (cap 0) and retired lanes */
.kb-paused { font-size: 0.7rem; font-weight: 700; color: var(--muted); background: var(--sunken); border-radius: 999px; padding: 0 7px; line-height: 1.6; }
.kb-retire { width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.kb-retire:hover:not(:disabled) { background: var(--sunken); color: var(--fg); }
.kb-retire svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.kb-retired { position: relative; margin-left: auto; }
.kb-rbtn { font: inherit; font-size: 0.86rem; font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 5px 12px; min-height: 36px; cursor: pointer; }
.kb-rbtn[aria-expanded="true"] { border-color: var(--accent); color: var(--fg); }
.kb-rpop { left: auto; right: 0; min-width: 240px; z-index: 6; }
.kb-rrow { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.kb-rname { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-rrow .btn { min-height: 34px; padding: 4px 12px; }
.kb-pin.lost { background: var(--attn-soft); color: var(--attn); }
.kb-pin.unpushed { background: var(--attn-soft); color: var(--attn); white-space: nowrap; }
.kb-pin.unpushed.guess { background: var(--sunken); color: var(--attn); }
/* The liveness watchdog's flag (api/watchdog.py): solid red, and an even red edge round its card. */
.kb-pin.escalated { background: var(--attn); color: var(--surface); white-space: nowrap; }
.kb-card:has(.kb-pin.escalated) { border-color: var(--attn); }
/* A blocked job (issue #259): held for its bot, with the reason; waiting, not silent. */
.kb-pin.blocked { background: var(--wait-bg); color: var(--fg); border: 1px solid var(--wait-line); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Cancel job (a card's or a queue row's menu) and its confirm; Add job at the top of a column. */
.kb-card.has-menu, .kb-card.has-menu.active { padding-right: 76px; }
.kb-card.has-menu .kb-pri { right: 40px; }
.kb-menu .kb-cancel { color: var(--attn); }
.kb-menu .kb-cancel[aria-disabled="true"] { color: var(--muted); opacity: 0.6; cursor: not-allowed; }
.kb-menu .kb-cancel[aria-disabled="true"]:hover { background: none; }
.kb-menu.kb-confirm { min-width: 220px; gap: 6px; }
.kb-cq { font-weight: 600; padding: 4px 6px 0; }
.kb-crow { display: flex; gap: 6px; }
.kb-menu .kb-crow button { flex: 1; text-align: center; border: 1px solid var(--line); }
.kb-menu .kb-crow .kb-yes { background: var(--attn); border-color: var(--attn); color: var(--surface); font-weight: 600; }
.kb-menu .kb-crow .kb-yes:hover, .kb-menu .kb-crow .kb-yes:focus-visible { background: color-mix(in srgb, var(--attn) 85%, var(--fg)); }
.jobwrap.has-menu .frow { padding-right: 88px; }
.jobwrap.has-menu .nextbtn { right: 46px; }
.qmore { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.qmore:hover, .qmore[aria-expanded="true"] { background: var(--sunken); color: var(--fg); }
.qmore svg { width: 18px; height: 18px; fill: currentColor; }
.q-menu { top: calc(50% + 20px); right: 10px; }
/* Agent columns: one heading row (bird and critter in Playful, name, % left, active/cap, Retire). */
.kb-cols[data-layout="agent"] .kb-ch { flex-wrap: nowrap; }
.kb-cols[data-layout="agent"] .kb-ch h3 { flex: 0 1 auto; min-width: 0; }
.kb-cols[data-layout="agent"] .kb-nums { flex: none; }
.kb-al { border: 0; padding: 0; font-size: 0.78rem; }
.kb-bot { position: relative; flex: none; width: 30px; height: 30px; margin: -4px 0; }
.kb-bird { width: 30px; height: 30px; object-fit: contain; display: block; }
.kb-crit { position: absolute; right: -6px; bottom: -3px; width: 18px; height: 18px; object-fit: contain; }
.kb-bot:has(.kb-crit) { margin-right: 4px; }
[data-style="corporate"] .kb-bot { display: none !important; }
/* SHOW_FLIGHT_PANEL off (app.js): no In flight button, panel or menu fold at any width. */
body.no-flight #fl-btn, body.no-flight .flight, body.no-flight .fl-back, body.no-flight #flight-wrap { display: none !important; }
@media (min-width: 1600px) { body.no-flight .layout { grid-template-columns: minmax(0, 1fr); } }
/* Bot capacity in the Jobs board's header, at its right (after Retired when that shows). */
.kb-head .kb-capmenu { margin: 0 0 0 auto; }
.kb-head .kb-retired + .kb-capmenu { margin-left: 0; }
.kb-retired:has(+ .kb-capmenu) { margin-left: auto; }
/* A bot's Completed: rows in its fold (a comment waiting is flagged), the loading and retry lines. */
.rd-waiting { position: relative; background: var(--attn-soft); }
.rd-waiting .frow { padding-right: 120px; }
.rd-pin { position: absolute; top: 8px; right: 12px; display: inline-flex; align-items: center; gap: 4px; color: var(--attn); }
.rd-pin svg { width: 12px; height: 12px; }
.rd-more { padding: 10px 22px; color: var(--muted); font-size: 0.85rem; }
.rd-retry { margin: 8px 22px 12px; }
.rd-sentinel { height: 1px; }
.kb-hlist .fs { overflow: hidden; }
.kb-hlist .fs .fstate { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* A bot's Completed: a fold at the foot of its column in the Agent view, read when opened. */
.kb-hist, .kb-cmt { flex: none; margin: 0 10px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; min-width: 0; }
/* A bot's Committed fold (Agent view): its cards keep their tint; the fold sits above Completed. */
.kb-cmt .kb-cmtlist { flex: none; max-height: 40vh; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; min-height: 0; padding: 8px; border-top: 1px solid var(--line); }
@media (max-width: 599px) { .kb-cmt .kb-cmtlist { max-height: 60vh; } }
.kb-cmt .kb-cmtlist[hidden] { display: none; }
.kb-hhead { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; font: inherit; font-size: 0.88rem; font-weight: 600; color: var(--fg); background: transparent; border: 0; padding: 8px 12px; cursor: pointer; text-align: left; }
.kb-hhead:hover { background: var(--sunken); }
.kb-hhead[aria-expanded="true"] .chev { transform: rotate(45deg); }
.kb-hflag { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: 0.78rem; font-weight: 600; color: var(--attn); }
.kb-hflag svg { width: 14px; height: 14px; }
.kb-hlist { max-height: 40vh; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; border-top: 1px solid var(--line); }
.kb-hlist[hidden] { display: none; }
.kb-hlist .frow { padding: 6px 12px; min-height: 52px; }
.kb-hlist .rd-waiting .frow { padding-right: 120px; }
.kb-hlist .frwrap:last-child, .kb-hlist .frow:last-child { border-bottom: 0; }
@media (max-width: 599px) { .kb-hist, .kb-cmt { margin: 0 16px 14px; } .kb-hhead { min-height: 48px; } .kb-hlist { max-height: 60vh; } }
/* Add, in each column's heading row: a plain button, visibly clickable. */
.kb-add { flex: none; display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 0 10px 0 8px; border: 1px solid var(--accent); border-radius: 999px; background: var(--surface); color: var(--accent); font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.kb-add:hover, .kb-add:focus-visible { background: var(--accent); color: var(--accent-fg); outline: none; }
.kb-add svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.kb-ch > .kb-add { margin-left: auto; }
@media (max-width: 599px) { .kb-add { min-height: 34px; } }
/* Agent columns carry more in their heading (bird, % left, active/cap, Add, Retire): wider, so the bot's name still reads. */
.kb-cols[data-layout="agent"] { grid-auto-columns: minmax(320px, 1fr); }
.kb-cols[data-layout="agent"] .kb-nums { gap: 6px; }
/* In a bot's history, a note to it or its request to the owner reads lighter than a finished job. */
.kb-hlight .frow, .frow.kb-hlight { background: var(--sunken); }
.kb-hlight .frow .ft, .frow.kb-hlight .ft { font-weight: 500; color: var(--muted); }
.frwrap.kb-hlight { background: var(--sunken); }
/* Staff mode: the non-coding Home board. Lanes by state, a whole-surface tint and an icon per card type. */
body.staff-mode #board-std, body.staff-mode #board-preset, body.staff-mode #ptabs, body.staff-mode #ptabs-preset { display: none !important; }
.modectl { display: flex; align-items: center; margin-right: 8px; }
.modectl .sseg { width: auto; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.modectl .sopt { min-height: 36px; padding: 6px 12px; font-size: 0.88rem; }
body.phone .modectl { margin: 0 0 8px; }
body.phone .modectl .sseg { width: 100%; }
body.phone .modectl .sopt { min-height: 44px; }
.staff-board { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.staff-head { display: flex; justify-content: flex-end; }
.ask { display: flex; gap: 8px; width: 100%; max-width: 560px; }
.ask-in { flex: 1; min-width: 0; font: inherit; font-size: 0.95rem; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; min-height: 44px; }
.ask-in::placeholder { color: var(--muted); }
.ask-in:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ask-go, .st-act { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; text-decoration: none; }
.ask-go { min-height: 44px; }
.ask-go .st-svg, .st-act .st-svg { width: 14px; height: 14px; }
.staff-lanes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 26px 20px; align-items: start; }
@container board (min-width: 900px) { .staff-lanes { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.slane > h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.slane .col { gap: 12px; }
.stile { --stc: var(--call); position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 12px 14px; min-width: 0;
  padding: 14px 16px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--stc) 24%, var(--line));
  background: color-mix(in srgb, var(--stc) var(--st-mix), var(--surface)); color: var(--fg); box-shadow: var(--shadow); font: inherit; text-align: left; }
.stile.st-email { --stc: var(--accent); }
.stile.st-event { --stc: var(--p-ochre); }
.stile.st-document, .stile.st-find { --stc: var(--ok); }
.stile.st-approval { --stc: var(--taste); }
.stile.clickable { cursor: pointer; }
.stile.clickable:hover { border-color: color-mix(in srgb, var(--stc) 60%, var(--line)); }
.stile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.st-ico { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--stc) 18%, var(--surface)); color: color-mix(in srgb, var(--stc) 75%, var(--fg)); }
.st-svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.st-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.st-title { margin: 0; font-size: 1rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.st-sub { font-size: 0.85rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-act { min-height: 36px; padding: 6px 14px; font-size: 0.88rem; }
.stile .err { grid-column: 2 / -1; }
.stile.saving .saving-veil { border-radius: inherit; }
.st-find { border-style: dashed; box-shadow: none; background: color-mix(in srgb, var(--stc) 4%, var(--surface)); cursor: default; }
.st-find .st-title { color: var(--muted); }
.st-find:disabled { opacity: 1; }
body.phone .stile { grid-template-columns: 40px minmax(0, 1fr); }
body.phone .stile .st-act { grid-column: 2; justify-self: start; min-height: 44px; }
body.phone .staff-head { justify-content: stretch; }
body.phone .ask { max-width: none; }
[data-style="corporate"] .stile, [data-style="corporate"] .ask-in, [data-style="corporate"] .modectl .sseg { border-radius: 4px; }
[data-style="corporate"] .st-ico { border-radius: 4px; }
[data-style="corporate"] .stile { padding: 10px 12px; }
:root { --st-mix: 8%; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --st-mix: 14%; } }
:root[data-theme="dark"] { --st-mix: 14%; }
.slane .col { container-type: inline-size; }
@container (max-width: 360px) {
  .stile { grid-template-columns: 40px minmax(0, 1fr); }
  .stile .st-act { grid-column: 2; justify-self: start; }
}


/* ---------- Committed: finished work not closed yet. A full tint, an even border all round and a pill ---------- */
:root { --cmt: #4a58a8; --cmt-fg: #ffffff; --cmt-soft: #eceefa; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --cmt: #a3adf0; --cmt-fg: #15120e; --cmt-soft: #1d2033; } }
:root[data-theme="dark"] { --cmt: #a3adf0; --cmt-fg: #15120e; --cmt-soft: #1d2033; }
.tile.committed { background: var(--cmt-soft); border-color: color-mix(in srgb, var(--cmt) 40%, var(--line)); box-shadow: none; }
.kb-card.committed { background: var(--cmt-soft); border-color: color-mix(in srgb, var(--cmt) 40%, var(--line)); box-shadow: none; }
.frow.committed { background: var(--cmt-soft); }
.frow.committed:hover { background: color-mix(in srgb, var(--cmt) 12%, var(--cmt-soft)); }
.cmt-pill { font-size: 0.78rem; font-weight: 600; color: var(--cmt-fg); background: var(--cmt); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.cmt-pill.kb-pin, .cmt-pill.fstate { font-size: 0.7rem; padding: 0 7px; line-height: 1.6; align-self: flex-start; }
.st.committed { color: var(--cmt); }
.kb-card .links.prs, .tile .links.prs { gap: 6px; margin-top: 4px; }
.kb-card .links.prs .chip { font-size: 0.75rem; padding: 2px 8px; }
[data-style="corporate"] .cmt-pill { border-radius: 4px; }

/* ---------- Child jobs, hand-offs, and an ask with no job yet (the error token, as a tint and a pill) ---------- */
.tile.unjobbed { background: var(--attn-soft); border-color: color-mix(in srgb, var(--attn) 45%, var(--line)); box-shadow: none; }
.frow.unjobbed { background: var(--attn-soft); }
.nojob-pill { font-size: 0.78rem; font-weight: 600; color: #fff; background: var(--attn); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.cos-pill { font-size: 0.78rem; font-weight: 600; color: var(--fg); background: color-mix(in srgb, var(--req) 24%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--req) 55%, transparent); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.kb-meta .cos-pill, .src .cos-pill { font-size: 0.7rem; padding: 0 8px; line-height: 1.6; }
.cos-pill.fstate { font-size: 0.7rem; padding: 0 7px; line-height: 1.6; align-self: flex-start; }
.fs .cos-pill.fstate, .kb-hlist .fs .cos-pill.fstate { flex: none; overflow: visible; }
.fs:has(.cos-pill) { flex-wrap: wrap; row-gap: 4px; }
.nojob-pill.fstate { font-size: 0.7rem; padding: 0 7px; line-height: 1.6; align-self: flex-start; }
[data-style="corporate"] .nojob-pill { border-radius: 4px; }
.kids, .links.followup { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.kids-n { font-size: 0.8rem; font-weight: 600; }
.kids-n.all { color: var(--ok); }
.kids .chip.kid, .links.followup .chip { font-size: 0.75rem; padding: 2px 8px; }
.kids-n { flex-basis: 100%; }
.kids .chip.kid.done { opacity: 0.7; }
.kids .chip.kid.done::before { content: "\2713\00a0"; color: var(--ok); }
.links.followup .fu-k { font-size: 0.75rem; font-weight: 600; }
.links.followup .chip.fu-link { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.links.followup .fu-st { font-size: 0.75rem; opacity: 0.75; }

/* Corporate: empty states use a plain line icon (no mascot art, no zzz); a working station shows its label with an ellipsis instead of the status dot. */
[data-style="corporate"] .doze { width: 36px; height: 36px; }
[data-style="corporate"] .doze-img, [data-style="corporate"] .doze .zzz { display: none !important; }
[data-style="corporate"] .doze::before { content: ""; display: block; width: 100%; height: 100%; background-color: var(--muted); opacity: 0.7;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 13l3-8h12l3 8v6H3z'/%3E%3Cpath d='M3 13h5l1 3h6l1-3h5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 13l3-8h12l3 8v6H3z'/%3E%3Cpath d='M3 13h5l1 3h6l1-3h5'/%3E%3C/svg%3E") center / contain no-repeat; }
[data-style="corporate"] .tile.empty { min-height: 120px; gap: 8px; }
[data-style="corporate"] .station.working .sdot { display: none; }
[data-style="corporate"] .station.working .step::after { content: "\2026"; }

.related { margin: 6px 0; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 0.9em; }
.related summary { cursor: pointer; }
.related-row { padding: 4px 0; }

/* A job's GitHub issues on its card: one row each, state dot first. */
.issues { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.issue { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; font-size: 0.85rem; }
.issue .dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--muted, #8a8f98); align-self: flex-start; margin-top: 0.45em; }
.issue.open .dot { background: var(--ok, #2da44e); }
.issue.closed .dot { background: transparent; box-shadow: inset 0 0 0 2px var(--muted); }
.issue .link { color: var(--accent); flex: none; font-size: 0.78rem; text-decoration: none; }
.issue .link:hover { text-decoration: underline; }
.issue .ititle { flex: 1 1 16ch; min-width: 0; overflow-wrap: anywhere; }
.issue.tracker .ititle { font-weight: 600; }

/* Settings > Chief of staff and Agents (web/agents.js), and the Add new agent column on Jobs > Agents.
   Even borders and tints only. */
.set-dlg .ag-sect { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.set-dlg .hk-hrow .hk-more { margin-left: auto; }
.ag-cos { font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-height: 44px; width: 100%; }
.ag-connect { text-decoration: none; }
.hk-claude { align-self: flex-start; margin: 0 0 8px; padding: 4px 0; font: inherit; font-size: 0.85rem; font-weight: 600; color: var(--accent); background: transparent; border: 0; cursor: pointer; }
.hk-claude:hover { text-decoration: underline; }
.ag-list .hk-row { padding: 6px 8px; }
.ag-row.cos { background: var(--sunken); border-radius: 10px; }
.ag-pill { flex: none; font-size: 0.75rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; color: var(--fg); background: color-mix(in srgb, var(--gold) 22%, transparent); }
.ag-check { display: inline-flex; align-items: center; gap: 8px; align-self: flex-end; min-height: 38px; font-size: 0.92rem; color: var(--fg); cursor: pointer; }
.ag-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.ag-name { font-family: var(--font-mono); font-size: 0.82rem; color: var(--muted); overflow-wrap: anywhere; }
.ag-copy { display: flex; gap: 8px; min-width: 0; }
.ag-copy input { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 0.82rem; }
.ag-confirm { display: flex; gap: 6px; flex: none; }
.btn.ag-danger { background: var(--attn); border-color: var(--attn); color: #fff; }
.ag-form > input[type=text] { font: inherit; width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--fg); min-height: 44px; }
.kb-col.kb-addcol { background: transparent; border: 1px dashed var(--line); align-items: stretch; justify-content: center; min-height: 160px; }
.kb-addbtn { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; color: var(--muted); background: transparent; border: 0; border-radius: 14px; cursor: pointer; min-height: 160px; }
.kb-addbtn:hover, .kb-addbtn:focus-visible { color: var(--fg); background: var(--sunken); }
.kb-addbtn .ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
body.phone .ag-confirm .btn, body.phone .ag-copy .btn { min-height: 44px; }
body.phone .set-dlg .hk-form { padding: 12px 0 4px; }
body.phone .ag-row.cos { border-radius: 8px; }
.set-dlg .hk-form { margin-top: 0; }
@media (max-width: 599px) {
  .kb-col.kb-addcol { border: 0; min-height: auto; }
  .kb-addbtn { flex-direction: row; justify-content: flex-start; min-height: 56px; padding: 0 16px; border-radius: 0; }
}
/* Job progress feed (a job card on the Jobs board opens it): updates newest first */
.dialog.feed-dlg { max-width: 640px; }
.feed-dlg .mtitle { font-size: 1.4rem; }
.feed-dlg .fd-now { color: var(--fg); font-size: 0.92rem; overflow-wrap: anywhere; min-width: 0; }
.feed-dlg .fd-open, .feed-dlg .fd-more { align-self: flex-start; min-height: 44px; }
.fd-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.fd-row { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; border-top: 1px solid var(--line); min-width: 0; }
.fd-row:first-child { border-top: 0; padding-top: 4px; }
.fd-top { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.fd-head { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.fd-crit { flex: none; width: 28px; height: 28px; object-fit: contain; align-self: flex-start; }
[data-style="corporate"] .fd-crit { display: none; }
.fd-when { flex: none; font-size: 0.82rem; color: var(--muted); white-space: nowrap; }
.fd-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.fd-line { font-size: 0.9rem; color: var(--muted); overflow-wrap: anywhere; }
.fd-empty { margin: 0; color: var(--muted); }
@media (max-width: 600px) {
  .modal:has(.feed-dlg) { padding: 0; align-items: stretch; }
  .dialog.feed-dlg { max-width: none; min-height: 100%; border-radius: 0; box-shadow: none; padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px)); margin: 0; }
  .feed-dlg .fd-top { flex-wrap: wrap; align-items: center; gap: 2px 10px; }
  .feed-dlg .fd-when { flex-basis: 100%; }
}
/* Jobs in Coder mode on a phone: the page scrolls as one. */
body.phone.view-jobs.home-folded { display: block; height: auto; overflow: visible; }
body.phone.view-jobs.home-folded .layout { display: block; }
body.phone.view-jobs.home-folded .kb-cols { overflow: visible; }
/* Tasks mode (#277): Home's own panels inside the Jobs board, scrolling under its header. */
.kb-tasks { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px 72px; }
body.phone .kb-tasks { flex: none; overflow: visible; padding: 4px calc(var(--safe-r) + 16px) calc(var(--safe-b) + 40px) calc(var(--safe-l) + 16px); }
body.phone .kb-tasks .content { gap: 18px; }
/* A dialog holds the page still: the folded phone page scrolls as one, which noscroll must outrank,
   or a drag on the dialog scrolls the page behind it and its options and Send are never reached. */
body.phone.view-jobs.home-folded.noscroll { overflow: hidden; }
/* Health (#279): the button beside the filter icon, and its modal with the allowance gauges,
   the health checks and every agent (the old side rail's contents). */
.vtabs .hbtn { margin-right: 8px; }
.projdot.hlv.lv-warn { background: var(--gold); }
.projdot.hlv.lv-bad { background: var(--attn); }
.hmodal { z-index: 19; }
.hdlg { gap: 12px; }
.hdlg .mtitle { margin: 0; }
.hdlg #allow, .hdlg #health { padding: 0; }
.hdlg #allow .fg-tip { left: 0; right: 0; }
.hdlg .hm-agents { gap: 6px; }
.hdlg .hm-agents .sub { margin: 4px 0 0; display: flex; align-items: baseline; gap: 8px; }
.hdlg .hm-agents .count { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 500; color: var(--muted); }
.hdlg .rail { flex-direction: column; overflow: visible; padding: 0; gap: 0; scroll-snap-type: none; margin: 0 -28px; }
@media (max-width: 899px) {
  .hdlg .rail { margin: 0; gap: 10px; }
  .hdlg .stwrap, .hdlg .rail .station { flex: none; width: 100%; }
  .hdlg .rhead { align-self: flex-start; }
  .hdlg .runsubs { max-width: none; }
}
/* New task: in the Jobs board's header, after the layout switch. */
.kb-head .newtask { margin: 0; width: auto; min-height: 36px; }
@media (max-width: 599px) {
  .kb-head { flex-wrap: wrap; gap: 8px; }
  .kb-head .newtask { padding-inline: 12px; }
  .vtabs .hbtn { margin-right: 2px; }
  body.phone .vtabs .mmenubtn { position: relative; width: 40px; }
  .vtabs .mmenubtn .projdot { top: 2px; right: -2px; }
  .hmodal { padding: 0; align-items: stretch; }
  .hdlg { max-width: none; min-height: 100%; border-radius: 0; box-shadow: none; padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px)); margin: 0; }
}
/* A bot's name on its Agent view column opens its agent window. */
.kb-who { font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 4px; }
.kb-who:hover { text-decoration: underline; }
.kb-who:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* The bell: an icon in the top bar; on a phone a row in the menu, named. */
.pend-lbl { display: none; }
body.phone .md-body .pendbtn { width: 100%; min-height: 48px; margin: 0; padding: 0 12px; border-radius: 12px; justify-content: flex-start; gap: 10px; background: var(--surface); border: 1px solid var(--line); }
body.phone .md-body .pendbtn[hidden] { display: none; }
body.phone .md-body .pend-lbl { display: inline; font-weight: 600; margin-right: auto; }
.vtabs .hbtn, .vtabs #proj-btn, .vtabs .mmenubtn { flex: none; }
@media (max-width: 399px) { .vtabs .projbtn { width: 38px; height: 38px; } body.phone .vtabs .mmenubtn { width: 36px; } .vtabs #proj-menu { margin-right: 2px; } .vtabs .hbtn { margin-right: 0; } }
.pend-clear { margin: 6px 14px 10px; min-height: 40px; align-self: flex-start; }
.clear-btn { min-height: 40px; }

.cday { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.cday input { flex: 1; min-width: 0; font: inherit; font-size: 0.92rem; color: var(--fg); background: var(--sunken); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.cday button { font: inherit; min-height: 40px; min-width: 40px; padding: 0 10px; color: var(--fg); background: var(--sunken); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.cday button:focus-visible, .cday input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
