:root {
    --color-positive: #45a878;
    --color-negative: #df7272;
    --color-income: #45a878;
    --color-expense: #df7272;
    --color-text: #edf2f4;
    --color-text-strong: #ffffff;
    --color-muted: #9caab1;
    --color-subtle: #718087;
    --color-line: #26363d;
    --color-line-strong: #354850;
    --color-panel: #121b20;
    --color-panel-raised: #172228;
    --color-bg: #0a1115;
    --color-field: #0d161b;
    --color-field-hover: #111d22;
    --color-accent: #74c7cf;
    --color-accent-strong: #36737a;
    --color-accent-soft: rgba(102, 180, 189, 0.12);
    --color-danger-soft: rgba(223, 114, 114, 0.12);
    --color-success-soft: rgba(69, 168, 120, 0.12);
    --radius-sm: 7px;
    --radius-md: 11px;
    --radius-lg: 16px;
    --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.14);
    color-scheme: dark;
}

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

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

body::before {
    background: radial-gradient(circle at 50% -12rem, rgba(102, 180, 189, 0.09), transparent 38rem);
    content: "";
    inset: 0 0 auto;
    height: 34rem;
    pointer-events: none;
    position: fixed;
    z-index: -1;
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { color: #a0e2e8; }
h1, h2, h3, p { margin-top: 0; }
h1 { color: var(--color-text-strong); font-size: clamp(1.55rem, 2.5vw, 2rem); letter-spacing: -0.025em; line-height: 1.2; margin-bottom: 0.35rem; }
h2 { color: var(--color-text-strong); font-size: 1.15rem; line-height: 1.3; margin-bottom: 0.5rem; }
h3 { font-size: 1rem; margin-bottom: 0.35rem; }
p:last-child { margin-bottom: 0; }
small, .help-text { color: var(--color-muted); font-size: 0.84rem; }

.skip-link {
    background: var(--color-accent);
    color: #071114;
    left: 1rem;
    padding: 0.65rem 1rem;
    position: fixed;
    top: -5rem;
    z-index: 100;
}
.skip-link:focus { top: 1rem; }

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

button, .button, .button-link {
    align-items: center;
    background: var(--color-panel-raised);
    border: 1px solid var(--color-line-strong);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    cursor: pointer;
    display: inline-flex;
    font-weight: 650;
    gap: 0.4rem;
    justify-content: center;
    line-height: 1.2;
    min-height: 42px;
    padding: 0.65rem 0.9rem;
    transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}
button:hover, .button:hover, .button-link:hover { background: #1d2b31; border-color: #50656d; color: var(--color-text-strong); }
button:active, .button:active { transform: translateY(1px); }
button.primary, .button.primary, .primary {
    background: var(--color-accent-strong);
    border-color: #4a8c93;
    color: #fff;
}
button.primary:hover, .button.primary:hover { background: #43828a; border-color: #65aab2; }
button.danger, .button.danger, .danger {
    background: transparent;
    border-color: rgba(223, 114, 114, 0.5);
    color: #f09a9a;
}
button.danger:hover, .button.danger:hover { background: var(--color-danger-soft); border-color: var(--color-negative); color: #ffc0c0; }
.button.small, button.small { min-height: 34px; padding: 0.4rem 0.65rem; }
.button.ghost, button.ghost { background: transparent; border-color: transparent; color: var(--color-muted); }
.link-button, .menu-action {
    background: transparent;
    border: 0;
    color: var(--color-accent);
    justify-content: flex-start;
    min-height: auto;
    padding: 0;
}
:focus-visible { outline: 3px solid rgba(116, 199, 207, 0.45); outline-offset: 2px; }

.topbar {
    backdrop-filter: blur(14px);
    background: rgba(10, 17, 21, 0.9);
    border-bottom: 1px solid rgba(53, 72, 80, 0.7);
    position: sticky;
    top: 0;
    z-index: 40;
}
.topbar-inner {
    align-items: center;
    display: flex;
    gap: 1.5rem;
    margin: 0 auto;
    max-width: 1220px;
    min-height: 64px;
    padding: 0 1.25rem;
}
.brand { align-items: center; color: var(--color-text-strong); display: flex; font-size: 1.05rem; font-weight: 800; gap: 0.6rem; letter-spacing: -0.02em; }
.brand:hover { color: #fff; }
.brand-mark { align-items: center; background: linear-gradient(145deg, #75cbd3, #2f6970); border-radius: 9px; color: #071114; display: inline-flex; font-weight: 900; height: 32px; justify-content: center; width: 32px; }
.topnav { align-items: stretch; align-self: stretch; display: flex; gap: 0.15rem; }
.nav-link { align-items: center; border-bottom: 2px solid transparent; color: var(--color-muted); display: flex; font-size: 0.92rem; font-weight: 600; padding: 0 0.75rem; }
.nav-link:hover { color: var(--color-text); }
.nav-link.active { border-bottom-color: var(--color-accent); color: var(--color-text-strong); }
.nav-more { margin-left: auto; position: relative; }
.nav-more > summary { align-items: center; border: 1px solid var(--color-line); border-radius: 999px; color: var(--color-muted); cursor: pointer; display: flex; font-weight: 650; list-style: none; min-height: 38px; padding: 0 0.85rem; }
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more > summary::after { content: "⌄"; margin-left: 0.45rem; }
.nav-more[open] > summary { background: var(--color-panel-raised); color: var(--color-text); }
.nav-menu { background: var(--color-panel-raised); border: 1px solid var(--color-line-strong); border-radius: var(--radius-md); box-shadow: 0 18px 50px rgba(0,0,0,.35); display: grid; min-width: 220px; padding: 0.45rem; position: absolute; right: 0; top: calc(100% + 0.55rem); }
.nav-menu > a, .nav-menu .menu-action { border-radius: var(--radius-sm); color: var(--color-text); font-weight: 550; min-height: 40px; padding: 0.58rem 0.7rem; width: 100%; }
.nav-menu > a:hover, .nav-menu > a.active, .nav-menu .menu-action:hover { background: var(--color-accent-soft); color: var(--color-text-strong); }
.nav-menu form { margin: 0; }
.mobile-only { display: none; }
.nav-user { border-bottom: 1px solid var(--color-line); display: grid; margin-bottom: 0.35rem; padding: 0.5rem 0.7rem 0.75rem; }
.nav-user small { overflow: hidden; text-overflow: ellipsis; }

.app-shell, .auth-shell { margin: 0 auto; max-width: 1220px; padding: 1.5rem 1.25rem 5rem; width: 100%; }
.auth-body { align-items: center; display: flex; min-height: 100vh; }
.auth-shell { max-width: 520px; }
.auth-shell.wide { max-width: 760px; }
.auth-brand { justify-content: center; margin: 0 auto 1.25rem; }
.auth-card { padding: 1.4rem; }
.auth-card > header { margin-bottom: .35rem; }
.install-intro { border-bottom: 1px solid var(--color-line); margin-bottom: 1.25rem !important; padding-bottom: 1.25rem; }

.page-header {
    align-items: flex-start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}
.page-header p, .page-description { color: var(--color-muted); margin: 0; max-width: 68ch; }
.page-actions, .actions, .export-actions, .form-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 0.55rem; }
.page-actions { flex: 0 0 auto; justify-content: flex-end; }
.eyebrow { color: var(--color-accent); display: block; font-size: 0.76rem; font-weight: 750; letter-spacing: 0.08em; margin-bottom: 0.25rem; text-transform: uppercase; }
.section-heading { align-items: center; display: flex; gap: 1rem; justify-content: space-between; margin-bottom: 0.9rem; }
.section-heading h1, .section-heading h2 { margin-bottom: 0; }
.section-heading > div { min-width: 0; }
.section-context { color: var(--color-muted); }
.summary-total { font-size: 1.2rem; white-space: nowrap; }

.panel, .month-card {
    background: var(--color-panel);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    margin-bottom: 1rem;
    padding: 1.15rem;
}
.panel.compact { padding: 0.8rem 1rem; }
.panel.subtle { background: rgba(18, 27, 32, 0.62); box-shadow: none; }
.panel-header { align-items: center; display: flex; gap: 1rem; justify-content: space-between; margin-bottom: 1rem; }
.panel-header > :first-child { min-width: 0; }
.panel-header h2 { margin: 0; }
.panel-header p { color: var(--color-muted); margin: 0.2rem 0 0; }
.panel-footer { border-top: 1px solid var(--color-line); margin: 1rem -1.15rem -1.15rem; padding: 0.9rem 1.15rem; }

.disclosure { padding: 0; }
.disclosure > summary { align-items: center; cursor: pointer; display: flex; gap: 0.75rem; justify-content: space-between; list-style: none; min-height: 54px; padding: 0.8rem 1.05rem; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::after { color: var(--color-muted); content: "+"; font-size: 1.35rem; line-height: 1; }
.disclosure[open] > summary::after { content: "−"; }
.disclosure[open] > summary { border-bottom: 1px solid var(--color-line); }
.disclosure-title { display: grid; }
.disclosure-title strong { color: var(--color-text-strong); }
.disclosure-body { padding: 1rem 1.05rem; }

.form-stack { display: grid; gap: 1rem; }
.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: 1 / -1; }
.field, .form-stack label, .toolbar label, .filters label { color: var(--color-muted); display: grid; font-size: 0.88rem; font-weight: 600; gap: 0.4rem; }
.field-label { color: var(--color-muted); font-size: 0.88rem; font-weight: 600; }
input, select, textarea {
    background: var(--color-field);
    border: 1px solid var(--color-field-border, var(--color-line-strong));
    border-radius: var(--radius-sm);
    color: var(--color-text);
    min-height: 43px;
    padding: 0.6rem 0.7rem;
    width: 100%;
}
input:hover, select:hover, textarea:hover { background: var(--color-field-hover); border-color: #486069; }
input:focus, select:focus, textarea:focus { border-color: var(--color-accent); outline: 3px solid rgba(116, 199, 207, 0.13); }
input::placeholder, textarea::placeholder { color: #68767d; }
textarea { min-height: 96px; resize: vertical; }
input[type="color"] { max-width: 100px; padding: 0.3rem; }
input[type="checkbox"], input[type="radio"] { min-height: auto; width: auto; }
.input-with-suffix { align-items: center; display: grid; grid-template-columns: 1fr auto; }
.input-with-suffix input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-suffix { align-items: center; align-self: stretch; background: var(--color-panel-raised); border: 1px solid var(--color-line-strong); border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--color-muted); display: flex; padding: 0 0.75rem; }
.form-actions { border-top: 1px solid var(--color-line); justify-content: flex-end; margin-top: 0.25rem; padding-top: 1rem; }
.form-note { background: var(--color-accent-soft); border-radius: var(--radius-sm); color: var(--color-muted); padding: 0.75rem; }
.transaction-form { display: grid; gap: 0; }
.form-section { border: 0; border-bottom: 1px solid var(--color-line); margin: 0; padding: 0.3rem 0 1.25rem; }
.form-section + .form-section { padding-top: 1.25rem; }
.form-section-heading { align-items: flex-start; display: flex; gap: 0.75rem; margin-bottom: 1rem; }
.form-section-heading h2 { margin: 0; }
.form-section-heading p { color: var(--color-muted); margin: 0.15rem 0 0; }
.step-number { align-items: center; background: var(--color-accent-soft); border: 1px solid rgba(116,199,207,.22); border-radius: 999px; color: var(--color-accent); display: inline-flex; flex: 0 0 28px; font-size: .78rem; font-weight: 800; height: 28px; justify-content: center; }
.optional-section > summary { cursor: pointer; list-style: none; padding: 0; }
.optional-section > summary::-webkit-details-marker { display: none; }
.optional-section > summary > span { display: grid; padding-right: 2rem; position: relative; }
.optional-section > summary > span::after { color: var(--color-muted); content: "+"; font-size: 1.35rem; position: absolute; right: .25rem; top: .1rem; }
.optional-section[open] > summary > span::after { content: "−"; }
.optional-section .optional-fields { margin-top: 1rem; }
.inline-form { align-items: end; display: flex; flex-wrap: wrap; gap: 0.55rem; }
.inline-form > input, .inline-form > select, .inline-form > .field { flex: 1 1 180px; }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
hr { border: 0; border-top: 1px solid var(--color-line); margin: 0.4rem 0; width: 100%; }

.toolbar, .filters { align-items: end; display: grid; gap: 0.75rem; }
.toolbar { grid-template-columns: repeat(2, minmax(130px, 1fr)) auto; }
.toolbar-compact { grid-template-columns: minmax(150px, 1fr) auto; }
.filters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.filter-actions { align-items: center; display: flex; gap: 0.5rem; }
.filter-summary { color: var(--color-muted); font-size: 0.88rem; }

.table-wrap { margin: 0 -0.35rem; overflow-x: auto; padding: 0 0.35rem; }
table { border-collapse: collapse; width: 100%; }
th, td { border-bottom: 1px solid var(--color-line); padding: 0.75rem 0.65rem; text-align: left; vertical-align: middle; }
th { color: var(--color-muted); font-size: 0.76rem; font-weight: 750; letter-spacing: 0.045em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(116, 199, 207, 0.035); }
.cell-number { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.cell-actions { text-align: right; white-space: nowrap; }
.cell-main { color: var(--color-text-strong); font-weight: 700; }
.cell-stack { display: grid; gap: 0.12rem; }
.cell-stack small { color: var(--color-muted); }
.status { align-items: center; border-radius: 999px; display: inline-flex; font-size: 0.76rem; font-weight: 700; gap: 0.35rem; padding: 0.25rem 0.55rem; white-space: nowrap; }
.status.active, .status.success { background: var(--color-success-soft); color: #8fdbb1; }
.status.archived, .status.neutral { background: rgba(156,170,177,.1); color: var(--color-muted); }
.status.warning { background: rgba(224,189,87,.11); color: #e8ca75; }

.summary-grid { display: grid; gap: 0.75rem; grid-template-columns: repeat(3, 1fr); }
.summary-grid > div { background: rgba(13,22,27,.6); border: 1px solid var(--color-line); border-radius: var(--radius-md); padding: 0.9rem; }
.summary-grid span, .transaction-row small { color: var(--color-muted); display: block; font-size: 0.84rem; }
.summary-grid strong { display: block; font-size: clamp(1.05rem, 2vw, 1.35rem); font-variant-numeric: tabular-nums; margin-top: 0.25rem; }
.money-positive, .money-income { color: var(--color-income); }
.money-negative, .money-expense { color: var(--color-expense); }
.money-neutral { color: var(--color-accent); }
.opening-balance-change { display: grid; gap: .45rem; min-width: 280px; text-align: left; white-space: normal; }
.opening-balance-change > strong { color: var(--color-accent); font-size: .7rem; letter-spacing: .035em; text-transform: uppercase; }
.opening-balance-change dl { background: rgba(7,16,21,.42); border: 1px solid var(--color-line); border-radius: 9px; display: grid; grid-template-columns: 1fr 1fr; margin: 0; overflow: hidden; }
.opening-balance-change dl > div { display: grid; padding: .42rem .5rem; }
.opening-balance-change dl > div:nth-child(odd) { border-right: 1px solid var(--color-line); }
.opening-balance-change dl > div:nth-child(-n+2) { border-bottom: 1px solid var(--color-line); }
.opening-balance-change dt { color: var(--color-muted); font-size: .62rem; }
.opening-balance-change dd { font-size: .76rem; font-variant-numeric: tabular-nums; font-weight: 700; margin: .08rem 0 0; }
.opening-balance-change small { font-size: .66rem; }
.opening-balance-scope { margin: .8rem .35rem 0; }

.transaction-list { border-top: 1px solid var(--color-line); }
.transaction-row { align-items: center; border-bottom: 1px solid var(--color-line); display: flex; gap: 1rem; justify-content: space-between; padding: 0.75rem 0.25rem; }
.transaction-row:hover { background: rgba(116,199,207,.035); }
.transaction-row > span:first-child { min-width: 0; }
.transaction-row > span:last-child { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.transaction-row strong { overflow-wrap: anywhere; }

.tree { display: grid; gap: 0.65rem; margin-bottom: 1rem; }
.tree-node { background: var(--color-panel); border: 1px solid var(--color-line); border-radius: var(--radius-md); overflow: hidden; }
.tree-node summary { align-items: center; cursor: pointer; display: flex; gap: 0.65rem; justify-content: space-between; list-style: none; min-height: 46px; padding: 0.65rem 0.85rem; }
.tree-node summary::before { color: var(--color-muted); content: "+"; flex: 0 0 1rem; font-weight: 700; }
.tree-node[open] > summary::before { content: "−"; }
.tree-node summary span { flex: 1 1 auto; }
.tree-node summary::-webkit-details-marker { display: none; }
.tree-node.nested { border-bottom: 0; border-radius: 0; border-right: 0; margin: 0; }
.tree-kind > summary { background: var(--color-panel-raised); font-weight: 750; }
.tree-category { background: #121d23; border-left: 3px solid var(--color-accent); }
.tree-category > summary { padding-left: 1rem; }
.tree-subcategory { background: var(--color-panel); border-left: 3px solid var(--color-line); }
.tree-subcategory > summary { padding-left: 1.35rem; }
.tree-day { background: rgba(7,16,21,.28); border-left: 3px solid rgba(98,201,218,.3); }
.tree-day > summary { padding-left: 1.7rem; }
.tree-day .transaction-list { margin-left: 1.7rem; }
.transfer-tree > summary { background: linear-gradient(145deg,rgba(98,201,218,.09),var(--color-panel-raised)); }
.transfer-tree > summary > span:first-of-type { align-items: center; display: flex; gap: .5rem; }
.transfer-tree .status { flex: 0 0 auto; }
.transfer-tree-totals { display: grid; flex: 0 0 auto !important; gap: .1rem; text-align: right; }
.transfer-tree-totals small { color: var(--color-muted); font-size: .68rem; font-weight: 600; white-space: nowrap; }
.tree-transfer-direction { border-left: 3px solid var(--color-accent); }
.tree-transfer-direction > summary { padding-left: 1rem; }
.tree-transfer-direction .transaction-list { margin-left: 1rem; }
.transfer-row { color: var(--color-text); }
.transfer-row > span:last-child { color: var(--color-accent); }

.report-table { font-size: 0.95rem; }
.report-summary { margin-bottom: 1rem; }
.report-table th:not(:first-child), .report-table td:not(:first-child) { text-align: right; white-space: nowrap; }
.report-table tfoot th { border-top: 2px solid var(--color-line-strong); color: var(--color-text); }
.report-table tfoot th.money-positive { color: var(--color-income); }
.report-table tfoot th.money-negative { color: var(--color-expense); }
.annual-report-table th > span { display: block; font-size: .68rem; font-weight: 600; letter-spacing: 0; margin-top: .15rem; text-transform: none; }
.report-value { display: block; font-size: calc(1em + 1px); }
.report-transfer { color: #b9c3c8; display: block; font-size: .7rem; font-variant-numeric: tabular-nums; font-weight: 600; line-height: 1.3; margin-top: .2rem; }
.report-transfer-label, .report-transfer-value { display: block; }
.expense-chart .section-heading strong { font-size: 1.15rem; white-space: nowrap; }
.chart-bars { display: grid; gap: 0.45rem; }
.chart-row { align-items: center; display: grid; gap: 0.7rem; grid-template-columns: minmax(130px, 22%) minmax(120px, 1fr) auto; }
.chart-toggle { align-items: center; color: var(--color-text); display: flex; gap: 0.5rem; min-width: 0; }
.chart-toggle a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-bar-link { background: var(--color-field); border: 1px solid var(--color-line); border-radius: 999px; display: block; height: 1.25rem; overflow: hidden; }
.chart-bar { background: var(--bar-color); border-radius: inherit; display: block; height: 100%; transition: width 160ms ease; width: var(--bar-width); }
.chart-amount { font-variant-numeric: tabular-nums; white-space: nowrap; }

.flash { border: 1px solid transparent; border-radius: var(--radius-md); margin-bottom: 1rem; padding: 0.75rem 0.9rem; }
.flash.success { background: var(--color-success-soft); border-color: rgba(69,168,120,.25); color: #a3e2bf; }
.flash.error { background: var(--color-danger-soft); border-color: rgba(223,114,114,.25); color: #f1aaaa; }
.warning { color: #e8ca75; }
.confirmation-dialog {
    background: transparent;
    border: 0;
    color: var(--color-text);
    max-height: calc(100dvh - 2rem);
    max-width: none;
    padding: 0;
    width: min(440px, calc(100% - 2rem));
}
.confirmation-dialog::backdrop { backdrop-filter: blur(4px); background: rgba(2,8,11,.76); }
.confirmation-dialog[open] { display: block; }
.confirmation-dialog-card { background: var(--color-panel-raised); border: 1px solid var(--color-line-strong); border-radius: var(--radius-lg); box-shadow: 0 24px 70px rgba(0,0,0,.55); overflow: hidden; padding: 1.2rem; }
.confirmation-dialog-card > header { align-items: flex-start; display: flex; gap: .8rem; }
.confirmation-dialog-card h2 { margin: 0; }
.confirmation-dialog-card p { color: var(--color-muted); margin: 1rem 0 1.2rem; overflow-wrap: anywhere; }
.confirmation-dialog-icon { align-items: center; background: var(--color-accent-soft); border: 1px solid rgba(116,199,207,.25); border-radius: 50%; color: var(--color-accent); display: inline-flex; flex: 0 0 38px; height: 38px; justify-content: center; }
.confirmation-dialog-actions { border-top: 1px solid var(--color-line); display: flex; gap: .65rem; justify-content: flex-end; padding-top: 1rem; }
.confirmation-dialog-actions button { min-width: 110px; }
body.confirmation-open { overflow: hidden; }
.empty-state, .empty { color: var(--color-muted); padding: 2rem 1rem; text-align: center; }
.empty-state strong { color: var(--color-text); display: block; font-size: 1rem; margin-bottom: 0.25rem; }

.category-list { display: grid; gap: 0.75rem; }
.category-list > .category-summary { background: rgba(13,22,27,.6); border: 1px solid var(--color-line); border-radius: var(--radius-md); }
.category-summary { align-items: center; display: flex; gap: 1rem; justify-content: space-between; padding: 0.9rem 1rem; }
.category-summary h2 { margin: 0; }
.category-directory { --category-columns: minmax(0, 1fr) 7.5rem 5.5rem; background: var(--color-panel); border: 1px solid var(--color-line); border-radius: var(--radius-md); box-shadow: var(--shadow-soft); display: grid; margin-bottom: 1rem; }
.category-columns { align-items: center; display: grid; gap: 1rem; grid-template-columns: var(--category-columns); }
.category-list-heading { color: var(--color-muted); font-size: .72rem; font-weight: 750; letter-spacing: .045em; padding: .65rem 1rem; text-transform: uppercase; }
.category-list-heading > span:last-child { text-align: right; }
.category-item { border-top: 1px solid var(--color-line); min-width: 0; }
.category-item-inactive { background: rgba(7, 16, 21, .18); }
.category-row { min-height: 66px; padding: .75rem 1rem; }
.category-name { min-width: 0; }
.category-name h2 { font-size: 1rem; margin: 0; overflow-wrap: anywhere; }
.category-item-inactive .category-name { opacity: .68; }
.category-actions, .subcategory-actions { justify-self: end; }
.category-editor[open] { z-index: 20; }
.category-editor-menu { width: min(370px, calc(100vw - 2rem)); }
.category-editor-menu form, .subcategory-editor-menu form { margin: 0; }
.editor-section { display: grid; gap: .55rem; }
.editor-section + .editor-section { border-top: 1px solid var(--color-line); padding-top: .65rem; }
.editor-section h3 { font-size: .76rem; letter-spacing: .045em; margin: 0; text-transform: uppercase; }
.category-editor-actions, .subcategory-editor-actions { display: grid; gap: .55rem; }
.category-editor-actions button, .subcategory-editor-actions button { width: 100%; }
.editor-note { color: var(--color-muted); font-size: .78rem; line-height: 1.45; margin: 0; }
.delete-unavailable { background: var(--color-field); border-radius: var(--radius-sm); padding: .55rem .65rem; }
.subcategory-list { border-top: 1px solid var(--color-line); }
.subcategory-row { border-bottom: 1px solid var(--color-line); min-height: 56px; padding: .65rem 1rem; }
.subcategory-row:last-child { border-bottom: 0; }
.subcategory-name { align-items: start; display: grid; gap: .45rem; grid-template-columns: auto minmax(0, 1fr); min-width: 0; padding-left: 1rem; }
.subcategory-name strong { overflow-wrap: anywhere; }
.subcategory-indent { color: var(--color-muted); font-size: 1rem; line-height: 1.2; }
.subcategory-row-inactive .subcategory-name { opacity: .68; }
.subcategory-editor[open] { z-index: 20; }
.subcategory-editor-menu { width: min(340px, calc(100vw - 2rem)); }
.inline-editor { position: relative; }
.inline-editor > summary { border: 1px solid var(--color-line); border-radius: var(--radius-sm); color: var(--color-muted); cursor: pointer; font-size: .82rem; font-weight: 650; list-style: none; padding: .35rem .55rem; }
.inline-editor > summary::-webkit-details-marker { display: none; }
.inline-editor[open] > summary { background: var(--color-panel-raised); color: var(--color-text); }
.inline-editor-menu { background: var(--color-panel-raised); border: 1px solid var(--color-line-strong); border-radius: var(--radius-md); box-shadow: 0 18px 45px rgba(0,0,0,.35); display: grid; gap: .65rem; max-height: calc(100vh - 2rem); min-width: 260px; overflow-y: auto; padding: .75rem; position: absolute; right: 0; top: calc(100% + .4rem); z-index: 10; }

.color-settings-grid { display: grid; gap: .75rem; grid-template-columns: repeat(2, minmax(0,1fr)); }
.color-field { align-items: center; background: var(--color-field); border: 1px solid var(--color-line); border-radius: var(--radius-md); cursor: pointer; display: grid; gap: .75rem; grid-template-columns: auto 1fr auto; padding: .8rem; }
.color-field:hover { border-color: var(--color-line-strong); }
.color-field input { height: 42px; width: 52px; }
.color-field span { display: grid; }
.color-field small { font-weight: 400; }
.color-field code { color: var(--color-muted); }
.guidance-list { color: var(--color-muted); display: grid; gap: .6rem; margin: 0; padding-left: 1.4rem; }
.guidance-list code { color: var(--color-text); }
.diagnostic-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2,minmax(0,1fr)); }
.diagnostic-card { display: grid; gap: 1rem; }
.diagnostic-card > div { align-items: center; display: flex; gap: .7rem; }
.diagnostic-card h2 { margin: 0; }

.detail dl { display: grid; gap: 0; grid-template-columns: minmax(140px, 190px) 1fr; margin: 0; }
.detail dt, .detail dd { border-bottom: 1px solid var(--color-line); padding: 0.75rem 0; }
.detail dt { color: var(--color-muted); }
.detail dd { margin: 0; overflow-wrap: anywhere; }
.detail dl > :nth-last-child(-n+2) { border-bottom: 0; }
.receipt-box img, .receipt-preview { border: 1px solid var(--color-line); border-radius: var(--radius-md); display: block; max-height: 70vh; max-width: 100%; object-fit: contain; }
.receipt-box { margin: 0; }
.danger-zone { border: 1px solid rgba(223,114,114,.22); border-radius: var(--radius-md); margin-top: 1rem; padding: 0.9rem; }
.danger-zone h2 { color: #f09a9a; }

.fab { align-items: center; background: var(--color-accent); border-radius: 999px; bottom: max(1rem, env(safe-area-inset-bottom)); box-shadow: 0 12px 30px rgba(0,0,0,.35); color: #061114; display: none; font-size: 1.8rem; font-weight: 500; height: 54px; justify-content: center; line-height: 1; position: fixed; right: 1rem; width: 54px; z-index: 30; }
.fab:hover { background: #9bdee4; color: #061114; }
.muted { opacity: 0.55; }

@media (max-width: 860px) {
    .topbar-inner { gap: 0.75rem; padding: 0 0.8rem; }
    .brand > span:last-child { display: none; }
    .topnav { flex: 1 1 auto; overflow-x: auto; scrollbar-width: none; }
    .topnav::-webkit-scrollbar { display: none; }
    .nav-link { flex: 0 0 auto; padding: 0 0.6rem; }
    .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
    html { font-size: 14px; }
    .topbar-inner { min-height: 58px; }
    .brand-mark { height: 30px; width: 30px; }
    .nav-link { font-size: 0.84rem; }
    .nav-reports { display: none; }
    .nav-menu .mobile-only { display: flex; }
    .nav-more > summary span { display: none; }
    .nav-more > summary { border: 0; min-width: 34px; padding: 0 0.4rem; }
    .nav-more > summary::after { content: "•••"; letter-spacing: 0.1em; margin: 0; }
    .nav-menu { position: fixed; right: 0.75rem; top: 3.7rem; }
    .app-shell { padding: 1rem 0.75rem 5.5rem; }
    .page-header { align-items: stretch; flex-direction: column; margin-bottom: 1rem; }
    .page-actions { justify-content: flex-start; }
    .panel, .month-card { border-radius: var(--radius-md); padding: 0.9rem; }
    .panel-footer { margin: 0.9rem -0.9rem -0.9rem; padding: 0.8rem 0.9rem; }
    .form-grid, .grid-2, .toolbar, .filters, .summary-grid { grid-template-columns: 1fr; }
    .color-settings-grid, .diagnostic-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: auto; }
    .form-actions { align-items: stretch; flex-direction: column-reverse; }
    .form-actions > button, .form-actions > .button { width: 100%; }
    .category-list > form.category-summary { align-items: stretch; flex-direction: column; }
    .category-directory { --category-columns: minmax(0, 1fr) 6.5rem 3.9rem; }
    .category-columns { gap: .55rem; }
    .category-list-heading { font-size: .64rem; padding: .55rem .7rem; }
    .category-row { padding: .7rem; }
    .category-name h2 { font-size: .92rem; }
    .category-row .status, .subcategory-row .status { font-size: .68rem; padding: .22rem .45rem; }
    .subcategory-row { padding: .65rem .7rem; }
    .subcategory-name { gap: .3rem; padding-left: .35rem; }
    .transaction-row { align-items: flex-start; }
    .transaction-row > span:last-child { white-space: normal; }
    .chart-row { gap: 0.45rem; grid-template-columns: minmax(100px, 1fr) auto; }
    .chart-bar-link { grid-column: 1 / -1; grid-row: 2; }
    .detail dl { grid-template-columns: 1fr; }
    .detail dt { border-bottom: 0; padding-bottom: 0.15rem; }
    .detail dd { padding-top: 0; }
    .detail dl > :nth-last-child(-n+2) { border-bottom: initial; }
    .detail dl > dd:last-child { border-bottom: 0; }
    .fab { display: flex; }
    .inline-editor-menu { bottom: auto; left: .75rem; max-height: calc(100vh - 2rem); min-width: 0; position: fixed; right: .75rem; top: 1rem; }

    table.responsive-table thead { clip: rect(0 0 0 0); clip-path: inset(50%); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; }
    table.responsive-table, table.responsive-table tbody, table.responsive-table tr, table.responsive-table td { display: block; width: 100%; }
    table.responsive-table tr { border-bottom: 1px solid var(--color-line-strong); padding: 0.65rem 0; }
    table.responsive-table tr:last-child { border-bottom: 0; }
    table.responsive-table td { align-items: baseline; border: 0; display: flex; gap: 1rem; justify-content: space-between; padding: 0.3rem 0; text-align: right; white-space: normal; }
    table.responsive-table td::before { color: var(--color-muted); content: attr(data-label); flex: 0 0 38%; font-size: 0.76rem; font-weight: 700; letter-spacing: .04em; text-align: left; text-transform: uppercase; }
    table.responsive-table td.cell-actions { justify-content: flex-end; padding-top: 0.65rem; }
    table.responsive-table td.cell-actions::before { display: none; }
    table.responsive-table tfoot { display: none; }

    .annual-report-panel { padding-left: 0; padding-right: 0; }
    .annual-report-panel > .panel-header,
    .annual-report-panel > .report-summary { margin-left: .9rem; margin-right: .9rem; }
    .annual-report-panel > .table-wrap { margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }

    .annual-report-table { border-spacing: 0; font-size: calc(.68rem + 1px); table-layout: fixed; }
    .annual-report-table th,
    .annual-report-table td { padding: .42rem .18rem; vertical-align: top; }
    .annual-report-table tbody td { background: transparent; border: 0; border-bottom: 1px solid var(--color-line); border-radius: 0; }
    .annual-report-table tbody td:first-child,
    .annual-report-table tbody td:last-child { border-left: 0; border-radius: 0; border-right: 0; }
    .annual-report-table tbody tr:last-child td { border-bottom: 0; }
    .annual-report-table th { font-size: calc(.58rem + 1px); letter-spacing: 0; line-height: 1.2; text-transform: none; white-space: normal; }
    .annual-report-table th:first-child { width: 21%; }
    .annual-report-table th:not(:first-child),
    .annual-report-table td:not(:first-child) { white-space: normal; }
    .annual-report-table .cell-main { font-size: calc(.7rem + 1px); }
    .annual-report-table .cell-number { font-size: calc(.64rem + 1px); }
    .annual-report-table .report-value { font-size: calc(1em + 1px); }
    .annual-report-table th > span { font-size: calc(.52rem + 1px); line-height: 1.2; margin-top: .12rem; }
    .annual-report-table .report-transfer { font-size: calc(.5rem + 1px); line-height: 1.25; margin-top: .16rem; }
    .annual-report-table tfoot th { font-size: calc(.58rem + 1px); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}

/* Walloc compact workspace — approved 2026 redesign */
:root {
    --color-bg: #071015;
    --color-panel: #0d1820;
    --color-panel-raised: #12212b;
    --color-field: #0b171d;
    --color-field-hover: #10212a;
    --color-line: #1b313c;
    --color-line-strong: #2a4653;
    --color-text: #f1f6f8;
    --color-text-strong: #fff;
    --color-muted: #91a4ae;
    --color-subtle: #687d87;
    --color-accent: #62c9da;
    --color-accent-strong: #2c8190;
    --color-accent-soft: #102e38;
    --cell-bg: #142631;
    --cell-border: #2a4653;
    --radius-sm: 9px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

body { background: var(--color-bg); }
body::before { background: radial-gradient(circle at 82% -15rem,rgba(98,201,218,.08),transparent 38rem); }
.icon-sprite { height: 0; overflow: hidden; position: absolute; width: 0; }
.icon { display: block; fill: none; height: 20px; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; width: 20px; }
.icon.sm { height: 16px; width: 16px; }
.icon.lg { height: 25px; width: 25px; }

.app-frame { display: grid; grid-template-columns: 226px minmax(0,1fr); min-height: 100vh; }
.side-nav { background: #09141a; border-right: 1px solid var(--color-line); display: flex; flex-direction: column; height: 100vh; overflow-y: auto; padding: 24px 16px 16px; position: sticky; top: 0; z-index: 35; }
.side-nav .brand { align-items: center; color: var(--color-text-strong); display: flex; font-size: 1.12rem; font-weight: 820; gap: 10px; letter-spacing: -.03em; padding: 0 10px 25px; }
.brand-mark { align-items: center; background: linear-gradient(145deg,#87deea,#2f8492); border-radius: 10px; color: #061116; display: inline-flex; flex: 0 0 34px; height: 34px; justify-content: center; width: 34px; }
.brand-mark .icon { height: 19px; width: 19px; }
.wallet-switcher { align-items: end; background: rgba(16,46,56,.48); border: 1px solid #1f4b58; border-radius: 11px; display: grid; gap: 6px; grid-template-columns: minmax(0,1fr) 34px; padding: 8px; }
.wallet-switcher-field { display: grid; gap: 3px; min-width: 0; }
.wallet-switcher-field > span,.wallet-switcher-empty > span { color: var(--color-muted); font-size: .61rem; font-weight: 760; letter-spacing: .035em; }
.wallet-switcher select { min-height: 34px; min-width: 0; overflow: hidden; padding: 5px 7px; text-overflow: ellipsis; white-space: nowrap; }
.wallet-switcher-submit { height: 34px; min-height: 34px; padding: 0; width: 34px; }
.wallet-switcher-empty { background: rgba(16,46,56,.32); border: 1px dashed #1f4b58; border-radius: 11px; display: grid; gap: 2px; padding: 9px; }
.wallet-switcher-empty strong { font-size: .72rem; overflow-wrap: anywhere; }
.side-wallet-switcher { margin: 0 0 6px; }
.nav-caption { color: #607984; font-size: .66rem; font-weight: 800; letter-spacing: .1em; margin: 15px 11px 7px; text-transform: uppercase; }
.side-link { align-items: center; border: 1px solid transparent; border-radius: 10px; color: var(--color-muted); display: flex; font-size: .88rem; font-weight: 640; gap: 11px; margin: 2px 0; min-height: 42px; padding: 9px 11px; }
.side-link:hover { background: rgba(98,201,218,.06); color: var(--color-text); }
.side-link.active { background: var(--color-accent-soft); border-color: #1f4b58; color: #dffaff; }
.side-link.active .icon { color: var(--color-accent); }
.side-spacer { flex: 1 1 24px; }
.side-profile { border-top: 1px solid var(--color-line); margin-top: 12px; position: relative; }
.side-profile > summary { align-items: center; cursor: pointer; display: grid; gap: 9px; grid-template-columns: 34px 1fr auto; list-style: none; padding: 16px 8px 2px; }
.side-profile > summary::-webkit-details-marker { display: none; }
.side-profile > summary > span:nth-child(2) { display: grid; min-width: 0; }
.side-profile strong { font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-profile small { color: var(--color-muted); font-size: .63rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { align-items: center; background: #213945; border: 1px solid #355563; border-radius: 50%; color: #cff6fb; display: flex; font-size: .72rem; font-weight: 800; height: 34px; justify-content: center; width: 34px; }
.profile-menu { background: var(--color-panel-raised); border: 1px solid var(--color-line-strong); border-radius: 10px; bottom: 52px; box-shadow: 0 18px 40px rgba(0,0,0,.38); left: 4px; padding: 5px; position: absolute; right: 4px; }
.profile-menu button { background: transparent; border: 0; justify-content: flex-start; width: 100%; }
.app-workspace { min-width: 0; }
.app-shell { max-width: 1440px; padding: 30px 32px 60px; }
.mobile-appbar,.mobile-bottom-nav { display: none; }

.dashboard-heading { align-items: center; display: flex; gap: 1rem; justify-content: space-between; margin-bottom: 24px; }
.dashboard-heading h1 { font-size: 1.8rem; margin: 0 0 4px; }
.dashboard-heading p { color: var(--color-muted); font-size: .82rem; margin: 0; }
.dashboard-wallet-heading { display: grid; min-width: 0; }
.dashboard-context-label { color: var(--color-accent); font-size: .65rem; font-weight: 800; letter-spacing: .08em; margin-bottom: 3px; text-transform: uppercase; }
.period-picker { position: relative; }
.period-picker > summary { align-items: center; border: 1px solid var(--color-line-strong); border-radius: 9px; color: var(--color-muted); cursor: pointer; display: flex; font-size: .78rem; font-weight: 650; gap: 7px; list-style: none; min-height: 42px; padding: 0 11px; }
.period-picker > summary::-webkit-details-marker { display: none; }
.period-picker form { background: var(--color-panel-raised); border: 1px solid var(--color-line-strong); border-radius: 12px; box-shadow: 0 18px 45px rgba(0,0,0,.38); display: grid; gap: 9px; min-width: 260px; padding: 12px; position: absolute; right: 0; top: calc(100% + 7px); z-index: 20; }
.period-picker label { color: var(--color-muted); display: grid; font-size: .72rem; gap: 4px; }

.current-wallet-overview { margin-bottom: 18px; }
.current-wallet-overview-header { gap: 1rem; }
.current-wallet-overview-heading { display: grid; gap: 3px; }
.current-wallet-overview-heading > small { color: var(--color-muted); font-size: .68rem; }
.wallet-overview-actions { align-items: center; display: flex; gap: 14px; }
.dashboard-wallet-total { display: grid; gap: 2px; text-align: right; }
.dashboard-wallet-total > small { color: var(--color-muted); font-size: .64rem; }
.dashboard-wallet-total > strong { font-size: .9rem; font-variant-numeric: tabular-nums; }
.dashboard-account-breakdown { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit,minmax(250px,1fr)); max-height: none; overflow: visible; padding-right: 0; }
.dashboard-summary { margin: 18px 0; }
.monthly-flow-summary { background: linear-gradient(155deg,#10222c,#0d1920); border: 1px solid var(--color-line-strong); border-radius: 15px; padding: 14px 16px; }
.monthly-flow-summary > header { margin-bottom: 11px; }
.monthly-flow-summary > header > span { display: grid; gap: 2px; }
.monthly-flow-summary > header strong { font-size: .78rem; }
.monthly-flow-summary > header small { color: var(--color-muted); font-size: .65rem; }
.monthly-flow-summary dl { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); margin: 0; }
.monthly-flow-summary dl > div { display: grid; gap: 6px; min-width: 0; padding: 0 15px; }
.monthly-flow-summary dl > div + div { border-left: 1px solid var(--color-line-strong); }
.flow-metric dt { align-items: center; color: var(--color-muted); display: flex; font-size: .68rem; gap: 7px; }
.flow-metric dd { font-size: .95rem; font-variant-numeric: tabular-nums; font-weight: 750; margin: 0; white-space: nowrap; }
.flow-metric .metric-icon { height: 28px; margin: 0; width: 28px; }
.metric-icon { align-items: center; background: var(--color-accent-soft); border-radius: 9px; color: var(--color-accent); display: flex; height: 34px; justify-content: center; margin-bottom: 18px; width: 34px; }
.quick-actions { display: none; }
.dashboard-grid { display: grid; gap: 18px; grid-template-columns: 1fr; margin-bottom: 18px; }
.dashboard-wallet-warning { margin-bottom: 8px; }
.data-panel { background: rgba(12,24,31,.86); border: 1px solid var(--color-line); border-radius: 15px; padding: 17px; }
.data-panel > header { align-items: center; display: flex; justify-content: space-between; margin-bottom: 13px; }
.data-panel > header h2 { font-size: .98rem; margin: 0; }
.data-panel > header a { font-size: .7rem; }
.wallet-cells,.activity-list { display: grid; gap: 6px; }
.wallet-cell { align-items: center; background: var(--cell-bg); border: 1px solid var(--cell-border); border-radius: 11px; color: var(--color-text); display: grid; gap: 11px; grid-template-columns: 40px 1fr auto; padding: 10px; }
.wallet-cell:hover,.activity-cell:hover { background: #182d39; color: var(--color-text); }
.cell-icon { align-items: center; background: #1b3945; border-radius: 9px; color: var(--color-accent); display: flex; flex: 0 0 38px; height: 38px; justify-content: center; width: 38px; }
.cell-icon.variant-2,.cell-icon.coin { background: #2d2742; color: #b69cff; }
.cell-icon.variant-3,.cell-icon.salary { background: #17372b; color: var(--color-income); }
.cell-icon.food { background: #35282a; color: #ffaaa0; }
.cell-icon.home { background: #2d2742; color: #b69cff; }
.cell-icon.bolt { background: #203744; color: #7bd6e4; }
.wallet-cell > span:nth-child(2),.cell-value,.activity-copy,.activity-amount { display: grid; }
.wallet-cell strong,.activity-cell strong { font-size: .78rem; }
.wallet-cell small,.activity-cell small { color: var(--color-muted); font-size: .62rem; margin-top: 2px; }
.cell-value { text-align: right; }
.activity-cell { align-items: center; background: var(--cell-bg); border: 1px solid var(--cell-border); border-radius: 11px; display: grid; gap: 10px; grid-template-columns: minmax(0,1fr) auto auto; min-height: 59px; padding: 8px 9px; position: relative; }
.activity-main { align-items: center; color: var(--color-text); display: flex; gap: 10px; min-width: 0; }
.activity-main:hover { color: var(--color-text); }
.activity-copy { min-width: 0; }
.activity-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-amount { text-align: right; white-space: nowrap; }
.recent-history-links { display: flex; gap: 12px; }

.valuation-control { display: inline-flex; position: relative; }
.valuation-info-button { align-items: center; background: #eafcff; border: 2px solid #67c9da; border-radius: 50%; color: #176f80; cursor: pointer; display: inline-flex; flex: 0 0 23px; font-family: Georgia,serif; font-size: .75rem; font-weight: 900; height: 23px; justify-content: center; line-height: 1; padding: 0; width: 23px; }
.valuation-backdrop { display: none; }
.valuation-popover { background: #11242d; border: 1px solid #4e9ead; border-radius: 14px; box-shadow: 0 22px 60px rgba(0,0,0,.5); color: var(--color-text); display: block; min-width: 340px; padding: 14px; position: absolute; right: 0; top: calc(100% + 8px); white-space: normal; z-index: 50; }
.valuation-popover[hidden],.valuation-backdrop[hidden] { display: none; }
.valuation-popover-head { align-items: center; display: flex; gap: 9px; margin-bottom: 11px; }
.valuation-popover-head > span:nth-child(2) { display: grid; }
.valuation-popover-head strong { font-size: .86rem; }
.valuation-popover-head small { color: var(--color-muted); font-size: .62rem; }
.valuation-close { background: transparent; border: 0; color: var(--color-muted); margin-left: auto; min-height: auto; padding: 4px; }
.valuation-data { background: #0b1a21; border: 1px solid var(--color-line); border-radius: 10px; display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; }
.valuation-data > span { border-bottom: 1px solid var(--color-line); display: grid; padding: 8px; }
.valuation-data > span:nth-child(odd) { border-right: 1px solid var(--color-line); }
.valuation-data > span:nth-last-child(-n+2) { border-bottom: 0; }
.valuation-data small { color: var(--color-muted); font-size: .58rem; }
.valuation-data strong { font-size: .67rem; margin-top: 2px; }
.valuation-warning { color: #e8ca75; display: block; font-size: .62rem; margin-top: 8px; }
.detail-value-with-info { align-items: center; display: flex; gap: 8px; }

.dashboard-analysis { margin-top: 0; padding: 0; margin-bottom: 18px; }
.dashboard-analysis > summary { align-items: center; cursor: pointer; display: flex; justify-content: space-between; list-style: none; padding: 14px 17px; }
.dashboard-analysis > summary::-webkit-details-marker { display: none; }
.dashboard-analysis > summary > span { display: grid; }
.dashboard-analysis > summary small { color: var(--color-muted); font-size: .7rem; }
.dashboard-analysis[open] > summary .icon { transform: rotate(90deg); }
.analysis-content { border-top: 1px solid var(--color-line); display: grid; gap: 18px; grid-template-columns: 1fr 1fr; padding: 17px; }
.analysis-content .tree { margin: 0; }

/* Tables become separated readable cells */
table { border-collapse: separate; border-spacing: 0 5px; }
th,td { border: 0; }
th { padding: 0 10px 4px; }
tbody tr:hover { background: transparent; }
tbody td { background: var(--cell-bg); border-bottom: 1px solid var(--cell-border); border-top: 1px solid var(--cell-border); padding: .72rem .65rem; }
tbody td:first-child { border-left: 1px solid var(--cell-border); border-radius: 10px 0 0 10px; }
tbody td:last-child { border-radius: 0 10px 10px 0; border-right: 1px solid var(--cell-border); }

@media (max-width: 1040px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
    body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
    .app-frame { display: block; min-height: 0; }
    .side-nav { display: none; }
    .app-workspace { width: 100%; }
    .mobile-appbar { align-items: center; background: rgba(7,16,21,.96); display: flex; gap: 7px; height: 64px; justify-content: space-between; padding: 7px 15px; position: sticky; top: 0; z-index: 35; }
    .mobile-appbar .brand { align-items: center; color: var(--color-text); display: flex; font-size: 1rem; font-weight: 800; gap: 8px; }
    .mobile-appbar .brand-mark { flex-basis: 32px; height: 32px; width: 32px; }
    .mobile-wallet-switcher { background: transparent; border: 0; flex: 1 1 auto; margin: 0; max-width: 300px; min-width: 0; padding: 0; }
    .mobile-wallet-switcher.wallet-switcher-empty { align-content: center; align-self: stretch; display: grid; gap: 0; padding: 0 4px; }
    .mobile-wallet-switcher.wallet-switcher-empty strong { font-size: .68rem; }
    .mobile-wallet-switcher .wallet-switcher-field > span { font-size: .54rem; line-height: 1; }
    .mobile-wallet-switcher select { font-size: .72rem; min-height: 31px; padding: 3px 6px; }
    .mobile-wallet-switcher .wallet-switcher-submit { height: 31px; min-height: 31px; width: 32px; }
    .mobile-more { position: relative; }
    .mobile-more > summary { align-items: center; background: var(--color-panel-raised); border: 1px solid var(--color-line-strong); border-radius: 10px; cursor: pointer; display: flex; height: 36px; justify-content: center; list-style: none; width: 36px; }
    .mobile-more > summary::-webkit-details-marker { display: none; }
    .mobile-more > div { background: var(--color-panel-raised); border: 1px solid var(--color-line-strong); border-radius: 12px; box-shadow: 0 20px 45px rgba(0,0,0,.45); display: grid; min-width: 210px; padding: 5px; position: absolute; right: 0; top: 42px; }
    .mobile-more a,.mobile-more button { align-items: center; background: transparent; border: 0; color: var(--color-text); display: flex; font-size: .85rem; gap: 9px; justify-content: flex-start; padding: 10px; width: 100%; }
    .mobile-bottom-nav { align-items: center; background: rgba(9,20,26,.98); border-top: 1px solid var(--color-line-strong); bottom: 0; display: grid; grid-template-columns: repeat(5,1fr); height: calc(72px + env(safe-area-inset-bottom)); left: 0; padding: 6px 8px calc(10px + env(safe-area-inset-bottom)); position: fixed; right: 0; z-index: 40; }
    .mobile-bottom-nav > a:not(.mobile-add) { align-items: center; color: #718994; display: grid; font-size: .66rem; gap: 2px; justify-items: center; }
    .mobile-bottom-nav > a.active { color: var(--color-accent); }
    .mobile-bottom-nav .icon { height: 19px; width: 19px; }
    .mobile-add { align-items: center; background: linear-gradient(145deg,#72d4e1,#318593); border-radius: 50%; box-shadow: 0 8px 22px rgba(41,145,161,.34); color: #061217; display: flex; height: 48px; justify-content: center; margin: -23px auto 0; width: 48px; }
    .mobile-add .icon { height: 25px; width: 25px; }
    .app-shell { padding: 8px 15px 22px; }
    .dashboard-heading { align-items: flex-start; margin: 8px 0 12px; }
    .dashboard-heading h1 { font-size: 1.15rem; margin-bottom: 2px; overflow-wrap: anywhere; }
    .dashboard-heading p { font-size: .66rem; }
    .dashboard-context-label { font-size: .57rem; }
    .dashboard-heading .page-actions { display: flex; flex: 0 0 auto; justify-content: flex-end; }
    .dashboard-heading .button.primary { display: none; }
    .period-picker > summary { min-height: 35px; }
    .period-picker form { position: fixed; right: 15px; top: 62px; }
    .dashboard-summary { margin: 12px 0 0; }
    .monthly-flow-summary { padding: 12px; }
    .monthly-flow-summary > header { margin-bottom: 9px; }
    .monthly-flow-summary dl > div { padding: 0 8px; }
    .flow-metric dt { align-items: flex-start; flex-direction: column; gap: 4px; }
    .flow-metric dd { font-size: .78rem; white-space: normal; }
    .flow-metric .metric-icon { height: 25px; width: 25px; }
    .quick-actions { display: grid; gap: 9px; grid-template-columns: repeat(4,1fr); margin: 15px 0 20px; }
    .quick-actions a { align-items: center; color: var(--color-text); display: grid; font-size: .7rem; gap: 6px; justify-items: center; }
    .quick-actions a > span { align-items: center; background: var(--color-panel-raised); border: 1px solid var(--color-line-strong); border-radius: 12px; color: var(--color-accent); display: flex; height: 43px; justify-content: center; width: 43px; }
    .quick-actions a:nth-child(2)>span { color: var(--color-income); }
    .quick-actions a:nth-child(3)>span { color: #b69cff; }
    .quick-actions a:nth-child(4)>span { color: #f4c96b; }
    .quick-actions small { color: var(--color-text); font-size: .65rem; }
    .dashboard-grid { display: block; }
    .current-wallet-overview { margin-bottom: 19px; }
    .current-wallet-overview-header { align-items: flex-start !important; }
    .wallet-overview-actions { align-items: flex-end; flex-direction: column; gap: 5px; }
    .dashboard-account-breakdown { max-height: none; overflow: visible; padding-right: 0; }
    .data-panel { background: transparent; border: 0; padding: 0; }
    .data-panel > header { margin: 0 2px 8px; }
    .data-panel > header h2 { font-size: 1rem; }
    .activity-list { gap: 5px; }
    .activity-cell { grid-template-columns: minmax(0,1fr) auto auto; min-height: 61px; }
    .activity-amount strong { font-size: .78rem; }
    .activity-amount small { display: block; }
    .dashboard-analysis { background: var(--color-panel); border: 1px solid var(--color-line); margin-top: 14px; padding: 0; }
    .analysis-content { grid-template-columns: 1fr; }
    .transfer-tree > summary { align-items: flex-start; flex-wrap: wrap; }
    .transfer-tree-totals { flex: 1 0 100% !important; padding-left: 1.65rem; text-align: left; }
    .transfer-row { align-items: flex-start; display: grid; gap: .35rem; }
    .transfer-row > span:last-child { text-align: left; }
    .valuation-backdrop { background: rgba(2,8,11,.6); inset: 0; position: fixed; z-index: 60; }
    .valuation-backdrop:not([hidden]) { display: block; }
    .valuation-popover { bottom: auto; left: 16px; min-width: 0; position: fixed; right: 16px; top: 26%; z-index: 61; }
    body.valuation-open { overflow: hidden; }

    table.responsive-table tr { background: var(--cell-bg); border: 1px solid var(--cell-border); border-radius: 12px; margin-bottom: 6px; padding: 7px 10px; }
    table.responsive-table td { background: transparent; border: 0; border-bottom: 1px solid rgba(42,70,83,.65); padding: .48rem 0; }
    table.responsive-table td:first-child,table.responsive-table td:last-child { border-left: 0; border-radius: 0; border-right: 0; }
    table.responsive-table td:last-child { border-bottom: 0; }
    .opening-balance-change { min-width: 0; width: 100%; }
}

.compact-page-header { align-items: center; margin-bottom: 16px; }
.compact-page-header h1 { font-size: 1.75rem; margin: 0 0 3px; }
.compact-page-header p { color: var(--color-muted); font-size: .78rem; }
.icon-action { align-items: center; background: var(--color-panel-raised); border: 1px solid var(--color-line-strong); border-radius: 10px; color: var(--color-text); display: inline-flex; height: 40px; justify-content: center; width: 40px; }
.header-menu { position: relative; }
.header-menu > summary { align-items: center; background: var(--color-panel-raised); border: 1px solid var(--color-line-strong); border-radius: 10px; cursor: pointer; display: flex; height: 40px; justify-content: center; list-style: none; width: 40px; }
.header-menu > summary::-webkit-details-marker { display: none; }
.header-menu > div { background: var(--color-panel-raised); border: 1px solid var(--color-line-strong); border-radius: 10px; box-shadow: 0 18px 40px rgba(0,0,0,.4); min-width: 190px; padding: 5px; position: absolute; right: 0; top: 46px; z-index: 20; }
.header-menu a { border-radius: 7px; color: var(--color-text); display: block; font-size: .8rem; padding: 9px; }

.filter-drawer,.create-drawer { background: rgba(12,24,31,.72); border: 1px solid var(--color-line); border-radius: 12px; margin-bottom: 14px; }
.filter-drawer > summary,.create-drawer > summary { align-items: center; color: var(--color-muted); cursor: pointer; display: flex; font-size: .78rem; font-weight: 650; gap: 7px; list-style: none; min-height: 43px; padding: 0 12px; }
.filter-drawer > summary::-webkit-details-marker,.create-drawer > summary::-webkit-details-marker { display: none; }
.filter-drawer > summary .icon:last-child { margin-left: auto; }
.filter-drawer[open] > summary .icon:last-child { transform: rotate(90deg); }
.filter-drawer-body { border-top: 1px solid var(--color-line); padding: 12px; }
.filter-drawer .export-actions { border-top: 1px solid var(--color-line); justify-content: flex-end; margin-top: 10px; padding-top: 10px; }
.transaction-data-panel { padding: 12px; }
.transaction-filter-summary { background: rgba(7,16,21,.48); border: 1px solid var(--color-line); border-radius: 11px; display: grid; gap: 8px; grid-template-columns: minmax(0,1.4fr) repeat(2,minmax(0,1fr)); margin-bottom: 10px; padding: 10px; }
.transaction-filter-summary > span { border-left: 1px solid var(--color-line); display: grid; gap: 3px; min-width: 0; padding-left: 10px; }
.transaction-filter-summary > span:first-child { border-left: 0; padding-left: 0; }
.transaction-filter-summary small { color: var(--color-muted); font-size: .63rem; }
.transaction-filter-summary strong { font-size: .92rem; white-space: nowrap; }

.portfolio-grid { display: grid; gap: 14px; grid-template-columns: repeat(2,minmax(0,1fr)); }
.portfolio-card > header > span { display: grid; }
.portfolio-card > header h2 { margin: 0; }
.portfolio-card > header small { color: var(--color-muted); font-size: .65rem; }
.portfolio-card > header > strong { font-size: 1.15rem; white-space: nowrap; }
.portfolio-card-archived { border-style: dashed; }
.compact-warning { align-items: center; background: rgba(244,201,107,.08); border: 1px solid rgba(244,201,107,.22); border-radius: 9px; color: #e8ca75; display: flex; font-size: .67rem; gap: 7px; margin-bottom: 8px; padding: 7px 9px; }
.account-breakdown { display: grid; gap: 9px; }
.portfolio-account { background: rgba(7,16,21,.5); border: 1px solid var(--color-line); border-radius: 12px; padding: 10px; }
.portfolio-account-archived { border-style: dashed; }
.portfolio-account > header { align-items: flex-start; display: flex; gap: 10px; justify-content: space-between; margin-bottom: 8px; }
.portfolio-account > header > strong { font-size: .9rem; white-space: nowrap; }
.portfolio-account-heading { display: grid; gap: 4px; min-width: 0; }
.portfolio-account-title { align-items: center; display: flex; flex-wrap: wrap; gap: 6px; }
.portfolio-account-title h3 { font-size: .86rem; margin: 0; overflow-wrap: anywhere; }
.portfolio-account-heading > small { align-items: center; color: var(--color-muted); display: flex; flex-wrap: wrap; font-size: .61rem; gap: 6px; }
.portfolio-account-heading .status { font-size: .6rem; padding: .18rem .42rem; }
.portfolio-account .account-warning { margin-bottom: 6px; }
.asset-cells { display: grid; gap: 5px; }
.asset-cell { align-items: center; background: var(--cell-bg); border: 1px solid var(--cell-border); border-radius: 11px; display: grid; gap: 10px; grid-template-columns: 38px minmax(0,1fr) auto auto; min-height: 58px; padding: 8px 9px; }
.asset-copy { display: grid; min-width: 0; }
.asset-copy strong { font-size: .78rem; }
.asset-copy small { color: var(--color-muted); font-size: .61rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portfolio-actions { align-items: center; border-top: 1px solid var(--color-line); display: flex; gap: 6px; margin: 12px -17px -17px; padding: 10px 17px; }
.portfolio-actions form { margin: 0; }
.portfolio-actions .inline-editor { margin-left: auto; }
.create-drawer { margin-top: 14px; }
.create-drawer > form { border-top: 1px solid var(--color-line); padding: 12px; }

.wallet-detail-header .status { margin-top: 4px; }
.account-panel > header > span { display: grid; }
.account-panel > header small { color: var(--color-muted); font-size: .7rem; }
.account-panel .table-wrap { overflow: visible; }
.account-table { min-width: 690px; }
.account-table td { vertical-align: middle; }
.account-table .cell-actions form { margin: 0; }
.status.default-account { background: var(--color-accent-soft); color: #bceff5; }
.account-secondary { color: var(--color-muted); font-size: .78rem; }
.account-row-archived > td:not(.cell-actions) { opacity: .62; }
.account-editor { display: inline-block; text-align: left; }
.account-editor > summary { align-items: center; display: inline-flex; gap: 5px; min-height: 34px; }
.account-editor-menu { width: min(330px, calc(100vw - 30px)); }
.account-editor-menu button { width: 100%; }
.account-archive-form { border-top: 1px solid var(--color-line); padding-top: .65rem; }
.account-action-note { border-top: 1px solid var(--color-line); color: var(--color-muted); font-size: .72rem; margin: 0; padding-top: .65rem; white-space: normal; }
.archived-account-actions { align-items: center; display: inline-flex; gap: 9px; }
.archived-account-actions small { white-space: nowrap; }
.account-create-drawer { margin-left: auto; margin-right: auto; max-width: 760px; }

.quick-entry-header { align-items: center; display: grid; grid-template-columns: 40px 1fr 40px; margin: 0 auto 14px; max-width: 650px; }
.quick-entry-header h1 { font-size: 1.2rem; margin: 0; text-align: center; }
.quick-entry-form { background: rgba(12,24,31,.86); border: 1px solid var(--color-line); border-radius: 16px; margin: 0 auto; max-width: 650px; padding: 16px; }
.kind-switch { background: #0b171d; border: 1px solid var(--color-line-strong); border-radius: 12px; display: grid; gap: 3px; grid-template-columns: 1fr 1fr; padding: 3px; }
.kind-switch label { cursor: pointer; }
.kind-switch input { clip: rect(0 0 0 0); clip-path: inset(50%); height: 1px; position: absolute; width: 1px; }
.kind-switch span { align-items: center; border-radius: 9px; color: var(--color-muted); display: flex; font-size: .78rem; font-weight: 700; gap: 6px; justify-content: center; min-height: 38px; }
.kind-switch input[value="expense"]:checked + span { background: rgba(223,114,114,.2); color: #ffb0b0; }
.kind-switch input[value="income"]:checked + span { background: rgba(69,168,120,.18); color: #9de0bb; }
.amount-entry { display: block; padding: 26px 0 24px; text-align: center; }
.amount-entry > span:first-child { color: var(--color-muted); display: block; font-size: .68rem; margin-bottom: 4px; }
.amount-input { align-items: baseline; display: flex; justify-content: center; }
.amount-input input { background: transparent; border: 0; border-radius: 0; font-size: 2.4rem; font-weight: 820; letter-spacing: -.055em; min-height: 54px; padding: 0; text-align: right; width: min(260px,70%); }
.amount-input input:focus { box-shadow: none; outline: 0; }
.amount-input input::placeholder { color: #eaf2f5; }
.amount-input small { color: var(--color-muted); font-size: .9rem; font-weight: 700; margin-left: 8px; }
.entry-cell { align-items: center; background: var(--cell-bg); border: 1px solid var(--cell-border); border-radius: 12px; color: var(--color-text); display: grid; gap: 10px; grid-template-columns: 38px minmax(0,1fr) minmax(120px,auto) 16px; margin-bottom: 7px; min-height: 59px; padding: 8px 11px; position: relative; }
.entry-pair { display: grid; gap: 7px; grid-template-columns: repeat(2,minmax(0,1fr)); margin-bottom: 7px; }
.entry-pair .entry-cell { grid-template-columns: 38px minmax(0,1fr) 16px; margin-bottom: 0; }
.entry-pair .entry-cell > select { inset: 0; opacity: 0; position: absolute; width: 100%; z-index: 2; }
.entry-pair .entry-copy > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-pair .entry-cell:focus-within { border-color: var(--color-accent); box-shadow: 0 0 0 2px rgba(30,167,191,.14); }
.entry-icon { align-items: center; background: #1d3945; border-radius: 9px; color: var(--color-accent); display: flex; height: 38px; justify-content: center; width: 38px; }
.entry-copy { display: grid; min-width: 0; }
.entry-copy > small { color: var(--color-muted); font-size: .6rem; }
.entry-copy > strong { font-size: .76rem; }
.entry-copy input { background: transparent; border: 0; min-height: 25px; padding: 0; }
.entry-cell > select { background: transparent; border: 0; color: var(--color-text); font-size: .75rem; min-height: 35px; padding: 0 4px; text-align: right; }
.account-select-cell:focus-within { border-color: var(--color-accent); box-shadow: 0 0 0 2px rgba(30,167,191,.14); }
.entry-label { color: var(--color-muted); display: block; font-size: .67rem; margin: 14px 2px 8px; }
.category-chips { display: grid; gap: 6px; grid-template-columns: repeat(4,1fr); margin-bottom: 13px; }
.category-chip { align-items: center; background: var(--color-panel); border: 1px solid var(--color-line-strong); border-radius: 11px; color: var(--color-muted); display: grid; font-size: .64rem; gap: 5px; justify-items: center; min-height: 62px; padding: 7px 3px; }
.category-chip.active { background: rgba(223,114,114,.18); border-color: rgba(223,114,114,.5); color: #ffb3ab; }
.category-chip .icon { height: 19px; width: 19px; }
.entry-meta { align-items: center; border-top: 1px solid var(--color-line); display: flex; gap: 18px; margin-top: 14px; padding-top: 12px; }
.entry-meta label,.entry-meta button { align-items: center; background: transparent; border: 0; color: var(--color-muted); cursor: pointer; display: flex; font-size: .65rem; gap: 6px; min-height: 28px; padding: 0; }
.entry-meta input[type="date"] { background: transparent; border: 0; color: var(--color-muted); font-size: .65rem; min-height: 28px; padding: 0; width: 106px; }
.file-meta input { height: 1px; opacity: 0; overflow: hidden; position: absolute; width: 1px; }
.advanced-entry { background: #0b171d; border: 1px solid var(--color-line); border-radius: 10px; margin-top: 12px; padding: 10px; }
.advanced-entry label { color: var(--color-muted); display: grid; font-size: .7rem; gap: 5px; }
.advanced-entry small { color: var(--color-muted); }
.quick-save { border-top: 1px solid var(--color-line); display: flex; gap: 8px; justify-content: flex-end; margin-top: 15px; padding-top: 13px; }

@media (max-width:820px) {
    .confirmation-dialog { width: min(100% - 1.5rem, 440px); }
    .confirmation-dialog-card { padding: 1rem; }
    .confirmation-dialog-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .confirmation-dialog-actions button { min-height: 46px; min-width: 0; }
    .compact-page-header { margin: 4px 1px 13px; }
    .compact-page-header h1 { font-size: 1.25rem; }
    .compact-page-header .page-actions .button.primary { min-height: 36px; padding: .5rem .65rem; }
    .transaction-data-panel { background: transparent; border: 0; padding: 0; }
    .transaction-filter-summary { grid-template-columns: 1fr 1fr; }
    .transaction-filter-summary > span:first-child { grid-column: 1 / -1; }
    .transaction-filter-summary > span:nth-child(2) { border-left: 0; padding-left: 0; }
    .filter-drawer { margin-bottom: 10px; }
    .portfolio-grid { grid-template-columns: 1fr; }
    .portfolio-card { background: rgba(12,24,31,.86); border: 1px solid var(--color-line); padding: 13px; }
    .portfolio-card-archived { border-style: dashed; }
    .portfolio-card > header { margin-bottom: 9px; }
    .portfolio-account { padding: 9px; }
    .asset-cell { grid-template-columns: 38px minmax(0,1fr) auto auto; }
    .portfolio-actions { margin: 11px -13px -13px; padding: 9px 13px; }
    .wallet-detail-header .page-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .wallet-detail-header .page-actions .button { width: 100%; }
    .account-panel { background: rgba(12,24,31,.86); border: 1px solid var(--color-line); padding: 13px; }
    .account-table { min-width: 0; }
    table.responsive-table.account-table tr { padding: 8px 10px; }
    table.responsive-table.account-table td.cell-actions { align-items: stretch; display: block; }
    .account-editor, .account-editor > summary { width: 100%; }
    .account-editor > summary { justify-content: center; }
    .archived-account-actions { justify-content: space-between; width: 100%; }
    .account-create-drawer .inline-form { align-items: stretch; display: grid; }
    .focus-mode { padding-bottom: 0; }
    .focus-mode .mobile-bottom-nav { display: none; }
    .focus-mode .app-shell { padding: 13px 15px 90px; }
    .quick-entry-header { margin-bottom: 12px; }
    .quick-entry-header h1 { font-size: 1rem; }
    .quick-entry-form { background: transparent; border: 0; padding: 0; }
    .amount-entry { padding: 24px 0; }
    .amount-input input { font-size: 2.45rem; width: min(230px,68%); }
    .entry-cell { grid-template-columns: 38px minmax(0,1fr) 16px; }
    .entry-cell > select { inset: 0; opacity: 0; position: absolute; width: 100%; z-index: 2; }
    .entry-pair { gap: 6px; }
    .entry-pair .entry-cell { gap: 6px; min-height: 56px; padding: 7px; }
    .entry-pair .entry-icon { border-radius: 8px; height: 32px; width: 32px; }
    .entry-pair .entry-icon .icon { height: 17px; width: 17px; }
    .category-select-cell { display: none; }
    .category-select-cell.revealed { display: grid; }
    .entry-copy input { position: relative; z-index: 3; }
    .entry-meta { gap: 13px; }
    .entry-meta label,.entry-meta button { font-size: .59rem; }
    .entry-meta input[type="date"] { font-size: .59rem; width: 96px; }
    .quick-save { background: linear-gradient(180deg,rgba(7,16,21,0),var(--color-bg) 28%); bottom: 0; left: 0; padding: 24px 15px 16px; position: fixed; right: 0; z-index: 30; }
    .quick-save .button { display: none; }
    .quick-save .primary { width: 100%; }
}

/* I01: shared responsive rules for wallet, account and operation components */
.app-workspace,
.data-panel,
.panel,
.portfolio-card,
.portfolio-account,
.asset-copy,
.cell-value,
.category-directory,
.category-item,
.category-row,
.subcategory-row,
.analysis-content,
.tree-node,
.tree-node summary > span {
    min-width: 0;
}

.wallet-switcher { grid-template-columns: minmax(0, 1fr) 40px; }
.wallet-switcher select,
.wallet-switcher-submit { min-height: 40px; }
.wallet-switcher-submit { height: 40px; width: 40px; }
.inline-editor > summary { align-items: center; display: inline-flex; min-height: 40px; }
.valuation-info-button { height: 38px; width: 38px; }
.valuation-close { height: 40px; justify-content: center; min-height: 40px; width: 40px; }
.portfolio-actions { flex-wrap: wrap; }
.portfolio-actions a,
.portfolio-actions button { white-space: normal; }
.cell-stack,
.cell-main,
.account-secondary,
.dashboard-transfer-heading,
.portfolio-account-heading { overflow-wrap: anywhere; }
.confirmation-dialog-card { max-height: calc(100dvh - 2rem); overflow-y: auto; overscroll-behavior: contain; }

@media (max-width: 820px) {
    .mobile-appbar { height: auto; min-height: 72px; }
    .mobile-wallet-switcher select,
    .mobile-wallet-switcher .wallet-switcher-submit { height: 44px; min-height: 44px; }
    .mobile-wallet-switcher .wallet-switcher-submit { width: 44px; }
    .mobile-wallet-switcher { grid-template-columns: minmax(0, 1fr) 44px; }
    .mobile-more > summary { height: 44px; min-height: 44px; width: 44px; }
    .mobile-bottom-nav > a { min-height: 44px; width: 100%; }
    .app-shell { padding-bottom: 32px; }
    .panel-header { align-items: stretch; flex-direction: column; }
    .panel-header > form,
    .panel-header > form > button { width: 100%; }
    .inline-editor > summary,
    .account-editor > summary { min-height: 44px; }
    .inline-editor-menu {
        bottom: calc(72px + env(safe-area-inset-bottom) + .75rem);
        max-height: none;
        top: .75rem;
    }
    .valuation-info-button,
    .valuation-close { height: 44px; min-height: 44px; width: 44px; }
    .valuation-popover {
        bottom: calc(72px + env(safe-area-inset-bottom) + 16px);
        max-height: none;
        overflow-y: auto;
        overscroll-behavior: contain;
        top: calc(env(safe-area-inset-top) + 76px);
    }
    .confirmation-dialog-card { max-height: calc(100dvh - 1.5rem); }
    table.responsive-table td,
    table.responsive-table td > * { min-width: 0; }
}

@media (max-width: 420px) {
    .mobile-appbar { gap: 6px; padding-left: 10px; padding-right: 10px; }
    .mobile-appbar .brand > span:last-child { display: none; }
    .category-directory { --category-columns: minmax(0, 1fr) 5.9rem 4.2rem; }
    .monthly-flow-summary dl { grid-template-columns: 1fr; }
    .monthly-flow-summary dl > div { padding: 7px 0; }
    .monthly-flow-summary dl > div + div { border-left: 0; border-top: 1px solid var(--color-line-strong); }
    .flow-metric dt { align-items: center; flex-direction: row; }
    .portfolio-card > header,
    .portfolio-account > header { display: grid; }
    .portfolio-card > header > strong,
    .portfolio-account > header > strong { justify-self: start; white-space: normal; }
    .asset-cell { grid-template-columns: 38px minmax(0, 1fr) 44px; }
    .asset-cell .cell-value { grid-column: 2; grid-row: 2; text-align: left; }
    .asset-cell > .valuation-control { align-self: center; grid-column: 3; grid-row: 1 / span 2; justify-self: end; }
    .activity-cell { grid-template-columns: minmax(0, 1fr) 44px; }
    .activity-main { grid-column: 1; }
    .activity-amount { grid-column: 1; grid-row: 2; text-align: left; white-space: normal; }
    .activity-cell > .valuation-control { align-self: center; grid-column: 2; grid-row: 1 / span 2; justify-self: end; }
    .opening-balance-cell { display: block !important; text-align: left !important; }
    .opening-balance-cell::before { display: block; margin-bottom: .45rem; }
    .opening-balance-change dl { grid-template-columns: 1fr; }
    .opening-balance-change dl > div,
    .opening-balance-change dl > div:nth-child(odd),
    .opening-balance-change dl > div:nth-child(-n+2) { border-bottom: 1px solid var(--color-line); border-right: 0; }
    .opening-balance-change dl > div:last-child { border-bottom: 0; }
    .transaction-row { display: grid; }
    .transaction-row > span:last-child { text-align: left; }
}
