/* CFO layout and components. Corporate tokens are defined in /brand/theme.css. */
:root { font-family: var(--font-sans); color: var(--text); background: var(--canvas); }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .58; cursor: wait; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.8rem, 4vw, 2.65rem); letter-spacing: -.055em; line-height: 1.05; }
h2 { font-size: 1.08rem; letter-spacing: -.02em; }
h3 { font-size: .94rem; }
.sign-in { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: var(--canvas); }
.sign-in-card { width: min(100%, 420px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 7vw, 42px);  }
.sign-in-card h1 { margin: 23px 0; font-size: 1.9rem; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 750; letter-spacing: -.035em; white-space: nowrap; }
.app-shell { min-height: 100dvh; display: grid; grid-template-columns: 202px minmax(0, 1fr); }
.sidebar { display: flex; flex-direction: column; gap: 38px; border-right: 1px solid var(--line); padding: 29px 17px 23px; background: var(--sidebar); position: sticky; top: 0; height: 100dvh; }
.sidebar .brand { margin-left: 6px; }
nav { display: grid; gap: 5px; }
nav button { display: block; text-align: left; border: 0; border-radius: 9px; padding: 11px 12px; background: transparent; color: var(--subtle); font-weight: 650; }
nav button:hover, nav button[aria-current] { background: var(--accent-soft); color: var(--accent-ink); }
.sidebar-foot { margin-top: auto; display: grid; justify-items: start; gap: 6px; font-size: .86rem; padding: 0 7px; }
#household { font-weight: 680; overflow-wrap: anywhere; }
.main { padding: 32px clamp(20px, 4vw, 56px) 42px; width: min(1420px, 100%); margin: 0 auto; }
.masthead, .toolbar, .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.masthead { margin-bottom: 19px; }
.toolbar { margin-bottom: 15px; min-height: 42px; }
.toolbar p + p { margin-top: 4px; }
.muted, .field-note { color: var(--subtle); font-size: .87rem; line-height: 1.45; }
.primary, .secondary, .text-button { padding: 9px 14px; border-radius: 8px; font-size: .89rem; font-weight: 680; border: 1px solid transparent; min-height: 40px; }
.primary { background: var(--action); color: var(--on-accent); }
.primary:hover { background: var(--action-hover); }
.secondary { background: var(--surface); color: var(--text); border-color: var(--line); }
.secondary:hover { background: var(--surface-raised); }
.text-button { color: var(--accent-ink); padding: 4px 2px; background: transparent; min-height: 32px; }
.text-button:hover { text-decoration: underline; }
.notice, .error { font-size: .88rem; margin: 0 0 14px; padding: 10px 12px; border-radius: 8px; overflow-wrap: anywhere; }
.notice { background: var(--notice-bg); color: var(--notice-ink); }
.error { color: var(--error); background: var(--error-bg); }
.currency-section + .currency-section { margin-top: 10px; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.metric { padding: 17px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.metric-label { color: var(--subtle); font-size: .82rem; margin-bottom: 10px; font-weight: 580; }
.metric-value { font-size: clamp(1rem, 1.8vw, 1.52rem); font-weight: 720; letter-spacing: -.045em; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.panel-heading { min-height: 56px; padding: 10px 15px; border-bottom: 1px solid var(--line-soft); }
.panel-inner { padding: 2px 15px 10px; }
.list-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); font-size: .9rem; overflow-wrap: anywhere; }
.list-row:last-child { border-bottom: 0; }
.list-row small { display: block; color: var(--subtle); margin-top: 2px; }
.list-row strong:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.spend-row { padding-top: 11px; }
.spend-row .list-row { padding: 0; border-bottom: 0; }
progress { appearance: none; width: 100%; height: 6px; border: none; border-radius: 999px; background: var(--line-soft); }
progress::-webkit-progress-bar { background: var(--line-soft); border-radius: inherit; }
progress::-webkit-progress-value { background: var(--accent); border-radius: inherit; }
progress::-moz-progress-bar { background: var(--accent); border-radius: inherit; }
.empty { padding: 20px 15px; color: var(--subtle); font-size: .89rem; line-height: 1.45; }
.panel-inner .empty { padding-left: 0; padding-right: 0; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: .86rem; }
th, td { padding: 11px 13px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { color: var(--subtle); background: var(--surface-raised); font-weight: 670; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
.numeric { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.date { white-space: nowrap; }
td small { display: block; color: var(--subtle); margin-top: 3px; }
td .text-button { font-weight: 700; text-align: left; min-height: auto; padding: 0; overflow-wrap: anywhere; }
table td:first-child, table td:nth-child(2) { min-width: 98px; }
.form, .form-row { display: grid; gap: 13px; }
.form-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form label, .toolbar label, .split-row label { display: grid; gap: 5px; font-size: .84rem; font-weight: 650; min-width: 0; }
.toolbar .inline-label { display: flex; align-items: center; gap: 9px; }
input, select, textarea { color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-height: 38px; padding: 8px; min-width: 0; width: 100%; }
input:disabled, select:disabled { background: var(--surface-raised); }
input[type="checkbox"] { min-height: auto; width: auto; }
.form .check { display: flex; align-items: center; gap: 8px; }
.filter-bar { align-items: end; justify-content: start; }
.filter-bar label { flex: 0 1 auto; }
.filter-bar label:first-child { flex: 1 1 145px; }
.next-button { margin-top: 13px; }
dialog { width: min(620px, calc(100% - 24px)); color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 19px; max-height: calc(100dvh - 26px); }
.modal-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.modal-heading h2 { font-size: 1.3rem; }
dialog .form-error { margin: 0; }
fieldset { min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 9px; }
legend { font-weight: 680; font-size: .88rem; }
.split-row { display: grid; grid-template-columns: 1.4fr 1fr auto; align-items: end; gap: 6px; margin-bottom: 7px; }
.detail-list { margin: 0 0 14px; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 12px; font-size: .89rem; }
.detail-list dt { color: var(--subtle); }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }
.detail-actions { margin-top: 15px; display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 940px) { .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .metric-value { font-size: 1.28rem; } }
@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar { height: auto; position: static; padding: 12px 15px 0; border-right: 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 8px; }
  .sidebar .brand { margin-left: 0; }
  .sidebar-foot { justify-items: end; gap: 0; padding: 0; font-size: .73rem; }
  nav { grid-row: 2; grid-column: 1 / -1; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; }
  nav button { text-align: center; padding: 9px 2px; border-radius: 8px 8px 0 0; font-size: .8rem; }
  .main { padding: 20px 14px 28px; }
  .panels { grid-template-columns: 1fr; }
  .metric { padding: 13px 10px; }
  .metric-value { font-size: 1.12rem; }
}
@media (max-width: 390px) { .form-row { grid-template-columns: 1fr; } .detail-list { grid-template-columns: 1fr; } }

.account-groups { display: grid; gap: 24px; }
.account-group h2 { margin-bottom: 11px; font-size: .9rem; color: var(--subtle); }
.account-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.account-card { display: grid; text-align: left; gap: 10px; border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 18px; color: inherit; min-height: 140px; align-content: start; }
.account-card:hover { border-color: var(--accent); }
.account-name { font-weight: 650; font-size: .91rem; overflow-wrap: anywhere; }
.account-value { font-size: 1.45rem; font-variant-numeric: tabular-nums; letter-spacing: -.045em; overflow-wrap: anywhere; }
.account-status { font-size: .77rem; color: var(--warning); line-height: 1.4; }
.account-status.balance_checked { color: var(--positive); }
.account-card small { color: var(--subtle); }
.archive-filter { display: flex; align-items: center; gap: 8px; margin-bottom: 15px; font-size: .84rem; color: var(--subtle); }
.archive-filter input { width: auto; min-height: auto; }
#account-detail { margin-top: 22px; }
#planning-content, #outlook-content, #imports-content, #reports-content, #settings-content { display: grid; gap: 17px; }
#overview-attention:not(:empty) { margin-top: 16px; }
#import-detail { margin-top: 17px; }
.subheading { margin: 20px 0 9px; }
.table-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.table-actions button { white-space: nowrap; }
.assumption { color: var(--subtle); font-size: .86rem; line-height: 1.5; margin: 9px 0; }
.account-notes { white-space: pre-wrap; margin-top: 13px; }
.reconciliation-preview { padding: 13px; border: 1px solid var(--line); background: var(--notice-bg); border-radius: 8px; font-size: .9rem; line-height: 1.5; }
.panel-inner > .secondary { margin: 12px 0; }
.panel-inner > .field-note { margin: 12px 0; }
#planning-content .panel-inner, #outlook-content .panel-inner, #reports-content .panel-inner { padding-bottom: 14px; }
@media (min-width: 721px) {
  .sidebar { width: 202px; }
  nav { gap: 3px; }
  nav button { padding-top: 9px; padding-bottom: 9px; font-size: .86rem; }
}
@media (max-width: 720px) {
  nav { display: flex; overflow-x: auto; padding-bottom: 2px; }
  nav button { flex: 0 0 auto; padding: 10px 13px; }
  .account-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .account-card { padding: 13px; min-height: 134px; }
  .account-value { font-size: 1.12rem; }
  .sidebar { max-width: 100vw; }
  nav { min-width: 0; }
}
@media (max-width: 360px) { .account-grid { grid-template-columns: 1fr; } }

.capture-card { padding: 16px 0; border-bottom: 1px solid var(--line); }
.capture-card:last-child { border-bottom: 0; }
.capture-card .field-note { margin-top: 6px; }
.capture-text { line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.link-code { background: var(--surface-raised); padding: 15px; border-radius: 8px; font-size: 1rem; overflow-wrap: anywhere; user-select: all; }
.briefing-preview { white-space:pre-wrap; overflow-wrap:anywhere; font:inherit; line-height:1.6; max-width:100%; }
.shortcut-suggestions { display:flex; flex-wrap:wrap; gap:.5rem; margin-block:.5rem; }
.calculation-notes { margin-top:1rem; }
.calculation-notes summary { cursor:pointer; color:var(--accent-ink); font-weight:600; }

/* Layout and interaction refinements shared by both appearances. */
body { font-size: 1rem; line-height: 1.5; }
a { color: var(--accent-ink); }
button { touch-action: manipulation; }
button, input, select, textarea { transition: background-color var(--motion-fast) ease, border-color var(--motion-fast) ease, color var(--motion-fast) ease; }
button:disabled { cursor: not-allowed; }
input, select, textarea { min-height: 44px; border-radius: var(--radius-control); padding: 10px 12px; }
input[type="checkbox"] { accent-color: var(--accent); }
select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23737d91' stroke-width='1.6'/%3E%3C/svg%3E"); background-position: right 13px center; background-repeat: no-repeat; }
.primary, .secondary { min-height: 44px; border-radius: var(--radius-control); padding: 10px 16px; }
.secondary:hover { border-color: var(--accent-ink); }
.text-button { border-radius: 7px; }
.panel-heading { padding: 17px 20px; }
.panel-inner { padding: 5px 20px 18px; }
.metric { padding: 22px 20px; }
.metrics-grid { gap: 14px; }
.metric-value { font-size: clamp(1.25rem, 1.85vw, 1.85rem); letter-spacing: -.04em; }
.metric-label { font-size: .875rem; }
.masthead { padding-block: 5px 18px; margin-bottom: 17px; border-bottom: 1px solid var(--line); }
.eyebrow { color: var(--subtle); text-transform: uppercase; letter-spacing: .13em; font-size: .75rem; font-weight: 700; margin-bottom: 9px; }
h1 { font-size: clamp(1.8rem, 3.2vw, 2.45rem); letter-spacing: -.045em; line-height: 1.15; }
h2 { font-size: 1rem; }
.app-shell { grid-template-columns: 230px minmax(0,1fr); }
.sidebar { gap: 25px; padding: 30px 16px 20px; width: 230px; overflow-y: auto; }
.sidebar nav { gap: 4px; }
.sidebar nav button { padding: 10px 14px; font-size: .875rem; font-weight: 550; min-height: 42px; position: relative; }
.sidebar nav button[aria-current] { font-weight: 700; box-shadow: inset 3px 0 var(--accent-ink); }
.sidebar-foot { width: 100%; padding: 14px 6px 0; border-top: 1px solid var(--line); gap: 10px; }
.brand { font-size: 1.1rem; }
.main { width: min(1520px, 100%); padding-top: 32px; }
.appearance-control { display: flex; align-items: center; gap: 10px; color: var(--subtle); font-size: .875rem; width: 100%; }
.appearance-control select { width: auto; flex: 1; min-height: 38px; font-size: .875rem; }
.sign-in-card > .field-note { margin-block: 15px 22px; }
.sign-in-card > .text-button { margin-top: 15px; }
.sign-in-card .appearance-control { border-top: 1px solid var(--line); padding-top: 18px; }
dialog { background: var(--surface); padding: 25px;  border-radius: var(--radius); }
th, td { padding: 13px 16px; }
tr:hover td { background: var(--hover); }
.form label, .toolbar label, .split-row label { font-size: .875rem; }
.account-name, .account-status, .archive-filter, .sidebar-foot { font-size: .875rem; }
.account-card { border-radius: var(--radius);  padding: 21px; }
.account-card:hover { border-color: var(--accent-ink);  }
.chart-caption { fill: var(--subtle); }
.capture-hero { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 20px; }
.capture-hero h2 { font-size: 1.5rem; margin-bottom: 8px; letter-spacing: -.035em; }
.capture-hero p { max-width: 65ch; color: var(--subtle); }
.capture-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.capture-card { padding: 22px 0; }
.capture-card:first-child { padding-top: 15px; }
.capture-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.capture-badge { border: 1px solid var(--line); padding: 4px 10px; border-radius: 999px; font-size: .8125rem; font-weight: 650; color: var(--accent-ink); background: var(--accent-soft); }
.capture-facts { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; padding: 16px; background: var(--surface-raised); border-radius: 12px; margin-block: 14px; }
.capture-facts dt { color: var(--subtle); font-size: .8125rem; }
.capture-facts dd { margin: 3px 0 0; font-weight: 650; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.capture-questions { margin-block: 12px; padding: 14px 16px; background: var(--surface-raised); border: 1px solid var(--line); border-radius: 12px; }
.capture-questions p + p { margin-top: 7px; }
.capture-preview { white-space: pre-wrap; overflow-wrap: anywhere; }
.capture-empty { padding: 35px 12px; text-align: center; color: var(--subtle); }
@media(max-width:1000px) { .app-shell { grid-template-columns: 208px minmax(0,1fr); } .sidebar { width: 208px; } .metric { padding: 18px 14px; } .capture-facts { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media(max-width:720px) { .app-shell { display: block; } .sidebar { width: 100%; height: auto; padding: 14px 14px 0; overflow: visible; gap: 12px; } .sidebar-foot { width: auto; border: 0; padding: 0; gap: 3px; } .sidebar-foot .appearance-control { width: auto; font-size: .75rem; } .sidebar-foot .appearance-control select { min-height: 32px; padding-block: 3px; } .sidebar-foot #household { display: block; max-width: 170px; font-size: .75rem; } .sidebar nav { display: flex; gap: 4px; } .sidebar nav button { padding: 10px 13px; min-height: 42px; } .sidebar nav button[aria-current] { box-shadow: inset 0 -3px var(--accent-ink); } .main { padding: 22px 14px 32px; } .masthead { gap: 15px; } .masthead .primary { font-size: .8125rem; padding-inline: 12px; } .eyebrow { font-size: .6875rem; } .metrics-grid { gap: 9px; } .metric { padding: 16px 12px; } .metric-value { font-size: 1.18rem; } .panel-heading { padding: 14px 16px; } .panel-inner { padding-inline: 16px; } .capture-hero { padding: 20px; } .capture-actions .primary, .capture-actions .secondary { flex: 1 1 auto; } dialog { padding: 20px; } }
@media(prefers-reduced-motion:reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }

/* 0.6.2: quieter chrome, stronger hierarchy and report detail. */
.main { padding-inline: clamp(24px, 3.5vw, 52px); }
.masthead { padding-bottom: 22px; margin-bottom: 26px; }
h1 { font-size: clamp(1.75rem, 2.5vw, 2.2rem); letter-spacing: -.04em; font-weight: 700; }
.panel-heading h2 { font-size: .98rem; font-weight: 650; }
.panel-heading { padding-block: 16px; }
.sidebar { padding-top: 32px; }
.sidebar nav button { border-radius: 8px; }
.sidebar nav button[aria-current] { box-shadow: none; border: 1px solid var(--line); background: var(--surface); color: var(--accent-ink); }
.primary, .secondary, input, select, textarea { border-radius: 8px; }
.capture-hero { border-radius: var(--radius); background: var(--surface); border-top: 3px solid var(--accent-ink); }
.capture-hero h2 { font-size: 1.4rem; }
.capture-card { padding-block: 24px; }
.capture-facts { border-radius: 8px; border: 1px solid var(--line-soft); }
.memory-explanation { border-left: 3px solid var(--accent-ink); background: var(--accent-soft); color: var(--accent-ink); padding: 10px 13px; font-size: .875rem; border-radius: 0 6px 6px 0; }
.memory-choice { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 16px; }

@media(max-width:720px) {
  .main { padding: 22px 14px 32px; }
  .masthead { margin-bottom: 20px; }
  .sidebar nav button[aria-current] { border-color: var(--line); }
  .list-row { flex-wrap: wrap; }
}

.budget-progress{display:grid;gap:.3rem;min-width:0;margin-top:.5rem}.budget-progress progress{width:100%;height:.65rem;accent-color:var(--chart-income)}.scope-badge{font-size:.85rem;padding:.5rem;border:1px solid var(--line);border-radius:.5rem}.settings-navigation{flex-wrap:wrap}.scheduled-budget{margin-top:1rem}

.budget-progress small{white-space:normal}.numeric .budget-progress{width:6rem;max-width:100%}

.settings-group{border:1px solid var(--line);border-radius:14px;margin:.7rem 0;background:var(--surface)}.settings-group>summary{cursor:pointer;padding:1rem;font-weight:650}.settings-group-body{padding:0 .75rem .75rem}.settings-group-body>.panel{margin-top:.7rem}.category-checklist{border:1px solid var(--line);border-radius:10px;padding:.8rem;max-height:18rem;overflow:auto}.category-checklist label{display:flex;align-items:center;gap:.65rem;padding:.45rem 0}.category-checklist input{width:1.1rem;height:1.1rem;flex:none}.capture-guide li{margin:.7rem 0}.capture-endpoint{display:block;overflow-wrap:anywhere;margin:.7rem 0}

.settings-subsection>summary{cursor:pointer;justify-content:flex-start;gap:.6rem}.settings-subsection>summary::before{content:"▸"}.settings-subsection[open]>summary::before{content:"▾"}.category-checklist{min-inline-size:0}.category-checklist label{overflow-wrap:anywhere}

.close-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:.7rem;border:1px solid var(--line);padding:1rem;margin:1rem 0;border-radius:12px}.close-row>strong,.close-row>p{grid-column:1/-1}.scope-badge{white-space:normal;overflow-wrap:anywhere}.inline-category{padding:.6rem;border:1px solid var(--line);border-radius:8px}

.close-row{display:block}.close-row>summary{cursor:pointer;font-weight:600;overflow-wrap:anywhere}.close-row-fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:.7rem;margin-top:.8rem}.close-row-fields>p{grid-column:1/-1}

/* Reports */
#reports-content { gap: 12px; }
.report-scope { color: var(--subtle); font-size: .88rem; overflow-wrap: anywhere; }
.report-tabs { justify-content: start; gap: 5px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.report-tabs button { min-height: 38px; font-size: .9rem; }
.report-tabs button[aria-selected="false"] { border-color: transparent; }
.report-date-controls { justify-content: start; }
.report-date-controls .toolbar { justify-content: start; gap: 6px; }
.report-date-controls button { padding-inline: 11px; min-height: 36px; font-size: .83rem; }
.report-date-controls button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-ink); color: var(--accent-ink); }

.report-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.report-stat { min-width: 0; padding: 11px 14px; border-inline-end: 1px solid var(--line-soft); }
.report-stat:last-child { border-inline-end: 0; }
.report-stat .metric-label { margin-block: 0 2px; }
.report-stat .metric-value { font-size: clamp(1.02rem, 1.8vw, 1.44rem); font-weight: 700; letter-spacing: -.025em; }
.report-stat .field-note { font-size: .79rem; margin-top: 2px; }
.report-view { display: grid; gap: 12px; min-width: 0; }
.report-view .panel-heading { min-height: 44px; padding: 8px 14px; }
.report-view .panel-inner { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding-block: 10px 13px; min-width: 0; }
.report-view .field-note, .report-details .field-note { font-size: .84rem; line-height: 1.5; }

.report-details { padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.report-details > summary { min-height: 26px; cursor: pointer; font-size: .86rem; font-weight: 650; }
.report-details[open] > summary { margin-bottom: 8px; }
.report-details > p + p, .report-details > p + .table-wrap { margin-top: 7px; }
.report-details > .table-wrap + .report-details { margin-top: 8px; }
.report-filter-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,190px),1fr)); gap: 10px; align-items: end; }
.report-filter-grid select[multiple] { min-height: 108px; }
.report-category-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.report-category-controls label, .report-filter-grid label, .report-figure label {
  display: grid; gap: 3px; min-width: 0; font-size: .84rem; font-weight: 650;
}
.report-category-controls label:nth-child(2) { flex: 1 1 190px; }
.report-category-controls select { text-overflow: ellipsis; }

#reports-content .table-wrap { max-width: 100%; border: 1px solid var(--line-soft); border-radius: 8px; }
#reports-content th, #reports-content td { padding: 7px 10px; min-width: 0; }
#reports-content th { font-size: .8rem; color: var(--text); }
#reports-content td { font-size: .88rem; }
#reports-content tbody tr:nth-child(even) { background: var(--surface-raised); }
#reports-content td:first-child { overflow-wrap: anywhere; }
#reports-content .report-period { white-space: nowrap; }
#reports-content .report-scroll-table { max-height: 22rem; overflow: auto; }
#reports-content .report-scroll-table thead { position: sticky; top: 0; z-index: 1; }

.category-distribution { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-width: 0; }
.report-category-name { min-width: 86px; }
#reports-content .report-category-name button { font-size: inherit; }
.allocation-track { display: block; width: min(70px, 100%); height: 4px; margin-block: 4px 1px; border-radius: 4px; background: var(--line-soft); overflow: hidden; }
.allocation-track span { display: block; height: 100%; border-radius: inherit; }
.distribution-overview { display: flex; align-items: center; gap: 12px; }
.distribution-caption { min-width: 0; font-size: .88rem; }
.donut-chart { display: block; width: 76px; height: 76px; flex: none; }
.donut-chart [role="button"] { cursor: pointer; }
.donut-chart circle[tabindex]:hover, .donut-chart circle[tabindex]:focus { stroke-width: 14px; }

.report-chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 350px), 1fr));
  gap: 8px;
  align-items: start;
}
.report-figure {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-raised);
  width: min(100%, 560px);
  min-width: 0;
}
.report-chart-grid .report-figure { width: 100%; }
.report-chart-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.report-chart-title { font-size: .91rem; font-weight: 700; }
.report-chart-heading select {
  width: auto;
  max-width: 100%;
  min-height: 32px;
  padding-block: 3px;
  font-size: .8rem;
}
.report-chart { display: block; width: min(100%, 520px); height: auto; }
.report-chart.is-interactive { cursor: crosshair; }
.report-grid-line { stroke: var(--chart-grid); stroke-dasharray: 3 4; }
.report-zero-line { stroke: var(--subtle); opacity: .65; }
.report-chart-cursor { stroke: var(--focus); stroke-width: 1.8; stroke-dasharray: 3 3; }
.report-budget-utilization { display: grid; justify-items: end; }
.report-budget-utilization .allocation-track { width: min(100%, 72px); }
.report-movement-list { display: grid; gap: 7px; margin: 3px 0 0; padding: 0; list-style: none; }
.report-movement-list li {
  display: grid;
  grid-template-columns: minmax(6rem, 1fr) minmax(3rem, 1fr) auto;
  align-items: center;
  gap: 8px;
  font-size: .82rem;
  overflow-wrap: anywhere;
}
.report-movement-value { text-align: end; font-variant-numeric: tabular-nums; }
.report-movement-track { position: relative; height: 8px; border-radius: 3px; background: var(--line); }
.report-movement-track span { position: absolute; inset-block: 0; border-radius: 3px; }
.report-movement-track .is-negative { background: var(--chart-expense); }
.report-movement-track .is-positive { background: var(--chart-income); }
.report-movement-track.is-diverging::after {
  content: '';
  position: absolute;
  inset-inline-start: 50%;
  inset-block: -2px;
  border-inline-start: 1px solid var(--subtle);
}
.report-chart .axis-label { fill: var(--subtle); font: 14px system-ui, sans-serif; }
.chart-series-legend { display: flex; gap: 4px 7px; flex-wrap: wrap; align-items: center; font-size: .8rem; }
.chart-series-legend > span, .report-legend-button { display: inline-flex; align-items: center; gap: 5px; }
.report-legend-button {
  min-height: 30px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.report-legend-button[aria-pressed="false"] { background: transparent; color: var(--subtle); border-style: dashed; }
.report-legend-button[aria-pressed="false"] .legend-dot { opacity: .3; }
.legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; flex: none; }
.report-inspected {
  display: grid;
  gap: 6px;
  padding: 7px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--surface);
  font-size: .82rem;
  overflow-wrap: anywhere;
}
.report-inspected-period { color: var(--subtle); font-variant-numeric: tabular-nums; }
.report-inspected-values {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr));
  gap: 8px;
  margin: 0;
}
.report-inspected-values dd { margin: 0; }
.report-chart-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.report-inspected-metric .field-note { font-size: .75rem; }
.report-chart-actions, .report-imported-period { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 10px; }
.report-chart-actions .text-button { font-size: .8rem; min-height: 34px; }
.report-imported-period {
  justify-content: space-between;
  padding: 6px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--surface-raised);
}
.report-imported-period button { min-height: 33px; font-size: .8rem; }

@media (max-width: 800px) {
  .report-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-stat:nth-child(2) { border-inline-end: 0; }
  .report-stat:nth-child(-n+2) { border-bottom: 1px solid var(--line-soft); }
}
@media (max-width: 720px) {
  .report-tabs { flex-wrap: wrap; justify-content: start; }
  .report-tabs button { padding-inline: 8px; font-size: .8rem; flex: 1 0 auto; }
  .report-view .panel-inner { padding-inline: 10px; }
  #reports-content th, #reports-content td { padding-inline: 8px; }
  .report-chart .axis-label { font-size: 17px; }
  .report-figure { padding-inline: 7px; }
}

.report-extra > summary { min-height: 36px; display: list-item; padding: 5px 3px; }
.report-extra-body { display: grid; gap: 12px; min-width: 0; }
.report-extra .panel { min-width: 0; }
.report-extra .panel-inner { min-width: 0; }
.report-tools { justify-content: start; }
.report-tools label, .report-mini-form label { display: grid; gap: 4px; }
.report-mini-form, .report-compare-dates { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.report-rule-group { display: grid; gap: 6px; justify-items: start; min-width: 0; }
.report-rule-group .table-wrap { width: 100%; }
.report-rule-group h3 { font-size: .94rem; }
.distribution-overview { display: grid; grid-template-columns: minmax(145px, 210px) minmax(0, 1fr); gap: 16px; align-items: center; }
.donut-chart { width: min(100%, 210px); height: auto; justify-self: center; }
.donut-chart circle[tabindex]:hover, .donut-chart circle[tabindex]:focus { stroke-width: 18px; }
.distribution-plot { display: grid; justify-items: center; gap: 4px; text-align: center; }
.report-category-name .legend-dot { margin-inline-end: 6px; vertical-align: middle; }
.report-heat-cell { display: inline-block; min-width: 3.5em; text-align: end; border-radius: 5px; padding: 4px; }
.report-heat-cell[data-level="1"] { background: color-mix(in srgb,var(--chart-income) 13%,var(--surface)); }
.report-heat-cell[data-level="2"] { background: color-mix(in srgb,var(--chart-income) 24%,var(--surface)); }
.report-heat-cell[data-level="3"] { background: color-mix(in srgb,var(--chart-income) 34%,var(--surface)); }
.report-heat-cell[data-level="4"] { background: color-mix(in srgb,var(--chart-income) 45%,var(--surface)); }
.report-heat-cell[data-negative="true"] { background: color-mix(in srgb,var(--chart-expense) 24%,var(--surface)); }
dialog:has(.report-entry-drawer) { position: fixed; inset: 0 0 0 auto; margin: 0; width: min(100%, 650px); height: 100dvh; max-height: 100dvh; border-radius: 12px 0 0 12px; }
.report-entry-drawer { display: grid; gap: 8px; }
.report-card-manager .toolbar label { flex: 1 1 180px; }
@media(max-width:680px) {
 .distribution-overview { grid-template-columns: minmax(0, 1fr); gap: 9px; }
 .donut-chart { width: min(100%, 174px); }
 .report-tools { flex-wrap: wrap; }
}
@media print {
 body.print-report .sidebar, body.print-report .masthead, body.print-report .report-tabs,
 body.print-report .report-tools, body.print-report .report-date-controls, body.print-report button,
 body.print-report #reports-content > details, body.print-report .report-actions { display:none!important; }
 body.print-report #workspace { display:block!important; }
 body.print-report #reports-content .panel { break-inside: avoid; }
 body.print-report #reports-content .table-wrap { overflow:visible; }
 body.print-report #reports-content .report-scroll-table { max-height:none; }
}

.transaction-form > .transaction-amount-row { grid-row: 2; }
@media (max-width: 720px) {
  .transaction-form button.primary { position: sticky; bottom: 0; z-index: 1; }
}

.report-mini-trend {
  display: inline-block;
  width: 4.75rem;
  height: 1.25rem;
  vertical-align: middle;
}

.statement-match-list {
  max-height: 15rem;
  overflow: auto;
  display: grid;
  gap: .35rem;
}

.statement-match-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
}

.approval-preview { max-block-size: 20rem; white-space: pre-wrap; overflow: auto; overflow-wrap: anywhere; }
.register-filters { flex-basis: 100%; }
.ledger-destination { margin-bottom: 0.75rem; }

#settings-content { grid-template-columns: minmax(0, 1fr); }
#settings-content :where(.settings-group, .settings-group-body, .settings-subsection, .panel-inner, .table-wrap, details, form) {
  min-inline-size: 0;
  max-inline-size: 100%;
}
#settings-content .panel-inner { overflow-wrap: anywhere; }
#settings-content .list-row > * { min-inline-size: 0; }
#settings-content button { max-inline-size: 100%; overflow-wrap: anywhere; }
#settings-content .table-actions > button { white-space: normal; }

.brand img { width: 124px; height: auto; display: block; }
.brand img.brand-dark { display: none; }
:root[data-theme='dark'] .brand .brand-light { display: none; }
:root[data-theme='dark'] .brand .brand-dark { display: block; }
.brand-product { border-inline-start: 1px solid var(--control); padding-inline-start: .55rem; font-size: .75rem; letter-spacing: .13em; }
dialog::backdrop { background: var(--backdrop); }
html[lang='th'] body { line-height: 1.65; }
body { font-variant-numeric: tabular-nums lining-nums; }
input:not([type='checkbox']), textarea, select, .secondary { border-color: var(--control); }
.workspace-skip { position: absolute; inset-inline-start: 1rem; top: -10rem; z-index: 5; padding: .6rem .8rem; background: var(--action); color: var(--on-accent); }
.workspace-skip:focus { top: 1rem; }
