/* Client Portal design system: calm, card-based, large tap targets, plain language. */

:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #f0efea;
  --text: #1d2327;
  --muted: #5d676d;
  --border: #e3e1da;
  --accent: #1f5f5b;
  --accent-hover: #174b48;
  --accent-ink: #ffffff;
  --accent-soft: #e3efed;
  --good: #23784a;
  --good-soft: #e2f3e8;
  --warn: #8a5a00;
  --warn-soft: #fbf0d9;
  --bad: #b3261e;
  --bad-soft: #fbe5e3;
  --info: #2c5d9b;
  --info-soft: #e4ecf7;
  --shadow: 0 1px 2px rgba(20, 30, 30, .06), 0 4px 16px rgba(20, 30, 30, .05);
  --shadow-hover: 0 2px 4px rgba(20, 30, 30, .08), 0 10px 28px rgba(20, 30, 30, .09);
  --radius: 16px;
  --radius-sm: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121615;
    --surface: #1a201f;
    --surface-2: #222a28;
    --text: #e8ecea;
    --muted: #a0aba7;
    --border: #2e3735;
    --accent: #5fb3ab;
    --accent-hover: #7cc6be;
    --accent-ink: #0d1f1d;
    --accent-soft: #1f3431;
    --good: #6cc895;
    --good-soft: #1b3326;
    --warn: #e2b55c;
    --warn-soft: #362b14;
    --bad: #f08a82;
    --bad-soft: #3a1e1c;
    --info: #8fb4e6;
    --info-soft: #1c2a3d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-hover: 0 4px 18px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 16px; line-height: 1.5;
}
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.75rem; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; font-weight: 620; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0; }
img, svg { flex-shrink: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 28px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

/* ---------- shell: sidebar on desktop, bottom tabs on phones ---------- */
.shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border); padding: 22px 14px;
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; font-size: 1.05rem; color: var(--text); text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 750; font-size: .72rem; letter-spacing: -.02em;
}
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: .78rem; }
.nav-group { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 16px 12px 6px; font-weight: 650; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none; font-weight: 520;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 620; }
.nav-link .count {
  margin-left: auto; background: var(--accent); color: var(--accent-ink); border-radius: 999px;
  font-size: .75rem; font-weight: 700; padding: 1px 8px; min-width: 22px; text-align: center;
}
.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }
.who { padding: 8px 12px; font-size: .9rem; }
.who strong { display: block; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }

.main { padding: 36px 44px 64px; max-width: 1180px; width: 100%; }
.topbar { display: none; }
.bottom-nav { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .main { padding: 20px 16px 104px; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; padding: 12px 16px;
    background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10;
  }
  .topbar .brand { padding: 0; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
    background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a {
    display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; font-size: .72rem;
    color: var(--muted); text-decoration: none; border-radius: 10px; position: relative; font-weight: 560;
  }
  .bottom-nav a.active { color: var(--accent); }
  .bottom-nav .dot { position: absolute; top: 4px; right: calc(50% - 16px); width: 9px; height: 9px; border-radius: 50%; background: var(--bad); }
  h1 { font-size: 1.45rem; }
}

/* ---------- page heading ---------- */
.page-head { margin-bottom: 26px; }
.page-head .lead { color: var(--muted); margin-top: 6px; font-size: 1.05rem; }
.back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px; text-decoration: none; font-weight: 560; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 34px 0 14px; }
.section-title h2 { font-size: 1.1rem; }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.cards.two { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; display: flex; flex-direction: column; gap: 12px; min-width: 0;
}
a.card { color: inherit; text-decoration: none; transition: box-shadow .15s, transform .15s, border-color .15s; }
a.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); color: inherit; }
.card .card-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 600; }
.card-icon {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.card-icon.warm { background: var(--warn-soft); color: var(--warn); }
.card-icon.blue { background: var(--info-soft); color: var(--info); }
.card-icon.green { background: var(--good-soft); color: var(--good); }
.card-icon.red { background: var(--bad-soft); color: var(--bad); }
.card.hero { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.card.hero .muted { color: color-mix(in srgb, var(--accent-ink) 80%, transparent); }
.card.hero .card-icon { background: rgba(255, 255, 255, .16); color: var(--accent-ink); }
.card.hero .card-foot { color: var(--accent-ink); }
a.card.hero:hover { color: var(--accent-ink); }
.card.flat { box-shadow: none; }
.card.todo { border-left: 5px solid var(--warn); }
.card.compact { padding: 16px 18px; }
.stat { font-size: 2rem; font-weight: 700; line-height: 1; }

/* ---------- document cards ---------- */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.doc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: flex; gap: 14px; min-width: 0; }
.doc-type {
  width: 48px; height: 58px; border-radius: 9px; background: var(--surface-2); color: var(--muted);
  display: grid; place-items: center; font-size: .7rem; font-weight: 750; letter-spacing: .03em; position: relative;
}
.doc-type.pdf { background: var(--bad-soft); color: var(--bad); }
.doc-type.image { background: var(--info-soft); color: var(--info); }
.doc-type.excel, .doc-type.csv { background: var(--good-soft); color: var(--good); }
.doc-type.word { background: var(--info-soft); color: var(--info); }
.doc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.doc-title { font-weight: 620; overflow-wrap: anywhere; }
.doc-meta { color: var(--muted); font-size: .85rem; }
.doc-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* ---------- chips and badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 10px; font-size: .8rem; font-weight: 620; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.chip-new { background: var(--accent); color: var(--accent-ink); }
.chip-good { background: var(--good-soft); color: var(--good); }
.chip-info { background: var(--info-soft); color: var(--info); }
.chip-wait { background: var(--warn-soft); color: var(--warn); }
.chip-bad { background: var(--bad-soft); color: var(--bad); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn-danger { color: var(--bad); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .9rem; border-radius: 10px; }
.btn-lg { min-height: 52px; padding: 12px 24px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-weight: 600; }
.field .hint { color: var(--muted); font-size: .875rem; }
input[type=text], input[type=email], input[type=date], input[type=search], select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 13px; min-height: 46px; width: 100%;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.code-input { font-size: 1.8rem; letter-spacing: .35em; text-align: center; font-family: ui-monospace, Consolas, monospace; max-width: 260px; }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); }

/* Radio choices shown as big tappable chips */
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices input { position: absolute; opacity: 0; pointer-events: none; }
.choices label {
  border: 1.5px solid var(--border); background: var(--surface); border-radius: 999px; padding: 9px 16px;
  cursor: pointer; font-weight: 560; min-height: 44px; display: inline-flex; align-items: center;
}
.choices input:checked + label { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.choices input:focus-visible + label { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- drop zone ---------- */
.dropzone {
  position: relative; border: 2px dashed color-mix(in srgb, var(--accent) 45%, var(--border)); border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); padding: 38px 20px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px; transition: background .15s, border-color .15s;
}
.dropzone.dragging { background: var(--accent-soft); border-color: var(--accent); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dropzone .dz-icon { width: 60px; height: 60px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; color: var(--accent); box-shadow: var(--shadow); }
.dropzone .dz-title { font-weight: 650; font-size: 1.1rem; }
.dropzone.compact { padding: 22px 16px; }
.file-picked { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-direction: column; gap: 6px; width: 100%; max-width: 460px; }
.file-picked li { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; display: flex; gap: 8px; align-items: center; text-align: left; font-size: .92rem; }

/* ---------- banners ---------- */
.banner { border-radius: var(--radius-sm); padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; margin-bottom: 20px; font-weight: 520; }
.banner.ok { background: var(--good-soft); color: var(--good); }
.banner.err { background: var(--bad-soft); color: var(--bad); }
.banner.note { background: var(--info-soft); color: var(--info); }
.banner.warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- lists and tables ---------- */
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list-item { display: flex; gap: 14px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--border); }
.list-item:first-child { border-top: 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table.table { border-collapse: collapse; width: 100%; font-size: .87rem; background: var(--surface); }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.table th { background: var(--surface-2); font-weight: 650; position: sticky; top: 0; }
.table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.wrap { white-space: normal; min-width: 220px; }
details.reveal > summary { cursor: pointer; font-weight: 600; color: var(--accent); list-style: none; display: inline-flex; gap: 6px; align-items: center; }
details.reveal > summary::-webkit-details-marker { display: none; }
details.reveal[open] > summary { margin-bottom: 12px; }
pre.text-preview { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px; max-height: 360px; overflow: auto; font-size: .8rem; white-space: pre-wrap; }

/* ---------- empty states ---------- */
.empty { text-align: center; padding: 42px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .card-icon { width: 56px; height: 56px; }

/* ---------- authenticator setup ---------- */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 18px; }
.steps > li { counter-increment: step; display: grid; grid-template-columns: 36px 1fr; gap: 14px; }
.steps > li::before {
  content: counter(step); width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 700;
}
.qr { background: #fff; padding: 12px; border-radius: 12px; border: 1px solid var(--border); width: 220px; height: 220px; }
.store-links { display: flex; gap: 8px; flex-wrap: wrap; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; font-family: ui-monospace, Consolas, monospace; font-size: 1.05rem; }
.codes span { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; text-align: center; }

/* ---------- landing ---------- */
.landing { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.landing-inner { width: 100%; max-width: 760px; }
.landing .brand { justify-content: center; font-size: 1.3rem; padding-bottom: 30px; }
.landing h1 { text-align: center; font-size: 2rem; }
.landing .lead { text-align: center; color: var(--muted); margin: 10px 0 30px; font-size: 1.1rem; }
.dev-ribbon { background: var(--warn-soft); color: var(--warn); text-align: center; font-size: .85rem; padding: 6px 12px; font-weight: 600; }

@media print {
  .sidebar, .topbar, .bottom-nav, .btn { display: none !important; }
  .shell { display: block; }
}

/* ---------- utilities (no inline styles: the CSP forbids them) ---------- */
.center { text-align: center; }
.card.center { max-width: 520px; margin: 0 auto; text-align: center; align-items: center; }
.foot-link { text-align: center; margin-top: 28px; }
/* Pre-authenticator gate pages (Setup/Verify): brand and sign-out only, no sidebar, counts or account details. */
.gate-head {
  display: flex; align-items: center; justify-content: space-between; padding: 12px 24px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.gate-head .brand { padding: 0; }
.gate-head + .main { margin: 0 auto; }
.mt { margin-top: 16px; }
.mt-lg { margin-top: 32px; }
.narrow { max-width: 680px; }
.hidden { display: none; }
.client-tabs { margin: 0 0 18px; } .client-tabs .chip { padding: 6px 12px; text-decoration: none; }

/* ---------- ShareFile import and offboarding (area B) ---------- */
.import-progress { width: 100%; height: 10px; }
.import-map select { min-width: 180px; max-width: 320px; }
.import-map tr.level-2 td:first-child { padding-left: 28px; }
fieldset.field { border: 0; padding: 0; margin: 0; }
fieldset.field legend { font-weight: 600; margin-bottom: 6px; }
/* ---------- client documents (area A): preview, profile, view as client, outbox ---------- */
.preview-frame { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.preview-frame iframe { display: block; width: 100%; height: 78vh; min-height: 420px; border: 0; }
.preview-image { text-align: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; }
.preview-image img { max-width: 100%; max-height: 78vh; height: auto; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.facts dt { font-weight: 600; color: var(--muted); }
.facts dd { margin: 0; min-width: 0; }
.break { overflow-wrap: anywhere; word-break: break-word; }
.block { display: block; }
.choice-list { border: 0; padding: 0; margin: 0; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.choice input { margin-top: 4px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters .field { margin: 0; min-width: 160px; }
.view-as-banner { position: sticky; top: 0; z-index: 5; }
.view-as { border: 2px dashed var(--border); border-radius: var(--radius-sm); padding: 16px; }
.view-as button[disabled] { cursor: not-allowed; opacity: .55; }
@media (max-width: 640px) { .view-as { padding: 8px; } .facts { grid-template-columns: 1fr; } }
/* ---------- e-signature (area C2) ---------- */
.sign-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.sign-frame { width: 100%; height: 70vh; min-height: 420px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); margin-top: 12px; }
.sign-pages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 70vh; overflow-y: auto; }
.sign-pages li.done { color: var(--good); }
.sign-page-done { display: inline-flex; align-items: center; gap: 6px; font-size: .92rem; }
.sign-name { font-family: "Brush Script MT", "Segoe Script", cursive; font-size: 1.5rem; }
.sign-num { width: 6em; }
.sign-filters input[type=search] { min-width: 260px; }
.sign-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.sign-dl dt { color: var(--muted); font-size: .9rem; }
.sign-dl dd { margin: 0; }
.wrap-any { overflow-wrap: anywhere; }
.sign-pre { white-space: pre-line; }
@media (max-width: 900px) {
  .sign-layout { grid-template-columns: 1fr; }
  .sign-frame { height: 60vh; }
  .sign-filters input[type=search] { min-width: 0; width: 100%; }
/* ---------- client record (area E: timeline, quick log, email capture) ---------- */
.pre-line { white-space: pre-line; }
.record-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.record-addtask input[type=text] { flex: 1; min-width: 0; }
.record-addtask input[type=date] { width: auto; }
.record-filters { gap: 14px; }
.record-filter-row { display: flex; flex-wrap: wrap; gap: 12px; }
.record-filter-row > .field { min-width: 150px; }
.record-filter-row > .field.grow { flex: 1 1 260px; }
.record-kinds { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.record-kinds legend { margin-bottom: 6px; }
.record-kinds .check input { width: 18px; height: 18px; }
.record-form fieldset { border: 0; padding: 0; margin: 0; }
.record-form input[type=number], .record-form input[type=datetime-local] {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 13px; min-height: 46px; width: 100%;
}
.record-form input[type=number] { max-width: 120px; }
.timeline { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.tl-item { display: flex; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; min-width: 0; }
.tl-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex-shrink: 0; }
.tl-emailreceived .tl-icon, .tl-emailsent .tl-icon { background: var(--info-soft); color: var(--info); }
.tl-phonecall .tl-icon, .tl-meeting .tl-icon, .tl-voicemail .tl-icon, .tl-textmessage .tl-icon { background: var(--accent-soft); color: var(--accent); }
.tl-note .tl-icon, .tl-followup .tl-icon { background: var(--warn-soft); color: var(--warn); }
.tl-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.tl-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tl-title { font-weight: 620; overflow-wrap: anywhere; }
.tl-text { white-space: pre-line; overflow-wrap: anywhere; color: var(--text); font-size: .93rem; }
.tl-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.record-headers { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; font-size: .92rem; }
.record-headers dt { font-weight: 620; color: var(--muted); }
.record-headers dd { margin: 0; overflow-wrap: anywhere; }
.record-body { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px; max-height: 520px; overflow: auto; }
.record-preview { color: var(--muted); max-height: 140px; overflow: hidden; }
.record-candidates { flex-wrap: wrap; }
@media (max-width: 640px) {
  .tl-item { padding: 12px; gap: 10px; }
  .record-actions .btn { flex: 1 1 45%; }
}
/* ---------- records engine: vault, retention, disposal, reports, packets (D1) ---------- */
input[type=number] {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 13px; min-height: 46px; width: 100%;
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px 16px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 18px; }
.filter-bar .field { min-width: 160px; }
.filter-bar .check { align-self: center; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 8px 16px; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.facts dt { color: var(--muted); font-weight: 600; }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
code.hash { display: block; background: var(--surface-2); border-radius: 8px; padding: 8px 10px; overflow-wrap: anywhere; font-size: .85rem; }
details.rule-card > summary { cursor: pointer; list-style: none; }
details.rule-card > summary::-webkit-details-marker { display: none; }
.vault-tabs { flex-wrap: wrap; }
.vault-pick .list-item { cursor: pointer; }
fieldset.field, fieldset.choices { border: 0; padding: 0; margin: 0; }
/* ---------- personal transactions (spec 8.4.3) ---------- */
.pst-pick { gap: 12px; flex-wrap: wrap; }
.pst-links { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; }
.pst-tabs { margin: 8px 0 16px; flex-wrap: wrap; }
.pst-tabs .chip { text-decoration: none; padding: 6px 12px; }
.pst-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 18px; align-items: start; }
.pst-source { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
.pst-frame { width: 100%; height: 72vh; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.pst-source-table { max-height: 72vh; overflow: auto; }
.pst-source-table td { font-size: .8rem; padding: 4px 6px; }
.pst-source-table tr:target td { background: var(--warn-soft); }
pre.text-preview.pst-source-text { max-height: 72vh; }
.pst-rows { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pst-group { font-size: 1rem; margin: 10px 0 2px; }
.pst-row { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.pst-row.removed { opacity: .6; }
.pst-row > summary { display: flex; gap: 10px; align-items: center; padding: 8px 12px; cursor: pointer; list-style: none; flex-wrap: wrap; }
.pst-row > summary::-webkit-details-marker { display: none; }
.pst-row:target { outline: 2px solid var(--accent); }
.pst-cell { font-size: .875rem; white-space: nowrap; }
.pst-cell.grow { white-space: normal; min-width: 140px; }
.pst-cell.num { font-variant-numeric: tabular-nums; min-width: 64px; text-align: right; }
.pst-row-body { padding: 4px 12px 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.pst-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.pst-rule { border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 6px 10px; display: flex; gap: 12px; flex-wrap: wrap; }
.pst-edit { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; align-items: end; }
.pst-edit .pst-wide { grid-column: 1 / -1; }
.pst-edit > .btn { justify-self: start; }
@media (max-width: 1000px) {
  .pst-split { grid-template-columns: 1fr; }
  .pst-source { position: static; max-height: none; }
  .pst-frame { height: 60vh; }
}
/* ---------- onboarding, consent, disclosures, forms (area C1) ---------- */
.consent-text { white-space: pre-wrap; font-family: var(--font); font-size: .95rem; line-height: 1.55; background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 16px; margin: 0; max-height: 420px; overflow: auto; }
textarea.tall { min-height: 320px; }
.banner.countdown { text-decoration: none; align-items: center; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(210px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.board-col { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.board-col h3 { font-size: .9rem; margin: 2px 4px 4px; display: flex; justify-content: space-between; align-items: center; }
.board-col .count { background: var(--surface); border-radius: 999px; padding: 0 8px; font-size: .8rem; color: var(--muted); }
.board-card { display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; color: var(--text); text-decoration: none; }
.board-card:hover { box-shadow: var(--shadow-hover); color: var(--text); }
.board-card.stalled { border-left: 4px solid var(--warn); background: var(--warn-soft); }
.onboarding-steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.onboarding-steps li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.onboarding-steps .step-icon { color: var(--muted); }
.onboarding-steps li.done .step-icon { color: var(--good); }
.onboarding-todos { margin-bottom: 18px; }
.plain-list { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--bad); }
.field-error { color: var(--bad); font-size: .875rem; font-weight: 600; }
@media (max-width: 720px) { .board { grid-auto-flow: row; grid-auto-columns: auto; } }
/* ---------- firm records modules (D2: compliance calendar, proxy voting, security program, insurance, complaints) ---------- */
input[type=number], input[type=url], input[type=datetime-local], input[type=file] {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 13px; min-height: 46px; width: 100%;
}
input[type=file] { padding: 9px 11px; }
.input-short { max-width: 180px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 14px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 8px 16px; }
.filters { align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
dl.facts { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 6px 14px; margin: 0; }
dl.facts dt { color: var(--muted); font-weight: 600; }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.cal-dow { background: var(--surface-2); font-weight: 650; font-size: .8rem; padding: 6px 8px; }
.cal-day { min-height: 96px; border-top: 1px solid var(--border); border-left: 1px solid var(--border); padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-day:nth-child(7n + 1) { border-left: 0; }
.cal-day.other { opacity: .5; }
.cal-day.closed { background: var(--surface-2); }
.cal-day.today .cal-num { background: var(--accent); color: #fff; border-radius: 999px; padding: 0 7px; }
.cal-num { font-weight: 650; font-size: .85rem; align-self: flex-start; }
.cal-holiday { font-size: .7rem; color: var(--muted); }
.cal-item { display: block; font-size: .74rem; line-height: 1.25; padding: 3px 6px; border-radius: 6px; background: var(--info-soft); color: var(--info); text-decoration: none; overflow: hidden; text-overflow: ellipsis; }
.cal-item.chip-bad { background: var(--bad-soft); color: var(--bad); }
.cal-item.chip-wait { background: var(--warn-soft); color: var(--warn); }
.cal-item.chip-good { background: var(--good-soft); color: var(--good); }
@media (max-width: 720px) {
  .cal-day { min-height: 64px; padding: 3px; }
  .cal-item { font-size: .65rem; padding: 2px 3px; }
  dl.facts { grid-template-columns: 1fr; }
}
@media print {
  .sidebar, .bottom-nav, .topbar, .client-tabs, .btn { display: none !important; }
}
