/* KM Finance Cockpit - design system. RTL Hebrew UI, numbers LTR/tabular. Color carries state only. */
:root {
  color-scheme: light;
  --font: "Heebo", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --bg: #f4f6fa; --bg2: #eceff5; --surface: #ffffff; --surface2: #f8f9fc; --line: #e3e7ee; --line2: #d3d9e3;
  --ink: #0f172a; --ink2: #334155; --muted: #64748b; --faint: #94a3b8;
  --accent: #2a78d6; --accent-ink: #1c5cab; --accent-soft: #e6f0fb; --accent-line: #b7d3f6;
  --good: #0ca30c; --good-soft: #e5f6e5; --good-ink: #0a6f0a;
  --warn: #fab219; --warn-soft: #fff4d6; --warn-ink: #8a5d00;
  --serious: #ec835a; --serious-soft: #fde9e1; --serious-ink: #9a3f1d;
  --crit: #d03b3b; --crit-soft: #fbe4e4; --crit-ink: #9b1c1c;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s7: #6250d6; --s8: #e34948; --gray: #9aa5b8;
  --shadow: 0 1px 2px rgba(15,23,42,.05), 0 6px 20px -8px rgba(15,23,42,.12);
  --shadow-lg: 0 10px 40px -10px rgba(15,23,42,.25);
  --r: 14px; --r-sm: 10px; --r-xs: 7px;
  --ease-out: cubic-bezier(.23,1,.32,1); --ease-in-out: cubic-bezier(.77,0,.175,1);
  --side-w: 236px; --top-h: 60px;
  --chart-grid: #e8ebf1; --chart-axis: #8b95a7;
}
:root[data-theme="dark"] { color-scheme: dark;
  --bg: #0b0f17; --bg2: #0f141e; --surface: #121826; --surface2: #182033; --line: #222c3f; --line2: #2d3950;
  --ink: #e8ecf3; --ink2: #c3cbd8; --muted: #8d99ad; --faint: #5d6a80;
  --accent: #3987e5; --accent-ink: #86b6ef; --accent-soft: #15284a; --accent-line: #25487c;
  --good: #0ca30c; --good-soft: #0f2a12; --good-ink: #6fd56f; --warn: #fab219; --warn-soft: #2e2410; --warn-ink: #f5c75c;
  --serious: #ec835a; --serious-soft: #331c13; --serious-ink: #f3a384; --crit: #d03b3b; --crit-soft: #341416; --crit-ink: #f08a8a;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s7: #9085e9; --s8: #e66767; --gray: #5d6a80;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -10px rgba(0,0,0,.6); --shadow-lg: 0 16px 50px -12px rgba(0,0,0,.7);
  --chart-grid: #1f2838; --chart-axis: #7b879b;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark;
  --bg: #0b0f17; --bg2: #0f141e; --surface: #121826; --surface2: #182033; --line: #222c3f; --line2: #2d3950;
  --ink: #e8ecf3; --ink2: #c3cbd8; --muted: #8d99ad; --faint: #5d6a80;
  --accent: #3987e5; --accent-ink: #86b6ef; --accent-soft: #15284a; --accent-line: #25487c;
  --good: #0ca30c; --good-soft: #0f2a12; --good-ink: #6fd56f; --warn: #fab219; --warn-soft: #2e2410; --warn-ink: #f5c75c;
  --serious: #ec835a; --serious-soft: #331c13; --serious-ink: #f3a384; --crit: #d03b3b; --crit-soft: #341416; --crit-ink: #f08a8a;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s7: #9085e9; --s8: #e66767; --gray: #5d6a80;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -10px rgba(0,0,0,.6); --shadow-lg: 0 16px 50px -12px rgba(0,0,0,.7);
  --chart-grid: #1f2838; --chart-axis: #7b879b; } }

/* ---------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--bg); min-height: 100dvh; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--accent-ink); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button, [role="button"], .tab, .chip { touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
input, select, textarea { font-size: 16px; }
@media (min-width: 900px) { input, select, textarea { font-size: 14px; } }
.hidden { display: none !important; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12px; } .tiny { font-size: 11px; }
.num, .mono, td.n, .kpiV, .big { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.mono { font-family: var(--mono); font-size: 12px; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.right { text-align: right; } .ltr { direction: ltr; unicode-bidi: isolate; }
.pos { color: var(--good-ink); } .neg { color: var(--crit-ink); } .warnC { color: var(--warn-ink); }
.error { color: var(--crit-ink); min-height: 1.4em; font-size: 13px; margin-top: 8px; }
[data-ico] svg, .ico svg { width: 18px; height: 18px; display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 80% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.loginCard { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 32px 28px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 14px; }
.loginCard h1 { font-size: 22px; }
.loginLogo { width: 48px; height: 48px; border-radius: 14px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.loginLogo svg { width: 28px; height: 28px; }
.loginCard label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; color: var(--ink2); }

/* ---------- shell */
.shell { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100dvh; background: var(--surface); border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; padding: 16px 12px calc(12px + env(safe-area-inset-bottom)); gap: 14px; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.logo { width: 36px; height: 36px; border-radius: 11px; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.logo svg { width: 22px; height: 22px; }
.brandText { display: flex; flex-direction: column; line-height: 1.15; }
.brandText b { font-size: 15px; } .brandText small { color: var(--muted); font-size: 11px; }
nav#nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.navSec { font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; padding: 12px 10px 4px; }
.navItem { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm); color: var(--ink2); font-weight: 500; border: 0; background: none; width: 100%; text-align: start; transition: background 120ms ease, color 120ms ease, transform 120ms var(--ease-out); }
.navItem:active { transform: scale(.98); }
.navItem[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.navItem .ico { color: var(--muted); } .navItem[aria-current="page"] .ico { color: var(--accent-ink); }
.navItem .badge { margin-inline-start: auto; }
@media (hover: hover) and (pointer: fine) { .navItem:hover { background: var(--surface2); } .navItem[aria-current="page"]:hover { background: var(--accent-soft); } }
.sideFoot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 4px; }
.deadlineMini { background: var(--surface2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; font-size: 12px; color: var(--muted); }
.deadlineMini b { display: block; font-size: 20px; color: var(--ink); line-height: 1.1; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; height: var(--top-h); display: flex; align-items: center; gap: 10px; padding: 0 20px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.top h1 { font-size: 18px; }
.topChips { display: flex; gap: 6px; flex-wrap: wrap; }
.who { font-size: 13px; color: var(--muted); padding-inline-start: 6px; }
.menuBtn { display: none; }
.page { padding: 20px; max-width: 1440px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; outline: none; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.page.enter { animation: pageIn 200ms var(--ease-out); }
@keyframes pageIn { from { opacity: 0; transform: translateY(4px); } }
.tabbar { display: none; }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 0 0 auto; width: min(300px, 86vw); transform: translateX(100%); transition: transform 240ms var(--ease-out), box-shadow 240ms; box-shadow: none; }
  [dir="rtl"] .side { right: 0; left: auto; }
  .side.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sideBackdrop { position: fixed; inset: 0; background: rgba(5,10,20,.45); z-index: 29; opacity: 0; pointer-events: none; transition: opacity 200ms; }
  .sideBackdrop.open { opacity: 1; pointer-events: auto; }
  .menuBtn { display: inline-flex; }
  .top { padding: 0 12px; gap: 6px; }
  .top h1 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .topChips .chip:nth-child(2) { display: none; }
  .page { padding: 14px 16px calc(84px + env(safe-area-inset-bottom)); }
  .who { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 25; }
  .tabbar button { background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; color: var(--muted); padding: 4px 0; border-radius: 8px; }
  .tabbar button[aria-current="page"] { color: var(--accent-ink); font-weight: 700; }
  .tabbar button:active { transform: scale(.95); }
}

/* ---------- buttons / inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: var(--r-sm); border: 1px solid var(--line2); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 13px; line-height: 1.2; transition: transform 140ms var(--ease-out), background 140ms ease, border-color 140ms ease, box-shadow 140ms; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--crit-ink); border-color: color-mix(in srgb, var(--crit) 40%, var(--line2)); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink2); }
.btn.small { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn.wide { width: 100%; padding: 11px; font-size: 15px; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn .ico svg, .btn [data-ico] svg { width: 15px; height: 15px; }
@media (hover: hover) and (pointer: fine) { .btn:hover { background: var(--surface2); } .btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); } .btn.ghost:hover { background: var(--surface2); } }
.iconBtn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--ink2); display: inline-flex; align-items: center; justify-content: center; transition: transform 140ms var(--ease-out), background 140ms; }
.iconBtn:active { transform: scale(.94); }
.iconBtn.danger { color: var(--crit-ink); }
@media (hover: hover) and (pointer: fine) { .iconBtn:hover { background: var(--surface2); } }
.iconBtn.spin svg { animation: spin 900ms linear infinite; } @keyframes spin { to { transform: rotate(360deg); } }
input[type="text"], input[type="number"], input[type="date"], input[type="password"], select, textarea, .input { width: 100%; padding: 9px 11px; border-radius: var(--r-sm); border: 1px solid var(--line2); background: var(--surface); color: var(--ink); outline: none; transition: border-color 120ms, box-shadow 120ms; min-width: 0; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="number"], input[type="date"] { direction: ltr; text-align: left; font-variant-numeric: tabular-nums; }
input.inline { padding: 5px 8px; border-radius: 7px; background: transparent; border-color: transparent; }
input.inline:focus-visible, input.inline:hover { border-color: var(--line2); background: var(--surface); }
select { appearance: auto; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); }
label.f > span { display: flex; justify-content: space-between; }
.fieldGrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.switch { position: relative; width: 38px; height: 22px; border-radius: 999px; background: var(--line2); border: 0; flex: none; transition: background 160ms; }
.switch::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform 160ms var(--ease-out); }
.switch[aria-checked="true"] { background: var(--good); } .switch[aria-checked="true"]::after { transform: translateX(-16px); }
[dir="ltr"] .switch[aria-checked="true"]::after { transform: translateX(16px); }
.seg { display: inline-flex; background: var(--surface2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 11px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted); transition: background 140ms, color 140ms; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface2); border: 1px solid var(--line); color: var(--ink2); white-space: nowrap; }
.chip.ok { background: var(--good-soft); color: var(--good-ink); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn-ink); border-color: transparent; }
.chip.serious { background: var(--serious-soft); color: var(--serious-ink); border-color: transparent; }
.chip.crit { background: var(--crit-soft); color: var(--crit-ink); border-color: transparent; }
.chip.info { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.chip svg { width: 13px; height: 13px; }
.badge { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--crit-soft); color: var(--crit-ink); text-align: center; line-height: 18px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* ---------- cards / grid */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(12, 1fr); }
.c12 { grid-column: span 12; } .c8 { grid-column: span 8; } .c6 { grid-column: span 6; } .c4 { grid-column: span 4; } .c3 { grid-column: span 3; }
@media (max-width: 1200px) { .c4, .c3 { grid-column: span 6; } .c8 { grid-column: span 12; } }
@media (max-width: 760px) { .c6, .c4, .c3 { grid-column: span 12; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card.flat { box-shadow: none; }
.cardHead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cardHead h2 { font-size: 15px; } .cardHead h3 { font-size: 14px; }
.cardHead .sub { color: var(--muted); font-size: 12px; }
.cardHead .actions { margin-inline-start: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* KPI tiles */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(6, 1fr); }
@media (max-width: 1300px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); min-width: 0; position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; inset-inline-start: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--kpi-accent, var(--line2)); }
.kpi.ok { --kpi-accent: var(--good); } .kpi.warn { --kpi-accent: var(--warn); } .kpi.crit { --kpi-accent: var(--crit); } .kpi.info { --kpi-accent: var(--accent); }
.kpiL { font-size: 12px; color: var(--muted); font-weight: 600; display: flex; justify-content: space-between; gap: 6px; }
.kpiV { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; text-align: start; }
.kpiV small { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpiS { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
@media (max-width: 700px) { .kpiV { font-size: 20px; } }

/* hero / status banner */
.hero { background: linear-gradient(135deg, var(--surface) 0%, var(--surface) 55%, var(--accent-soft) 160%); }
.hero.ok { background: linear-gradient(135deg, var(--surface) 0%, var(--surface) 55%, var(--good-soft) 160%); }
.hero.off, .hero.risk { background: linear-gradient(135deg, var(--surface) 0%, var(--surface) 55%, var(--crit-soft) 170%); }
.hero.tight { background: linear-gradient(135deg, var(--surface) 0%, var(--surface) 55%, var(--warn-soft) 170%); }
.headline { font-size: 18px; font-weight: 700; line-height: 1.4; }
@media (max-width: 700px) { .headline { font-size: 16px; } }
.summaryCols { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .summaryCols { grid-template-columns: 1fr; } }
.sumBlock h4 { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.sumList { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sumList li { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; line-height: 1.45; }
.sumList li .ico { flex: none; margin-top: 2px; } .sumList li .ico svg { width: 15px; height: 15px; }
.sev-critical .ico { color: var(--crit); } .sev-warning .ico { color: var(--warn-ink); } .sev-info .ico { color: var(--accent-ink); } .sev-good .ico { color: var(--good); }
.aiBox { background: var(--surface2); border: 1px dashed var(--line2); border-radius: var(--r-sm); padding: 14px 16px; font-size: 13.5px; line-height: 1.6; }
.aiBox h3 { font-size: 13.5px; margin: 10px 0 4px; } .aiBox h3:first-child { margin-top: 0; }
.aiBox ul, .aiBox ol { margin: 4px 0; padding-inline-start: 20px; } .aiBox li { margin: 2px 0; }
.aiBox p { margin: 4px 0; }
.aiMeta { font-size: 11px; color: var(--faint); display: flex; gap: 8px; flex-wrap: wrap; }

/* tables */
.tableWrap { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; border: 1px solid var(--line); border-radius: var(--r-sm); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 10px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { font-size: 11.5px; font-weight: 700; color: var(--muted); background: var(--surface2); position: sticky; top: 0; z-index: 1; }
td.n, th.n { text-align: end; font-variant-numeric: tabular-nums; }
td.n { direction: ltr; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.off td { opacity: .5; }
tbody tr.tot td { font-weight: 700; background: var(--surface2); }
tbody tr.sel td { background: var(--accent-soft); }
tbody tr.cur td { background: var(--surface2); font-weight: 600; }
tbody tr.danger td { background: var(--crit-soft); }
@media (hover: hover) and (pointer: fine) { tbody tr:hover td { background: var(--surface2); } }
td input.inline { max-width: 130px; } td input.inline.name { max-width: 260px; min-width: 160px; }
td input.inline.n { width: 100px; } td input.inline.d { width: 150px; }
td select.inline { padding: 5px 6px; border-radius: 7px; background: transparent; border-color: transparent; width: auto; min-width: 72px; }
td select.inline:hover, td select.inline:focus-visible { border-color: var(--line2); background: var(--surface); }
.rowActs { display: inline-flex; gap: 2px; opacity: .7; }
.rowActs .iconBtn { width: 30px; height: 30px; } .rowActs .iconBtn svg { width: 15px; height: 15px; }

/* month grid */
.monthGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.monthCell { background: var(--surface2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.monthCell b { font-size: 12px; color: var(--ink2); } .monthCell input { padding: 6px 8px; }
.monthCell.over { border-color: var(--accent-line); background: var(--accent-soft); }

/* accounts */
.accCard { display: flex; flex-direction: column; gap: 10px; }
.accCard .big { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.accEdit { display: flex; gap: 8px; align-items: center; }
.accEdit input { font-size: 18px; font-weight: 700; padding: 8px 10px; }
.accEdit .cur { font-weight: 700; color: var(--muted); }
.accEdit select { width: auto; min-width: 84px; }

/* meter */
.meter { height: 10px; border-radius: 999px; background: var(--bg2); overflow: hidden; border: 1px solid var(--line); }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width 400ms var(--ease-out); }
.meter.good i { background: var(--good); } .meter.warn i { background: var(--warn); } .meter.crit i { background: var(--crit); }
.meterRow { display: grid; grid-template-columns: minmax(120px, 1fr) 2fr auto; gap: 10px; align-items: center; font-size: 13px; }
@media (max-width: 600px) { .meterRow { grid-template-columns: 1fr auto; } .meterRow .meter { grid-column: 1 / -1; } }

/* segmented bar */
.segBar { display: flex; height: 26px; border-radius: 8px; overflow: hidden; gap: 2px; background: var(--bg2); }
.segBar i { display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; min-width: 0; overflow: hidden; transition: flex 300ms var(--ease-out); }
.segBar.thin { height: 8px; } .segBar.thin i { font-size: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 12px; color: var(--ink2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* charts */
.chart { position: relative; width: 100%; direction: ltr; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--font); }
.chart .grid line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .axis text { fill: var(--chart-axis); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .axis line, .chart .axis path { stroke: var(--line2); }
.chart .tgt { stroke: var(--crit); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart .tgtL { fill: var(--crit-ink); font-size: 11px; font-weight: 700; }
.chart .today { stroke: var(--faint); stroke-dasharray: 2 3; }
.chart .zero { stroke: var(--line2); stroke-width: 1.5; }
.chart .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .ar { opacity: .12; }
.chart .mk { fill: var(--surface); stroke-width: 2; }
.chart .cross { stroke: var(--chart-axis); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.chart .lbl { font-size: 11px; fill: var(--ink2); font-weight: 600; }
.chart .hit { fill: transparent; }
.tip { position: absolute; z-index: 5; pointer-events: none; background: var(--ink); color: #fff; padding: 8px 10px; border-radius: 9px; font-size: 12px; line-height: 1.45; box-shadow: var(--shadow-lg); min-width: 150px; max-width: 260px; direction: rtl; text-align: start; opacity: 0; transform: translateY(2px); transition: opacity 120ms var(--ease-out), transform 120ms var(--ease-out); }
:root[data-theme="dark"] .tip { background: #e8ecf3; color: #0f172a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tip { background: #e8ecf3; color: #0f172a; } }
.tip.show { opacity: 1; transform: translateY(0); }
.tip b { font-weight: 700; } .tip .r { display: flex; justify-content: space-between; gap: 12px; } .tip .r span:last-child { font-variant-numeric: tabular-nums; direction: ltr; }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 36px; direction: ltr; }
.spark i { flex: 1; background: var(--s1); border-radius: 2px 2px 0 0; min-height: 2px; opacity: .85; }
.spark i.lo { background: var(--gray); }

/* agenda */
.agenda { display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow: auto; overscroll-behavior: contain; }
.agItem { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface2); font-size: 13px; }
.agItem .d { font-weight: 700; color: var(--ink2); font-size: 12px; line-height: 1.2; } .agItem .d small { display: block; color: var(--faint); font-weight: 500; }
.agItem .v { font-weight: 700; font-variant-numeric: tabular-nums; direction: ltr; }
.agItem.income .v { color: var(--good-ink); } .agItem.debt .v { color: var(--s7); }

/* simulator */
.sliderRow { display: grid; grid-template-columns: 170px 1fr 110px; gap: 12px; align-items: center; }
@media (max-width: 600px) { .sliderRow { grid-template-columns: 1fr 90px; } .sliderRow input[type="range"] { grid-column: 1 / -1; } }
.sliderRow label { font-weight: 600; font-size: 13px; color: var(--ink2); }
.sliderRow label small { display: block; color: var(--faint); font-weight: 500; }
input[type="range"] { width: 100%; accent-color: var(--accent); direction: ltr; }
.cmp td.delta { font-weight: 700; }

/* modal */
.modalBack { position: fixed; inset: 0; background: rgba(5,10,20,.5); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fadeIn 160ms var(--ease-out); }
@keyframes fadeIn { from { opacity: 0; } }
.modal { width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 20px; display: flex; flex-direction: column; gap: 14px; max-height: calc(100dvh - 32px); overflow: auto; overscroll-behavior: contain; animation: popIn 200ms var(--ease-out); }
@keyframes popIn { from { opacity: 0; transform: scale(.96) translateY(6px); } }
.modal h2 { font-size: 17px; }
.modalActs { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 600px) { .modalBack { align-items: end; padding: 0; } .modal { border-radius: 18px 18px 0 0; max-height: 92dvh; padding-bottom: calc(20px + env(safe-area-inset-bottom)); } }

/* toasts */
.toasts { position: fixed; bottom: calc(16px + env(safe-area-inset-bottom)); inset-inline-start: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; pointer-events: none; }
@media (max-width: 960px) { .toasts { bottom: calc(80px + env(safe-area-inset-bottom)); } }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 12px; font-size: 13px; box-shadow: var(--shadow-lg); max-width: 360px; opacity: 1; transform: translateY(0); transition: opacity 300ms ease, transform 300ms var(--ease-out); pointer-events: auto; }
:root[data-theme="dark"] .toast { background: #e8ecf3; color: #0f172a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast { background: #e8ecf3; color: #0f172a; } }
.toast.err { background: var(--crit); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }
@starting-style { .toast { opacity: 0; transform: translateY(8px); } }

.empty { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--line2); border-radius: var(--r-sm); }
.note { font-size: 12.5px; color: var(--muted); background: var(--surface2); border-radius: var(--r-xs); padding: 8px 10px; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 18px; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; text-align: start; } .stat span { font-size: 12px; color: var(--muted); }
.statRow { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.kbd { font-family: var(--mono); font-size: 11px; background: var(--surface2); border: 1px solid var(--line2); border-radius: 5px; padding: 1px 5px; }
details.adv summary { cursor: pointer; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.pill-scope { font-size: 11px; padding: 2px 8px; border-radius: 6px; font-weight: 700; }
.sc-business { background: color-mix(in srgb, var(--s1) 16%, transparent); color: var(--s1); } .sc-personal { background: color-mix(in srgb, var(--s2) 16%, transparent); color: var(--s2); } .sc-stores { background: color-mix(in srgb, var(--s3) 16%, transparent); color: var(--s3); } .sc-onetime { background: color-mix(in srgb, var(--s7) 16%, transparent); color: var(--s7); } .sc-perorder { background: color-mix(in srgb, var(--s4) 20%, transparent); color: var(--s4); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media print { .side, .top, .tabbar, .toasts { display: none !important; } .shell { grid-template-columns: 1fr; } .card { break-inside: avoid; box-shadow: none; } }
