/* ==========================================================================
   Ledgerline — application styles (no framework)
   ========================================================================== */

:root {
    --brand: #0b7a75;
    --brand-600: #09625e;
    --brand-700: #074d4a;
    --brand-50: #e8f5f4;
    --brand-100: #cdeae8;

    --ink: #0f1b2d;
    --text: #1f2a37;
    --muted: #667085;
    --subtle: #98a2b3;
    --border: #e4e7ec;
    --border-strong: #d0d5dd;
    --bg: #f4f6f9;
    --surface: #ffffff;
    --surface-2: #f9fafb;

    --sidebar: #0f1b2d;
    --sidebar-2: #16263d;
    --sidebar-text: #a9b4c4;
    --sidebar-hover: #1c2f4a;

    --success: #12805c;
    --success-50: #e7f6ef;
    --danger: #d0364b;
    --danger-50: #fdecee;
    --warning: #b76e00;
    --warning-50: #fff4e0;
    --info: #2563eb;
    --info-50: #eaf1ff;
    --chart-2: #f2a444;

    --radius: 10px;
    --radius-sm: 7px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .18), 0 4px 8px -4px rgba(16, 24, 40, .06);
    --focus: 0 0 0 3px rgba(11, 122, 117, .22);

    --sidebar-w: 248px;
    --topbar-h: 60px;
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---- Base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { color: var(--ink); margin: 0; line-height: 1.25; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-600); text-decoration: underline; }
button { font: inherit; }
img, svg { display: inline-block; vertical-align: middle; }
[hidden] { display: none !important; }
.icon { flex-shrink: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.grow { flex: 1 1 auto; min-width: 0; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.inline { display: inline; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.optional { color: var(--subtle); font-weight: 400; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--brand); margin-bottom: 4px; }

/* ---- Brand ---------------------------------------------------------------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: #fff; text-decoration: none !important; }
.brand-dark { color: var(--ink); }
.brand-mark {
    width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
    background: linear-gradient(135deg, #14b8a6, var(--brand) 60%, var(--brand-700));
    color: #fff; font-weight: 800; font-size: 16px; box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
}

/* ---- Buttons --------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 38px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
    font-weight: 600; font-size: 14px; line-height: 1; cursor: pointer; white-space: nowrap;
    text-decoration: none !important; transition: background .15s, border-color .15s, box-shadow .15s, color .15s;
}
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--surface-2); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: rgba(15, 27, 45, .06); color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12.5px; font-weight: 500; }
.btn-lg { height: 44px; font-size: 15px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 600; cursor: pointer; }
.link-sm { font-size: 13px; font-weight: 600; }
.icon-btn {
    width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 50%;
    border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: rgba(15, 27, 45, .06); color: var(--ink); }

/* ---- Forms ------------------------------------------------------------------ */
.form-group { margin-bottom: 18px; min-width: 0; }
.form-group label, .label-row label { display: block; font-weight: 600; font-size: 13px; color: var(--ink); margin-bottom: 6px; }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-row-3 { grid-template-columns: repeat(3, 1fr); }
.input {
    display: block; width: 100%; height: 40px; padding: 0 12px;
    font: inherit; color: var(--ink); background: var(--surface);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
select.input {
    appearance: none; padding-right: 34px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
}
.input:hover { border-color: var(--subtle); }
.input:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
.input:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.input.is-invalid { border-color: var(--danger); }
.input.is-invalid:focus { box-shadow: 0 0 0 3px rgba(208, 54, 75, .18); }
.field-error { color: var(--danger); font-size: 12.5px; margin-top: 6px; font-weight: 500; }
.help { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.input-group { position: relative; }
.input-group .input { padding-right: 64px; }
.input-addon {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    border: 0; background: none; color: var(--brand); font-weight: 600; font-size: 13px; cursor: pointer; padding: 6px 8px; border-radius: 6px;
}
.input-addon:hover { background: var(--brand-50); }
.checkbox { display: inline-flex; align-items: flex-start; gap: 9px; cursor: pointer; font-size: 13.5px; color: var(--text); }
.checkbox input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--brand); flex-shrink: 0; }
.checkbox.is-invalid span { color: var(--danger); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 6px; }
.form-card { padding: 24px; }
.form-card .card-header { padding: 0 0 18px; border: 0; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.choice { position: relative; margin: 0 !important; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
    display: flex; align-items: center; min-height: 46px; padding: 10px 14px; border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); font-weight: 500; font-size: 13.5px; cursor: pointer; background: var(--surface); transition: all .15s;
}
.choice span:hover { border-color: var(--brand); }
.choice input:checked + span { border-color: var(--brand); background: var(--brand-50); color: var(--brand-700); box-shadow: inset 0 0 0 1px var(--brand); }
.choice input:focus-visible + span { box-shadow: var(--focus); }

.strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 8px; }
.strength span { height: 4px; border-radius: 4px; background: var(--border); transition: background .2s; }
.strength[data-score="1"] span:nth-child(-n+1) { background: var(--danger); }
.strength[data-score="2"] span:nth-child(-n+2) { background: var(--chart-2); }
.strength[data-score="3"] span:nth-child(-n+3) { background: #52b788; }
.strength[data-score="4"] span { background: var(--success); }

/* ---- Alerts, badges, banners ------------------------------------------------- */
.alert {
    display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm);
    margin-bottom: 18px; font-size: 13.5px; font-weight: 500; border: 1px solid transparent;
}
.alert > span { flex: 1; }
.alert .icon { margin-top: 1px; }
.alert-success { background: var(--success-50); color: #0b5d42; border-color: #bfe6d4; }
.alert-error { background: var(--danger-50); color: #9f1f33; border-color: #f6c6cd; }
.alert-info { background: var(--info-50); color: #1d4ed8; border-color: #c9dafd; }
.alert-close { border: 0; background: none; color: inherit; opacity: .6; cursor: pointer; padding: 0; line-height: 0; }
.alert-close:hover { opacity: 1; }
.badge {
    display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
    font-size: 11.5px; font-weight: 600; line-height: 1.5; vertical-align: middle; white-space: nowrap;
}
.badge-muted { background: #eef0f3; color: var(--muted); }
.badge-success { background: var(--success-50); color: var(--success); }
.badge-warning { background: var(--warning-50); color: var(--warning); }
.badge-danger { background: var(--danger-50); color: var(--danger); }
.banner {
    display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin-bottom: 20px;
    background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--chart-2);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.banner > .icon { color: var(--warning); }
.banner strong { display: block; color: var(--ink); }

/* ---- Cards ------------------------------------------------------------------ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); min-width: 0; }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 12px; }
.card-header p { font-size: 13px; margin-top: 2px; }
.card-footer-link {
    display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-top: 1px solid var(--border);
    font-weight: 600; font-size: 13px;
}

/* ---- App shell -------------------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
    display: flex; flex-direction: column; background: var(--sidebar); color: var(--sidebar-text);
    transition: transform .25s ease;
}
.sidebar-brand { height: var(--topbar-h); padding: 0 20px; flex-shrink: 0; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 12px 16px; scrollbar-width: thin; scrollbar-color: #2a3d59 transparent; }
.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255,255,255,.06); }
.nav-link {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; margin-bottom: 2px;
    border: 0; border-radius: 8px; background: none; color: var(--sidebar-text);
    font-weight: 500; font-size: 14px; text-align: left; cursor: pointer; text-decoration: none !important;
}
.nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.nav-link.is-active { background: var(--brand); color: #fff; }
.nav-link.is-current { color: #fff; }
.nav-link > span { flex: 1; }
.nav-caret { transition: transform .2s; opacity: .7; }
.nav-group.is-open .nav-caret { transform: rotate(180deg); }
.nav-sub { display: none; padding: 2px 0 8px 30px; }
.nav-group.is-open .nav-sub { display: block; }
.nav-sublink {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 12px; border-radius: 7px;
    color: var(--sidebar-text); font-size: 13.5px; text-decoration: none !important; position: relative;
}
.nav-sublink:hover { color: #fff; background: var(--sidebar-hover); }
.nav-sublink.is-active { color: #fff; background: var(--sidebar-2); font-weight: 600; }
.nav-sublink.is-active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: #2dd4bf; }
.nav-soon { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: #6c7c93; }

.app-main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
    display: flex; align-items: center; gap: 16px; padding: 0 24px;
    background: rgba(255, 255, 255, .92); backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--border);
}
.topbar-menu { display: none; }
.company-btn {
    display: flex; align-items: center; gap: 10px; max-width: 280px; padding: 6px 10px 6px 6px;
    border: 1px solid transparent; border-radius: 9px; background: none; cursor: pointer; color: var(--ink); font-weight: 600;
}
.company-btn:hover { background: var(--surface-2); border-color: var(--border); }
.company-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-avatar {
    width: 30px; height: 30px; flex-shrink: 0; display: grid; place-items: center; border-radius: 8px;
    background: var(--brand-50); color: var(--brand-700); font-weight: 700; font-size: 12px;
}
.company-avatar.sm { width: 24px; height: 24px; font-size: 10.5px; border-radius: 6px; }
.company-avatar.lg { width: 42px; height: 42px; font-size: 15px; border-radius: 10px; }
.topbar-search {
    flex: 1; max-width: 460px; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; color: var(--subtle);
}
.topbar-search input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; color: var(--ink); outline: none; }
.topbar-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.avatar-btn { border: 0; background: none; padding: 2px; border-radius: 50%; cursor: pointer; }
.avatar {
    width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%;
    background: var(--ink); color: #fff; font-weight: 600; font-size: 12.5px;
}
.avatar.sm { width: 26px; height: 26px; background: var(--brand-50); color: var(--brand-700); }

.page { padding: 28px 32px 48px; max-width: 1360px; width: 100%; margin: 0 auto; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header p { margin-top: 4px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; margin-bottom: 10px; }

.sidebar-backdrop { display: none; }

/* ---- Dropdowns ---------------------------------------------------------------- */
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 50; min-width: 240px; padding: 6px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
    opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .15s, transform .15s, visibility .15s;
}
.dropdown.is-open > .dropdown-menu { opacity: 1; visibility: visible; transform: none; }
.dropdown-menu-right { left: auto; right: 0; }
.dropdown-item {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 7px;
    background: none; color: var(--text); font-size: 13.5px; text-align: left; cursor: pointer; text-decoration: none !important;
}
.dropdown-item:hover { background: var(--surface-2); color: var(--ink); }
.dropdown-item.is-selected { color: var(--brand-700); font-weight: 600; }
.dropdown-item .icon { color: var(--muted); }
.dropdown-label { padding: 8px 10px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--subtle); }
.dropdown-header { display: flex; flex-direction: column; gap: 2px; padding: 10px; }
.dropdown-header strong { color: var(--ink); }
.dropdown-header .muted { font-size: 12.5px; }
.dropdown-header .badge { align-self: flex-start; margin-top: 6px; }
.dropdown-divider { height: 1px; background: var(--border); margin: 6px 0; }
.new-menu { display: grid; grid-template-columns: repeat(4, minmax(170px, 1fr)); gap: 4px; padding: 12px; }

/* ---- Dashboard ------------------------------------------------------------------ */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi { display: flex; align-items: flex-start; gap: 14px; padding: 18px 20px; }
.kpi-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; flex-shrink: 0; }
.tone-success { background: var(--success-50); color: var(--success); }
.tone-danger { background: var(--danger-50); color: var(--danger); }
.tone-brand { background: var(--brand-50); color: var(--brand); }
.tone-warning { background: var(--warning-50); color: var(--warning); }
.kpi-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 22px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; font-variant-numeric: tabular-nums; margin: 2px 0; }
.kpi-hint { font-size: 12px; color: var(--subtle); }
.dash-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.chart-box { position: relative; height: 280px; padding: 4px 20px 20px; }
.progress { height: 6px; margin: 0 20px 8px; background: var(--border); border-radius: 6px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--brand); border-radius: 6px; }
.checklist { list-style: none; margin: 0; padding: 4px 12px 16px; }
.checklist li { display: flex; align-items: center; gap: 12px; padding: 9px 8px; border-radius: 8px; }
.checklist li:hover { background: var(--surface-2); }
.checklist a { color: var(--ink); font-weight: 500; }
.checklist li.is-done a { color: var(--muted); text-decoration: line-through; }
.check-dot { width: 22px; height: 22px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--border-strong); color: #fff; }
.is-done .check-dot { background: var(--success); border-color: var(--success); }
.list { list-style: none; margin: 0; padding: 0 8px 8px; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; }
.list li + li { border-top: 1px solid var(--border); border-radius: 0; }
.list strong { display: block; color: var(--ink); font-weight: 600; }
.list .muted { display: block; font-size: 12.5px; }
.list-icon { width: 32px; height: 32px; flex-shrink: 0; display: grid; place-items: center; border-radius: 8px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.amount { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.invoice-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 4px 20px 14px; }
.invoice-summary span { display: block; font-size: 12.5px; }
.invoice-summary strong { font-size: 16px; color: var(--ink); font-variant-numeric: tabular-nums; }
.stack-bar { display: flex; height: 10px; margin: 0 20px; border-radius: 6px; background: var(--border); overflow: hidden; }
.seg-overdue { background: var(--danger); }
.seg-open { background: var(--chart-2); }
.empty-inline { display: flex; align-items: center; gap: 8px; padding: 16px 20px 20px; color: var(--muted); font-size: 13px; }

/* ---- Empty states ----------------------------------------------------------------- */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 48px 24px; color: var(--muted); }
.empty-state.compact { padding: 20px 24px 28px; }
.empty-state.large { padding: 80px 24px; }
.empty-state p { max-width: 420px; }
.empty-state .btn { margin-top: 8px; }
.empty-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px; background: var(--brand-50); color: var(--brand); margin-bottom: 6px; }
.empty-actions { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; justify-content: center; }

/* ---- Tables & toolbars -------------------------------------------------------------- */
.toolbar { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.toolbar select.input { width: auto; min-width: 200px; }
.search-input { position: relative; flex: 0 1 320px; }
.search-input .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--subtle); }
.search-input .input { padding-left: 36px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    position: sticky; top: 0; padding: 10px 16px; text-align: left; white-space: nowrap;
    font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
    background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.table td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover td { background: #fafbfc; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.table tr.is-inactive td { color: var(--subtle); }
.account-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); flex-wrap: wrap; }
.sub-mark { color: var(--subtle); }

/* ---- Tabs & settings ------------------------------------------------------------------ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; overflow-x: auto; }
.tab { padding: 10px 14px; font-weight: 600; font-size: 13.5px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab.is-active { color: var(--brand); border-color: var(--brand); }
.tab.is-disabled { color: var(--subtle); cursor: not-allowed; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.sticky-actions {
    position: sticky; bottom: 0; padding: 14px 0; margin-top: 4px;
    background: linear-gradient(to top, var(--bg) 70%, rgba(244, 246, 249, 0));
}

/* ---- Auth pages ------------------------------------------------------------------------ */
.auth-body { background: var(--surface); }
.auth-layout { display: grid; grid-template-columns: minmax(420px, 1fr) 1.1fr; min-height: 100vh; }
.auth-panel { display: flex; flex-direction: column; padding: 32px 48px; }
.auth-content { flex: 1; display: flex; flex-direction: column; justify-content: center; width: 100%; max-width: 420px; margin: 0 auto; padding: 40px 0; }
.auth-card h1 { font-size: 28px; margin-bottom: 8px; }
.auth-sub { color: var(--muted); margin-bottom: 28px; }
.auth-form .checkbox { margin: 2px 0 22px; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 28px 0 16px; color: var(--muted); font-size: 13px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-legal { margin-top: 28px; font-size: 12px; color: var(--muted); text-align: center; }
.auth-footer { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; font-size: 12.5px; color: var(--muted); }
.auth-footer a { color: var(--muted); }
.identifier-summary {
    display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 18px;
    border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); font-weight: 500; color: var(--ink);
}
.identifier-summary .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-form.is-identifier-step .password-step { display: none; }

.auth-showcase {
    position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 48px;
    background: radial-gradient(1200px 600px at 110% -10%, #14b8a6 0%, transparent 55%),
                radial-gradient(900px 500px at -10% 110%, #1e3a8a 0%, transparent 60%),
                linear-gradient(160deg, #0b3b44, #0f1b2d 70%);
    color: #dbe7f0;
}
.showcase-inner { max-width: 470px; }
.auth-showcase h2 { color: #fff; font-size: 32px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin-bottom: 14px; }
.auth-showcase > .showcase-inner > p { color: #b9c9d6; font-size: 15px; margin-bottom: 32px; }
.showcase-card { background: #fff; color: var(--text); border-radius: 14px; padding: 20px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.5); }
.showcase-card-head { display: flex; justify-content: space-between; font-weight: 600; font-size: 13px; color: var(--ink); }
.showcase-figure { font-size: 26px; font-weight: 700; color: var(--ink); margin: 6px 0 14px; letter-spacing: -.01em; }
.showcase-figure small { font-size: 12px; font-weight: 600; }
.showcase-figure .up { color: var(--success); }
.showcase-bars { display: flex; align-items: flex-end; gap: 8px; height: 90px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.showcase-bars span { flex: 1; border-radius: 5px 5px 2px 2px; background: linear-gradient(to top, var(--brand), #2dd4bf); opacity: .9; }
.showcase-rows div { display: flex; align-items: center; gap: 8px; padding-top: 10px; font-size: 13px; }
.showcase-rows b { margin-left: auto; color: var(--ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot-income { background: var(--brand); }
.dot-expense { background: var(--chart-2); }
.showcase-points { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 10px; font-size: 14px; }
.showcase-points li { display: flex; align-items: center; gap: 10px; }
.showcase-points .icon { color: #5eead4; }

/* ---- Focus layout (onboarding, company select, errors) --------------------------------- */
.focus-body { background: var(--bg); min-height: 100vh; }
.focus-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; padding: 0 28px; background: var(--surface); border-bottom: 1px solid var(--border); }
.focus-user { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.focus-main { max-width: 760px; margin: 0 auto; padding: 40px 20px 64px; }
.focus-card { max-width: 480px; margin: 20px auto; padding: 32px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.focus-card h1 { margin-bottom: 4px; }
.company-list { display: grid; gap: 10px; margin: 24px 0; }
.company-option {
    display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px; text-align: left; cursor: pointer;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--muted);
}
.company-option:hover { border-color: var(--brand); box-shadow: var(--focus); }
.company-option strong { display: block; color: var(--ink); }
.company-option .muted { font-size: 12.5px; }
.onboarding-intro { margin-bottom: 24px; }
.onboarding-intro h1 { font-size: 28px; margin-bottom: 6px; }
.stepper { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 20px; counter-reset: step; }
.stepper li { flex: 1; display: flex; align-items: center; gap: 10px; padding: 10px 0; font-size: 13px; font-weight: 600; color: var(--subtle); border-top: 3px solid var(--border); }
.stepper li span { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--border); color: var(--muted); font-size: 12px; }
.stepper li.is-active { color: var(--ink); border-color: var(--brand); }
.stepper li.is-active span { background: var(--brand); color: #fff; }
.stepper li.is-complete { color: var(--brand); border-color: var(--brand); }
.stepper li.is-complete span { background: var(--brand-50); color: var(--brand); }
.onboarding-card { padding: 28px; }
.onboarding-card h2 { font-size: 18px; margin-bottom: 18px; }
.onboarding-card h2 + p { margin: -12px 0 18px; }
.step { display: none; }
.step.is-active { display: block; animation: fade-in .2s ease; }
.onboarding-actions { display: flex; align-items: center; gap: 10px; padding-top: 18px; margin-top: 6px; border-top: 1px solid var(--border); }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.error-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.error-card { text-align: center; max-width: 440px; }
.error-code { font-size: 72px; font-weight: 800; letter-spacing: -.04em; color: var(--brand); line-height: 1; margin-bottom: 12px; }
.error-card h1 { margin-bottom: 10px; }
.error-card p { margin-bottom: 24px; }

/* ---- Responsive ------------------------------------------------------------------------ */
@media (max-width: 1200px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .dash-grid { grid-template-columns: repeat(2, 1fr); }
    .new-menu { grid-template-columns: repeat(2, minmax(170px, 1fr)); }
}
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    body.sidebar-open .sidebar { transform: none; }
    body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(15, 27, 45, .45); }
    .app-main { margin-left: 0; }
    .topbar-menu { display: inline-grid; }
    .auth-layout { grid-template-columns: 1fr; }
    .auth-showcase { display: none; }
    .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .page { padding: 20px 16px 40px; }
    .topbar { padding: 0 12px; gap: 8px; }
    .topbar-search { display: none; }
    .company-name { max-width: 120px; }
    .kpi-grid, .dash-grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .auth-panel { padding: 24px 20px; }
    .new-menu { grid-template-columns: 1fr 1fr; min-width: 300px; right: -60px; }
    .invoice-summary { grid-template-columns: 1fr; }
    .stepper li { font-size: 0; gap: 0; }
    .focus-user .muted { display: none; }
    .toolbar .search-input { flex-basis: 100%; }
}

/* ==========================================================================
   Phase 2–4: books, sales, expenses, banking
   ========================================================================== */
.badge-info { background: var(--info-50); color: var(--info); }
.badge-lg { font-size: 12.5px; padding: 3px 10px; vertical-align: 4px; margin-left: 6px; }
.text-warning { color: var(--warning) !important; }
.text-ink { color: var(--ink); }
.nowrap { white-space: nowrap; }
.clamp { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pre { white-space: pre-line; }
.req { color: var(--danger); }
.strong-link { font-weight: 600; color: var(--brand); }
.amount-link { color: var(--ink); font-weight: 600; }
.narrow { max-width: 640px; }
.card-section { padding: 16px 20px; }
.muted-row td { color: var(--muted); background: var(--surface-2); font-size: 12.5px; }
.table tbody tr[data-href] { cursor: pointer; }
.table tfoot td { padding: 11px 16px; background: var(--surface-2); border-top: 1px solid var(--border); }

/* Money bar (open / overdue / paid) */
.money-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.money-seg {
    display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--border-strong);
    color: var(--ink); text-decoration: none !important; box-shadow: var(--shadow-sm); transition: box-shadow .15s, transform .15s;
}
.money-seg:hover { box-shadow: var(--shadow); transform: translateY(-1px); color: var(--ink); }
.money-seg strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.money-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.seg-neutral { border-top-color: #94a3b8; }
.seg-overdue { border-top-color: var(--danger); }
.seg-open { border-top-color: var(--chart-2); }
.seg-paid { border-top-color: var(--success); }

.stat-row { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.stat-link { display: flex; align-items: center; gap: 10px; padding: 12px 18px; text-decoration: none !important; }
.stat-link.is-active { border-color: var(--brand); box-shadow: var(--focus); }
.stat-num { font-size: 22px; font-weight: 700; }

/* Filters */
.date-range { display: flex; align-items: center; gap: 8px; }
.date-range .input { width: 150px; }
.preset-row { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 20px 14px; border-bottom: 1px solid var(--border); margin-top: -4px; }
.chip { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border); font-size: 12.5px; font-weight: 500; color: var(--muted); background: var(--surface); text-decoration: none !important; }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.is-active { background: var(--brand-50); border-color: var(--brand); color: var(--brand-700); }

/* Details lists */
.details { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; margin: 0; padding: 4px 20px 20px; font-size: 13.5px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.contact-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; margin-bottom: 20px; align-items: start; }
.kpi-2 { grid-template-columns: 1fr; margin: 0; }

/* Item type picker */
.type-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.type-option {
    display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--surface); color: var(--ink); text-decoration: none !important;
}
.type-option .icon { color: var(--muted); margin-bottom: 4px; }
.type-option:hover { border-color: var(--brand); color: var(--ink); }
.type-option.is-active { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: var(--brand-50); }
.type-option.is-active .icon { color: var(--brand); }

/* Transaction forms */
.txn-form { padding-bottom: 80px; }
.txn-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.txn-head h1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.txn-no { font-size: 15px; font-weight: 500; }
.input-inline { display: inline-block; width: 130px; height: 34px; font-size: 16px; font-weight: 600; }
.txn-total-box { text-align: right; }
.txn-total-box span { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.txn-total-box strong { font-size: 30px; font-weight: 700; color: var(--ink); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.txn-card { margin-bottom: 18px; }
.txn-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 16px; padding: 20px 20px 4px; }
.txn-fields .span-2 { grid-column: span 2; }
.input-with-link { display: flex; align-items: center; gap: 10px; }
.input-with-link .input { flex: 1; }
.input-with-link .link-sm { white-space: nowrap; }
.lines-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.inline-field { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.inline-field .input { width: auto; }
.input-sm { height: 34px; padding: 0 9px; font-size: 13.5px; }
textarea.input-sm { padding: 7px 9px; min-height: 34px; line-height: 1.4; resize: vertical; }
select.input-sm { padding-right: 28px; background-position: right 7px center; }
.num-input { text-align: right; font-variant-numeric: tabular-nums; }
.lines-table td { padding: 6px 8px; vertical-align: top; }
.lines-table th { padding: 10px 8px; }
.lines-table tbody tr:hover td { background: #fbfcfd; }
.line-handle { color: var(--subtle); font-size: 12.5px; padding-top: 14px !important; text-align: center; }
.line-billable { min-width: 170px; }
.line-billable .checkbox { margin-top: 4px; }
.checkbox.tiny { font-size: 12px; gap: 6px; }
.checkbox.tiny input { width: 14px; height: 14px; }
.icon-btn.sm { width: 30px; height: 30px; margin-top: 2px; }
.lines-actions { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.lines-actions + .field-error { padding: 0 20px 12px; }
.txn-foot { display: grid; grid-template-columns: 1fr 360px; gap: 32px; padding: 18px 20px 20px; border-top: 1px solid var(--border); align-items: start; }
.txn-notes .form-group:last-child { margin-bottom: 0; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 10px 20px; margin: 0; font-size: 14px; align-items: center; }
.totals dt { color: var(--muted); text-align: right; }
.totals dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); min-width: 110px; }
.totals .total-dt { color: var(--ink); font-weight: 700; font-size: 15px; padding-top: 8px; border-top: 1px solid var(--border); }
.totals .total-dd { font-weight: 700; font-size: 17px; padding-top: 8px; border-top: 1px solid var(--border); }
.discount-dt { display: flex; justify-content: flex-end; gap: 6px; }
.discount-dt select { width: 140px; }
.discount-dt input { width: 80px; }
.action-bar {
    position: fixed; left: var(--sidebar-w); right: 0; bottom: 0; z-index: 25; display: flex; align-items: center; gap: 10px;
    padding: 12px 32px; background: rgba(255,255,255,.96); backdrop-filter: blur(6px); border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgba(16, 24, 40, .06);
}
.pay-check { width: 16px; height: 16px; accent-color: var(--brand); }

/* Transaction detail page */
.show-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.show-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.show-side { display: flex; flex-direction: column; gap: 18px; }
.doc-card { padding: 32px; }
.journal-details summary { display: flex; align-items: center; gap: 8px; padding: 14px 20px; cursor: pointer; font-weight: 600; color: var(--ink); list-style: none; }
.journal-details summary::-webkit-details-marker { display: none; }
.journal-details[open] summary { border-bottom: 1px solid var(--border); }

/* Printable document */
.doc { color: var(--text); font-size: 13.5px; }
.doc { --doc-accent: var(--brand); }
.doc-top { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 20px; border-bottom: 3px solid var(--doc-accent); }
.doc-logo { max-height: 64px; max-width: 220px; margin-bottom: 10px; display: block; object-fit: contain; }
.doc-company { font-size: 20px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.doc-title { text-align: right; }
.doc-type { font-size: 26px; font-weight: 800; letter-spacing: .08em; color: var(--doc-accent); }
.doc-number { font-size: 14px; font-weight: 600; color: var(--muted); margin-top: 4px; }
.doc-meta { display: grid; grid-template-columns: 1fr 1fr auto; gap: 24px; padding: 20px 0; }
.doc-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; }
.doc-dates { display: grid; grid-template-columns: auto auto; gap: 6px 16px; margin: 0; }
.doc-dates dt { color: var(--muted); }
.doc-dates dd { margin: 0; font-weight: 600; color: var(--ink); text-align: right; }
.doc-lines { width: 100%; border-collapse: collapse; margin-top: 4px; }
.doc-lines th { text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 8px; background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.doc-lines td { padding: 12px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.doc-lines .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.doc-bottom { display: grid; grid-template-columns: 1fr 320px; gap: 32px; padding-top: 20px; }
.doc-message { color: var(--muted); }

.print-body { background: #eef1f5; }
.print-toolbar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.print-wrap { max-width: 880px; margin: 24px auto; padding: 0 16px; }
.print-sheet { background: #fff; padding: 48px; border-radius: 6px; box-shadow: var(--shadow-lg); }
@media print {
    @page { margin: 14mm; }
    .no-print, .print-toolbar { display: none !important; }
    .print-body { background: #fff; }
    .print-wrap { margin: 0; padding: 0; max-width: none; }
    .print-sheet { box-shadow: none; padding: 0; }
    .doc-lines th, .muted-row td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 1200px) {
    .txn-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .show-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
    .action-bar { left: 0; padding: 10px 16px; }
    .contact-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .txn-fields { grid-template-columns: 1fr; }
    .txn-fields .span-2 { grid-column: auto; }
    .txn-foot, .doc-bottom, .doc-meta { grid-template-columns: 1fr; }
    .type-switch { grid-template-columns: 1fr; }
    .details { grid-template-columns: 1fr; }
    .doc-card, .print-sheet { padding: 18px; }
    .action-bar .btn-secondary { display: none; }
    .date-range .input { width: 130px; }
}

/* Dashboard additions */
.seg-paid-bar { background: var(--success); }
.donut-wrap { display: grid; grid-template-columns: 140px 1fr; gap: 16px; align-items: center; padding: 0 20px 20px; }
.donut-box { position: relative; height: 140px; }
.legend-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13px; }
.legend-list li { display: flex; align-items: center; gap: 8px; }
.legend-list strong { font-variant-numeric: tabular-nums; color: var(--ink); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; background: var(--border); }
.card-footer-links { display: flex; gap: 18px; padding: 12px 20px; border-top: 1px solid var(--border); font-size: 13px; font-weight: 600; }

/* Banking */
.bank-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.bank-card { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none !important; box-shadow: var(--shadow-sm); }
.bank-card:hover { border-color: var(--brand); color: var(--ink); }
.bank-card.is-active { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.bank-card .badge { align-self: flex-start; margin-top: 4px; }
.bank-card-name { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.card-tabs { margin: 0; padding: 0 16px; }
.feed-table td { vertical-align: middle; }
.match-box { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.match-box select { flex: 1; min-width: 160px; }
.add-instead summary { cursor: pointer; margin-top: 6px; list-style: none; }
.inline-add { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.inline-add select { flex: 1; min-width: 130px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.dropzone { display: flex !important; flex-direction: column; align-items: center; gap: 6px; padding: 28px; border: 2px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; text-align: center; color: var(--muted); font-weight: 500 !important; }
.dropzone:hover { border-color: var(--brand); color: var(--brand); }
.dropzone strong { color: var(--ink); }
.section-title { margin: 8px 0 12px; font-size: 14px; }
.preview-table { max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 16px; }
.condition-row { display: grid; grid-template-columns: 150px 180px 1fr; gap: 8px; margin-bottom: 8px; }
.input-auto { display: inline-block; width: auto; margin: 0 6px; }
.recon-begin { display: flex; align-items: baseline; gap: 12px; padding: 12px 14px; margin-bottom: 18px; background: var(--surface-2); border-radius: var(--radius-sm); flex-wrap: wrap; }
.recon-begin strong { font-size: 18px; }
.recon-summary { display: flex; align-items: center; justify-content: space-around; gap: 16px; padding: 18px 24px; margin-bottom: 20px; flex-wrap: wrap; }
.recon-summary > div { display: flex; flex-direction: column; gap: 2px; text-align: center; }
.recon-summary strong { font-size: 22px; color: var(--ink); font-variant-numeric: tabular-nums; }
.recon-summary .op { font-size: 24px; color: var(--subtle); }
.recon-diff strong { color: var(--danger); }
.recon-diff.is-zero strong { color: var(--success); }
@media (max-width: 720px) { .condition-row { grid-template-columns: 1fr; } }

/* Reports */
.report-search { flex: 0 1 300px; }
.report-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.report-tile { display: flex; flex-direction: column; gap: 6px; padding: 18px; color: var(--ink); text-decoration: none !important; }
.report-tile .icon { color: var(--brand); }
.report-tile:hover { border-color: var(--brand); box-shadow: var(--shadow); color: var(--ink); }
.report-groups { columns: 2 420px; column-gap: 20px; }
.report-group { break-inside: avoid; margin-bottom: 20px; display: inline-block; width: 100%; }
.report-list { list-style: none; margin: 0; padding: 0 8px 12px; }
.report-list li { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 8px; }
.report-list li:hover { background: var(--surface-2); }
.report-filters { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; padding: 16px 20px 0; margin-bottom: 20px; }
.report-filters .form-group { min-width: 160px; }
.report-card { padding: 28px 32px 20px; }
.report-head { text-align: center; margin-bottom: 20px; }
.report-company { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.report-title { font-size: 22px; font-weight: 700; color: var(--ink); margin: 4px 0; }
.report-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.report-table th { padding: 8px 12px; border-bottom: 2px solid var(--ink); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); text-align: left; white-space: nowrap; }
.report-table td { padding: 7px 12px; border-bottom: 1px solid #f0f2f5; }
.report-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.report-table td.neg { color: var(--danger); }
.report-table a { color: var(--text); }
.report-table a:hover { color: var(--brand); }
.report-table .r-section td { font-weight: 700; color: var(--ink); padding-top: 14px; border-bottom: 0; }
.report-table .r-section a { color: var(--ink); }
.report-table .r-subtotal td { font-weight: 600; color: var(--ink); border-top: 1px solid var(--border-strong); background: #fcfcfd; }
.report-table .r-strong td { font-weight: 700; background: var(--surface-2); }
.report-table .r-total td { font-weight: 800; color: var(--ink); border-top: 2px solid var(--ink); border-bottom: 3px double var(--ink); padding: 10px 12px; }
.report-table .r-muted td { color: var(--muted); font-style: italic; }
.report-table .r-spacer td { height: 14px; border: 0; }
.report-foot { text-align: center; margin-top: 18px; }
@media (max-width: 1024px) { .report-quick { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) { .report-card { padding: 16px; } .report-quick { grid-template-columns: 1fr; } }

/* Settings */
.logo-preview { padding: 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); margin-bottom: 10px; display: inline-block; background: #fff; }
.logo-preview img { max-height: 70px; max-width: 240px; display: block; }
.color-input { width: 64px; height: 40px; padding: 2px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; cursor: pointer; }
.brand-preview { padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
code { font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border); }

/* Phase 8–10 screens */
.inline-flex { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.center { text-align: center; }
.bell { position: relative; }
.bell-dot { position: absolute; top: 4px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; line-height: 1; }
.notif-menu { width: 340px; padding: 0; max-height: 440px; overflow-y: auto; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.notif-empty { padding: 20px 14px; text-align: center; }
.notif-item { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none !important; font-size: 13px; }
.notif-item:hover { background: var(--surface-2); color: var(--ink); }
.notif-item.is-unread { background: var(--brand-50); }
.notif-item.is-unread strong::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); margin-right: 6px; vertical-align: middle; }
.mfa-icon { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 16px; background: var(--brand-50); color: var(--brand); margin-bottom: 18px; }
.code-input { font-size: 22px; letter-spacing: 6px; text-align: center; height: 52px; font-variant-numeric: tabular-nums; }
.auth-alt-form { text-align: center; margin-top: 16px; }
.mfa-actions { flex-wrap: wrap; gap: 8px !important; }
.mfa-actions .input { width: 160px; }
.recovery-card { border-color: var(--chart-2); }
.recovery-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }
.recovery-codes code { font-size: 14px; padding: 6px 10px; text-align: center; letter-spacing: 1px; }
.steps-list { margin: 0 0 16px; padding-left: 20px; display: grid; gap: 10px; }
.secret { font-size: 13px; word-break: break-all; }
.qr-box { width: 196px; min-height: 196px; padding: 8px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); display: grid; place-items: center; }
.role-options { display: grid; gap: 8px; }
.role-options .choice span { display: block; line-height: 1.4; }
.audit-details span { display: inline-block; margin-right: 10px; }
.attach-form { display: flex; gap: 8px; align-items: center; border-top: 1px solid var(--border); }
.attach-form .input { flex: 1; min-width: 0; padding-top: 5px; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.project-card { display: flex; flex-direction: column; gap: 12px; padding: 18px; color: var(--text); text-decoration: none !important; }
.project-card:hover { border-color: var(--brand); box-shadow: var(--shadow); color: var(--text); }
.project-card .progress { margin: 0; }
.project-card-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.project-card-head strong { color: var(--ink); font-size: 15px; }
.project-figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.project-figures span { display: block; }
.project-figures strong { font-variant-numeric: tabular-nums; color: var(--ink); }
.weekly-table .hours-input { width: 64px; }
.budget-table .budget-input { width: 96px; }
.sticky-col { position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 200px; }
.dispose-box { display: inline-block; position: relative; }
.dispose-box summary { list-style: none; cursor: pointer; }
.dispose-box summary::-webkit-details-marker { display: none; }
.dispose-form { position: absolute; right: 0; top: 100%; z-index: 20; width: 280px; display: grid; gap: 8px; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); text-align: left; }
.dispose-form label { display: grid; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.payslip-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.api-list { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 4px; }
@media (max-width: 720px) { .payslip-cols, .recovery-codes, .project-figures { grid-template-columns: 1fr; } }

/* Dashboard customize dialog */
.dash-customize { width: min(560px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border); }
.dash-customize::backdrop { background: rgba(15, 23, 42, .45); }
.widget-order { list-style: none; margin: 0; padding: 0 20px; }
.widget-order li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); background: var(--surface, #fff); }
.widget-order li.is-dragging { opacity: .5; }
.widget-order label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.drag-handle { cursor: grab; color: var(--muted, #94a3b8); letter-spacing: -2px; user-select: none; }

/* Help centre */
.help-layout { display: grid; grid-template-columns: 240px 1fr; gap: 20px; align-items: start; }
.help-toc { position: sticky; top: 80px; display: flex; flex-direction: column; padding: 8px; }
.help-toc a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--ink, inherit); text-decoration: none; }
.help-toc a:hover { background: var(--surface-2); }
.help-topics { display: flex; flex-direction: column; gap: 20px; }
.help-topic { scroll-margin-top: 80px; }
.help-steps { margin: 0; padding: 4px 20px 16px 40px; line-height: 1.6; }
.help-steps li + li { margin-top: 6px; }
@media (max-width: 860px) { .help-layout { grid-template-columns: 1fr; } .help-toc { position: static; } }

/* System log viewer */
.log-list { padding: 0 8px 8px; }
.log-entry { border-bottom: 1px solid var(--border); }
.log-entry summary { display: flex; gap: 12px; padding: 8px 12px; cursor: pointer; font-size: 13px; align-items: baseline; }
.log-entry summary .mono { white-space: nowrap; }
.log-detail { margin: 0 12px 12px; padding: 12px; background: var(--surface-2); border-radius: 8px; font-size: 12px; white-space: pre-wrap; word-break: break-word; max-height: 360px; overflow: auto; }

/* Side drawer (dialog) — report Customise and other side panels */
.drawer { position: fixed; inset: 0 0 0 auto; margin: 0; height: 100vh; max-height: 100vh; width: min(440px, 100vw); padding: 0; border: 0; border-left: 1px solid var(--border); border-radius: 0; background: var(--surface); box-shadow: var(--shadow-lg); display: none; flex-direction: column; }
.drawer[open] { display: flex; }
.drawer::backdrop { background: rgba(15, 23, 42, .35); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { margin: 0; font-size: 17px; }
.drawer-body { flex: 1; overflow: auto; padding: 4px 20px 20px; }
.drawer-foot { display: flex; justify-content: space-between; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); }
.drawer-section { border-bottom: 1px solid var(--border); padding: 14px 0; }
.drawer-section > summary { list-style: none; cursor: pointer; font-weight: 700; color: var(--ink); display: flex; justify-content: space-between; }
.drawer-section > summary::-webkit-details-marker { display: none; }
.drawer-section > summary::after { content: '▾'; color: var(--muted); }
.drawer-section:not([open]) > summary::after { content: '▸'; }
.drawer-section .form-group { margin-top: 10px; }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin-top: 10px; }
.check-grid label, .radio-row label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; }
.seg-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: var(--radius-sm); margin: 14px 0 4px; }
.seg-tabs button { border: 0; background: transparent; padding: 7px; border-radius: 6px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg-tabs button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* Report screen v2 */
.report-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); margin: -28px -32px 20px; flex-wrap: wrap; }
.report-toolbar .tools { display: flex; align-items: center; gap: 4px; }
.report-toolbar select { width: auto; }
.report-table.d-compact td { padding: 4px 10px; } .report-table.d-compact { font-size: 12.5px; }
.report-table.d-cozy td { padding: 9px 12px; }
.report-table.d-comfort td { padding: 12px 14px; font-size: 14px; }
.report-table.banded tbody tr:nth-child(even) td { background: var(--surface-2); }
.report-table.neg-red td.neg, .report-table td.neg-red { color: var(--danger); }
.report-table:not(.neg-red) td.neg { color: inherit; }
.report-table .r-toggle { cursor: pointer; user-select: none; }
.report-table .r-toggle::before { content: '▾'; display: inline-block; width: 14px; color: var(--muted); }
.report-table .r-toggle.is-collapsed::before { content: '▸'; }
.report-head.align-left { text-align: left; } .report-head.align-right { text-align: right; }
.report-logo { max-height: 48px; margin-bottom: 6px; }
.report-note { margin: 16px auto 0; max-width: 720px; padding: 10px 14px; background: var(--surface-2); border-radius: var(--radius-sm); font-size: 13px; white-space: pre-wrap; }
@media (max-width: 720px) { .report-toolbar { margin: -16px -16px 16px; } .check-grid { grid-template-columns: 1fr; } }
@media print { .report-toolbar, .drawer { display: none !important; } }
.drawer-form { display: flex; flex-direction: column; height: 100%; }
select.input[multiple] { height: auto; min-height: 110px; padding: 6px; }
.line-row.is-dragging { opacity: .45; } .line-handle { cursor: grab; } .line-del { white-space: nowrap; }
.table-tools { display: flex; justify-content: flex-end; align-items: center; gap: 6px; padding: 6px 12px; }
.table.t-compact td { padding-top: 5px; padding-bottom: 5px; font-size: 13px; }
.table.t-cozy td { padding-top: 14px; padding-bottom: 14px; }
@media print { body.printing-table .sidebar, body.printing-table .topbar, body.printing-table .page-header, body.printing-table .table-tools, body.printing-table .money-bar, body.printing-table .card:not(:has(.print-target)) { display: none !important; } }

/* Home page (phase 13) */
.app-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.app-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--ink); font-weight: 600; font-size: 13.5px; text-decoration: none !important; box-shadow: var(--shadow-sm); }
.app-chip:hover { border-color: var(--brand); color: var(--brand); }
.app-chip-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand-50); color: var(--brand); }
.dash-block { margin-bottom: 18px; }
.dash-block-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.dash-block-head h2, .quick-title { font-size: 15px; margin: 0; }
.feed-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.feed-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; border-top: 3px solid var(--info); }
.feed-card.tone-danger { border-top-color: var(--danger); } .feed-card.tone-warning { border-top-color: var(--warning); } .feed-card.tone-info { border-top-color: var(--info); } .feed-card.tone-muted { border-top-color: var(--border-strong); }
.feed-card p { margin: 0; }
.feed-card-head { display: flex; align-items: flex-start; gap: 8px; }
.feed-icon { color: var(--muted); margin-top: 2px; }
.quick-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.quick-row .quick-title { margin-right: 6px; }
.quick-row .chip { display: inline-flex; align-items: center; padding: 6px 14px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 600; text-decoration: none !important; }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.ageing-bars { display: grid; gap: 8px; }
.ageing-bar { display: grid; grid-template-columns: 60px 1fr 120px; align-items: center; gap: 10px; }
.ageing-bar strong { text-align: right; }
.ageing-bar .bar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.ageing-bar .bar span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.dash-privacy .kpi-value, .dash-privacy .amount, .dash-privacy strong, .dash-privacy td.num, .dash-privacy .chart-box, .dash-privacy .donut-wrap { filter: blur(7px); user-select: none; }
.dash-foot { text-align: center; margin: 18px 0 0; }
@media (max-width: 720px) { .ageing-bar { grid-template-columns: 50px 1fr 100px; } }

/* Shell (phase 13): instant search, notification tabs, bookmarks */
.topbar-search { position: relative; }
.search-pop { position: absolute; top: calc(100% + 6px); left: 0; right: 0; min-width: 380px; max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 60; padding: 6px 0; }
.search-pop a { display: flex; flex-direction: column; padding: 7px 14px; color: var(--text); text-decoration: none; }
.search-pop a:hover, .search-pop a.is-active { background: var(--surface-2); }
.search-group { padding: 8px 14px 2px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.search-empty { padding: 10px 14px; }
.search-foot { display: flex; justify-content: space-between; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 4px; }
.search-foot a { flex-direction: row; font-size: 12.5px; color: var(--brand); }
.notif-tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--border); }
.notif-tabs button { border: 0; background: none; padding: 8px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.notif-tabs button.is-active { color: var(--brand); border-bottom-color: var(--brand); }
.icon-btn.is-on { color: var(--brand); }
.sidebar-bookmarks { padding: 8px 12px; border-top: 1px solid rgba(255, 255, 255, .08); }
.sidebar-label { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--sidebar-text); padding: 6px 8px; opacity: .8; }
@media (max-width: 720px) { .search-pop { min-width: 0; } }
.report-li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.star-btn { color: var(--subtle); }
.star-btn.is-on, .star-btn:hover { color: #e3a008; }
.star-btn.is-on svg { fill: #e3a008; }
.report-list-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0 12px; }
.pkg-cover { min-height: 70vh; display: flex; flex-direction: column; justify-content: center; text-align: center; gap: 10px; }
.pkg-cover h1 { font-size: 34px; margin: 0; }
.pkg-section { margin-top: 28px; }
.pkg-toc { list-style: none; padding: 0; margin: 0 auto; max-width: 520px; }
.pkg-toc li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dotted var(--border-strong); }
@media print { .pkg-break { page-break-before: always; break-before: page; } }

/* Tags (phase 15) */
.tag-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 40px; height: auto; padding: 5px 8px; cursor: text; }
.tag-input { border: 0; outline: 0; flex: 1; min-width: 140px; font: inherit; background: transparent; padding: 3px 2px; }
.tag-chip { --tag: #667085; display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
    color: var(--tag); background: color-mix(in srgb, var(--tag) 12%, transparent); border: 1px solid color-mix(in srgb, var(--tag) 35%, transparent); white-space: nowrap; }
.tag-chip button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 14px; line-height: 1; padding: 0 0 0 2px; }
.tag-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.tag-list { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.btn-split { display: inline-flex; align-items: center; gap: 1px; } .btn-split > .btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; } .btn-split .dropdown > .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; padding-left: 8px; padding-right: 8px; }
.quick-entry { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 10px 16px; background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.cashback-box { display: grid; grid-template-columns: 1fr 1fr 140px; gap: 8px; margin-bottom: 10px; } @media (max-width: 720px) { .cashback-box { grid-template-columns: 1fr; } }
.quick-entry .input { width: auto; flex: 0 0 auto; } .quick-entry input[type=date] { width: 150px; } .quick-entry .grow { flex: 1 1 160px; min-width: 140px; }
.alert-warning { background: var(--warning-50); color: #8a5300; border-color: #f5d7a1; } .vat-boxes td:first-child { width: 40px; color: var(--muted); font-weight: 700; } .vat-boxes .r-total td { font-weight: 800; border-top: 2px solid var(--ink); }
.amount, .kpi-value { white-space: nowrap; } .kpi-value { font-size: clamp(16px, 1.35vw, 22px); overflow: hidden; text-overflow: ellipsis; }

/* Collapsible "more fields" block inside a form card */
.form-more { margin: 4px 0 14px; }
.form-more > summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: 13.5px; margin-bottom: 10px; }
.item-thumb { width: 32px; height: 32px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); vertical-align: middle; margin-right: 8px; float: left; }
.item-thumb.lg { width: 88px; height: 88px; float: none; margin: 0; }
.item-image-field { display: flex; gap: 14px; align-items: flex-start; }

/* Tasks & comments */
.task-check { border: 1.5px solid var(--border-strong, var(--border)); border-radius: 50%; color: transparent; }
.task-check:hover { color: var(--success); border-color: var(--success); }
.task-check.is-checked { background: var(--success); border-color: var(--success); color: #fff; }
.task-list li.is-done strong { text-decoration: line-through; color: var(--muted); }
.task-list li { align-items: flex-start; }
.comment-form { display: flex; gap: 8px; align-items: flex-end; border-top: 1px solid var(--border); }
.comment-form textarea { flex: 1; resize: vertical; }
.comment-list li { align-items: flex-start; }
.comment-list .avatar { flex: none; font-size: 11px; }
.audit-trail li { padding-left: 20px; }

/* Form styles (Settings → Form styles): layout + font */
.doc-font-serif { font-family: Georgia, "Times New Roman", serif; }
.doc-font-mono { font-family: "Courier New", Consolas, monospace; }
.doc-tpl-classic .doc-top { border-bottom-width: 1px; }
.doc-tpl-classic .doc-lines th { background: var(--doc-accent); color: #fff; border-color: var(--doc-accent); }
.doc-tpl-classic .doc-lines td { border: 1px solid var(--border); }
.doc-tpl-compact { font-size: 12px; }
.doc-tpl-compact .doc-lines td { padding: 5px 8px; }
.doc-tpl-compact .doc-lines th { padding: 6px 8px; }
.doc-tpl-compact .doc-meta { padding: 12px 0; }
@media print { .doc-tpl-classic .doc-lines th { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* Sales overview: horizontal bars in a list */
.bar-list .grow { min-width: 0; }
.bar-track { display: block; height: 6px; border-radius: 3px; background: var(--surface-2); margin-top: 6px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 3px; background: var(--brand); }

/* Proposals & contracts */
.paper-section { margin-top: 18px; }
.paper-section h3 { font-size: 15px; color: var(--ink); margin: 0 0 6px; }
.paper-answer { margin-top: 24px; padding: 12px 14px; border-radius: 8px; border: 1px solid var(--border); }
.paper-answer.is-yes { background: var(--success-50); border-color: #bfe6d4; }
.paper-answer.is-no { background: var(--danger-50); border-color: #f6c6cd; }
.agree-box { max-width: 820px; margin: 16px auto 40px; }
.lead-funnel { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 16px; }
.lead-funnel a { display: block; padding: 12px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); color: inherit; text-decoration: none; }
.lead-funnel a.is-active { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; }
.lead-funnel strong { display: block; font-size: 18px; color: var(--ink); }
.lead-funnel span { font-size: 12.5px; color: var(--muted); }
.section-editor { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
@media (max-width: 900px) { .lead-funnel { grid-template-columns: repeat(3, 1fr); } }
.manage-opts .checkbox { margin-right: 14px; }
.delayed-box { margin-bottom: 16px; }

/* Attachment thumbnails (library list / grid, attachments card) */
.attach-thumb { display: inline-flex; align-items: center; justify-content: center; flex: none; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); vertical-align: middle; }
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-type { font-size: 10px; font-weight: 700; letter-spacing: .03em; color: var(--muted); }
.attach-thumb[style*="150px"] .attach-type { font-size: 18px; }
.attach-type-pdf { color: var(--danger); }
.attach-type-xls, .attach-type-xlsx, .attach-type-csv { color: var(--success); }
.attach-type-doc, .attach-type-docx { color: var(--info); }
.list li .attach-thumb { margin-right: 4px; }
.attach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.attach-tile { position: relative; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; background: var(--surface); min-width: 0; }
.attach-tile .attach-thumb { width: 100% !important; height: 150px !important; margin-bottom: 8px; }
.attach-tile-check { position: absolute; top: 14px; left: 14px; z-index: 1; background: var(--surface); border-radius: 4px; padding: 2px 4px; line-height: 0; }
.attach-tile-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Edit / Email view / PDF view preview tabs (partials/preview_tabs.php) */
.preview-tabs { margin-bottom: 16px; align-items: center; }
.preview-tabs button.tab { background: none; border-top: 0; border-left: 0; border-right: 0; cursor: pointer; font-family: inherit; }
.preview-tabs .tab.is-active { color: var(--brand); border-bottom-color: var(--brand); }
.preview-panel { padding: 0; overflow: hidden; margin-bottom: 20px; }
.preview-panel iframe { display: block; width: 100%; height: 720px; border: 0; background: #eef1f5; }
.preview-note { margin: 0; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.email-preview { max-width: 640px; margin: 24px auto; padding: 0 16px; }
.email-preview-head { display: grid; grid-template-columns: 70px 1fr; gap: 6px 12px; margin: 0 0 16px; padding: 14px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); font-size: 13.5px; }
.email-preview-head dt { color: var(--muted); }
.email-preview-head dd { margin: 0; overflow-wrap: anywhere; }
.email-preview-body > div { border-radius: var(--radius); }

/* Drawn e-signature (public /agree page) */
.sig-pad { position: relative; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); }
.sig-pad canvas { display: block; width: 100%; height: auto; aspect-ratio: 760 / 200; touch-action: none; cursor: crosshair; }
.sig-pad .sig-hint { position: absolute; left: 14px; bottom: 10px; pointer-events: none; font-size: 12px; }
.sig-pad .sig-hint::before { content: "✕ "; }
.sig-pad.is-signed .sig-hint { display: none; }
.sig-pad .sig-clear { position: absolute; top: 6px; right: 6px; }
.paper-signature { display: block; max-width: 260px; max-height: 80px; margin-top: 8px; background: #fff; }

/* Bank feed: VAT picker under the category */
.bank-tax { display: block; margin-top: 4px; max-width: 100%; }
.inline-add .bank-tax { display: inline-block; margin-top: 0; width: auto; }
