@font-face { font-family: Heebo; font-weight: 400; font-display: swap; src: url(fonts/heebo-hebrew-400-normal.woff2) format("woff2"); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: Heebo; font-weight: 400; font-display: swap; src: url(fonts/heebo-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-21FF; }
@font-face { font-family: Heebo; font-weight: 600; font-display: swap; src: url(fonts/heebo-hebrew-600-normal.woff2) format("woff2"); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: Heebo; font-weight: 600; font-display: swap; src: url(fonts/heebo-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-21FF; }
@font-face { font-family: Heebo; font-weight: 800; font-display: swap; src: url(fonts/heebo-hebrew-800-normal.woff2) format("woff2"); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: Heebo; font-weight: 800; font-display: swap; src: url(fonts/heebo-latin-800-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-21FF; }

:root {
  --bg: #f4f2ec;
  --surface: #ffffff;
  --surface-2: #faf8f3;
  --ink: #12233f;
  --ink-2: #5a6578;
  --line: #e6e1d6;
  --accent: #0f766e;
  --accent-soft: #dff1ee;
  --neg: #b4472a;
  --neg-soft: #f8e6df;
  --warn: #a16207;
  --warn-soft: #fbf0d5;
  --navy: #12233f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(18, 35, 63, .05), 0 4px 16px rgba(18, 35, 63, .04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1626; --surface: #142036; --surface-2: #19273f; --ink: #e8ecf3; --ink-2: #94a0b4;
    --line: #243552; --accent: #2bb3a3; --accent-soft: #123a3a; --neg: #f08a6c; --neg-soft: #3a2220;
    --warn: #e3b341; --warn-soft: #3a3018; --shadow: none; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 Heebo, system-ui, "Segoe UI", Arial, sans-serif; }
h1 { font-size: 1.6rem; font-weight: 800; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; font-weight: 600; margin: 0 0 .75rem; }
h3 { font-size: .95rem; font-weight: 600; margin: 0 0 .5rem; }
a { color: inherit; }
.muted { color: var(--ink-2); }
.sm { font-size: .85rem; }
.mt { margin-top: 1rem; }
.num { font-variant-numeric: tabular-nums; font-weight: 600; direction: ltr; unicode-bidi: isolate; }
.neg { color: var(--neg); }
.warn-t { color: var(--warn); }
.link { color: var(--accent); text-decoration: none; font-size: .9rem; font-weight: 600; }
.link:hover { text-decoration: underline; }

/* layout */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #dbe3ef; padding: 1.4rem 1rem; display: flex; flex-direction: column; gap: 1.5rem; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.15rem; color: #fff; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, #2bb3a3, #0f766e); color: #fff; font-size: 1.1rem; }
.brand.big { font-size: 1.4rem; color: var(--ink); justify-content: center; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; border-radius: 10px; text-decoration: none; color: #b9c4d6; font-weight: 600; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.on { background: rgba(43,179,163,.16); color: #fff; }
.nav .ico { width: 1.2rem; text-align: center; opacity: .8; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: .5rem; font-size: .85rem; }
.side-foot .btn { color: #dbe3ef; border-color: rgba(255,255,255,.18); width: 100%; }
.who b { color: #fff; }
.main { padding: 1.8rem 2.2rem 4rem; max-width: 1180px; width: 100%; }
.tabbar { display: none; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.3rem; flex-wrap: wrap; }
.page-head p { margin: .25rem 0 0; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .6rem; }
.card-head h2 { margin: 0; }
.card-head .total { font-weight: 800; font-variant-numeric: tabular-nums; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.grid2 > .card, .grid3 > .card { margin-bottom: 0; }
.grid2, .grid3 { margin-bottom: 1rem; }
.label { font-size: .82rem; color: var(--ink-2); font-weight: 600; }
.kpi .num { font-size: 1.55rem; font-weight: 800; margin-top: .15rem; }
.kpi.good .num { color: var(--accent); }
.kpi.bad .num { color: var(--neg); }
a.kpi.filter { text-decoration: none; transition: border-color .15s; }
a.kpi.filter:hover, a.kpi.filter.on { border-color: var(--accent); }

.hero { display: grid; grid-template-columns: 1.1fr 1.6fr; gap: 1rem; background: var(--navy); color: #fff; border-radius: calc(var(--radius) + 4px); padding: 1.6rem 1.8rem; margin-bottom: 1rem; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; inset: auto -80px -120px auto; width: 320px; height: 320px; border-radius: 50%; background: radial-gradient(circle, rgba(43,179,163,.35), transparent 70%); pointer-events: none; }
.hero .label { color: #9fb0c8; }
.hero-num { font-size: 2.6rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; direction: ltr; text-align: right; line-height: 1.15; margin-top: .2rem; }
.hero-sub { color: #b9c4d6; display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; margin-top: .2rem; }
.hero-split { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; align-self: end; border-right: 1px solid rgba(255,255,255,.12); padding-right: 1.4rem; }
.hero-split .num { font-size: 1.3rem; font-weight: 800; }
.hero-split .muted { color: #9fb0c8; }
.hero .neg { color: #ffb39c; }
.delta { font-size: .85rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; white-space: nowrap; }
.delta.up { background: var(--accent-soft); color: var(--accent); }
.delta.down { background: var(--neg-soft); color: var(--neg); }
.hero .delta.up { background: rgba(43,179,163,.2); color: #7fe0d3; }
.hero .delta.down { background: rgba(240,138,108,.2); color: #ffb39c; }

.meter { height: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; margin: .6rem 0 .3rem; }
.meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #2bb3a3); width: 0; border-radius: 99px; }
.kpi.bad .meter span { background: var(--neg); }

.chart-wrap { position: relative; height: 260px; }
.chart-wrap.tall { height: 340px; }

.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.bars li { display: grid; grid-template-columns: 78px 1fr 84px; gap: .6rem; align-items: center; font-size: .9rem; }
.bar { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; width: 0; }
.bar-val { text-align: left; font-variant-numeric: tabular-nums; font-weight: 600; direction: ltr; }
.hint { background: var(--warn-soft); border-radius: 10px; padding: .6rem .8rem; font-size: .9rem; margin: 1rem 0 0; }

.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.chips li { background: var(--warn-soft); border-radius: 99px; padding: .25rem .8rem; font-size: .88rem; }

/* rows */
.rows { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) 150px 100px 230px auto; gap: .8rem; align-items: center; padding: .8rem 0; border-top: 1px solid var(--line); }
.rows .row:first-child { border-top: 0; }
#expenses .row, .row:not(:has(.row-quick)) { grid-template-columns: minmax(0, 1fr) 170px auto; }
.row-title { font-weight: 600; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.row-sub { font-size: .85rem; overflow-wrap: anywhere; }
.row-val { text-align: left; }
.row-val .num { font-size: 1.05rem; }
.row-meta { font-size: .85rem; color: var(--ink-2); text-align: center; }
.date.stale { color: var(--warn); font-weight: 600; }
.date.stale::before { content: "⚠ "; }
.row-quick { display: flex; gap: .4rem; }
.row-quick input { width: 100%; min-width: 0; }
.row-edit { grid-column: 1 / -1; margin-top: -.4rem; }
.row-edit[open] { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: .8rem; margin-top: 0; }
.row-edit > summary { list-style: none; display: inline-flex; }
.row-edit > summary::-webkit-details-marker { display: none; }
.row-edit:not([open]) { grid-column: auto; margin-top: 0; }
.edit-panel { margin-top: .8rem; }
.danger-zone { margin-top: .8rem; padding-top: .8rem; border-top: 1px dashed var(--line); }

.tag { font-size: .75rem; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); padding: .05rem .5rem; border-radius: 99px; }
.tag.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill { font-size: .72rem; font-weight: 800; padding: .05rem .5rem; border-radius: 99px; }
.pill.yes { background: var(--accent-soft); color: var(--accent); }
.pill.no { background: var(--neg-soft); color: var(--neg); }
.pill.maybe { background: var(--warn-soft); color: var(--warn); }

/* forms */
input, select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .5rem .7rem; min-height: 40px; width: 100%; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; }
.span2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: .8rem; }
.inline-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline-form input { width: auto; flex: 1 1 160px; }
.actions { margin-top: .9rem; display: flex; gap: .5rem; }
details.add > summary { list-style: none; cursor: pointer; }
details.add > summary::-webkit-details-marker { display: none; }
details.add:not([open]) { background: transparent; border-style: dashed; box-shadow: none; }

.btn { font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border-radius: 10px; padding: .5rem 1rem; min-height: 40px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; color: var(--neg); border-color: var(--neg-soft); }
.btn.danger:hover { background: var(--neg-soft); }
.btn.sm { min-height: 34px; padding: .3rem .8rem; font-size: .88rem; }
.btn.xs { min-height: 28px; padding: .1rem .5rem; font-size: .8rem; }
.btn.wide { width: 100%; }

.toast { padding: .7rem 1rem; border-radius: 12px; margin-bottom: 1rem; font-weight: 600; transition: opacity .4s; }
.toast.ok { background: var(--accent-soft); color: var(--accent); }
.toast.bad { background: var(--neg-soft); color: var(--neg); }
.toast.hide { opacity: 0; }

.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: right; font-size: .8rem; color: var(--ink-2); font-weight: 600; padding: .5rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl td.num { text-align: right; }
.tbl tr:last-child td { border-bottom: 0; }
ul.plain { list-style: none; padding: 0; margin: 0 0 .8rem; display: flex; flex-direction: column; gap: .5rem; }

/* login */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: radial-gradient(1200px 600px at 80% -10%, rgba(43,179,163,.18), transparent 60%), var(--bg); }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 2.2rem 2rem; width: 100%; max-width: 380px; box-shadow: var(--shadow); text-align: center; }
.login-card form { text-align: right; margin-top: 1.2rem; }
.login-card .brand-mark { width: 44px; height: 44px; font-size: 1.3rem; }

/* responsive */
@media (max-width: 1100px) {
  .row { grid-template-columns: minmax(0, 1fr) 140px auto; }
  .row-meta { display: none; }
  .row-quick { grid-column: 1 / 3; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 1.1rem 1rem 6rem; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; inset-inline: 0; background: var(--surface); border-top: 1px solid var(--line); padding: .35rem .3rem calc(.35rem + env(safe-area-inset-bottom)); z-index: 10; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: .1rem; font-size: .72rem; font-weight: 600; text-decoration: none; color: var(--ink-2); padding: .25rem 0; border-radius: 10px; }
  .tabbar a span { font-size: 1.15rem; line-height: 1; }
  .tabbar a.on { color: var(--accent); background: var(--accent-soft); }
  .hero { grid-template-columns: 1fr; padding: 1.3rem; }
  .hero-num { font-size: 2.1rem; }
  .hero-split { border-right: 0; padding-right: 0; border-top: 1px solid rgba(255,255,255,.12); padding-top: 1rem; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  h1 { font-size: 1.35rem; }
  .hero-split { grid-template-columns: 1fr 1fr; }
  .hero-split > div:last-child { grid-column: span 2; }
  .row { grid-template-columns: minmax(0, 1fr) auto; }
  .row-val { grid-column: 2; grid-row: 1; }
  .row-quick { grid-column: 1 / -1; }
  .row-edit:not([open]) { grid-column: 1 / -1; }
  .form-grid { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .card { padding: 1rem; }
}


/* --- accessibility: skip link (visible on focus) --- */
.skip-link {
  position: absolute;
  inset-inline-start: 0;
  top: -100px;
  z-index: 100;
  padding: 12px 20px;
  background: #12233f;
  color: #fff;
  border-radius: 0 0 8px 0;
  font-weight: 700;
  text-decoration: none;
  transition: top .15s ease;
}
.skip-link:focus {
  top: 0;
}

/* --- accessibility: honour prefers-reduced-motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
