/* MoWallet: emerald actions, navy structure, and a compact financial ledger. */
:root {
  --sidebar-width: 204px;
  --topbar-height: 44px;
  --page-pad: 14px;
  --panel-pad: 10px;
  --gap: 10px;
  --control-height: 34px;
  --cell-y: 5px;
  --cell-x: 10px;
  --font-body: 13px;
  --radius: 6px;
  --color-primary: #007f5b;
  --color-primary-dark: color-mix(in srgb, var(--color-primary) 82%, #000);
  --color-primary-soft: color-mix(in srgb, var(--color-primary) 9%, transparent);
  --color-bg: #f2f7f7;
  --color-surface: #fff;
  --color-glass: rgb(255 255 255 / 96%);
  --color-sidebar: #082f49;
  --color-nav-text: #c3d5df;
  --color-nav-muted: #96b1c1;
  --color-nav-hover: #123e55;
  --color-nav-active: #0c514b;
  --color-nav-accent: #76efba;
  --color-nav-border: #24485e;
  --color-border: #d9e5e7;
  --color-text: #12354b;
  --color-muted: #607783;
  --color-soft: #f0f6f6;
  --color-success: #008254;
  --color-danger: #ba4750;
  --color-warning: #916019;
  --color-info: #356b8b;
  --color-chart-expense: #416b85;
  --color-brand-navy: #082f49;
  --shadow: 0 1px 2px rgb(8 47 73 / 4%);
  color-scheme: light;
  font: var(--font-body)/1.5 Inter, "Noto Sans Myanmar", system-ui, sans-serif;
  font-synthesis: none;
}
:root[data-theme="dark"] {
  --color-bg: #091c2a;
  --color-surface: #112c3c;
  --color-glass: rgb(17 44 60 / 96%);
  --color-sidebar: #071c2b;
  --color-nav-border: #203c4d;
  --color-border: #2c4859;
  --color-text: #e3eff5;
  --color-muted: #9cb7c5;
  --color-soft: #183747;
  --color-primary: #62dfac;
  --color-success: #62dfac;
  --color-danger: #ff9a9f;
  --color-warning: #e3bd70;
  --color-info: #92bfdc;
  --color-chart-expense: #8cb6d2;
  --shadow: none;
  color-scheme: dark;
}
:root[data-density="comfortable"] {
  --control-height: 40px;
  --cell-y: 8px;
  --panel-pad: 14px;
  --gap: 12px;
  --font-body: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--color-bg); color: var(--color-text); }
a { color: var(--color-primary); text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; font-weight: 750; letter-spacing: -.65px; line-height: 1.4; }
h2 { font-size: 14px; font-weight: 700; line-height: 1.55; }
h3 { font-size: 13px; }
strong { font-weight: 650; }
small, .small { font-size: 11px; }
svg { vertical-align: middle; flex-shrink: 0; }
.muted { color: var(--color-muted); }
.positive { color: var(--color-success); }
.negative, .danger-text { color: var(--color-danger) !important; }
.number, .metric strong, .book-row > strong, .balance-summary strong {
  text-align: right; font-variant-numeric: tabular-nums; letter-spacing: -.2px; white-space: nowrap;
}
.amount { font-weight: 700; }
.eyebrow { display: block; color: var(--color-primary); font-size: 10px; font-weight: 650; letter-spacing: .6px; margin-bottom: 4px; }
.page-heading .eyebrow, .panel-heading .eyebrow { display: none; }
.preserve-lines { white-space: pre-wrap; overflow-wrap: anywhere; }
.mobile-only { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.skip-link { position: fixed; top: -70px; left: 12px; padding: 10px; background: var(--color-surface); z-index: 200; }
.skip-link:focus { top: 8px; }

/* Compact navy navigation; app identity lives only in the top bar. */
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 80; width: var(--sidebar-width); padding: 12px 9px 9px; background: var(--color-sidebar); border-right: 1px solid var(--color-border); display: flex; flex-direction: column; overflow-y: auto; }
.nav-label { color: var(--color-nav-muted); font-size: 10px; font-weight: 650; letter-spacing: .9px; margin: 6px 9px 8px; }
.nav-label:not(:first-child) { margin-top: 20px; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 7px 9px; min-height: 36px; margin-bottom: 3px; border: 1px solid transparent; border-radius: 4px; color: var(--color-nav-text); font-size: 12px; line-height: 1.5; }
.nav-item .icon { width: 16px; height: 16px; }
.nav-item:hover { color: #fff; background: var(--color-nav-hover); }
.nav-item.is-active { color: var(--color-nav-accent); background: var(--color-nav-active); border-color: transparent; font-weight: 650; box-shadow: inset 3px 0 var(--color-nav-accent); }
.sidebar { border-color: var(--color-nav-border); }
.sidebar :focus-visible { outline-color: var(--color-nav-accent); }
.sidebar-bottom { margin-top: auto; padding-top: 20px; }
.currency-note { display: flex; align-items: center; gap: 8px; padding: 10px 7px; border-top: 1px solid var(--color-nav-border); margin-bottom: 5px; color: var(--color-nav-text); }
.currency-symbol { display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid var(--color-nav-border); border-radius: 4px; background: var(--color-nav-hover); color: var(--color-nav-accent); font-size: 14px; }
.currency-note strong, .currency-note small { display: block; font-size: 10px; }
.currency-note small { color: var(--color-nav-muted); }
.app-shell { margin-left: var(--sidebar-width); min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 60; height: var(--topbar-height); display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 var(--page-pad); border-bottom: 1px solid var(--color-border); background: var(--color-glass); backdrop-filter: blur(10px); }
.topbar-left, .topbar-actions { display: flex; align-items: center; gap: 8px; min-width: 0; }
.app-brand { display: inline-flex; align-items: center; gap: 7px; color: var(--color-text); font-weight: 750; letter-spacing: -.4px; white-space: nowrap; }
.app-brand .icon { color: var(--color-primary); width: 20px; height: 20px; }
.app-brand small { color: var(--color-muted); font-size: 10px; font-weight: 450; letter-spacing: 0; border-left: 1px solid var(--color-border); padding-left: 8px; margin-left: 2px; }
.brand-name > span { color: var(--color-primary); }
.app-logo { width: 32px; height: 32px; object-fit: contain; flex-shrink: 0; border-radius: 7px; }
.auth-logo { width: 48px; height: 48px; object-fit: contain; flex-shrink: 0; border-radius: 10px; }
.branding-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.branding-choice { display: flex; align-items: center; gap: 12px; min-width: 0; }
.branding-choice .field { flex: 1; }
.branding-preview { display: grid; place-items: center; width: 68px; height: 68px; flex-shrink: 0; border: 1px solid var(--color-border); border-radius: 6px; background: var(--color-soft); }
.branding-preview img { width: 56px; height: 56px; object-fit: contain; }
.favicon-preview img { width: 32px; height: 32px; }
.branding-choice input { font-size: 12px; overflow: hidden; }
.branding-panel .form-actions { justify-content: space-between; }
.branding-panel .form-actions .field-hint { margin: 0; }
.branding-panel .form-actions .button { flex-shrink: 0; }
.branding-resets { display: flex; gap: 14px; margin-top: 6px; }
.breadcrumb { font-size: 11px; color: var(--color-muted); min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.breadcrumb::before { content: "/"; margin: 0 10px 0 3px; color: var(--color-border); }
.breadcrumb strong { font-weight: 500; }
.today { color: var(--color-muted); font-size: 11px; white-space: nowrap; }
.language { font-size: 11px; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 5px; color: var(--color-muted); background: transparent; border: 1px solid transparent; border-radius: 4px; }
.icon-button:hover { color: var(--color-primary); background: var(--color-primary-soft); }
.inline { display: inline-flex; margin: 0; }
.content { max-width: 1560px; padding: 14px var(--page-pad) 0; margin: auto; }
.page-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 12px; }
.page-heading > div:first-child { min-width: 0; flex: 1; }
.page-heading p { color: var(--color-muted); font-size: 12px; margin-top: 2px; line-height: 1.55; }
.heading-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.page-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 16px 0 10px; color: var(--color-muted); font-size: 10px; }
.page-footer .muted { display: none; }

/* Shared controls and work surfaces. */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--control-height); padding: 6px 10px; border: 1px solid var(--color-border); border-radius: 4px; background: var(--color-surface); color: var(--color-text); font-size: 12px; font-weight: 550; line-height: 1.4; text-align: center; }
.button:hover { border-color: var(--color-muted); background: var(--color-soft); }
.button.primary { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
:root[data-theme="dark"] .button.primary { color: #082f35; }
.button.primary:hover { background: var(--color-primary-dark); }
.button.danger-button { color: #fff; background: var(--color-danger); border-color: var(--color-danger); }
.button .icon { width: 15px; height: 15px; }
.button:disabled { opacity: .5; cursor: not-allowed; }
.text-button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 28px; padding: 3px; background: transparent; border: 0; color: var(--color-primary); font-size: 11px; font-weight: 550; line-height: 1.6; }
.text-button:hover { text-decoration: underline; }
.text-button .icon { width: 15px; height: 15px; }
.row-action-icon { display: none; }
.full-width { width: 100%; }
.panel { min-width: 0; padding: var(--panel-pad); margin-bottom: var(--gap); border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; margin-bottom: 8px; }
.panel-heading > .icon { color: var(--color-muted); }
.metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.metric { position: relative; min-width: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; min-height: 70px; padding: 8px 10px; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); }
.metric > div { min-width: 0; }
.metric-label { display: block; color: var(--color-muted); font-size: 11px; margin-bottom: 2px; }
.metric strong { display: block; text-align: left; font-size: 21px; font-weight: 700; line-height: 1.35; letter-spacing: -.6px; white-space: normal; }
.metric small { display: block; color: var(--color-muted); font-size: 10px; margin-top: 2px; }
.metric-icon { display: grid; place-items: center; flex-shrink: 0; width: 25px; height: 25px; background: var(--color-soft); color: var(--color-muted); border-radius: 4px; }
.metric-icon .icon { width: 15px; height: 15px; }
.metric-icon.success { color: var(--color-success); background: color-mix(in srgb,var(--color-success) 9%,transparent); }
.metric-icon.danger { color: var(--color-danger); background: color-mix(in srgb,var(--color-danger) 9%,transparent); }
.metric-icon.brand { color: var(--color-primary); background: var(--color-primary-soft); }
.metric.brand { border-color: var(--color-brand-navy); background: var(--color-brand-navy); color: #fff; }
.metric.brand .metric-label, .metric.brand small { color: #bdd5df; }
.metric.brand .metric-icon { color: var(--color-nav-accent); background: rgb(118 239 186 / 12%); }
.two-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); max-width: 800px; }
.three-metrics { grid-template-columns: repeat(3,minmax(0,1fr)); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0,2.15fr) minmax(280px,1fr); gap: var(--gap); }
.dashboard-grid .ledger-table .row-note { max-width: 150px; }
.dashboard-grid .ledger-table .actions-col { position: static; box-shadow: none; }
.main-stack, .side-stack { min-width: 0; }
.report-grid, .settings-grid { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(280px,1fr); gap: var(--gap); }
.detail-grid { display: grid; grid-template-columns: minmax(0,1.8fr) minmax(290px,1fr); gap: var(--gap); }
.book-list { margin: 7px 0; }
.dashboard-books { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 16px; }
.book-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; border-top: 1px solid var(--color-border); margin-top: 3px; padding-top: 5px; }
.book-row { display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 7px 0; border-top: 1px solid var(--color-border); color: var(--color-text); }
.book-row > span:nth-child(2) { flex: 1; min-width: 0; }
.book-row strong { font-size: 12px; overflow-wrap: anywhere; }
.book-row small { display: block; color: var(--color-muted); font-size: 10px; }
.book-icon { display: grid; place-items: center; width: 27px; height: 30px; border: 1px solid var(--color-border); border-left: 3px solid var(--color-primary); border-radius: 3px; color: var(--color-primary); background: var(--color-soft); }
.book-icon .icon { width: 14px; height: 14px; }
.balance-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px 0; }
.balance-summary > div + div { border-left: 1px solid var(--color-border); padding-left: 12px; }
.balance-summary span { display: block; font-size: 11px; color: var(--color-muted); }
.balance-summary strong { display: block; text-align: left; font-size: 18px; white-space: normal; }
.due-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--color-border); color: var(--color-text); }
.due-row strong { font-size: 12px; }
.due-row small { display: block; color: var(--color-muted); font-size: 10px; }
.due-row > span:last-child { text-align: right; }
.panel-link { display: flex; justify-content: flex-start; border-top: 1px solid var(--color-border); padding-top: 7px; margin-top: 3px; }
.quiet-note { display: flex; align-items: flex-start; gap: 7px; padding: 5px 1px; font-size: 11px; color: var(--color-muted); }
.quiet-note .icon { width: 15px; height: 15px; margin-top: 2px; }

/* Filter fields scroll independently; Apply and Reset always remain reachable. */
.filter-disclosure > summary { display: none; list-style: none; }
.filter-disclosure > summary::-webkit-details-marker { display: none; }
.filter-bar { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; align-items: end; }
.filter-scroll { min-width: 0; overflow-x: auto; padding: 2px 2px 5px; scrollbar-width: thin; }
.filter-fields { display: flex; align-items: flex-end; gap: 8px; width: max-content; min-width: 100%; }
.filter-fields > .field { flex: 0 0 154px; width: 154px; }
.filter-fields > .business-field { flex-basis: 190px; width: 190px; }
.filter-fields > .search-field { flex: 1 0 205px; width: 205px; }
.filter-fields > .date-field { flex: 0 0 142px; width: 142px; }
.filter-actions { display: flex; align-items: center; gap: 8px; padding-bottom: 5px; min-height: var(--control-height); white-space: nowrap; }
.filter-actions .button { white-space: nowrap; }
.field { display: flex; flex-direction: column; min-width: 0; gap: 3px; font-size: 11px; }
.field > span:first-child { font-weight: 550; color: var(--color-muted); }
.required { color: var(--color-primary); }
input, select, textarea { width: 100%; min-width: 0; min-height: var(--control-height); padding: 6px 8px; border: 1px solid var(--color-border); border-radius: 4px; background: var(--color-surface); color: var(--color-text); font-size: 12px; line-height: 1.4; }
select { padding-right: 22px; }
textarea { min-height: 64px; resize: vertical; }
input::placeholder { color: var(--color-muted); }
:is(input:not([type="checkbox"]):not([type="radio"]), select, textarea):focus {
  border-color: var(--field-focus, var(--color-primary));
  outline: 2px solid var(--field-focus, var(--color-primary));
  outline-offset: -2px;
  box-shadow: none;
}
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] {
  --field-focus: var(--color-danger);
  border-color: var(--color-danger);
}
input[type="number"] { font-variant-numeric: tabular-nums; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px 14px; }
.field-group { display: contents; }
.form-panel { max-width: 880px; padding: 12px; border-top: 3px solid var(--color-primary); }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding-top: 11px; margin-top: 11px; border-top: 1px solid var(--color-border); }
.field-error { display: block; color: var(--color-danger); font-size: 11px; line-height: 1.6; }
.field-hint { color: var(--color-muted); font-size: 11px; line-height: 1.65; margin: 6px 0; }
.stack-form { display: grid; gap: 10px; margin-top: 10px; }
.stack-form .button { justify-self: start; }
.settlement-panel { align-self: start; padding: 12px; border-top: 3px solid var(--color-primary); }
.notice { margin-bottom: 10px; padding: 8px 10px; border: 1px solid color-mix(in srgb,var(--color-primary) 25%,transparent); border-radius: 4px; background: var(--color-primary-soft); color: var(--color-primary); font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }
.notice.danger { color: var(--color-danger); border-color: color-mix(in srgb,var(--color-danger) 30%,transparent); background: color-mix(in srgb,var(--color-danger) 7%,var(--color-surface)); }
.notice.warning { color: var(--color-warning); border-color: color-mix(in srgb,var(--color-warning) 30%,transparent); background: color-mix(in srgb,var(--color-warning) 7%,var(--color-surface)); }
.notice a { text-decoration: underline; }

/* Ledger rows, aligned money columns, and compact directory lists. */
.table-wrap { overflow: auto; max-height: 650px; border: 1px solid var(--color-border); border-radius: 4px; scrollbar-width: thin; }
table { width: 100%; min-width: 600px; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.report-grid table { min-width: 460px; }
.ledger-table td:nth-child(3) small { white-space: nowrap; }
th { position: sticky; top: 0; z-index: 2; padding: 8px var(--cell-x); border-bottom: 1px solid var(--color-border); background: var(--color-soft); color: var(--color-muted); font-size: 10px; font-weight: 650; text-align: left; white-space: nowrap; }
td { min-height: 38px; height: 38px; padding: var(--cell-y) var(--cell-x); border-bottom: 1px solid var(--color-border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) td { background: color-mix(in srgb,var(--color-soft) 45%,var(--color-surface)); }
tbody tr:hover td { background: var(--color-soft); }
td strong { font-size: 12px; }
td small { display: block; color: var(--color-muted); font-size: 10px; line-height: 1.45; }
.row-note { max-width: 200px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.actions-col { position: sticky; right: 0; background: var(--color-surface); text-align: right; white-space: nowrap; box-shadow: -2px 0 3px rgb(8 47 73 / 2%); }
th.actions-col { z-index: 3; background: var(--color-soft); }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.row-actions form { margin: 0; }
.list-summary { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; font-size: 11px; color: var(--color-muted); }
.badge { display: inline-flex; align-items: center; gap: 4px; min-height: 20px; padding: 2px 6px; border-radius: 4px; background: var(--color-soft); color: var(--color-muted); font-size: 10px; font-weight: 550; line-height: 1.45; white-space: nowrap; }
.badge > span { font-size: 6px; }
.badge.success { color: var(--color-success); background: color-mix(in srgb,var(--color-success) 9%,transparent); }
.badge.danger { color: var(--color-danger); background: color-mix(in srgb,var(--color-danger) 8%,transparent); }
.badge.warning { color: var(--color-warning); background: color-mix(in srgb,var(--color-warning) 10%,transparent); }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 25px 14px; text-align: center; color: var(--color-muted); font-size: 12px; }
.empty-state > .icon { width: 25px; height: 25px; margin-bottom: 3px; opacity: .65; }
.empty-state strong { color: var(--color-text); font-size: 13px; }
.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 9px; font-size: 11px; color: var(--color-muted); }
.pagination > div { display: flex; gap: 7px; }
.detail-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 8px 0; }
.detail-facts dt { color: var(--color-muted); font-size: 11px; }
.detail-facts dd { margin: 2px 0 0; font-size: 12px; overflow-wrap: anywhere; }
.settled-check { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--color-primary-soft); color: var(--color-primary); font-size: 20px; margin: 6px; }
.settings-grid .panel { padding: 14px; }
.preference-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0; }
.preference-row select { width: auto; min-width: 150px; }
.settings-divider { height: 1px; background: var(--color-border); margin: 14px 0; }
.settings-grid h2 + p { margin: 8px 0; line-height: 1.65; }

/* Charts are supporting evidence, leaving room for the actual ledger. */
.chart-legend { display: flex; align-items: center; gap: 14px; margin: 1px 0 8px; color: var(--color-muted); font-size: 10px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend span:last-child { margin-left: auto; }
.legend-dot { display: inline-block; width: 7px; height: 7px; border-radius: 2px; }
.income-dot, .income-bar, .income-fill { background: var(--color-primary); }
.expense-dot, .expense-bar, .expense-fill { background: var(--color-chart-expense); }
.chart-empty { position: relative; display: grid; place-items: center; height: 150px; color: var(--color-muted); font-size: 12px; }
.empty-grid { position: absolute; inset: 0; background: repeating-linear-gradient(to top,transparent,transparent 35px,var(--color-border) 35px,var(--color-border) 36px); opacity: .6; }
.chart-empty p { z-index: 1; padding: 7px; background: var(--color-surface); text-align: center; }
.bar-chart { display: flex; align-items: flex-end; gap: 16px; height: 160px; padding: 4px 10px 0; margin-bottom: 6px; overflow-x: auto; background: repeating-linear-gradient(to top,transparent,transparent 35px,var(--color-border) 35px,var(--color-border) 36px); }
.bar-group { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; flex: 1; min-width: 58px; height: 100%; }
.bar-pair { display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: calc(100% - 25px); width: 100%; }
.chart-bar { width: 26%; max-width: 30px; min-height: 2px; border-radius: 2px 2px 0 0; }
.bar-group > span { width: 100%; height: 25px; padding-top: 5px; background: var(--color-surface); color: var(--color-muted); font-size: 10px; text-align: center; white-space: nowrap; }
.category-row { padding: 8px 0; border-bottom: 1px solid var(--color-border); }
.category-row:last-child { border-bottom: 0; }
.category-row > div:first-child { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 11px; }
.category-row strong { flex: 1; }
.category-row .number { font-weight: 650; }
.progress-track { height: 4px; border-radius: 2px; background: var(--color-soft); overflow: hidden; }
.progress-track > span { display: block; height: 100%; border-radius: 2px; }
dialog { width: min(450px,calc(100vw - 24px)); padding: 0; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-surface); color: var(--color-text); box-shadow: 0 12px 35px rgb(0 0 0 / 18%); }
dialog::backdrop { background: rgb(4 23 37 / 50%); }
.dialog-content { padding: 20px; }
.dialog-content h2 { font-size: 19px; margin: 4px 0 9px; }
.dialog-content p { color: var(--color-muted); font-size: 12px; line-height: 1.7; }
.nav-overlay { display: none; }
.sidebar-collapsed { --sidebar-width: 56px; }
.sidebar-collapsed .sidebar { padding-inline: 6px; }
.sidebar-collapsed .nav-copy, .sidebar-collapsed .nav-label { display: none; }
.sidebar-collapsed .nav-item { justify-content: center; padding: 9px; }

/* Contact import and the finance-book cover on authentication screens. */
.import-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: var(--gap); max-width: 1000px; }
.import-method { padding: 14px; }
.import-method > .metric-icon { float: right; margin-left: 8px; }
.import-method h2 { margin-bottom: 6px; }
.import-method > p { margin-bottom: 10px; color: var(--color-muted); font-size: 12px; line-height: 1.7; }
.import-method input[type="file"] { height: auto; font-size: 12px; overflow: hidden; }
.checkbox-label { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.contact-checkbox, .checkbox-label input { width: 18px; height: 18px; min-height: 18px; padding: 0; accent-color: var(--color-primary); cursor: pointer; }
.contact-checkbox:disabled { cursor: default; }
.contact-table { min-width: 630px; }
.contact-table td:first-child { width: 95px; }
.contact-table td:nth-child(2) { min-width: 140px; }
.contact-table td:nth-child(3) { white-space: nowrap; }
.contact-notes { max-width: 260px; }
.form-actions [data-selected-count] { margin-right: auto; }
.auth-story .brand { display: flex; align-items: center; gap: 9px; color: var(--color-text); font-size: 22px; font-weight: 750; letter-spacing: -.6px; }
.brand-mark { display: grid; place-items: center; width: 33px; height: 36px; border-radius: 4px; background: var(--color-primary); color: #fff; }
.brand-mark svg { width: 22px; height: 22px; }
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-wrap { display: grid; grid-template-columns: 1fr 1fr; max-width: 860px; width: 100%; min-height: 460px; border: 1px solid var(--color-border); border-radius: 8px; overflow: hidden; background: var(--color-surface); box-shadow: 0 10px 40px rgb(8 47 73 / 6%); }
.auth-story { display: flex; flex-direction: column; justify-content: center; padding: 26px; border-left: 5px solid var(--color-primary); background: var(--color-brand-navy); color: #edf9f6; }
.auth-story .brand { color: #fff; margin-bottom: 30px; }
.auth-story .brand-name > span { color: var(--color-nav-accent); }
.auth-story .brand-mark { color: var(--color-nav-accent); background: var(--color-nav-hover); }
.auth-story .eyebrow { color: var(--color-nav-accent); font-size: 10px; }
.auth-story h1 { max-width: 340px; font-size: 30px; letter-spacing: -.8px; line-height: 1.25; margin: 8px 0 12px; }
.auth-story p { color: #c3d5df; font-size: 12px; line-height: 1.8; }
.auth-story > small { color: #96b1c1; margin-top: 16px; font-size: 10px; }
.auth-visual { padding-top: 25px; }
.visual-ledger { display: flex; align-items: flex-end; gap: 16px; padding: 12px; border: 1px solid var(--color-nav-border); border-radius: 4px; background: var(--color-nav-hover); }
.visual-ledger > span { color: var(--color-nav-accent); font-size: 12px; }
.visual-ledger > span:last-child { margin-left: auto; font-size: 24px; }
.visual-bars { display: flex; align-items: flex-end; gap: 8px; flex: 1; height: 65px; }
.visual-bars i { display: block; width: 12px; height: 40%; border-radius: 2px 2px 0 0; background: var(--color-nav-accent); }
.visual-bars i:nth-child(2) { height: 60%; }.visual-bars i:nth-child(3) { height: 52%; }.visual-bars i:nth-child(4) { height: 78%; }.visual-bars i:nth-child(5) { height: 64%; }.visual-bars i:nth-child(6) { height: 88%; }.visual-bars i:nth-child(7) { height: 100%; }
.auth-card { position: relative; display: flex; flex-direction: column; justify-content: center; padding: 34px 30px; }
.auth-language { position: absolute; top: 12px; right: 20px; }
.auth-card h2 { font-size: 24px; letter-spacing: -.5px; margin: 4px 0; }
.auth-card > p { font-size: 12px; }
.auth-form { display: grid; gap: 11px; margin-top: 20px; }
.auth-form .button { justify-content: space-between; margin-top: 3px; }
.auth-footnote { margin-top: 18px; color: var(--color-muted); font-size: 10px !important; text-align: center; }
.auth-card .notice { margin-top: 12px; margin-bottom: 0; }
html[lang="my"] { line-height: 1.8; }
html[lang="my"] h1 { font-size: 20px; letter-spacing: 0; line-height: 1.7; }
html[lang="my"] h2 { line-height: 1.8; }
html[lang="my"] .eyebrow { letter-spacing: 0; }
html[lang="my"] .nav-item { font-size: 11px; line-height: 1.8; }
html[lang="my"] .auth-story h1 { font-size: 28px; }
html[lang="my"] .field > span:first-child { line-height: 1.8; }

@media (max-width: 1100px) {
  .dashboard-grid, .report-grid, .detail-grid { grid-template-columns: 1fr; }
  .side-stack { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
  .side-stack .quiet-note { grid-column: 1 / -1; }
  .settings-grid { grid-template-columns: 1fr; }
  .metric strong { font-size: 19px; }
  .metric-icon { width: 22px; height: 22px; }
  .topbar .today, .app-brand small { display: none; }
}
@media (max-width: 760px) {
  :root, :root[data-density="comfortable"] { --sidebar-width: 220px; --topbar-height: 48px; --page-pad: 10px; --panel-pad: 9px; --control-height: 40px; --gap: 8px; --cell-y: 5px; --cell-x: 8px; --font-body: 13px; }
  .sidebar { transform: translateX(-100%); transition: transform .15s ease; }
  .app-shell { margin-left: 0; }
  .nav-open { overflow: hidden; }
  .nav-open .sidebar { transform: translateX(0); }
  .nav-open .nav-overlay { display: block; position: fixed; inset: 0; background: rgb(4 23 37 / 50%); z-index: 70; }
  .sidebar-collapsed .nav-copy, .sidebar-collapsed .nav-label { display: revert; }
  .sidebar-collapsed .nav-item { justify-content: flex-start; }
  .sidebar-collapsed .sidebar { padding-inline: 9px; }
  .nav-item { min-height: 40px; }
  .breadcrumb { display: none; }
  .topbar { padding-inline: 6px; }
  .topbar-left, .topbar-actions { gap: 3px; }
  .app-brand { font-size: 14px; gap: 5px; }
  .app-brand .icon { width: 18px; height: 18px; }
  .app-logo { width: 30px; height: 30px; }
  .branding-grid { grid-template-columns: 1fr; gap: 10px; }
  .branding-panel .panel-heading { flex-wrap: wrap; }
  .branding-panel .form-actions { align-items: flex-end; }
  .branding-panel .form-actions .field-hint { font-size: 10px; }
  .icon-button { min-width: 40px; height: 40px; }
  .language { min-width: 42px; }
  .text-button { min-height: 40px; }
  .button { font-size: 12px; padding: 6px 9px; }
  .content { padding-top: 10px; }
  h1 { font-size: 20px; }
  .page-heading { gap: 7px; margin-bottom: 9px; }
  .page-heading > div:first-child { flex-basis: auto; }
  .page-heading p { display: none; }
  .page-heading .record-context { display: block; font-size: 11px; }
  .page-heading > .button { margin-left: auto; }
  .heading-actions { gap: 5px; }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .three-metrics .metric:last-child { grid-column: 1 / -1; }
  .metric { min-height: 67px; padding: 8px 9px; }
  .metric strong { font-size: 18px; }
  .metric-icon { position: absolute; top: 7px; right: 7px; width: 19px; height: 19px; }
  .metric-icon .icon { width: 13px; height: 13px; }
  .metric-label { font-size: 10px; padding-right: 17px; }
  .metric small { font-size: 10px; }
  .metric > div { width: 100%; }
  .side-stack { display: block; }
  .dashboard-books { grid-template-columns: 1fr; }
  .panel-heading { min-height: 26px; margin-bottom: 5px; }
  .panel-heading h2 { font-size: 14px; }
  .filter-disclosure > summary { display: flex; align-items: center; gap: 7px; min-height: 40px; cursor: pointer; font-size: 12px; }
  .filter-disclosure > summary .icon { width: 15px; height: 15px; color: var(--color-primary); }
  .filter-disclosure > summary > .icon:last-child { margin-left: auto; transition: transform .15s; }
  .filter-disclosure[open] > summary > .icon:last-child { transform: rotate(90deg); }
  .filter-period { color: var(--color-muted); font-size: 10px; margin-left: auto; white-space: nowrap; }
  .filter-count { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 3px; background: var(--color-primary-soft); color: var(--color-primary); font-size: 10px; }
  .filter-bar { display: block; padding-top: 6px; }
  .filter-scroll { overflow: visible; padding: 0; }
  .filter-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; min-width: 0; width: 100%; }
  .filter-fields > .field, .filter-fields > .date-field, .filter-fields > .search-field { width: auto; min-width: 0; }
  .filter-fields > .search-field { grid-column: 1 / -1; }
  .filter-actions { justify-content: flex-end; margin-top: 9px; padding: 0; }
  .field { font-size: 11px; }
  input, select, textarea { font-size: 16px; padding: 5px 7px; }
  .form-panel { padding: 11px; }
  .form-grid { gap: 10px; }
  .form-grid > .field-group > .text-button { align-self: end; font-size: 11px; }
  .form-actions { gap: 6px; padding-top: 9px; margin-top: 10px; }
  .form-actions .button { min-width: 0; }
  .field-hint, .field-error { font-size: 11px; }
  .stack-form { gap: 9px; }
  .stack-form .button { justify-self: stretch; }
  .book-row { min-height: 42px; padding: 6px 0; }
  .book-row > strong { font-size: 13px; }
  .balance-summary strong { font-size: 19px; }
  .due-row { padding-block: 6px; }
  .table-wrap { max-height: 600px; }
  table { min-width: 520px; }
  td { height: 44px; }
  .list-summary { padding-block: 6px; font-size: 10px; }
  .row-actions { gap: 1px; }
  .row-action-icon { display: inline-flex; }
  .row-action-label { display: none; }
  .row-actions .text-button, .row-view { min-width: 40px; }
  .mobile-only { display: block; }
  .entry-meta { max-width: 100%; color: var(--color-muted); font-size: 10px; line-height: 1.5; white-space: normal; overflow-wrap: anywhere; }
  .entry-status { margin-top: 3px; }
  .ledger-table, .entity-table, .debt-table, .payment-table { min-width: 0; table-layout: auto; }
  .ledger-table td:first-child { width: 100%; max-width: 1px; }
  .ledger-table .row-note { max-width: 100%; }
  .ledger-table td:first-child strong { font-size: 11px; }
  .ledger-table th:nth-child(2), .ledger-table th:nth-child(3), .ledger-table th:nth-child(4), .ledger-table th:nth-child(5),
  .ledger-table td:nth-child(2), .ledger-table td:nth-child(3), .ledger-table td:nth-child(4), .ledger-table td:nth-child(5) { display: none; }
  .ledger-table td.number { font-size: 13px; }
  .ledger-table .actions-col, .entity-table .actions-col, .debt-table .actions-col, .payment-table .actions-col { position: static; box-shadow: none; padding-left: 1px; padding-right: 3px; }
  .ledger-table .actions-col { width: 80px; }
  .entity-table th:not(:first-child):not(:last-child), .entity-table td:not(:first-child):not(:last-child) { display: none; }
  .entity-table td:first-child { width: 100%; max-width: 1px; }
  .entity-table .row-note { max-width: 100%; }
  .entity-money { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 3px; font-size: 11px; font-variant-numeric: tabular-nums; }
  .entity-money > span { white-space: nowrap; }
  .entity-table .person-balances { display: none; }
  .identity-link { color: var(--color-text); }
  .identity-link:hover { color: var(--color-primary); }
  .debt-table th:nth-child(2), .debt-table th:nth-child(3), .debt-table th:nth-child(4), .debt-table th:nth-child(5), .debt-table th:nth-child(7),
  .debt-table td:nth-child(2), .debt-table td:nth-child(3), .debt-table td:nth-child(4), .debt-table td:nth-child(5), .debt-table td:nth-child(7) { display: none; }
  .debt-table td:first-child { width: 100%; }
  .debt-table td.number { font-size: 14px; }
  .payment-table th:nth-child(2), .payment-table td:nth-child(2) { display: none; }
  .payment-table td:first-child { width: 100%; }
  .payment-table .row-note { max-width: 150px; }
  .payment-table td.number { font-size: 14px; }
  .report-grid table { min-width: 450px; }
  .detail-facts { gap: 8px 10px; }
  .detail-facts dd { font-size: 12px; }
  .settlement-panel, .settings-grid .panel { padding: 11px; }
  .settlement-panel > .eyebrow { display: none; }
  .settlement-form { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .settlement-form > .button { grid-column: 1 / -1; }
  .settings-grid .muted { font-size: 12px; }
  .preference-row { align-items: center; }
  .preference-row > span, .preference-row > label { flex: 1; min-width: 0; }
  .preference-row select { min-width: 130px; max-width: 60%; font-size: 14px; }
  .bar-chart { height: 130px; gap: 10px; }
  .chart-empty { height: 120px; }
  .page-footer { padding-top: 12px; font-size: 9px; }
  .import-grid { grid-template-columns: 1fr; }
  .import-method { padding: 11px; }
  .import-method > p { font-size: 11px; margin-bottom: 8px; }
  .import-method .button { width: 100%; }
  .contact-checkbox, .checkbox-label input { width: 24px; height: 24px; min-height: 24px; }
  .contact-table td:first-child { min-width: 90px; }
  .contact-table td:first-child input { margin: 5px; }
  .auth-body { padding: 12px; }
  .auth-wrap { grid-template-columns: 1fr; max-width: 440px; min-height: 0; }
  .auth-story { padding: 14px 20px; border-left-width: 5px; }
  .auth-story .brand { margin: 0; font-size: 20px; }
  .auth-story > .eyebrow, .auth-story h1, .auth-story > p, .auth-story > small, .auth-visual { display: none; }
  .auth-card { padding: 40px 20px 20px; }
  .auth-card h2 { font-size: 23px; }
  .auth-form { margin-top: 14px; }
  .auth-language { top: 6px; right: 15px; }
  html[lang="my"] h1 { font-size: 18px; }
  html[lang="my"] .button { font-size: 11px; }
  html[lang="my"] .filter-period { font-size: 9px; }
  html[lang="my"] .metric strong { font-size: 17px; }
}
@media (max-width: 360px) {
  .form-grid { grid-template-columns: 1fr; }
  .page-heading > div:first-child { flex-basis: 100%; }
  .page-heading > .button { margin-left: 0; }
  .heading-actions { width: 100%; }
  .metric strong { font-size: 16px; }
  .ledger-table .row-actions { flex-direction: column; }
  .ledger-table .row-actions .text-button { min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .topbar { background: var(--color-surface); backdrop-filter: none; }
}
