:root {
  color-scheme: light;
  --page: #f4f7f4;
  --surface: #ffffff;
  --surface-soft: #edf3ee;
  --text: #1d2923;
  --muted: #52645a;
  --line: #d9e3db;
  --green: #176c4b;
  --green-soft: #e2f3e8;
  --amber: #85570d;
  --amber-soft: #fff1d3;
  --red: #aa4038;
  --red-soft: #ffebe9;
  --shadow: 0 16px 42px #19362212;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--page); color: var(--text); }
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #4a9b77; outline-offset: 2px; }
.material-symbols-outlined { font-family: "Material Symbols Outlined"; font-weight: normal; font-style: normal; font-size: 20px; line-height: 1; letter-spacing: normal; text-transform: none; display: inline-flex; white-space: nowrap; word-wrap: normal; direction: ltr; font-feature-settings: "liga"; -webkit-font-feature-settings: "liga"; -webkit-font-smoothing: antialiased; }
.material-symbols-outlined.symbol-fallback { font-family: "Segoe UI Symbol", system-ui, sans-serif; font-weight: 600; font-size: 18px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 214px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 17px 13px; background: var(--surface); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; min-height: 39px; padding: 0 6px 17px; font-size: 15px; font-weight: 700; letter-spacing: -.03em; }
.brand-mark { display: grid; width: 31px; height: 31px; place-items: center; border-radius: 9px; background: var(--green); color: #fff; }
.nav-list { display: grid; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 42px; padding: 0 11px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); text-align: left; font-size: 13px; font-weight: 600; cursor: pointer; }
.nav-item .material-symbols-outlined { font-size: 19px; }
.nav-item:hover { background: var(--surface-soft); }
.nav-item.is-active { color: var(--green); background: var(--green-soft); }
.sidebar-bottom { margin-top: auto; }
.sidebar-note { margin: 11px 7px 0; padding-top: 11px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.45; }
.main-area { min-width: 0; }
.topbar { position: sticky; z-index: 5; top: 0; display: flex; min-height: 58px; justify-content: space-between; align-items: center; gap: 14px; padding: 0 25px; border-bottom: 1px solid var(--line); background: #ffffffed; backdrop-filter: blur(10px); }
.topbar-title { color: var(--muted); font-size: 13px; font-weight: 500; }
.topbar-title span:first-child { margin: 0 7px; color: #87968c; }
.topbar-actions { display: flex; align-items: center; gap: 11px; }
.cloud-status { display: inline-flex; align-items: center; min-height: 29px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--green); font-size: 12px; font-weight: 700; white-space: nowrap; }
.cloud-status[data-tone="busy"] { color: #78550b; background: #fff7e7; }
.cloud-status[data-tone="error"] { color: #b33b32; background: #fff0ee; border-color: #f0c8c4; }
.demo-pill { display: inline-flex; align-items: center; min-height: 29px; padding: 0 10px; border-radius: 999px; background: var(--amber-soft); color: var(--amber); font-size: 12px; font-weight: 700; white-space: nowrap; }
.button { display: inline-flex; min-height: 40px; justify-content: center; align-items: center; gap: 7px; padding: 0 13px; border: 1px solid transparent; border-radius: 9px; font-size: 13px; font-weight: 650; white-space: nowrap; cursor: pointer; transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.button:hover { transform: translateY(-1px); }
.button .material-symbols-outlined { font-size: 19px; }
.button-primary { background: var(--green); color: #fff; }
.button-primary:hover { background: #105a3e; }
.button-secondary { border-color: var(--line); background: var(--surface); color: var(--text); }
.button-secondary:hover { background: var(--surface-soft); }
.button-danger-outline { border-color: #e8b5b1; background: var(--surface); color: var(--red); }
.button-danger-outline:hover { background: var(--red-soft); }
.text-button { display: inline-flex; min-height: 38px; align-items: center; gap: 5px; padding: 0 6px; border: 0; background: none; color: var(--green); font-size: 13px; font-weight: 650; cursor: pointer; }
.text-button:hover { text-decoration: underline; }
.icon-button { display: inline-grid; width: 40px; height: 40px; flex: 0 0 40px; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--muted); cursor: pointer; }
.icon-button:hover { background: var(--surface-soft); }
.page-content { width: min(1230px, 100%); margin: 0 auto; padding: 20px 26px 34px; }
.demo-banner { display: flex; align-items: center; gap: 9px; margin-bottom: 17px; padding: 11px 13px; border: 1px solid #e8d29f; border-radius: 10px; background: #fffaeb; color: #694b17; font-size: 13px; line-height: 1.45; }
.demo-banner > .material-symbols-outlined { flex: 0 0 auto; font-size: 19px; }
.demo-banner strong { font-weight: 700; }
.demo-banner .text-button { margin-left: auto; flex: 0 0 auto; color: #694b17; }
.cloud-error-banner { border-color: #f0c8c4; background: #fff0ee; color: #862b25; }
.view-panel.is-hidden, .is-hidden { display: none !important; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 15px; margin-bottom: 15px; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
h1 { margin: 0; font-size: 24px; line-height: 1.18; letter-spacing: -.045em; }
h2 { margin: 0; font-size: 15px; letter-spacing: -.02em; }
.page-subtitle { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.month-control { display: inline-flex; min-height: 40px; align-items: center; gap: 5px; padding: 3px 5px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--muted); }
.month-control .material-symbols-outlined { font-size: 18px; }
.month-control input { width: 123px; padding: 0; border: 0; background: transparent; color: var(--text); font-size: 13px; font-weight: 600; }
.month-control .month-calendar { flex: 0 0 auto; }
.month-step { display: inline-grid; width: 32px; height: 32px; flex: 0 0 32px; place-items: center; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }
.month-step:hover { background: var(--surface-soft); color: var(--green); }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.metric-card { min-width: 0; padding: 12px 14px 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.metric-label { color: var(--muted); font-size: 13px; font-weight: 500; }
.metric-value { margin-top: 6px; font-size: 21px; line-height: 1.12; font-weight: 700; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.metric-hint { margin-top: 5px; color: var(--muted); font-size: 12px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(245px, .76fr); align-items: start; gap: 13px; margin-top: 13px; }
.panel { min-width: 0; padding: 13px 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: 0 2px 5px #15281b05; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 11px; margin-bottom: 8px; }
.timeline-head-actions { display: flex; align-items: center; flex: 0 0 auto; gap: 7px; }
.timeline-add { min-height: 36px; padding: 0 9px; }
.timeline-add .material-symbols-outlined { font-size: 18px; }
.panel-subtitle { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.status-badge { display: inline-flex; min-height: 29px; align-items: center; gap: 5px; padding: 0 9px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: 12px; font-weight: 700; white-space: nowrap; }
.status-badge.is-negative { background: var(--red-soft); color: var(--red); }
.status-badge.is-warning { background: var(--amber-soft); color: var(--amber); }
.status-badge .material-symbols-outlined { font-size: 16px; }
.timeline-list { position: relative; padding-left: 14px; }
.timeline-list::before { position: absolute; z-index: 0; top: 13px; bottom: 11px; left: 3px; width: 2px; background: repeating-linear-gradient(to bottom, var(--line) 0 3px, transparent 3px 7px); content: ""; }
.timeline-group { position: relative; z-index: 1; display: flex; width: calc(100% + 14px); min-height: 39px; align-items: center; margin: 8px 0 8px -14px; padding: 8px 10px; border-radius: 8px; background: var(--green-soft); color: var(--green); font-size: 13px; font-weight: 650; letter-spacing: .02em; }
.timeline-group::before, .timeline-group::after { position: absolute; z-index: 2; left: 0; width: 5px; height: 8px; background: var(--surface); content: ""; }
.timeline-group::before { top: -8px; }
.timeline-group::after { top: 100%; }
.timeline-group:first-child { margin-top: 2px; }
.timeline-row { position: relative; display: grid; grid-template-columns: 67px minmax(0, 1fr) auto; align-items: center; gap: 9px; min-height: 49px; border-top: 1px solid var(--line); }
.timeline-row.is-done { opacity: .78; }
.timeline-row::before { position: absolute; top: 20px; left: -14px; width: 8px; height: 8px; border-radius: 50%; background: var(--green); content: ""; box-shadow: 0 0 0 3px var(--surface); }
.timeline-row.is-pending::before { background: var(--amber); }
.timeline-date { color: var(--muted); font-size: 13px; font-weight: 650; white-space: nowrap; }
.timeline-copy { min-width: 0; }
.timeline-name { overflow: hidden; font-size: 13px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.timeline-detail { overflow: hidden; margin-top: 2px; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.timeline-amount { text-align: right; font-size: 13px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.timeline-running { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 500; }
.timeline-subtotal { position: relative; display: flex; min-height: 38px; justify-content: space-between; align-items: center; gap: 10px; margin: 5px 0 9px; padding: 8px 10px; border-radius: 8px; background: var(--green-soft); color: var(--green); font-size: 13px; font-weight: 650; }
.timeline-subtotal strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.timeline-subtotal strong.negative { color: var(--red); }
.positive { color: var(--green); }
.negative { color: var(--red); }
.checkpoint { display: flex; min-height: 39px; justify-content: space-between; align-items: center; gap: 9px; margin: 8px 0; padding: 8px 10px; border-radius: 8px; background: var(--green-soft); }
.checkpoint-label { display: flex; align-items: center; gap: 7px; color: var(--green); font-size: 13px; font-weight: 600; }
.checkpoint-label .material-symbols-outlined { font-size: 18px; }
.checkpoint-value { color: var(--green); font-size: 14px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pending-strip { display: none; margin: 8px 0 2px; padding: 9px 10px; border-radius: 8px; background: var(--amber-soft); color: var(--amber); font-size: 12px; line-height: 1.4; }
.pending-strip.is-visible { display: flex; align-items: flex-start; gap: 7px; }
.pending-strip .material-symbols-outlined { flex: 0 0 auto; font-size: 16px; }
.panel-footer-row { display: flex; justify-content: flex-end; margin-top: 3px; border-top: 1px solid var(--line); }
.side-stack { display: grid; gap: 11px; }
.side-card-head { display: flex; align-items: center; gap: 8px; }
.side-icon { display: grid; width: 29px; height: 29px; flex: 0 0 29px; place-items: center; border-radius: 8px; background: var(--green-soft); color: var(--green); }
.side-icon.is-amber { background: var(--amber-soft); color: var(--amber); }
.side-icon .material-symbols-outlined { font-size: 18px; }
.side-card-title { font-size: 13px; font-weight: 700; }
.side-copy { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.side-row { display: flex; min-height: 35px; justify-content: space-between; align-items: center; gap: 8px; margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--line); font-size: 12px; }
.side-row strong { font-size: 13px; font-weight: 700; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.side-alert { display: flex; align-items: flex-start; gap: 7px; margin-top: 8px; padding: 8px 9px; border-radius: 8px; background: var(--amber-soft); color: var(--amber); font-size: 12px; line-height: 1.4; }
.side-alert .material-symbols-outlined { flex: 0 0 auto; font-size: 16px; }
.month-summary { background: var(--green); color: #fff; }
.month-summary .side-card-title, .month-summary .side-copy { color: #fff; }
.month-summary .side-icon { color: var(--green); background: #ffffffdf; }
.month-summary .side-row { border-color: #ffffff4d; }
.month-summary .side-row strong { color: #fff; }
.list-empty { padding: 29px 16px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); text-align: center; font-size: 13px; line-height: 1.5; }
.movement-list { display: grid; }
.movement-row { display: grid; grid-template-columns: 104px minmax(180px,1fr) 120px 128px 112px; align-items: center; gap: 8px; min-height: 55px; border-top: 1px solid var(--line); }
.movement-row:first-child { border-top: 0; }
.movement-date { color: var(--muted); font-size: 12px; font-weight: 600; line-height: 1.45; }
.movement-main { min-width: 0; }
.movement-title, .template-heading { display: flex; min-width: 0; align-items: center; gap: 8px; }
.movement-title strong, .template-heading strong { min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.merchant-mark { display: inline-grid; width: 28px; height: 28px; flex: 0 0 28px; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--merchant-color, var(--muted)); }
.merchant-mark-generic .material-symbols-outlined { font-size: 18px; }
.merchant-logo { display: block; width: 23px; height: 23px; object-fit: contain; }
.merchant-mark.has-logo .merchant-logo { display: block; }
.merchant-mark:not(:has(.merchant-logo)) { background: color-mix(in srgb, var(--merchant-color, var(--muted)) 10%, white); }
.movement-main strong { display: block; font-size: 13px; }
.movement-main span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.movement-status { justify-self: start; padding: 5px 7px; border-radius: 999px; background: var(--surface-soft); color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.movement-status.pending { background: var(--amber-soft); color: var(--amber); }
.movement-status.confirmed { background: var(--green-soft); color: var(--green); }
.row-actions { display: flex; justify-content: flex-end; gap: 2px; }
.row-actions .icon-button { border-color: transparent; }
.movement-row .row-actions .icon-button { width: 34px; height: 34px; flex-basis: 34px; }
.cards-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 12px; }
.card-item { padding: 15px; }
.card-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.date-box { padding: 9px 10px; border-radius: 8px; background: var(--surface-soft); }
.date-box span { display: block; color: var(--muted); font-size: 12px; }
.date-box strong { display: block; margin-top: 4px; font-size: 13px; }
.card-caption { color: var(--muted); font-size: 12px; line-height: 1.45; }
.templates-list { display: grid; }
.template-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px auto; gap: 10px; align-items: center; min-height: 56px; border-top: 1px solid var(--line); }
.template-row:first-child { border-top: 0; }
.template-name { font-size: 13px; font-weight: 650; }
.template-heading { margin-bottom: 3px; }
.template-heading .merchant-mark { width: 26px; height: 26px; flex-basis: 26px; }
.template-method { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 400; }
.merchant-selection-preview { display: inline-flex; min-height: 31px; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.merchant-selection-preview .merchant-mark { width: 25px; height: 25px; flex-basis: 25px; }
.template-amount { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.settings-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; align-items: start; }
.settings-grid > .panel:last-child { grid-column: 1/-1; }
.form-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 13px; }
.form-grid.two-columns { grid-template-columns: repeat(2,minmax(0,1fr)); }
.field { display: grid; min-width: 0; gap: 6px; color: var(--text); font-size: 13px; font-weight: 600; }
.field > span:first-child { min-height: 18px; }
.field input, .field select, .control-select { width: 100%; min-width: 0; height: 42px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 13px; }
.field-hint, .small-note { color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.4; }
.field-wide { grid-column: 1/-1; }
.form-actions { grid-column: 1/-1; display: flex; justify-content: flex-end; }
.backup-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.small-note { margin: 10px 0 0; }
.app-dialog { width: min(600px, calc(100% - 26px)); max-height: min(90vh, 760px); padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.app-dialog::backdrop { background: #14201880; backdrop-filter: blur(2px); }
.app-dialog form { padding: 18px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.dialog-heading .eyebrow { margin-bottom: 4px; }
.dialog-heading h2 { font-size: 19px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 17px; padding-top: 13px; border-top: 1px solid var(--line); }
.dialog-hint { margin: 12px 0 0; }
.toast { position: fixed; z-index: 20; right: 20px; bottom: 20px; max-width: min(420px, calc(100% - 40px)); padding: 12px 15px; border-radius: 10px; background: #20352a; color: #fff; font-size: 13px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(8px); transition: .18s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 180px minmax(0,1fr); }
  .sidebar { padding-right: 10px; padding-left: 10px; }
  .dashboard-grid { grid-template-columns: minmax(0,1.25fr) minmax(225px,.8fr); }
  .page-content { padding-right: 17px; padding-left: 17px; }
  .movement-row { grid-template-columns: 96px minmax(0,1fr) 120px; gap: 7px; padding: 8px 0; }
  .movement-row .movement-date { grid-column: 1; grid-row: 1 / span 3; }
  .movement-row .movement-main { grid-column: 2; grid-row: 1; }
  .movement-row .movement-amount { grid-column: 3; grid-row: 1; }
  .movement-row .movement-status { grid-column: 2; grid-row: 2; }
  .movement-row .row-actions { grid-column: 2 / 4; grid-row: 3; }
}
@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 10; inset: auto 0 0; display: block; width: 100%; height: 63px; padding: 5px 8px; border-top: 1px solid var(--line); border-right: 0; }
  .sidebar .brand, .sidebar-bottom { display: none; }
  .nav-list { display: flex; height: 100%; justify-content: space-around; gap: 3px; }
  .nav-item { min-width: 0; min-height: 50px; flex-direction: column; justify-content: center; gap: 2px; padding: 3px 5px; font-size: 13px; text-align: center; }
  .nav-item .material-symbols-outlined { font-size: 19px; }
  .topbar { padding: 0 13px; }
  .topbar-title { display: none; }
  .topbar-actions { width: 100%; justify-content: space-between; gap: 6px; }
  .demo-pill { font-size: 12px; }
  .page-content { padding: 14px 12px 82px; }
  .demo-banner { flex-wrap: wrap; align-items: flex-start; }
  .demo-banner .text-button { margin-left: 25px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .dashboard-grid, .settings-grid { grid-template-columns: 1fr; }
  .settings-grid > .panel:last-child { grid-column: auto; }
  .cards-grid { grid-template-columns: 1fr; }
  .movement-row { grid-template-columns: 76px minmax(0,1fr) 96px; gap: 6px; padding: 8px 0; }
  .movement-row .movement-date { grid-column: 1; grid-row: 1 / span 3; }
  .movement-row .movement-main { grid-column: 2; grid-row: 1; }
  .movement-row .movement-amount { grid-column: 3; grid-row: 1; }
  .movement-row .movement-status { grid-column: 2; grid-row: 2; }
  .movement-row .row-actions { grid-column: 2 / 4; grid-row: 3; }
  .movement-main strong, .movement-main span { overflow-wrap: anywhere; }
  .template-row { grid-template-columns: minmax(0,1fr) auto; padding: 5px 0; }
  .template-row .template-amount { grid-column: 1; grid-row: 2; }
  .template-row .row-actions { grid-column: 2; grid-row: 1 / span 2; }
}
@media (max-width: 460px) {
  #add-movement-button { width: 42px; min-width: 42px; padding: 0; }
  #add-movement-button .button-label { display: none; }
  .timeline-heading { align-items: flex-start; }
  .timeline-heading > div:first-child { min-width: 0; }
  .timeline-head-actions { flex-direction: row; align-items: center; }
  .timeline-add { width: 38px; min-width: 38px; min-height: 36px; padding: 0; }
  .timeline-add .button-label { display: none; }
  h1 { font-size: 22px; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-value { font-size: 20px; }
  .timeline-row { grid-template-columns: 57px minmax(0,1fr) auto; gap: 6px; }
  .timeline-date { font-size: 12px; }
  .timeline-amount { font-size: 12px; }
  .timeline-running { font-size: 12px; }
  .form-grid, .form-grid.two-columns { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .dialog-actions { flex-wrap: wrap; }
  .dialog-actions .button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
