/* הסופר שלנו: אח של "כסף משותף". אותו עיצוב "פנקס בנק" (docs/design-system.md):
   רקע אפור-נייר קר, כרטיסים לבנים עם קו דק, צבע מותג אחד: ירוק (יעם בחר ירוק כדי להבדיל מכסף משותף), בלי צללים.
   היררכיה בעזרת משקל, קו דק ומרווח. מחלקה = אריח אייקון צבוע לפי משפחה. */
:root {
  --bg: #f1f2ef;
  --surface: #ffffff;
  --surface-2: #ebede9;
  --text: #15191c;
  --muted: #5f666c;
  --line: #e0e2de;
  --line-strong: #c9cdc7;
  --primary: #18704a;
  --primary-ink: #ffffff;
  --primary-soft: #dcefe4;
  --income: #18704a;
  --expense: #b4372a;
  --warn: #a8700f;
  --radius: 14px;
  --r-ctl: 10px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1214; --surface: #171b1e; --surface-2: #20262a; --text: #e8eaeb; --muted: #8e979d; --line: #262c30; --line-strong: #353c41;
    --primary: #5cc28f; --primary-ink: #07170f; --primary-soft: #15291f;
    --income: #5cc28f; --expense: #f07e6e; --warn: #e0ad4a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.5 "IBM Plex Sans Hebrew", system-ui, sans-serif; min-height: 100dvh; -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
button, input, select { font: inherit; color: inherit; }
input, select { font-size: 16px; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
a { color: var(--primary); }
.ico { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }

#app { max-width: 560px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-left, 0px)) calc(48px + var(--safe-b)) max(16px, env(safe-area-inset-right, 0px)); }
.splash { min-height: 80dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.splash img { width: 64px; height: 64px; border-radius: 18px; }
.splash b { font-size: 1.15rem; font-weight: 600; }

/* כפתורים */
.btn { border: 0; background: var(--surface-2); color: var(--text); border-radius: var(--r-ctl); padding: 11px 16px; min-height: 44px; font-weight: 500; transition: transform .1s; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); color: var(--primary-ink); font-weight: 600; }
.btn.ghost { background: transparent; border: 1px solid var(--line-strong); }
.btn.danger { background: transparent; border: 1px solid var(--line-strong); color: var(--expense); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; }
.link { background: none; border: 0; color: var(--primary); font-weight: 500; padding: 10px 4px; min-height: 44px; }
.link.danger { color: var(--expense); }
.iconbtn { width: 44px; height: 44px; border: 0; background: none; display: grid; place-items: center; color: var(--text); border-radius: 50%; }
.iconbtn .ico { width: 23px; height: 23px; stroke-width: 1.7; }

/* כניסה */
.auth { padding-top: calc(10vh + var(--safe-t)); display: flex; flex-direction: column; gap: 12px; }
.auth img { width: 72px; height: 72px; border-radius: 20px; }
.auth h1 { margin: 4px 0 0; font-size: 1.75rem; font-weight: 600; letter-spacing: -.01em; }
.auth p { margin: 0; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); }
.field input, .field select { padding: 11px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-ctl); background: var(--surface); color: var(--text); }
.field input:focus, .field select:focus { outline: 2px solid var(--primary); border-color: transparent; }
.err { color: var(--expense); font-size: .9rem; min-height: 1.2em; }
.hint { color: var(--muted); font-size: .85rem; margin: 0; }

/* כותרת והוספה */
header { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: calc(8px + var(--safe-t)) 0 10px; display: flex; flex-direction: column; gap: 10px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top h1 { margin: 0; font-size: 1.75rem; font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
.count { color: var(--muted); font-size: .85rem; }
form.add { display: flex; gap: 8px; }
#q { flex: 1; min-width: 0; padding: 11px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-ctl); background: var(--surface); color: var(--text); }
#q:focus { outline: 2px solid var(--primary); border-color: transparent; }
form.add .btn { display: inline-flex; align-items: center; gap: 6px; padding: 0 16px 0 14px; }
form.add .btn .ico { stroke-width: 2.2; }
.guess { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); flex-wrap: wrap; }
.guess select { font-size: .86rem; padding: 6px 12px; min-height: 36px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); }
.banner { display: flex; gap: 8px; align-items: center; background: var(--primary-soft); color: var(--text); border-radius: var(--r-ctl); padding: 10px 12px; font-size: .9rem; }
.banner .ico { color: var(--primary); }

/* מחלקות */
h2.aisle-h { display: flex; align-items: center; gap: 10px; margin: 1.4rem 2px .55rem; font-size: .95rem; font-weight: 600; }
h2.aisle-h .no { margin-inline-start: auto; color: var(--muted); font-weight: 400; font-size: .8rem; }
.ci { display: inline-grid; place-items: center; flex: none; color: hsl(var(--h, 210) 42% 34%); }
.ci svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ci.tile { width: 30px; height: 30px; border-radius: 9px; background: hsl(var(--h, 210) 50% 93%); }
.ci.tile svg { width: 18px; height: 18px; }
@media (prefers-color-scheme: dark) {
  .ci { color: hsl(var(--h, 210) 60% 74%); }
  .ci.tile { background: hsl(var(--h, 210) 22% 19%); }
}
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
ul.items { list-style: none; margin: 0; padding: 0; overflow: hidden; }
ul.items li { display: flex; align-items: center; }
ul.items li + li { border-top: 1px solid var(--line); }
.tick { flex: 1; min-width: 0; min-height: 48px; display: flex; align-items: center; gap: 12px; background: none; border: 0; text-align: start; padding: 11px 16px; }
.tick:active { background: var(--surface-2); }
.box { flex: none; width: 26px; height: 26px; border: 2px solid var(--line-strong); border-radius: 8px; display: grid; place-items: center; transition: background .15s, border-color .15s; }
.box .ico { width: 16px; height: 16px; stroke-width: 2.4; color: var(--primary-ink); opacity: 0; }
.done .box { background: var(--primary); border-color: var(--primary); }
.done .box .ico { opacity: 1; }
.nm { min-width: 0; display: flex; flex-direction: column; }
.nm b { font-weight: 500; overflow-wrap: anywhere; }
.nm small { color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.done .nm b { text-decoration: line-through; color: var(--muted); }
.done .tick { opacity: .7; }
.more .ico { width: 22px; height: 22px; stroke-width: 2.8; }
.more { flex: none; width: 44px; height: 48px; background: none; border: 0; color: var(--muted); display: grid; place-items: center; margin-inline-end: 4px; }
li.flash { animation: flash 1.2s var(--ease); }
@keyframes flash { 0%, 50% { background: var(--primary-soft); } 100% { background: transparent; } }

.cart-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 1.8rem 2px .35rem; }
.cart-h h2 { margin: 0; font-size: .95rem; font-weight: 600; color: var(--muted); }

.empty { margin-top: 18px; border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 28px 16px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.empty b { color: var(--text); font-weight: 600; }

/* חלונות מלמטה */
dialog { border: 0; padding: 0; width: 100%; max-width: 560px; margin: auto auto 0; background: var(--bg); color: var(--text); border-radius: 20px 20px 0 0; max-height: 92dvh; }
dialog[open] { animation: up .28s var(--ease); }
dialog::backdrop { background: rgba(10, 14, 20, .45); animation: fade .25s; }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } }
.sheet { padding: 8px max(16px, env(safe-area-inset-left, 0px)) 0 max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 12px; }
.grab { width: 36px; height: 4px; border-radius: 9px; background: var(--line-strong); margin: 0 auto 2px; }
.sheet-h { display: flex; align-items: center; justify-content: space-between; }
.sheet-h h3 { margin: 0; font-size: 1.15rem; font-weight: 600; }
.x { width: 44px; height: 44px; border: 0; background: none; display: grid; place-items: center; margin-inline-end: -6px; }
.x span { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; }
.sheet-foot { position: sticky; bottom: 0; background: var(--bg); border-top: 1px solid var(--line); margin: 4px -16px 0; padding: 10px 16px calc(10px + var(--safe-b)); display: flex; gap: 8px; }
.sheet-foot .btn { flex: 1; }
.group-h { font-size: .85rem; font-weight: 600; color: var(--muted); margin: 6px 2px -4px; }
.code-card { padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.code-card b { font-size: 1.5rem; font-weight: 600; letter-spacing: .15em; direction: ltr; }
.menu-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 11px 16px; background: none; border: 0; text-align: start; color: var(--text); }
.menu-row + .menu-row { border-top: 1px solid var(--line); }
.menu-row .t { flex: 1; font-weight: 500; }
.menu-row .ci.tile { color: var(--primary); background: var(--primary-soft); }
.menu-row .chev { color: var(--muted); }
.menu-row.danger { color: var(--expense); }
.order { list-style: none; margin: 0; padding: 0; overflow: auto; max-height: 56dvh; }
.order li { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 16px; min-height: 52px; }
.order li + li { border-top: 1px solid var(--line); }
.order .lbl { flex: 1; min-width: 0; font-weight: 500; }
.order .n { color: var(--muted); width: 1.4em; font-size: .85rem; }
.order button { width: 44px; height: 44px; border: 0; background: var(--surface-2); border-radius: var(--r-ctl); display: grid; place-items: center; color: var(--text); }
.order button:disabled { opacity: .35; }

/* הודעה קופצת עם ביטול */
#toast { position: fixed; inset-inline: 16px; bottom: calc(24px + var(--safe-b)); margin: 0 auto; max-width: 480px; background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 10px; font-size: .9rem; display: flex; align-items: center; justify-content: space-between; gap: 12px; opacity: 0; transform: translateY(12px); transition: opacity .22s var(--ease), transform .22s var(--ease); pointer-events: none; z-index: 20; }
#toast.show { opacity: 1; transform: none; pointer-events: auto; }
#toast button { background: none; border: 0; color: inherit; text-decoration: underline; font-weight: 600; padding: 6px 4px; min-height: 36px; }

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