/* ===========================================================
   mobile.css – התאמות למובייל (360px–430px), נטען אחרי styles.css
   =========================================================== */

/* ---------- 1. בלי גלילה רוחבית של הדף ----------
   html: hidden עובר ל-viewport; body: clip לא יוצר scroll-container,
   כך שה-sticky של הסרגל העליון ושל כותרות היומן ממשיך לעבוד. */
html{overflow-x:hidden;-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{overflow-x:clip;max-width:100%}
img,video,canvas,svg{max-width:100%}
#app,main,.card,.lrow,.sheet{min-width:0}
.card,.lrow,.appt,.newbox,.sheet{overflow-wrap:break-word}

/* פסים שנועדו לגלול לרוחב – גלילה חלקה בלי "למשוך" את הדף */
.bnav,.filters,.odays,.stabs,.cftabs,.bdays,.cdays,.aedur,.pk-sel,.wkwrap,.wk{
  -webkit-overflow-scrolling:touch;overscroll-behavior-x:contain}

/* ---------- 2. גלילה רכה ל-sheets / מודאלים ---------- */
.sheet{max-height:88vh;max-height:88dvh;overscroll-behavior:contain;width:100%}

@media (max-width:520px){
  /* ---------- אזורי לחיצה ≥44px ---------- */
  .btn{min-height:44px}
  .btn.sm{min-height:40px}
  .iconbtn{width:44px;height:44px}
  .fchip,.tplc,.pk,.oday,.bnav button,.cftabs button,.seg button{min-height:44px}
  .fchip,.tplc,.bnav button{display:inline-flex;align-items:center}
  .linkbtn,.back,.pk-x{min-height:44px}
  .secchip{min-height:40px;margin:-10px 0}
  .xs{min-height:40px;padding:6px 10px}
  .qcb,.play{width:44px;height:44px}
  .pay{min-height:40px;padding:8px 12px}
  .cpout,.cpsw{min-height:40px;padding-inline:12px}
  .cpwho select,select[data-cpwho]{min-height:40px}

  /* שדות: 16px מונע זום אוטומטי ב-iOS */
  input:not([type=checkbox]):not([type=radio]),select,textarea{font-size:16px}
  .fld input,.fld select,.search{min-height:46px}

  /* רווחים */
  main{padding:4px 14px 18px}
  .card{padding:14px 13px}
  .acts{gap:8px;flex-wrap:wrap}
  .sheet{padding:8px 16px calc(20px + env(safe-area-inset-bottom))}
  .sheet .acts>.btn{min-height:48px}

  /* כרטיס פנייה: שורת כפתורי פעולה עם 3 אייקונים + 2 כפתורי טקסט →
     שורה עליונה לטקסט (אשר / קבע), שורה שנייה לאייקונים */
  .acts:has(> [style*="flex:0 0"])>*:not([style*="flex:0 0"]){order:-1;flex:1 1 calc(50% - 4px);white-space:nowrap}
  .acts:has(> [style*="flex:0 0"])>[style*="flex:0 0"]{flex:1 1 0!important}

  /* ---------- 3. ניווט תחתון: שורה אחת, בלי שבירה ---------- */
  nav.bn a{min-height:56px;padding:8px 0 7px;white-space:nowrap;font-size:clamp(10px,2.9vw,11.5px);overflow:hidden;text-overflow:ellipsis;min-width:0}
  nav.bn .ic{padding:4px 8px}
  nav.bn .badge{right:calc(50% - 22px)}
  .cpnav a{font-size:clamp(10px,2.8vw,11px)}

  /* ---------- 4. כרטיסי סיכום ---------- */
  .stats{gap:6px}
  .stat{padding:11px 10px;min-width:0}
  .stat b{font-size:clamp(17px,5.4vw,22px);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .wsum{grid-template-columns:repeat(2,1fr)}
  .daysum{flex-wrap:wrap}
  .daysum .box{flex:1 1 calc(50% - 4px);min-width:0}
  .kpis,.paylinks{grid-template-columns:1fr 1fr}
  .kv{gap:10px}.kv b,.kv>:last-child{text-align:left}
  .rcpt .rh{flex-wrap:wrap}
  .hrow{flex-wrap:wrap}
  .hsw{width:auto}
  .frow .lbl{width:96px}
  .toast{bottom:calc(76px + env(safe-area-inset-bottom))}
}

/* ---------- 5. יומן העצמאי – תצוגה שבועית רוחבית ----------
   במסך צר 7 ימים לא נכנסים: הטבלה גוללת לרוחב (ולגובה בתוך עצמה),
   כותרת התאריכים ועמודת השעות נשארות דבוקות. */
@media (max-width:699px){
  body.wide #app{max-width:520px}
  .wk{overflow:auto;max-height:calc(100vh - 170px);max-height:calc(100dvh - 170px);
      overscroll-behavior:contain;scroll-snap-type:x proximity;scroll-padding-inline-start:44px;border:1px solid var(--line)}
  .wk-h,.wk-b{min-width:calc(44px + var(--n) * 88px);grid-template-columns:44px repeat(var(--n),minmax(88px,1fr))}
  .wk-h{top:0;z-index:8}
  .wk-h>div:first-child,.wk-t{position:sticky;right:0;z-index:7;background:#fff;border-left:1px solid var(--line)}
  .wk-h .dh{scroll-snap-align:start}
  .wk-t span{font-size:11px}
  .wa{font-size:12px;padding:3px 6px 3px 14px}
  .wa b{white-space:normal;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
  .wf:hover{background:transparent;color:transparent}
  .wf:active{background:var(--pri2);color:var(--pri)}
  .legend{gap:8px 12px}
}

/* ---------- 6. מסכים צרים במיוחד (≤360px) ---------- */
@media (max-width:360px){
  body{font-size:14.5px}
  .hero h1{font-size:20px}
  .stat span{font-size:11.5px}
  .brand b{font-size:15px}
  .top{gap:8px;padding-inline:12px}
  main{padding-inline:12px}
  .imp2,.paylinks{grid-template-columns:1fr}
}

/* ---------- 7. מוכנות לאפליקציה (Capacitor / PWA) ----------
   • Safe Areas גם בצדדים (אייפון לרוחב / Dynamic Island) – בנוסף ל-top/bottom הקיימים
   • מגע: בלי השהיית double-tap, בלי הבהוב כחול, אזורי לחיצה ≥44px גם בכפתורים הקטנים של מסכי הטכנאי/לקוח
   • .native (נקבע ע״י js/platform/platform.js): תחושת אפליקציה – בלי "קפיצת" גלילה ובלי תפריט העתקה על כפתורים */
#app,.ffh,nav.bn,.sheet,.toast{padding-left:max(var(--pad-l,0px),env(safe-area-inset-left));padding-right:max(var(--pad-r,0px),env(safe-area-inset-right))}
.ffh{padding-left:max(14px,env(safe-area-inset-left));padding-right:max(14px,env(safe-area-inset-right))}
.sheet{padding-left:max(18px,env(safe-area-inset-left));padding-right:max(18px,env(safe-area-inset-right))}
.toast{padding-left:14px;padding-right:14px}
#app{--pad-l:0px;--pad-r:0px}
button,a,[data-act],input,select,label{touch-action:manipulation;-webkit-tap-highlight-color:transparent}
@media (max-width:520px){
  .ff .xs,.ff .btn.xs,.ff .btn.sm,.lcrow .btn,.chlinks a,.chlinks button,.chcal,.lcpill,.chstrip button,.chwit,button.chwdh{min-height:44px}
  .chlinks a,.chlinks button{display:inline-flex;align-items:center}
  .ffburger{min-width:44px;min-height:44px}
  .ff .linkbtn{padding-block:12px}
  .pmtog{min-height:44px;align-items:center}
}
html.native body{overscroll-behavior-y:none}
html.native button,html.native .btn,html.native nav a{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}
