/* HomeJab Books — one neutral palette, one cobalt accent, system type, tabular money. */

:root {
    color-scheme: light;
    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface-2: #f6f7f9;
    --surface-3: #eceef2;
    --ink: #15171c;
    --ink-2: #3a404b;
    --muted: #697180;
    --faint: #9aa1ad;
    --line: #e3e6eb;
    --line-strong: #cfd4db;
    --accent: #2850e0;
    --accent-hover: #1f42c4;
    --accent-ink: #ffffff;
    --accent-soft: #e9eefd;
    --pos: #12784f;
    --pos-soft: #e2f3ea;
    --neg: #bf342a;
    --neg-soft: #fbe8e6;
    --warn: #8f5d00;
    --warn-soft: #fcf1d9;
    --side: #111318;
    --side-2: #1a1d24;
    --side-ink: #a6adba;
    --side-ink-strong: #f2f4f7;
    --shadow: 0 1px 2px rgba(17, 19, 24, 0.06), 0 1px 1px rgba(17, 19, 24, 0.03);
    --shadow-pop: 0 12px 32px rgba(17, 19, 24, 0.16), 0 2px 6px rgba(17, 19, 24, 0.08);
    --radius: 8px;
    --radius-sm: 6px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, 'Helvetica Neue', sans-serif;
    --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
    --side-w: 216px;
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --bg: #0d0f13;
        --surface: #15181e;
        --surface-2: #1a1e25;
        --surface-3: #222730;
        --ink: #e9ebef;
        --ink-2: #c3c8d1;
        --muted: #8d95a3;
        --faint: #626a78;
        --line: #252a33;
        --line-strong: #343a45;
        --accent: #7090ff;
        --accent-hover: #8aa4ff;
        --accent-ink: #0d0f13;
        --accent-soft: #1d2540;
        --pos: #4cc38a;
        --pos-soft: #13291f;
        --neg: #ff7a6e;
        --neg-soft: #33191a;
        --warn: #e8b04a;
        --warn-soft: #2e2413;
        --side: #090a0d;
        --side-2: #14161b;
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.5);
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--ink);
    font: 14px/1.45 var(--font);
    -webkit-font-smoothing: antialiased;
    font-feature-settings: 'cv11', 'ss01';
}

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

h1,
h2,
h3 {
    margin: 0;
    font-weight: 650;
    letter-spacing: -0.01em;
}
h1 {
    font-size: 20px;
}
h2 {
    font-size: 15px;
}
h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    font-weight: 600;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.num,
.money {
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}
.neg {
    color: var(--neg);
}
.pos {
    color: var(--pos);
}
.muted {
    color: var(--muted);
}
.small {
    font-size: 12px;
}
.mono {
    font-family: var(--mono);
    font-size: 12.5px;
}
.nowrap {
    white-space: nowrap;
}
.grow {
    flex: 1 1 auto;
}
.hidden {
    display: none !important;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ── shell ─────────────────────────────────────────────────────────────── */

.shell {
    display: grid;
    grid-template-columns: var(--side-w) 1fr;
    min-height: 100vh;
}

.side {
    background: var(--side);
    color: var(--side-ink);
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 18px 12px 14px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 20px;
    color: var(--side-ink-strong);
    font-weight: 650;
    letter-spacing: -0.01em;
}
.brand-mark {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: var(--accent);
    display: grid;
    place-items: center;
    color: #fff;
}
.brand small {
    display: block;
    font-weight: 500;
    font-size: 11px;
    color: var(--side-ink);
    letter-spacing: 0.02em;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    color: var(--side-ink);
    font-weight: 500;
    position: relative;
}
.nav a:hover {
    background: var(--side-2);
    color: var(--side-ink-strong);
    text-decoration: none;
}
.nav a[aria-current='page'] {
    background: var(--side-2);
    color: var(--side-ink-strong);
}
.nav a[aria-current='page']::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 7px;
    bottom: 7px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
}
.nav svg {
    width: 16px;
    height: 16px;
    flex: none;
    opacity: 0.85;
}
.nav .count {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    background: var(--accent);
    color: #fff;
    border-radius: 10px;
    padding: 0 7px;
    line-height: 18px;
    font-variant-numeric: tabular-nums;
}

.side-foot {
    margin-top: auto;
    border-top: 1px solid var(--side-2);
    padding: 12px 8px 0;
    font-size: 12px;
}
.side-foot .who {
    color: var(--side-ink-strong);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.side-foot button {
    background: none;
    border: 0;
    color: var(--side-ink);
    padding: 4px 0 0;
    cursor: pointer;
    font: inherit;
}
.side-foot button:hover {
    color: var(--side-ink-strong);
}

.topbar,
.scrim {
    display: none;
}

.main {
    min-width: 0;
    padding: 24px 32px 64px;
    max-width: 1440px;
    width: 100%;
}

.page-head {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.page-head h1 {
    margin-right: auto;
}
.page-head .crumb {
    color: var(--muted);
    font-weight: 500;
}

@media (max-width: 860px) {
    .shell {
        grid-template-columns: 1fr;
    }
    .side {
        position: fixed;
        inset: 0 auto 0 0;
        width: 240px;
        z-index: 40;
        transform: translateX(-100%);
        transition: transform 0.18s ease;
    }
    .shell.nav-open .side {
        transform: none;
        box-shadow: var(--shadow-pop);
    }
    .scrim {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.35);
        z-index: 30;
        display: none;
    }
    .shell.nav-open .scrim {
        display: block;
    }
    .topbar {
        display: flex;
        align-items: center;
        gap: 10px;
        position: sticky;
        top: 0;
        z-index: 20;
        background: var(--side);
        color: var(--side-ink-strong);
        padding: 10px 16px;
        font-weight: 650;
    }
    .topbar button {
        background: none;
        border: 0;
        color: inherit;
        padding: 4px;
        display: grid;
        cursor: pointer;
    }
    .main {
        padding: 16px 16px 48px;
    }
}

/* ── controls ──────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink);
    font: 500 13px/1 var(--font);
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover {
    background: var(--surface-2);
    text-decoration: none;
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
}
.btn.primary:hover:not(:disabled) {
    background: var(--accent-hover);
}
.btn.danger {
    color: var(--neg);
}
.btn.danger.solid {
    background: var(--neg);
    border-color: var(--neg);
    color: #fff;
}
.btn.ghost {
    border-color: transparent;
    background: transparent;
    color: var(--ink-2);
}
.btn.ghost:hover:not(:disabled) {
    background: var(--surface-3);
}
.btn.sm {
    height: 26px;
    padding: 0 8px;
    font-size: 12px;
}
.btn.link {
    border: 0;
    background: none;
    color: var(--accent);
    padding: 0;
    height: auto;
}
.btn.link:hover {
    text-decoration: underline;
    background: none;
}
.btn .spin {
    width: 12px;
    height: 12px;
}

input,
select,
textarea {
    font: 13px/1.3 var(--font);
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    height: 32px;
    padding: 0 9px;
    min-width: 0;
}
textarea {
    height: auto;
    padding: 7px 9px;
    resize: vertical;
}
select {
    padding-right: 4px;
}
input[type='checkbox'],
input[type='radio'] {
    height: auto;
    width: 15px;
    height: 15px;
    accent-color: var(--accent);
    margin: 0;
    vertical-align: middle;
}
input[type='file'] {
    padding: 5px 6px;
    height: auto;
}
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
input.money-in {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
input:invalid,
.invalid {
    border-color: var(--neg);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.field > span {
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
}
.field.check {
    flex-direction: row;
    align-items: center;
    gap: 7px;
}
.field.check > span {
    color: var(--ink-2);
    font-size: 13px;
}
.hint {
    font-size: 12px;
    color: var(--muted);
}

.row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
}
.row.center {
    align-items: center;
}
.stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.grid-form {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.grid-form .wide {
    grid-column: 1 / -1;
}

.seg {
    display: inline-flex;
    background: var(--surface-3);
    border-radius: var(--radius-sm);
    padding: 2px;
    gap: 2px;
    flex-wrap: wrap;
}
.seg button {
    border: 0;
    background: none;
    height: 28px;
    padding: 0 11px;
    border-radius: 5px;
    font: 500 12.5px var(--font);
    color: var(--ink-2);
    cursor: pointer;
}
.seg button:hover {
    color: var(--ink);
}
.seg button[aria-pressed='true'] {
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow);
}

.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 18px;
    overflow-x: auto;
    scrollbar-width: none;
}
.tabs a,
.tabs button {
    border: 0;
    background: none;
    font: 500 13px var(--font);
    color: var(--muted);
    padding: 9px 12px;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    white-space: nowrap;
}
.tabs a:hover,
.tabs button:hover {
    color: var(--ink);
    text-decoration: none;
}
.tabs [aria-selected='true'] {
    color: var(--ink);
    border-bottom-color: var(--accent);
}

/* ── surfaces ──────────────────────────────────────────────────────────── */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-pad {
    padding: 16px 18px;
}
.card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
.card-head h2 {
    margin-right: auto;
}
.section {
    margin-bottom: 20px;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 12px;
}
.toolbar select {
    max-width: 240px;
}
.toolbar input[type='search'] {
    width: 180px;
}
.toolbar .spacer {
    flex: 1 1 auto;
}

.bulkbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--accent-soft);
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    flex-wrap: wrap;
}

/* ── tables ────────────────────────────────────────────────────────────── */

.table-wrap {
    overflow: auto;
    max-height: calc(100vh - 230px);
    min-height: 0;
}
.table-wrap.free {
    max-height: none;
}

table.t {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}
.t th,
.t td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}
.t thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface-2);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    border-bottom: 1px solid var(--line-strong);
}
.t th.num,
.t td.num {
    text-align: right;
}
.t tbody tr:hover > td {
    background: var(--surface-2);
}
.t tbody tr.selected > td {
    background: var(--accent-soft);
}
.t tfoot td {
    font-weight: 650;
    background: var(--surface-2);
    position: sticky;
    bottom: 0;
    border-top: 1px solid var(--line-strong);
}
.t td.desc {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.t td.actions {
    white-space: nowrap;
    text-align: right;
}
.t td.actions .btn + .btn {
    margin-left: 4px;
}
.t .chk {
    width: 32px;
    padding-right: 0;
}
.t tr.clickable {
    cursor: pointer;
}
.t tr.leaving > td {
    opacity: 0.35;
    transition: opacity 0.25s;
}
.t td select {
    height: 28px;
    width: 100%;
    max-width: 230px;
}
.t td.nowrap select {
    width: calc(100% - 44px);
}
.t td select.suggested {
    border-color: var(--accent);
    background-color: var(--accent-soft);
}

/* a small disclosure menu for secondary row actions */
.menu {
    position: relative;
    display: inline-block;
    margin-left: 4px;
}
.menu > summary {
    list-style: none;
    cursor: pointer;
}
.menu > summary::-webkit-details-marker {
    display: none;
}
.menu-pop {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 170px;
    padding: 4px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.menu-pop .btn {
    justify-content: flex-start;
    text-align: left;
}
.t td.actions .menu-pop .btn + .btn {
    margin-left: 0;
}
.t td input {
    height: 28px;
}
.t tr.detail > td {
    background: var(--surface-2);
    padding: 10px 14px 14px 40px;
}
.t tr.detail:hover > td {
    background: var(--surface-2);
}

.caret {
    display: inline-block;
    width: 14px;
    color: var(--faint);
    transition: transform 0.15s;
}
tr[aria-expanded='true'] .caret {
    transform: rotate(90deg);
}

/* Financial statements */
.statement {
    font-size: 13px;
}
.statement thead th {
    text-align: right;
    white-space: normal;
    vertical-align: bottom;
    min-width: 96px;
}
.statement td:first-child {
    min-width: 220px;
}
.statement td.num {
    width: 1%;
}
.statement thead th:first-child {
    text-align: left;
}
.statement td {
    border-bottom-color: transparent;
    padding-top: 5px;
    padding-bottom: 5px;
}
.statement tr.sec > td {
    padding-top: 16px;
    font-weight: 650;
    color: var(--ink);
    border-bottom: 1px solid var(--line);
}
.statement tr.acct > td:first-child {
    padding-left: 26px;
}
.statement tr.acct > td:first-child a {
    color: var(--ink-2);
}
.statement tr.acct > td:first-child a:hover {
    color: var(--accent);
}
.statement tr.subtotal > td {
    font-weight: 600;
    border-top: 1px solid var(--line-strong);
    border-bottom: 0;
}
.statement tr.summary > td {
    font-weight: 650;
    border-top: 1px solid var(--line-strong);
    padding-top: 9px;
    padding-bottom: 9px;
}
.statement tr.summary.key > td {
    font-size: 14px;
    border-top: 2px solid var(--ink);
    border-bottom: 3px double var(--ink);
    background: var(--surface-2);
}
.statement tr.summary.pct > td {
    font-weight: 500;
    color: var(--muted);
    border-top: 0;
}

/* ── badges & chips ────────────────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    padding: 0 7px;
    border-radius: 9px;
    background: var(--surface-3);
    color: var(--ink-2);
    white-space: nowrap;
    letter-spacing: 0.01em;
}
.badge.accent {
    background: var(--accent-soft);
    color: var(--accent);
}
.badge.pos {
    background: var(--pos-soft);
    color: var(--pos);
}
.badge.neg {
    background: var(--neg-soft);
    color: var(--neg);
}
.badge.warn {
    background: var(--warn-soft);
    color: var(--warn);
}

.chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.chip {
    display: inline-flex;
    gap: 6px;
    align-items: baseline;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--line);
    font-size: 12px;
    color: var(--muted);
}
.chip b {
    color: var(--ink);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}
.chip.neg b {
    color: var(--neg);
}
.chip.warn b {
    color: var(--warn);
}

.callout {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--line);
    font-size: 13px;
}
.callout.neg {
    background: var(--neg-soft);
    border-color: transparent;
    color: var(--neg);
}
.callout.warn {
    background: var(--warn-soft);
    border-color: transparent;
    color: var(--warn);
}
.callout.pos {
    background: var(--pos-soft);
    border-color: transparent;
    color: var(--pos);
}

/* ── states ────────────────────────────────────────────────────────────── */

.empty {
    padding: 48px 20px;
    text-align: center;
    color: var(--muted);
}
.empty strong {
    display: block;
    color: var(--ink);
    font-size: 15px;
    margin-bottom: 4px;
}
.empty .glyph {
    width: 36px;
    height: 36px;
    margin: 0 auto 12px;
    color: var(--faint);
}

.loading {
    padding: 32px;
    display: flex;
    justify-content: center;
    color: var(--muted);
    gap: 10px;
    align-items: center;
}
.spin {
    width: 16px;
    height: 16px;
    border: 2px solid var(--line-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
.skeleton {
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3));
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
}
@keyframes shimmer {
    to {
        background-position: -200% 0;
    }
}

/* ── dashboard ─────────────────────────────────────────────────────────── */

.kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}
.kpi {
    padding: 14px 16px;
}
.kpi .label {
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
}
.kpi .value {
    font-size: 24px;
    font-weight: 650;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    margin: 4px 0 2px;
    white-space: nowrap;
}
.kpi .sub {
    font-size: 12px;
    color: var(--muted);
}
.dash-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 12px;
    align-items: start;
}
.dash-side {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.list-plain {
    list-style: none;
    margin: 0;
    padding: 0;
}
.list-plain li {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid var(--line);
}
.list-plain li:last-child {
    border-bottom: 0;
}
.list-plain li.total {
    font-weight: 650;
    border-top: 1px solid var(--line-strong);
}
.stat-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.stat-split .value {
    font-size: 18px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}
.review-cta {
    display: flex;
    align-items: center;
    gap: 14px;
}
.review-cta .big {
    font-size: 30px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.chart {
    width: 100%;
    height: auto;
    display: block;
}
.chart text {
    font: 11px var(--font);
    fill: var(--muted);
    font-variant-numeric: tabular-nums;
}
.chart .grid {
    stroke: var(--line);
}
.chart .zero {
    stroke: var(--line-strong);
}
.chart .bar {
    fill: var(--accent);
    opacity: 0.22;
}
.chart .bar:hover {
    opacity: 0.4;
}
.chart .line {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
    stroke-linejoin: round;
}
.chart .dot {
    fill: var(--surface);
    stroke: var(--accent);
    stroke-width: 2;
}
.chart .dot.neg {
    stroke: var(--neg);
}
.legend {
    display: flex;
    gap: 14px;
    font-size: 12px;
    color: var(--muted);
}
.legend i {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-right: 5px;
    vertical-align: -1px;
}

@media (max-width: 1100px) {
    .kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .dash-grid {
        grid-template-columns: 1fr;
    }
}

/* ── reconcile ─────────────────────────────────────────────────────────── */

.recon-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr)) minmax(180px, 1.3fr);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 14px;
}
.recon-strip > div {
    padding: 12px 14px;
    border-right: 1px solid var(--line);
}
.recon-strip > div:last-child {
    border-right: 0;
}
.recon-strip .label {
    font-size: 11.5px;
    color: var(--muted);
    font-weight: 500;
}
.recon-strip .value {
    font-size: 16px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    margin-top: 2px;
    white-space: nowrap;
}
.recon-diff {
    background: var(--neg-soft);
    color: var(--neg);
    transition: background 0.2s, color 0.2s;
}
.recon-diff .label {
    color: inherit !important;
    opacity: 0.85;
    font-weight: 650 !important;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.recon-diff .value {
    font-size: 24px !important;
    font-weight: 700 !important;
    letter-spacing: -0.02em;
}
.recon-diff.zero {
    background: var(--pos-soft);
    color: var(--pos);
}

@media (max-width: 1100px) {
    .recon-strip {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .recon-strip > div {
        border-bottom: 1px solid var(--line);
    }
}
@media (max-width: 560px) {
    .recon-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .recon-diff {
        grid-column: 1 / -1;
    }
}

/* ── journal entry form ────────────────────────────────────────────────── */

.je-lines td {
    padding: 4px 6px;
    border-bottom: 0;
}
.je-lines td select,
.je-lines td input {
    width: 100%;
    max-width: none;
    height: 32px;
}
.je-lines .acct-col {
    width: 36%;
}
.je-lines .amt-col {
    width: 14%;
}
.je-total {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 10px 6px 0;
    border-top: 1px solid var(--line);
    margin-top: 6px;
}
.je-total .sum {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

/* ── diff (audit) ──────────────────────────────────────────────────────── */

.diff {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    font-family: var(--mono);
}
.diff td,
.diff th {
    padding: 3px 8px;
    vertical-align: top;
    border-bottom: 1px solid var(--line);
    text-align: left;
    word-break: break-word;
}
.diff th {
    font-family: var(--font);
    color: var(--muted);
    font-weight: 600;
    font-size: 11px;
}
.diff tr.changed td.before {
    background: var(--neg-soft);
}
.diff tr.changed td.after {
    background: var(--pos-soft);
}
.diff td.key {
    color: var(--muted);
    white-space: nowrap;
}

/* ── token reveal ──────────────────────────────────────────────────────── */

.secret {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    padding: 12px;
    border-radius: var(--radius-sm);
    background: var(--warn-soft);
    border: 1px solid transparent;
}
.secret code {
    font-family: var(--mono);
    font-size: 13px;
    background: var(--surface);
    padding: 6px 8px;
    border-radius: 5px;
    word-break: break-all;
    flex: 1 1 260px;
    user-select: all;
}

/* ── dialogs & toasts ──────────────────────────────────────────────────── */

dialog {
    border: 0;
    padding: 0;
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-pop);
    width: min(520px, calc(100vw - 24px));
    max-height: calc(100vh - 48px);
}
dialog.wide {
    width: min(860px, calc(100vw - 24px));
}
dialog::backdrop {
    background: rgba(13, 15, 19, 0.45);
}
dialog[open] {
    animation: pop 0.14s ease-out;
}
@keyframes pop {
    from {
        transform: translateY(6px) scale(0.99);
        opacity: 0;
    }
}
.dlg {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 48px);
}
.dlg-head {
    padding: 16px 20px 0;
}
.dlg-head p {
    margin: 6px 0 0;
    color: var(--muted);
}
.dlg-body {
    padding: 14px 20px;
    overflow: auto;
}
.dlg-foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px 16px;
    border-top: 1px solid var(--line);
    background: var(--surface-2);
    flex-wrap: wrap;
}
.dlg-foot .left {
    margin-right: auto;
    align-self: center;
}

.toasts {
    position: fixed;
    right: 16px;
    bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
    max-width: min(420px, calc(100vw - 32px));
}
.toast {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: var(--side);
    color: #f2f4f7;
    border-radius: var(--radius);
    padding: 10px 12px 10px 14px;
    box-shadow: var(--shadow-pop);
    font-size: 13px;
    animation: toast-in 0.18s ease-out;
    border-left: 3px solid var(--pos);
}
.toast.error {
    border-left-color: var(--neg);
}
.toast.warn {
    border-left-color: var(--warn);
}
.toast .msg {
    flex: 1;
    word-break: break-word;
}
.toast button {
    background: none;
    border: 0;
    color: #a6adba;
    cursor: pointer;
    padding: 0 2px;
    font-size: 16px;
    line-height: 1;
}
@keyframes toast-in {
    from {
        transform: translateY(8px);
        opacity: 0;
    }
}

/* ── login ─────────────────────────────────────────────────────────────── */

.login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 16px;
    background:
        radial-gradient(1200px 600px at 10% -10%, var(--accent-soft), transparent 60%),
        var(--bg);
}
.login .card {
    width: min(380px, 100%);
    padding: 28px;
}
.login .brand {
    color: var(--ink);
    padding: 0 0 22px;
}
.login .brand small {
    color: var(--muted);
}
.login form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.login input {
    height: 38px;
    font-size: 14px;
}
.login .btn {
    height: 38px;
    font-size: 14px;
}

/* ── responsive tables ─────────────────────────────────────────────────── */

@media (max-width: 860px) {
    .table-wrap {
        max-height: none;
    }
    .t td.desc {
        max-width: 200px;
    }
    .hide-sm {
        display: none;
    }
    .kpi .value {
        font-size: 20px;
    }
    .toolbar > .field {
        flex: 1 1 140px;
    }
    .toolbar > .field input,
    .toolbar > .field select {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}
