/* Layout idea: fixed left rail of sections, one working pane; summary first, registers below. */
:root{
  --bg:#f2f5f4; --surface:#ffffff; --ink:#15211f; --muted:#5a6a67; --line:#d8e0de;
  --accent:#17544f; --accent-ink:#ffffff; --accent-soft:#e1efec;
  --good:#1d7a46; --warn:#8f5b00; --bad:#b3261e;
  --display:"Source Serif 4",Georgia,serif; --body:"IBM Plex Sans",system-ui,-apple-system,"Segoe UI",sans-serif;
}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    --bg:#0f1514; --surface:#172020; --ink:#e5eeec; --muted:#93a4a0; --line:#293736;
    --accent:#72c9be; --accent-ink:#0b1615; --accent-soft:#1c3431;
    --good:#6fcf97; --warn:#e5b454; --bad:#f08a80; color-scheme:dark;
  }
}
:root[data-theme="dark"]{
  --bg:#0f1514; --surface:#172020; --ink:#e5eeec; --muted:#93a4a0; --line:#293736;
  --accent:#72c9be; --accent-ink:#0b1615; --accent-soft:#1c3431;
  --good:#6fcf97; --warn:#e5b454; --bad:#f08a80; color-scheme:dark;
}
*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{background:var(--bg);color:var(--ink);font:15px/1.45 var(--body);display:flex}
a{color:var(--accent)}
h1,h2,h3{font-family:var(--display);font-weight:600;margin:0;text-wrap:balance}
h1{font-size:26px} h2{font-size:18px} h3{font-size:15px;font-family:var(--body)}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}

nav{width:216px;flex:none;background:var(--surface);border-right:1px solid var(--line);display:flex;flex-direction:column;gap:4px;padding:18px 12px}
.brand{font-family:var(--display);font-size:19px;padding:0 8px 2px}
.brand small{display:block;font:12px var(--body);color:var(--muted)}
.links{display:flex;flex-direction:column;gap:2px;margin-top:14px}
.links a{padding:8px 10px;border-radius:6px;text-decoration:none;color:var(--ink);font-weight:500}
.links a:hover{background:var(--bg)}
.links a.on{background:var(--accent-soft);color:var(--accent)}
.who{display:flex;flex-direction:column;gap:4px;padding:10px 8px 0;font-size:12px;color:var(--muted)}
.who select{width:100%}
.banner{border:1px solid var(--line);background:var(--surface);border-left:4px solid var(--accent);border-radius:6px;padding:8px 12px;font-size:14px}
.banner.ro{border-left-color:var(--warn)}
.navfoot{margin-top:auto;display:flex;flex-direction:column;gap:8px;padding:8px;font-size:12px;color:var(--muted)}

main{flex:1;min-width:0;overflow:auto;padding:24px 28px 48px}
.wrap{max-width:1120px;margin:0 auto;display:flex;flex-direction:column;gap:20px}
.head{display:flex;flex-wrap:wrap;gap:12px;align-items:center;justify-content:space-between}
.head p{margin:2px 0 0;color:var(--muted)}
.row{display:flex;flex-wrap:wrap;gap:10px;align-items:center}
.grid2{display:grid;grid-template-columns:repeat(auto-fit,minmax(320px,1fr));gap:20px}
.tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:12px}
.tile{background:var(--surface);border:1px solid var(--line);border-radius:8px;padding:14px 16px}
.tile b{display:block;font:600 26px var(--display);font-variant-numeric:tabular-nums}
.tile span{color:var(--muted);font-size:13px}
.tile em{display:block;font-style:normal;font-size:12px;margin-top:4px}
.panel{background:var(--surface);border:1px solid var(--line);border-radius:8px;min-width:0}
.panel>header{display:flex;flex-wrap:wrap;gap:8px;justify-content:space-between;align-items:center;padding:12px 16px;border-bottom:1px solid var(--line)}
.panel .body{padding:12px 16px}
.scroll{overflow-x:auto}
table{width:100%;border-collapse:collapse;font-size:14px}
th{font-size:12px;font-weight:600;color:var(--muted);text-align:left;text-transform:uppercase;letter-spacing:.04em}
th,td{padding:9px 16px;border-bottom:1px solid var(--line);vertical-align:top}
tr:last-child td{border-bottom:0}
td.n,th.n{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}
td small{display:block;color:var(--muted)}
.empty{padding:18px 16px;color:var(--muted)}

.pill{display:inline-block;padding:1px 9px;border-radius:99px;font-size:12px;font-weight:600;white-space:nowrap;border:1px solid currentColor}
.pill.good{color:var(--good)} .pill.warn{color:var(--warn)} .pill.bad{color:var(--bad)}
.pill.acc{color:var(--accent)} .pill.mut{color:var(--muted)}
.bad-t{color:var(--bad)} .warn-t{color:var(--warn)} .mut{color:var(--muted)}

button,.btn{font:500 14px var(--body);padding:7px 13px;border-radius:6px;border:1px solid var(--line);background:var(--surface);color:var(--ink);cursor:pointer}
button:hover{border-color:var(--accent)}
button.pri{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
button.sm{padding:3px 9px;font-size:13px}
input,select,textarea{font:14px var(--body);padding:7px 9px;border:1px solid var(--line);border-radius:6px;background:var(--surface);color:var(--ink);max-width:100%}
textarea{min-height:76px;resize:vertical}

.list{list-style:none;margin:0;padding:0}
.list li{display:flex;gap:12px;align-items:flex-start;padding:10px 16px;border-bottom:1px solid var(--line)}
.list li:last-child{border-bottom:0}
.list .when{flex:none;width:92px;font-variant-numeric:tabular-nums;font-weight:500}
.list .what{flex:1;min-width:0}
.list .what small{display:block;color:var(--muted)}
.done .what{text-decoration:line-through;color:var(--muted)}
.bars{display:flex;flex-direction:column;gap:10px}
.bar{display:grid;grid-template-columns:1fr auto;gap:2px 10px;font-size:13px}
.bar i{grid-column:1/-1;height:8px;border-radius:4px;background:var(--accent-soft);overflow:hidden}
.bar i u{display:block;height:100%;background:var(--accent);border-radius:4px}
.bar span:nth-child(2){font-variant-numeric:tabular-nums;font-weight:500}
.facts{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:14px 20px;margin:0}
.facts dt{font-size:12px;color:var(--muted);text-transform:uppercase;letter-spacing:.04em}
.facts dd{margin:2px 0 0;font-weight:500}
.note{padding:10px 16px;border-bottom:1px solid var(--line)}
.note small{color:var(--muted)}
.alert{border:1px solid var(--warn);color:var(--warn);border-radius:6px;padding:8px 10px;font-size:13px}
.alert ul{margin:4px 0 0;padding-left:18px}

dialog{border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--ink);padding:0;width:min(540px,calc(100% - 32px));max-height:calc(100% - 32px)}
dialog::backdrop{background:rgba(0,0,0,.45)}
dialog form,dialog .dbody{display:flex;flex-direction:column;gap:12px;padding:20px}
dialog label{display:flex;flex-direction:column;gap:4px;font-size:13px;font-weight:500}
dialog .row{justify-content:flex-end;margin-top:4px}
.toast{position:fixed;bottom:18px;left:50%;transform:translateX(-50%);background:var(--ink);color:var(--bg);padding:8px 14px;border-radius:6px;font-size:14px}

@media (max-width:780px){
  body{flex-direction:column}
  nav{width:auto;border-right:0;border-bottom:1px solid var(--line);padding:10px 12px}
  .links{flex-direction:row;overflow-x:auto;margin-top:6px}
  .links a{white-space:nowrap}
  .navfoot{display:none}
  main{padding:16px}
}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}

/* ---- additions for the full application ---- */
.navfoot a{color:var(--muted)}
.navfoot form{margin:0}
.msgs{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}
.msgs li{border:1px solid var(--line);border-left:4px solid var(--good);background:var(--surface);border-radius:6px;padding:8px 12px}
.msgs li.warning{border-left-color:var(--warn);color:var(--warn)} .msgs li.error{border-left-color:var(--bad);color:var(--bad)}
.narrow{max-width:640px}
.form{display:flex;flex-direction:column;gap:14px}
.field{display:flex;flex-direction:column;gap:4px}
.field>label{font-size:13px;font-weight:600}
.field small{color:var(--muted)}
.field input:not([type=checkbox]):not([type=radio]):not([type=file]),.field select,.field textarea{width:100%}
.field div[id]{display:flex;flex-direction:column;gap:4px} .field div[id] label{font-weight:400;display:flex;gap:8px;align-items:center}
.errorlist{list-style:none;margin:0;padding:0;color:var(--bad);font-size:13px}
a.btn{text-decoration:none;display:inline-block}
a.btn.pri{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
a.btn.sm{padding:3px 9px;font-size:13px}
.inline{display:inline;margin:0}
.pager{display:flex;gap:12px;align-items:center;padding:10px 16px;color:var(--muted);font-size:13px}
.login{margin:8vh auto;width:min(380px,calc(100% - 32px))}
.changes{font-size:12px;color:var(--muted);overflow-wrap:anywhere;max-width:420px}
@media (max-width:780px){.navfoot{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;margin-top:8px;padding:0}}
@media print{nav,.noprint,.msgs,.banner{display:none!important} body{display:block;background:#fff} main{overflow:visible;padding:0} .panel{border:0}}
a.brand{display:block;padding:0 4px;line-height:0}
/* the logo's navy and green need a light ground, so it sits on a white plate in the dark theme */
.logo{max-width:100%;height:auto;background:#fff;border-radius:8px;padding:6px}
.firmname{padding:6px 10px 0;font-size:13px;color:var(--muted)}
@media (max-width:780px){a.brand .logo{width:120px}.firmname{display:none}}
.foot{margin-top:12px;padding-top:14px;border-top:1px solid var(--line);text-align:center;line-height:0}
.foot .logo{padding:4px 8px;background:transparent}
/* the dark lettering needs a light ground in the dark theme */
@media (prefers-color-scheme:dark){.foot .logo{background:#fff}}
@media print{.foot{display:none}}
.signoff{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px}
.signoff>div{border:1px solid var(--line);border-radius:6px;padding:10px 12px}
.signoff .step{font-size:12px;color:var(--muted);text-transform:uppercase;letter-spacing:.04em;margin-bottom:4px}
.qr{flex:none;line-height:0;background:#fff;border-radius:6px}
.links .pill{font-size:11px;padding:0 6px}

/* ---- A4 printing: fee notes, credit notes, payment vouchers, purchase orders, reports ---- */
.printonly{display:none}
.letterhead{display:flex;gap:14px;align-items:center;flex:1;min-width:220px}
.letterhead+div{flex:none}
.firmlogo{max-height:64px;max-width:220px;width:auto;height:auto;flex:none}
@page{size:A4 portrait;margin:16mm 15mm 18mm}
@media print{
  /* always print in the light palette, whatever theme the screen uses */
  :root,:root:not([data-theme="light"]),:root[data-theme="dark"]{
    --bg:#fff!important;--surface:#fff!important;--ink:#111!important;--muted:#444!important;--line:#bbb!important;
    --accent:#12243D!important;--accent-soft:#eee!important;--good:#1d6b3f!important;--warn:#7a4e00!important;--bad:#a3201a!important;
    color-scheme:light}
  html,body{height:auto;background:#fff}
  body{font-size:10.5pt;line-height:1.4;-webkit-print-color-adjust:exact;print-color-adjust:exact}
  main{overflow:visible;padding:0}
  .wrap{max-width:none;gap:10pt}
  h1{font-size:16pt} h2{font-size:13pt}
  .panel{max-width:none!important;border:0;border-radius:0}
  .panel .body,.panel>header{padding-left:0;padding-right:0}
  .scroll{overflow:visible}
  table{font-size:10pt}
  th,td{padding:5pt 8pt}
  th:first-child,td:first-child{padding-left:0} th:last-child,td:last-child{padding-right:0}
  thead{display:table-header-group}
  tr,.signoff>div,.secure,.alert,.facts>div{break-inside:avoid}
  .signoff{grid-template-columns:repeat(3,1fr)}
  .signoff:has(>div:nth-child(2):last-child){grid-template-columns:repeat(2,1fr)}
  .facts{grid-template-columns:repeat(4,1fr);gap:8pt 12pt}
  .secure{break-before:avoid}
  .qr svg{width:28mm;height:28mm}
  .firmlogo{max-height:22mm;max-width:60mm}
  .panel .head{flex-wrap:nowrap;align-items:flex-start}
  .letterhead{min-width:0}
  a{color:inherit;text-decoration:none}
  .printonly{display:block;margin-top:8pt;padding-top:6pt;border-top:1px solid var(--line);font-size:8pt;color:var(--muted)}
}
td:first-child a{white-space:nowrap}
.list .when{width:auto;min-width:92px;white-space:nowrap}
.tabs{display:flex;gap:4px;border-bottom:1px solid var(--line)}
.tabs:empty{display:none}
.tabs a{padding:8px 14px;text-decoration:none;color:var(--muted);font-weight:500;border-bottom:2px solid transparent;margin-bottom:-1px}
.tabs a.on{color:var(--accent);border-bottom-color:var(--accent)}
.activities{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:10px}
.activity{display:flex;flex-direction:column;gap:2px;padding:12px 14px;border:1px solid var(--line);border-radius:8px;text-decoration:none;color:var(--ink);background:var(--surface)}
.activity:hover{border-color:var(--accent);background:var(--accent-soft)}
.activity b{color:var(--accent)}
.activity span{font-size:13px;color:var(--muted)}
table.items input{width:100%} table.items td{padding:4px 6px} table.items td.n input{text-align:right;min-width:90px}
.lettertext{max-width:70ch;line-height:1.55}
.lettertext h3{font-family:var(--display);font-size:15px;margin:14px 0 4px}
.lettertext p{margin:0 0 10px}
.lettertext ul{margin:0 0 10px;padding-left:20px}
code{background:var(--accent-soft);padding:1px 5px;border-radius:4px;font-size:13px}
@media print{.lettertext{max-width:none;font-size:10.5pt} .lettertext h3{font-size:11pt;break-after:avoid}}

tr.group td{background:var(--tint,rgba(0,0,0,.035))}

/* ---------- illustrations (drawn by tools/make_art.py) ---------- */
img.art{flex:none;border-radius:22%;display:block}
.links a{display:flex;align-items:center;gap:10px}
.links a .pill{margin-left:auto}
.activity{flex-direction:row;align-items:center;gap:12px}
.activity>span{display:flex;flex-direction:column;gap:2px;min-width:0}
.wrap>.head>div:first-child{min-height:64px;padding-left:78px;background:left center/64px 64px no-repeat;display:flex;flex-direction:column;justify-content:center}
.sec-dashboard .wrap>.head>div:first-child{background-image:url(art/dashboard.svg)}
.sec-matters .wrap>.head>div:first-child{background-image:url(art/matters.svg)}
.sec-clients .wrap>.head>div:first-child{background-image:url(art/clients.svg)}
.sec-time .wrap>.head>div:first-child{background-image:url(art/time.svg)}
.sec-billing .wrap>.head>div:first-child{background-image:url(art/billing.svg)}
.sec-receipts .wrap>.head>div:first-child{background-image:url(art/receipts.svg)}
.sec-receive_money .wrap>.head>div:first-child{background-image:url(art/cash.svg)}
.sec-fee_estimates .wrap>.head>div:first-child{background-image:url(art/estimate.svg)}
.sec-engagement_letters .wrap>.head>div:first-child{background-image:url(art/letter.svg)}
.sec-vouchers .wrap>.head>div:first-child{background-image:url(art/voucher.svg)}
.sec-purchase_orders .wrap>.head>div:first-child{background-image:url(art/order.svg)}
.sec-petty_cash .wrap>.head>div:first-child{background-image:url(art/pettycash.svg)}
.sec-calendar .wrap>.head>div:first-child{background-image:url(art/calendar.svg)}
.sec-documents .wrap>.head>div:first-child{background-image:url(art/documents.svg)}
.sec-ledger .wrap>.head>div:first-child{background-image:url(art/ledger.svg)}
.sec-team .wrap>.head>div:first-child{background-image:url(art/team.svg)}
.sec-reports .wrap>.head>div:first-child{background-image:url(art/reports.svg)}
.sec-audit .wrap>.head>div:first-child{background-image:url(art/audit.svg)}
.sec-goods_received .wrap>.head>div:first-child{background-image:url(art/goods.svg)}
.sub-clearing .wrap>.head>div:first-child,.sub-banks .wrap>.head>div:first-child,.sub-reconciliations .wrap>.head>div:first-child{background-image:url(art/bank.svg)}
.sub-spot_checks .wrap>.head>div:first-child{background-image:url(art/audit.svg)}
.sub-trust .wrap>.head>div:first-child,.sub-trust_receipts .wrap>.head>div:first-child{background-image:url(art/trust.svg)}
.licence{margin-top:28px;font-size:12px;color:var(--muted);text-align:center}
@media (max-width:780px){.wrap>.head>div:first-child{padding-left:60px;background-size:48px 48px;min-height:48px}}
@media print{main .wrap>.head>div:first-child{padding-left:0!important;min-height:0!important;background-image:none!important} .licence{margin-top:14pt;font-size:7.5pt;color:#333;border-top:.5pt solid #999;padding-top:4pt}}

.printhead{display:none}
@media print{.printhead{display:block;margin-bottom:12pt;padding-bottom:8pt;border-bottom:.5pt solid #999}}
.banner.bad{border-left-color:var(--bad)}
.support{margin-top:28px;font-size:13px;color:var(--muted);text-align:center}
.support+.licence{margin-top:6px}
.qr2 svg{display:block;width:230px;height:230px;border:1px solid var(--line)}
.codes{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px}
.codes code{font-size:18px;padding:8px 10px;border:1px solid var(--line);border-radius:6px;text-align:center;letter-spacing:.06em}
.sec-accounts .wrap>.head>div:first-child{background-image:url(art/users.svg)}
