:root {
  --pre: #f0c00c; --pre-ink: #7a5a00; --pre-soft: #fdf5d2; --ret: #243c80; --ret-soft: #e6ebf6;
  --bg: #f4f5f7; --panel: #ffffff; --text: #1d2330; --muted: #667085; --line: #e3e6ec;
  --accent: #243c80; --accent-soft: #e6eef9; --good: #1e7a46; --good-soft: #e3f4ea;
  --warn: #9a6200; --warn-soft: #fdf3dc; --bad: #a12c2c; --bad-soft: #fbe6e6;
  --gold: #b07d12; --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b; --panel: #1b1f27; --text: #e6e9ef; --muted: #9aa3b2; --line: #2b313c;
    --accent: #7aa7e6; --accent-soft: #1f2c40; --good: #5cc48a; --good-soft: #17301f;
    --warn: #e2b04a; --warn-soft: #33290f; --bad: #ef7f7f; --bad-soft: #3a1c1c;
    --gold: #e2b04a; --shadow: none; color-scheme: dark;
    --pre: #f0c00c; --pre-ink: #f4cf45; --pre-soft: #3a300a; --ret: #5b8fd6; --ret-soft: #1f2c40;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--accent); text-decoration: none; }
h1, h2 { margin: 0; }
.muted, .sub, .note { color: var(--muted); }

.topbar { display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: var(--panel);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 16px; color: var(--text); }
.links { margin-left: auto; display: flex; gap: 14px; align-items: center; }
.links a { color: var(--muted); } .links a.on { color: var(--text); font-weight: 600; }
.sync-note { color: var(--muted); font-size: 12px; white-space: nowrap; }
.btn.refresh { padding: 4px 10px; }
.btn.refresh[disabled] { opacity: .6; cursor: progress; }
.who { color: var(--muted); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.side { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--muted);
  padding: 12px 16px; font: inherit; font-size: 18px; font-weight: 600; cursor: pointer; text-align: center; }
.side span { display: block; font-size: 12px; font-weight: 400; margin-top: 2px; }
.side.prehire.on { background: var(--pre); border-color: var(--pre); color: #1d2330; }
.side.prehire.on span { color: #3d3420; }
.side.retained.on { background: var(--ret); border-color: var(--ret); color: #fff; }
body[data-side=prehire] .side-panel { border-top: 4px solid var(--pre); }
body[data-side=retained] .side-panel { border-top: 4px solid var(--ret); }
body[data-side=prehire] .chip.on { background: var(--pre-soft); border-color: var(--pre); }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.rail { position: sticky; top: 72px; max-height: calc(100vh - 92px); }
.rail .badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; color: #fff; }
.badge.prehire { background: var(--pre); color: #1d2330; } .badge.retained { background: var(--ret); } .badge.lost { background: var(--muted); }
.rail h3 { margin: 6px 0 2px; font-size: 18px; }
.rail dl { display: grid; grid-template-columns: 100px 1fr; gap: 4px 8px; margin: 12px 0; }
.rail dt { color: var(--muted); } .rail dd { margin: 0; overflow-wrap: anywhere; }
.rail .money { display: flex; gap: 16px; margin: 10px 0; }
.rail .money div { flex: 1; background: var(--bg); border-radius: 8px; padding: 8px; }
.rail .money b { display: block; font-size: 16px; }
.tabs { display: inline-flex; gap: 2px; margin-left: 8px; }
.tabs button { border: 0; background: none; color: var(--muted); font: inherit; padding: 2px 8px; border-radius: 6px; cursor: pointer; }
.tabs button.on { background: var(--bg); color: var(--text); font-weight: 600; }
#tl-filter { margin-bottom: 8px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 12px 22px; }
.timeline .dot { position: absolute; left: -12px; top: 0; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; color: #fff; background: var(--muted); }
.dot.email { background: #a8357a; } .dot.call { background: #2e7d6b; } .dot.text { background: #6a4bb3; }
.dot.update, .dot.sync { background: #c2410c; } .dot.money { background: var(--good); } .dot.time { background: #312e81; }
.dot.sign { background: #4a7fb5; } .dot.file, .dot.form { background: #b8860b; } .dot.task, .dot.calendar { background: var(--accent); }
.dot.note { background: #64748b; }
.timeline .t-title { font-weight: 600; }
.timeline .t-meta { color: var(--muted); font-size: 12px; }
.timeline .t-line { white-space: pre-wrap; overflow-wrap: anywhere; }
.timeline .t-body { max-height: 6em; overflow: hidden; color: var(--muted); font-size: 13px; white-space: pre-wrap; cursor: pointer; }
.timeline .t-body.open { max-height: none; }
.timeline .chips { margin: 4px 0 0; }
.rail.maxed .timeline .t-body { max-height: 12em; }
.cal-day { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; margin: 8px 0 2px; }
.cal-ev { display: grid; grid-template-columns: 76px 1fr; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.cal-ev .t { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; padding-top: 1px; }
.cal-ev .w { font-weight: 600; } .cal-ev .loc, .cal-ev .cal { color: var(--muted); font-size: 12px; }
.mail li { cursor: pointer; } .mail li.unread .s { font-weight: 700; }
#email li { flex-direction: column; gap: 0; cursor: pointer; }
#email li .row { display: flex; gap: 8px; width: 100%; } #email li .f { font-weight: 600; }
#email li.unread .f::before { content: "● "; color: var(--accent); }
#email li .s { color: var(--muted); }
.mail-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; border-top: 1px solid var(--line); padding-top: 8px; }
.clickable { cursor: pointer; } .clickable:hover td { background: var(--bg); }
tr.picked td { background: var(--accent-soft); }
.search { flex: 1; min-width: 180px; max-width: 360px; padding: 7px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; }

main { padding: 16px 20px 40px; max-width: 1600px; margin: 0 auto; }
.banner { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; }
.results { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; padding: 8px 14px; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px;
  box-shadow: var(--shadow); min-height: 220px; max-height: 420px; display: flex; flex-direction: column; overflow: hidden; }
.panel.wide { grid-column: span 2; }
.panel.full { grid-column: 1 / -1; max-height: none; }
.panel > header { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.panel h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.panel .max { margin-left: auto; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; }
.panel > :not(header) { overflow: auto; }
.panel.maxed { position: fixed; inset: 60px 20px 20px; z-index: 10; max-height: none; }
.empty { color: var(--muted); padding: 20px 4px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 2px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .when { margin-left: auto; color: var(--muted); white-space: nowrap; font-size: 12px; }
.list .overdue .when { color: var(--bad); font-weight: 600; }
.feed li { flex-direction: column; gap: 2px; }
.feed .meta { color: var(--muted); font-size: 12px; }
.feed .body { white-space: pre-wrap; max-height: 4.5em; overflow: hidden; }

.inline-form { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.inline-form input, .inline-form select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); color: var(--text); font: inherit; min-width: 0; }
.inline-form input[name=task] { flex: 1; }
.inline-form.stack { flex-direction: column; margin-top: 14px; }
.btn { padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg);
  color: var(--text); font: inherit; cursor: pointer; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); display: inline-block; padding: 10px 18px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; background: var(--bg);
  color: var(--text); font: inherit; font-size: 12px; cursor: pointer; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); }
.chip b { margin-left: 4px; }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.table td { padding: 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table tr.refund td.num { color: var(--bad); }
.table tr.failed td { color: var(--muted); text-decoration: line-through; }
.tag { font-size: 11px; color: var(--muted); }

.billing { display: grid; grid-template-columns: 260px 1fr 1fr; gap: 20px; }
.billing .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.billing .big { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; }
.billing .split { color: var(--muted); font-size: 12px; margin: 4px 0 10px; }
.history { list-style: none; padding: 0; margin: 0; }
.history li { display: grid; grid-template-columns: 110px 1fr 80px; gap: 6px; align-items: center; font-size: 12px; padding: 2px 0; }
.history .bar { height: 8px; background: var(--accent-soft); border-radius: 4px; overflow: hidden; }
.history .bar i { display: block; height: 100%; background: var(--accent); }
.history .amt { text-align: right; font-variant-numeric: tabular-nums; }

.board .thermos { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.thermo { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.t-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.t-bar { height: 22px; background: var(--bg); border-radius: 11px; margin: 10px 0; overflow: hidden; border: 1px solid var(--line); }
.t-fill { height: 100%; width: 0; background: var(--pre); transition: width .6s; }
.t-fill.mid { background: var(--accent); } .t-fill.high, .t-fill.done { background: var(--good); }
.thermo { display: grid; grid-template-columns: 1fr auto; align-items: end; }
.t-bar, .t-foot { grid-column: 1 / -1; }
.t-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.t-bar { position: relative; }
.t-bar i { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.t-foot { display: flex; justify-content: space-between; color: var(--muted); font-variant-numeric: tabular-nums; }
.quarter .total.sub { border: 0; margin-top: 0; padding-top: 2px; font-weight: 400; color: var(--muted); }
.quarters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.quarter { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.quarter.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.quarter h3 { margin: 0 0 8px; font-size: 15px; display: flex; justify-content: space-between; }
.quarter h3 span { color: var(--muted); font-weight: 400; font-size: 12px; }
.quarter ol { list-style: none; margin: 0; padding: 0; }
.quarter li { display: flex; justify-content: space-between; padding: 3px 6px; border-radius: 5px; font-variant-numeric: tabular-nums; }
.quarter li .n { color: var(--muted); width: 28px; }
.quarter li.goal { background: var(--good-soft); color: var(--good); }
.quarter li.best { background: var(--warn-soft); color: var(--gold); font-weight: 700; }
.quarter li.now { outline: 1px dashed var(--accent); }
.quarter li.blank .v { color: var(--muted); }
.quarter .total { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; display: flex; justify-content: space-between; font-weight: 700; }

.login { display: grid; place-items: center; min-height: 100vh; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 32px; text-align: center; width: min(360px, 92vw); }
.alert { background: var(--bad-soft); color: var(--bad); padding: 8px 10px; border-radius: 6px; }

@media (max-width: 1100px) {
  .workspace { grid-template-columns: 1fr; } .rail { position: static; max-height: none; }
  .grid { grid-template-columns: 1fr 1fr; } .panel.wide { grid-column: 1 / -1; }
  .billing { grid-template-columns: 1fr; } .quarters { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .inline-form input[name=task] { flex-basis: 100%; }
  main { padding: 12px 16px 32px; }
  .grid, .quarters, .board .thermos { grid-template-columns: 1fr; }
  .side { font-size: 15px; padding: 10px; }
  .panel.maxed { inset: 8px; }
}
.panel.side-panel { max-height: 520px; }
.panel > header, .chips, .inline-form { flex-shrink: 0; }

/* ---- case view and intake forms ---- */
.btn.small { padding: 3px 10px; font-size: 13px; }
.btn.primary.small { display: inline-block; padding: 4px 12px; margin-left: 8px; }
.btn[disabled] { opacity: .6; cursor: progress; }
#p-work { max-height: none; }
#p-work #list-view { display: flex; flex-direction: column; max-height: 520px; overflow: hidden; }
#p-work #list-view .table-scroll { overflow: auto; }
#p-work header { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
#p-work header .max { margin-left: auto; }
.side-switch { margin-top: 0; }
#p-work.maxed #list-view { max-height: none; height: 100%; }
.case-head { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.case-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.case-title h2 { font-size: 20px; text-transform: none; letter-spacing: 0; color: var(--text); }
.case-tabs { display: flex; flex-wrap: wrap; gap: 2px; margin: 0 0 12px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.case-tabs button { padding: 5px 12px; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px 24px; }
.detail-grid section { break-inside: avoid; }
.detail-grid h4, .lm-heading { margin: 4px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.kv { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; gap: 4px 10px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.addr { white-space: pre-line; }
.form-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.lm-form { display: flex; flex-direction: column; gap: 8px; }
.lm-row { display: grid; grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr)); gap: 8px 14px; }
.lm-row:has(> .lm-heading) { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.lm-field { display: flex; flex-direction: column; gap: 3px; }
.lm-field[hidden] { display: none; }
.lm-label { font-size: 12px; color: var(--muted); } .lm-label .req { color: var(--bad); }
.lm-field input, .lm-field select, .lm-field textarea { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); color: var(--text); font: inherit; width: 100%; }
.lm-field .ro { padding: 6px 0; color: var(--muted); }
.form-actions { position: sticky; bottom: 0; display: flex; gap: 8px; justify-content: flex-end; align-items: center;
  background: var(--panel); border-top: 1px solid var(--line); padding: 10px 0 2px; margin-top: 12px; }
.form-actions .sub { margin-right: auto; }
@media (max-width: 700px) { .lm-row { grid-template-columns: 1fr; } .kv { grid-template-columns: 1fr; } }
[hidden] { display: none !important; }
.multi { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 4px 0; }
.multi .check { display: inline-flex; gap: 5px; align-items: center; font-size: 13px; }
.multi .check input { width: auto; }
.stage-pick { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; margin-left: auto; }
.stage-pick select { padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; }
.lm-links { display: inline-flex; gap: 6px; flex-wrap: wrap; }
a.btn { text-decoration: none; display: inline-block; }
a.btn.primary { color: #fff; }
.danger-zone { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.btn.danger { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); }
.review-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.review-tools select { padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }
tr.dup td { background: var(--warn-soft); }
.dup-of { font-size: 13px; }
#list-mode b { font-weight: 700; color: var(--pre-ink); }

/* ---- email reader ---- */
.reader { position: fixed; inset: 56px 0 0 0; z-index: 20; background: var(--bg); overflow: auto; padding: 14px 20px 40px; }
body.reading main { visibility: hidden; }
.reader-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; position: sticky; top: -14px; background: var(--bg); padding: 8px 0; }
.reader-bar #reader-webmail { margin-left: auto; }
.reader-head { max-width: 900px; margin: 10px auto 12px; }
.reader-head h2 { font-size: 20px; text-transform: none; letter-spacing: 0; color: var(--text); margin-bottom: 6px; }
.reader-text { max-width: 900px; margin: 0 auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 18px 22px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.reader-html { display: block; width: 100%; max-width: 900px; margin: 0 auto; height: calc(100vh - 240px); border: 1px solid var(--line);
  border-radius: 10px; background: #fff; }
.reader-note { max-width: 900px; margin: 6px auto; }
#reader-mode button[disabled] { opacity: .4; cursor: default; }
.reader { visibility: visible; }

/* ---- composer ---- */
.composer .reader-bar strong { font-size: 15px; }
.composer #cmp-status { margin-left: auto; }
.cmp-body { max-width: 900px; margin: 10px auto; display: flex; flex-direction: column; gap: 8px; }
.cmp-row { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 8px; color: var(--muted); }
.cmp-row input, .cmp-ai input, #cmp-text { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel); color: var(--text); font: inherit; width: 100%; }
#cmp-text { min-height: 300px; resize: vertical; line-height: 1.5; }
.cmp-ai { display: flex; gap: 8px; } .cmp-ai input { flex: 1; }
.cmp-files { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cmp-files .file { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: 12px; }
.cmp-files .file button { border: 0; background: none; color: var(--muted); cursor: pointer; }
.cmp-sig pre, .cmp-quote pre { white-space: pre-wrap; font: inherit; font-size: 13px; color: var(--muted); max-height: 300px; overflow: auto; }
body.reading .composer { visibility: visible; }
#mail-folders { margin-left: 4px; }
#p-email > header { flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 8px; }
.brand img { border-radius: 4px; background: #fff; }
.login-logo { display: block; margin: 0 auto 10px; border-radius: 6px; background: #fff; }
.feed li.connect { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; }

/* ---- document preview ---- */
#doc-viewer #doc-note { margin-left: auto; }
.doc-body { max-width: 1000px; margin: 10px auto; }
.doc-frame { display: block; width: 100%; height: calc(100vh - 140px); border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.doc-img { display: block; max-width: 100%; margin: 0 auto; border-radius: 8px; }
body.reading #doc-viewer { visibility: visible; }

/* ---- accordion under the Pre-hire / Hired buttons ---- */
.side { position: relative; }
.side .caret { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-style: normal; opacity: .8; }
.side .caret::before { content: "▸"; }
body.work-open .side.on .caret::before { content: "▾"; }
body:not(.work-open) .side.prehire.on { background: var(--pre-soft); color: var(--pre-ink); border-color: var(--pre); }
body:not(.work-open) .side.retained.on { background: var(--ret-soft); color: var(--ret); border-color: var(--ret); }
body:not(.work-open) .side-switch { margin-bottom: 14px; }
.grid + .grid, .grid + article, article + .grid { margin-top: 14px; }

/* ---- email delete ---- */
#email li .trash { margin-left: 6px; border: 0; background: none; cursor: pointer; opacity: 0; font-size: 13px; padding: 0 2px; }
#email li:hover .trash, #email li .trash:focus { opacity: .7; }
#email li .trash:hover { opacity: 1; }
@media (hover: none) { #email li .trash { opacity: .6; } }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 40; background: var(--text); color: var(--bg);
  padding: 10px 14px; border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,.2); display: flex; gap: 10px; align-items: center; }
.toast .btn { background: transparent; color: var(--bg); border-color: rgba(255,255,255,.4); }

/* ---- logo: full wordmark in light mode, mark + white text in dark mode ---- */
.brand .brand-full { display: block; height: 34px; width: auto; }
.brand .brand-dark { display: none; align-items: center; gap: 8px; }
.login-logo.brand-full { display: block; width: min(300px, 80%); height: auto; margin: 0 auto 14px; background: none; }
.login h1.brand-dark, .login-logo.brand-dark { display: none; }
@media (prefers-color-scheme: dark) {
  .brand .brand-full, .login-logo.brand-full { display: none; }
  .brand .brand-dark { display: inline-flex; }
  .login h1.brand-dark { display: block; } .login-logo.brand-dark { display: block; margin: 0 auto 10px; }
}
.brand .brand-full { height: 46px; }
.topbar { padding-top: 6px; padding-bottom: 6px; }
body:not(.work-open) .side.prehire.on span { color: inherit; opacity: .85; }
.timeline { margin-left: 14px; }

/* ---- Tasks | Texts ---- */
#p-tasks > header { flex-wrap: wrap; }
.badge-count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--bad); color: #fff;
  font-size: 11px; line-height: 18px; text-align: center; font-weight: 700; }
.texts li { flex-direction: column; gap: 0; cursor: pointer; }
.texts li .row { display: flex; gap: 8px; width: 100%; } .texts li .f { font-weight: 600; }
.texts li .s { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.texts li.unread .s { color: var(--text); font-weight: 600; }
.thread-view { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.thread-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 8px; flex-wrap: wrap; }
.thread-to { display: flex; gap: 8px; align-items: center; color: var(--muted); margin-bottom: 8px; }
.thread-to input { flex: 1; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; }
.thread { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 6px; padding: 4px 2px; min-height: 120px; }
.bubble { max-width: 80%; padding: 7px 11px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.in { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble.out { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.bubble .meta { font-size: 11px; opacity: .7; margin-top: 2px; }
.thread-reply { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.thread-reply textarea { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; resize: vertical; }
.thread-actions { display: flex; align-items: center; gap: 8px; } .thread-actions .sub { margin-right: auto; }
#p-tasks #texts-body { display: flex; flex-direction: column; min-height: 0; flex: 1; }
#p-tasks #texts-body[hidden] { display: none; }

/* ---- Tasks | Texts switch: two half-width colored buttons ---- */
#p-tasks > header.tt-head { display: flex; flex-direction: column; align-items: stretch; gap: 6px; margin-bottom: 8px; }
.tt-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tt-switch .tt { border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; font: inherit; font-weight: 600;
  font-size: 15px; cursor: pointer; text-align: center; }
.tt.tasks { background: var(--ret-soft); color: var(--ret); border-color: var(--ret-soft); }
.tt.texts { background: var(--pre-soft); color: var(--pre-ink); border-color: var(--pre-soft); }
.tt.tasks.on { background: var(--ret); color: #fff; border-color: var(--ret); }
.tt.texts.on { background: var(--pre); color: #1d2330; border-color: var(--pre); }
.tt-switch .tt:only-child { grid-column: 1 / -1; }
.tt-bar { display: flex; align-items: center; gap: 10px; min-height: 0; }
.tt-bar .max { margin-left: auto; }
