/* ============================================================
   app.css — רכיבי הממשק. נשען על tokens.css, לא מגדיר צבעים משלו.
   מבוסס על עמוד התצוגה שאושר ב-5.10.2026.
   ============================================================ */

/* ---------- שלד ---------- */
.appbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px;
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.appbar .biz { display: flex; align-items: center; gap: 9px; min-width: 0; }
.mark {
  width: 30px; height: 30px; flex: none; border-radius: 9px;
  background: var(--ink); color: var(--neon); display: grid; place-items: center;
  font-family: var(--font); font-weight: 700; font-size: 15px;
}
.appbar .name { font-weight: 500; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar .quota { font-size: .72rem; color: var(--ink-4); white-space: nowrap; }
.iconbtn {
  width: 38px; height: 38px; flex: none; border: 0; background: transparent;
  border-radius: 11px; font-size: 1.1rem; cursor: pointer; color: var(--ink-3);
}
.iconbtn:hover { background: var(--paper-2); color: var(--ink); }

main { max-width: 760px; margin: 0 auto; padding: 14px 14px 90px; }
.screen { display: flex; flex-direction: column; gap: 14px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.page-head h2 { margin: 0; font-size: 1.25rem; }

/* ---------- ניווט תחתון ---------- */
.nav {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30;
  display: flex; background: var(--paper); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nav a {
  flex: 1; padding: 9px 4px 10px; text-align: center; text-decoration: none;
  color: var(--ink-4); font-size: .7rem; display: flex; flex-direction: column; gap: 3px;
  transition: color var(--t) var(--ease);
}
.nav a i { font-style: normal; font-size: 1.15rem; }
/* שישה פריטים בניווט — בטלפון צר התווית מתכווצת במקום לשבור שורה */
@media (max-width: 400px) {
  .nav a { font-size: .62rem; padding-inline: 2px; }
  .nav a i { font-size: 1.05rem; }
}
.nav a.on { color: var(--green-deep); }
.nav a:hover { color: var(--ink); text-decoration: none; }

/* ---------- משטח החתימה: הסכום ---------- */
.hero {
  background: var(--ink); color: #fff; border-radius: var(--r-lg);
  padding: 18px; box-shadow: var(--shadow-ink); position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; inset-inline-end: -40px; top: -40px;
  width: 150px; height: 150px; border-radius: 50%;
  background: radial-gradient(circle, rgba(61,242,155,.14), transparent 68%);
}
.hero .lbl {
  font-size: .74rem; letter-spacing: .09em; color: rgba(255,255,255,.62);
}
.hero .fig {
  font-family: var(--font-num); font-weight: 700;
  font-size: clamp(2.1rem, 11vw, 2.8rem); line-height: 1.05;
  color: var(--neon); letter-spacing: -.03em;
}
.hero .fig small { font-size: .5em; font-weight: 500; margin-inline-start: 4px; }
.hero .sub { font-size: .82rem; color: rgba(255,255,255,.66); margin-top: 6px; }
.hero .strip {
  display: flex; gap: 16px; flex-wrap: wrap; margin-top: 13px;
  padding-top: 12px; border-top: 1px solid rgba(255,255,255,.12);
}
.hero .strip div { font-size: .75rem; color: rgba(255,255,255,.6); }
.hero .strip b { display: block; font-family: var(--font-num); font-size: 1.02rem; color: #fff; }

/* ---------- כפתורים ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 18px; border: 0; cursor: pointer; border-radius: var(--r);
  font-family: var(--font); font-size: .98rem; font-weight: 500;
  background: var(--paper); color: var(--ink); border: 1px solid var(--line-2);
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease), border-color var(--t);
}
.btn:hover { border-color: var(--green); color: var(--green-deep); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary {
  background: var(--green); color: #fff; border-color: var(--green);
  box-shadow: 0 2px 10px rgba(15,169,104,.3);
}
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 5px 18px rgba(15,169,104,.36); color: #fff; }
.btn.big { width: 100%; padding: 16px; font-size: 1.05rem; }
.btn.danger { color: var(--high); border-color: var(--high); }
.btn.sm { padding: 7px 12px; font-size: .84rem; border-radius: var(--r-sm); }
.row { display: flex; gap: 9px; flex-wrap: wrap; }
.row.grow > * { flex: 1; }
.row.end { justify-content: flex-end; }

/* ---------- כרטיס ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-1); }
.card-h {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 13px 14px 9px; font-weight: 500; font-size: .95rem;
}
.card-h span { font-size: .76rem; color: var(--ink-4); font-weight: 400; }
.card-b { padding: 0 14px 14px; }
.hint { font-size: .84rem; color: var(--ink-3); margin: 0 0 10px; }
.muted { color: var(--ink-4); }
.empty { padding: 28px 16px; text-align: center; color: var(--ink-4); font-size: .9rem; }

/* ---------- שורת חשבונית ---------- */
.inv {
  display: flex; align-items: center; gap: 11px; padding: 11px 14px;
  border-top: 1px solid var(--line); cursor: pointer; text-align: start;
  background: none; border-inline: 0; border-bottom: 0; width: 100%; font: inherit; color: inherit;
}
.inv:first-of-type { border-top: 0; }
.inv:hover { background: var(--paper-2); }
.inv .av {
  width: 36px; height: 36px; flex: none; border-radius: 11px;
  background: var(--paper-2); border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 1rem;
}
.inv .mid { flex: 1; min-width: 0; }
.inv .t { font-size: .92rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv .m { font-size: .76rem; color: var(--ink-4); }

/* ---------- תגים ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-pill);
  font-size: .72rem; font-weight: 500; white-space: nowrap;
}
.chip.high { background: var(--high-soft); color: var(--high); }
.chip.med  { background: var(--med-soft);  color: var(--med); }
.chip.info { background: var(--paper-2); color: var(--ink-3); border: 1px solid var(--line); }
.chip.money{ background: var(--green-soft); color: var(--green-deep); font-family: var(--font-num); font-weight: 700; }
.chip.ok   { color: var(--ink-4); }

/* ---------- ממצא ---------- */
.find {
  display: grid; grid-template-columns: 42px minmax(0,1fr) auto; gap: 13px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r);
  padding: 15px; position: relative; overflow: hidden;
}
.find::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 3px; background: var(--line); }
.find.high::before { background: var(--high); }
.find.medium::before { background: var(--med); }
.find.good::before { background: var(--green); }
.find .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem; background: var(--paper-2); }
.find.high .ic { background: var(--high-soft); }
.find.medium .ic { background: var(--med-soft); }
.find.good .ic { background: var(--green-soft); }
.find h3 { font-size: .97rem; font-weight: 600; margin: 0 0 3px; }
.find p { margin: 0 0 7px; font-size: .86rem; color: var(--ink-3); }
.find .act { font-size: .8rem; display: flex; align-items: flex-start; gap: 6px; }
.find .act::before { content: "←"; color: var(--green-deep); flex: none; }
.find .right { display: flex; flex-direction: column; gap: 3px; align-items: flex-end; text-align: end; }
.find .risk { font-family: var(--font-num); font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.find.high .risk { color: var(--high); }
.find.medium .risk { color: var(--med); }
.find.good .risk { color: var(--green-deep); }
.find .rlbl { font-size: .68rem; color: var(--ink-4); }
.find .fbtns { grid-column: 1 / -1; display: flex; gap: 7px; flex-wrap: wrap; padding-top: 4px; }
@media (max-width: 560px) {
  .find { grid-template-columns: 34px minmax(0,1fr); }
  .find .ic { width: 34px; height: 34px; font-size: 1rem; }
  .find .right { grid-column: 1 / -1; flex-direction: row; align-items: baseline; gap: 8px; justify-content: flex-start; }
}

/* ---------- טפסים ---------- */
label.f { display: flex; flex-direction: column; gap: 5px; font-size: .84rem; color: var(--ink-3); }
input, select, textarea {
  font-family: var(--font); font-size: 1rem; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line-2);
  border-radius: var(--r-sm); padding: 11px 12px; width: 100%;
  transition: border-color var(--t) var(--ease);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft);
}
input[type="checkbox"] { width: auto; accent-color: var(--green); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 11px; }

/* ---------- אזור סריקה ---------- */
.scanbox {
  border: 2px dashed var(--line-2); border-radius: var(--r-lg);
  padding: 18px; display: flex; flex-direction: column; gap: 11px;
  background: var(--paper); text-align: center;
  transition: border-color var(--t) var(--ease), background var(--t);
}
.scanbox.drag { border-color: var(--green); background: var(--green-soft); }

/* ---------- טעינה ---------- */
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 22px; color: var(--ink-3); font-size: .9rem; }
.spin {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  border: 2px solid var(--line-2); border-top-color: var(--green);
  animation: sp .8s linear infinite;
}
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------- הודעה צפה ---------- */
.toast {
  position: fixed; inset-inline: 16px; bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  z-index: 60; margin: 0 auto; max-width: 440px;
  background: var(--ink); color: #fff; padding: 12px 16px;
  border-radius: var(--r); box-shadow: var(--shadow-ink);
  font-size: .9rem; text-align: center;
  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.warn { background: var(--med); }
.toast.err { background: var(--high); }

/* ---------- חלונית ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 70; background: rgba(10,15,12,.48);
  display: grid; place-items: center; padding: 16px;
  animation: fade var(--t) var(--ease);
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--paper); border-radius: var(--r-lg); width: 100%; max-width: 480px;
  max-height: 86vh; display: flex; flex-direction: column; box-shadow: var(--shadow-2);
}
.modal-h { padding: 16px 18px 10px; font-size: 1.05rem; font-weight: 600; }
.modal-b { padding: 0 18px; overflow: auto; }
.modal-f { display: flex; gap: 9px; justify-content: flex-end; padding: 14px 18px 16px; flex-wrap: wrap; }

/* ---------- טבלה ---------- */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: 9px 10px; text-align: start; border-bottom: 1px solid var(--line); }
th { font-weight: 500; color: var(--ink-4); font-size: .76rem; }
td.num, th.num { font-variant-numeric: tabular-nums; text-align: end; }

/* ---------- מנוי: מכסה, הודעה ומסלולים ---------- */
/* המכסה מוצגת כפס ולא כמספר יחיד, כי "נותרו 12" נקרא מהר יותר
   מ-"138 מתוך 150". הצבע עולה לכתום ב-70% ולאדום ב-90%. */
.meter {
  height: 7px; border-radius: var(--r-pill); background: var(--paper-2);
  border: 1px solid var(--line); overflow: hidden; position: relative;
}
.meter::before {
  content: ""; position: absolute; inset-block: 0; inset-inline-start: 0;
  width: var(--fill, 0%); background: var(--green);
  transition: width var(--t-slow) var(--ease);
}
.meter.med::before  { background: var(--med); }
.meter.high::before { background: var(--high); }

.note {
  background: var(--green-soft); border: 1px solid var(--green-mid);
  border-radius: var(--r-sm); padding: 10px 12px; font-size: .86rem;
  color: var(--ink-2); margin: 11px 0 0;
}

.tiers { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.tier {
  display: flex; align-items: center; gap: 11px; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 11px 12px;
  transition: border-color var(--t) var(--ease);
}
.tier:hover { border-color: var(--line-2); }
.tier.on { border-color: var(--green); background: var(--green-soft); }
.tier .mid { flex: 1; min-width: 150px; }
.tier .t { font-size: .94rem; font-weight: 500; display: flex; align-items: center; gap: 7px; }
.tier .m { font-size: .78rem; color: var(--ink-4); }
.tier .price {
  font-family: var(--font-num); font-size: 1.1rem; font-weight: 700;
  color: var(--ink); white-space: nowrap;
}
.tier .price small { font-size: .62em; font-weight: 500; color: var(--ink-4); }

/* המחיר מוצג לפני מע״מ, כנהוג בין עסקים — ולכן התוספת חייבת לשבת
   צמוד למספר ולא בהערת שוליים. ההפרש בדף התשלום אסור שיהיה הפתעה. */
.tier .price .vat {
  display: block; font-family: var(--font); font-size: .68rem;
  font-weight: 500; color: var(--ink-4); white-space: nowrap;
}
