:root {
  color-scheme: light;
  --bg: #f5f6f7;
  --surface: #ffffff;
  --surface-2: #f0f2f3;
  --line: #d9dde0;
  --line-strong: #c7cdd1;
  --text: #30383d;
  --muted: #758087;
  --brand: #00a7c4;
  --brand-dark: #00849e;
  --brand-soft: #e1f7fb;
  --green: #35a270;
  --green-soft: #e8f6ef;
  --amber: #e18721;
  --amber-soft: #fff4e3;
  --red: #d45a5c;
  --red-soft: #fcebec;
  --blue: #3888c9;
  --purple: #7867ae;
  --shadow: 0 1px 2px rgba(31, 45, 52, .05);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #15191c;
  --surface: #20262a;
  --surface-2: #292f33;
  --line: #374046;
  --line-strong: #4a555c;
  --text: #f2f5f6;
  --muted: #a4afb5;
  --brand: #2bc0d8;
  --brand-dark: #65d5e5;
  --brand-soft: #183b42;
  --green: #64bd8b;
  --green-soft: #1d3b2e;
  --amber: #e2a955;
  --amber-soft: #46351f;
  --red: #e97b7b;
  --red-soft: #482929;
  --blue: #75aee0;
  --purple: #b49bda;
  --shadow: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { width: 100%; min-height: 100%; background: var(--bg); border: 0; border-radius: 0; box-shadow: none; }
body { width: 100%; margin: 0; min-width: 320px; min-height: 100%; background: var(--bg); color: var(--text); border: 0; border-radius: 0; box-shadow: none; font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", sans-serif; letter-spacing: 0; overscroll-behavior-y: none; }
button, select { font: inherit; }
button { color: inherit; }
button, [role="button"] { -webkit-tap-highlight-color: transparent; }
button:focus-visible, select:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent); outline-offset: 2px; }
.auth-gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth-shell { width: min(100%, 420px); text-align: center; }
.auth-shell .brand-mark { margin: 0 auto 14px; width: 48px; height: 48px; }
.auth-shell h1 { margin: 0; font-size: 22px; }
.auth-shell p { margin: 7px 0 18px; color: var(--muted); }
.auth-status { color: var(--muted); font-size: 13px; }
#user-button { width: 34px; height: 34px; display: grid; place-items: center; }
.app-shell { width: 100%; min-height: 100dvh; display: grid; grid-template-columns: 224px minmax(0, 1fr); border: 0; border-radius: 0; box-shadow: none; }
.sidebar { position: sticky; top: 0; height: 100dvh; padding: 0 0 18px; background: var(--surface); color: var(--text); display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.brand { min-height: 72px; display: flex; align-items: center; gap: 11px; font-size: 18px; font-weight: 750; padding: 0 20px; color: #fff; background: var(--brand); border-bottom: 1px solid color-mix(in srgb, var(--brand-dark) 45%, transparent); }
.brand-mark { width: 34px; height: 34px; border-radius: 5px; display: grid; place-items: center; background: rgba(255,255,255,.2); color: #fff; }
.brand-mark svg { width: 20px; }
.side-nav { display: grid; gap: 0; padding-top: 12px; }
.nav-button { border: 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 68%, transparent); background: transparent; color: var(--muted); height: 50px; border-radius: 0; padding: 0 20px; display: flex; align-items: center; gap: 12px; cursor: pointer; text-align: left; }
.nav-button svg { width: 19px; }
.nav-button:hover { color: var(--text); background: var(--surface-2); }
.nav-button.active { color: var(--brand-dark); background: var(--brand-soft); box-shadow: inset 4px 0 var(--brand); font-weight: 750; }
.sidebar-foot { margin-top: auto; display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; padding: 10px 20px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #54bb7d; display: inline-block; box-shadow: 0 0 0 3px rgba(84,187,125,.13); }
.main-shell { min-width: 0; border: 0; border-radius: 0; box-shadow: none; }
.topbar { height: 72px; padding: 0 24px; background: color-mix(in srgb, var(--surface) 96%, transparent); border-top: 4px solid var(--brand); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px); }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; }
h1, h2, h3, p { letter-spacing: 0; }
h1 { margin: 0; font-size: 21px; font-weight: 700; }
h2 { margin: 0; font-size: 17px; }
h3 { margin: 0; font-size: 15px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.sync-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; margin-right: 8px; }
.icon-button { width: 40px; height: 40px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 4px; display: inline-grid; place-items: center; cursor: pointer; }
.icon-button:hover { background: var(--surface-2); }
.icon-button svg { width: 19px; height: 19px; }
.icon-button.subtle { border: 0; background: var(--surface-2); }
main { width: 100%; margin: 0; padding: 18px 16px 56px; }
.view { display: none; }
.view.active { display: block; animation: enter .24s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(4px); } }
.period-row, .analysis-toolbar, .filter-row, .section-head, .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.period-row, .analysis-toolbar, .filter-row { margin-bottom: 20px; }
.segmented { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 4px; padding: 0; display: inline-flex; max-width: 100%; overflow: hidden; }
.segmented button { min-height: 36px; border: 0; border-right: 1px solid var(--line); background: transparent; padding: 0 15px; color: var(--muted); border-radius: 0; cursor: pointer; white-space: nowrap; }
.segmented button svg { width: 15px; height: 15px; margin-right: 6px; vertical-align: -3px; }
.segmented button:last-child { border-right: 0; }
.segmented button.active { background: var(--brand); color: #fff; font-weight: 700; box-shadow: none; }
.text-button { border: 0; background: transparent; color: var(--brand-dark); font-weight: 700; display: flex; gap: 6px; align-items: center; cursor: pointer; padding: 8px 0; }
.text-button svg { width: 16px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.metric { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 20px 18px 18px; min-width: 0; overflow: hidden; }
.metric::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--brand); }
.metric:nth-child(2)::before { background: var(--amber); }.metric:nth-child(3)::before { background: var(--green); }.metric:nth-child(4)::before { background: var(--red); }
.metric-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; }
.metric-icon { width: 30px; height: 30px; border-radius: 4px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-dark); }
.metric-icon svg { width: 16px; }
.metric strong { display: block; margin-top: 17px; font-size: clamp(22px, 2.2vw, 29px); white-space: nowrap; }
.metric-foot { display: flex; align-items: center; gap: 7px; margin-top: 8px; color: var(--muted); font-size: 11px; }
.change { color: var(--green); font-weight: 700; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .75fr); gap: 14px; margin-bottom: 28px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 20px; box-shadow: var(--shadow); }
.chart-panel { min-height: 520px; }
.chart-wrap { height: 240px; margin-top: 18px; }
.profit-chart-head { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.profit-chart-head > div { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.profit-chart-head small { color: var(--muted); }
.chart-wrap.profit-chart { height: 130px; margin-top: 8px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: 11px; }
.legend span { display: flex; align-items: center; gap: 5px; }
.swatch { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.swatch.sales { background: var(--brand); }.swatch.expense { background: #d79b42; }.swatch.profit { background: var(--green); }
.health-row { padding: 17px 0; border-bottom: 1px solid var(--line); }
.health-row:last-child { border-bottom: 0; padding-bottom: 0; }
.health-row p { margin: 0 0 7px; color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; }
.health-row strong { font-size: 21px; }
.health-row small { color: var(--muted); }
.health-track { height: 5px; background: var(--surface-2); margin-top: 10px; border-radius: 5px; overflow: hidden; }
.health-track span { height: 100%; display: block; border-radius: 5px; }
.section-block { margin-top: 4px; }
.section-head { margin-bottom: 14px; }
.invoice-list { display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.invoice-row { border: 0; border-bottom: 1px solid var(--line); background: var(--surface); padding: 14px 16px; display: grid; grid-template-columns: 46px minmax(190px, 1.5fr) minmax(150px, 1fr) 130px 145px 80px; gap: 12px; align-items: center; text-align: left; cursor: pointer; }
.invoice-row:last-child { border-bottom: 0; }
.invoice-row:hover { background: var(--brand-soft); }
.invoice-number { color: var(--muted); font-size: 12px; font-weight: 700; }
.client strong, .invoice-subject strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client small, .invoice-subject small { color: var(--muted); display: block; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amount { text-align: right; font-weight: 750; }
.status-stack { display: flex; gap: 5px; flex-wrap: wrap; }
.badge { border-radius: 2px; padding: 4px 7px; font-size: 10px; font-weight: 750; line-height: 1; white-space: nowrap; border: 1px solid currentColor; }
.badge.unpaid { color: var(--amber); background: var(--amber-soft); }.badge.paid { color: var(--green); background: var(--green-soft); }.badge.unposted { color: var(--red); background: var(--red-soft); }.badge.posted { color: var(--blue); background: color-mix(in srgb, var(--blue) 14%, transparent); }
.row-actions { display: flex; justify-content: flex-end; gap: 4px; }
.row-actions .icon-button { width: 34px; height: 34px; }
.analysis-grid { display: grid; grid-template-columns: minmax(300px, .85fr) minmax(340px, 1.15fr); gap: 14px; }
.select { height: 42px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); color: var(--text); padding: 0 34px 0 12px; }
.search-box { width: min(230px, 36vw); height: 42px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 4px; display: flex; align-items: center; gap: 8px; padding: 0 11px; }
.search-box svg { width: 17px; color: var(--muted); }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
.search-box input::placeholder { color: var(--muted); }
.donut-panel, .ranking-panel { min-height: 390px; }
.donut-wrap { height: 290px; position: relative; display: grid; place-items: center; }
.donut-wrap canvas { max-height: 270px; }
.donut-center { position: absolute; text-align: center; pointer-events: none; transition: opacity .12s ease; }
.donut-center.tooltip-active { opacity: 0; }
.donut-center span { color: var(--muted); display: block; font-size: 11px; }
.donut-center strong { font-size: 28px; }.donut-center strong span { display: inline; font-size: 13px; margin-left: 2px; }
.ranking-item { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.ranking-item:last-child { border-bottom: 0; }
.rank { color: var(--muted); font-size: 12px; }
.ranking-item p { margin: 0; }.ranking-item small { display: block; color: var(--muted); margin-top: 4px; }
.trend-panel { margin-top: 14px; }
.bar-list { margin-top: 18px; display: grid; gap: 16px; }
.bar-item { display: grid; grid-template-columns: 150px 1fr 100px; gap: 14px; align-items: center; font-size: 12px; }
.bar-track { height: 12px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.bar-track span { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.bar-item strong { text-align: right; }
.sales-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.sales-tools { display: flex; align-items: center; gap: 10px; }
.sales-table { border: 1px solid var(--line); background: var(--surface); overflow: hidden; }
.sales-table-head, .sales-row { display: grid; grid-template-columns: 96px minmax(240px, 1.7fr) 110px minmax(130px, .75fr) minmax(170px, 1fr) 70px 40px; gap: 10px; align-items: center; }
.sales-table-head { min-height: 42px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: 10px; font-weight: 750; }
.sales-row { min-height: 64px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.sales-row:last-child { border-bottom: 0; }
.sales-row:hover { background: color-mix(in srgb, var(--brand-soft) 42%, var(--surface)); }
.sales-date { color: var(--muted); font-size: 12px; }
.sales-detail { min-width: 0; }.sales-detail strong, .sales-detail small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.sales-detail small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.sales-amount { text-align: right; }.sales-amount.negative { color: var(--red); }
.sales-row .select { width: 100%; height: 36px; padding-left: 9px; font-size: 12px; }
.sales-state { font-size: 10px; font-weight: 750; text-align: center; }.sales-state.review { color: var(--amber); }.sales-state.classified { color: var(--green); }
.sales-save { width: 36px; height: 36px; color: var(--brand-dark); }
.empty-row { padding: 42px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.invoice-summary { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 4px; background: var(--surface); margin-bottom: 20px; }
.summary-item { padding: 18px 20px; border-right: 1px solid var(--line); }
.summary-item:last-child { border-right: 0; }
.summary-item p { margin: 0 0 8px; color: var(--muted); font-size: 12px; }.summary-item strong { font-size: 24px; }.summary-item small { margin-left: 6px; color: var(--muted); }
.classification-intro { background: var(--brand); color: white; border-radius: 4px; padding: 20px 22px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.classification-intro .eyebrow { color: #a9c9cc; }.classification-intro h2 { font-size: 20px; }
.progress-ring { width: 58px; height: 58px; border: 6px solid rgba(255,255,255,.17); border-top-color: #59cbd0; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.classification-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .7fr); gap: 14px; align-items: start; }
.classification-queue { display: grid; gap: 10px; }
.classify-card { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 18px; }
.classify-top { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.classify-top p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }.classify-top strong { font-size: 19px; }
.classify-fields { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; margin-top: 17px; }
.field label { display: block; color: var(--muted); font-size: 10px; margin-bottom: 5px; }.field .select { width: 100%; }
.primary-button, .secondary-button { min-height: 42px; border-radius: 4px; padding: 0 16px; font-weight: 750; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; }
.primary-button { background: var(--brand); color: white; border: 1px solid var(--brand); }.primary-button:hover { background: var(--brand-dark); }
.secondary-button { background: var(--surface); color: var(--text); border: 1px solid var(--line); }.primary-button svg, .secondary-button svg { width: 18px; }
.classify-fields .primary-button { align-self: end; }
.rules-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 18px; }
.rule-list > div { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.rule-list > div:last-child { border-bottom: 0; }.rule-list p { margin: 0; }.rule-list small { color: var(--muted); display: block; margin-top: 3px; }.rule-list > div > span:last-child { color: var(--muted); font-size: 11px; }
.rule-icon { width: 32px; height: 32px; border-radius: 6px; display: grid; place-items: center; font-size: 12px; font-weight: 850; }.rule-icon svg { width: 16px; }.rule-icon.stores { color: #8a3a67; background: #f6e4ef; }.rule-icon.coconala { color: #2672a9; background: #e2f1fa; }.rule-icon.direct { color: var(--brand-dark); background: var(--brand-soft); }
.bottom-nav { display: none; }
dialog { width: min(640px, 100%); max-height: min(820px, 100dvh); padding: 0; border: 0; border-radius: 4px; background: var(--surface); color: var(--text); box-shadow: 0 24px 80px rgba(0,0,0,.26); }
dialog::backdrop { background: rgba(10,25,30,.52); backdrop-filter: blur(3px); }
.dialog-shell { display: flex; flex-direction: column; max-height: min(820px, 100dvh); }
.dialog-head { min-height: 76px; padding: 12px 18px; display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.dialog-body { padding: 20px; overflow: auto; }
.invoice-preview { border: 1px solid var(--line); padding: 20px; background: color-mix(in srgb, var(--surface) 93%, white); }
.preview-brand { color: var(--brand-dark); font-weight: 800; }.preview-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 22px 0; }.preview-meta p, .timeline p { margin: 0; color: var(--muted); font-size: 11px; }.preview-meta strong { display: block; margin-top: 4px; }.preview-total { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 16px 0; display: flex; justify-content: space-between; align-items: end; }.preview-total strong { font-size: 28px; }
.timeline { margin-top: 20px; display: grid; gap: 14px; }.timeline-item { display: grid; grid-template-columns: 28px 1fr; gap: 10px; }.timeline-icon { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; color: var(--brand-dark); }.timeline-icon svg { width: 14px; }.timeline strong { font-size: 13px; }.timeline small { display: block; color: var(--muted); margin-top: 3px; }
.dialog-actions { padding: 14px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.period-dialog { width: min(540px, calc(100% - 28px)); }
.period-shell { padding: 0; }
.period-dialog-head { min-height: 72px; padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.period-fields { padding: 24px 18px 12px; display: grid; grid-template-columns: 1fr 24px 1fr; gap: 10px; align-items: end; }
.period-fields label span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.period-fields input { width: 100%; height: 42px; border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 10px; background: var(--surface); color: var(--text); font: inherit; }
.period-arrow { height: 42px; display: grid; place-items: center; color: var(--muted); }.period-arrow svg { width: 16px; }
.period-error { min-height: 18px; margin: 0; padding: 0 18px; color: var(--red); font-size: 12px; }
.period-actions { padding: 14px 18px 18px; display: flex; justify-content: flex-end; gap: 10px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: #17343a; color: white; padding: 11px 16px; border-radius: 6px; font-size: 12px; opacity: 0; pointer-events: none; transition: .2s; z-index: 100; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.spin { animation: spin .55s linear; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 960px) {
  .analysis-grid { height: clamp(410px, calc(100dvh - 190px), 520px); align-items: stretch; }
  .donut-panel, .ranking-panel { height: 100%; min-height: 0; }
  .donut-panel { display: flex; flex-direction: column; }
  .donut-panel .donut-wrap { flex: 1 1 auto; min-height: 0; height: auto; }
  .ranking-panel { display: flex; flex-direction: column; overflow: hidden; }
  .ranking-panel > .panel-head { flex: 0 0 auto; }
  #ranking-list { flex: 1 1 auto; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding-right: 8px; }
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 76px 1fr; }
  .sidebar { padding: 0 0 18px; }
  .brand { padding: 0; justify-content: center; }.brand > span:last-child, .nav-button span, .sidebar-foot span:last-child { display: none; }
  .nav-button { justify-content: center; padding: 0; }
  .sidebar-foot { justify-content: center; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .invoice-health #invoice-health { display: grid; grid-template-columns: repeat(3, 1fr); }.health-row { border-bottom: 0; border-right: 1px solid var(--line); padding: 12px; }.health-row:last-child { border-right: 0; }
  .invoice-row { grid-template-columns: 40px minmax(160px, 1.4fr) minmax(130px, 1fr) 105px 125px 74px; font-size: 13px; }
  .classification-layout { grid-template-columns: 1fr; }
  .sales-table-head, .sales-row { grid-template-columns: 86px minmax(190px, 1.5fr) 100px minmax(120px, .7fr) minmax(150px, 1fr) 64px 38px; }
}

@media (min-width: 1500px) {
  .dashboard-grid { grid-template-columns: minmax(0, 2fr) minmax(320px, .7fr); }
}

@media (max-width: 700px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .topbar { height: 68px; padding: 0 16px; }.topbar h1 { font-size: 19px; }.sync-label { display: none; }
  main { padding: 18px 14px calc(88px + env(safe-area-inset-bottom)); }
  .bottom-nav { position: fixed; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); left: 0; right: 0; bottom: 0; min-height: 66px; padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--surface) 98%, transparent); border-top: 3px solid var(--brand); backdrop-filter: blur(16px); }
  .bottom-nav .nav-button { height: 62px; border-radius: 0; flex-direction: column; justify-content: center; gap: 4px; padding: 0; font-size: 10px; color: var(--muted); }
  .bottom-nav .nav-button.active { color: var(--brand-dark); box-shadow: none; background: var(--brand-soft); }
  .bottom-nav .nav-button svg { width: 19px; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 8px; }.metric { padding: 14px; }.metric strong { font-size: 20px; margin-top: 14px; }.metric-foot { white-space: nowrap; overflow: hidden; }
  .period-row { align-items: stretch; }.period-row .segmented { overflow-x: auto; }.period-row .text-button { display: none; }
  .period-fields { grid-template-columns: 1fr; }.period-arrow { display: none; }.period-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .panel { padding: 16px; }.chart-panel { min-height: 500px; }.chart-wrap { height: 230px; }.chart-wrap.profit-chart { height: 130px; }.legend { display: none; }
  .invoice-health #invoice-health { display: block; }.health-row { border-right: 0; border-bottom: 1px solid var(--line); padding: 14px 0; }
  .analysis-grid { grid-template-columns: 1fr; }.analysis-toolbar { align-items: stretch; flex-direction: column; }.analysis-toolbar .select { width: 100%; }.analysis-toolbar .segmented { width: 100%; }.analysis-toolbar .segmented button { flex: 1; }
  .bar-item { grid-template-columns: 105px 1fr 78px; gap: 8px; }
  .invoice-summary { grid-template-columns: 1fr; }.summary-item { border-right: 0; border-bottom: 1px solid var(--line); }.summary-item:last-child { border-bottom: 0; }
  .filter-row { align-items: stretch; flex-direction: column; }.invoice-filters { overflow-x: auto; }.invoice-filters button { padding: 0 12px; }.search-box { width: 100%; }
  .sales-toolbar { align-items: stretch; flex-direction: column; }.sales-tools { align-items: stretch; flex-direction: column; }.sales-tools .segmented, .sales-tools .search-box { width: 100%; }.sales-tools .segmented button { flex: 1; }
  .sales-table { border: 0; background: transparent; overflow: visible; }.sales-table-head { display: none; }.sales-row { grid-template-columns: 78px 1fr auto; gap: 8px; min-height: 0; margin-bottom: 8px; padding: 13px; border: 1px solid var(--line); background: var(--surface); }.sales-date { grid-column: 1; }.sales-detail { grid-column: 2; }.sales-amount { grid-column: 3; grid-row: 1; }.sales-row [data-field="channel"] { grid-column: 1 / 2; }.sales-row [data-field="service"] { grid-column: 2 / 4; }.sales-state { grid-column: 1 / 3; text-align: left; }.sales-save { grid-column: 3; justify-self: end; }
  .invoice-row { grid-template-columns: 32px minmax(0, 1fr) auto; gap: 9px; padding: 14px 12px; }.invoice-subject, .row-actions { display: none; }.amount { grid-column: 3; grid-row: 1; }.status-stack { grid-column: 2 / 4; }.client small { white-space: normal; }
  .classification-intro { padding: 17px; }.classification-intro h2 { font-size: 17px; }.classify-fields { grid-template-columns: 1fr; }.classify-fields .primary-button { width: 100%; }
  dialog { width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }.dialog-shell { height: 100dvh; max-height: 100dvh; }.dialog-body { flex: 1; }.preview-meta { grid-template-columns: 1fr; }
}

@media (max-width: 390px) {
  .metric-grid { grid-template-columns: 1fr; }.metric { display: grid; grid-template-columns: 1fr auto; align-items: center; }.metric strong { grid-row: 1; grid-column: 2; margin: 0; font-size: 19px; }.metric-foot { grid-column: 1 / 3; }
}

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