/* קבלני שטח — מותג הבית הירוק המאוחד (23.09.2026):
 *   ליים #9DBC18 + יער #3E8533 (צבעי הלוגו) · אורן עמוק #0F2A18 לכותרת ·
 *   זהב #F4B227 **רק להישג** (מסך "הדוח נשלח") · משטחי קרם/לבן.
 *
 * ⚠️ החלטת עיצוב מכוונת: **בלי backdrop-filter / blur בשום מקום**, בניגוד
 * לדשבורד. המסך הזה נקרא בשמש ישירה על גג, בידיים עם כפפות, בטלפון
 * שהסוללה שלו כבר חצי. זכוכית מטושטשת מורידה ניגודיות בדיוק בתנאים האלה
 * ושורפת GPU. הפרימיום כאן בא מהמותג, מהטיפוגרפיה ומהמרווחים — לא מטשטוש.
 *
 * ניגודיות: טקסט ירוק קטן על בהיר = #34752B (5.6:1 על לבן) ומטה. ליים ויער
 * משמשים רק למשטחים/פסים/אייקונים גדולים, לא לטקסט קטן. גבולות שדות ≥3:1.
 * תנועה: רק transform/opacity (בלי ריצוד layout), וכולה כבויה ב-reduced-motion.
 */
:root {
  /* מותג */
  --lime:        #9DBC18;     /* צבע לוגו — פסים ואקסנטים, לא טקסט */
  --forest:      #3E8533;     /* צבע לוגו — משטחים גדולים */
  --forest-text: #34752B;     /* ירוק לטקסט/כפתורים על בהיר — 5.6:1 */
  --pine:        #0F2A18;     /* כותרת, לחיצה, טקסט מודגש */
  --pine-2:      #173D22;
  --gold:        #F4B227;     /* 🔴 הישג בלבד — מסך "נשלח" */
  --gold-tint:   #FFF6DF;
  --lime-tint:   #F1F6E4;
  --lime-line:   #D6E5B4;

  /* משטחים וטקסט */
  --ink:         #14231A;
  --muted:       #53625A;     /* 5.6:1 על לבן, 5.1:1 על קרם */
  --line:        #DDE3D6;     /* גבול כרטיס — עדין */
  --field:       #7F9083;     /* גבול שדה/כפתור משני — 3.4:1, נראה בשמש */
  --bg:          #F6F4EA;     /* קרם */
  --card:        #FFFFFF;
  --bad:         #B3261E;
  --bad-tint:    #FDECEA;
  --ok:          #2E6B25;

  --radius:      16px;
  --tap:         52px;        /* יעד מגע — גדול מ-44 בגלל כפפות */
  --shadow:      0 1px 2px rgba(15,42,24,.06), 0 6px 20px rgba(15,42,24,.07);
  --press:       .97;
  --ease-out:    cubic-bezier(.2, .8, .2, 1);
  --ease-pop:    cubic-bezier(.3, 1.5, .5, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Rubik', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  font-size: 17px;
  line-height: 1.7;              /* עברית צפופה יותר מלטינית — 1.5 לוחץ אותה */
  color: var(--ink);
  background: var(--bg);
  padding-bottom: env(safe-area-inset-bottom);
}

/* ── כותרת ─────────────────────────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--pine) 0%, var(--pine-2) 100%);
  border-bottom: 4px solid var(--lime);
}
.brand { font-weight: 700; font-size: 20px; display: flex; align-items: center; gap: 10px; }
/* הלוגו הרשמי על אריח לבן — אותו טיפול כמו בפורטל הלקוחות (23.09.2026). */
.logo {
  width: 44px; height: 40px; flex: none; padding: 2px;
  background: #fff; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px rgba(157,188,24,.45), 0 3px 10px rgba(0,0,0,.25);
}
.logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sub {
  font-size: 16px; font-weight: 500; line-height: 1.4; white-space: nowrap;
  color: #E9F3CC; padding: 4px 12px;
  border: 1.5px solid rgba(157,188,24,.7); border-radius: 999px;
}

main { max-width: 640px; margin: 0 auto; padding: 16px; }
.view { display: flex; flex-direction: column; gap: 14px; }
.view[hidden] { display: none; }
.view:not([hidden]) { animation: view-in .22s var(--ease-out) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }

/* ── כרטיסים ───────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card.center { text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
/* כרטיס "מתי" — הדבר הראשון שקבלן מחפש. גוון ליים עדין ופס יער בצד ההתחלה. */
.card.hero {
  background: linear-gradient(180deg, var(--lime-tint), #fff 80%);
  border-color: var(--lime-line);
  border-inline-start: 6px solid var(--forest);
}

h1 { font-size: 24px; line-height: 1.35; margin: 0; color: var(--pine); text-wrap: balance; }
h2 { font-size: 19px; line-height: 1.4; margin: 0 0 10px; color: var(--forest-text); }
/* פס ליים לפני כותרת כרטיס — היררכיה בלי עוד צבע טקסט */
.card > h2::before {
  content: ''; display: inline-block; width: 5px; height: .95em;
  margin-inline-end: 10px; vertical-align: -2px;
  background: var(--lime); border-radius: 3px;
}
h3 { font-size: 16px; margin: 14px 0 6px; color: var(--muted); }
p { margin: 0; }
.lead { font-size: 18px; }
.muted { color: var(--muted); font-size: 16px; }
.big-icon { font-size: 44px; line-height: 1; }

.when { font-size: 26px; line-height: 1.35; font-weight: 700; color: var(--pine); }
.meta { margin-top: 8px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.chip {
  display: inline-block; padding: 4px 14px; border-radius: 999px;
  background: var(--forest-text); color: #fff; font-size: 16px; font-weight: 500;
}

.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.row > * { flex: 1 1 140px; }
.contact {
  margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line);
  display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
}

.equipment { margin: 12px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 0 16px; }
.equipment dt, .equipment dd { padding: 8px 0; border-bottom: 1px solid var(--line); }
.equipment dt:last-of-type, .equipment dd:last-of-type { border-bottom: 0; }
.equipment dt { color: var(--muted); }
.equipment dd { margin: 0; font-weight: 500; }
.notes {
  white-space: pre-wrap; background: var(--lime-tint); padding: 12px 14px;
  border-radius: 10px; border-inline-start: 4px solid var(--lime);
}

#roof-img { width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); }

/* ── כפתורים ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px;
  font: inherit; font-weight: 500; text-decoration: none; text-align: center;
  color: var(--forest-text); background: #fff;
  border: 2px solid var(--forest-text); border-radius: 12px;
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: transform .09s ease-out, background-color .12s, border-color .12s, color .12s;
}
/* משוב לחיצה: כפפה לא "מרגישה" מגע — הכפתור צריך להראות שנלחץ */
.btn:active:not(:disabled) { transform: scale(var(--press)); background: var(--lime-tint); }
.btn.primary { color: #fff; background: var(--forest-text); border-color: var(--forest-text); }
.btn.primary:active:not(:disabled) { background: var(--pine); border-color: var(--pine); }
.btn.ghost { border-color: var(--field); color: var(--muted); }
.btn.ghost:active:not(:disabled) { background: var(--bg); }
.btn.big { min-height: 60px; font-size: 18px; width: 100%; }
.btn.small { min-height: var(--tap); padding: 0 16px; font-size: 16px; }   /* 52px גם כאן — כפפות */
.btn:disabled { opacity: .45; cursor: not-allowed; }
/* טבעת מיקוד: אורן + הילת ליים — נראית גם על לבן וגם על ירוק */
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--pine); outline-offset: 2px;
  box-shadow: 0 0 0 7px rgba(157,188,24,.55);
}
.btn.file { position: relative; overflow: hidden; }
.btn.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.btn.file:focus-within { outline: 3px solid var(--pine); outline-offset: 2px; }

/* "נסו שוב" — פעולה אמיתית, לא משנית: מתאר ירוק + אייקון רענון */
.btn.retry::before { content: '↻'; font-size: 22px; line-height: 1; font-weight: 700; }

/* ── שדות ──────────────────────────────────────────────────────────────── */
input[type=text], select, textarea {
  width: 100%; min-height: var(--tap);
  font: inherit; font-size: 17px;          /* 16+ — אחרת iOS מגדיל את הדף במיקוד */
  color: var(--ink); background: #fff;
  border: 1.5px solid var(--field); border-radius: 12px; padding: 12px 14px;
  transition: border-color .12s;
}
input[type=text]:focus, textarea:focus { border-color: var(--forest-text); }
input::placeholder, textarea::placeholder { color: #6E7C73; opacity: 1; }
textarea { resize: vertical; }
#serials { font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; text-align: start; }

.photo-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.photo-list li {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 10px 12px; background: var(--bg); border-radius: 10px; font-size: 16px;
  border-inline-start: 4px solid var(--line);
  animation: row-in .2s var(--ease-out) both;
}
.photo-list li:has(.state.ok)  { border-inline-start-color: var(--forest); }
.photo-list li:has(.state.bad) { border-inline-start-color: var(--bad); background: var(--bad-tint); }
@keyframes row-in { from { opacity: 0; transform: translateY(-4px); } }
/* min-width:0 — בלעדיו ילד flex עם nowrap לא מתכווץ, והשורה חורגת מהמסך */
.photo-list li span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; unicode-bidi: isolate; }
.state { flex-shrink: 0; color: var(--muted); }
.state.ok { color: var(--ok); font-weight: 500; }
.state.bad { color: var(--bad); font-weight: 500; }
.count { margin-top: 8px; color: var(--forest-text); font-weight: 500; }

/* ── חתימה ─────────────────────────────────────────────────────────────── */
.sig-wrap { position: relative; margin-top: 12px; }
.sig-pad {                                   /* שני אזורי חתימה: קבלן + לקוח (23.09.2026) */
  display: block; width: 100%; height: 190px;
  background: #fff; border: 2px dashed var(--forest); border-radius: 12px;
  touch-action: none;                        /* בלי זה האצבע גוללת את הדף במקום לחתום */
}
.sig-clear { position: absolute; inset-block-start: 8px; inset-inline-end: 8px; background: #fff; }
.hint { margin: 4px 0 0; color: var(--forest-text); }
/* "הלקוח לא נוכח" — כל השורה היא יעד המגע, לא רק תיבת 22px */
.check {
  display: flex; align-items: center; gap: 12px; margin-top: 12px;
  min-height: var(--tap); padding: 10px 14px; cursor: pointer;
  background: #fff; border: 1.5px solid var(--field); border-radius: 12px;
  font-weight: 500; -webkit-tap-highlight-color: transparent;
  transition: transform .09s ease-out, background-color .12s, border-color .12s;
}
.check:active { transform: scale(var(--press)); }
.check:has(input:checked) { background: var(--lime-tint); border-color: var(--forest-text); }
.check input { width: 26px; height: 26px; margin: 0; flex: none; accent-color: var(--forest-text); }
#client-absent-box { margin-top: 12px; }
#client-absent-box input { width: 100%; }

.actions { display: flex; gap: 10px; }
.actions .btn { flex: 1; }
.error {
  color: var(--bad); background: var(--bad-tint); border: 1px solid #F5C2BD;
  border-inline-start: 5px solid var(--bad);
  padding: 12px 14px; border-radius: 12px; font-weight: 500;
}

dialog {
  width: min(92vw, 460px); border: none; border-radius: var(--radius);
  border-top: 5px solid var(--forest);
  padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.3); color: var(--ink);
}
dialog::backdrop { background: rgba(15,42,24,.6); }   /* כהה בלבד — בלי blur */
dialog h2 { margin-bottom: 8px; color: var(--pine); }
dialog p { margin-bottom: 10px; }

/* ── טעינה: שלד במקום ספינר ────────────────────────────────────────────────
 * השלד מחקה את מסך העבודה, כך שהמעבר לתוכן לא "קופץ". הברק נע בכיוון
 * הקריאה (ימין→שמאל) ובנוי על transform בלבד — בלי ציור מחדש בכל פריים. */
.loading-text { text-align: center; }
.sk-card { display: flex; flex-direction: column; gap: 12px; }
.sk-row { display: flex; gap: 10px; }
.sk {
  position: relative; overflow: hidden; display: block;
  height: 16px; border-radius: 8px; background: #E7EBDF;
}
.sk::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.75), transparent);
  transform: translateX(100%);
  animation: shimmer 1.3s ease-in-out infinite;
}
.hero .sk { background: #DDE7C6; }
.sk.tall { height: 28px; }
.sk.pill { width: 38%; height: 30px; border-radius: 999px; }
.sk.btn-sk { flex: 1; height: var(--tap); border-radius: 12px; }
.sk.w-30 { width: 30%; } .sk.w-40 { width: 40%; } .sk.w-60 { width: 60%; }
.sk.w-70 { width: 70%; } .sk.w-80 { width: 80%; } .sk.w-90 { width: 90%; }
@keyframes shimmer { to { transform: translateX(-100%); } }

/* ── שגיאה ─────────────────────────────────────────────────────────────── */
#view-error .card { border-top: 5px solid var(--bad); padding-top: 24px; }
.status-icon {
  width: 72px; height: 72px; margin: 0 auto 4px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; font-weight: 700; line-height: 1;
  color: var(--bad); background: var(--bad-tint); border: 3px solid var(--bad);
}

/* ── נשלח: ההישג היחיד באפליקציה — וכאן בלבד זהב ─────────────────────────
 * סדר: דיסקית יער קופצת → וי לבן נמשך → פרץ קרני זהב → הכותרת עולה.
 * האנימציה רצה מחדש בכל פעם שהמסך מוצג (display:none → flex מאתחל אותה).
 * מצב הבסיס = המצב הסופי; האנימציות מגדירות רק `from`. לכן reduced-motion
 * (animation:none) מציג מיד מסך שלם ותקין. */
.done-card {
  background: linear-gradient(180deg, var(--gold-tint), #fff 55%);
  border-color: #F1DDA8; border-top: 5px solid var(--gold);
  padding-top: 26px;
}
.success-mark { position: relative; width: 96px; height: 96px; margin: 26px auto 22px; }
.success-mark::before {                      /* הילת זהב שמתרחבת ונמוגה */
  content: ''; position: absolute; inset: -6px; border-radius: 50%;
  border: 3px solid var(--gold); opacity: 0;
  animation: halo .9s .3s var(--ease-out) both;
}
.check-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.check-disc { fill: var(--forest); transform-origin: 50% 50%; transform-box: fill-box;
  animation: pop .42s var(--ease-pop) both; }
.check-tick { fill: none; stroke: #fff; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 44; stroke-dashoffset: 0;
  animation: draw .38s .3s var(--ease-out) both; }
.burst { position: absolute; inset: 0; pointer-events: none; }
.burst i {
  position: absolute; left: 50%; top: 50%;
  width: 6px; height: 16px; margin: -8px 0 0 -3px; border-radius: 3px;
  background: var(--gold); opacity: 0;
  transform: rotate(var(--a)) translateY(-76px);
  animation: ray .7s .42s var(--ease-out) both;
}
.burst i:nth-child(even) { height: 10px; margin-top: -5px; background: var(--lime); }
.burst i:nth-child(1) { --a: 0deg; }   .burst i:nth-child(2) { --a: 45deg; }
.burst i:nth-child(3) { --a: 90deg; }  .burst i:nth-child(4) { --a: 135deg; }
.burst i:nth-child(5) { --a: 180deg; } .burst i:nth-child(6) { --a: 225deg; }
.burst i:nth-child(7) { --a: 270deg; } .burst i:nth-child(8) { --a: 315deg; }
.done-card h1, .done-card .lead { animation: rise .4s .5s var(--ease-out) both; }
.done-card .btn { animation: rise .4s .62s var(--ease-out) both; }

@keyframes pop  { from { transform: scale(0); } }
@keyframes draw { from { stroke-dashoffset: 44; } }
@keyframes halo { 0% { opacity: 0; transform: scale(.7); } 15% { opacity: .9; } 100% { opacity: 0; transform: scale(1.35); } }
@keyframes ray {
  0%   { opacity: 0; transform: rotate(var(--a)) translateY(-54px) scaleY(.3); }
  30%  { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--a)) translateY(-78px) scaleY(1); }
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ── תנועה מופחתת: הכול סטטי, המצב הסופי מוצג מיד ───────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .btn:active:not(:disabled), .check:active { transform: none; }
  /* ההישג עדיין מסומן — קרניים סטטיות במקום פרץ */
  .burst i { opacity: 1; transform: rotate(var(--a)) translateY(-64px); }
  .sk::after { display: none; }
}

/* ── איי LTR ─────────────────────────────────────────────────────────────
 * מספרים, יחידות, דגמים, טלפונים ותאריכים בתוך עברית. בלי זה אלגוריתם
 * הדו-כיווניות מפרק את "ממיר 15 kW AC" ל-"kW AC 15 ממיר" ואת "22.5 kWp"
 * ל-"kWp 22.5" — הספק הפוך על המסך של קבלן בשטח. נבנה ב-app.js::bidi. */
.ltr-island { direction: ltr; unicode-bidi: isolate; display: inline-block; }
