:root {
    --bg: #F5F6F8;
    --surface: #ffffff;
    --surface-soft: #F5F6F8;
    --text: #182B45;
    --muted: #5B687A;
    --line: #E2E7EE;
    --primary: #0078D4;
    --primary-strong: #005A9E;
    --active-bg: #EAF3FC;
    --blue: #0078D4;
    --amber: #d97706;
    --danger: #B42332;
    --danger-bg: #FDECEE;
    --good: #008750;
    --good-bg: #EAF7EF;
    --nav: #0f172a;
    --nav-soft: #172033;
    --radius: 8px;
    --shadow: 0 3px 12px rgba(24, 43, 69, 0.04);
    --shadow-soft: 0 2px 8px rgba(24, 43, 69, 0.03);
    font-family: "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
    color: var(--text);
    background: var(--bg);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 20px 16px;
    background: var(--nav);
    color: #f8fafc;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 8px;
    border-radius: var(--radius);
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    flex: 0 0 auto;
}

.brand strong,
.brand small {
    display: block;
    line-height: 1.2;
}

.brand small {
    color: #b8c0cc;
    margin-top: 3px;
}

.nav-list {
    display: grid;
    gap: 6px;
    margin-top: 28px;
}

.nav-list a,
.mobile-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 10px 12px;
    border-radius: 8px;
    color: #d9e2ef;
    font-weight: 700;
}

.nav-list a:hover,
.nav-list a.is-active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.nav-list a.is-active {
    box-shadow: inset 3px 0 0 var(--primary);
}

.nav-list svg,
.mobile-nav svg,
.btn svg,
.icon-btn svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.main {
    min-width: 0;
    padding: 28px 32px 44px;
}

.topbar,
.toolbar,
.panel-header,
.toolbar-actions,
.table-actions,
.card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.topbar {
    margin-bottom: 20px;
    padding: 4px 0 8px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 0.86rem;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: 1.82rem;
    line-height: 1.2;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 0;
    font-size: 1.05rem;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
    border-radius: 8px;
    padding: 8px 10px 8px 12px;
}

.user-chip span,
.user-chip small {
    display: block;
}

.user-chip small {
    color: var(--muted);
}

.btn,
.icon-btn {
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    font-weight: 700;
    transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.btn {
    padding: 9px 14px;
}

.btn:hover,
.icon-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}

.btn.primary {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 10px 20px rgba(13, 148, 136, 0.18);
}

.btn.primary:hover {
    background: var(--primary-strong);
}

.btn.ghost {
    color: var(--text);
    background: rgba(255, 255, 255, 0.82);
    border-color: var(--line);
}

.btn.warning {
    color: #4b2e00;
    background: #fde68a;
}

.btn.danger,
.icon-btn.danger {
    color: #fff;
    background: var(--danger);
}

.btn.small {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 0.86rem;
}

.btn.full {
    width: 100%;
}

.icon-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    color: var(--text);
    background: var(--surface);
    border-color: var(--line);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin: 18px 0;
}

.metric-card,
.panel,
.event-card,
.resource-card,
.auth-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.metric-card {
    position: relative;
    overflow: hidden;
    padding: 18px;
    border-color: rgba(148, 163, 184, 0.32);
}

.metric-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: var(--primary);
    opacity: .78;
}

.metric-card span,
.metric-card small {
    color: var(--muted);
}

.metric-card strong {
    display: block;
    margin: 8px 0 4px;
    font-size: 1.6rem;
    line-height: 1.15;
}

.metric-card.strong {
    border-left: 0;
}

.dashboard-grid,
.split-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.dashboard-grid .wide {
    grid-column: 1 / -1;
}

.chart-box {
    position: relative;
    width: 100%;
    height: 300px;
    min-height: 260px;
    overflow: hidden;
}

.chart-box.wide {
    height: 280px;
}

.chart-box.compact {
    height: 220px;
    min-height: 200px;
}

.chart-box canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.panel {
    padding: 18px;
    border-color: rgba(148, 163, 184, 0.32);
}

.panel-header {
    margin-bottom: 14px;
}

.panel-header a {
    color: var(--primary);
    font-weight: 700;
}

.toolbar {
    flex-wrap: wrap;
    margin: 10px 0 16px;
}

.inline-form,
.grid-form,
.stack-form {
    display: grid;
    gap: 12px;
}

.inline-form {
    grid-template-columns: repeat(4, minmax(150px, auto));
    align-items: end;
}

.inline-form.filters {
    grid-template-columns: repeat(5, minmax(150px, auto));
}

.inline-form.tight {
    display: flex;
    gap: 6px;
    align-items: center;
}

.grid-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-form.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
    display: grid;
    gap: 6px;
    color: #344054;
    font-weight: 700;
    min-width: 0;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 11px;
    color: var(--text);
    background: #fff;
    box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.02);
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(15, 118, 110, 0.18);
    border-color: var(--primary);
}

.wide-field {
    grid-column: 1 / -1;
}

.check-card {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.check-card input {
    width: 18px;
    min-height: 18px;
}

.check-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    font-weight: 700;
    white-space: nowrap;
}

.check-inline input {
    width: 16px;
    min-height: 16px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 13px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0;
    background: #f8fafc;
}

td small {
    display: block;
    color: var(--muted);
    margin-top: 3px;
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 3px 8px;
    border-radius: 999px;
    color: #344054;
    background: var(--surface-soft);
    font-size: 0.82rem;
    font-weight: 800;
}

.status.closed,
.status.deleted,
.status.cancelled,
.event-card.overdue {
    color: #fff;
    background: var(--danger);
}

.status.open,
.status.done,
.status.active,
.status.receipt-ok,
.status.acknowledged,
.status.reimbursed {
    color: #fff;
    background: var(--good);
}

.status.extra-home {
    color: #fff;
    background: var(--blue);
}

.status.planned,
.status.partial,
.status.corrected,
.status.deposit,
.status.adjustment,
.status.missing-receipt,
.status.unsettled {
    color: #3f2f05;
    background: #fde68a;
}

.status.withdrawal,
.status.ignored {
    color: #fff;
    background: var(--danger);
}

.flash {
    padding: 12px 14px;
    border-radius: 8px;
    margin: 10px 0;
    border: 1px solid var(--line);
    background: var(--surface);
}

.flash.success {
    border-color: #86efac;
    background: #f0fdf4;
}

.flash.error {
    border-color: #fecaca;
    background: #fef2f2;
}

.alert-strip {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 14px;
    border-radius: 8px;
    background: #fffbeb;
    border: 1px solid #fde68a;
}

.alert-strip svg {
    color: var(--amber);
}

.alert-strip.danger {
    border-color: #fecaca;
    background: #fef2f2;
}

.alert-strip.danger svg {
    color: var(--danger);
}

.alert-strip.success {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.alert-strip.success svg {
    color: var(--good);
}

.toolbar > .inline-form,
.toolbar > .btn,
.toolbar-actions form {
    filter: drop-shadow(0 8px 16px rgba(15, 23, 42, 0.04));
}

.dashboard-grid .panel,
.split-grid .panel {
    min-width: 0;
}

.panel-header h2 {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #0f172a;
}

.panel-header small {
    color: var(--muted);
}

.table-wrap {
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: var(--radius);
    overflow: auto;
}

.table-wrap table {
    background: #fff;
}

tbody tr {
    transition: background .15s ease;
}

tbody tr:hover {
    background: #f8fafc;
}

.list-row {
    border-radius: var(--radius);
    padding: 10px 8px;
    transition: background .15s ease, transform .15s ease;
}

.list-row:hover {
    background: #f8fafc;
    transform: translateX(2px);
}

.timeline-item {
    padding: 6px 0;
}

.timeline-item > span {
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.chart-box {
    padding: 8px 4px 0;
}

.resource-card,
.event-card,
.fund-card,
.quick-card,
.attachment-tile {
    border-color: rgba(148, 163, 184, 0.32);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.resource-card:hover,
.event-card:hover,
.fund-card:hover,
.quick-card:hover,
.attachment-tile:hover {
    transform: translateY(-2px);
    border-color: rgba(13, 148, 136, 0.34);
    box-shadow: 0 20px 42px rgba(15, 23, 42, 0.10);
}

.fund-card {
    border-left: 4px solid var(--fund-color, var(--primary));
}

.fund-card-main strong {
    color: #0f172a;
}

.quick-actions {
    align-items: stretch;
}

.quick-card {
    color: #0f172a;
}

.quick-card.is-active {
    background: #ecfdf5;
}

.chip-cloud span {
    box-shadow: 0 5px 14px rgba(15, 23, 42, 0.04);
}

.empty-state {
    box-shadow: var(--shadow);
}

.list,
.timeline {
    display: grid;
    gap: 10px;
}

.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 48px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.list-row:last-child {
    border-bottom: 0;
}

.list-row small,
.muted {
    color: var(--muted);
}

.list-row.danger {
    color: var(--danger);
}

.list-row.warning {
    color: #8a5700;
}

.timeline-item {
    display: grid;
    grid-template-columns: 12px 1fr;
    gap: 12px;
}

.timeline-item > span {
    width: 10px;
    height: 10px;
    margin-top: 6px;
    border-radius: 50%;
    background: var(--blue);
}

.timeline-item small {
    display: block;
    color: var(--muted);
    margin-top: 4px;
}

pre {
    max-width: 100%;
    overflow: auto;
    padding: 12px;
    border-radius: 8px;
    background: #111827;
    color: #f8fafc;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}

.fund-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}

.resource-card,
.event-card,
.fund-card {
    padding: 16px;
}

.fund-card {
    display: grid;
    gap: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.fund-card.is-deleted,
.is-muted {
    opacity: .58;
}

.fund-card-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.fund-card-main strong,
.fund-card-main small {
    display: block;
}

.fund-card-main small {
    color: var(--muted);
    margin-top: 3px;
}

.fund-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: var(--fund-color, var(--primary));
    background: color-mix(in srgb, var(--fund-color, var(--primary)), #ffffff 86%);
    border: 1px solid color-mix(in srgb, var(--fund-color, var(--primary)), #ffffff 65%);
    flex: 0 0 auto;
}

.fund-icon svg {
    width: 23px;
    height: 23px;
}

.fund-progress {
    display: grid;
    gap: 7px;
}

.fund-progress > div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-weight: 800;
}

.fund-progress progress {
    width: 100%;
    height: 12px;
    overflow: hidden;
    border: 0;
    border-radius: 999px;
    background: var(--surface-soft);
}

.fund-progress progress::-webkit-progress-bar {
    background: var(--surface-soft);
}

.fund-progress progress::-webkit-progress-value {
    border-radius: 999px;
    background: var(--fund-color, var(--primary));
}

.fund-progress progress::-moz-progress-bar {
    border-radius: 999px;
    background: var(--fund-color, var(--primary));
}

.fund-progress.large progress {
    height: 16px;
}

.fund-hero {
    display: grid;
    gap: 14px;
    border-left: 5px solid var(--fund-color, var(--primary));
}

.resource-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.resource-card svg {
    width: 28px;
    height: 28px;
    color: var(--primary);
}

.resource-card small,
.event-card small {
    display: block;
    color: var(--muted);
    margin-top: 3px;
}

.event-card {
    display: grid;
    gap: 12px;
}

.event-card dl,
.details-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
}

dt {
    color: var(--muted);
    font-size: 0.84rem;
}

dd {
    margin: 2px 0 0;
    font-weight: 700;
}

.attachment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.attachment-tile {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.attachment-tile a {
    display: flex;
    gap: 8px;
    align-items: center;
    min-width: 0;
}

.attachment-tile span {
    overflow-wrap: anywhere;
}

.attachment-tile.is-deleted {
    opacity: .6;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    margin: 12px 0 16px;
}

.quick-card {
    min-height: 92px;
    display: grid;
    place-items: center;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    font-weight: 800;
    color: var(--text);
}

.quick-card svg {
    width: 26px;
    height: 26px;
    color: var(--primary);
}

.quick-card.is-active {
    border-color: var(--primary);
    outline: 3px solid rgba(15, 118, 110, 0.16);
}

.tab-panel {
    display: none;
}

.tab-panel.is-active {
    display: block;
}

.quick-amounts {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-amounts button {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
    min-height: 36px;
    padding: 6px 10px;
}

.inline-delete {
    display: flex;
    align-items: center;
    gap: 6px;
}

.inline-delete input {
    min-height: 34px;
    width: 120px;
}

.row-details summary {
    cursor: pointer;
    color: var(--primary);
    font-weight: 800;
}

.settlement-details {
    min-width: 260px;
}

.settlement-form {
    display: grid;
    gap: 8px;
    margin-top: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.settlement-form input,
.settlement-form select {
    min-height: 36px;
}

.chip-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip-cloud span {
    border: 1px solid color-mix(in srgb, var(--chip), #ffffff 65%);
    background: color-mix(in srgb, var(--chip), #ffffff 88%);
    color: #1f2937;
    border-radius: 999px;
    padding: 6px 10px;
    font-weight: 700;
}

.empty-state {
    min-height: 320px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 12px;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 30px;
}

.empty-state svg {
    width: 42px;
    height: 42px;
    color: var(--primary);
}

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background: #eef3f7;
}

.auth-card {
    width: min(460px, 100%);
    padding: 28px;
}

.auth-brand {
    margin-bottom: 22px;
}

.auth-switch {
    margin: 14px 0 0;
    text-align: center;
}

.auth-switch a {
    color: var(--primary);
    font-weight: 800;
}

.mobile-nav {
    display: none;
}

.text-danger {
    color: var(--danger);
    font-weight: 800;
}

.text-good {
    color: var(--good);
    font-weight: 800;
}

.danger-zone {
    border-color: #fecaca;
}

.list-row {
    border-radius: var(--radius);
    padding: 10px 8px;
    transition: background .15s ease, transform .15s ease;
}

.list-row:hover {
    background: #f8fafc;
    transform: translateX(2px);
}

.resource-card,
.event-card,
.fund-card,
.quick-card,
.attachment-tile {
    border-color: rgba(148, 163, 184, 0.32);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.resource-card:hover,
.event-card:hover,
.fund-card:hover,
.quick-card:hover,
.attachment-tile:hover {
    transform: translateY(-2px);
    border-color: rgba(13, 148, 136, 0.34);
    box-shadow: 0 20px 42px rgba(15, 23, 42, 0.10);
}

.fund-card {
    border-left: 4px solid var(--fund-color, var(--primary));
}

.quick-card {
    color: #0f172a;
}

.quick-card.is-active {
    background: #ecfdf5;
}

@media (max-width: 1100px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .main {
        padding: 18px 16px 92px;
    }

    .metric-grid,
    .dashboard-grid,
    .split-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mobile-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 50;
        display: flex;
        gap: 0;
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        background: rgba(15, 23, 42, 0.94);
        border-top: 1px solid rgba(255, 255, 255, 0.10);
        box-shadow: 0 -18px 36px rgba(15, 23, 42, 0.22);
        backdrop-filter: blur(14px);
        padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    }

    .mobile-nav::-webkit-scrollbar {
        display: none;
    }

    .mobile-nav a {
        flex: 0 0 76px;
        min-height: 58px;
        padding: 6px 4px;
        display: grid;
        place-items: center;
        gap: 2px;
        color: #cbd5e1;
        font-size: 0.72rem;
        text-align: center;
    }

    .mobile-nav a.is-active {
        color: #fff;
        background: rgba(13, 148, 136, 0.25);
        box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.22);
    }
}

@media (max-width: 760px) {
    .topbar {
        align-items: flex-start;
    }

    .user-chip {
        padding: 7px;
    }

    .user-chip > span,
    .user-chip > small {
        display: none;
    }

    h1 {
        font-size: 1.35rem;
    }

    .metric-grid,
    .dashboard-grid,
    .split-grid,
    .grid-form,
    .grid-form.compact,
    .quick-actions,
    .event-card dl,
    .details-grid {
        grid-template-columns: 1fr;
    }

    .quick-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .quick-card {
        min-height: 74px;
    }

    .inline-form,
    .inline-form.filters {
        width: 100%;
        grid-template-columns: 1fr;
    }

    .toolbar,
    .toolbar-actions {
        align-items: stretch;
    }

    .toolbar > .btn,
    .toolbar-actions,
    .toolbar-actions .btn,
    .toolbar-actions form {
        width: 100%;
    }

    .panel {
        padding: 14px;
    }

    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
    }

    thead {
        display: none;
    }

    tr {
        padding: 12px 0;
        border-bottom: 1px solid var(--line);
    }

    td {
        display: flex;
        justify-content: space-between;
        gap: 16px;
        border-bottom: 0;
        padding: 7px 0;
    }

    td::before {
        content: attr(data-label);
        color: var(--muted);
        font-weight: 800;
        flex: 0 0 110px;
    }

    .table-actions,
    .inline-delete {
        justify-content: flex-end;
        flex-wrap: wrap;
    }
}

/* Shared Windows-blue theme, navigation and dashboard composition. */
body, .auth-body { background: var(--bg); font-size: 15px; line-height: 1.5; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -100px; left: 12px; z-index: 100; background: var(--surface); padding: 12px; }
.skip-link:focus { top: 12px; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
svg { flex-shrink: 0; }
.app-shell { grid-template-columns: 240px minmax(0, 1fr); }
.sidebar { display: flex; flex-direction: column; height: 100vh; height: 100dvh; min-height: 0; padding: 20px 14px 12px; color: var(--text); background: var(--surface); border-right: 1px solid var(--line); }
.sidebar-top, .sidebar-footer { flex-shrink: 0; }
.sidebar-top { position: relative; }
.brand { padding: 0 6px; gap: 10px; }
.brand-mark { background: var(--primary); width: 44px; height: 48px; font-size: 22px; }
.brand strong { font-size: 16px; font-weight: 700; }
.brand small { color: var(--muted); }
.brand .brand-edition { display: inline-block; color: var(--primary); background: var(--active-bg); border-radius: 4px; padding: 1px 8px; font-size: 13px; font-weight: 600; margin-top: 4px; }
.household-picker { position: relative; margin: 20px 4px 12px; }
.household-picker > svg { position: absolute; left: 12px; top: 12px; width: 20px; height: 20px; }
.household-picker select { padding-left: 40px; font-weight: 500; height: 44px; }
.household-picker select:disabled { opacity: 1; color: var(--text); -webkit-text-fill-color: var(--text); cursor: default; background: var(--surface); }
.household-form.is-enhanced .household-submit { display: none; }
.nav-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; margin: 0; display: block; padding: 4px 2px 12px; }
.nav-group + .nav-group { margin-top: 18px; }
.nav-heading { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; margin: 0 12px 6px; }
.nav-list a, .settings-link { display: flex; align-items: center; gap: 14px; min-height: 42px; padding: 9px 12px; color: var(--text); font-weight: 500; border-radius: 6px; position: relative; }
.nav-list a + a { margin-top: 2px; }
.nav-list svg, .settings-link svg { width: 20px; height: 20px; }
.nav-list a:hover, .settings-link:hover { background: var(--bg); color: var(--primary); }
.nav-list a.is-active, .settings-link.is-active { background: var(--active-bg); color: var(--primary); box-shadow: inset 3px 0 0 var(--primary); font-weight: 650; }
.sidebar-footer { padding-top: 8px; border-top: 1px solid var(--line); }
.profile-row { display: flex; align-items: center; gap: 8px; padding: 10px 4px 0; }
.profile-avatar { display: grid; place-items: center; flex: 0 0 36px; height: 36px; border-radius: 50%; color: var(--primary); background: var(--active-bg); }
.profile-avatar svg { width: 20px; height: 20px; }
.profile-name { flex: 1; min-width: 0; }
.profile-name strong, .profile-name small { display: block; overflow-wrap: anywhere; }
.profile-name strong { font-weight: 600; line-height: 1.2; font-size: 14px; }
.profile-name small { color: var(--muted); font-size: 11px; margin-top: 3px; }
.profile-row .icon-btn { border-color: transparent; }
.main { min-width: 0; padding: 28px 30px 40px; }
.topbar { margin-bottom: 24px; padding: 0; gap: 20px; flex-wrap: wrap; }
.page-heading { display: flex; align-items: center; gap: 12px; min-width: 0; }
.page-heading > div { min-width: 0; }
h1 { font-size: 30px; line-height: 1.2; font-weight: 700; overflow-wrap: anywhere; }
h2 { font-size: 19px; line-height: 1.3; font-weight: 650; }
.page-subtitle { margin: 7px 0 0; color: var(--muted); font-size: 15px; overflow-wrap: anywhere; }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.header-add { min-width: 112px; height: 44px; }
.header-add svg { width: 22px; height: 22px; }
.menu-toggle, .drawer-close { display: none; }
.month-picker { display: flex; min-width: 0; gap: 6px; }
.month-picker label { position: relative; display: block; min-width: 0; }
.month-picker label > svg { width: 20px; height: 20px; position: absolute; left: 13px; top: 12px; pointer-events: none; }
.month-picker select { padding-left: 42px; min-height: 44px; max-width: 245px; }
.month-picker.is-enhanced .month-submit { display: none; }
.budget-status { gap: 7px; min-height: 44px; padding: 8px 13px; border-radius: 8px; white-space: nowrap; }
.budget-status svg { width: 16px; height: 16px; }
.btn, .icon-btn { font-weight: 600; box-shadow: none; }
.btn:hover, .icon-btn:hover { transform: none; box-shadow: none; }
.btn.primary { background: var(--primary); box-shadow: none; }
.btn.primary:hover { background: var(--primary-strong); }
.btn.ghost, .icon-btn { background: var(--surface); border-color: var(--line); }
.btn.ghost:hover, .icon-btn:hover { background: var(--active-bg); border-color: var(--primary); }
.icon-btn { min-width: 44px; min-height: 44px; }
label { color: var(--text); font-weight: 600; }
input, select, textarea { min-width: 0; max-width: 100%; box-shadow: none; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }
input[type="file"]::file-selector-button { border: 1px solid var(--line); border-radius: 4px; padding: 5px 10px; margin-right: 10px; color: var(--text); background: var(--bg); font: inherit; cursor: pointer; }
input[type="file"]::file-selector-button:hover { background: var(--active-bg); }
.panel { border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; background: var(--surface); padding: 22px; }
.panel-header { flex-wrap: wrap; }
.panel-header h2, .fund-card-main strong, .quick-card { color: var(--text); }
.panel-header a { display: inline-flex; gap: 4px; align-items: center; font-size: 14px; font-weight: 600; }
.panel-header a svg { width: 17px; height: 17px; }
.panel > .panel, .panel .table-wrap { box-shadow: none; border-radius: 0; }
.panel > .panel { padding-left: 0; padding-right: 0; }
.metric-card, .event-card, .resource-card, .fund-card, .auth-card { box-shadow: var(--shadow-soft); border-color: var(--line); }
.metric-card::before { display: none; }
.metric-card strong, .balance-card strong, .summary-row dd, td, .fund-progress, .list-row b { font-variant-numeric: tabular-nums; }
.metric-card strong { overflow-wrap: anywhere; }
.metric-grid { grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); }
.dashboard-overview { display: grid; grid-template-columns: 1.12fr 1fr; gap: 18px; }
.balance-card { display: flex; flex-direction: column; padding: 28px; min-width: 0; background: var(--primary-strong); color: white; border-radius: var(--radius); box-shadow: var(--shadow-soft); }
.balance-card h2 { text-transform: uppercase; font-size: 14px; font-weight: 650; }
.balance-main { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin: 28px 0 6px; }
.balance-main strong { font-size: 46px; line-height: 1.12; font-weight: 700; overflow-wrap: anywhere; min-width: 0; }
.balance-main > svg { width: 64px; height: 64px; color: #a9d6f5; stroke-width: 1.4; }
.balance-card > p { margin: 0 0 28px; font-size: 15px; }
.balance-details { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; border-top: 1px solid #ffffff40; margin: auto 0 0; padding-top: 22px; }
.balance-details > div { min-width: 0; }
.balance-details > div + div { border-left: 1px solid #ffffff40; padding-left: 20px; }
.balance-details dt { color: white; font-size: 12px; }
.balance-details dd { font-size: 21px; line-height: 1.3; margin-top: 6px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.dashboard-card { min-width: 0; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-soft); }
.monthly-summary dl { margin: 14px 0 0; }
.summary-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 0; }
.summary-row + .summary-row { border-top: 1px solid var(--line); }
.summary-row:last-child { padding-bottom: 0; }
.summary-row dt { display: flex; align-items: center; gap: 14px; font-size: 14px; font-weight: 650; color: var(--text); min-width: 0; }
.summary-row dt small { display: block; margin-top: 4px; font-size: 12px; font-weight: 400; color: var(--muted); }
.summary-row dd { font-size: 19px; font-weight: 700; margin: 0; white-space: nowrap; }
.summary-icon, .empty-icon { display: grid; place-items: center; width: 46px; height: 46px; flex: 0 0 46px; border-radius: 50%; background: var(--active-bg); color: var(--primary); }
.summary-icon svg { width: 24px; height: 24px; }
.summary-icon.income { color: var(--good); background: var(--good-bg); }
.summary-icon.spending { color: var(--danger); background: var(--danger-bg); }
.dashboard-activity { display: grid; grid-template-columns: 1fr 1.1fr; gap: 18px; margin-top: 20px; align-items: start; }
.dashboard-activity > article { min-height: 258px; }
.section-empty { min-height: 188px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 12px 0; }
.section-empty .empty-icon { width: 64px; height: 64px; flex-basis: 64px; margin-bottom: 16px; }
.section-empty .empty-icon svg { width: 30px; height: 30px; }
.section-empty h3 { font-size: 17px; margin: 0 0 5px; }
.section-empty p { color: var(--muted); font-size: 14px; margin: 0; }
.onboarding-strip { display: flex; align-items: center; gap: 18px; border: 1px solid var(--line); border-left: 4px solid var(--primary); border-radius: var(--radius); background: var(--surface); padding: 20px 24px; margin-top: 20px; }
.onboarding-strip > span:nth-child(2) { flex: 1; min-width: 0; }
.onboarding-strip strong, .onboarding-strip small { display: block; }
.onboarding-strip strong { font-size: 18px; }
.onboarding-strip small { font-size: 14px; color: var(--muted); margin-top: 4px; }
.onboarding-strip > svg { color: var(--primary); width: 20px; }
.dashboard-notices { display: grid; gap: 12px; margin: 20px 0; }
.quiet-status { display: flex; align-items: center; gap: 10px; color: var(--muted); margin: 0; font-size: 14px; }
.quiet-status svg { width: 22px; height: 22px; }
.dashboard-history { margin-top: 24px; }
.list { gap: 0; }
.list-row { border-radius: 0; padding: 12px 0; }
.list-row:hover { transform: none; }
.list-row > span { min-width: 0; }
.list-row > span > strong, .list-row > span > small { display: block; overflow-wrap: anywhere; }
.list-row > b { flex-shrink: 0; font-size: 14px; white-space: nowrap; }
.list-row small { font-size: 12px; }
.list-row svg { width: 18px; height: 18px; }
.alert-strip > div > strong, .alert-strip > div > span, .alert-strip > div > a { display: block; }
.alert-strip { font-size: 14px; }
.alert-strip > svg { width: 22px; height: 22px; }
.receipt-suggestion { background: var(--surface); color: var(--muted); border-color: var(--line); }
.receipt-suggestion > svg { color: var(--primary); }
.receipt-suggestion a { text-decoration: underline; text-underline-offset: 3px; }
.status { font-weight: 600; }
.status.outside-budget { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; margin-top: 6px; border: 1px solid #e4c778; border-radius: 4px; padding: 5px 8px; background: #fff4d6; color: #795500; font-size: 12px; font-weight: 700; line-height: 1.4; white-space: normal; }
.status.outside-budget svg { width: 16px; height: 16px; flex: 0 0 16px; }
.expense-title-content { flex: 1; min-width: 0; }
.expense-title-content > strong, .expense-title-content > small { display: block; overflow-wrap: anywhere; }
.budget-plan-section { margin-top: 20px; }
.plan-add-form { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 20px; }
.plan-edit { min-width: 0; max-width: 100%; }
.plan-edit .grid-form { grid-template-columns: minmax(0,1fr); min-width: 0; margin: 12px 0; }
.budget-options .toolbar-actions { flex-wrap: wrap; margin-top: 12px; }
.payment-section { margin: 20px 0; scroll-margin-top: 16px; }
.payment-prompt { margin-bottom: 18px; flex-wrap: wrap; }
.payment-forecast { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; margin: 16px 0 10px; }
.payment-forecast dt { color: var(--muted); font-size: 14px; }
.payment-forecast dd { margin: 5px 0 0; font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.payment-list { margin-top: 16px; }
.payment-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px; border-top: 1px solid var(--line); padding: 16px 0; }
.payment-description { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.payment-description > small, .payment-description > strong { display: block; }
.payment-description small { color: var(--muted); margin-top: 4px; }
.payment-amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.payment-due .payment-question { color: var(--danger); font-weight: 600; }
.payment-question { margin: 8px 0 0; }
.payment-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.payment-actions .btn { min-height: 44px; }
.balance-payment-link { display: block; color: inherit; }
.balance-payment-link:focus-visible { outline: 2px solid white; outline-offset: 4px; }
.balance-payment-forecast { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; border-top: 1px solid #ffffff40; padding-top: 16px; margin: 0 0 20px; }
.balance-payment-forecast > div { min-width: 0; }
.balance-payment-forecast dt { font-size: 12px; color: white; }
.balance-payment-forecast dd { font-size: 20px; font-weight: 700; margin: 6px 0 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.payment-add { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 16px; }
.payment-add summary { display: flex; align-items: center; gap: 8px; color: var(--primary); cursor: pointer; font-weight: 600; min-height: 44px; }
.payment-add summary svg { width: 20px; height: 20px; }
.payment-add form { margin-top: 12px; }
.bill-document { margin-top: 8px; min-height: 44px; }
.payment-reject { min-width: 0; max-width: 100%; }
.payment-reject summary { display: flex; align-items: center; gap: 6px; min-height: 44px; cursor: pointer; color: var(--danger); font-weight: 600; }
.payment-reject summary svg { width: 18px; height: 18px; flex-shrink: 0; }
.payment-reject[open] { flex-basis: 100%; }
.payment-reject-form { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; padding: 12px 0; }
.payment-reject-form label { flex: 1 1 180px; min-width: 0; }
.payment-confirm { min-width: 0; max-width: 100%; }
.payment-confirm > summary { list-style: none; cursor: pointer; }
.payment-confirm > summary::-webkit-details-marker { display: none; }
.payment-confirm[open] { flex-basis: 100%; }
.payment-confirm-form { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; padding: 12px 0; }
.payment-confirm-form label { flex: 1 1 160px; min-width: 0; }

.wallet-manage { display:flex; align-items:center; gap:8px; min-height:36px; padding:4px 8px; font-size:13px; color:var(--muted); }
.wallet-manage svg, .wallet-private svg { width:16px; height:16px; flex-shrink:0; }
.wallet-private { display:inline-flex; align-items:center; gap:6px; font-size:13px; color:var(--primary); margin-top:6px; }
.wallet-row { display:flex; align-items:center; flex-wrap:wrap; gap:12px; padding:16px 0; border-top:1px solid var(--line); }
.wallet-row > svg { width:22px; height:22px; flex-shrink:0; color:var(--primary); }
.wallet-name { flex:1 1 180px; min-width:0; overflow-wrap:anywhere; }
.wallet-name strong, .wallet-name small { display:block; }
.wallet-name small { color:var(--muted); margin-top:4px; }
.wallet-row form { margin:0; }
.wallet-create { margin-top:20px; }
.wallet-create .grid-form { max-width:600px; }

.category-chart-controls { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; margin-bottom:16px; }
.chart-scope { display:flex; flex-wrap:wrap; gap:2px; min-width:0; max-width:100%; margin:0; padding:3px; background:var(--bg); border:1px solid var(--line); border-radius:8px; }
.chart-scope label { position:relative; flex:1 1 auto; margin:0; cursor:pointer; }
.chart-scope label span { display:block; padding:9px 12px; min-height:40px; border-radius:5px; color:var(--muted); font-size:14px; font-weight:600; text-align:center; }
.chart-scope input:checked + span { background:var(--surface); color:var(--primary); box-shadow:0 1px 3px rgba(24,43,69,.12); }
.chart-scope input:focus-visible + span { outline:3px solid var(--primary); outline-offset:1px; }
.chart-scope input:disabled + span { opacity:.55; cursor:wait; }
.category-chart-total { color:var(--muted); font-size:14px; }
.category-chart-total output { font-weight:700; color:var(--text); font-variant-numeric:tabular-nums; white-space:nowrap; }
.category-breakdown { list-style:none; margin:16px 0 0; padding:0; }
.category-breakdown:empty { display:none; }
.category-breakdown li { display:grid; grid-template-columns:10px minmax(0,1fr) auto; align-items:center; gap:12px; padding:10px 0; border-top:1px solid var(--line); }
.category-dot { width:10px; height:10px; border-radius:2px; }
.category-name { overflow-wrap:anywhere; font-size:14px; }
.category-value { text-align:right; font-size:14px; font-variant-numeric:tabular-nums; }
.category-value strong { display:block; white-space:nowrap; }
.category-value small { display:block; color:var(--muted); }
.category-chip { display:inline-flex; align-items:center; gap:6px; padding:7px 10px; border-radius:6px; background:color-mix(in srgb,var(--chip),#fff 90%); border:1px solid color-mix(in srgb,var(--chip),#fff 65%); color:var(--text); font-size:14px; overflow-wrap:anywhere; max-width:100%; }
.category-chip svg { width:14px; height:14px; }
.category-row { display:flex; align-items:center; gap:12px; padding:12px 0; border-top:1px solid var(--line); }
.category-swatch { width:20px; height:20px; border:1px solid var(--line); border-radius:4px; flex-shrink:0; }
.category-row-name { flex:1; min-width:0; overflow-wrap:anywhere; }
.category-row-name strong,.category-row-name small { display:block; }
.category-row-name small { color:var(--muted); }
@media(max-width:600px) { .payment-forecast { grid-template-columns:minmax(0,1fr); gap:12px; } .payment-description { flex-basis: 100%; } .payment-actions { width:100%; } }
.status.open, .status.done, .status.active, .status.receipt-ok, .status.acknowledged, .status.reimbursed { color: var(--good); background: var(--good-bg); }
.status.closed { color: var(--muted); background: var(--surface-soft); }
.status.deleted, .status.cancelled, .status.withdrawal, .status.ignored, .event-card.overdue { color: var(--danger); background: var(--danger-bg); }
.status.extra-home { color: var(--primary-strong); background: var(--active-bg); }
.status.missing-receipt { color: var(--muted); background: var(--surface-soft); }
.status.planned, .status.partial, .status.corrected, .status.deposit, .status.adjustment, .status.unsettled { background: #fff4d6; color: #795500; }
.chart-state { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px; background: var(--surface); color: var(--muted); text-align: center; padding: 24px; }
.table-wrap { border-color: var(--line); border-radius: 8px; }
th { letter-spacing: 0; text-transform: none; font-weight: 600; background: var(--bg); }
.pagination, .form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pagination { justify-content: flex-end; padding: 18px 0; }
.inline-form.filters, .filters { display: flex; flex-wrap: wrap; align-items: end; }
.filters > label { flex: 1 1 140px; }
.search-field { min-width: 180px; }
.empty-table { padding: 32px; text-align: center; color: var(--muted); }
.field-error { color: var(--danger); font-size: 13px; }
[aria-invalid="true"] { border-color: var(--danger); }
.form-details { padding: 12px 0; border-top: 1px solid var(--line); }
.form-details > summary { cursor: pointer; font-weight: 600; padding: 8px 0; }
.form-details[open] > summary { margin-bottom: 12px; }
.amount-field input { font-size: 30px; font-weight: 700; min-height: 64px; font-variant-numeric: tabular-nums; }
.quick-expense { max-width: 820px; }
.quick-actions { gap: 8px; }
.quick-card { min-height: 58px; box-shadow: none; cursor: pointer; }
.quick-card.is-active { background: var(--active-bg); outline: none; border-color: var(--primary); }
.resource-card:hover, .event-card:hover, .fund-card:hover, .quick-card:hover, .attachment-tile:hover { transform: none; border-color: var(--primary); box-shadow: var(--shadow-soft); }
.toolbar > .inline-form, .toolbar > .btn, .toolbar-actions form { filter: none; }
.chip-cloud span, .empty-state { box-shadow: none; }
.timeline-item > span { box-shadow: none; }
.timeline-item > .audit-content { min-width: 0; overflow-wrap: anywhere; }
.timeline-item.audit-critical { border-left: 4px solid var(--danger); background: var(--danger-bg); padding: 14px 16px; border-radius: 4px; }
.audit-critical > span { background: var(--danger); }
.audit-heading { display: flex; align-items: center; gap: 8px; }
.audit-critical .audit-heading { color: var(--danger); }
.audit-heading svg { width: 20px; height: 20px; flex: 0 0 20px; }
.audit-expense-title { margin: 8px 0; font-weight: 600; }
.audit-amounts { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; margin: 8px 0; color: var(--danger); font-variant-numeric: tabular-nums; }
.audit-amounts b { white-space: nowrap; }
.audit-reason { margin: 8px 0; }
.audit-content details { margin-top: 8px; }
.timeline-item:not(.audit-critical) .audit-amounts { color: var(--text); }
.audit-context { margin: 6px 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.record-author { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; margin: 6px 0; vertical-align: middle; font-size: 12px; line-height: 1.4; color: var(--muted); }
.record-author > .record-author-initials { display: grid; place-items: center; width: 24px; height: 24px; flex: 0 0 24px; border-radius: 50%; background: var(--active-bg); color: var(--primary-strong); font-size: 11px; line-height: 1; font-weight: 700; }
.record-author > .record-author-text { min-width: 0; overflow-wrap: anywhere; font-size: 12px; line-height: 1.4; color: var(--muted); font-weight: 400; }
.history-tabs { display: flex; flex-wrap: wrap; gap: 20px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.history-tabs a { padding: 12px 0; color: var(--muted); border-bottom: 3px solid transparent; text-decoration: none; }
.history-tabs a[aria-current="page"] { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.history-filters { flex: 1 1 400px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; min-width: 0; }
.history-more { grid-column: 1 / -1; min-width: 0; }
.history-more > summary { cursor: pointer; color: var(--primary); padding: 6px 0; }
.history-filter-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: 12px; align-items: end; margin-top: 12px; }
.card-grid, .fund-grid { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
@media (max-width: 1250px) {
    .main { padding: 24px; }
    .balance-card, .dashboard-card { padding: 22px; }
    .balance-main strong { font-size: 40px; }
    .balance-main > svg { width: 44px; height: 44px; }
    .summary-row { flex-wrap: wrap; }
    .summary-row dd { margin-left: auto; }
}
@media (max-width: 1100px) {
    .app-shell { grid-template-columns: 1fr; }
    .main { padding: 22px 24px 32px; }
    .sidebar { display: none; position: fixed; inset: 0 auto 0 0; z-index: 80; width: min(300px, calc(100% - 28px)); padding-top: 16px; }
    .sidebar.is-open { display: flex; }
    .sidebar-top .brand { padding-right: 38px; }
    .drawer-close { display: inline-flex; position: absolute; top: 0; right: 0; border: 0; }
    .menu-toggle { display: inline-flex; flex-shrink: 0; }
    .drawer-backdrop { position: fixed; inset: 0; background: #182b4570; z-index: 70; }
    body.menu-open { overflow: hidden; }
}
@media (max-width: 760px) {
    .main { padding: 18px 16px 28px; }
    .topbar { gap: 16px; margin-bottom: 20px; align-items: center; }
    .page-heading { flex: 1 1 200px; }
    h1 { font-size: 28px; }
    .page-subtitle { font-size: 13px; }
    .header-actions { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
    .header-add { grid-column: 2; grid-row: 1; min-width: 94px; }
    .month-picker { grid-column: 1; grid-row: 2; }
    .month-picker label, .month-picker select { width: 100%; max-width: 100%; }
    .budget-status { grid-column: 2; grid-row: 2; justify-content: center; font-size: 12px; padding: 6px 8px; }
    .topbar:has(.month-picker) { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
    .topbar:has(.month-picker) .page-heading { grid-column: 1; grid-row: 1; }
    .topbar:has(.month-picker) .header-actions { display: contents; }
    .topbar:not(:has(.month-picker)) { flex-wrap: nowrap; }
    .topbar:not(:has(.month-picker)) .header-actions { display: flex; width: auto; }
    .dashboard-overview, .dashboard-activity { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .balance-card, .dashboard-card { padding: 22px 20px; }
    .balance-main { margin-top: 24px; }
    .balance-main strong { font-size: 40px; }
    .balance-main > svg { display: none; }
    .balance-card > p { font-size: 14px; margin-bottom: 24px; }
    .balance-details { gap: 12px; padding-top: 18px; }
    .balance-details > div + div { padding-left: 12px; }
    .balance-details dd { font-size: 19px; }
    .balance-details dt { font-size: 12px; }
    .summary-row dt { font-size: 14px; gap: 10px; }
    .summary-row dd { font-size: 19px; }
    .summary-icon { width: 40px; height: 40px; flex-basis: 40px; }
    .summary-row { gap: 10px; flex-wrap: nowrap; }
    .summary-row dt { flex: 1; }
    .summary-row dt > span:last-child { min-width: 0; overflow-wrap: anywhere; }
    .summary-row dd { flex: 0 1 auto; max-width: 45%; white-space: normal; overflow-wrap: anywhere; text-align: right; }
    .dashboard-activity > article { min-height: 0; }
    .dashboard-card h2 { font-size: 18px; }
    .section-empty { min-height: 180px; }
    .onboarding-strip { padding: 16px; gap: 12px; align-items: flex-start; }
    .onboarding-strip strong { font-size: 16px; }
    .onboarding-strip > svg { display: none; }
    .onboarding-strip .empty-icon { width: 36px; height: 36px; flex-basis: 36px; }
    .panel { padding: 18px 12px; }
    .metric-grid { grid-template-columns: minmax(0, 1fr); }
    .quick-actions { display: flex; flex-wrap: wrap; }
    .quick-card { flex: 1 1 88px; min-height: 68px; padding: 8px; font-size: 13px; }
    .quick-card svg { width: 22px; height: 22px; }
    .form-actions .btn { flex: 1 1 160px; }
    .inline-form.filters, .filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .filters .search-field { grid-column: 1 / -1; min-width: 0; }
    .filters input, .filters select { min-width: 0; width: 100%; }
    .table-wrap td { overflow-wrap: anywhere; padding: 8px; }
    .table-wrap td::before { flex-basis: 76px; }
    .empty-table::before { display: none; }
    .table-actions { gap: 6px; }
    .inline-delete input { max-width: 110px; }
    .toolbar-actions { flex-wrap: wrap; }
    .settlement-details { min-width: 0; width: 100%; }
    .list-row { flex-wrap: wrap; gap: 8px; }
    .list-row > b { margin-left: auto; }
}
@media (max-height: 500px) {
    .sidebar { padding-top: 10px; padding-bottom: 8px; }
    .household-picker { margin-top: 10px; margin-bottom: 4px; }
    .sidebar-footer { padding-top: 4px; }
    .profile-row { padding-top: 4px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

.connection-notice { position: sticky; top: 0; z-index: 65; padding: 12px 18px; padding-top: max(12px, env(safe-area-inset-top)); background: #FFF4CE; color: #614400; border-bottom: 1px solid #D9C77E; text-align: center; font-size: 14px; }
.connection-notice[hidden] { display: none; }
@media (max-width: 1100px) {
    .sidebar { padding-top: max(16px, env(safe-area-inset-top)); padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}
@media (max-width: 760px) {
    .main { padding-top: max(18px, env(safe-area-inset-top)); padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); padding-bottom: max(28px, env(safe-area-inset-bottom)); }
    input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px; }
    .auth-body { padding-top: max(24px, env(safe-area-inset-top)); padding-bottom: max(24px, env(safe-area-inset-bottom)); }
}

/* Financial history is a ledger of distinct operations, not an undivided feed. */
.timeline:has(> .audit-row) { gap: 0; }
.timeline > .audit-row { grid-template-columns: 36px minmax(0,1fr); gap: 14px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.timeline > .audit-row:first-child { padding-top: 8px; }
.timeline > .audit-row:last-child { border-bottom: 0; }
.audit-row > .audit-action-icon { display: grid; place-items: center; width: 36px; height: 36px; margin: 0; border-radius: 6px; background: var(--active-bg); color: var(--primary); box-shadow: none; }
.audit-action-icon > svg { width: 18px; height: 18px; }
.audit-row-main { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 16px; align-items: start; }
.audit-description { min-width: 0; }
.audit-row .audit-heading { font-size: 14px; line-height: 1.5; font-weight: 600; color: var(--text); }
.audit-row .audit-expense-title { margin: 5px 0 0; font-size: 16px; font-weight: 650; line-height: 1.5; overflow-wrap: anywhere; }
.audit-row .audit-context { display: inline-block; margin: 7px 0 0; padding: 3px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg); color: var(--muted); font-size: 11px; line-height: 1.5; font-weight: 500; }
.audit-row .audit-amounts { margin: 0; color: var(--text); font-size: 18px; line-height: 1.5; justify-content: end; text-align: right; max-width: 100%; }
.audit-row .audit-amounts b { white-space: normal; overflow-wrap: anywhere; }
.audit-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin-top: 12px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.audit-meta > span { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.audit-meta svg { width: 14px; height: 14px; flex: 0 0 14px; }
.audit-row .audit-reason { margin: 12px 0 0; padding: 8px 10px; border-left: 2px solid var(--danger); background: var(--surface); font-size: 13px; }
.timeline > .audit-row.audit-critical { margin: 8px 0; padding: 16px; border: 1px solid #edc3c8; border-left: 4px solid var(--danger); border-radius: 6px; background: var(--danger-bg); }
.audit-critical > .audit-action-icon { color: var(--danger); background: var(--surface); }
.audit-critical .audit-heading, .audit-critical .audit-amounts { color: var(--danger); }
.audit-critical .audit-context { background: var(--surface); border-color: #edc3c8; }
.audit-row .audit-change-amounts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.audit-change-amounts > span { display: grid; gap: 2px; text-align: left; font-size: 11px; }
.audit-change-amounts > span:first-child b { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.audit-change-amounts > span b { display: block; font-size: 18px; }
.audit-change-amounts > svg { width: 18px; height: 18px; }
.audit-row .audit-deleted-amount { display: grid; gap: 2px; font-size: 11px; }
.audit-deleted-amount b { font-size: 18px; }
.audit-row .audit-content details { margin-top: 12px; font-size: 13px; }
.audit-row .audit-content details > summary { cursor: pointer; color: var(--primary); min-height: 30px; }
.audit-row pre { overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.dashboard-history .audit-row { grid-template-columns: 30px minmax(0,1fr); gap: 10px; padding: 16px 0; }
.dashboard-history .audit-action-icon { width: 30px; height: 30px; }
.dashboard-history .audit-expense-title { font-size: 14px; }
.dashboard-history .audit-amounts, .dashboard-history .audit-amounts b { font-size: 16px; }
.dashboard-history .audit-meta { margin-top: 8px; }
.audit-date-short { display: none; }
.history-ledger .audit-day { font-size:14px; font-weight:600; color:var(--muted); background:var(--bg); padding:10px 12px; margin:12px 0 0; border-bottom:1px solid var(--line); }
.history-ledger .audit-day:first-child { margin-top:0; }
.history-ledger .audit-row { padding:12px 10px; gap:10px; }
.history-ledger .audit-content { position:relative; }
.history-ledger .audit-row-main { padding-right:86px; }
.history-ledger .audit-meta { position:absolute; top:0; right:0; margin:0; gap:6px; }
.history-ledger .audit-meta time { font-size:12px; font-variant-numeric:tabular-nums; }
.history-ledger .audit-expense-title, .history-ledger .audit-context { margin:3px 0 0; }
@media (max-width: 760px) {
    .timeline > .audit-row { grid-template-columns: 24px minmax(0,1fr); gap: 8px; padding: 9px 0; }
    .timeline > .audit-row > .audit-action-icon { width: 24px; height: 24px; border-radius: 5px; }
    .audit-action-icon > svg { width: 15px; height: 15px; }
    /* One shared compact layout for dashboard and full history, without duplicated content. */
    .timeline > .audit-row .audit-content { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 2px 8px; min-width: 0; }
    .timeline > .audit-row .audit-row-main, .timeline > .audit-row .audit-description { display: contents; }
    .timeline > .audit-row .audit-heading { grid-area: 1 / 1; padding: 0; font-size: 12px; line-height: 1.4; align-self: center; overflow-wrap: anywhere; }
    .timeline > .audit-row .audit-expense-title { grid-area: 2 / 1; margin: 0; font-size: 14px; line-height: 1.4; }
    .timeline > .audit-row .audit-context { grid-area: 3 / 1 / auto / -1; justify-self: start; margin: 0; padding: 0; border: 0; background: transparent; font-size: 11px; line-height: 1.4; }
    .timeline > .audit-row .audit-amounts { grid-area: 2 / 2; align-self: start; margin: 0; max-width: 116px; font-size: 14px; line-height: 1.4; text-align: right; font-variant-numeric: tabular-nums; }
    .timeline > .audit-row .audit-amounts b { font-size: 14px; }
    .timeline > .audit-row .audit-meta { position: static; grid-area: 1 / 2; justify-content: end; align-self: start; flex-wrap: nowrap; margin: 0; gap: 5px; }
    .timeline > .audit-row .audit-meta time { font-size: 11px; line-height: 1.4; white-space: nowrap; font-variant-numeric: tabular-nums; }
    .audit-date-wide { display: none; }
    .audit-date-short { display: inline; }
    .timeline > .audit-row .audit-reason { grid-area: 4 / 1 / auto / -1; margin: 4px 0 0; padding: 5px 8px; font-size: 12px; overflow-wrap: anywhere; }
    .timeline > .audit-row .audit-content > details { grid-area: 5 / 1 / auto / -1; margin-top: 2px; min-width: 0; }
    .timeline > .audit-row.audit-critical { padding: 9px 8px; margin: 5px 0; }
    .timeline > .audit-row.audit-critical .audit-expense-title { grid-column: 1 / -1; }
    .timeline > .audit-row.audit-critical .audit-amounts { grid-area: 3 / 1 / auto / -1; max-width: none; justify-content: start; text-align: left; gap: 5px 8px; }
    .timeline > .audit-row.audit-critical .audit-context { grid-row: 4; }
    .timeline > .audit-row.audit-critical .audit-reason { grid-row: 5; }
    .timeline > .audit-row.audit-critical .audit-content > details { grid-row: 6; }
    .audit-row .audit-deleted-amount { display: flex; align-items: baseline; flex-wrap: wrap; }
    .audit-row .audit-change-amounts > span, .audit-row .audit-deleted-amount > span { font-size: 11px; }
    .history-ledger .audit-day { padding: 6px 8px; margin-top: 8px; font-size: 12px; }
    .audit-row .audit-content details > summary { min-height: 44px; padding-top: 8px; }
}

/* Everyday actions, explicit financial context and compact secondary views. */
.form-surface { max-width: 920px; }
.form-surface .panel-header { margin-bottom: 20px; }
.simple-expense-form .funding-effect { margin: 0; font-size: 14px; }
.form-details > summary, .more-actions > summary { min-height: 44px; padding: 10px 0; color: var(--primary); cursor: pointer; font-weight: 600; }
.form-details[open] > summary { margin-bottom: 14px; }
.add-choices { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; max-width: 920px; margin-bottom: 20px; }
.add-choices a { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 12px 14px; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; color: var(--text); font-weight: 600; }
.add-choices a.is-active { border-color: var(--primary); color: var(--primary); background: var(--active-bg); }
.add-choices svg { width: 22px; height: 22px; flex: 0 0 22px; }
.add-choices span { overflow-wrap: anywhere; }
.view-links { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0 0 20px; border-bottom: 1px solid var(--line); }
.view-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 0; color: var(--muted); border-bottom: 2px solid transparent; }
.view-links a.is-active { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.filter-disclosure { flex: 1; min-width: 0; }
.filter-disclosure > summary { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 14px; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; cursor: pointer; }
.filter-disclosure > summary svg { width: 18px; height: 18px; }
.filter-disclosure[open] > summary { margin-bottom: 16px; }
.filter-disclosure .filters { width: 100%; }
.current-wallet-context { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.current-wallet-context svg { width: 14px; height: 14px; }
.notice-inline { padding: 14px 16px; border-left: 3px solid var(--primary); background: var(--surface); color: var(--muted); line-height: 1.6; }
.allocation-preview { display: grid; grid-template-columns: 1fr 1fr; margin: 0; padding: 16px 0; gap: 20px; border-block: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.allocation-preview dt { color: var(--muted); font-size: 14px; }
.allocation-preview dd { margin: 6px 0 0; font-size: 24px; font-weight: 700; overflow-wrap: anywhere; }
.settings-section > summary { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; font-size: 18px; font-weight: 650; list-style: none; }
.settings-section > summary::after { content: '+'; margin-left: auto; color: var(--primary); }
.settings-section[open] > summary::after { content: '-'; }
.settings-section[open] > summary { padding-bottom: 16px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.settings-section > summary small { font-size: 14px; font-weight: 400; color: var(--muted); }
.settings-section > summary svg { width: 22px; height: 22px; color: var(--primary); }
.settings-form-group + .settings-form-group { border-top: 1px solid var(--line); padding-top: 24px; margin-top: 24px; }
.settings-form-group h2 { font-size: 18px; margin-bottom: 16px; }
.settings-links { margin-bottom: 14px; }
.row-menu > summary { list-style: none; cursor: pointer; }
.row-menu > div { display: grid; gap: 10px; padding: 12px 0; min-width: 180px; }
.row-menu .inline-delete { display: grid; align-items: end; gap: 8px; grid-template-columns: minmax(120px,1fr) 44px; }
.row-menu label { font-size: 13px; }
.table-actions > a, .row-menu { flex-shrink: 0; }
.payment-actions .payment-reject > summary { width: auto; min-width: 88px; min-height: 44px; gap: 6px; padding: 8px 10px; }
.payment-detail .payment-actions { align-items: start; flex-wrap: wrap; }
.manual-fund-operations > summary { min-height: 44px; cursor: pointer; font-weight: 600; color: var(--muted); }
.manual-fund-operations[open] > summary { margin-bottom: 20px; }
.decision-summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.decision-summary > a { display: grid; align-content: start; gap: 6px; padding: 18px 22px; min-width: 0; }
.decision-summary > a + a { border-left: 1px solid var(--line); }
.decision-summary span { font-size: 14px; color: var(--muted); }
.decision-summary strong { font-size: 26px; font-variant-numeric: tabular-nums; line-height: 1.3; overflow-wrap: anywhere; }
.decision-summary small { font-size: 12px; color: var(--muted); }
.dashboard-workbench { display: block; }
.dashboard-workbench .payment-section .payment-row { grid-template-columns: minmax(0,1fr) auto auto; gap: 14px; align-items: center; }
.dashboard-workbench .payment-section .payment-description { grid-column: 1; grid-row: 1; }
.dashboard-workbench .payment-section .payment-amount { grid-column: 2; grid-row: 1; }
.dashboard-workbench .payment-section .payment-actions { grid-column: 3; grid-row: 1; max-width: none; }
.dashboard-workbench .payment-section .payment-list { max-height: none; overflow: visible; }
.dashboard-workbench .payment-section .payment-actions .btn { min-height: 40px; font-size: 13px; padding: 8px 10px; }
.dashboard-workbench .payment-section .payment-actions > .icon-btn, .dashboard-workbench .payment-section .payment-reject > summary { min-width: 40px; min-height: 40px; }
.dashboard-workbench .payment-section .payment-description { font-size: 14px; }
.dashboard-workbench .payment-section .payment-description > small, .dashboard-workbench .payment-section .record-author-text { font-size: 12px; }
.dashboard-workbench .payment-section .payment-amount { font-size: 15px; }
.dashboard-analysis { border-block: 1px solid var(--line); min-width: 0; }
.dashboard-workbench > .dashboard-analysis { margin-top: 18px; }
.dashboard-analysis > summary { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-height: 54px; padding: 12px 0; color: var(--primary); cursor: pointer; font-size: 16px; font-weight: 600; }
.dashboard-analysis > summary svg { width: 21px; height: 21px; }
.dashboard-analysis > summary span { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: auto; }
.dashboard-analysis[open] > .panel, .dashboard-analysis[open] > .dashboard-grid { margin-bottom: 16px; }
.dashboard-analysis .spending-categories .category-value small { font-size: 12px; }
.dashboard-analysis .trend-heading { font-size: 13px; }
.dashboard-analysis .trend-heading select { font-size: 13px; min-height: 36px; }
.dashboard-secondary { grid-template-columns: minmax(0,1fr); }
.empty-state { grid-column: 1 / -1; }
.panel > .empty-state { background: transparent; border: 0; box-shadow: none; padding: 24px 0; }
.real-contributions { min-width: 0; padding: 22px 0; border-block: 1px solid var(--line); margin-block: 18px; }
.real-contributions-table { table-layout: fixed; width: 100%; }
.real-contributions-table th, .real-contributions-table td { overflow-wrap: anywhere; }
.real-contributions-table td { font-variant-numeric: tabular-nums; }
.real-contributions-table td:last-child { color: var(--primary); background: var(--surface); }
.real-contributions-table small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.real-contributions-totals { display: flex; flex-wrap: wrap; gap: 20px 40px; margin: 18px 0 0; }
.real-contributions-totals > div { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; }
.real-contributions-totals dt { color: var(--muted); }
.real-contributions-totals dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.real-contributions-note { font-size: 12px; margin-top: 14px; }
[hidden] { display: none !important; }
@media (max-width: 760px) {
    .real-contributions-table, .real-contributions-table tbody { display: block; }
    .real-contributions-table thead { display: none; }
    .real-contributions-table tr { display: block; border-bottom: 1px solid var(--line); padding: 14px 10px; }
    .real-contributions-table tbody th { display: block; border: 0; padding: 0 0 8px; text-align: left; background: transparent; }
    .real-contributions-table tbody td { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; border: 0; padding: 5px 0; }
    .real-contributions-table tbody td::before { content: attr(data-label); color: var(--muted); font-weight: 400; flex-basis: auto; width: auto; }
    .real-contributions-table td small { flex-basis: 100%; text-align: right; }
    .expense-list-table tbody tr { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
    .expense-list-table tbody td { display: block; border: 0; padding: 0; min-width: 0; font-size: 13px; }
    .expense-list-table tbody td::before { display: none; }
    .expense-list-table tbody td:nth-child(2) { grid-column: 1; grid-row: 1 / span 2; text-align: left; }
    .expense-list-table tbody td:nth-child(5) { grid-column: 2; grid-row: 1; text-align: right; font-size: 15px; }
    .expense-list-table tbody td:nth-child(1) { grid-column: 2; grid-row: 2; color: var(--muted); text-align: right; }
    .expense-list-table tbody td:nth-child(3) { grid-column: 1; grid-row: 3; color: var(--muted); }
    .expense-list-table tbody td:nth-child(4) { grid-column: 1; grid-row: 4; color: var(--muted); }
    .expense-list-table tbody td:nth-child(6) { grid-column: 2; grid-row: 3; text-align: right; }
    .expense-list-table tbody td:nth-child(7) { grid-column: 1 / -1; grid-row: 5; display: flex; justify-content: end; }
    .expense-list-table .expense-detail-link { font-size: 15px; }
    .expense-list-table .record-author { margin: 6px 0; }
    .expense-list-table .status { font-size: 12px; }
    .expense-list-table tbody tr:has(.empty-table) { display: block; }
    .add-choices { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .add-choices a { min-height: 64px; font-size: 14px; padding: 10px 12px; }
    .decision-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .decision-summary > a { padding: 14px; }
    .decision-summary > a:last-child { grid-column: 1 / -1; border-top: 1px solid var(--line); border-left: 0; grid-template-columns: 1fr auto; align-items: center; }
    .decision-summary > a:last-child small { grid-column: 1 / -1; }
    .decision-summary strong { font-size: 21px; }
    .dashboard-workbench .payment-section .payment-row { grid-template-columns: minmax(0,1fr) auto; gap: 10px; }
    .dashboard-workbench .payment-section .payment-actions { grid-column: 1 / -1; grid-row: 2; justify-content: start; }
    .dashboard-workbench .payment-section .payment-actions .btn, .dashboard-workbench .payment-section .payment-actions > .icon-btn, .dashboard-workbench .payment-section .payment-reject > summary { min-height: 44px; min-width: 44px; }
    .dashboard-workbench .payment-section .payment-amount { font-size: 14px; }
    .allocation-preview { grid-template-columns: minmax(0,1fr); gap: 14px; }
    .form-surface { padding: 18px 16px; }
    .row-menu > div { min-width: 0; }
    .dashboard-analysis > summary span { display: none; }
    .fund-hero + .manual-fund-operations { margin-top: 16px; }
}

/* Dashboard composition from the desktop / phone reference. */
:root { --shadow-soft: 0 2px 10px rgba(24,43,69,.035); }
.dashboard-page .main { max-width: 1700px; width: 100%; }
.dashboard-page .current-wallet-context { display: none; }
.nav-more { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.nav-more > summary { display: flex; align-items: center; gap: 14px; min-height: 44px; padding: 9px 12px; cursor: pointer; list-style: none; font-weight: 500; border-radius: 6px; }
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more > summary:hover { background: var(--bg); color: var(--primary); }
.nav-more > summary > svg:last-child { margin-left: auto; width: 16px; }
.nav-more[open] > summary > svg:last-child { transform: rotate(180deg); }
.mobile-app-header, .phone-navigation, .mobile-bills-shortcut { display: none; }
.dashboard-workspace { display: grid; gap: 18px; min-width: 0; }
.dashboard-workspace > * { min-width: 0; margin-block: 0; }
.dashboard-workspace h2 { font-size: 20px; }
.dashboard-workspace .panel-header { margin-bottom: 14px; gap: 8px; align-items: start; }
.dashboard-workspace .panel-header h2 { margin: 0; }
.dashboard-workspace .panel-header p { color: var(--muted); font-size: 13px; margin: 3px 0 0; }
.dashboard-workspace .dashboard-card { padding: 18px; border-radius: 8px; }
.dashboard-overview { grid-template-columns: minmax(0,1.1fr) minmax(0,1.6fr); gap: 0; padding: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.dashboard-overview .balance-card { background: var(--active-bg); color: var(--text); border-radius: 6px; box-shadow: none; padding: 18px 24px; }
.dashboard-overview .balance-card h2 { text-transform: none; font-size: 17px; margin: 0; }
.dashboard-overview .balance-main { margin: 7px 0 9px; }
.dashboard-overview .balance-main strong { color: var(--primary); font-size: 44px; }
.dashboard-overview .balance-card > .balance-projection { border-top: 1px solid #c1d8ec; padding-top: 7px; margin: 0; font-size: 14px; }
.balance-projection strong { font-size: inherit; }
.overview-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); align-items: center; margin: 0; padding: 18px 0; }
.overview-metrics > div { padding: 0 20px; min-width: 0; }
.overview-metrics > div + div { border-left: 1px solid var(--line); }
.overview-metrics dt { display: flex; flex-direction: column; gap: 9px; font-size: 13px; color: var(--muted); }
.overview-metrics dt > svg { color: var(--text); width: 26px; height: 26px; stroke-width: 1.6; margin-bottom: 2px; }
.overview-metrics dd { font-size: 23px; font-weight: 700; margin: 7px 0 0; line-height: 1.3; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.dashboard-charts { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(0,1fr); gap: 12px 16px; }
.chart-funding-controls { display: flex; justify-content: start; margin-top: 4px; }
.chart-funding-controls .chart-scope { margin: 0; padding: 2px; }
.chart-funding-controls .chart-scope label span { min-height: 28px; padding: 4px 12px; font-size: 12px; }
.trend-mode { margin-left: auto; }
.trend-mode select { min-height: 34px; padding: 5px 25px 5px 9px; font-size: 12px; width: auto; }
.spending-progress .panel-header { flex-wrap: nowrap; }
.spending-progress .panel-header > div { min-width: 0; }
.dashboard-workspace .spending-progress-chart { height: 190px; min-height: 190px; }
.category-composition { display: grid; grid-template-columns: minmax(135px,.95fr) minmax(0,1fr); align-items: center; gap: 10px; min-height: 190px; }
.dashboard-workspace .category-ring { height: 190px; min-height: 190px; width: 100%; min-width: 0; }
.category-breakdown { margin: 0; min-width: 0; max-height: 220px; overflow-y: auto; scrollbar-width: thin; }
.category-breakdown > li { display: block; padding: 0; border: 0; }
.category-detail > summary { display: grid; grid-template-columns: 9px minmax(0,1fr) 10px; gap: 4px 8px; padding: 10px 0; align-items: center; cursor: pointer; list-style: none; border-radius: 4px; }
.category-detail > summary::-webkit-details-marker { display: none; }
.category-detail > summary:hover .category-name { color: var(--primary); }
.category-chevron { grid-column: 3; grid-row: 1 / span 2; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); color: var(--muted); }
.category-detail[open] .category-chevron { transform: rotate(225deg); }
.category-transactions { margin: 2px 0 10px; padding: 0 8px; border-left: 2px solid var(--primary); background: var(--bg); border-radius: 0 4px 4px 0; }
.category-transactions ul { list-style: none; padding: 0; margin: 0; }
.category-transactions li { display: block; padding: 0; border: 0; }
.category-transactions a { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 10px; border-bottom: 1px solid var(--line); padding: 10px 0; font-size: 12px; }
.category-transactions a:hover strong { color: var(--primary); text-decoration: underline; }
.category-transactions a > span { min-width: 0; flex: 1 1 100px; overflow-wrap: anywhere; }
.category-transactions small { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.category-transactions b { font-variant-numeric: tabular-nums; }
.category-load-status { padding-top: 7px; margin: 0; font-size: 11px; color: var(--muted); }
.category-load-more { margin: 8px 0; min-height: 36px; font-size: 12px; }
.category-name { font-size: 14px; overflow-wrap: anywhere; }
.category-dot { width: 9px; height: 9px; border-radius: 3px; }
.category-value { grid-column: 2; font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 8px; font-variant-numeric: tabular-nums; }
.category-value small { font-size: 11px; color: var(--muted); font-weight: 400; }
.category-track { display: none; }
.category-empty { grid-column: 1 / -1; font-size: 14px; }
.dashboard-workspace .chart-state { font-size: 13px; text-align: center; gap: 10px; padding: 14px; }
.dashboard-lists { display: grid; grid-template-columns: minmax(0,1.05fr) minmax(0,1fr); gap: 16px; align-items: start; }
.dashboard-lists > * { margin: 0; }
.recent-expense-list { list-style: none; padding: 0; margin: 0; }
.recent-expense-list > li { display: grid; grid-template-columns: 36px minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.recent-expense-list > li:last-child { border-bottom: 0; }
.expense-category-icon { display: grid; place-items: center; width: 36px; height: 36px; color: var(--primary); background: var(--active-bg); border-radius: 7px; }
.expense-category-icon svg { width: 22px; height: 22px; stroke-width: 1.7; }
.expense-category-icon.outside { color: #8c5e13; background: #fff4df; }
.expense-detail-link { font-weight: 650; font-size: 14px; overflow-wrap: anywhere; }
.expense-detail-link:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
.recent-expense-description { min-width: 0; }
.recent-expense-description > small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.recent-expense-description .status { font-size: 11px; padding: 2px 6px; margin-top: 4px; }
.recent-expense-description .status > svg { width: 13px; height: 13px; }
.receipt-shortcut { display: inline-flex; vertical-align: middle; padding: 6px; color: var(--muted); }
.receipt-shortcut svg { width: 16px; height: 16px; }
.recent-expense-amount { display: flex; align-items: end; flex-direction: column; gap: 4px; max-width: 135px; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.recent-expense-amount > strong { font-size: 14px; }
.expense-record-meta { display: flex; align-items: center; gap: 5px; }
.expense-record-meta .receipt-shortcut { padding: 3px; }
.recent-expense-amount .record-author { margin: 0; }
.recent-expense-amount .record-author-initials { width: 22px; height: 22px; font-size: 10px; }
.recent-expense-amount .record-author-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.count-badge { display: inline-grid; place-items: center; min-width: 23px; height: 23px; padding: 0 5px; border-radius: 50%; background: var(--active-bg); color: var(--primary); font-size: 13px; vertical-align: middle; }
.payment-section { scroll-margin-top: 16px; }
.payment-section .payment-list { margin: 0; border: 0; }
.payment-section .payment-row { display: block; padding: 0; border-bottom: 1px solid var(--line); }
.payment-row > summary { display: grid; grid-template-columns: 36px minmax(0,1fr) auto 16px; align-items: center; gap: 10px; padding: 12px 0; cursor: pointer; list-style: none; }
.payment-row > summary::-webkit-details-marker { display: none; }
.payment-row > summary:hover .payment-description strong { color: var(--primary); }
.payment-row > summary .payment-chevron { width: 16px; height: 16px; }
.payment-row[open] > summary .payment-chevron { transform: rotate(90deg); }
.payment-section .payment-description { min-width: 0; }
.payment-description strong { font-size: 14px; overflow-wrap: anywhere; }
.payment-description > small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.payment-section .payment-amount { max-width: 130px; text-align: right; font-size: 14px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.payment-row-detail { padding: 0 0 14px 46px; }
.payment-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.payment-meta .record-author { margin: 0; }
.payment-section .payment-actions { flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.payment-section .payment-confirm[open] { flex-basis: 100%; }
.payment-section .payment-confirm-form { min-width: 0; }
.payment-section .payment-confirm-form .btn { white-space: normal; }
.payment-section .payment-due { border-left: 3px solid var(--danger); padding-left: 10px; }
.payment-total { display: flex; gap: 8px; flex-wrap: wrap; justify-content: space-between; padding-top: 14px; font-size: 14px; }
.payment-total span { color: var(--muted); }
.payment-total strong, .payment-total strong span { color: var(--text); font-variant-numeric: tabular-nums; }
.payment-scope { margin-top: 4px; color: var(--muted); font-size: 12px; }
.payment-scope summary { cursor: pointer; padding-block: 6px; }
.payment-scope p { margin: 4px 0 10px; }
.payment-footer-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: start; margin-top: 8px; }
.payment-footer-actions .payment-add { flex: 1; border: 0; padding: 0; margin: 0; }
.payment-add > summary { display: flex; align-items: center; min-height: 40px; gap: 8px; cursor: pointer; font-size: 13px; color: var(--primary); }
.payment-add[open] { flex-basis: 100%; }
.payment-add .grid-form { grid-template-columns: minmax(0,1fr); margin-top: 12px; }
.payment-add svg { width: 18px; height: 18px; }
.payment-dismissed { min-height: 40px; display: inline-flex; align-items: center; color: var(--muted); font-size: 12px; }
.dashboard-savings { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; padding: 14px 0; border-block: 1px solid var(--line); }
.dashboard-savings > a { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.dashboard-savings svg { width: 24px; color: var(--primary); }
.dashboard-savings > span { font-size: 13px; color: var(--muted); }
.dashboard-savings strong { font-variant-numeric: tabular-nums; }
.dashboard-secondary { display: grid; grid-template-columns: minmax(0,1fr); gap: 16px; }
.dashboard-workspace .dashboard-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.dashboard-workspace .section-empty { min-height: 160px; }
.dashboard-workspace .section-empty .empty-icon { width: 40px; height: 40px; flex-basis: 40px; margin-bottom: 12px; }
.dashboard-workspace .section-empty .empty-icon svg { width: 22px; height: 22px; }
.dashboard-workspace .section-empty h3 { font-size: 15px; }
.dashboard-workspace .section-empty p { font-size: 13px; }
@media (min-width: 1101px) and (max-width: 1300px) {
    .dashboard-page .main { padding: 24px; }
    .dashboard-overview .balance-card { padding: 18px; }
    .dashboard-overview .balance-main strong { font-size: 38px; }
    .overview-metrics > div { padding: 0 14px; }
    .overview-metrics dd { font-size: 20px; }
    .category-composition { grid-template-columns: minmax(135px,.9fr) minmax(0,1fr); gap: 8px; }
    .dashboard-workspace .category-ring { height: 160px; min-height: 160px; }
    .dashboard-workspace h2 { font-size: 18px; }
}
@media (max-width: 1000px) {
    .overview-metrics > div { padding: 0 14px; }
    .overview-metrics dd { font-size: 20px; }
}
@media (max-width: 760px) {
    .main { padding: max(12px, env(safe-area-inset-top)) 14px calc(90px + env(safe-area-inset-bottom)); }
    .mobile-app-header { display: grid; grid-template-columns: 40px minmax(0,1fr) 36px; align-items: center; gap: 14px; margin-bottom: 10px; }
    .mobile-app-header .brand-mark { width: 38px; height: 38px; font-size: 20px; }
    .mobile-app-header .household-picker { margin: 0; max-width: 230px; }
    .mobile-app-header .household-picker select { height: 40px; min-height: 40px; padding-block: 6px; font-size: 14px; }
    .mobile-app-header .household-picker > svg { top: 10px; }
    .mobile-app-header .profile-avatar { font-size: 14px; font-weight: 600; }
    .topbar .menu-toggle { display: none; }
    .topbar { margin-bottom: 14px; }
    .dashboard-page .topbar { gap: 8px; grid-template-columns: minmax(0,1fr) auto; }
    .dashboard-page .page-subtitle, .dashboard-page .header-add, .dashboard-page .budget-status.open { display: none; }
    .dashboard-page .page-heading h1 { font-size: 26px; }
    .dashboard-page .month-picker { grid-column: 2; grid-row: 1; max-width: 188px; }
    .dashboard-page .month-picker select { min-height: 38px; height: 38px; font-size: 12px; padding-left: 32px; padding-right: 22px; }
    .dashboard-page .month-picker label > svg { width: 17px; height: 17px; top: 10px; left: 9px; }
    .dashboard-page .budget-status:not(.open) { grid-column: 1 / -1; grid-row: 2; min-height: 30px; justify-self: start; }
    .dashboard-workspace { gap: 12px; }
    .dashboard-workspace h2 { font-size: 18px; }
    .dashboard-overview { display: block; border: 0; border-radius: 0; padding: 0; background: transparent; }
    .dashboard-overview .balance-card { padding: 10px 16px; border-radius: 8px; }
    .dashboard-overview .balance-card h2 { font-size: 15px; }
    .dashboard-overview .balance-main { margin: 5px 0 7px; }
    .dashboard-overview .balance-main strong { font-size: 40px; }
    .dashboard-overview .balance-card > .balance-projection { font-size: 13px; padding-top: 6px; }
    .overview-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 14px 0 0; }
    .overview-metrics > div { position: relative; padding: 0 10px 0 38px; }
    .overview-metrics > div + div { padding-left: 48px; }
    .overview-metrics dt { font-size: 12px; display: block; }
    .overview-metrics dt > svg { position: absolute; left: 5px; top: 7px; width: 23px; height: 23px; }
    .overview-metrics > div + div dt > svg { left: 13px; }
    .overview-metrics dd { font-size: 17px; margin-top: 2px; }
    .overview-metrics .overview-saved { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); margin-top: 12px; padding: 8px 0 0; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
    .overview-saved dt > svg { display: none; }
    .overview-saved dd { font-size: 14px; }
    .overview-metrics:has(.overview-saved dd[data-zero]) .overview-saved { display: none; }
    .mobile-bills-shortcut { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-soft); font-size: 12px; }
    .mobile-bills-shortcut > svg { width: 19px; height: 19px; }
    .mobile-bills-shortcut > strong { margin-left: auto; font-size: 14px; font-variant-numeric: tabular-nums; }
    .mobile-bills-shortcut > svg:last-child { width: 14px; }
    .dashboard-charts { grid-template-columns: minmax(0,1fr); gap: 12px; }
    .chart-funding-controls { justify-content: start; }
    .chart-funding-controls .chart-scope label span { min-height: 30px; padding: 5px 9px; font-size: 11px; }
    .dashboard-workspace .dashboard-card { padding: 14px; }
    .dashboard-workspace .panel-header { margin-bottom: 8px; }
    .dashboard-workspace .panel-header p { font-size: 12px; }
    .trend-mode select { max-width: 115px; min-height: 36px; font-size: 11px; }
    .dashboard-workspace .spending-progress-chart { height: 150px; min-height: 150px; }
    .spending-categories .panel-header p:not([data-scope="outside"]) { display: none; }
    .category-composition { display: block; min-height: 0; }
    .dashboard-workspace .category-ring { display: none; }
    .category-breakdown { max-height: none; }
    .category-detail > summary { grid-template-columns: minmax(0,1fr) auto 10px; gap: 6px 10px; padding: 10px 0; }
    .category-dot, .category-value small { display: none; }
    .category-value { grid-column: 2; grid-row: auto; justify-content: end; font-size: 14px; }
    .category-name { font-size: 13px; }
    .category-track { display: block; grid-column: 1 / -1; height: 9px; border-radius: 5px; background: #edf0f4; overflow: hidden; }
    .category-chevron { grid-row: 1; }
    .category-load-more { min-height: 44px; }
    .category-fill { display: block; height: 100%; border-radius: inherit; }
    .dashboard-lists { grid-template-columns: minmax(0,1fr); gap: 14px; }
    .recent-expense-list > li { gap: 9px; }
    .recent-expense-amount { max-width: 115px; }
    .payment-row > summary { gap: 8px; grid-template-columns: 32px minmax(0,1fr) auto 12px; }
    .payment-row > summary .expense-category-icon { width: 32px; height: 32px; }
    .payment-section .payment-amount { max-width: 105px; font-size: 13px; }
    .payment-row-detail { padding-left: 0; }
    .payment-section .payment-actions .btn, .payment-section .payment-actions > .icon-btn, .payment-section .payment-reject > summary { min-height: 44px; min-width: 44px; }
    .dashboard-workspace .dashboard-grid { grid-template-columns: minmax(0,1fr); }
    .dashboard-workspace .dashboard-history { padding: 10px 12px; }
    .dashboard-workspace .dashboard-history .panel-header,
    .dashboard-workspace .upcoming-reminders .panel-header { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px; margin-bottom: 4px; }
    .dashboard-workspace .dashboard-history .panel-header h2,
    .dashboard-workspace .upcoming-reminders .panel-header h2 { font-size: 16px; line-height: 1.3; }
    .dashboard-workspace .dashboard-history .panel-header a,
    .dashboard-workspace .upcoming-reminders .panel-header a { font-size: 12px; min-height: 44px; }
    .dashboard-workspace .upcoming-reminders { padding: 8px 12px; }
    .upcoming-reminders .reminder-empty { display: flex; align-items: center; gap: 8px; margin: 2px 0 6px; font-size: 13px; line-height: 1.4; color: var(--muted); }
    .upcoming-reminders .reminder-empty > svg { width: 20px; height: 20px; flex: 0 0 20px; }
    .upcoming-reminders .list-row { padding-block: 8px; min-height: 44px; font-size: 13px; }
    .upcoming-reminders .list-row small { font-size: 12px; }
    .dashboard-workspace .dashboard-notices { gap: 8px; }
    .dashboard-workspace .alert-strip { padding: 10px 12px; gap: 8px; font-size: 13px; line-height: 1.4; }
    .dashboard-workspace .alert-strip > svg { width: 20px; height: 20px; flex: 0 0 20px; }
    .dashboard-workspace .dashboard-analysis > summary { min-height: 44px; padding: 6px 0; gap: 8px; font-size: 14px; }
    .dashboard-workspace .section-empty { min-height: 0; display: grid; grid-template-columns: 24px minmax(0,1fr); gap: 2px 8px; padding: 10px 0; text-align: left; align-items: center; }
    .dashboard-workspace .section-empty .empty-icon { grid-column: 1; grid-row: 1 / span 2; width: 24px; height: 24px; margin: 0; }
    .dashboard-workspace .section-empty .empty-icon svg { width: 16px; height: 16px; }
    .dashboard-workspace .section-empty h3 { grid-column: 2; margin: 0; font-size: 14px; }
    .dashboard-workspace .section-empty p { grid-column: 2; font-size: 12px; }
    .dashboard-savings { font-size: 14px; }
    .phone-navigation { display: grid; grid-auto-columns: minmax(0,1fr); grid-auto-flow: column; position: fixed; z-index: 50; bottom: 0; left: 0; right: 0; padding: 7px max(8px,env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left)); background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -3px 16px rgba(24,43,69,.035); }
    .phone-navigation > a, .phone-navigation > button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0; min-height: 52px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 11px; padding: 2px; cursor: pointer; border-radius: 6px; }
    .phone-navigation > .is-active { color: var(--primary); font-weight: 650; }
    .phone-navigation svg { width: 22px; height: 22px; }
    .phone-navigation .phone-add svg { width: 44px; height: 32px; padding: 4px 10px; background: var(--primary); color: white; border-radius: 7px; box-shadow: 0 2px 6px #0078d42a; }
    .phone-navigation > a:focus-visible, .phone-navigation > button:focus-visible { outline-offset: -3px; }
    html { scroll-padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
}
@media (max-width: 359px) {
    .dashboard-overview .balance-main strong { font-size: 34px; }
    .overview-metrics dd { font-size: 15px; }
    .mobile-bills-shortcut { gap: 5px; padding-inline: 9px; font-size: 11px; }
    .mobile-bills-shortcut > strong { font-size: 12px; }
    .dashboard-workspace h2 { font-size: 16px; }
    .trend-mode select { max-width: 104px; }
    .recent-expense-list > li { grid-template-columns: 30px minmax(0,1fr) auto; }
    .recent-expense-list .expense-category-icon { width: 30px; height: 30px; }
    .recent-expense-amount { max-width: 92px; }
    .recent-expense-amount > strong { font-size: 12px; }
}

.module-switch { display: flex; gap: 4px; padding: 4px; background: #f0f2f5; border-radius: 8px; margin: 0 6px 14px; }
.module-switch a { flex: 1; min-height: 44px; display: flex; align-items: center; justify-content: center; font-weight: 600; color: #5b687a; }
.module-switch a.active { background: #fff; color: #0078d4; border-radius: 6px; box-shadow: 0 1px 3px #182b4510; }
.nav-list .module-switch a { min-width:0; padding:8px 4px; font-size:13px; gap:0; }

/* Dense financial records; disclosures retain the full detail and native keyboard support. */
.compact-finance-page .topbar { margin-bottom: 16px; }
.compact-finance-page .toolbar { margin-bottom: 14px; gap: 10px; }
.compact-finance-page .view-links { margin-bottom: 12px; gap: 6px 18px; }
.compact-finance-page .panel-header { margin-bottom: 12px; }
.expense-register { padding: 16px 20px; }
.expense-register .panel-header h2 { font-size: 18px; }
.expense-register .panel-header small { font-size: 12px; }
.expense-detail-page .metric-card { padding: 12px 14px; }
.expense-detail-page .metric-card strong { font-size: 20px; margin-block: 4px; }
.expense-detail-page .metric-card span, .expense-detail-page .details-grid dt { font-size: 12px; }
.expense-detail-page .panel { padding: 16px; }
.expense-list { list-style: none; padding: 0; margin: 0; }
.expense-item { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: start; border-top: 1px solid var(--line); column-gap: 4px; }
.expense-item > details { min-width: 0; }
.expense-disclosure > summary { display: grid; grid-template-columns: minmax(0,1fr) minmax(100px,160px) minmax(100px,140px) 18px; align-items: center; gap: 3px 16px; padding: 10px 4px; min-height: 66px; cursor: pointer; list-style: none; border-radius: 4px; }
.expense-disclosure > summary::-webkit-details-marker, .expense-delete > summary::-webkit-details-marker, .plan-add-disclosure > summary::-webkit-details-marker { display: none; }
.expense-disclosure > summary:hover { background: var(--bg); }
.expense-disclosure > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.expense-item-name { grid-column: 1; grid-row: 1; min-width: 0; font-size: 14px; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
.expense-item-amount { grid-column: 3; grid-row: 1 / span 2; font-size: 15px; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; line-height: 1.3; }
.expense-item-meta { grid-column: 1; grid-row: 2; display: flex; align-items: center; flex-wrap: wrap; gap: 3px 8px; min-width: 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.expense-item-meta > span { overflow-wrap: anywhere; }
.expense-item-meta .record-author { margin: 0; display: inline-flex; }
.expense-item-meta .record-author-initials { width: 20px; height: 20px; font-size: 10px; }
.expense-item-meta .record-author-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.expense-item-category { grid-column: 2; grid-row: 1 / span 2; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.expense-item-flags { grid-column: 1 / 3; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.expense-item-flags:empty { display: none; }
.expense-item-flags .status { margin: 0; padding: 1px 6px; font-size: 11px; line-height: 1.5; white-space: normal; }
.expense-item-flags .status svg { width: 12px; height: 12px; }
.expense-item-chevron { grid-column: 4; grid-row: 1 / span 2; width: 16px; height: 16px; color: var(--muted); }
.expense-disclosure[open] > summary .expense-item-chevron { transform: rotate(180deg); }
.expense-item-edit { width: 44px; height: 44px; min-width: 44px; margin-top: 9px; border: 0; background: transparent; }
.expense-item-edit svg { width: 17px; height: 17px; }
.expense-item-details { padding: 8px 4px 14px; border-top: 1px dashed var(--line); }
.expense-facts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px 20px; margin: 0 0 10px; }
.expense-facts > div { min-width: 0; }
.expense-facts dt { color: var(--muted); font-size: 12px; }
.expense-facts dd { margin: 2px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.expense-item-details > .record-author { margin: 0 0 8px; }
.expense-item-actions { display: flex; flex-wrap: wrap; align-items: start; gap: 8px 12px; }
.expense-item-actions .btn, .expense-delete > summary { min-height: 44px; font-size: 13px; }
.expense-delete > summary { display: inline-flex; align-items: center; gap: 6px; color: var(--danger); padding: 8px; cursor: pointer; list-style: none; }
.expense-delete > summary svg { width: 16px; height: 16px; }
.expense-delete form { display: grid; gap: 8px; margin: 6px 0; }
.expense-form-surface { max-width: 720px; padding: 18px 20px; }
.simple-expense-form, .simple-expense-form .grid-form, .budget-plan-section .grid-form { gap: 10px 14px; }
.simple-expense-form label, .budget-plan-section label { gap: 4px; font-size: 13px; }
.simple-expense-form input:not([type=checkbox]), .simple-expense-form select,
.budget-plan-section input:not([type=checkbox]), .budget-plan-section select { min-height: 44px; padding: 8px 10px; font-size: 16px; }
.simple-expense-form textarea { padding: 8px 10px; font-size: 16px; min-height: 80px; }
.simple-expense-form .check-card, .budget-plan-section .check-card { padding: 8px 10px; min-height: 44px; }
.simple-expense-form .form-details { padding: 0; margin: 0; }
.simple-expense-form .form-details > summary { padding: 8px 0; min-height: 44px; font-size: 14px; }
.simple-expense-form .form-details[open] > summary { margin-bottom: 8px; }
.simple-expense-form .funding-effect { font-size: 12px; line-height: 1.45; }
.simple-expense-form .form-actions { margin: 0; gap: 8px; }
.simple-expense-form .form-actions .btn { min-height: 44px; padding: 8px 14px; font-size: 14px; }
.expense-edit-context { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12px; color: var(--muted); }
.expense-edit-context .status { margin: 0; }
.expense-receipt-details > summary { display: flex; align-items: center; gap: 6px; }
.expense-receipt-details > summary svg { width: 16px; height: 16px; }
.expense-receipt-details > summary .muted { font-weight: 400; font-size: 12px; margin-left: auto; }
.budget-plan-section { margin-top: 14px; padding: 16px 20px; }
.budget-plan-table td, .budget-plan-table th { padding: 8px 10px; font-size: 14px; }
.budget-plan-section .plan-edit > summary { min-height: 44px; display: flex; align-items: center; color: var(--primary); cursor: pointer; font-size: 13px; }
.budget-plan-section .plan-edit .grid-form { margin: 8px 0; }
.plan-add-disclosure > summary { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 0; color: var(--primary); cursor: pointer; font-weight: 600; font-size: 14px; list-style: none; }
.plan-add-disclosure > summary svg { width: 16px; height: 16px; }
.plan-add-disclosure .plan-add-form { margin-top: 6px; padding-top: 10px; }
@media (max-width: 760px) {
    .compact-finance-page .main { padding-left: 12px; padding-right: 12px; }
    .compact-finance-page .topbar { margin-bottom: 10px; }
    .compact-finance-page h1 { font-size: 24px; }
    .compact-finance-page .page-subtitle { display: none; }
    .compact-finance-page .view-links { flex-wrap: nowrap; gap: 0 14px; }
    .compact-finance-page .view-links a { font-size: 12px; min-height: 44px; }
    .compact-finance-page .toolbar > .btn, .compact-finance-page .filter-disclosure > summary { padding: 8px 10px; min-height: 44px; font-size: 13px; }
    .compact-finance-page .toolbar:has(> .filter-disclosure) { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: start; }
    .compact-finance-page .toolbar > .filter-disclosure[open] { grid-column: 1 / -1; }
    .compact-finance-page .toolbar:has(> .filter-disclosure) > .btn { width: auto; }
    .expense-register, .expense-form-surface, .budget-plan-section { padding: 12px; }
    .expense-register .panel-header { gap: 4px; margin-bottom: 8px; }
    .expense-register .panel-header h2 { font-size: 16px; }
    .expense-register .panel-header small { font-size: 11px; }
    .expense-disclosure > summary { grid-template-columns: minmax(0,1fr) minmax(74px,auto) 14px; gap: 3px 6px; padding: 8px 0; min-height: 62px; }
    .expense-item-amount { grid-column: 2; grid-row: 1; font-size: 14px; max-width: 120px; }
    .expense-item-meta { grid-column: 1 / 3; gap: 3px 6px; }
    .expense-item-category { display: none; }
    .expense-item-chevron { grid-column: 3; width: 14px; height: 14px; }
    .expense-item-name { font-size: 14px; }
    .expense-item-flags { grid-column: 1 / -1; }
    .expense-item-edit { margin-top: 8px; }
    .expense-item-details { padding-bottom: 10px; }
    .expense-facts { gap: 6px 12px; }
    .simple-expense-form .form-actions { display: flex; flex-wrap: wrap; }
    .simple-expense-form .form-actions > .btn { flex: 1 1 160px; }
    .simple-expense-form.is-editing .form-actions { padding-top: 8px; border-top: 1px solid var(--line); }
    .budget-plan-page .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
    .expense-detail-page .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
    .expense-detail-page .metric-card { padding: 10px; min-height: 0; }
    .expense-detail-page .metric-card strong { font-size: 17px; }
    .expense-detail-page .metric-card:first-child { grid-column: 1 / -1; }
    .expense-detail-page .metric-card:first-child strong { font-size: 26px; }
    .expense-detail-page .details-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
    .budget-plan-page .metric-card { padding: 10px; min-height: 0; }
    .budget-plan-page .metric-card span { font-size: 12px; }
    .budget-plan-page .metric-card strong { font-size: 18px; margin: 4px 0 0; }
    .budget-plan-page .onboarding-strip { padding: 10px; gap: 8px; margin-block: 12px; }
    .budget-plan-page .onboarding-strip strong { font-size: 14px; }
    .budget-plan-page .onboarding-strip small { font-size: 12px; }
    .budget-plan-page .onboarding-strip .empty-icon { display: none; }
    .budget-plan-table tbody tr { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
    .budget-plan-table tbody td { display: block; padding: 0; border: 0; font-size: 13px; min-width: 0; }
    .budget-plan-table tbody td::before { display: none; }
    .budget-plan-table td:nth-child(1) { grid-column: 1; grid-row: 1; }
    .budget-plan-table td:nth-child(3) { grid-column: 2; grid-row: 1; text-align: right; }
    .budget-plan-table td:nth-child(2) { grid-column: 1; grid-row: 2; color: var(--muted); font-size: 12px; }
    .budget-plan-table td:nth-child(4) { grid-column: 2; grid-row: 2; text-align: right; color: var(--muted); font-size: 12px; }
    .budget-plan-table td:nth-child(5) { grid-column: 1 / -1; grid-row: 3; }
    .budget-plan-section .plan-edit > summary { min-height: 44px; padding-block: 6px; }
    .budget-plan-section .plan-edit .grid-form { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .budget-plan-section .plan-edit label:first-of-type { grid-column: 1 / -1; }
    .budget-plan-section .plan-edit button { grid-column: 1 / -1; min-height: 44px; }
}

/* Scoped density for secondary finance views; existing expense layouts stay unchanged. */
.compact-module-page .topbar { margin-bottom: 16px; }
.compact-module-page .toolbar { gap: 10px; align-items: start; margin-bottom: 14px; }
.compact-module-page .panel { padding: 16px 20px; }
.compact-module-page .panel-header { gap: 8px 16px; margin-bottom: 12px; }
.compact-module-page .panel-header h2 { font-size: 18px; }
.compact-module-page .metric-grid { gap: 10px; margin-bottom: 16px; }
.compact-module-page .metric-card { padding: 12px 14px; min-height: 0; }
.compact-module-page .metric-card span { font-size: 13px; }
.compact-module-page .metric-card strong { font-size: 23px; margin: 5px 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.compact-module-page .metric-card small { font-size: 12px; line-height: 1.4; }
.compact-module-page .empty-state { padding: 20px 14px; }
.compact-module-page .empty-state h2 { font-size: 18px; margin-block: 8px; }
.compact-module-page .empty-state p { font-size: 14px; margin-block: 8px 14px; }
.compact-module-page .filter-disclosure[open] > summary { margin-bottom: 10px; }
.filter-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding-inline: 4px; background: var(--active-bg); color: var(--primary); border-radius: 4px; font-size: 12px; font-weight: 600; }
.compact-record-list { list-style: none; padding: 0; margin: 0; }
.compact-record { display: grid; grid-template-columns: minmax(0,1fr) auto; column-gap: 6px; border-top: 1px solid var(--line); }
.compact-record > details { min-width: 0; }
.compact-record > details:only-child { grid-column: 1 / -1; }
.compact-record-summary { display: grid; grid-template-columns: minmax(0,1fr) auto 16px; gap: 3px 12px; min-height: 64px; padding: 9px 0; align-content: center; cursor: pointer; list-style: none; }
.compact-record-summary::-webkit-details-marker, .compact-delete > summary::-webkit-details-marker { display: none; }
.compact-record-summary:hover { background: var(--bg); }
.compact-record-summary:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.compact-record-title { font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.compact-record-amount { grid-column: 2; font-size: 15px; line-height: 1.4; font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; max-width: 180px; }
.compact-record-meta { grid-column: 1 / 3; display: flex; flex-wrap: wrap; align-items: center; gap: 3px 8px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.compact-record-meta .record-author { margin: 0; }
.compact-record-meta .record-author-initials { width: 20px; height: 20px; font-size: 10px; }
.compact-record-meta .record-author-text { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.compact-record-chevron { grid-column: 3; grid-row: 1 / 3; align-self: center; width: 16px; height: 16px; color: var(--muted); }
.compact-record > details[open] > summary .compact-record-chevron { transform: rotate(180deg); }
.compact-record-flags { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px; }
.compact-record-flags .status { padding: 1px 6px; font-size: 11px; }
.compact-record-edit { width: 44px; height: 44px; min-width: 44px; margin-top: 9px; border: 0; background: transparent; }
.compact-record-edit svg { width: 17px; height: 17px; }
.compact-record-detail { padding: 10px 0 12px; border-top: 1px dashed var(--line); }
.compact-record-note { font-size: 14px; overflow-wrap: anywhere; }
.compact-facts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px 16px; margin: 0 0 10px; }
.compact-facts dt { color: var(--muted); font-size: 12px; }
.compact-facts dd { margin: 2px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.compact-delete > summary { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 0; color: var(--danger); font-size: 13px; list-style: none; cursor: pointer; }
.compact-delete > summary svg { width: 16px; height: 16px; }
.compact-delete form { display: grid; gap: 8px; max-width: 480px; }
.compact-form-surface { max-width: 720px; }
.compact-form, .compact-form .grid-form { gap: 10px 14px; }
.compact-form label { gap: 4px; font-size: 13px; }
.compact-form input:not([type=checkbox]), .compact-form select, .compact-form textarea { min-height: 44px; padding: 8px 10px; font-size: 16px; }
.compact-form .check-card { min-height: 44px; padding: 8px 10px; }
.compact-form .form-details > summary { min-height: 44px; padding: 8px 0; font-size: 14px; }
.compact-form .form-details[open] > summary { margin-bottom: 8px; }
.compact-form-context { color: var(--muted); margin: 4px 0; font-size: 13px; overflow-wrap: anywhere; }
.compact-form .form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.compact-form .form-actions .btn { min-height: 44px; font-size: 14px; padding: 8px 14px; }
.compact-export, .compact-month-create { min-width: 0; }
.compact-export > summary, .compact-month-create > summary { cursor: pointer; list-style: none; }
.compact-export > summary::-webkit-details-marker, .compact-month-create > summary::-webkit-details-marker { display: none; }
.compact-export .toolbar-actions, .compact-month-create form { display: grid; gap: 8px; margin-top: 8px; }
.compact-month-create form { grid-template-columns: repeat(2,minmax(0,1fr)); }
.compact-month-create form button { grid-column: 1 / -1; }
.compact-totals > summary { min-height: 44px; display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--primary); }
.compact-totals > summary::after { content: '+'; margin-left: auto; }
.compact-totals[open] > summary::after { content: '-'; }
.compact-totals[open] > summary { margin-bottom: 10px; }
.expense-register .payment-actions { display: flex; flex-wrap: wrap; align-items: start; gap: 8px; margin-bottom: 10px; }
.expense-register .payment-actions > .icon-btn { display: none; }
.expense-register .payment-confirm-form, .expense-register .payment-reject-form { max-width: 100%; }
@media (max-width: 760px) {
    .compact-module-page .main { padding-inline: 12px; }
    .compact-module-page .topbar { margin-bottom: 10px; }
    .compact-module-page h1 { font-size: 24px; }
    .compact-module-page .page-subtitle { display: none; }
    .compact-module-page .panel { padding: 12px; }
    .compact-module-page .panel-header h2 { font-size: 16px; }
    .compact-module-page .toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
    .compact-module-page .toolbar > .btn, .compact-module-page .filter-disclosure > summary { min-height: 44px; padding: 8px 10px; font-size: 13px; width: auto; }
    .compact-module-page .toolbar > .filter-disclosure[open] { flex-basis: 100%; }
    .compact-module-page .toolbar:has(> .filter-disclosure) { display: grid; grid-template-columns: minmax(0,1fr) auto; }
    .compact-module-page .toolbar > .filter-disclosure[open] { grid-column: 1 / -1; }
    .compact-module-page .toolbar > .inline-form { flex: 1; width: auto; min-width: 0; }
    .compact-module-page .toolbar > .inline-form label { min-width: 0; }
    .compact-module-page .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
    .compact-module-page .metric-card { padding: 10px; }
    .compact-module-page .metric-card span { font-size: 12px; line-height: 1.35; }
    .compact-module-page .metric-card strong { font-size: 18px; }
    .compact-module-page .metric-card small { font-size: 11px; }
    .compact-module-page .metric-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
    .compact-record-summary { gap: 3px 6px; }
    .compact-record-amount { font-size: 14px; max-width: 124px; }
    .compact-module-page .panel-header .btn.small { min-height: 44px; padding: 6px 8px; font-size: 12px; }
    .compact-module-page .panel-header { flex-direction: row; align-items: center; flex-wrap: wrap; }
    .compact-export { margin-left: auto; }
    .compact-export > summary { min-height: 44px; font-size: 13px; padding: 8px 10px; }
    .compact-export[open] { flex-basis: 100%; }
    .compact-month-create { flex: 1 1 100%; }
    .compact-month-table tbody tr { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4px 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
    .compact-month-table tbody td { display: block; border: 0; padding: 0; min-width: 0; font-size: 13px; }
    .compact-month-table tbody td::before, .compact-person-table tbody td::before { display: none; }
    .compact-month-table td:nth-child(1) { grid-column: 1; grid-row: 1; }
    .compact-month-table td:nth-child(2) { grid-column: 1; grid-row: 2; font-size: 11px; color: var(--muted); }
    .compact-month-table td:nth-child(3) { grid-column: 1; grid-row: 3; }
    .compact-month-table td:nth-child(4) { grid-column: 2; grid-row: 1 / 4; align-self: center; }
    .compact-month-table .btn { min-height: 44px; font-size: 12px; padding: 6px 8px; }
    .compact-person-table tbody tr { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4px 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
    .compact-person-table tbody td { display: block; border: 0; padding: 0; font-size: 14px; }
    .compact-person-table td:nth-child(2) { text-align: right; }
    .compact-person-table td:nth-child(3) { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
    .expense-register .payment-actions .btn, .expense-register .payment-actions .icon-btn { min-height: 44px; }
}

/* Authorship is a compact identity marker, not a second payer label. */
.record-author {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; min-width: 24px; flex: 0 0 24px;
    margin: 0; padding: 0; gap: 0; border-radius: 50%; vertical-align: middle;
    cursor: help; line-height: 1;
}
.record-author > .record-author-initials {
    display: grid; place-items: center; width: 24px; height: 24px; flex: none;
    border-radius: 50%; font-size: 11px; line-height: 1; font-weight: 700;
    background: hsl(var(--author-hue) var(--author-saturation) 92%);
    color: hsl(var(--author-hue) var(--author-saturation) 25%);
}
.record-author:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.record-author-tooltip {
    position: fixed; z-index: 2000; width: max-content; max-width: min(280px, calc(100vw - 16px));
    padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px;
    background: var(--surface); color: var(--text); box-shadow: 0 3px 12px #182b4520;
    font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; pointer-events: none;
}
.record-author-tooltip[hidden] { display: none; }

.quick-amount-link { color:inherit; font-weight:700; font-variant-numeric:tabular-nums; text-decoration:underline dotted; text-underline-offset:4px; min-height:44px; display:inline-flex; align-items:center; justify-content:flex-end; }
.quick-amount-link:hover, .quick-amount-link:focus-visible { color:var(--primary,#0078d4); text-decoration-style:solid; }
.finance-dialog { width:min(420px,calc(100% - 24px)); max-height:calc(100dvh - 32px); overflow:auto; border:1px solid #e2e7ee; border-radius:8px; padding:20px; color:#182b45; background:#fff; box-shadow:0 16px 56px #182b4529; }
.finance-dialog::backdrop { background:#182b4566; }
.finance-dialog h2 { font-size:20px; margin:0 0 12px; }
.finance-dialog p { margin:0 0 16px; overflow-wrap:anywhere; }
.finance-dialog label { display:grid; gap:6px; }
.finance-dialog input { width:100%; min-width:0; font-size:16px; }
.finance-dialog-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:20px; }
.category-select { display:flex; align-items:center; gap:6px; min-width:0; }
.category-select select { flex:1; min-width:0; width:0; }
.category-select .icon-btn { flex:0 0 44px; width:44px; height:44px; }
.category-dialog { display:none; }
.category-dialog[open] { display:flex; flex-direction:column; gap:12px; }
.category-dialog h2, .category-dialog p { margin:0; }
.category-results { overflow:auto; min-height:80px; max-height:50dvh; display:flex; flex-direction:column; overscroll-behavior:contain; }
.category-option { border:0; border-bottom:1px solid #e2e7ee; background:#fff; color:#182b45; text-align:left; padding:12px; min-height:44px; flex-shrink:0; font:inherit; cursor:pointer; overflow-wrap:anywhere; }
.category-option:hover, .category-option:focus-visible, .category-option[aria-pressed="true"] { background:#eaf3fc; color:#005a9e; }
.undo-notice { position:fixed; z-index:90; right:16px; bottom:90px; width:min(380px,calc(100% - 32px)); display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 14px; margin:0; border:1px solid #e2e7ee; border-left:3px solid #0078d4; border-radius:8px; background:#fff; box-shadow:0 4px 20px #182b451f; }
.undo-notice form { margin:0; }
@media (max-width:600px) {
    .finance-dialog { padding:16px; }
}
