/* Ledgerwise — plain CSS, no build step. */

:root {
    --brand: #0d9488;
    --brand-dark: #0f766e;
    --brand-2: #4338ca;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --bg: #f5f7fb;
    --card: #ffffff;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --ok: #15803d;
    --ok-bg: #f0fdf4;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }

body {
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
p { margin: 0 0 1rem; }

/* ---------- Auth (split screen) ---------- */

.auth { display: flex; min-height: 100vh; }

.auth-banner {
    flex: 1.15;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px 56px;
    color: #fff;
    background:
        radial-gradient(circle at 15% 20%, rgba(45, 212, 191, .35), transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(99, 102, 241, .45), transparent 50%),
        linear-gradient(135deg, #0f766e 0%, #134e4a 40%, #312e81 100%);
}

.auth-banner::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: linear-gradient(to bottom, #000 30%, transparent 90%);
    pointer-events: none;
}

.auth-banner > * { position: relative; z-index: 1; }

.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 700; font-size: 1.35rem; color: inherit; }
.brand:hover { text-decoration: none; }

.banner-copy { max-width: 560px; }
.banner-copy .eyebrow {
    display: inline-block;
    padding: 4px 12px;
    margin-bottom: 18px;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    font-size: .8rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.banner-copy h1 { font-size: 2.6rem; font-weight: 800; margin-bottom: 16px; letter-spacing: -.02em; }
.banner-copy h1 span { color: #5eead4; }
.banner-copy p { font-size: 1.05rem; color: rgba(255, 255, 255, .8); }

.banner-features { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 14px; }
.banner-features li { display: flex; gap: 12px; align-items: flex-start; color: rgba(255, 255, 255, .9); }
.banner-features .ico {
    flex: none;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .12);
}
.banner-features strong { display: block; color: #fff; }
.banner-features small { color: rgba(255, 255, 255, .7); font-size: .88rem; }

.banner-art { margin: 32px 0 8px; max-width: 520px; }
.banner-art svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 20px 40px rgba(0, 0, 0, .25)); }

.banner-foot { font-size: .85rem; color: rgba(255, 255, 255, .6); }

.auth-form-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 24px;
    background: #fff;
}

.auth-card { width: 100%; max-width: 400px; }
.auth-card .mobile-brand { display: none; margin-bottom: 28px; }
.auth-card h2 { font-size: 1.7rem; font-weight: 700; margin-bottom: 6px; }
.auth-card .sub { color: var(--muted); margin-bottom: 28px; }
.auth-alt { margin-top: 24px; text-align: center; color: var(--muted); }

@media (max-height: 820px) {
    .auth-banner { padding-top: 32px; padding-bottom: 32px; }
    .banner-art { display: none; }
}

@media (max-width: 960px) {
    .auth-banner { display: none; }
    .auth-card .mobile-brand { display: inline-flex; }
}

/* ---------- Forms ---------- */

.field { margin-bottom: 18px; }
.field label, .label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }

.input-icon { position: relative; }
.input-icon > svg.lead {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}
.input-icon input[type] { padding-left: 44px; }
.input-icon .eye {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
}
.input-icon .eye:hover { color: var(--ink); background: #f1f5f9; }
.input-icon input[type].has-eye { padding-right: 48px; }
.eye .eye-off { display: none; }
.eye.on .eye-open { display: none; }
.eye.on .eye-off { display: block; }

input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=file], select, textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    font: inherit;
    color: inherit;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: 0;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(13, 148, 136, .15);
}
.is-invalid { border-color: var(--danger) !important; }
.error { color: var(--danger); font-size: .85rem; margin-top: 6px; }
.hint { color: var(--muted); font-size: .85rem; margin-top: 6px; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }

.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 10px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none !important;
    transition: background .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-dark)); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-light { color: var(--ink); background: #fff; border-color: var(--line); }
.btn-light:hover { background: #f8fafc; }
.btn-danger { color: #fff; background: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: .88rem; }
.btn-block { width: 100%; padding: 12px; }

.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 20px; font-size: .92rem; }
.alert-ok { color: var(--ok); background: var(--ok-bg); border: 1px solid #bbf7d0; }
.alert-error { color: var(--danger); background: var(--danger-bg); border: 1px solid #fecaca; }

/* ---------- App shell ---------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 250px;
    flex: none;
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    color: #cbd5e1;
    background: #0f172a;
}
.sidebar .brand { color: #fff; padding: 4px 10px 22px; font-size: 1.2rem; }
.nav-title { padding: 16px 12px 6px; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #64748b; }
.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: #cbd5e1;
    font-weight: 500;
}
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .06); text-decoration: none; }
.nav a.active { color: #fff; background: linear-gradient(135deg, rgba(13, 148, 136, .9), rgba(67, 56, 202, .8)); }
.nav a.soon { opacity: .5; pointer-events: none; }
.nav a.soon::after { content: "soon"; margin-left: auto; font-size: .68rem; padding: 1px 6px; border-radius: 6px; background: rgba(255, 255, 255, .1); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 28px;
    background: #fff;
    border-bottom: 1px solid var(--line);
}
.topbar .who { display: flex; align-items: center; gap: 12px; }
.avatar {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
}
.who small { display: block; color: var(--muted); font-size: .8rem; line-height: 1.2; }

/* Pages use the whole screen, up to a very wide monitor. */
.content { padding: 28px; max-width: 1840px; width: 100%; }

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 22px; }
.card h2 { margin-bottom: 4px; }
.card .card-sub { color: var(--muted); margin-bottom: 18px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat .num { font-size: 1.9rem; font-weight: 800; }
.stat .lbl { color: var(--muted); font-size: .9rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
details.card > summary { cursor: pointer; }
details.card[open] > summary { margin-bottom: 8px; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }

table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.table tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #f1f5f9; color: #334155; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-off { background: var(--danger-bg); color: var(--danger); }
.badge-brand { background: #ccfbf1; color: var(--brand-dark); }

.perm-group { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; }
.perm-group h3 { font-size: .95rem; margin-bottom: 10px; }
.perm-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; }
.perm-row select { width: auto; padding: 6px 10px; }

.qr { display: inline-block; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.code-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; padding: 14px; background: #f8fafc; border-radius: 10px; font-family: Consolas, monospace; }
.mono { font-family: Consolas, monospace; letter-spacing: .05em; word-break: break-all; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inline { display: inline; }

/* ---------- Bookkeeping screens ---------- */

.badge-warn { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-email { background: #ede9fe; color: #6d28d9; }
.alert-warn { color: #92400e; background: #fffbeb; border: 1px solid #fde68a; }
.alert a { color: inherit; }
.client-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.client-title h1 { margin: 0; }
.my-job { font-size: .88rem; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 999px; padding: 4px 12px; }
.my-job:hover { text-decoration: none; background: #fef3c7; }
.page-head .actions form { margin: 0; }
.comment-pop { max-width: 560px; margin: 0 auto; }
/* An entry's comments: one block per conversation, each with its own reply box. */
.entry-thread { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.entry-reply { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }
.entry-reply textarea { flex: 1; min-height: 44px; }
.comment-pop .context-check { background: #f0fdfa; border: 1px solid #99f6e4; border-radius: 8px; padding: 8px 12px; margin: 4px 0 14px; }
.recipients { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
.recipients legend { font-weight: 600; padding: 0 4px; }
.recipients .check { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.recipients .locked { color: var(--muted); }
.comment-where { font-size: .85rem; color: var(--brand); margin: 2px 0 4px; }
.comment-to { font-size: .8rem; margin-top: 4px; }
/* Client pages: the buttons always sit under the client's name, on the left, so they don't move between tabs. */
.page-head.client-head { flex-direction: column; align-items: stretch; }
/* Their own row between the client's name and the tabs, at the right (above the last tabs). */
.page-head.client-head .actions { justify-content: flex-end; flex-wrap: wrap; align-items: center; }
.page-head.client-head { gap: 12px; }
.page-head.client-head .actions > .actions { display: contents; }
.actions-sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 4px; }
.text-ok { color: var(--ok); }
.text-danger { color: var(--danger); }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 16px; }
@media (max-width: 960px) { .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 1080px) { .split { grid-template-columns: 1fr; } }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: -6px 0 22px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--brand-dark); border-bottom-color: var(--brand); }
/* Client tabs: many of them, so tighter, on one line; a narrow window scrolls them sideways instead of wrapping. */
/* No visible scrollbar: on a narrow window the row can still be swiped or shift-scrolled sideways. */
nav.tabs:not(.sub-tabs) { flex-wrap: nowrap; gap: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -ms-overflow-style: none; }
nav.tabs:not(.sub-tabs)::-webkit-scrollbar { display: none; }
/* The grey line is drawn inside the row (not as a border) so the hidden overflow doesn't clip the active tab's underline. */
nav.tabs:not(.sub-tabs) { border-bottom: 0; box-shadow: inset 0 -1px 0 var(--line); }
nav.tabs:not(.sub-tabs) a { margin-bottom: 0; }
nav.tabs:not(.sub-tabs) a { padding: 10px 12px; font-size: .92rem; white-space: nowrap; flex-shrink: 0; }
@media (max-width: 1500px) { nav.tabs:not(.sub-tabs) a { padding: 10px 6px; font-size: .86rem; } }
.sub-tabs { margin-top: -12px; }
.sub-tabs a { padding: 6px 12px; font-size: .9rem; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters input[type=text] { flex: 1 1 240px; }
.filters input, .filters select { width: auto; }
form.card.filters { padding: 14px 16px; }

.table td.num, .table th.num, .data .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table.kv th { width: 34%; text-transform: none; letter-spacing: 0; font-size: .88rem; vertical-align: top; }
.table tfoot td { border-top: 2px solid var(--line); }
.table.tx td { vertical-align: top; }
tr.row-danger td { background: #fef2f2; }
tr.row-muted td { background: #fafafa; }
tr.row-warn td { background: #fffbeb; }
/* Year-end readiness: one step per VAT quarter. */
.quarter-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.quarter-step { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #f8fafc; color: var(--ink); text-decoration: none; }
.quarter-step:hover { text-decoration: none; border-color: var(--brand); }
.quarter-step small { color: var(--muted); }
.quarter-step.done { background: var(--ok-bg); border-color: #bbf7d0; }
.quarter-step.done small { color: var(--ok); font-weight: 600; }
.quarter-step.draft { background: #fffbeb; border-color: #fde68a; }
/* Sortable column headings and the "How entered" column. */
th.is-sorted { color: var(--brand); }
th .sort-mark { margin-left: 4px; font-size: .75em; }
.entry-how { white-space: nowrap; }
.how { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #f1f5f9; color: #475569; }
.how-bank { background: #e0f2fe; color: #0369a1; }
.how-scanned { background: #ede9fe; color: #6d28d9; }
.how-manual { background: #f0fdfa; color: var(--brand-dark); }
.how-payroll, .how-contract, .how-mileage { background: #fef3c7; color: #92400e; }
.scope-hint { margin: 0 0 10px; padding: 6px 10px; border-radius: 8px; background: #f0fdfa; border: 1px solid #99f6e4; font-size: .88rem; color: var(--brand-dark); }
.inline-field { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; color: var(--muted); }
.inline-field input { width: auto; }
/* Banks tab: one card per bank account. */
.bank-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-bottom: 18px; }
.bank-card { display: flex; flex-direction: column; gap: 6px; color: var(--ink); text-decoration: none; margin: 0; border: 2px solid transparent; }
.bank-card:hover { text-decoration: none; border-color: var(--line); }
.bank-card.is-current { border-color: var(--brand); }
.bank-card .tile-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; background: #e0f2fe; color: #0369a1; }
.bank-figures { display: flex; gap: 14px; font-size: .9rem; color: var(--muted); }
.bank-figures strong { color: var(--ink); }
.flag { font-size: .8rem; margin-top: 4px; padding: 3px 8px; border-radius: 6px; display: inline-block; }
.flag-danger { background: #fee2e2; color: #991b1b; }
.flag-warning { background: #fef3c7; color: #92400e; }

.preview img { max-width: 100%; border-radius: 8px; display: block; margin: 0 auto; }
.preview iframe { width: 100%; height: 75vh; border: 1px solid var(--line); border-radius: 8px; }
.dropzone { border: 2px dashed var(--line); border-radius: 12px; padding: 18px; background: #f8fafc; }
.dropzone input[type=file] { border: 0; background: transparent; padding: 0; }

.segmented { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.segmented label { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 500; }
.segmented input { accent-color: var(--brand); }
.segmented label:has(input:checked) { border-color: var(--brand); background: #f0fdfa; }

.vat-boxes td { padding: 12px 8px; }
.vat-boxes td.box { font-weight: 700; color: var(--brand-dark); white-space: nowrap; width: 70px; }
.vat-boxes tr.total td { font-weight: 800; background: #f8fafc; }
.mini-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 4px; }

/* Financial statements (also used inside cards) */
.statements h2 { color: var(--brand-dark); margin-top: 18px; }
.statements h3 { font-size: .95rem; margin: 16px 0 6px; }
.statements .note { color: var(--muted); font-size: .88rem; }
table.data { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
table.data td, table.data th { padding: 7px 8px; border-bottom: 1px solid #f1f5f9; }
table.data th { font-size: .75rem; text-transform: uppercase; color: var(--muted); text-align: left; }
table.data tr.sub td { font-weight: 700; border-top: 1px solid #94a3b8; }
table.data tr.total td { font-weight: 800; border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); }
table.data tr.section td { font-weight: 700; padding-top: 14px; border-bottom: 0; }
table.data td.indent { padding-left: 22px; }
table.data .prior { color: var(--muted); }
.statements-text { margin: 12px 0 18px; padding: 12px 14px; background: #f8fafc; border-radius: 10px; }
.statements-text .note { margin: 0 0 6px; }
.statements-text .signature { margin-top: 18px; }
code { background: #f1f5f9; padding: 1px 6px; border-radius: 4px; font-size: .88em; }

/* ---------- Work in progress & alerts ---------- */

input[type=datetime-local] { width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.nav-count { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 999px; background: #dc2626; color: #fff; font-size: .72rem; font-weight: 700; text-align: center; }
.bell { position: relative; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; color: var(--muted); }
.bell:hover { background: #f1f5f9; color: var(--ink); }
.bell-count { position: absolute; top: 2px; right: 0; min-width: 18px; padding: 0 5px; border-radius: 999px; background: #dc2626; color: #fff; font-size: .68rem; font-weight: 700; line-height: 18px; text-align: center; }
a.stat { color: inherit; }
a.stat:hover { text-decoration: none; border-color: var(--brand); }

.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; align-items: start; }
.board-col { background: #eef2f7; border-radius: var(--radius); padding: 12px; min-height: 120px; }
.board-col h3 { font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 2px 4px 10px; }
.job-card { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; margin-bottom: 10px; background: #fff; border-radius: 10px; border-left: 4px solid var(--brand); box-shadow: var(--shadow); color: var(--ink); }
.job-card:hover { text-decoration: none; transform: translateY(-1px); }
.job-card.soon { border-left-color: #f59e0b; }
.job-card.overdue { border-left-color: #dc2626; background: #fff7f7; }
.job-card small { font-size: .8rem; }
/* The whole card opens the job (stretched link); the client name sits above it and opens the client's work page. */
.job-card { position: relative; }
.job-card .job-link { color: inherit; }
.job-card .job-link::after { content: ""; position: absolute; inset: 0; border-radius: 10px; }
.job-card .job-client { position: relative; z-index: 1; align-self: flex-start; color: var(--brand-dark); }
.job-card .job-client:hover { text-decoration: underline; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 14px 12px; }
.timeline li::before { content: ""; position: absolute; left: -23px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: #cbd5e1; border: 2px solid #fff; }
.timeline li.t-completed::before, .timeline li.t-approved::before { background: #16a34a; }
.timeline li.t-added::before { background: var(--brand); }
.timeline li.t-removed::before { background: #dc2626; }
.timeline li.t-reminder::before { background: #f59e0b; }
.timeline li.t-reopened::before { background: #dc2626; }

.alert-row { display: flex; justify-content: space-between; gap: 16px; padding: 12px 10px; border-bottom: 1px solid var(--line); color: var(--ink); }
.alert-row:hover { background: #f8fafc; text-decoration: none; }
.alert-row.unread { font-weight: 600; background: #f0fdfa; }
.alert-row.k-overdue span { color: #b91c1c; }

/* ---------- Charts (dataviz reference palette; status colours always paired with a label) ---------- */

:root {
    --series-1: #2a78d6;      /* blue   */
    --series-2: #eb6834;      /* orange */
    --series-3: #1baf7a;      /* aqua   */
    --status-good: #0ca30c;
    --status-warning: #fab219;
    --status-critical: #d03b3b;
    --viz-grid: #e1e0d9;
    --viz-base: #c3c2b7;
    --viz-muted: #898781;
}
.viz { position: relative; }
.viz-svg { width: 100%; height: auto; display: block; overflow: visible; }
.viz-grid { stroke: var(--viz-grid); stroke-width: 1; }
.viz-base { stroke: var(--viz-base); stroke-width: 1; }
.viz-tick { fill: var(--viz-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz-value { fill: #52514e; font-size: 11px; font-weight: 600; }
.viz-mark path { transition: opacity .12s; }
.viz-svg:hover .viz-mark path { opacity: .55; }
.viz-svg .viz-mark:hover path { opacity: 1; }
.viz-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 10px; font-size: .82rem; color: #52514e; }
.viz-legend i, .stack-key i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.viz-table { margin-top: 8px; font-size: .82rem; }
.viz-table summary { cursor: pointer; color: var(--viz-muted); }
.viz-table table { margin-top: 6px; }

.hbar { display: grid; grid-template-columns: minmax(90px, 30%) 1fr auto; align-items: center; gap: 10px; padding: 5px 0; }
.hbar-label { font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { height: 14px; }
.hbar-fill { display: flex; gap: 2px; height: 100%; }
.hbar-seg { height: 100%; border-radius: 0; position: relative; }
.hbar-seg:last-child { border-radius: 0 4px 4px 0; }
.hbar-value { font-size: .85rem; font-weight: 600; color: #52514e; font-variant-numeric: tabular-nums; min-width: 28px; text-align: right; }

.stackbar { display: flex; gap: 2px; height: 22px; border-radius: 6px; overflow: hidden; }
.stack-seg { position: relative; height: 100%; }
.stack-empty { flex: 1; background: var(--viz-grid); }
.stack-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-top: 12px; }
.stack-key { display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; column-gap: 4px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); font-size: .85rem; }
a.stack-key[href]:hover { text-decoration: none; border-color: var(--brand); }
.stack-key i { grid-row: span 2; }
.stack-key strong { font-size: 1.15rem; grid-row: span 2; }
.stack-key small { grid-column: 2; }

/* Hover tooltip for HTML bars */
[data-tip]:hover::after {
    content: attr(data-tip); position: absolute; z-index: 30; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
    padding: 6px 10px; border-radius: 8px; background: #0f172a; color: #fff; font-size: .78rem; white-space: nowrap; pointer-events: none;
}
[data-tip]:hover { filter: brightness(1.08); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); color: var(--ink); }
a.kpi:hover { text-decoration: none; border-color: var(--brand); }
.kpi .num { font-size: 2rem; font-weight: 800; line-height: 1.1; }
.kpi .lbl { color: var(--muted); font-size: .85rem; }
.kpi .sub { font-size: .78rem; margin-top: 4px; }
.kpi.alert .num { color: var(--status-critical); }
.dash-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; }
.dash-grid > .card { margin-bottom: 0; }
.span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
@media (max-width: 1100px) { .span-4, .span-5, .span-6, .span-7, .span-8 { grid-column: span 12; } }

/* ---------- Client progress & records requests ---------- */

.rag { display: inline-block; width: 14px; height: 14px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(0, 0, 0, .04); }
.rag-red { background: #dc2626; }
.rag-amber { background: #f59e0b; }
.rag-green { background: #16a34a; }
.stat.risk-red .num { color: #dc2626; }
.stat.risk-amber .num { color: #d97706; }
.stat.risk-green .num { color: #16a34a; }
.steps { display: flex; gap: 3px; margin-bottom: 4px; }
.steps span { flex: 1; height: 8px; border-radius: 4px; background: #e2e8f0; }
.steps span.on { background: linear-gradient(90deg, var(--brand), #14b8a6); }
.progress-table td { vertical-align: top; }
.progress-table .badge { margin: 0 4px 4px 0; }
.checklist { margin: 0 0 14px; padding-left: 0; list-style: none; }
.checklist li { position: relative; padding: 6px 0 6px 28px; border-bottom: 1px dashed #eef2f6; }
.checklist li::before { content: "✓"; position: absolute; left: 4px; top: 6px; color: var(--brand); font-weight: 800; }

.upload-page { min-height: 100vh; display: flex; justify-content: center; align-items: flex-start; padding: 40px 16px; background: linear-gradient(160deg, #f0fdfa, #eef2ff); }
.upload-card { width: 100%; max-width: 620px; padding: 30px; }
.upload-card h1 { font-size: 1.5rem; }
.upload-form { margin-top: 18px; padding: 18px; border-radius: 12px; background: #f8fafc; border: 1px solid var(--line); }

/* ---------- Built-in guidance ---------- */

.help {
    position: relative; display: inline-grid; place-items: center; width: 18px; height: 18px; margin-left: 6px; border-radius: 50%;
    background: #e0f2f1; color: var(--brand-dark); font-size: .72rem; font-weight: 800; cursor: help; vertical-align: 1px;
}
.help .help-text {
    display: none; position: absolute; z-index: 40; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
    width: max-content; max-width: 300px; padding: 10px 12px; border-radius: 10px; background: #0f172a; color: #fff;
    font-size: .82rem; font-weight: 400; line-height: 1.45; text-align: left; white-space: normal; box-shadow: 0 10px 30px rgba(15, 23, 42, .25);
}
.help:hover .help-text, .help:focus .help-text { display: block; }
.nav a small { display: none; }
/* Right side of the top bar: icons and Sign out, the search under them. */
.topbar-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.topsearch { position: relative; width: 380px; max-width: 100%; margin: 0; }
.topsearch input {
    width: 100%; padding: 9px 40px 9px 38px; font-size: .9rem; border: 1px solid var(--line); border-radius: 999px;
    background: var(--bg); color: var(--ink); transition: border-color .15s, box-shadow .15s, background .15s;
}
.topsearch input::placeholder { color: var(--muted); }
.topsearch input:hover { border-color: #cbd5e1; }
.topsearch input:focus { outline: none; background: #fff; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(13, 148, 136, .15); }
.topsearch-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.topsearch:focus-within .topsearch-icon { color: var(--brand); }
/* Search box at the end of a filter bar: wide, rounded, with an icon, like the top search. */
.filters .filter-search { position: relative; flex: 1 1 320px; min-width: 260px; margin: 0 0 0 auto; }
.filters .filter-search input {
    width: 100%; height: 46px; padding: 0 16px 0 44px; font-size: .98rem; border: 1px solid var(--line); border-radius: 999px;
    background: var(--bg); color: var(--ink); transition: border-color .2s, box-shadow .2s, background .2s;
}
.filters .filter-search input::placeholder { color: var(--muted); }
.filters .filter-search input:hover { border-color: #cbd5e1; background: #fff; }
.filters .filter-search input:focus { outline: none; background: #fff; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(13, 148, 136, .14); }
.filter-search-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; transition: color .2s; }
.filter-search:focus-within .filter-search-icon { color: var(--brand); }
.topsearch-key { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); padding: 1px 7px; border: 1px solid var(--line);
    border-radius: 6px; background: #fff; color: var(--muted); font-size: .72rem; font-family: inherit; pointer-events: none; }
.topsearch:focus-within .topsearch-key { display: none; }
.guide { border-left: 4px solid var(--brand); }
.guide-steps { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 8px 18px; }
.guide-steps li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; }
.guide-steps .tick { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); font-size: .75rem; font-weight: 800; color: #fff; }
.guide-steps li.done .tick { background: var(--status-good); border-color: var(--status-good); }
.guide-steps li.done a { color: var(--muted); text-decoration: line-through; }
.help-page h2 { margin-top: 8px; }
.help-page .card p, .help-page .card li { color: #334155; }
.help-toc { display: flex; flex-wrap: wrap; gap: 8px; }
.help-toc a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: .88rem; }
dl.glossary dt { font-weight: 700; margin-top: 10px; }
dl.glossary dd { margin: 2px 0 0; color: #475569; }

/* ---------- Deadlines calendar ---------- */

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head { font-size: .75rem; font-weight: 700; text-transform: uppercase; color: var(--muted); text-align: center; padding: 4px 0; }
.cal-day { min-height: 92px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal-day.blank { background: transparent; border-color: transparent; }
.cal-day.today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.cal-num { font-size: .78rem; font-weight: 700; color: var(--muted); }
.cal-chip { display: block; padding: 2px 6px; border-radius: 5px; background: #e0f2fe; color: #0c4a6e; font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-chip:hover { text-decoration: none; filter: brightness(.95); }
.cal-chip.done { background: #dcfce7; color: #166534; }
.cal-chip.late { background: #fee2e2; color: #991b1b; font-weight: 600; }
@media (max-width: 860px) { .cal-day { min-height: 60px; } .cal-chip { font-size: .66rem; } }

/* ---------- Pop-up entry window ---------- */

dialog.lw-modal {
    width: min(1180px, 96vw); height: 96vh; max-height: none; max-width: none; padding: 0; border: 0;
    border-radius: 18px; overflow: hidden; box-shadow: 0 30px 80px rgba(15, 23, 42, .35);
}
dialog.lw-modal::backdrop { background: rgba(15, 23, 42, .55); backdrop-filter: blur(3px); }
dialog.lw-modal iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
/* While the next page loads, hide the old one and show a quiet "Loading…" */
dialog.lw-modal.is-loading iframe { visibility: hidden; }
dialog.lw-modal.is-loading::after { content: 'Loading…'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 600; }
.lw-modal-x {
    position: absolute; top: 10px; right: 12px; z-index: 2; width: 36px; height: 36px; border: 0; border-radius: 50%;
    background: #f1f5f9; color: #334155; font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.lw-modal-x:hover { background: #e2e8f0; }
/* "Close this window?" question shown over the pop-up when Esc is pressed */
.lw-confirm { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; background: rgba(15, 23, 42, .45); }
.lw-confirm[hidden] { display: none; }
.lw-confirm-box { background: #fff; border-radius: 16px; padding: 22px 24px; width: min(400px, 90%); box-shadow: 0 24px 60px rgba(15, 23, 42, .35); }
.lw-confirm-box strong { font-size: 1.15rem; }
.lw-confirm-box p { margin: 6px 0 16px; color: var(--muted); }
.lw-confirm-box .actions { justify-content: flex-end; }
.bulk-bar { align-items: center; }
/* Dated outside the VAT quarter it counts in: a quiet note, not a warning. */
.badge-outside { background: #f8fafc; color: var(--muted); border: 1px solid var(--line); font-weight: 500; }
/* Report lines that open a ledger. */
.report-link { color: inherit; text-decoration: underline; text-decoration-color: rgba(13, 148, 136, .35); text-underline-offset: 3px; }
.report-link:hover { color: var(--brand); text-decoration-color: var(--brand); }
/* Filters apply as soon as they change, so their Filter / Update buttons aren't shown. */
form.auto-filter button[type="submit"] { display: none; }
.flag-btn { color: var(--muted); }
.flag-btn:hover { color: #dc2626; }
.flag-btn.is-flagged { color: #fff; background: #dc2626; border-color: #dc2626; }
.flag-btn[disabled] { opacity: .6; cursor: progress; }
.comment-btn { color: var(--muted); }
.comment-btn:hover { color: var(--brand); }
.mail-btn { color: var(--muted); }
.mail-btn:hover { color: #7c3aed; }
/* Emailed the client about this entry. */
.mail-btn.has-emails { position: relative; color: #fff; background: #7c3aed; border-color: #7c3aed; }
.mail-btn.has-emails:hover { color: #fff; background: #6d28d9; }
.mail-btn .talk-count { color: #6d28d9; border-color: #7c3aed; }
.comment.email-sent { border-left: 3px solid #7c3aed; }
/* Under discussion: there are comments about this entry. */
.comment-btn.has-comments { position: relative; color: #fff; background: #2563eb; border-color: #2563eb; }
.comment-btn.has-comments:hover { color: #fff; background: #1d4ed8; }
.comment-btn .talk-count, .mail-btn .talk-count { position: absolute; top: -6px; right: -6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
    background: #fff; color: #1d4ed8; border: 1px solid #2563eb; font-size: 10px; font-weight: 700; line-height: 14px; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Switch between the + Record screens without leaving the window. */
.rec-switch { margin: 0 0 14px; padding: 12px 14px; background: #f8fafc; }
.rec-aside .rec-switch { margin: 0; }
.rec-switch h2 { font-size: .95rem; margin: 0 0 8px; }
.rec-switch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.rec-switch-item { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 4px; border: 1px solid var(--line); border-radius: 8px;
    background: #fff; color: var(--text); font-size: .76rem; font-weight: 600; text-align: center; text-decoration: none; line-height: 1.2; }
.rec-switch-item svg { color: var(--muted); }
.rec-switch-item.in svg { color: #059669; }
.rec-switch-item.out svg { color: #dc2626; }
.rec-switch-item.asset svg, .rec-switch-item.doc svg { color: #4f46e5; }
a.rec-switch-item:hover { border-color: var(--brand); color: var(--brand); background: #f0fdfa; }
.rec-switch-item.is-current { border: 2px solid var(--brand); background: #f0fdfa; color: var(--brand); }
/* Flag and comment icons in a report row. */
.report-marks { white-space: nowrap; width: 1%; }
.report-marks .icon-btn { width: 28px; height: 28px; }
.job-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin: 0 0 16px; }
.job-head-people { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.job-head-people .work-people .assignee { margin: 0; }
.table-search { width: min(420px, 100%); }
.people-cell { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.work-table .job-title { font-weight: 600; color: var(--ink); }
.work-table .tick { width: 32px; padding-right: 0; }
/* The app's own "Are you sure?" window (replaces the browser's confirm box). */
.lw-ask { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: rgba(15, 23, 42, .45); padding: 16px; }
.lw-ask[hidden] { display: none; }
.lw-ask-box { background: #fff; border-radius: 16px; padding: 22px 24px; width: min(440px, 100%); box-shadow: 0 24px 60px rgba(15, 23, 42, .35); }
.lw-ask-box strong { font-size: 1.1rem; display: block; }
.lw-ask-box p { margin: 8px 0 18px; color: var(--muted); white-space: pre-line; }
.lw-ask-box .actions { justify-content: flex-end; }

/* Searchable client picker (VAT page tiles) */
dialog.pick-modal {
    width: min(560px, 94vw); max-height: 80vh; padding: 24px 24px 18px; border: 0; border-radius: 18px;
    box-shadow: 0 30px 80px rgba(15, 23, 42, .35); display: none; flex-direction: column;
}
dialog.pick-modal[open] { display: flex; }
dialog.pick-modal::backdrop { background: rgba(15, 23, 42, .55); backdrop-filter: blur(3px); }
dialog.pick-modal h2 { margin: 0 40px 2px 0; }
.pick-search { width: 100%; margin: 12px 0 10px; padding: 11px 14px; font-size: 1rem; border: 1px solid var(--line); border-radius: 10px; }
.pick-search:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.pick-list { overflow-y: auto; min-height: 120px; margin: 0 -6px; padding: 0 6px; }
.pick-list a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 10px; color: inherit; }
.pick-list a[hidden] { display: none; }
.pick-list a:hover, .pick-list a.active { background: #eef2ff; text-decoration: none; }
.pick-list a > span:first-child { display: flex; flex-direction: column; min-width: 0; }
.pick-list small { color: var(--muted); font-size: .8rem; }
.pick-list .badge { flex-shrink: 0; }
body.in-modal { background: #fff; }
.modal-content { padding: 22px 28px 28px; }
/* Show only what's needed in the pop-up */
.in-modal .tabs, .in-modal .page-head > .actions, .in-modal .page-head .hint:first-child { display: none; }
.in-modal .page-head { margin-bottom: 10px; }
.in-modal .page-head h1 { font-size: 1.15rem; color: var(--muted); }
.in-modal .page-head p { display: none; }
.in-modal .record-card { border: 0; box-shadow: none; padding: 6px 0 0; }
/* Compact pop-up so the whole entry screen fits without scrolling */
.modal-content { padding: 16px 26px 18px; }
.in-modal .page-head { margin-bottom: 4px; }
.in-modal .rec-row { padding: 6px 0; }
.in-modal .record-top { margin-bottom: 6px; }
.in-modal .rec-hint { min-height: 0; }
.in-modal .alert { margin-bottom: 8px; padding: 8px 12px; }
#currency:invalid { border-color: var(--status-warning); }
.money select#currency { min-width: 120px; font-weight: 700; }
.in-modal .card { box-shadow: none; }

/* ---------- Record (fast keyboard entry) ---------- */

.record-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.record-tile {
    position: relative; display: flex; flex-direction: column; gap: 4px; padding: 20px 20px 18px;
    border: 1px solid var(--line); border-left: 5px solid var(--brand); border-radius: var(--radius);
    background: #fff; color: var(--ink); box-shadow: var(--shadow); transition: transform .08s, box-shadow .15s;
}
.record-tile:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(15, 23, 42, .1); }
.record-tile strong { font-size: 1.08rem; }
.record-tile small { color: var(--muted); }
.record-tile.in { border-left-color: #16a34a; }
.record-tile.out { border-left-color: #dc2626; }
.record-tile.asset { border-left-color: var(--brand-2); }
.record-tile.doc { border-left-color: #94a3b8; }
.record-tile .key { position: absolute; top: 14px; right: 14px; }
kbd, .record-tile .key {
    display: inline-block; min-width: 22px; padding: 1px 6px; border: 1px solid #cbd5e1; border-bottom-width: 2px;
    border-radius: 6px; background: #f8fafc; font: 600 .78rem/1.5 Consolas, monospace; color: #334155; text-align: center;
}
.btn-primary kbd { background: rgba(255, 255, 255, .15); border-color: rgba(255, 255, 255, .4); color: #fff; margin-left: 6px; }

.record-card { padding: 28px 32px; }
.record-top { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; }
.ref-badge {
    display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 110px; padding: 10px 16px;
    border-radius: 14px; color: #fff; font-size: 2rem; font-weight: 800; line-height: 1;
    background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 6px 18px rgba(13, 148, 136, .3);
}
.ref-badge small { font-size: .7rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; opacity: .85; margin-bottom: 4px; }
/* The quarter's paper file the number belongs to (numbers start again each quarter). */
.ref-badge .ref-quarter { margin-top: 5px; font-size: .66rem; font-weight: 600; font-style: normal; white-space: nowrap; opacity: .9; }
/* A Ref number shown in a list, with its quarter underneath. */
.ref-q { display: block; margin-top: 2px; font-size: .7rem; color: var(--muted); white-space: nowrap; }

.rec-row { display: grid; grid-template-columns: 170px minmax(0, 1fr); align-items: center; gap: 16px; padding: 10px 0; border-bottom: 1px dashed #eef2f6; }
.rec-row > label { font-weight: 700; font-size: 1.05rem; color: #334155; }
.record-card input[type=text], .record-card select { font-size: 1.35rem; padding: 12px 16px; border-width: 2px; }
.record-card input[type=text]:focus, .record-card select:focus { box-shadow: 0 0 0 5px rgba(13, 148, 136, .18); background: #f0fdfa; }
.record-card ::selection { background: #99f6e4; }
.date-boxes { display: flex; align-items: center; gap: 8px; }
.date-boxes input[type=text] { width: 76px; text-align: center; font-variant-numeric: tabular-nums; }
.date-boxes input.yyyy { width: 110px; }
.date-boxes span { font-size: 1.5rem; color: #94a3b8; }
.money { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.money input[type=text] { max-width: 240px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.money select { width: auto; }
.money .prefix { font-size: 1.2rem; font-weight: 700; color: var(--muted); }
.rec-hint { margin: 4px 0 0 186px; min-height: 1.2em; }
.rec-hint.is-warn { color: #b45309; font-weight: 600; }
.ready-meter { display: block; height: 6px; border-radius: 3px; background: #e2e8f0; overflow: hidden; margin: 6px 0 2px; }
.ready-meter > span { display: block; height: 100%; background: linear-gradient(90deg, #f59e0b, #10b981); border-radius: 3px; }
.ready-meter.big { height: 10px; flex: 1 1 200px; margin: 0; }
.rec-ready { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.rec-finding { padding: 10px 0; border-bottom: 1px dashed #e2e8f0; }
.stat-link { display: block; color: inherit; text-decoration: none; cursor: pointer; }
.stat-link:hover { border-color: #0d9488; box-shadow: 0 0 0 3px rgba(13, 148, 136, .12); }
.sb-pair { border-bottom: 1px solid #eef2f6; padding: 8px 0; }
.sb-pair summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; }
.sb-sums { margin-left: auto; font-size: .9rem; }
.sense { border-left: 4px solid #f59e0b; }
.palette { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; z-index: 1000; }
.palette[hidden] { display: none; }
.palette-box { width: min(560px, 92vw); background: #fff; border-radius: 12px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); overflow: hidden; }
.palette-box input { width: 100%; border: 0; border-bottom: 1px solid #e2e8f0; padding: 14px 16px; font-size: 1.05rem; outline: none; }
.palette-box ul { list-style: none; margin: 0; padding: 4px 0; max-height: 50vh; overflow: auto; }
.palette-box li { padding: 8px 16px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.palette-box li.on { background: #f0fdfa; color: #0f766e; }
.palette-box li small { color: var(--muted); }
.saved-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 10px; }
.saved-filters .chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: #f1f5f9; font-size: .82rem; }
.saved-filters .chip button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 2px; }
.note-form { display: grid; gap: 8px; }
.note-form textarea { width: 100%; resize: vertical; }
.note { margin-bottom: 10px; }
.note.is-pinned { border-left: 4px solid #0d9488; }
.note-body { white-space: pre-wrap; margin-top: 8px; line-height: 1.5; }
.wb-sheet { margin-bottom: 14px; }
.wb-sheet.is-skip { opacity: .6; }
.wb-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 14px; margin-top: 10px; }
.wb-cols label { font-size: .8rem; color: var(--muted); display: block; }
.wb-preview { max-height: 220px; overflow: auto; margin-top: 10px; font-size: .78rem; }
.wb-preview td, .wb-preview th { padding: 2px 6px; white-space: nowrap; border-bottom: 1px solid #eef2f6; }
.wb-preview th { position: sticky; top: 0; background: #f8fafc; }
.amt-cell { width: 110px; text-align: right; font: inherit; color: inherit; background: transparent; border: 1px solid transparent; border-radius: 4px; padding: 2px 6px; }
.amt-cell:hover { border-color: #cbd5e1; background: #fff; }
.amt-cell:focus { border-color: #0d9488; background: #fff; outline: none; box-shadow: 0 0 0 3px rgba(13, 148, 136, .15); }
.amt-cell.is-saved { border-color: #16a34a; background: #f0fdf4; }
.rec-tiles { margin-bottom: 18px; }
.rec-tiles .home-tile.is-clear { opacity: .75; }
.rec-tiles .home-tile.is-active { opacity: 1; outline: 3px solid #0d9488; outline-offset: 2px; }
.rec-pick-hint { text-align: center; margin: 4px 0 18px; }
.rec-nothing { display: none; align-items: center; gap: 8px; }
.rec-tiles-on .rec-section { display: none !important; }
.rec-tiles-on .rec-section.is-open { display: block !important; }
.rec-tiles-on .rec-nothing.is-open { display: flex !important; }
.rec-tiles .home-tile.is-clear:hover { opacity: 1; }
.rec-section { scroll-margin-top: 80px; }
.name-group { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; align-items: center; padding: 10px 0; border-bottom: 1px dashed #e2e8f0; }
.name-group .chip { display: inline-block; padding: 2px 10px; margin: 2px 4px 2px 0; border-radius: 999px; background: #f1f5f9; font-size: .88rem; }
.cell-link { color: inherit; text-decoration: none; border-bottom: 1px dotted #94a3b8; }
.cell-link:hover { color: #0f766e; border-bottom-color: #0f766e; background: #f0fdfa; }
.money-in { color: #15803d; font-weight: 700; }
.money-out { color: #b91c1c; font-weight: 700; }
.cat-link { color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; }
.cat-link.is-none { color: #b45309; font-weight: 600; }
.cat-scope label { display: block; margin: 4px 0; }
.rec-drop { display: block; margin: 0 0 8px; padding: 10px 14px; border: 2px dashed #cbd5e1; border-radius: 10px; color: var(--muted); font-size: .9rem; cursor: pointer; transition: border-color .15s, background .15s; }
.rec-drop:hover, .rec-drop.is-over { border-color: #0d9488; background: #f0fdfa; color: #0f766e; }
.rec-drop.is-busy { border-style: solid; border-color: #0d9488; background: #f0fdfa; cursor: progress; }
.rec-drop.is-done { border-style: solid; border-color: #86efac; background: #f0fdf4; color: #166534; }
.bank-ok { display: block; margin-top: 2px; font-size: .7rem; font-weight: 600; color: #15803d; white-space: nowrap; }
.rec-more { margin-top: 14px; }
.rec-more summary { cursor: pointer; color: var(--muted); font-weight: 600; }

.ta { position: relative; }
.ta-list {
    position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 6px; list-style: none;
    background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(15, 23, 42, .14);
    max-height: 320px; overflow-y: auto;
}
.ta-list li { padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 1.05rem; }
.ta-list li:hover, .ta-list li.on { background: #ccfbf1; }

.segmented.compact { margin: 0; gap: 0; }
.segmented.compact a { padding: 6px 12px; border: 1px solid var(--line); color: var(--muted); font-weight: 600; font-size: .88rem; }
.segmented.compact a:first-child { border-radius: 8px 0 0 8px; }
.segmented.compact a:last-child { border-radius: 0 8px 8px 0; border-left: 0; }
.segmented.compact a.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.segmented.compact a:hover { text-decoration: none; }

@media (max-width: 720px) {
    .rec-row { grid-template-columns: 1fr; gap: 6px; }
    .rec-hint { margin-left: 0; }
    .record-card { padding: 20px; }
}

@media (max-width: 860px) {
    .sidebar { display: none; }
    .content { padding: 18px; }
}

/* ---------- Icons on tiles and buttons ---------- */
.icon { flex: none; vertical-align: -4px; }
.btn .icon { margin-right: 6px; vertical-align: -3px; }
.record-tile .tile-icon { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 12px; margin-bottom: 8px; background: #ccfbf1; color: var(--brand-dark); }
.record-tile.in .tile-icon { background: #dcfce7; color: #15803d; }
.record-tile.out .tile-icon { background: #fee2e2; color: #b91c1c; }
.record-tile.asset .tile-icon { background: #e0e7ff; color: var(--brand-2); }
.record-tile.doc .tile-icon { background: #f1f5f9; color: #475569; }
.record-tile:hover .tile-icon { transform: scale(1.06); transition: transform .12s; }

/* ---------- Payroll ---------- */
.btn-lg { padding: 13px 24px; font-size: 1.05rem; }
.card-inset { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin: 14px 0; }
.payroll-start h2 { margin-bottom: 2px; }
.progress-line { height: 8px; background: #e2e8f0; border-radius: 99px; overflow: hidden; width: min(420px, 100%); margin-top: 6px; }
.progress-line span { display: block; height: 100%; background: var(--status-good); border-radius: 99px; transition: width .3s; }
.pay-grid { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.pay-grid th { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); text-align: right; padding: 8px 6px; border-bottom: 2px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: #fff; z-index: 1; }
.pay-grid th.l, .pay-grid td.l { text-align: left; }
.pay-grid td { padding: 6px 5px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; vertical-align: middle; }
.pay-grid tr.is-checked td { background: #f0fdf4; }
.pay-grid tr:hover td { background: #f8fafc; }
.pay-grid tr.is-checked:hover td { background: #e7f9ee; }
.pay-grid input[type=text] { width: 74px; text-align: right; padding: 6px 7px; font-variant-numeric: tabular-nums; font-weight: 600; }
.pay-grid input.small { width: 50px; }
.pay-grid input:focus { outline: 2px solid var(--brand); background: #f0fdfa; }
.pay-grid input.saving { background: #fefce8; }
.pay-grid .net { font-weight: 800; font-size: 1.02rem; }
.pay-grid .emp strong { display: block; }
.pay-grid .emp small { color: var(--muted); }
.pay-grid tfoot td { font-weight: 800; border-top: 2px solid var(--line); border-bottom: 0; }
.pay-grid .warn-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-left: 6px; vertical-align: 1px; }
.warn-dot.danger { background: var(--status-critical); }
.warn-dot.warning { background: var(--status-warning); }
.warn-dot.info { background: #94a3b8; }
.pay-grid .tick { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); background: #fff; color: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.pay-grid .tick.on { background: var(--status-good); border-color: var(--status-good); color: #fff; }
.bulk-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; }
.bulk-bar .count { font-weight: 700; margin-right: 6px; }
.payslip-sheet { border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; background: #fff; }
.payslip-sheet table { width: 100%; border-collapse: collapse; }
.payslip-sheet td { padding: 5px 0; border-bottom: 1px dashed #eef2f6; }
.payslip-sheet td.num { text-align: right; font-variant-numeric: tabular-nums; }
.payslip-sheet .netpay { font-size: 1.6rem; font-weight: 800; color: var(--brand-dark); }
.slip-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.slip-nav .pos { color: var(--muted); font-weight: 600; }
.status-line { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: .92rem; }
.status-line strong { color: var(--ink); }
@media (max-width: 760px) {
    .pay-grid input[type=text] { width: 70px; }
}
.checklist.status li::before { content: "○"; color: var(--muted); }
.checklist.status li.done::before { content: "✓"; color: var(--status-good); }
.checklist.status li.done { color: var(--muted); }
.tick-demo { display: inline-flex; width: 20px; height: 20px; border-radius: 50%; background: var(--status-good); color: #fff; font-size: .75rem; align-items: center; justify-content: center; }
.table.compare th, .table.compare td { padding: 9px 8px; }
.table.compare tbody th, .table.compare tr > th:first-child { text-transform: none; letter-spacing: 0; font-size: .92rem; color: var(--ink); font-weight: 600; }
.table.compare tr.strong td, .table.compare tr.strong th { font-weight: 800; border-top: 2px solid var(--line); }
/* Pop-up entry window: recent entries sit beside the form instead of below it */
.in-modal .rec-side { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 22px; align-items: start; }
.in-modal .rec-recent { margin: 0; padding: 14px 16px; max-height: calc(96vh - 330px); overflow: auto; background: #f8fafc; }
.rec-aside { display: flex; flex-direction: column; gap: 14px; }
.in-modal .rec-aside { margin-top: 34px; } /* clear of the window's ✕ */
.in-modal .rec-recent h2 { font-size: 1rem; }
.in-modal .rec-recent .table td { padding: 7px 4px; font-size: .86rem; }
/* Ref on the left; name and amount on the first line, the entry's icons on the second (four icons don't fit beside them). */
.in-modal .rec-recent .table tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0 8px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.in-modal .rec-recent .table td:first-child { grid-row: span 2; }
.in-modal .rec-recent .table td:nth-child(3) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.in-modal .rec-recent .table td.rec-actions { grid-column: 2 / 4; padding-top: 0; }
.in-modal .rec-recent .table td { border: 0; }
.in-modal .rec-recent td.cat, .in-modal .rec-recent td.vat, .in-modal .rec-recent td:nth-child(2) { display: none; }
@media (max-width: 900px) { .in-modal .rec-side { grid-template-columns: 1fr; } }
/* Receipts / Payments: big money in / out picture centred at the top of the entry screen */
.record-top:has(.rec-hero) { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.record-top:has(.rec-hero) .actions { justify-self: end; }
.record-top:has(.rec-hero) .ref-badge { justify-self: start; }
.rec-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; }
.rec-hero h2 { margin: 6px 0 0; font-size: 1.35rem; }
.rec-hero small { color: var(--muted); font-weight: 600; }
.rec-hero-icon {
    width: 80px; height: 80px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 22px -8px currentColor, inset 0 0 0 6px rgba(255, 255, 255, .55);
}
.rec-hero.in .rec-hero-icon { background: linear-gradient(145deg, #dcfce7, #bbf7d0); color: #15803d; }
.rec-hero.in h2 { color: #166534; }
.rec-hero.out .rec-hero-icon { background: linear-gradient(145deg, #fee2e2, #fecaca); color: #b91c1c; }
.rec-hero.out h2 { color: #991b1b; }
.rec-hero.in .rec-hero-icon svg { animation: rec-in 1.6s ease-in-out 2; }
.rec-hero.out .rec-hero-icon svg { animation: rec-out 1.6s ease-in-out 2; }
@keyframes rec-in { 50% { transform: translateY(3px); } }
@keyframes rec-out { 50% { transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .rec-hero-icon svg { animation: none !important; } }
.in-modal .record-top:has(.rec-hero) .ref-badge { margin-bottom: 0; }

/* Required documents: tick lists and the "who is asked" chooser */
.req-ticks { display: grid; gap: 6px; }
.req-ticks .check, .req-who .check { align-items: flex-start; }
.req-more { margin-top: 12px; }
.req-more summary, .req-add > summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.req-more[open] summary { margin-bottom: 8px; }
.req-add { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.req-add > summary { list-style: none; display: inline-flex; color: inherit; }
.req-add > summary::-webkit-details-marker { display: none; }
.req-who { display: grid; gap: 6px; }
.req-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px 12px; margin: 0 0 4px 26px; }
.req-clients { margin: 0 0 4px 26px; }
.req-clients input[type=search] { width: 100%; margin-bottom: 6px; }
.req-client-list { max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; display: grid; gap: 4px; }
.req-client-list [hidden], .req-who [hidden] { display: none; }
.req-edit { display: inline-block; }
.req-edit > summary { list-style: none; }
.req-edit > summary::-webkit-details-marker { display: none; }
.req-edit[open] .req-edit-card { position: absolute; right: 24px; z-index: 30; width: min(520px, 90vw); text-align: left; white-space: normal; box-shadow: 0 20px 50px rgba(15, 23, 42, .2); }

/* Column-check screen: every line editable */
.edit-lines td { padding: 3px 4px; }
.edit-lines input { width: 100%; min-width: 70px; padding: 5px 7px; border: 1px solid transparent; border-radius: 6px; background: transparent; font: inherit; }
.edit-lines input:hover { border-color: var(--line); }
.edit-lines input:focus { border-color: var(--brand); background: #fff; outline: none; }
.edit-lines td.bal { color: var(--muted); white-space: nowrap; }
.edit-lines td.bal.changed { color: #b45309; font-weight: 700; }
.edit-totals { display: flex; gap: 16px; flex-wrap: wrap; font-size: .92rem; }

/* Review imported bank lines: one row per payee */
.review-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: space-between; padding: 4px 0 12px; }
.review-bar .hint { flex: 1; min-width: 240px; }
.review-table td { vertical-align: top; }
.review-table select { max-width: 230px; }
.review-payee { width: 100%; min-width: 180px; font-weight: 600; }
.review-group + .review-group .review-head td { border-top: 2px solid var(--line); }
.review-head td { border-bottom: 0; }
.review-toggle { display: block; margin-top: 6px; padding: 0; border: 0; background: none; cursor: pointer; text-align: left; font: inherit; font-size: .82rem; }
.review-sub td { padding-top: 4px; padding-bottom: 4px; border-top: 0; border-bottom: 0; font-size: .84rem; color: var(--muted); vertical-align: middle; }
.review-sub td:nth-child(2) { padding-left: 18px; }
.review-sub .review-date { color: var(--text, #0f172a); font-weight: 600; margin-right: 6px; }
.review-sub select { font-size: .84rem; padding: 4px 8px; max-width: 230px; }
.review-sub select.own { border-color: #b45309; color: #b45309; font-weight: 600; }
.review-sub .icon-btn { width: 26px; height: 26px; }
.amount-input { width: 104px; padding: 4px 6px; text-align: right; font: inherit; border: 1px solid var(--line); border-radius: 6px; }
.amount-input.changed { border-color: #b45309; color: #b45309; font-weight: 700; }
.drafts-card { margin-bottom: 18px; border-left: 4px solid #f59e0b; }
/* Client comments (permanent record) */
.comments { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.comment { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.comment.question { border-left: 4px solid #f59e0b; background: #fffbeb; }
.comment.answered { border-left: 4px solid var(--brand); }
.comment.reply { margin: 8px 0 0 18px; background: #f8fafc; }
.comment-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.comment-body { white-space: pre-line; }
.comment-reply { margin-top: 6px; }
.comment-reply summary { cursor: pointer; }
.comment-reply textarea { width: 100%; margin: 6px 0; }
.work-table td { vertical-align: top; }
.work-table .strong-link { font-weight: 700; }
.work-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.work-people { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.work-people .assignee { margin: 0; }
.work-people .assignee a { color: inherit; }
.add-person { position: relative; }
.add-person summary { list-style: none; cursor: pointer; width: 28px; height: 28px; }
.add-person summary::-webkit-details-marker { display: none; }
/* Opens to the left of the + button so it never runs off the edge of the table. */
.add-person-form { position: absolute; z-index: 20; top: 34px; right: 0; width: 280px; display: flex; flex-direction: column; gap: 10px; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(15, 23, 42, .18); }
.add-person-form strong { font-size: .95rem; }
/* Reconciliation work tab. */
.tab-count { display: inline-block; min-width: 18px; margin-left: 4px; padding: 0 5px; border-radius: 9px; background: #dc2626; color: #fff; font-size: .7rem; font-weight: 700; line-height: 18px; text-align: center; }
.rec-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.rec-summary a { padding: 6px 12px; border: 1px solid #fecaca; border-radius: 999px; background: #fff7f7; color: var(--text); font-size: .85rem; text-decoration: none; }
.rec-summary a.is-clear { border-color: var(--line); background: #fff; color: var(--muted); }
.rec-summary a strong { margin-left: 4px; }
.rec-section { margin-bottom: 14px; }
.rec-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.rec-file { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 16px 18px; color: var(--text); text-decoration: none; border-left: 4px solid #dc2626; }
.rec-file.is-clear { border-left-color: #10b981; }
.rec-file:hover { box-shadow: 0 6px 18px rgba(15, 23, 42, .1); }
.rec-file strong { font-size: 1.05rem; }
.rec-section h2 { display: flex; align-items: center; gap: 8px; }
.rec-section td { vertical-align: top; }
.rec-act { white-space: nowrap; text-align: right; width: 1%; }
.rec-act form { display: inline; margin: 0; }
.rec-icons { white-space: nowrap; width: 1%; }
div.rec-icons { margin-top: 6px; width: auto; }
.rec-quote { margin: 4px 0; padding: 6px 10px; border-left: 3px solid var(--line); background: #f8fafc; white-space: pre-line; font-size: .9rem; }
.rec-empty { display: flex; align-items: center; gap: 8px; color: #047857; font-weight: 600; }
.danger-text { color: #dc2626; }
/* Opening a VAT quarter's file: the client's HMRC stagger group and its deadlines. */
.stagger-note { margin: 0 0 16px; padding: 10px 14px; border-radius: 10px; background: #f0fdfa; border: 1px solid #99f6e4; font-size: .92rem; }
/* Buttons that can't be used yet look it (a reason is shown next to them). */
.btn:disabled, .btn.is-blocked { opacity: .5; cursor: not-allowed; box-shadow: none; }
@keyframes lw-flash { 0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); } 30% { box-shadow: 0 0 0 6px rgba(220, 38, 38, .35); } }
.alert.flash { animation: lw-flash 1.2s ease-in-out 2; }
/* Prepare VAT return: tick several people at once. */
.vat-people .work-people { gap: 8px; }
.vat-people #vat-people-chips { display: contents; }
.vat-people .add-person-form { left: 0; right: auto; }
.vat-people-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow: auto; }
.vat-people-list .check { margin: 0; }
/* Let the menu spill over the table's edge on the last rows (small screens keep the table scrolling sideways). */
@media (min-width: 900px) { .table-wrap:has(.work-table) { overflow: visible; } }
.add-person-form select { width: 100%; min-width: 0; padding: 9px 10px; font-size: .95rem; }
.add-person-form .actions { justify-content: flex-end; gap: 8px; }
.view-toggle { margin-left: auto; display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.view-toggle a { padding: 6px 12px; color: inherit; font-size: .9rem; }
.view-toggle a.active { background: var(--brand); color: #fff; }
.assignee { display: inline-flex; align-items: center; gap: 4px; margin: 0 12px 4px 0; padding: 2px 4px 2px 10px; border: 1px solid var(--line); border-radius: 999px; }
.assignee form { display: inline; margin: 0; }
.assignee .icon-btn { width: 24px; height: 24px; }
/* Job page: the client's actions as big buttons */
.import-hint { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; border-left: 4px solid var(--brand); }
.import-hint .hint { flex: 1; min-width: 220px; }
.import-sheets [data-sheet] .row-between { align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.amount-in { color: #15803d; }
.amount-out { color: #b91c1c; }

/* Edit / delete icons on recent entries */
td.rec-actions { white-space: nowrap; text-align: right; }
td.rec-actions form { display: inline; margin: 0; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0;
    border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #475569; cursor: pointer; vertical-align: middle;
}
.icon-btn + .icon-btn, .icon-btn + form, form + .icon-btn { margin-left: 4px; }
.icon-btn:hover { background: #f1f5f9; color: var(--brand); text-decoration: none; }
.icon-btn.danger:hover { background: #fef2f2; border-color: #fecaca; color: #dc2626; }
.icon-btn.locked { color: #94a3b8; cursor: default; background: transparent; }
.content:has(.pay-grid) { max-width: 1520px; }
.pay-grid .last-net { display: block; font-size: .72rem; color: var(--muted); font-weight: 500; }
.pay-grid td.emp { white-space: normal; min-width: 170px; }
/* Session currency choice for multi-currency clients */
.currency-pick { max-width: 860px; }
.currency-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-top: 8px; }
.currency-option { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 18px; border: 2px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink); transition: border-color .12s, transform .08s; }
.currency-option:hover, .currency-option:focus { text-decoration: none; border-color: var(--brand); transform: translateY(-2px); outline: none; }
.currency-option .sym { font-size: 1.9rem; font-weight: 800; color: var(--brand-dark); line-height: 1.1; }
.currency-option.mixed .sym { font-size: 1.3rem; color: var(--brand-2); }
.currency-option small { color: var(--muted); }
.currency-option .key { position: absolute; top: 12px; right: 12px; font: 600 .75rem/1 ui-monospace, monospace; background: #f1f5f9; border: 1px solid var(--line); border-radius: 5px; padding: 3px 6px; }
.in-modal .money { flex-wrap: nowrap; } .in-modal .money select#vat_rate { max-width: 230px; } .in-modal .money input[type=text] { min-width: 0; }
.in-modal .rec-row { padding: 4px 0; } .in-modal .rec-more { margin-top: 8px; } .in-modal .record-top .ref-badge { transform: scale(.85); transform-origin: left top; margin-bottom: -8px; }
/* ---------- Home: big buttons ---------- */
.home-group { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 26px 0 12px; }
.home-group:first-of-type { margin-top: 6px; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.home-tile { position: relative; display: flex; align-items: center; gap: 16px; padding: 22px 20px; min-height: 104px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); color: var(--ink); transition: transform .1s, box-shadow .15s, border-color .15s; }
.home-tile:hover, .home-tile:focus-visible { text-decoration: none; transform: translateY(-3px); box-shadow: 0 12px 30px rgba(15, 23, 42, .12); border-color: var(--tile-fg); outline: none; }
.home-icon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 60px; height: 60px; border-radius: 16px; background: var(--tile-bg); color: var(--tile-fg); transition: transform .15s; }
.home-tile:hover .home-icon { transform: scale(1.07) rotate(-3deg); }
.home-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.home-text strong { font-size: 1.12rem; }
.home-text small { color: var(--muted); font-size: .86rem; line-height: 1.35; }
.home-count { position: absolute; top: 12px; right: 12px; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 99px; background: var(--status-critical); color: #fff; font-size: .8rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.home-count.neutral { background: #e2e8f0; color: #334155; }
.tone-teal { --tile-bg: #ccfbf1; --tile-fg: #0f766e; }
.tone-indigo { --tile-bg: #e0e7ff; --tile-fg: #4338ca; }
.tone-amber { --tile-bg: #fef3c7; --tile-fg: #b45309; }
.tone-rose { --tile-bg: #ffe4e6; --tile-fg: #be123c; }
.tone-slate { --tile-bg: #f1f5f9; --tile-fg: #334155; }
@media (max-width: 600px) { .home-grid { grid-template-columns: 1fr; } .home-tile { min-height: 84px; padding: 16px; } }
.home-tile.is-current { border-color: var(--tile-fg); box-shadow: 0 0 0 3px var(--tile-bg), var(--shadow); }
/* ---------- Side menu: a drawer, hidden until the Menu button is pressed ---------- */
.sidebar { display: flex !important; position: fixed; top: 0; left: 0; bottom: 0; z-index: 60; overflow-y: auto; transform: translateX(-100%); transition: transform .22s ease, box-shadow .22s; }
body.nav-open .sidebar { transform: none; box-shadow: 12px 0 40px rgba(15, 23, 42, .35); }
.nav-backdrop { position: fixed; inset: 0; z-index: 59; background: rgba(15, 23, 42, .4); opacity: 0; pointer-events: none; transition: opacity .2s; }
body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-left strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-toggle { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.nav-toggle:hover { background: #f1f5f9; }
.topbar-home { display: inline-flex; }
@media (max-width: 600px) { .nav-toggle span { display: none; } }
/* Phones: a compact top bar (menu, logo, alerts, avatar, sign out) */
@media (max-width: 700px) {
    .topbar { padding: 10px 12px; gap: 8px; }
    .topbar-left strong, .topsearch, .topbar .who > a.who > span:not(.avatar) { display: none; }
    .topbar .who { gap: 6px; }
    .topbar .btn-sm { padding: 6px 9px; }
    .page-head { flex-wrap: wrap; gap: 10px; }
    .page-head .actions { flex-wrap: wrap; }
}
.filters { flex-wrap: wrap; } .filters > *, .filters select, .filters input { max-width: 100%; min-width: 0; }

/* Year-end figures the app already knows, under each balance box. */
.known-row { margin: -2px 0 8px; padding: 6px 10px; border-radius: 6px; background: var(--bg); font-size: 12.5px; line-height: 1.45; }
.known-diff { color: #b45309; font-weight: 600; }
.known-ok { color: var(--ok); }
.linklike { background: none; border: 0; padding: 0 0 0 6px; color: var(--brand); text-decoration: underline; cursor: pointer; font: inherit; }


/* Excel export: choose the layout. */
dialog.export-pick { overflow-y: auto; }
.export-options { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 14px; }
.export-option { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.export-option:has(input:checked) { border-color: var(--brand); background: #f0fdfa; }
.export-option input { margin-top: 3px; }
.export-option span { display: flex; flex-direction: column; min-width: 0; }
.export-option small { color: var(--muted); }
.export-upload { border-top: 1px solid var(--line); padding-top: 12px; }


/* Upload documents, at the end of the Documents filter bar. */
.filters .filter-upload { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }


/* Flagged once and resolved since: green, so it stays visible. And why an entry was flagged, under its badge. */
.flag-btn.was-flagged { color: #fff; background: #16a34a; border-color: #16a34a; }
.flag-btn.was-flagged:hover { background: #15803d; color: #fff; }
.badge-was-flagged { background: #dcfce7; color: #166534; }
.flag-why { margin-top: 3px; padding: 4px 8px; border-left: 3px solid #dc2626; background: #fef2f2; color: #7f1d1d; font-size: .78rem; line-height: 1.35; border-radius: 0 6px 6px 0; max-width: 520px; }
.flag-why.was { border-left-color: #16a34a; background: #f0fdf4; color: #166534; }


/* Resolve button at the end of a flag's reason, and its pop-up. */
.flag-resolve { display: inline-block; margin-left: 6px; padding: 1px 10px; border-radius: 999px; background: #dc2626; color: #fff !important; font-weight: 600; font-size: .74rem; text-decoration: none; }
.flag-resolve:hover { background: #b91c1c; }
.settle-pair { display: grid; gap: 10px; margin: 12px 0; }
.settle-line { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.settle-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }


/* Reports as big tiles: the tile opens the report; its exports sit along the bottom. */
.report-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.report-tile { flex-direction: column; align-items: stretch; justify-content: space-between; gap: 12px; }
.report-tile-main { display: flex; align-items: flex-start; gap: 16px; color: inherit; }
.report-tile-main:hover { text-decoration: none; }
.report-tile-main:hover .home-icon { transform: scale(1.07) rotate(-3deg); }
.report-tile-exports { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.report-tile-exports a { display: inline-flex; align-items: center; gap: 4px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); font-size: .82rem; font-weight: 600; background: #fff; }
.report-tile-exports a:hover { border-color: var(--tile-fg); color: var(--tile-fg); text-decoration: none; }
/* Export bar at the top of a report. */
.export-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; padding: 10px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.export-bar-label { font-weight: 600; color: var(--muted); margin-right: 4px; }
.export-bar .btn { display: inline-flex; align-items: center; gap: 6px; }

/* Alert system. */
.alert-actions { white-space: nowrap; }
.alert-actions form { display: inline; }
.alert-actions .btn { margin: 0 0 4px 4px; }
.alert-preview { text-align: left; white-space: normal; margin-top: 4px; }
.alert-preview pre { white-space: pre-wrap; font-family: inherit; font-size: .82rem; background: var(--bg); padding: 10px; border-radius: 8px; max-width: 420px; margin: 6px 0 0 auto; }

/* Accounts dashboard and invoices. */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi-grid .kpi { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.kpi-grid .lbl { color: var(--muted); font-size: .85rem; font-weight: 600; }
.kpi-grid .num { font-size: 1.75rem; font-weight: 800; margin: 4px 0; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: .82rem; color: var(--muted); }
.trend-up { color: #0b7a3b; }
.trend-down { color: #b42318; }
.upcoming { list-style: none; margin: 0; padding: 0; }
.upcoming li { display: grid; grid-template-columns: 52px 1fr auto; gap: 8px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.upcoming .up-date { font-weight: 700; color: var(--muted); }
.upcoming .up-what small { display: block; color: var(--muted); font-size: .75rem; }
.upcoming .up-amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.upcoming li.in .up-amount { color: #0b7a3b; }
.upcoming li.late .up-date { color: #b42318; }
.invoice-lines input, .invoice-lines select { width: 100%; }
.invoice-totals { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin: 12px 0; }
.invoice-totals div { display: flex; gap: 18px; min-width: 240px; justify-content: space-between; }
.invoice-totals .grand { font-size: 1.15rem; border-top: 2px solid var(--ink); padding-top: 6px; }
.row-total td { font-weight: 700; border-top: 2px solid var(--line); }
@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

/* Help page: the guide finder and the "What's new" card. */
.help-find { display: block; margin: 0 0 12px; }
.help-find input[type=search] { width: 100%; min-height: 50px !important; font-size: 1.02rem !important; }
.help-new { border-left: 4px solid var(--brand); }

/* Receipt batch: drop zone, counters, progress bar, and the review screen. */
.batch-drop { display: block; text-align: center; padding: 34px 16px; border-width: 2px; cursor: pointer; }
.batch-drop.over { border-color: var(--brand); background: var(--bg); }
.batch-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0 8px; }
.batch-bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.batch-bar span { display: block; height: 100%; width: 0; background: var(--brand); transition: width .3s; }
.batch-errors { margin: 6px 0; padding-left: 18px; color: #b45309; font-size: .85rem; }
.review-head { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; }
.review-split .preview img.review-img { width: 100%; max-height: 78vh; object-fit: contain; }
.review-split .preview iframe { width: 100%; height: 78vh; border: 0; }
.match-card { border: 2px solid #1a8d4a; }
.ref-written input { max-width: 120px; font-weight: 700; font-size: 1.05rem; text-align: center; border-radius: 999px; }
.ref-written .badge { margin-left: 6px; }
@media (max-width: 700px) { .batch-stats { grid-template-columns: repeat(2, 1fr); } }

/* WhatsApp: its own green, so it's found at a glance next to PDF, Excel and Email. */
.btn-whatsapp { display: inline-flex; align-items: center; gap: 6px; background: #1a8d4a; border-color: #1a8d4a; color: #fff; }
.btn-whatsapp:hover { background: #157a3f; color: #fff; text-decoration: none; }
.btn.btn-wa, .report-tile-exports a.wa { color: #157a3f; }
.report-tile-exports a.wa:hover { border-color: #1a8d4a; color: #157a3f; }

/* Buttons at the top right of a client page (e.g. Banks: import statements, upload documents). */
.page-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; }
.page-actions .btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; font-size: .95rem; }


/* Every search box (except the top bar's and the transactions bar's, which have their own markup): one look across
   the app. Rounded, a little taller, a magnifying glass drawn in, and a soft brand-coloured ring when typing. */
input[type=search]:not(#topsearch):not(.filter-search input) {
    -webkit-appearance: none; appearance: none;
    min-height: 44px; padding: 0 16px 0 42px; font-size: .95rem; color: var(--ink);
    border: 1px solid var(--line); border-radius: 999px;
    background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 15px center;
    transition: border-color .2s, box-shadow .2s, background-color .2s;
}
input[type=search]:not(#topsearch):not(.filter-search input)::placeholder { color: var(--muted); }
input[type=search]:not(#topsearch):not(.filter-search input):hover { border-color: #cbd5e1; background-color: #fff; }
input[type=search]:not(#topsearch):not(.filter-search input):focus {
    outline: none; background-color: #fff; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(13, 148, 136, .14);
}
.filters input[type=search]:not(.filter-search input) { flex: 1 1 300px; min-width: 240px; }
.pick-search { border-radius: 999px; }

/* Pop-ups on phones and tablets: every pop-up scrolls when it's taller than the screen (so Save is always reachable),
   and takes nearly the whole screen on a phone. */
dialog.pick-modal { overflow-y: auto; overscroll-behavior: contain; }
dialog.fees-modal { width: min(780px, 94vw); }
dialog.people-modal { width: min(600px, 94vw); }
.fee-row { display: grid; grid-template-columns: 1.4fr .8fr 1fr 1.4fr; gap: 8px; margin-bottom: 8px; }
.fee-row > * { min-width: 0; width: 100%; }
.fee-dd { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 10px 0 14px; }
.add-people-line { display: flex; align-items: center; gap: 10px; }
@media (max-width: 760px) {
    .fee-row { grid-template-columns: 1fr 1fr; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
    .fee-dd { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
    dialog.pick-modal { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; padding: 20px 16px 16px; border-radius: 18px 18px 0 0; }
    dialog.lw-modal { width: 100vw; height: 100vh; border-radius: 0; }
    .fee-dd { grid-template-columns: 1fr; }
    .pick-modal .actions { position: sticky; bottom: -16px; background: #fff; padding: 10px 0 6px; }
}
