:root {
  --ink: #17262b; --ink-2: #22363c; --paper: #eef1ee; --panel: #ffffff; --rule: #d3dad5; --rule-2: #e4e9e5;
  --muted: #566661; --accent: #0f6b63; --accent-d: #0b524c; --accent-bg: #dcece9;
  --warn: #8f5a0a; --warn-bg: #f8ecd3; --bad: #a93226; --bad-bg: #f6dcd8; --ok: #25693f; --ok-bg: #dcefe2; --info-bg: #e3e9ee;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root { --ink: #0c1517; --ink-2: #16262a; --paper: #101a1c; --panel: #172326; --rule: #2b3b3e; --rule-2: #223033; --muted: #9bb0aa; --accent: #53b4a8; --accent-d: #3f9a8f; --accent-bg: #1c3a37;
    --warn: #e0b25c; --warn-bg: #3a2f17; --bad: #f0877b; --bad-bg: #3d1f1c; --ok: #7fcf9b; --ok-bg: #1c3526; --info-bg: #1e2c33; color-scheme: dark; }
  body { color: #e6efec; }
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font: 1rem/1.5 var(--sans); background: var(--paper); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-d); }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
h1 { font: 600 1.7rem/1.15 var(--serif); letter-spacing: -0.01em; }
h2 { font: 600 1.25rem var(--serif); }
h3 { font: 600 1.05rem var(--sans); margin-bottom: .6rem; }
h4 { font-size: .95rem; margin: 1rem 0 .4rem; }
p { margin: 0 0 .75rem; }
code { font-family: var(--mono); font-size: .85em; word-break: break-all; background: var(--rule-2); padding: .1em .35em; border-radius: 3px; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: .5rem .8rem; z-index: 100; }
.skip:focus { left: 0; }

/* ---------- shell */
.shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--ink); color: #dfe9e6; padding: 1.1rem .9rem; display: flex; flex-direction: column; gap: 1.2rem; position: sticky; top: 0; height: 100vh; }
.brand-mark { font: 700 1.35rem var(--serif); letter-spacing: .01em; }
.side .brand-mark { color: #fff; }
.tenant { font-size: .8rem; color: #9db3ae; margin-top: .15rem; }
.side nav#mainnav { display: flex; flex-direction: column; flex: 1; overflow-y: auto; min-height: 0; }
.navgroup { display: flex; flex-direction: column; gap: 2px; }
.navgroup.bottom { margin-top: auto; padding-top: .6rem; position: sticky; bottom: 0; background: var(--ink); border-top: 1px solid #2c4248; }
.navhead { font: 600 .68rem var(--sans); letter-spacing: .09em; text-transform: uppercase; color: #8aa39e; margin: .7rem .7rem .2rem; }
.navgroup:first-child .navhead { margin-top: 0; }
.side nav a { color: #cfdcd8; text-decoration: none; padding: .4rem .7rem; border-radius: 5px; border-left: 3px solid transparent; display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.badge { background: #f2c14e; color: #2b2100; font: 700 .72rem var(--sans); padding: .05rem .45rem; border-radius: 999px; min-width: 1.3rem; text-align: center; }
.badge:empty { display: none; }
.menu-toggle, .tabbar { display: none; }
.side nav a:hover { background: var(--ink-2); color: #fff; }
.side nav a.on { background: var(--ink-2); color: #fff; border-left-color: #5fc2b4; font-weight: 600; }
.me { font-size: .85rem; border-top: 1px solid #2c4248; padding-top: .8rem; display: flex; justify-content: space-between; align-items: end; gap: .5rem; }
.me .muted { color: #9db3ae; text-transform: capitalize; }
.me .link { color: #cfdcd8; }
#main { min-width: 0; padding: 1.6rem clamp(1rem, 3vw, 2.4rem) 3rem; max-width: 1280px; width: 100%; outline: none; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-actions, .actions { display: flex; gap: .5rem; align-items: center; }
.actions { margin-top: .9rem; }
.actions.wrap { flex-wrap: wrap; margin: .9rem 0 1rem; }
.page-actions { flex-wrap: wrap; }
.back { display: inline-block; margin-bottom: .4rem; font-size: .9rem; text-decoration: none; }

/* ---------- controls */
button, input, select, textarea { font: inherit; color: inherit; }
button { background: var(--panel); border: 1px solid var(--rule); border-radius: 6px; padding: .45rem .85rem; cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--accent-d); }
@media (prefers-color-scheme: dark) { button.primary { color: #0c1517; } }
button.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
button.link { background: none; border: 0; padding: .1rem .3rem; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.icon-btn { border: 0; background: none; font-size: 1.5rem; line-height: 1; padding: .1rem .5rem; }
input, select, textarea { background: var(--panel); border: 1px solid var(--rule); border-radius: 6px; padding: .45rem .6rem; width: 100%; min-height: 2.35rem; }
input[type=checkbox] { width: auto; min-height: 0; accent-color: var(--accent); }
textarea { resize: vertical; }
.field { display: flex; flex-direction: column; gap: .25rem; }
.field label, .check span { font-weight: 600; font-size: .9rem; }
.field small, .check small { color: var(--muted); font-size: .8rem; }
.req { color: var(--bad); }
.check { display: grid; grid-template-columns: auto 1fr; gap: .1rem .5rem; align-items: center; }
.check small { grid-column: 2; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem 1rem; }
.form-grid .full { grid-column: 1 / -1; }
.form-error { color: var(--bad); margin: .6rem 0 0; font-weight: 600; min-height: 0; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .8rem; }
.filters input, .filters select { width: auto; min-width: 10rem; flex: 0 1 auto; }
.filters input[type=search] { flex: 1 1 16rem; }
label.inline { display: inline-flex; align-items: center; gap: .4rem; font-size: .9rem; }
label.inline input { width: auto; }

/* ---------- surfaces */
.card { background: var(--panel); border: 1px solid var(--rule); border-radius: 8px; padding: 1rem 1.1rem; margin-bottom: 1rem; min-width: 0; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.cols-wide { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat { background: var(--panel); border: 1px solid var(--rule); border-left: 4px solid var(--accent); border-radius: 8px; padding: .8rem 1rem; }
.stat-warn { border-left-color: var(--warn); } .stat-bad { border-left-color: var(--bad); }
.stat-label { color: var(--muted); font-size: .85rem; }
.stat-value { font: 600 1.55rem/1.25 var(--serif); font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--muted); font-size: .82rem; }
.stats.small .stat-value { font-size: 1.15rem; }
.empty { color: var(--muted); padding: .8rem 0; }
.flag, .due { color: var(--bad); font-weight: 600; }

/* ---------- tables: ledger rules, tabular figures */
.table-wrap { overflow-x: auto; margin: 0 -.2rem; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: .5rem .55rem; text-align: left; border-bottom: 1px solid var(--rule-2); vertical-align: top; }
th { font-weight: 600; font-size: .82rem; color: var(--muted); border-bottom: 2px solid var(--rule); white-space: nowrap; }
.r { text-align: right; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--accent-bg); }
.clip { display: inline-block; max-width: 34ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.table-wrap td .actions { margin: 0; }

/* ---------- pills */
.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .4rem; }
.pill { display: inline-block; padding: .08rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--info-bg); color: var(--ink); white-space: nowrap; }
@media (prefers-color-scheme: dark) { .pill { color: #e6efec; } }
.pill-paid, .pill-settled, .pill-sent, .pill-delivered, .pill-posted, .pill-active, .pill-completed { background: var(--ok-bg); color: var(--ok); }
.pill-promise_to_pay, .pill-arrangement, .pill-contacted, .pill-ringing { background: var(--accent-bg); color: var(--accent-d); }
.pill-disputed, .pill-legal, .pill-tracing, .pill-blocked, .pill-queued { background: var(--warn-bg); color: var(--warn); }
.pill-bad, .pill-dnc, .pill-failed, .pill-reversed, .pill-written_off { background: var(--bad-bg); color: var(--bad); }
.pill-closed, .pill-returned, .pill-sold { background: var(--rule-2); color: var(--muted); }

/* ---------- dashboard */
.todos { display: grid; gap: .25rem; }
.todo { display: grid; grid-template-columns: 3.2rem 1fr; align-items: baseline; text-decoration: none; color: var(--ink); padding: .4rem .5rem; border-radius: 6px; border: 1px solid transparent; }
@media (prefers-color-scheme: dark) { .todo { color: #e6efec; } }
.todo b { font: 600 1.4rem var(--serif); text-align: right; padding-right: .8rem; font-variant-numeric: tabular-nums; }
.todo:hover { background: var(--accent-bg); }
.todo.done { color: var(--muted); } .todo.done b { font-weight: 400; }
.todo-warn b { color: var(--warn); } .todo-bad b { color: var(--bad); }
.bars { width: 100%; height: auto; display: block; }
.bar { fill: var(--accent); } .bar.zero { fill: var(--rule); }
.agebar { display: flex; height: 1.7rem; border-radius: 5px; overflow: hidden; gap: 2px; }
.agebar span { min-width: 3px; }
.legend { list-style: none; padding: 0; margin: .8rem 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .3rem 1.2rem; }
.legend li { display: grid; grid-template-columns: auto 1fr auto; gap: .5rem; align-items: baseline; font-variant-numeric: tabular-nums; }
.legend b { white-space: nowrap; }
.legend i { width: .8rem; height: .8rem; border-radius: 2px; display: inline-block; }
.legend em { color: var(--muted); font-style: normal; font-size: .82rem; }

/* ---------- account detail */
.account-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; flex-wrap: wrap; }
.balance { text-align: right; }
.balance .big { font: 600 2.4rem/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--rule); margin: .5rem 0 1rem; overflow-x: auto; }
.tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; padding: .6rem .9rem; white-space: nowrap; }
.tabs button.on { border-bottom-color: var(--accent); font-weight: 700; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 .9rem; border-left: 2px solid var(--rule); }
.timeline li { position: relative; padding: 0 0 1rem 1rem; }
.timeline li::before { content: ""; position: absolute; left: -1.38rem; top: .35rem; width: .7rem; height: .7rem; border-radius: 50%; background: var(--panel); border: 2px solid var(--accent); }
.timeline li.t-payment::before { background: var(--ok); border-color: var(--ok); }
.timeline li.t-payment_reversal::before, .timeline li.t-dispute::before { background: var(--bad); border-color: var(--bad); }
.timeline li.t-note::before { border-color: var(--muted); }
.timeline p { margin: .15rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- modal & toast */
.overlay { position: fixed; inset: 0; background: rgba(10, 20, 22, .55); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 1rem 1rem; overflow-y: auto; z-index: 50; }
.modal { background: var(--panel); border-radius: 10px; width: min(460px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.modal-wide { width: min(720px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: .9rem 1.1rem; border-bottom: 1px solid var(--rule); }
.modal-body { padding: 1rem 1.1rem 1.1rem; }
.modal .actions { justify-content: flex-end; }
#toasts { position: fixed; bottom: 1rem; right: 1rem; display: grid; gap: .5rem; z-index: 80; max-width: min(420px, calc(100vw - 2rem)); }
.toast { background: var(--ink); color: #fff; padding: .7rem .95rem; border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.3); overflow-wrap: anywhere; }
.toast-err { background: var(--bad); }
.toast-warn { background: #8a5a00; }

/* ---------- login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: var(--ink); }
.login-card { background: var(--panel); border-radius: 10px; padding: 2rem; width: min(400px, 100%); display: grid; gap: .9rem; }
.login-card .brand-mark { color: var(--accent); }
.login-card form { display: grid; gap: .8rem; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: sticky; top: 0; z-index: 30; height: auto; max-height: 100vh; overflow-y: auto; flex-direction: column; gap: .4rem; padding: .55rem .8rem; }
  .brand { display: flex; align-items: center; justify-content: space-between; gap: .7rem; }
  .menu-toggle { display: inline-block; background: transparent; color: #fff; border: 1px solid #4a6670; border-radius: 6px; padding: .5rem .9rem; min-height: 44px; font: inherit; }
  .side nav#mainnav, .side .me { display: none; }
  .side.open nav#mainnav { display: flex; overflow: visible; }
  .side.open .me { display: flex; }
  .side.open { padding-bottom: 5rem; }
  .navgroup.bottom { position: static; border-top: 0; }
  .demo-box { bottom: calc(66px + env(safe-area-inset-bottom, 0px)) !important; }
  .side nav a { padding: .7rem .7rem; min-height: 44px; }
  .navgroup.bottom { margin-top: 0; }
  .me { border-top: 1px solid #2c4248; padding-top: .8rem; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--ink); border-top: 1px solid #2c4248; padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a, .tabbar .menu-toggle { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem; min-height: 54px; padding: .35rem .2rem; border: 0; border-radius: 0; border-top: 3px solid transparent; font-size: .78rem; color: #cfdcd8; text-decoration: none; }
  .tabbar a.on { color: #fff; border-top-color: #5fc2b4; font-weight: 600; background: transparent; }
  .tabbar .badge { position: absolute; transform: translate(1.4rem, -.2rem); }
  .tabbar a { position: relative; }
  #main { padding-bottom: 5.5rem; }
  .cols, .cols-wide, .form-grid { grid-template-columns: 1fr; }
  .balance { text-align: left; }
}
@media (prefers-reduced-motion: no-preference) { .modal { animation: pop .14s ease-out; } @keyframes pop { from { transform: translateY(6px); opacity: 0; } } }

/* Roles and permissions grid */
.matrix th[scope="row"] { font-weight: 500; text-align: left; min-width: 16rem; }
.matrix th.r, .matrix td.r { text-align: center; min-width: 7.5rem; vertical-align: top; }
.matrix tr.group th { background: var(--surface-2, rgba(127,127,127,.12)); text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; padding: .45rem .6rem; }
.matrix input[type="checkbox"] { width: 1.15rem; height: 1.15rem; }

/* Pick-an-account list and import preview */
.pick { display: grid; gap: .25rem; margin: .5rem 0; max-height: 16rem; overflow: auto; }
.pick-row { display: flex; gap: .6rem; align-items: center; padding: .4rem .5rem; border: 1px solid var(--line, rgba(127,127,127,.3)); border-radius: 6px; cursor: pointer; }
.pick-row input { width: auto; }
details { margin: .6rem 0; }
details summary { cursor: pointer; color: var(--muted); }

/* Dashboards */
.progress { height: .55rem; background: var(--rule); border-radius: 999px; overflow: hidden; margin: .35rem 0 .2rem; min-width: 5rem; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.progress span.low { background: var(--warn); } .progress span.full { background: var(--ok); }
.mini { min-width: 9rem; }
.stat-good .stat-sub { color: var(--ok); } .stat-bad .stat-sub { color: var(--bad); }
.stat-warn .stat-value { color: var(--warn); }
svg.bars text.axis { font-size: 10px; fill: var(--muted); }
.filters label { align-self: center; }

/* ---- dashboard widgets and fees ---- */
.widgets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: start; margin-top: 14px; }
.widget { min-width: 0; margin-bottom: 4px; }
.widget.editing { padding: 6px; }
.widget.w-sm { grid-column: span 1; }
.widget.w-md { grid-column: span 2; }
.widget.w-lg { grid-column: span 4; }
.widget .wbody > .stat, .widget .wbody > .card { margin: 0; height: 100%; }
.widget.editing { outline: 2px dashed var(--line, #c9d3cf); outline-offset: 3px; border-radius: 10px; padding: 0; }
.wtools { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 0 0 6px; font-size: 12px; }
.wtools .wname { flex: 1 1 100%; font-weight: 600; }
.wtools button { padding: 2px 8px; font-size: 12px; }
.dash-strip { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.picker { display: grid; gap: 10px; margin: 10px 0; }
.pick-group h4 { margin: 0 0 4px; font-size: 13px; }
.pick-items { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border-radius: 999px; padding: 3px 10px; font-size: 13px; }
@media (max-width: 900px) { .widget.w-sm { grid-column: span 2; } .widget.w-md, .widget.w-lg { grid-column: span 4; } }
@media (max-width: 520px) { .widgets { grid-template-columns: 1fr; } .widget.w-sm, .widget.w-md, .widget.w-lg { grid-column: span 1; } }
.tally { margin: 10px 0 14px; padding: 10px 12px; border: 1px solid var(--rule, #d3dad5); border-radius: 8px; }
.tally h4 { margin: 0 0 4px; }

/* Help and training */
.helpgrid { display: grid; grid-template-columns: 15rem 1fr; gap: 1rem; align-items: start; }
.toc { position: sticky; top: .5rem; display: flex; flex-direction: column; gap: .15rem; font-size: .9rem; }
.toc a { padding: .3rem .5rem; border-radius: 6px; text-decoration: none; }
.toc a:hover { background: var(--rule); }
.chapter ul, .chapter ol, .tut { padding-left: 1.3rem; }
.chapter li, .tut li { margin: .3rem 0; }
.helpnote { background: color-mix(in srgb, var(--accent) 10%, transparent); border-left: 4px solid var(--accent); padding: .6rem .8rem; border-radius: 4px; }
.tut li.done > label span { text-decoration: line-through; color: var(--muted); }
fieldset.q { border: 1px solid var(--rule); border-radius: 8px; margin: .8rem 0; padding: .6rem .9rem; }
fieldset.q label { display: flex; gap: .5rem; padding: .25rem 0; }
.review { border-left: 4px solid var(--rule); padding: .4rem .7rem; margin: .6rem 0; }
.review.right { border-left-color: #2e8b57; } .review.wrong { border-left-color: #c0392b; }
@media (max-width: 800px) { .helpgrid { grid-template-columns: 1fr; } .toc { position: static; } }
@media print { .sidebar, .side, .tabbar, nav[aria-label], .tabs, .filters, .actions, .noprint, .toc { display: none !important; } .helpgrid { display: block; } .card { break-inside: avoid; box-shadow: none; } }

/* Agency / purchased tags */
.book { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .02em; padding: .1rem .5rem; border-radius: 999px; vertical-align: middle; white-space: nowrap; }
.book-agency { background: #dbeafe; color: #1e3a8a; }
.book-purchased { background: #fde68a; color: #78350f; }
@media (prefers-color-scheme: dark) { .book-agency { background: #1e3a8a; color: #dbeafe; } .book-purchased { background: #78350f; color: #fde68a; } }

/* Collector Queues and scores */
.workhead { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.workhead h2 { margin: 0 0 .2rem; }
.scores { display: flex; gap: .8rem; flex-wrap: wrap; margin-bottom: .6rem; }
.score { border: 1px solid var(--rule); border-radius: 10px; padding: .4rem .9rem; text-align: center; min-width: 5.5rem; }
.score span { display: block; font-size: 1.4rem; font-weight: 700; }
.score small { color: var(--muted); }
.score.big { border-color: var(--accent); } .score.big span { font-size: 2rem; color: var(--accent); }
.nba { background: color-mix(in srgb, var(--accent) 10%, transparent); border-left: 4px solid var(--accent); padding: .6rem .8rem; border-radius: 4px; margin: .5rem 0; }
.reasons li { margin: .25rem 0; }
.outcomes { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: .3rem .8rem; margin: .5rem 0 1rem; }
.history { padding-left: 1.1rem; font-size: .92rem; }

[hidden] { display: none !important; }
.nextchoice.suggested span { font-weight: 600; text-decoration: underline; text-decoration-style: dotted; }
.suggest { min-height: 1.2em; margin: .25rem 0; }

.warnbar { background: #fff3cd; color: #5c4400; border: 1px solid #e0b100; border-left-width: 6px; border-radius: 6px; padding: .6rem .9rem; margin-bottom: 1rem; }
.warnbar a { color: inherit; font-weight: 600; }
@media (prefers-color-scheme: dark) { .warnbar { background: #3a2f00; color: #ffe9a3; } }

input.needs { border-color: #e0b100; background: #fff9e0; }

.instr { background: #eef6ff; border-left: 4px solid #3b7ddd; padding: .5rem .8rem; margin: .4rem 0; border-radius: 4px; }
@media (prefers-color-scheme: dark) { .instr { background: #14243a; } }
.alertchips { display: flex; flex-wrap: wrap; gap: .3rem; margin: .2rem 0; }
.alertchips .chip-bad { background: #fde2e2; color: #8a1c1c; padding: .1rem .5rem; border-radius: 999px; font-size: .85em; }
.alertchips .chip-warn { background: #fff3cd; color: #5c4400; padding: .1rem .5rem; border-radius: 999px; font-size: .85em; }
.qr { display: flex; justify-content: center; margin: .6rem 0; }
.qr svg { max-width: 100%; height: auto; border: 1px solid var(--line, #ccc); border-radius: 6px; }
pre.recovery { font: 1.05rem/1.7 ui-monospace, Menlo, Consolas, monospace; background: var(--panel-2, #f3f4f6); padding: .6rem .9rem; border-radius: 6px; columns: 2; user-select: all; }
code.key { font: 1.05rem ui-monospace, Menlo, Consolas, monospace; letter-spacing: .05em; user-select: all; }
.tabgroups { display: flex; flex-wrap: wrap; gap: 0 1.8rem; border-bottom: 1px solid var(--rule); margin: .5rem 0 1rem; }
.tabgroup { display: flex; align-items: center; gap: .5rem; }
.tabgroup-label { font: 600 .68rem var(--sans); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); min-width: 4.8rem; }
.tabgroup .tabs { margin: 0; border-bottom: 0; }
@media (max-width: 860px) { .tabgroups { flex-direction: column; } .tabgroup { align-items: flex-start; flex-direction: column; gap: 0; } .tabgroup .tabs { overflow-x: auto; max-width: 100%; } }
.printdoc { font: 1rem/1.55 var(--serif, Georgia, serif); background: #fff; color: #111; border: 1px solid var(--rule); border-radius: 6px; padding: 1.2rem 1.5rem; margin: .6rem 0; max-height: 55vh; overflow: auto; }
.printdoc h3 { font: 700 1.3rem var(--serif, Georgia, serif); margin: .8rem 0 .4rem; } .printdoc h4 { font: 700 1.05rem var(--serif, Georgia, serif); margin: .9rem 0 .3rem; }
.printdoc p { margin: 0 0 .7rem; } .printdoc ul { margin: 0 0 .7rem 1.2rem; padding: 0; }
.picklist { display: grid; gap: .25rem; max-height: 14rem; overflow: auto; border: 1px solid var(--rule); border-radius: 6px; padding: .5rem .7rem; margin-top: .3rem; }
ul.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
@page { size: A4 portrait; margin: 1.5cm; }
@media print {
  body > :not(.overlay) { display: none !important; }
  .overlay { position: static !important; background: none !important; display: block !important; padding: 0 !important; }
  .modal { box-shadow: none !important; max-width: none !important; width: auto !important; border: 0 !important; animation: none !important; }
  .modal-head, .noprint { display: none !important; }
  .printdoc { border: 0; padding: 0; max-height: none; overflow: visible; font-size: 11pt; }
}

/* ---- the debtor's private page (no sign-in, no menu) ---- */
.paypage { max-width: 36rem; margin: 0 auto; padding: 1rem 1rem 3rem; }
.paycard { background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.paycard h1 { margin: 0 0 .5rem; font-size: 1.5rem; } .paycard h2 { margin: 0 0 .6rem; font-size: 1.1rem; }
.payamount { margin: .6rem 0 1rem; } .payamount .big { font-size: 2.2rem; font-weight: 700; }
.payactions { display: grid; gap: .6rem; } .payactions button { width: 100%; text-align: left; padding: .8rem 1rem; }
.paypre { white-space: pre-wrap; font: inherit; margin: 0 0 .6rem; background: var(--paper); padding: .6rem .8rem; border-radius: 6px; }
.paysmall { color: var(--muted); font-size: .85rem; }
.paypage input { font-size: 1.2rem; letter-spacing: .15em; max-width: 9rem; }
.payoverlay { padding: 0; align-items: stretch; background: var(--paper); }
.payshell { width: 100%; max-width: 44rem; margin: 0 auto; }
.paybar { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: .6rem 1rem; background: var(--warn-bg); color: var(--warn); font-size: .9rem; position: sticky; top: 0; z-index: 2; }
.payframe .paypage { padding-top: 1rem; }
.signpage { max-width: 52rem; } .signpage [role=tab] { border: 2px solid #bbb; background: #fff; color: #111; } .signpage [role=tab][aria-selected=true] { border-color: #0f6e5c; background: #0f6e5c; color: #fff; } .signpage input[type=text] { font-size: 1.05rem; letter-spacing: normal; max-width: none; width: 100%; } .signpage input[type=checkbox] { width: auto; max-width: none; margin-top: .25rem; } .signpage .printdoc { max-height: none; }
/* ---- the client's portal ---- */
.monthbars { display: flex; gap: .4rem; align-items: flex-end; height: 11rem; overflow-x: auto; padding-top: .5rem; }
.monthbar { flex: 1 0 3.2rem; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: .1rem; text-align: center; }
.monthbar-fill { width: 70%; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 3px; }
.monthbar small { font-size: .7rem; }
.paycard td:first-child, .paycard th:first-child { white-space: nowrap; }

/* "?" helpers beside field labels */
.helpbtn { display: inline-flex; align-items: center; justify-content: center; width: 1.15rem; height: 1.15rem; padding: 0; margin-left: .15rem; border-radius: 50%; border: 1px solid var(--muted); background: transparent; color: var(--muted); font: 700 .72rem/1 inherit; cursor: pointer; vertical-align: middle; }
.helpbtn:hover, .helpbtn[aria-expanded="true"] { background: var(--accent, #0f6b5f); border-color: var(--accent, #0f6b5f); color: #fff; }
.helptext { background: var(--paper, #eef1ee); border-left: 3px solid var(--accent, #0f6b5f); padding: .5rem .7rem; border-radius: 4px; font-size: .85rem; line-height: 1.45; }

/* account statement */
.stmt { width: 100%; border-collapse: collapse; font-size: 10.5pt; margin: .6rem 0; }
.stmt th, .stmt td { padding: .25rem .4rem; border-bottom: 1px solid #ccc; text-align: left; }
.stmt th.r, .stmt td.r { text-align: right; }
.stmt tfoot th { border-top: 2px solid #111; border-bottom: 0; }

.letterhead { text-align: right; margin: 0 0 1rem; line-height: 1.35; } .lh-logo { max-height: 70px; max-width: 320px; display: block; margin: 0 0 .5rem auto; padding-bottom: .5rem; border-bottom: 1px solid #999; box-sizing: content-box; } .lh-name { font-weight: 700; } .lh-line { font-size: .85rem; color: #333; }

/* ---- Settings: categories down the left, items under each other ---- */
.settingsgrid { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.settingsnav { position: sticky; top: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.settingsnav-label { font: 600 .68rem var(--sans); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); padding: 0 .6rem .25rem; }
.settingsnav-group { display: flex; flex-direction: column; }
.settingsnav a { display: block; padding: .4rem .6rem; border-radius: 6px; color: var(--ink); text-decoration: none; border-left: 3px solid transparent; }
.settingsnav a:hover { background: var(--panel); }
.settingsnav a.on { background: var(--panel); border-left-color: var(--accent, #0f6e5c); font-weight: 600; }
@media (max-width: 800px) { .settingsgrid { grid-template-columns: 1fr; } .settingsnav { position: static; } }

/* ---------- prospects */
.pipeline { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: .75rem; overflow-x: auto; align-items: start; }
.pcol { background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; padding: .6rem; min-height: 8rem; }
.pcol.over { outline: 2px dashed var(--accent, #0f6b5f); }
.pcol h4 { margin: 0 0 .5rem; }
.pcard { background: #fff; border: 1px solid var(--rule); border-radius: 8px; padding: .55rem .65rem; margin-bottom: .5rem; cursor: grab; display: grid; gap: .2rem; }
.pcard:hover, .pcard:focus { border-color: var(--accent, #0f6b5f); }
.dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: #d98a00; vertical-align: middle; }
.enqpage { max-width: 38rem; margin: 0 auto; padding: 1rem 1rem 3rem; position: relative; }
.enqpage .field { margin-bottom: .8rem; }
.enqpage input[type=text], .enqpage input[type=email], .enqpage input[type=tel], .enqpage input[type=number], .enqpage select, .enqpage textarea { width: 100%; font-size: 1rem; }
@media (max-width: 800px) { .pipeline { grid-template-columns: 1fr; } }
