/* ================================================================
   תקציב — שפה עיצובית
   דיו וזהב: בסיס עמוק וניטרלי, מבטא חם יחיד, מספרים כגיבורים
   ================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;500;700&display=swap');

:root {
  --bg:      #0A0B0D;
  --s1:      #121418;
  --s2:      #191C21;
  --s3:      #22262D;
  --ink:     #F4F5F6;
  --ink-2:   #9DA4AE;
  --ink-3:   #656C77;
  --line:    rgba(255,255,255,.07);
  --line-2:  rgba(255,255,255,.13);

  --gold:    #E3B04B;
  --gold-dk: #8A6A26;
  --good:    #5FC79A;
  --warn:    #E0913F;
  --bad:     #E2726A;

  --r:   20px;
  --r-s: 13px;
  --nav: 74px;
  --f:   'Heebo', -apple-system, 'Segoe UI', Roboto, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #FBFAF8; --s1: #FFFFFF; --s2: #F4F2EE; --s3: #EAE7E1;
    --ink: #14161A; --ink-2: #5C636D; --ink-3: #8A9099;
    --line: rgba(20,22,26,.08); --line-2: rgba(20,22,26,.14);
    --gold: #A87A1E; --gold-dk: #E8D9B4;
    --good: #1B8A63; --warn: #A8620C; --bad: #B4443B;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }

/* כלל display מפורש גובר על תכונת hidden של HTML.
   בלי השורה הזו מסך הכניסה נשאר על המסך גם אחרי כניסה מוצלחת. */
[hidden] { display: none !important; }

body {
  font-family: var(--f); background: var(--bg); color: var(--ink);
  direction: rtl; font-size: 16px; line-height: 1.45; font-weight: 400;
  padding-bottom: calc(var(--nav) + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}

.n { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
.wrap { max-width: 540px; margin: 0 auto; padding: 0 20px; }
.screen { display: none; }
.screen.on { display: block; animation: rise .3s cubic-bezier(.2,.7,.3,1); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- כותרת ---------- */
.head { padding: calc(env(safe-area-inset-top) + 26px) 0 4px; }
.head .kick { font-size: 12px; font-weight: 500; letter-spacing: .1em; color: var(--gold); text-transform: uppercase; }
.head h1 { font-size: 27px; font-weight: 700; letter-spacing: -.025em; margin-top: 3px; }
.head .sub { font-size: 13.5px; color: var(--ink-3); margin-top: 2px; }

/* ---------- טבעת הגיבור ---------- */
.ring-card { display: flex; flex-direction: column; align-items: center; padding: 26px 0 8px; }
.ring { position: relative; width: 232px; height: 232px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-linecap: round; }
.ring .track { stroke: var(--s2); }
.ring .prog  { stroke: var(--gold); transition: stroke-dashoffset .9s cubic-bezier(.2,.8,.25,1), stroke .4s; }
.ring .prog.over { stroke: var(--bad); }
.ring .prog.warn { stroke: var(--warn); }
.ring .mid {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
}
.ring .cap { font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.ring .big { font-size: 45px; font-weight: 700; letter-spacing: -.04em; line-height: 1; }
.ring .big.over { color: var(--bad); }
.ring .foot { font-size: 13px; color: var(--ink-2); margin-top: 3px; }

.pace-tag {
  margin-top: 14px; font-size: 13px; font-weight: 500; padding: 7px 15px;
  border-radius: 99px; background: var(--s2); color: var(--ink-2);
}
.pace-tag.good { color: var(--good); } .pace-tag.warn { color: var(--warn); }
.pace-tag.bad  { color: var(--bad); }

/* ---------- כותרת מקטע ---------- */
.sec {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 30px 2px 12px;
}
.sec h2 { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.sec a { font-size: 13px; color: var(--gold); font-weight: 500; cursor: pointer; }

/* ---------- שורת קטגוריה ---------- */
.list { background: var(--s1); border-radius: var(--r); overflow: hidden; }
.item {
  display: flex; align-items: center; gap: 13px; padding: 14px 16px;
  cursor: pointer; position: relative; transition: background .15s;
}
.item + .item::before {
  content: ''; position: absolute; top: 0; inset-inline: 16px 16px;
  height: 1px; background: var(--line);
}
.item:active { background: var(--s2); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; background: var(--ink-3); }
.dot.good { background: var(--good); } .dot.warn { background: var(--warn); }
.dot.bad  { background: var(--bad); }  .dot.gold { background: var(--gold); }

.item .body { flex: 1; min-width: 0; }
.item .t { font-size: 15px; font-weight: 500; display: flex; align-items: center; gap: 7px; }
.item .s { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.item .s.bad { color: var(--bad); } .item .s.warn { color: var(--warn); }
.item .s.good { color: var(--good); }
.item .v { text-align: start; white-space: nowrap; }
.item .v b { font-size: 16px; font-weight: 700; letter-spacing: -.02em; display: block; }
.item .v i { font-style: normal; font-size: 12px; color: var(--ink-3); }

.line { height: 3px; border-radius: 2px; background: var(--s3); margin-top: 8px; position: relative; overflow: hidden; }
.line span { position: absolute; inset-inline-end: 0; top: 0; height: 100%; border-radius: 2px;
  background: var(--gold); transition: width .6s cubic-bezier(.2,.8,.3,1); }
.line span.good { background: var(--good); } .line span.warn { background: var(--warn); }
.line span.bad { background: var(--bad); }
.line .mark { position: absolute; top: -2px; width: 2px; height: 7px; background: var(--ink); opacity: .5; }

.tag { font-size: 10.5px; font-weight: 500; padding: 2px 7px; border-radius: 5px;
  background: var(--s3); color: var(--ink-3); }

/* ---------- מסך כניסה ---------- */
.gate {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.gatebox { width: 100%; max-width: 320px; text-align: center; }
.glogo {
  width: 72px; height: 72px; margin: 0 auto 20px; border-radius: 50%;
  border: 6px solid var(--s3); border-top-color: var(--gold);
  border-inline-end-color: var(--gold);
}
.gatebox h2 { font-size: 26px; font-weight: 700; letter-spacing: -.03em; }
.gatebox p { font-size: 13.5px; color: var(--ink-3); margin-top: 5px; }
.gatebox input {
  width: 100%; height: 56px; margin-top: 22px; border: 1px solid var(--line-2);
  border-radius: var(--r-s); background: var(--s1); color: var(--ink);
  font-family: var(--f); font-size: 26px; font-weight: 700; text-align: center;
  letter-spacing: .35em;
}
.gatebox input:focus { outline: none; border-color: var(--gold); }
.gatebox .chips { justify-content: center; margin-top: 16px; }
#pin-err { font-size: 13px; color: var(--bad); margin-top: 12px; min-height: 18px; }

/* ---------- פס סנכרון ---------- */
.syncbar {
  position: fixed; inset-inline: 0; top: 0; z-index: 90;
  padding: calc(env(safe-area-inset-top) + 7px) 16px 7px;
  font-size: 12.5px; font-weight: 500; text-align: center;
  background: var(--s3); color: var(--ink-2);
}
.syncbar.bad  { background: var(--bad); color: #fff; }
.syncbar.good { background: var(--gold); color: var(--bg); }

/* ---------- דשבורד ---------- */
.sum {
  background: linear-gradient(160deg, var(--s2), var(--s1));
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 20px; margin-top: 18px;
}
.sum .top { display: flex; justify-content: space-between; align-items: baseline; }
.sum .cap { font-size: 12.5px; color: var(--ink-3); }
.sum .hero { font-size: 40px; font-weight: 700; letter-spacing: -.04em; margin-top: 3px; line-height: 1.05; }
.sum .hero.bad { color: var(--bad); }
.sum .days { font-size: 12.5px; color: var(--ink-2); }
.sum .split { display: flex; gap: 18px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.sum .split div { flex: 1; }
.sum .split .k { font-size: 11.5px; color: var(--ink-3); }
.sum .split .v { font-size: 17px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.sum .split .v.gold { color: var(--gold); }

.dash { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-top: 14px; }
.dtile {
  background: var(--s1); border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px 16px 16px; cursor: pointer; text-align: start;
  font-family: var(--f); color: var(--ink);
  display: flex; flex-direction: column; gap: 3px; min-height: 128px;
  transition: transform .15s cubic-bezier(.3,1.2,.5,1), border-color .18s, background .18s;
}
.dtile:active { transform: scale(.96); }
.dtile:hover { border-color: var(--line-2); background: var(--s2); }
.dtile .ic {
  width: 42px; height: 42px; border-radius: 12px; background: var(--s3);
  display: flex; align-items: center; justify-content: center; margin-bottom: 8px;
}
.dtile .ic svg { width: 21px; height: 21px; stroke: var(--gold); fill: none;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dtile .t { font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; }
.dtile .s { font-size: 12.5px; color: var(--ink-3); margin-top: auto; padding-top: 6px; }
.dtile .s b { color: var(--gold); font-weight: 700; }

/* ---------- עריכה ---------- */
.edit { padding: 14px 16px; background: var(--s2); }
.edit .fields { display: flex; gap: 8px; }
.edit input {
  height: 44px; border: 1px solid var(--line-2); border-radius: var(--r-s);
  background: var(--bg); color: var(--ink); font-family: var(--f);
  font-size: 15px; padding: 0 12px; min-width: 0;
}
.edit input.nm { flex: 1; }
.edit input.am { width: 104px; text-align: center; font-weight: 700; }
.edit input.dy { width: 62px; text-align: center; }
.edit input:focus { outline: none; border-color: var(--gold); }
.edit .acts { display: flex; gap: 8px; margin-top: 10px; }
.edit .acts button {
  border: 0; border-radius: 9px; font-family: var(--f); font-size: 13.5px;
  font-weight: 700; cursor: pointer; padding: 10px 16px;
}
.edit .ok  { background: var(--gold); color: var(--bg); }
.edit .cx  { background: var(--s3); color: var(--ink-2); }
.edit .del { background: transparent; color: var(--bad); margin-inline-start: auto; }

.addrow {
  display: flex; align-items: center; gap: 9px; padding: 13px 16px;
  color: var(--gold); font-size: 14px; font-weight: 500; cursor: pointer;
  background: none; border: 0; width: 100%; font-family: var(--f);
  border-top: 1px solid var(--line);
}
.addrow span { font-size: 19px; line-height: 1; }

.pen { color: var(--ink-3); font-size: 11.5px; padding: 4px 6px; }

/* ---------- סיכום ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.tile { background: var(--s1); border-radius: var(--r-s); padding: 15px 16px; }
.tile .k { font-size: 12px; color: var(--ink-3); }
.tile .v { font-size: 22px; font-weight: 700; letter-spacing: -.03em; margin-top: 4px; }
.tile .v.gold { color: var(--gold); } .tile .v.bad { color: var(--bad); }

/* ---------- ניווט ---------- */
nav {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 40;
  height: calc(var(--nav) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(22px) saturate(1.5); -webkit-backdrop-filter: blur(22px) saturate(1.5);
  border-top: 1px solid var(--line); display: flex;
}
nav button {
  flex: 1; border: 0; background: none; font-family: var(--f); cursor: pointer;
  color: var(--ink-3); font-size: 10.5px; font-weight: 500;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  transition: color .18s;
}
nav button svg { width: 21px; height: 21px; stroke-width: 1.6; fill: none; stroke: currentColor;
  stroke-linecap: round; stroke-linejoin: round; }
nav button.on { color: var(--gold); }

.fabwrap { flex: 0 0 78px; position: relative; display: flex;
  align-items: flex-end; justify-content: center; padding-bottom: 11px; }
.fab {
  position: absolute; top: -20px; inset-inline-start: 50%; transform: translateX(50%);
  width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--gold); color: var(--bg); font-size: 30px; font-weight: 300;
  line-height: 1; box-shadow: 0 8px 26px color-mix(in srgb, var(--gold) 38%, transparent);
  transition: transform .15s cubic-bezier(.3,1.4,.5,1);
}
.fab:active { transform: translateX(50%) scale(.9); }
.fablbl { font-size: 10.5px; font-weight: 500; color: var(--gold); pointer-events: none; }

/* ---------- הזנה ---------- */
.amt { text-align: center; padding: 30px 0 10px; font-size: 58px; font-weight: 700; letter-spacing: -.045em; }
.amt.empty { color: var(--ink-3); }
.keys { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; margin-top: 14px; }
.keys button {
  height: 60px; border: 0; border-radius: var(--r-s); background: var(--s1);
  font-family: var(--f); font-size: 24px; font-weight: 500; color: var(--ink); cursor: pointer;
  transition: transform .1s, background .12s;
}
.keys button:active { transform: scale(.94); background: var(--s3); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line-2); background: transparent; color: var(--ink);
  border-radius: 99px; padding: 9px 16px; font-family: var(--f);
  font-size: 13.5px; font-weight: 500; cursor: pointer; transition: all .15s;
}
.chip:active { transform: scale(.95); }
.chip.on { background: var(--gold); border-color: var(--gold); color: var(--bg); font-weight: 700; }

.hintbox { margin-top: 16px; padding: 13px 15px; border-radius: var(--r-s);
  background: var(--s1); font-size: 13.5px; color: var(--ink-2); border-inline-start: 3px solid var(--gold); }
.hintbox.bad { border-inline-start-color: var(--bad); color: var(--bad); }

.btn {
  width: 100%; height: 54px; border: 0; border-radius: var(--r-s); background: var(--gold);
  color: var(--bg); font-family: var(--f); font-size: 16px; font-weight: 700;
  cursor: pointer; margin-top: 16px; transition: transform .12s, opacity .15s;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .25; }
.btn.alt { background: var(--s2); color: var(--ink); }

/* ---------- תכנון ---------- */
.planbar {
  position: sticky; top: 0; z-index: 6; background: var(--bg);
  padding: 12px 0 14px; margin-bottom: 4px;
}
.planbar .inner { background: var(--s1); border-radius: var(--r); padding: 16px 18px; }
.planbar .r { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-3); margin-bottom: 4px; }
.planbar .tot { display: flex; justify-content: space-between; align-items: baseline;
  padding-top: 10px; margin-top: 8px; border-top: 1px solid var(--line); }
.planbar .tot span { font-size: 13.5px; color: var(--ink-2); }
.planbar .tot b { font-size: 25px; font-weight: 700; letter-spacing: -.035em; color: var(--gold); }
.planbar .tot b.neg { color: var(--bad); }
.planbar .meter { height: 4px; border-radius: 2px; background: var(--s3); margin-top: 12px; overflow: hidden; }
.planbar .meter span { display: block; height: 100%; background: var(--gold); border-radius: 2px;
  transition: width .4s ease; }
.planbar .meter span.neg { background: var(--bad); }

.arow { display: flex; align-items: center; gap: 12px; padding: 13px 16px; position: relative; }
.arow + .arow::before { content: ''; position: absolute; top: 0; inset-inline: 16px;
  height: 1px; background: var(--line); }
.arow .body { flex: 1; min-width: 0; }
.arow .t { font-size: 14.5px; font-weight: 500; }
.arow .s { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.arow input {
  width: 96px; height: 42px; border: 1px solid var(--line-2); border-radius: var(--r-s);
  background: var(--bg); color: var(--ink); font-family: var(--f); font-size: 16px;
  font-weight: 700; text-align: center; padding: 0 4px;
}
.arow input:focus { outline: none; border-color: var(--gold); }
.arow .use { border: 0; background: none; color: var(--gold); font-family: var(--f);
  font-size: 11.5px; font-weight: 500; cursor: pointer; padding: 6px 2px; white-space: nowrap; }

/* ---------- ייבוא ---------- */
.drop {
  border: 1.5px dashed var(--line-2); border-radius: var(--r); padding: 40px 24px;
  text-align: center; cursor: pointer; transition: all .2s; background: var(--s1);
}
.drop:hover, .drop.over { border-color: var(--gold); background: var(--s2); }
.drop svg { width: 38px; height: 38px; stroke: var(--gold); fill: none; stroke-width: 1.4;
  stroke-linecap: round; stroke-linejoin: round; }
.drop .t { font-size: 15.5px; font-weight: 500; margin-top: 12px; }
.drop .s { font-size: 13px; color: var(--ink-3); margin-top: 4px; }

.note { font-size: 12.5px; color: var(--ink-3); line-height: 1.6; margin-top: 14px; }

.empty { text-align: center; padding: 64px 24px; color: var(--ink-3); font-size: 14px; }

/* ---------- מסך רחב ----------
   הניווט נשאר צמוד לתחתית תמיד — הופך לסרגל מרחף וממורכז */
@media (min-width: 940px) {
  .wrap { max-width: 620px; padding: 0 24px; }
  nav {
    inset-inline: auto; inset-inline-start: 50%; transform: translateX(50%);
    bottom: 20px; width: 460px; height: 70px; padding: 0;
    border: 1px solid var(--line-2); border-radius: 22px;
    background: color-mix(in srgb, var(--s1) 90%, transparent);
    box-shadow: 0 12px 40px rgba(0,0,0,.35);
  }
  .ring-card { padding-top: 34px; }
}
