:root {
    --ink: #0b2e6b;
    --muted: #3d5278;
    --line: #c5d0e0;
    --bg: #f7f8fa;
    --card: #ffffff;
    --nav: #0b2e6b;
    --nav-text: #ffffff;
    --accent: #0b2e6b;
    --yellow: #e0a800;
    --pos: #166534;
    --neg: #c40000;
    --danger: #b91c1c;
    --shadow: 0 10px 28px rgba(11, 46, 107, 0.06);
    --sans: "Segoe UI", "Myanmar Text", "Noto Sans Myanmar", "Pyidaungsu", "Myanmar MN", "Padauk", "Helvetica Neue", Arial, sans-serif;
    --mono: "Segoe UI", "Myanmar Text", "Noto Sans Myanmar", "Pyidaungsu", "Myanmar MN", "Padauk", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    min-height: 100vh;
    color: var(--ink);
    background: var(--bg);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.45;
}
body:not(.auth-body) {
    height: 100vh;
    overflow: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
h2 { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }

.skip {
    position: absolute;
    left: 12px;
    top: -40px;
    background: #fff;
    padding: 8px 12px;
    z-index: 20;
}
.skip:focus { top: 12px; }

.app { display: flex; height: 100vh; min-height: 0; overflow: hidden; }
.sidebar {
    width: 210px;
    flex: 0 0 210px;
    height: 100vh;
    overflow: auto;
    background: var(--nav);
    color: var(--nav-text);
    display: flex;
    flex-direction: column;
    padding: 22px 14px 16px;
    transition: width 0.16s ease, flex-basis 0.16s ease, padding 0.16s ease;
}
body.nav-hidden .sidebar {
    width: 0;
    flex: 0 0 0;
    min-width: 0;
    padding-left: 0;
    padding-right: 0;
    overflow: hidden;
    border: 0;
}
.brand {
    color: #fff;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 2px 10px 16px;
    text-decoration: none;
    border-bottom: 2px solid var(--yellow);
    margin-bottom: 14px;
}
.brand:hover { text-decoration: none; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .user-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--nav-text);
    text-decoration: none;
    padding: 9px 12px;
    border-radius: 8px;
}
.icon {
    width: 1.1em;
    font-size: 14px;
    line-height: 1;
    text-align: center;
    flex: 0 0 auto;
}
.nav a:hover, .user-link:hover { background: rgba(255,255,255,0.08); text-decoration: none; }
.nav a.active, .user-link.active { background: var(--yellow); color: #0b2e6b; }
.side-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.12); }
.logout {
    margin-top: 8px;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.18);
    color: #fff;
    border-radius: 6px;
    min-height: 36px;
    padding: 0 10px;
    cursor: pointer;
}
.logout:hover { background: rgba(255,255,255,0.08); color: #fff; }

.main { flex: 1; min-width: 0; min-height: 0; height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 28px 12px;
    background: #fff;
    border-bottom: 2px solid var(--yellow);
}
.topbar-title p { color: var(--muted); margin-top: 2px; font-size: 13px; }
.today { margin-left: auto; color: var(--muted); font-size: 13px; white-space: nowrap; }
.nav-toggle {
    display: inline-flex;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 8px;
    width: 38px;
    height: 38px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: var(--ink);
    flex: 0 0 auto;
}
.nav-toggle:hover { background: #fafaf9; }
.nav-backdrop { display: none; }
.content {
    flex: 1;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    padding: 16px 28px 18px;
}
body.page-account .content,
body.page-statement .content,
body.page-dashboard .content { overflow: auto; }

.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 16px;
    margin-bottom: 14px;
}
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.panel-head p { color: var(--muted); font-size: 13px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    box-shadow: 0 1px 0 rgba(28, 25, 23, 0.04);
}
.btn:hover { text-decoration: none; background: #eff6ff; border-color: #93c5fd; }
.btn:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }
.btn:active { transform: translateY(1px); }
.btn .icon { font-size: 13px; width: 1em; }
.btn-primary {
    background: var(--accent);
    border-color: #071f4d;
    color: #fff;
    box-shadow: 0 1px 1px rgba(29, 78, 216, 0.28);
}
.btn-primary:hover { background: #071f4d; border-color: #0b2e6b; color: #fff; }
.btn-ghost { background: #fff; color: #0b2e6b; border-color: #93c5fd; }
.btn-danger { background: #fff; color: var(--danger); border-color: #f3c0c0; }
.btn-danger:hover { background: #fef2f2; border-color: #e11d48; color: #9f1239; }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 13px; border-radius: 5px; }
.btn-block { width: 100%; min-height: 42px; }
.btn:disabled, .btn:disabled:hover {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; align-items: end; }
.filters-card { flex: 0 0 auto; margin-bottom: 12px; }
.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.filters-card.is-collapsed .filter-body { display: none; }
.filters-card.is-collapsed .filter-bar { margin-bottom: 0; }
.filters-card .actions-field { grid-column: 1 / -1; }
.filters-card .actions { flex-wrap: wrap; justify-content: flex-start; }
.range-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.toolbar { flex: 0 0 auto; }
body.page-banks .content > .panel:not(.form-sheet) {
    flex: 0 0 auto;
    overflow: visible;
    display: block;
    margin-bottom: 0;
    padding: 0;
}
body.page-banks .content > .panel.form-sheet {
    flex: 0 0 auto;
    align-self: flex-start;
    width: min(640px, 100%);
    overflow: visible;
    margin-bottom: 0;
    padding: 14px 16px 12px;
}
body.page-banks .content > .panel > .table-wrap,
body.page-history .content > .table-wrap {
    flex: 0 0 auto;
    min-height: 0;
    overflow: auto;
    margin-bottom: 0;
}
body.page-history .toolbar,
body.page-history .count-line,
body.page-history .pager { flex: 0 0 auto; }
table.grid.ledger {
    width: 100%;
    table-layout: fixed;
    border: 1px solid #0b2e6b;
}
table.ledger.customers th:nth-child(1) { width: 22%; }
table.ledger.customers th:nth-child(2) { width: 16%; }
table.ledger.customers th:nth-child(6) { width: 22%; }
table.ledger.lines th:nth-child(1) { width: 16%; }
table.ledger.lines th:nth-child(4) { width: 28%; }
table.ledger.lines th:nth-child(6) { width: 16%; }
table.ledger.daybook th:nth-child(1) { width: 12%; }
table.ledger.daybook th:nth-child(5) { width: 72px; }
table.ledger td { overflow: hidden; text-overflow: ellipsis; }
table.ledger td.row-actions,
table.ledger td.num,
table.ledger td.when { overflow: visible; }
body.page-transactions .cash-split {
    flex: 0 0 auto;
    align-items: start;
}
body.page-transactions .cash-split > section {
    min-height: 0;
    overflow: visible;
    display: flex;
    flex-direction: column;
}
body.page-transactions .cash-split > section:first-child {
    height: auto;
    overflow: visible;
}
body.page-transactions .cash-split > section:first-child > form.cash-box {
    flex: 0 0 auto;
    max-height: none;
    height: auto;
    overflow: visible;
}
body.page-transactions .cash-split > section:first-child > .panel:not(.cash-box) {
    flex: 0 0 auto;
    max-height: none;
    overflow: visible;
    display: block;
}
body.page-transactions .cash-split > section:first-child > .panel .table-wrap {
    overflow: auto;
}
body.page-transactions table.balance th,
body.page-transactions table.balance td {
    padding: 8px 10px;
    font-size: 15px;
}
body.page-transactions .cash-split > section:last-child .balance-sheet {
    flex: 0 0 auto;
    display: block;
}
body.page-transactions .cash-split .balance-sheet .table-wrap {
    overflow: auto;
    background: #fff;
    border: 1px solid #1c1917;
}
.chip {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 999px;
    min-height: 32px;
    padding: 0 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}
.chip:hover { border-color: #93c5fd; background: #eff6ff; }
.chip:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }
.chip.is-on, .chip.is-on:hover { background: var(--yellow); border-color: #b8860b; color: #0b2e6b; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span, .check { font-size: 13px; color: var(--muted); }
.field input, .field select, .field textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 8px;
    padding: 8px 10px;
    min-height: 36px;
    font-size: 16px;
}
.field textarea { min-height: 72px; resize: vertical; }
input[type="color"] { width: 42px; min-height: 32px; padding: 2px; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: 2px solid #bfdbfe;
    border-color: var(--accent);
}
.actions { display: flex; gap: 8px; }
.stack-fields { display: flex; flex-direction: column; gap: 8px; }
.form-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { color: var(--muted); font-size: 13px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.check input { width: auto; }

table.grid {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-variant-numeric: tabular-nums;
}
table.grid th, table.grid td {
    border: 1px solid var(--line);
    padding: 7px 9px;
    vertical-align: top;
    font-size: 14px;
}
table.grid th {
    background: #0b2e6b;
    color: #fff;
    border-color: #071f4d;
    font-weight: 650;
    text-align: center;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 12px;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
}
table.grid td { vertical-align: middle; }
table.grid td.num, table.grid th.num { text-align: right; white-space: nowrap; }
table.grid td.when { white-space: nowrap; }
table.grid tfoot td { font-weight: 650; background: #eff6ff; }
table.grid tr.opening td { background: #eff6ff; }
table.grid a { color: inherit; }
table.grid a:hover { color: var(--accent); }
.pos { color: var(--ink); }
.neg { color: var(--neg); }
.empty { color: var(--muted); padding: 18px 4px; }
.table-wrap { overflow: auto; min-width: 0; }
.bank-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bank-cell span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.logo-sm { width: 22px; height: 22px; object-fit: contain; border: 1px solid var(--line); background: #fff; flex: 0 0 auto; }
td.row-actions { white-space: nowrap; text-align: right; }
td.row-actions .btn { margin-left: 6px; }
td.row-actions .inline-form { display: inline-flex; vertical-align: middle; }
.inline-form { display: inline-flex; margin: 0; }
.count-line { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.history-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    flex: 0 0 auto;
}
.history-bar .count-line { margin: 0; }
.history-bar .toolbar { margin-left: auto; }
.history-note { background: #fff; border: 1px solid #d7deea; border-radius: 8px; padding: 16px 18px; }
.history-note h2 { margin: 0 0 14px; color: #0b2e6b; font-size: 1.15rem; }
.history-group { margin: 0 0 16px; }
.history-group h3 { margin: 0 0 4px; font-size: 1rem; }
.history-lines { list-style: none; margin: 0; padding: 0; }
.history-lines li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 3px 0; }
.history-lines .line-text { font-variant-numeric: tabular-nums; }
.history-total { margin: 4px 0 0; font-weight: 700; font-size: 1.05rem; }
.history-sheet {
    flex: 0 0 auto;
    min-height: 0;
    overflow: auto;
    margin: 0;
    background: #fff;
    border: 1px solid var(--line);
    border-top: 3px solid var(--yellow);
    border-radius: 12px;
    box-shadow: var(--shadow);
}
.filters-fit .filters {
    grid-template-columns: 148px 148px minmax(140px, 1fr) 132px minmax(150px, 1.1fr) auto;
}
.filters-fit .actions-field { grid-column: auto; }
.filters-fit .actions-field > span { display: none; }
.type-pill {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.type-pill.pos { background: #e8eef8; color: #0b2e6b; }
.type-pill.neg { background: #fde8e8; color: #c40000; }
table.ledger.lines td:nth-child(4) {
    overflow: visible;
    white-space: normal;
    text-overflow: clip;
}

.sheet { background: #fff; border: 1px solid var(--line); margin: 0 0 18px; }
.sheet-head { padding: 14px 14px 8px; }
.sheet-head h2 { font-size: 18px; }
.sheet-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: 13px; margin-top: 4px; }
.sheet table.grid { border: 0; }
.sheet table.grid th, .sheet table.grid td { border-color: #a8a29e; }
.summary-line { margin: 0 0 14px; color: var(--muted); }

.alert { border: 1px solid; border-radius: 4px; padding: 10px 12px; margin-bottom: 12px; }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.alert-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert ul { margin: 0; padding-left: 18px; }

.pager { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.pager a, .pager .current {
    min-width: 32px;
    text-align: center;
    border: 1px solid var(--line);
    background: #fff;
    padding: 5px 8px;
    border-radius: 4px;
    color: var(--ink);
    text-decoration: none;
}
.pager .current { background: #0b2e6b; color: #fff; border-color: #0b2e6b; }

.print-head, .signatures { display: none; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 22px; height: 22px; border: 1px solid var(--line); border-radius: 50%; cursor: pointer; padding: 0; }
.swatch.active { outline: 2px solid var(--ink); outline-offset: 2px; }
.logo-preview, .current-logo { max-width: 72px; max-height: 36px; object-fit: contain; }
.mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    color: #fff;
    font-size: 13px;
    font-weight: 650;
    overflow: hidden;
    object-fit: contain;
    background: #e7e5e4;
    flex: 0 0 auto;
}
.mark-sm { width: 20px; height: 20px; font-size: 11px; }
.mark-lg { width: 40px; height: 40px; font-size: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.cash-box {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    min-height: 0;
}
.cash-box > h2 { padding: 14px 14px 0; flex: 0 0 auto; }
.cash-box > .alert { margin: 10px 14px 0; flex: 0 0 auto; }
.cash-box-scroll {
    overflow: visible;
    padding: 12px 14px 0;
    flex: 0 0 auto;
}
.cash-box .form-actions {
    margin: 0;
    padding: 12px 14px 14px;
    background: #fff;
    flex: 0 0 auto;
}
.type-row { display: flex; gap: 16px; min-height: 36px; align-items: center; }
.type-row label { display: flex; align-items: center; gap: 6px; }
.logo-row { display: flex; align-items: center; gap: 12px; }
.narrow { max-width: 480px; }
.form-sheet { max-width: 640px; }
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.photo-upload {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px dashed #a8a29e;
    border-radius: 8px;
    background: #fafaf9;
    padding: 12px;
    cursor: pointer;
}
.photo-upload:hover { border-color: var(--accent); background: #f8fafc; }
.photo-upload:focus-within { border-color: var(--accent); outline: 2px solid #93c5fd; outline-offset: 2px; }
.photo-frame {
    width: 72px;
    height: 72px;
    flex: 0 0 72px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.photo-frame .mark,
.photo-preview {
    width: 72px;
    height: 72px;
    border-radius: 0;
    object-fit: contain;
}
.photo-icon {
    color: #5c6f8f;
    font-size: 22px;
    line-height: 1;
}
.photo-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.photo-copy strong { font-size: 15px; }
.photo-copy small { color: var(--muted); font-size: 13px; word-break: break-word; }
.entry-form .bank-transfer { display: none; }
.entry-form.is-transfer .bank-single { display: none; }
.entry-form.is-transfer .bank-transfer { display: block; }
.bank-transfer .hint { margin: 6px 0 0; }

.page-split { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 14px; align-items: start; }
.cash-split { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 14px; align-items: start; }
.cash-split > section { min-width: 0; }
.day-nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.day-nav .field { margin: 0; min-width: 150px; }
.sheet-meta { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.picker { position: relative; }
.picker-menu {
    position: absolute;
    z-index: 8;
    left: 0;
    right: 0;
    top: 100%;
    max-height: 220px;
    overflow: auto;
    margin: 2px 0 0;
    padding: 4px;
    list-style: none;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}
.picker-menu button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
    border-radius: 4px;
    padding: 8px 10px;
    cursor: pointer;
}
.picker-menu button:hover,
.picker-menu button.is-active { background: var(--yellow); color: #0b2e6b; }
.balance-sheet { width: 100%; min-width: 0; }
.balance-sheet.is-screen {
    flex: 0 0 auto;
    display: block;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px 16px 12px;
    overflow: visible;
    box-shadow: var(--shadow);
}
.balance-sheet.is-screen .table-wrap {
    overflow: auto;
    background: #fff;
    border: 1px solid #0b2e6b;
}
.balance-sheet.is-screen table.balance { height: auto; }
.balance-sheet h2 { color: #0b2e6b; font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
table.grid.balance { width: 100%; table-layout: fixed; }
table.balance { border: 1px solid #0b2e6b; }
table.balance th:nth-child(1) { width: 22%; }
table.balance th:nth-child(6) { width: 14%; }
table.balance th,
table.balance td { border-color: #d5deea; padding: 12px 16px; font-size: 16px; line-height: 1.4; }
table.balance thead th {
    background: #0b2e6b;
    color: #fff;
    border-color: #071f4d;
    text-align: center;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 12px;
    position: sticky;
    top: 0;
    z-index: 2;
}
table.balance td.name {
    background: #fff;
    color: #10233f;
    font-weight: 650;
}
table.balance td.name .name-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
table.balance td.date { white-space: nowrap; text-align: center; }
table.balance tr.day-row td {
    background: #4caf50;
    color: #fff;
    font-weight: 700;
    text-align: center;
    font-size: 17px;
}
table.balance tr.day-row td.num { text-align: right; }
table.balance tr.day-row td.date { text-align: center; }
table.balance tr.day-row td.neg { color: #ffe4e4; }
table.balance tfoot tr.totals td { background: #dbeafe; font-weight: 650; }
table.balance tfoot tr.summary-row td { background: var(--yellow); font-weight: 700; }
table.balance tfoot td.summary-label { text-align: center; }
.color-row { display: flex; align-items: center; gap: 10px; }
.category-field { border: 0; margin: 0; padding: 0; }
.category-field legend { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.form-sheet .category-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.new-category { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin-top: 8px; }
.new-category input[type="text"] {
    flex: 1 1 160px;
    min-width: 0;
    min-height: 36px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 16px;
}
.color-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.color-picks label { position: relative; width: 22px; height: 22px; cursor: pointer; }
.color-picks input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}
.color-picks span {
    display: block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(11, 46, 107, 0.25);
}
.color-picks input:checked + span { box-shadow: 0 0 0 2px #0b2e6b; }
.color-picks input:focus-visible + span { outline: 2px solid #93c5fd; outline-offset: 2px; }
.color-wheel {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #0b2e6b;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
}
.color-wheel::-webkit-color-swatch-wrapper { padding: 2px; }
.color-wheel::-webkit-color-swatch { border: 0; border-radius: 50%; }
.icon-upload { display: flex; align-items: center; gap: 8px; }
.icon-upload input[type="file"] { font-size: 16px; max-width: 220px; }
.cat-badge img.cat-icon { width: 16px; height: 16px; object-fit: cover; border-radius: 3px; }
.category-choice {
    position: relative;
    display: flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 5px 8px;
    min-height: 36px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}
.category-choice:hover { border-color: #8ea2c4; }
.category-choice:focus-within,
.category-choice:has(input:checked) {
    border-color: #0b2e6b;
    box-shadow: 0 0 0 2px rgba(11, 46, 107, 0.14);
    background: #f4f7fc;
}
.cat-badge {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex: 0 0 auto;
}
.cat-badge .icon { font-size: 12px; width: auto; color: #fff; }
table.balance td.name .who { display: flex; align-items: center; gap: 8px; min-width: 0; }
table.balance td.name .who > span:last-child { overflow: hidden; text-overflow: ellipsis; }
table.balance tr.remainder-row td,
table.ledger tr.remainder-row td { background: #e8eef8; font-weight: 700; }
.dash {
    display: grid;
    grid-template-columns: minmax(180px, 220px) minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    align-content: start;
}
.dash-count {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
    min-height: 132px;
    padding: 16px;
    border-radius: 12px;
    border-top: 3px solid var(--yellow);
    background: #0b2e6b;
    color: #fff;
    box-shadow: var(--shadow);
}
.dash-count-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.14);
}
.dash-count-icon .icon { color: #fff; font-size: 15px; }
.dash-count span {
    display: block;
    color: rgba(255, 255, 255, 0.76);
    font-size: 12px;
    font-weight: 650;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.dash-count strong {
    display: block;
    margin-top: 2px;
    color: #fff;
    font-size: 36px;
    line-height: 1;
    letter-spacing: -0.04em;
}
.dash-panel {
    background: #fff;
    border: 1px solid var(--line);
    border-top: 3px solid var(--yellow);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.dash-panel header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    background: #f8fafc;
}
.dash-panel h2 {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}
.dash-panel header span,
.dash-panel header a { font-size: 13px; font-weight: 650; color: var(--muted); white-space: nowrap; }
.dash-panel header span.neg { color: var(--neg); }
.dash-panel header a:hover { color: var(--ink); }
.dash-metrics { display: grid; grid-template-columns: 1fr 1fr; }
.dash-metrics > div { min-width: 0; padding: 14px 16px 16px; }
.dash-metrics > div + div { border-left: 1px solid var(--line); }
.dash-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.stat-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex: 0 0 auto;
}
.stat-icon .icon { font-size: 13px; width: auto; color: #fff; }
.stat-icon.tone-navy { background: #0b2e6b; }
.stat-icon.tone-red { background: #c40000; }
.dash-metrics strong {
    display: block;
    margin-top: 10px;
    font-size: 24px;
    line-height: 1.1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}
.dash-list { grid-column: 1 / -1; }
.dash-list .empty { margin: 0; padding: 16px; }
.dash-table { border: 0; }
.dash-table th:first-child,
.dash-table td.name { text-align: left; }
.dash-table .who {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: inherit;
    font-weight: 650;
}
.dash-table .who:hover { color: var(--accent); text-decoration: none; }
.dash-table .who > span:last-child { overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 1180px) {
    .filters, .filters-fit .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filters-fit .actions-field { grid-column: 1 / -1; }
    .content, .topbar { padding-left: 16px; padding-right: 16px; }
    table.ledger.lines { min-width: 720px; }
    .history-bar { flex-wrap: wrap; }
}
@media (max-width: 960px) {
    .page-split, .cash-split, .dash { grid-template-columns: 1fr; }
    .dash-count { min-height: 0; flex-direction: row; align-items: center; justify-content: flex-start; gap: 14px; }
    .dash-metrics strong { font-size: 20px; }
}

@media (max-width: 640px) {
    .form-grid, .form-pair { grid-template-columns: 1fr; }
    .form-sheet .category-grid { grid-template-columns: 1fr 1fr; }
}

.auth-body { background: #dbeafe; }
.auth-box {
    width: min(420px, calc(100% - 32px));
    margin: 10vh auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 22px;
}
.auth-box h1 { margin-bottom: 4px; }
.auth-box .lede { color: var(--muted); margin-bottom: 16px; }
.setup-note { margin-top: 16px; color: var(--muted); font-size: 13px; }
.setup-note ol { padding-left: 18px; }
.setup-note code { color: var(--ink); }

@media (max-width: 860px) {
    table.grid.ledger,
    table.grid.balance { min-width: 640px; }
    h1 { font-size: 20px; }
    .balance-sheet h2 { font-size: 20px; }
    .btn { min-height: 44px; }
    .form-actions .btn { flex: 1 1 120px; }
    .filters, .filters-fit .filters { grid-template-columns: 1fr; }
    .filters-fit .actions-field { grid-column: auto; }
    .cash-split { gap: 10px; }
    #cash-form {
        max-height: none;
        height: auto;
        min-height: 0;
    }
    body.page-transactions .cash-split > section:last-child {
        max-height: none;
        overflow: visible;
    }
    table.balance th,
    table.balance td { font-size: 15px; padding: 8px 10px; }
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 30;
        width: 210px;
        flex-basis: 210px;
        padding: 22px 14px 16px;
        transform: translateX(-105%);
        transition: transform 0.15s ease;
    }
    body.nav-hidden .sidebar { width: 210px; flex-basis: 210px; padding: 22px 14px 16px; }
    .sidebar.open { transform: none; }
    .nav-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 25; }
    .today { display: none; }
    .content, .topbar { padding-left: 14px; padding-right: 14px; }
    body:not(.auth-body),
    body:not(.auth-body) .app,
    body:not(.auth-body) .main {
        height: auto;
        overflow: visible;
    }
    body:not(.auth-body) .content {
        overflow: visible;
        display: block;
    }
    .sidebar { height: 100vh; overflow: auto; }
}

@media print {
    body, body:not(.auth-body),
    body:not(.auth-body) .app,
    body:not(.auth-body) .main,
    body:not(.auth-body) .content { background: #fff; height: auto; overflow: visible; display: block; }
    .sidebar, .topbar, .no-print, .nav-backdrop, .skip { display: none !important; }
    .app, .main, .content { display: block; padding: 0; height: auto; overflow: visible; }
    .sheet, .panel { border: 0; box-shadow: none; margin: 0 0 16px; break-inside: avoid; }
    .print-head { display: block; margin-bottom: 12px; }
    .signatures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 36px; }
    .sign-line { border-top: 1px solid #000; margin-top: 36px; padding-top: 6px; font-size: 12px; }
    a { color: inherit; text-decoration: none; }
}
