:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e3e6eb;
  --text: #17202c;
  --muted: #5f6b7a;
  --faint: #8a95a3;
  --side: #0f1b2d;
  --side-text: #c4cdd8;
  --accent: #0b6e4f;
  --accent-soft: #e6f3ee;
  --warn: #9a5b00;
  --warn-soft: #fdf3e1;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --info-soft: #eef3fb;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.5 "Segoe UI", Inter, system-ui, -apple-system, Roboto, sans-serif;
  color: var(--text); background: var(--bg);
  display: grid; grid-template-columns: 232px 1fr;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Sidebar */
.sidebar { background: var(--side); color: var(--side-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; padding: 20px 18px 18px; }
.logo { width: 32px; height: 32px; border-radius: 7px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; }
.brand-name { color: #fff; font-weight: 600; }
.brand-sub { font-size: 12px; color: #8b97a8; max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
nav { display: flex; flex-direction: column; padding: 6px 10px; gap: 2px; }
nav a { color: var(--side-text); padding: 8px 10px; border-radius: 6px; }
nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
nav a.active { background: rgba(255,255,255,.1); color: #fff; font-weight: 600; }
.sidebar-foot { margin-top: auto; padding: 16px 18px; font-size: 12px; color: #7d899a; }

/* Layout */
.view { padding: 28px 36px 60px; max-width: 1200px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
h1 { font-size: 22px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 650; }
.sub { color: var(--muted); margin: 2px 0 0; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 12px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.card .label { color: var(--muted); font-size: 12.5px; }
.card .value { font-size: 22px; font-weight: 650; margin-top: 4px; letter-spacing: -.01em; }
.card .meta { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.card.ok { border-left: 4px solid var(--accent); }
.card.warn { border-left: 4px solid #e0a030; }
.card.bad { border-left: 4px solid var(--bad); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; padding: 8px 10px; border-bottom: 1px solid var(--border); background: #fafbfc; }
td { padding: 9px 10px; border-bottom: 1px solid #eef0f3; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.total td { font-weight: 650; border-top: 1px solid var(--border); }
tr.done td { color: var(--faint); }
tr.done .title { text-decoration: line-through; }
.table-wrap { overflow-x: auto; }
.empty { color: var(--muted); padding: 22px 10px; text-align: center; }

/* Badges & notices */
.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: #eef0f3; color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.fbr { background: #e8eefb; color: #2953a6; }
.badge.secp { background: #f1e9fb; color: #6b3fa8; }
.badge.pseb { background: var(--accent-soft); color: var(--accent); }
.notice { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; background: var(--info-soft); border: 1px solid #d6e2f5; }
.notice.warn { background: var(--warn-soft); border-color: #f2dcb3; }
.notice.bad { background: var(--bad-soft); border-color: #f5c6c1; }
.notice.ok { background: var(--accent-soft); border-color: #c6e4d8; }
.flag { color: var(--bad); font-size: 12px; }
.flag.warn { color: var(--warn); }
.guidance { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.due-overdue { color: var(--bad); font-weight: 600; }
.due-soon { color: var(--warn); font-weight: 600; }

/* Forms */
label { display: block; font-size: 12.5px; font-weight: 600; color: #3b4654; margin-bottom: 4px; }
input, select, textarea {
  font: inherit; color: inherit; width: 100%; padding: 7px 10px; border: 1px solid #cfd5dd; border-radius: 6px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(11,110,79,.25); border-color: var(--accent); }
input[type=checkbox] { width: auto; }
textarea { resize: vertical; min-height: 60px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; font-size: 13.5px; color: var(--text); margin: 0; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 400; }
.inline-date { width: 140px; padding: 4px 8px; }
.select-sm { width: auto; padding: 5px 8px; }

/* Buttons */
.btn { font: inherit; font-weight: 600; border: 1px solid #cfd5dd; background: #fff; color: var(--text); padding: 7px 14px; border-radius: 6px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: #f6f7f9; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #095c42; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 10px; font-size: 12.5px; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 0; font-weight: 500; }
.btn:disabled { opacity: .55; cursor: default; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; }
.tabs a.active { color: var(--accent); border-color: var(--accent); }
.tabs a:hover { text-decoration: none; color: var(--text); }

/* Dialog */
dialog { border: 0; border-radius: 10px; padding: 0; width: min(640px, 94vw); box-shadow: 0 20px 50px rgba(16,24,40,.25); }
dialog::backdrop { background: rgba(15,27,45,.45); }
.dlg-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.dlg-head h2 { margin: 0; }
.dlg-body { padding: 18px 20px; max-height: 70vh; overflow: auto; }
.dlg-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: #fafbfc; border-radius: 0 0 10px 10px; }
.x { border: 0; background: none; font-size: 20px; cursor: pointer; color: var(--muted); }

.toast { position: fixed; bottom: 22px; right: 22px; background: #17202c; color: #fff; padding: 10px 16px; border-radius: 8px; opacity: 0; transform: translateY(10px); transition: .2s; pointer-events: none; max-width: 420px; }
.toast.show { opacity: 1; transform: none; }
.toast.error { background: var(--bad); }
.loading { color: var(--muted); padding: 40px 0; }

.pseb-hero { display: flex; justify-content: space-between; gap: 20px; align-items: center; flex-wrap: wrap; }
.pseb-hero .big { font-size: 20px; font-weight: 650; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 18px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* Sign in */
#user-box { margin-bottom: 10px; color: var(--side-text); }
#user-box .user-name { color: #fff; font-weight: 600; font-size: 13px; }
#user-box a { color: #9fd3bf; }
.disclaimer { font-size: 12px; }
body.auth-mode { grid-template-columns: 1fr; }
body.auth-mode .sidebar { display: none; }
body.auth-mode .view { max-width: none; }
.auth-wrap { min-height: calc(100vh - 88px); display: grid; place-items: center; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 28px; width: min(400px, 100%); box-shadow: 0 8px 30px rgba(16,24,40,.08); }
.auth-card h1 { font-size: 19px; margin-top: 18px; }
.auth-card label { margin-top: 14px; }
.auth-logo { display: flex; gap: 10px; align-items: center; }
.auth-title { font-weight: 650; }
.auth-btn { width: 100%; justify-content: center; margin-top: 18px; padding: 9px 14px; }
.auth-error { color: var(--bad); font-size: 13px; min-height: 18px; margin-top: 10px; }

/* Read-only users: hide controls that change data (the server enforces this too) */
.readonly #new-entry, .readonly [data-edit], .readonly [data-del], .readonly [data-dep], .readonly #add-cert,
.readonly #add-task, .readonly #add-event, .readonly #upload, .readonly .ck-attach, .readonly .ck-more,
.readonly #profile-form button, .readonly #rates-form button, .readonly a.btn[href*="new=1"] { display: none !important; }
.readonly .ck-done, .readonly .ck-status, .readonly .ck-due, .readonly #profile-form input, .readonly #profile-form select,
.readonly #profile-form textarea, .readonly #rates-form input { pointer-events: none; opacity: .75; }

/* Expense: type picker and tailored form */
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.type-tile { font: inherit; text-align: left; border: 1px solid var(--border); background: #fff; border-radius: 10px; padding: 12px; cursor: pointer; display: grid; gap: 2px; transition: border-color .12s, box-shadow .12s; }
.type-tile:hover, .type-tile:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(11,110,79,.12); outline: none; }
.type-icon { font-size: 22px; line-height: 1; }
.type-label { font-weight: 650; margin-top: 6px; }
.type-blurb { font-size: 12px; color: var(--muted); }
.type-mini { font-size: 14px; }
.exp-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; align-items: start; }
.exp-type { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.exp-type .btn { margin-left: auto; }
.exp-summary { position: sticky; top: 0; background: #f7faf8; border: 1px solid #d5e8df; border-radius: 10px; padding: 14px; font-size: 13px; }
.sum-title { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; margin-bottom: 8px; }
.sum-row { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; }
.sum-row.big { font-size: 15px; border-bottom: 1px solid #d5e8df; padding-bottom: 8px; margin-bottom: 4px; }
.sum-row b { font-variant-numeric: tabular-nums; }
.sum-notes { display: grid; gap: 6px; margin: 10px 0; }
.sum-note { font-size: 12.5px; }
.sum-note.ok { color: var(--accent); font-weight: 600; }
.sum-note.bad { color: var(--bad); font-weight: 600; }
.sum-note.warn { color: var(--warn); }
.sum-explain { font-size: 12px; color: var(--muted); }
.sum-journal { margin-top: 10px; font-size: 12px; }
.sum-journal summary { cursor: pointer; color: var(--accent); }
.sum-journal .journal td, .sum-journal .journal th { padding: 4px 6px; font-size: 11.5px; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid #cfd5dd; border-radius: 8px; overflow: hidden; }
.seg label { margin: 0; font-weight: 500; font-size: 13px; color: var(--text); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 7px 12px; cursor: pointer; border-right: 1px solid #e3e6eb; }
.seg label:last-child span { border-right: 0; }
.seg input:checked + span { background: var(--accent); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid rgba(11,110,79,.4); outline-offset: -2px; }
.picker-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; margin-bottom: 12px; }
.icon-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-pick label { margin: 0; }
.icon-pick input { position: absolute; opacity: 0; pointer-events: none; }
.icon-pick span { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 8px; font-size: 18px; cursor: pointer; background: #fff; }
.icon-pick input:checked + span { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(11,110,79,.15); }
/* Recording guide */
.guide-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 18px; align-items: start; }
.guide-nav { position: sticky; top: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow); max-height: calc(100vh - 40px); overflow: auto; }
.guide-nav input { margin-bottom: 8px; }
.guide-nav a { display: grid; grid-template-columns: 24px 1fr; gap: 8px; padding: 8px; border-radius: 6px; color: var(--text); font-size: 13px; }
.guide-nav a span:last-child { display: grid; }
.guide-nav a:hover { background: #f3f5f7; text-decoration: none; }
.guide-nav a.on { background: var(--accent-soft); }
.guide-nav a.on b { color: var(--accent); }
.gd-head { padding: 16px 18px; }
.gd-h { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.gd-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.gd-docs { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.gd-fields { display: flex; flex-wrap: wrap; gap: 6px; }
.gd-note { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; background: #fff8e6; border: 1px solid #f2dcb3; border-radius: var(--radius); padding: 12px 14px; margin-bottom: 18px; }
.gd-note.empty { background: #fafbfc; border-style: dashed; border-color: var(--border); }
.rules-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.rule-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.rule-list li { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding-top: 8px; border-top: 1px solid #eef0f3; font-size: 13.5px; }
.rule-list li:first-child { border-top: 0; padding-top: 0; }
.rule-list a { white-space: nowrap; }
.glossary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px; margin: 0; }
.glossary dt { font-weight: 700; color: var(--accent); }
.glossary dd { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
@media (max-width: 960px) { .guide-layout, .gd-cards, .rules-grid, .glossary { grid-template-columns: 1fr; } .guide-nav { position: static; max-height: none; } }
/* Settings */
.set-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 22px; align-items: start; }
.set-nav { position: sticky; top: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; display: grid; gap: 2px; box-shadow: var(--shadow); }
.set-nav input { margin-bottom: 8px; }
.set-nav a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 6px; color: var(--text); font-size: 13.5px; }
.set-nav a:hover { background: #f3f5f7; text-decoration: none; }
.set-nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.set-i { width: 20px; text-align: center; }
.set-title { font-size: 18px; margin: 4px 0 14px; }
.set-body > .panel:first-of-type, .set-body #set-body > .panel:first-child { margin-top: 0; }
.set-group { border: 0; border-top: 1px solid var(--border); margin: 0 0 6px; padding: 14px 0 10px; }
.set-group:first-of-type { border-top: 0; padding-top: 0; }
.set-group legend { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 0 8px 0 0; }
.set-save { position: sticky; bottom: 0; display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 12px 0 2px; background: linear-gradient(transparent, var(--surface) 30%); }
.prof-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; align-items: start; }
.prof-aside { position: sticky; top: 12px; }
.rule { display: grid; grid-template-columns: 22px 1fr; gap: 8px; font-size: 13px; padding: 6px 0; border-top: 1px solid #eef0f3; }
.rule:first-child { border-top: 0; }
.act-d { max-width: 420px; word-break: break-word; }
#set-body #heads-panel > .panel-head h2, #set-body #checklist-panel > .panel-head h2, #set-body #doctypes-panel > .panel-head h2, #set-body #ai-panel > .panel-head h2 { visibility: hidden; }
@media (max-width: 1100px) { .prof-layout { grid-template-columns: 1fr; } .prof-aside { position: static; } }
@media (max-width: 860px) { .set-layout { grid-template-columns: 1fr; } .set-nav { position: static; } }
/* AI assistant */
.ai-spend { display: grid; gap: 3px; min-width: 150px; }
.bar.thin { height: 5px; }
.ai-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; align-items: start; }
.chat-panel { display: flex; flex-direction: column; padding: 0; }
.chat { min-height: 320px; max-height: 58vh; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.chat-empty { margin: auto; text-align: center; color: var(--text); max-width: 380px; display: grid; gap: 4px; }
.chat-empty-i { font-size: 30px; }
.msg { display: flex; }
.msg.me { justify-content: flex-end; }
.bubble { max-width: 80%; padding: 10px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.55; }
.msg.me .bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.ai .bubble { background: #f3f5f7; border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.bubble p { margin: 0 0 6px; } .bubble p:last-child { margin-bottom: 0; }
.bubble ul, .fmt ul { margin: 4px 0 6px; padding-left: 18px; }
.msg-meta { margin-top: 6px; }
.typing i { display: inline-block; width: 6px; height: 6px; margin-right: 3px; border-radius: 50%; background: #9aa6b5; animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.chat-chips { padding: 0 16px; margin: 0 0 10px; }
.chat-chips .chip { font-size: 12.5px; }
.chat-input { border-top: 1px solid var(--border); padding: 12px 16px; display: grid; gap: 8px; }
.chat-input textarea { min-height: 48px; }
.chat-actions { display: flex; justify-content: space-between; }
.hist { display: grid; gap: 2px; max-height: 60vh; overflow-y: auto; }
.hist-i { font: inherit; text-align: left; border: 0; background: none; padding: 7px 8px; border-radius: 6px; cursor: pointer; display: grid; gap: 1px; font-size: 13px; color: var(--text); }
.hist-i:hover { background: #f3f5f7; }
.hist-i span:first-child { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.drafts { display: grid; }
.draft-i { font: inherit; text-align: left; border: 0; border-top: 1px solid #eef0f3; background: none; padding: 12px 16px; cursor: pointer; display: grid; grid-template-columns: 30px 1fr; gap: 10px; color: var(--text); }
.draft-i:first-child { border-top: 0; }
.draft-i:hover { background: #fafbfc; }
.draft-ic { font-size: 20px; }
.draft-b { display: grid; gap: 1px; }
.draft-text { font-family: Georgia, serif; font-size: 13.5px; line-height: 1.6; }
.type-tile:disabled { opacity: .5; cursor: default; }
@media (max-width: 960px) { .ai-layout { grid-template-columns: 1fr; } }
/* Dashboard */
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 18px; }
.qa { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-weight: 600; font-size: 13px; box-shadow: var(--shadow); }
.qa span { font-size: 20px; }
.qa:hover { border-color: var(--accent); text-decoration: none; box-shadow: 0 0 0 3px rgba(11,110,79,.1); }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.dw.full { grid-column: 1 / -1; }
.dw > .panel, .dw > .cards { height: calc(100% - 18px); }
.dash-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.att-list { display: grid; gap: 2px; }
.att { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 8px; border-left: 3px solid transparent; }
.att.bad { border-left-color: var(--bad); background: #fef7f6; }
.att.warn { border-left-color: #e0a030; background: #fffaf0; }
.att.info { border-left-color: #6b8fd6; background: #f6f8fd; }
.att-i { font-size: 18px; text-align: center; }
.att-t { font-weight: 600; font-size: 13.5px; }
.att-clear { color: var(--accent); font-weight: 600; padding: 8px 0; }
.dl-list { display: grid; gap: 8px; }
.dl { display: grid; grid-template-columns: 46px 1fr; gap: 10px; align-items: center; }
.dl-date { border: 1px solid var(--border); border-radius: 8px; text-align: center; padding: 3px 0; line-height: 1.15; }
.dl-date b { display: block; font-size: 16px; }
.dl-date span { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.dl-date.due-soon { border-color: #e0a030; }
.dl-date.due-overdue { border-color: var(--bad); }
.ring-row { display: flex; gap: 18px; align-items: center; }
.ring { --p: 0; width: 84px; height: 84px; border-radius: 50%; flex: none; display: grid; place-items: center; background: conic-gradient(var(--accent) calc(var(--p) * 1%), #eef0f3 0); }
.ring span { width: 64px; height: 64px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 700; font-size: 17px; }
.cust-list { display: grid; gap: 6px; }
.cust-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; }
@media (max-width: 1100px) { .dash-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) { .dash-grid { grid-template-columns: 1fr; } .dash-kpis { grid-template-columns: 1fr 1fr; } }
/* Year-end */
.ychecks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px; }
.ycheck { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid #eef0f3; }
.ycheck-l { font-weight: 600; font-size: 13.5px; }
.mchart { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; height: 150px; align-items: end; margin-bottom: 8px; }
.mcol { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 4px; }
.mbars { display: flex; align-items: flex-end; gap: 2px; height: 100%; }
.mb { flex: 1; border-radius: 3px 3px 0 0; min-height: 1px; }
.mb.in { background: var(--accent); }
.mb.ex { background: #9aa6b5; }
.ml { font-size: 11px; color: var(--muted); text-align: center; }
.hbar { margin-bottom: 9px; }
.hbar-l { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 3px; }
.hbar-t { height: 7px; background: #eef0f3; border-radius: 99px; overflow: hidden; }
.hbar-t span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.tcomp td { padding: 7px 8px; }
.tcomp tr.total td { font-weight: 650; border-top: 1px solid var(--border); }
.tcomp tr.grand td { font-weight: 700; font-size: 15px; border-top: 2px solid var(--text); }
.tcomp tr.muted-row td { color: var(--muted); }
.tcomp tr.chosen td { background: var(--accent-soft); }
.tcomp tr.bad-row td { color: var(--bad); }
.pack-list { display: grid; gap: 8px; }
.pack-list .btn { justify-content: flex-start; }
@media (max-width: 860px) { .ychecks { grid-template-columns: 1fr; } }
/* PSEB */
.psteps { grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 0; padding-top: 0; margin-top: 0; }
.ptimeline { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; }
.pm { display: grid; gap: 4px; justify-items: center; position: relative; }
.pm-bar { width: 100%; height: 26px; border-radius: 5px; background: #eef0f3; }
.pm.full .pm-bar { background: var(--accent); }
.pm.part .pm-bar { background: linear-gradient(90deg, var(--accent) 50%, #f2c3be 50%); }
.pm.none .pm-bar { background: #f2c3be; }
.pm.future.none .pm-bar { background: #eef0f3; }
.pm-l { font-size: 11.5px; color: var(--muted); }
.pm-dot { position: absolute; top: 5px; font-size: 11px; font-weight: 700; color: #fff; background: #17202c; border-radius: 99px; padding: 0 6px; line-height: 16px; }
.lg { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 3px 0 10px; vertical-align: -1px; }
.lg.full { background: var(--accent); } .lg.part { background: linear-gradient(90deg, var(--accent) 50%, #f2c3be 50%); } .lg.none { background: #f2c3be; }
details.panel summary { cursor: pointer; }
@media (max-width: 860px) { .psteps { grid-template-columns: 1fr; } .ptimeline { grid-template-columns: repeat(6, 1fr); } }
/* Withholding */
.qgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.qgrid .qcard { margin: 0; }
.qamt { font-size: 18px; margin-bottom: 2px; }
.wsteps { display: grid; gap: 10px; margin-top: 14px; border-top: 1px solid #eef0f3; padding-top: 12px; }
.wstep { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; }
.wstep .btn { margin-top: 6px; }
.wstep-l { font-weight: 600; }
.wdot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #cfd5dd; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.wstep.done .wdot { background: var(--accent); border-color: var(--accent); color: #fff; }
.wstep.late .wdot { background: var(--bad); border-color: var(--bad); color: #fff; }
.wstep.todo .wdot { border-color: #e0a030; }
.wstep.na { opacity: .55; }
.cert-prev { border: 1px solid var(--border); border-radius: 8px; padding: 16px 18px; margin-top: 14px; background: #fff; font-family: Georgia, serif; font-size: 13px; max-height: 340px; overflow: auto; }
.cert-prev h3 { text-align: center; text-transform: uppercase; letter-spacing: .05em; font-size: 14px; }
.cert-prev table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.cert-prev .cert-t th, .cert-prev .cert-t td { border: 1px solid #ccc; padding: 4px 6px; font-size: 12px; }
.cert-prev .tot td { font-weight: 700; }
.cert-prev .cert-kv td { padding: 2px 8px 2px 0; border: 0; }
@media (max-width: 860px) { .qgrid { grid-template-columns: 1fr; } }
.iris-steps { background: #f6f8fd; border: 1px solid #d6e2f5; border-radius: var(--radius); padding: 8px 14px; margin-bottom: 12px; }
.iris-steps ol { margin: 0; padding-left: 18px; display: grid; gap: 3px; }
.iris-t code { font-size: 12px; }
.iris-t tr.bad-row td { background: var(--bad-soft); }
/* Documents */
.faint { color: var(--faint); }
.doc-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 18px; align-items: start; }
.doc-folders { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; }
.doc-folders a { display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 6px; color: var(--text); font-size: 13px; }
.doc-folders a:hover { background: #f3f5f7; text-decoration: none; }
.doc-folders a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.doc-folders .cnt { color: var(--muted); font-size: 12px; }
.doc-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.doc-list > .panel.empty { border: 0; box-shadow: none; margin: 0; }
.doc-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; padding: 12px 16px; border-top: 1px solid #eef0f3; align-items: center; }
.doc-row:first-child { border-top: 0; }
.doc-icon { font-size: 22px; text-align: center; }
.doc-title { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.doc-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.doc-exp { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid #eef0f3; }
.doc-exp:first-of-type { border-top: 0; }
.drop { display: block; border: 2px dashed #cfd5dd; border-radius: 10px; padding: 18px; text-align: center; cursor: pointer; margin-bottom: 14px; font-weight: 400; font-size: 13.5px; color: var(--text); background: #fafbfc; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
@media (max-width: 860px) { .doc-layout { grid-template-columns: 1fr; } .doc-folders { position: static; flex-direction: row; flex-wrap: wrap; } .doc-row { grid-template-columns: 34px 1fr; } .doc-actions { grid-column: 2; justify-content: flex-start; } }
/* Checklist */
.ck-progress { padding: 16px 20px; }
.ck-stats { display: flex; gap: 40px; flex-wrap: wrap; margin-bottom: 12px; }
.ck-num { font-size: 22px; font-weight: 650; }
.bad-text { color: var(--bad); }
.bar { height: 8px; background: #eef0f3; border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; align-items: center; }
.chip { font: inherit; font-size: 13px; border: 1px solid #cfd5dd; background: #fff; border-radius: 99px; padding: 4px 12px; cursor: pointer; color: var(--text); }
.chip span { color: var(--muted); font-size: 12px; margin-left: 2px; }
.chip.on { background: var(--side); border-color: var(--side); color: #fff; }
.chip.on span { color: #b7c2d0; }
.chip-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.ck-month h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 8px; }
.ck-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.ck-item { display: grid; grid-template-columns: 26px 1fr auto; gap: 12px; padding: 12px 16px; border-top: 1px solid #eef0f3; align-items: start; }
.ck-item:first-child { border-top: 0; }
.ck-item.done .ck-title, .ck-item.na .ck-title { color: var(--muted); }
.ck-title { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ck-meta { margin-top: 3px; color: var(--muted); }
.ck-guide { margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.ck-guide summary { cursor: pointer; color: var(--accent); width: fit-content; }
.ck-notes { margin-top: 4px; }
.ck-actions { display: flex; gap: 6px; align-items: center; }
.st { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #cfd5dd; display: grid; place-items: center; font-size: 12px; font-weight: 700; margin-top: 1px; }
.st-done { background: var(--accent); border-color: var(--accent); color: #fff; }
.st-late { background: var(--bad); border-color: var(--bad); color: #fff; }
.st-soon { border-color: #e0a030; }
.st-na { background: #eef0f3; color: var(--muted); }
@media (max-width: 860px) { .ck-item { grid-template-columns: 26px 1fr; } .ck-actions { grid-column: 2; } }
/* Rates */
.rates-h { font-size: 13px; margin: 18px 0 8px; color: #3b4654; }
.rates-table td { vertical-align: middle; }
.rate-in input { width: 78px; padding: 4px 8px; }
.slab-table th { font-size: 11px; }
.slab-table td { padding: 4px 6px; }
.slab-in { padding: 4px 8px; }
.slab-in.rate { width: 80px; }
@media (max-width: 860px) { .exp-layout { grid-template-columns: 1fr; } .exp-summary { position: static; } }

/* AI */
.ai-bar { background: #f4f1fb; border: 1px solid #e0d8f3; border-radius: var(--radius); padding: 10px 12px; margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.ai-bar #ai-fill-msg { flex-basis: 100%; }
.ai-answer { white-space: pre-wrap; background: #fafbfc; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-top: 12px; font-size: 13.5px; }
.ok-text { color: var(--accent); }
.upd { border-top: 1px solid #eef0f3; padding: 10px 0; display: grid; gap: 3px; }
.upd:first-of-type { border-top: 0; }
.upd.reviewed { opacity: .6; }
.upd-head { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.ai-key { background: #fafbfc; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.readonly #ai-fill, .readonly #ai-review { display: none !important; }

/* Recording guide */
.guide { margin-top: 18px; padding: 14px 16px; background: #f7faf8; border: 1px solid #d5e8df; border-radius: var(--radius); font-size: 13px; }
.guide-title { font-weight: 650; color: var(--accent); margin-bottom: 6px; }
.guide-h { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; margin: 10px 0 3px; }
.guide ul, .guide-item ul { margin: 0; padding-left: 18px; }
.guide-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.journal { margin-top: 2px; background: #fff; border: 1px solid var(--border); border-radius: 6px; }
.journal th { background: #fafbfc; }
.journal td { padding: 6px 10px; }
.indent { display: inline-block; width: 22px; }
.guide-item { border-top: 1px solid #eef0f3; padding: 10px 0; }
.guide-item:first-of-type { border-top: 0; }
.guide-item summary { cursor: pointer; display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; list-style: none; }
.guide-item summary::before { content: '▸'; color: var(--muted); }
.guide-item[open] summary::before { content: '▾'; }
.guide-item[open] { padding-bottom: 16px; }
.rules { margin: 0; padding-left: 18px; }
.rules li { margin-bottom: 6px; }

@media (max-width: 860px) {
  .guide-grid { grid-template-columns: 1fr; }
  body { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { display: none; }
  .view { padding: 20px 16px 40px; }
  .grid2, .form-grid, .form-grid.three { grid-template-columns: 1fr; }
}

@media print {
  body { display: block; background: #fff; }
  .sidebar, .no-print, .toast { display: none !important; }
  .view { padding: 0; max-width: none; }
  .panel, .card { box-shadow: none; break-inside: avoid; }
}

/* Deposit form: list of withheld payments a CPR covers */
.dep-rows { max-height: 240px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 4px 0; }
.dep-rows:empty::before { content: 'No undeposited payments in this quarter.'; display: block; padding: 8px 12px; color: var(--muted); font-size: 13px; }
.dep-row { display: flex; align-items: center; gap: 10px; padding: 6px 12px; margin: 0; cursor: pointer; }
.dep-row:hover { background: var(--bg); }
.dep-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dep-row b { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Two-step sign-in and cron */
.qr-box { display: flex; justify-content: center; margin: 8px 0 12px; }
.qr-box svg { width: 200px; height: 200px; background: #fff; border-radius: 8px; }
.code-box { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 12px; white-space: pre-wrap; word-break: break-all; margin: 0 0 10px; }

/* Financial statements */
.fs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.fs-grid h3 { margin: 6px 0 8px; font-size: 14px; }
table.fs { width: 100%; font-size: 13px; }
table.fs td, table.fs th { padding: 4px 6px; }
table.fs .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.fs tr.sub td { font-weight: 600; color: var(--muted); padding-top: 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
table.fs tr.t td { font-weight: 700; border-top: 1px solid var(--border); }

/* Invoices */
.inv-lines { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.inv-line { display: grid; grid-template-columns: 1fr 70px 120px 32px; gap: 6px; align-items: center; }
.inv-total { background: var(--bg); border-radius: 8px; padding: 10px 14px; display: flex; flex-direction: column; gap: 4px; }
.inv-total > div:not(.small) { display: flex; justify-content: space-between; }
.inv-total .big { font-size: 16px; border-top: 1px solid var(--border); padding-top: 6px; }
.inv-preview iframe { width: 100%; height: 60vh; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
@media (max-width: 600px) { .inv-line { grid-template-columns: 1fr 60px 90px 28px; } }

/* Bank reconciliation */
.big-input { font-size: 20px; font-weight: 700; width: 100%; max-width: 220px; padding: 4px 8px; }
tr.carried td { background: var(--warn-soft); }
.bk-tick { width: 18px; height: 18px; }
.num-in { width: 110px; text-align: right; }
