/* 1.5: רשימה, ראש מגירה וגיליון עצירה בסגנון ספוק. כחול ותכלת וירוק/אדום לתגיות */
:root {
  --blue: #3b6fe8; --blue-bg: #eef2fb; --blue-line: #c4d3f5; --gray2: #6b7280;
  --ok-bg: #dcf3e1; --ok-fg: #15803d; --bad-bg: #fde4e4; --bad-fg: #c62828; --panel: #f3f5f9; --sep: #e5e8ee;
}
:root[data-theme="dark"] {
  --blue: #7aa2ff; --blue-bg: #17213d; --blue-line: #2d4170; --gray2: #9aa5bd;
  --ok-bg: #12351f; --ok-fg: #4ade80; --bad-bg: #3b1616; --bad-fg: #f87171; --panel: #1a2540; --sep: #25304d;
}
.ico { display: inline-flex; flex: none; }
.ico svg { display: block; }
#drawer[hidden], #ssheet[hidden], #searchbar[hidden], #jump[hidden] { display: none; }

/* ראש המגירה */
#dhead { background: var(--card); border-bottom: 1px solid var(--sep); }
.hrow { display: flex; align-items: center; gap: 4px; padding: 0 8px 6px 4px; }
.hsum { flex: 1; min-width: 0; font-size: .92rem; font-weight: 600; padding: 0 8px; line-height: 1.3; }
.ib { width: 48px; height: 48px; border: 0; background: none; color: var(--gray2); display: flex; align-items: center; justify-content: center; border-radius: 50%; cursor: pointer; }
#searchbar { display: flex; gap: 8px; padding: 0 10px 8px; }
#searchbar input { flex: 1; min-width: 0; min-height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); }
dialog#dmenu { position: fixed; inset: 0; margin: auto; width: min(340px, calc(100vw - 32px)); max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; color: inherit; background: var(--card); border: 0; border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,.45); padding: 6px; }
dialog#dmenu[open] { display: flex; flex-direction: column; }
dialog#dmenu::backdrop { background: rgba(0,0,0,.5); }
#dmenu button { min-height: 48px; text-align: right; background: none; border: 0; font-weight: 600; font-size: 1rem; padding: 0 14px; border-radius: 10px; cursor: pointer; }
#dmenu button:active { background: var(--blue-bg); }

/* הרשימה */
#dbody { background: var(--card); padding: 0 0 80px; }
#dbody main { max-width: none; }
.sw { margin: 0; border-radius: 0; background: var(--blue); }
.sw[data-dir="fail"] .sw-bg { background: #d64545; }
.sw[data-dir="done"] .sw-bg { background: var(--ok-fg); }
.srow { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px 10px 10px; background: var(--card); border-bottom: 1px solid var(--sep); cursor: pointer; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.srow.isnext { background: var(--blue-bg); }
.srow.hl { outline: 3px solid var(--tag); outline-offset: -3px; }
.scol { flex: none; width: 46px; display: flex; flex-direction: column; align-items: center; font-size: 1.05rem; color: var(--text); align-self: stretch; position: relative; }
.scol::after { content: ''; position: absolute; top: 3.2em; bottom: -12px; width: 2px; background: var(--blue-line); }
.sn { font-size: 1.12rem; font-weight: 500; }
.stm { font-size: 1rem; color: var(--gray2); min-height: 1.2em; }
.srow.isnext .sn, .srow.isnext .stm { color: var(--blue); }
.scol .stm:empty { display: none; }
.scol:has(.stm:empty)::after { top: 2em; }
.smain { flex: 1; min-width: 0; }
.stop1 { display: flex; align-items: flex-start; gap: 8px; }
.sadr { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sadr b { font-size: 1.3rem; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.sadr span { font-size: 1.05rem; color: var(--gray2); }
.idchip { flex: none; display: inline-flex; align-items: center; gap: 4px; background: var(--blue-bg); color: var(--blue); border-radius: 12px; padding: 6px 10px; font-weight: 600; font-size: .95rem; direction: ltr; }
.srow.isnext .idchip { background: #dfe7fa; }
:root[data-theme="dark"] .srow.isnext .idchip { background: #223055; }
.st-v, .st-x { display: inline-flex; width: 20px; height: 20px; border-radius: 50%; align-items: center; justify-content: center; }
.st-v { background: var(--ok-bg); color: var(--ok-fg); }
.st-x { background: var(--bad-bg); color: var(--bad-fg); }
.snote { display: flex; gap: 8px; align-items: flex-start; margin-top: 6px; color: var(--gray2); font-size: 1rem; line-height: 1.35; overflow-wrap: anywhere; }
.snote .ico { margin-top: 1px; }
.snote.bad { color: var(--bad-fg); font-weight: 600; }
a.tel { color: var(--text); text-decoration: underline; direction: ltr; unicode-bidi: isolate; }
.srow.done > * { opacity: .5; }
.srow.asg { background: rgba(128,128,128,.14); }
.srow.asg > * { opacity: .6; }
.srow.failed > * { opacity: .75; }
.nopin-t { color: var(--warn); font-size: .9rem; font-weight: 600; align-self: center; }
.tag { min-width: 40px; min-height: 40px; align-self: center; }
.allgone { text-align: center; padding: 14px; font-weight: 700; color: var(--ok-fg); }
.pending { display: block; padding: 8px 14px; }
.jump { position: absolute; left: 14px; bottom: 18px; width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--card); color: var(--blue); box-shadow: 0 3px 12px rgba(0,0,0,.3); display: flex; align-items: center; justify-content: center; z-index: 5; cursor: pointer; }

/* גיליון עצירה */
#ssheet { position: absolute; right: 0; left: 0; bottom: 0; z-index: 710; height: 62%; background: var(--card); border-radius: 22px 22px 0 0; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; touch-action: pan-y; }
.sgrip { height: 22px; flex: none; display: flex; align-items: center; justify-content: center; }
.sgrip span { width: 48px; height: 5px; border-radius: 3px; background: var(--line); }
.sbody { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); }
.shead { display: flex; align-items: flex-start; gap: 10px; }
.stitle { flex: 1; min-width: 0; margin: 0; font-size: 1.9rem; line-height: 1.2; font-weight: 800; overflow-wrap: anywhere; }
.sclose { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--panel); color: var(--text); display: flex; align-items: center; justify-content: center; margin-top: 4px; cursor: pointer; }
.ssub { display: flex; align-items: center; gap: 8px; color: var(--gray2); font-size: 1.15rem; margin: 6px 0 12px; }
.ssub .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--blue); }
.chip { margin-left: 4px; padding: 6px 14px; border-radius: 10px; font-weight: 600; font-size: 1.05rem; }
.chip.done { background: var(--ok-bg); color: var(--ok-fg); }
.chip.failed { background: var(--bad-bg); color: var(--bad-fg); }
.scode { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--code-bg); color: var(--code-text); border-radius: 14px; padding: 8px 14px; margin-bottom: 12px; font-weight: 700; }
.scode bdi { direction: ltr; unicode-bidi: isolate; font-size: 2rem; font-weight: 800; letter-spacing: 2px; }
.sbtns { display: flex; gap: 8px; margin-bottom: 8px; }
.sbtn { flex: 1 1 0; min-width: 0; min-height: 72px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--card); color: var(--text); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-weight: 600; font-size: 1rem; cursor: pointer; }
.sbtn.nav { background: var(--blue); border-color: var(--blue); color: #fff; }
.sbtn:disabled { opacity: .4; }
.sbtn[data-k="v"] .ico { color: var(--ok-fg); }
.sbtn[data-k="x"] .ico { color: var(--bad-fg); }
.sbtn[data-k="w"] .ico { color: #25d366; }
.markbox { background: var(--panel); border-radius: 16px; padding: 14px 16px; margin: 4px 0 8px; display: flex; flex-direction: column; gap: 4px; }
.markbox b { font-size: 1.5rem; margin-top: 10px; }
.mk-top { display: flex; align-items: center; justify-content: space-between; }
.mk-circ { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.mk-circ.ok { background: var(--ok-bg); color: var(--ok-fg); }
.mk-circ.bad { background: var(--bad-bg); color: var(--bad-fg); }
.undo { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--blue); font-weight: 700; font-size: 1.25rem; min-height: 48px; cursor: pointer; }
.mk-t, .mk-why { color: var(--gray2); font-size: 1.15rem; }
.lrow { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 10px 0; cursor: pointer; color: var(--gray2); }
.lrow .lt { flex: 1; min-width: 0; color: var(--text); font-size: 1.15rem; overflow-wrap: anywhere; }
.lrow .lt .orig { color: var(--gray2); margin-right: 12px; }
.lrow > .ico:last-child { color: var(--gray2); }
.lrows .lrow:not(:last-child) { border-bottom: 1px solid var(--sep); }
.lacts { background: var(--panel); margin: 10px -16px 0; padding: 6px 16px; }
.lacts .lrow.act .lt { font-size: 1.1rem; }
.lacts .lrow.danger, .lacts .lrow.danger .lt { color: var(--bad-fg); }
#ssheet .warn, #ssheet .hint, #ssheet .was { margin: 0 0 10px; }

/* 1.5 שלב 4: פאנל מסלולים מהצד הימני */
#rdim { position: absolute; inset: 0; z-index: 890; background: rgba(15,23,42,.5); }
#rpanel { position: absolute; top: 0; bottom: 0; right: 0; width: 90%; max-width: 440px; z-index: 900; background: var(--card); box-shadow: -6px 0 24px rgba(0,0,0,.3); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); animation: rpin .2s ease; }
@keyframes rpin { from { transform: translateX(100%); } }
#rdim[hidden], #rpanel[hidden] { display: none; }
#rp-list { flex: 1; overflow-y: auto; padding: 14px 0 6px; }
.rp-gh { color: #6b7280; font-size: 1.05rem; font-weight: 600; padding: 18px 20px 8px; }
.rp-gh:first-child { padding-top: 6px; }
.rp-g + .rp-g { border-top: 1px solid var(--line); margin-top: 8px; }
.rp-row { position: relative; display: flex; align-items: center; margin: 0 10px; border-radius: 14px; }
.rp-row.cur { background: #eef2fb; }
.rp-main { flex: 1; min-width: 0; min-height: 56px; display: flex; flex-direction: column; justify-content: center; text-align: right; background: none; border: 0; padding: 6px 10px; cursor: pointer; color: var(--text); font-size: 1.2rem; }
.rp-line { display: flex; gap: 8px; align-items: baseline; }
.rp-line .d { color: #8a93a6; flex: 0 0 auto; }
.rp-line .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.rp-main small { color: #8a93a6; font-size: .9rem; }
.rp-row.cur .rp-main, .rp-row.cur .rp-line .d { color: #3b6fe8; }
.rp-more { flex: 0 0 auto; width: 44px; height: 48px; border: 0; background: none; color: #6b7280; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.rp-menu { position: absolute; left: 8px; top: 46px; z-index: 5; min-width: 170px; background: var(--card); border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.3); padding: 6px; display: flex; flex-direction: column; }
.rp-menu button { min-height: 46px; text-align: right; background: none; border: 0; font-size: 1rem; font-weight: 600; padding: 0 12px; border-radius: 8px; cursor: pointer; color: var(--text); }
.rp-menu button.armed { background: var(--danger); color: #fff; }
.rp-menu button.del { color: var(--danger); }
.rp-menu button.armed.del { color: #fff; }
.rp-edit { flex: 1; min-width: 0; margin: 6px 10px; min-height: 48px; font-size: 1.1rem; border: 2px solid var(--accent); border-radius: 10px; padding: 0 10px; background: var(--card); color: var(--text); }
.rp-empty { padding: 20px; color: var(--muted); }
.rp-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.rp-new { min-height: 58px; border: 0; border-radius: 16px; background: #3b6fe8; color: #fff; font-size: 1.25rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; }
.rp-new span { font-size: 1.6rem; line-height: 1; font-weight: 400; }
.rp-set { align-self: center; background: none; border: 0; color: #6b7280; font-size: .95rem; min-height: 40px; padding: 0 16px; cursor: pointer; }

/* "יצירת מסלול": רשימת קבצי הדרייב, שורה עדינה לכל מסלול (18.11) */
#rt-drive { display: flex; flex-direction: column; margin: 4px 0 12px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; max-height: 60vh; overflow-y: auto; }
.rt-file { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 13px 14px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--text); font: inherit; font-size: 1rem; text-align: right; cursor: pointer; }
.rt-file:last-child { border-bottom: 0; }
.rt-file:active { background: rgba(47,102,230,.08); }
.rt-chev { color: var(--muted, #8a93a3); font-size: 1.2rem; }
#rt-drive .muted { padding: 12px 14px; margin: 0; }

/* גיליון עצירה (18.11): בטלפון האזור הנגלל בתוך הגיליון השאיר לדפדפן את התנועה האופקית, הדפדפן "לקח" אותה
   וההחלקה לעצירה הבאה/הקודמת לא עבדה. pan-y על כל מה שבתוך הגיליון - גלילה למעלה-למטה נשארת לדפדפן, ימינה-שמאלה לאפליקציה */
#ssheet, #ssheet * { touch-action: pan-y; }
#ssheet { overscroll-behavior-x: none; }

/* 1.7: כללי סדר קבועים */
#set-orules { width: 100%; margin: 0 0 8px; }
#ord-q { margin: 4px 0 8px; }
#ord-list, #orl-list { max-height: 52vh; overflow-y: auto; margin-bottom: 10px; display: flex; flex-direction: column; gap: 2px; }
.ord-item { width: 100%; justify-content: flex-start; text-align: right; gap: 10px; min-height: 52px; height: auto; padding: 6px 12px; }
.ord-item b { flex: 0 0 auto; min-width: 2.2em; color: var(--muted); }
.ord-item span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ord-item.dim { opacity: .55; }
.lrow.orule { cursor: default; border-bottom: 1px solid var(--sep); }
.lrow.orule .lt b { font-weight: 700; }
.orm { flex: 0 0 auto; width: 48px; height: 48px; border: 0; background: none; color: var(--gray2); display: flex; align-items: center; justify-content: center; cursor: pointer; }

/* וואטסאפ ליד כל טלפון ברשימה ובגיליון (18.11) */
.wa-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; margin: -4px 4px 0; vertical-align: middle; border-radius: 50%; background: #25d366; color: #fff; }
.wa-btn .ico { margin: 0; }
.wa-btn:active { transform: scale(.92); }

/* 2.5: מצב בחירה של כמה עצירות */
.multibar { position: sticky; top: 0; z-index: 3; display: flex; gap: 8px; align-items: center; padding: 10px 12px; background: var(--blue-bg); border-bottom: 1px solid var(--sep); font-weight: 700; }
.multibar span { flex: 1; }
.mchk { flex: none; width: 26px; height: 26px; margin-top: 4px; border: 2px solid var(--blue); border-radius: 7px; display: flex; align-items: center; justify-content: center; color: #fff; }
.srow.picked { background: var(--blue-bg); }
.srow.picked .mchk { background: var(--blue); }

/* 2.8: הפס העליון של כרטיס המשפחה - משיכה למטה סוגרת */
#ssheet .sgrip, #ssheet .sgrip * { touch-action: none; cursor: grab; }
#ssheet .sgrip { height: 34px; }
/* 22.11: כרטיס גבוה - משיכת הפס למעלה */
#ssheet.tall { height: calc(100% - 60px - env(safe-area-inset-top)); }

/* ---------- תמונות משפחה בכרטיס ---------- */
.pblock { margin: 4px 0 10px; }
.pgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.pgrid.hid { padding-top: 8px; border-top: 1px dashed var(--line); }
.pth { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); }
.pth.off img { opacity: .55; }
.pth-b { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.pth img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .15s; }
.pth.ready img { opacity: 1; }
.pth.ready.off img { opacity: .55; }
.pth-lbl, .pth-wait { position: absolute; inset-inline: 0; bottom: 0; background: rgba(0, 0, 0, .65); color: #fff; font-size: .75rem; text-align: center; padding: 2px 4px; pointer-events: none; }
.pth-wait { top: 0; bottom: auto; background: rgba(180, 83, 9, .85); }
.pth-plus { position: absolute; top: 4px; inset-inline-end: 4px; width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--ok); color: #fff; font-size: 1.8rem; font-weight: 700; line-height: 1; cursor: pointer; }
.pbar { display: flex; gap: 8px; align-items: stretch; }
.pcam { flex: 1; min-height: 56px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); color: var(--text); display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; font-size: 1rem; cursor: pointer; }
.pchip { min-width: 72px; min-height: 56px; padding: 0 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--panel); color: var(--text); font-weight: 800; font-size: 1.1rem; cursor: pointer; }
.pchip.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
dialog.pviewer { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; padding: 0; border: 0; border-radius: 0; background: #000; color: #fff; }
dialog.pviewer[open] { display: flex; flex-direction: column; }
.pv-top { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top)); }
.pv-tr { display: flex; align-items: center; gap: 8px; }
.pv-more { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: #9ca3af; font-size: 1.3rem; line-height: 1; cursor: pointer; }
.pv-menu { position: absolute; top: calc(56px + env(safe-area-inset-top)); left: 12px; z-index: 5; background: #1f2937; border: 1px solid #4b5563; border-radius: 10px; padding: 4px; box-shadow: 0 6px 20px rgba(0,0,0,.5); }
.pv-menu button { min-height: 44px; padding: 0 16px; border: 0; background: none; color: #fca5a5; font-size: 1rem; font-weight: 600; cursor: pointer; border-radius: 8px; }
.pv-x { width: 52px; height: 52px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .15); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.pv-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; touch-action: pan-y; }
.pv-img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; }
.pv-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 56px; height: 72px; border: 0; border-radius: 14px; background: rgba(0, 0, 0, .45); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.pv-nav.next { left: 6px; }
.pv-nav.prev { right: 6px; }
.pv-nav.prev .ico { transform: scaleX(-1); }
.pv-cap { text-align: center; padding: 8px; min-height: 2.2em; color: #d1d5db; }
.pv-acts, .pv-confirm { display: flex; flex-direction: column; gap: 8px; padding: 8px 16px calc(14px + env(safe-area-inset-bottom)); }
.pv-confirm p { margin: 0 0 4px; font-size: 1.05rem; text-align: center; }
.pv-btn { min-height: 56px; border-radius: 14px; border: 1.5px solid #4b5563; background: #1f2937; color: #fff; font-weight: 700; font-size: 1.1rem; cursor: pointer; }
.pv-btn.danger { background: #b91c1c; border-color: #b91c1c; }
.pv-btn.ok { background: #15803d; border-color: #15803d; }

#btn-veh { min-height: 36px; padding: 0 12px; border-radius: 18px; border: 1.5px solid var(--line); background: var(--card); color: inherit; font-weight: 700; font-size: .95rem; cursor: pointer; white-space: nowrap; }
#btn-veh[hidden] { display: none; }
