/* ===== מערכת עיצוב =====
   מובייל קודם: ניווט תחתון בטלפון, ניווט צד מ-900px. כהה/בהיר לפי המכשיר.
   צבעי הסטטוסים מגיעים מהשרת ומוזרקים דרך CSSOM (ראו js/core.js) — אין style inline, כדי שה-CSP יישאר הדוק. */

:root {
  --bg: #f3f2ec; --surface: #ffffff; --surface-2: #f1f0e8; --surface-3: #e8e6db;
  --ink: #1d2118; --ink-2: #3c4235; --muted: #6b705f; --line: #dedbcd; --line-2: #cfcbba;
  --accent: #4d6034; --accent-2: #5e7442; --accent-ink: #ffffff; --accent-soft: #e5ead9;
  --warn: #b26410; --warn-soft: #fbecd6; --bad: #b0402d; --bad-soft: #f8e1dc; --ok: #3b7a4b; --ok-soft: #dfeee2;
  --info: #365f8f; --info-soft: #e0e9f4;
  --none: #8d8d82;
  --shadow: 0 1px 2px rgb(30 35 20 / .06), 0 4px 16px rgb(30 35 20 / .06);
  --shadow-lg: 0 10px 40px rgb(20 25 10 / .22);
  --r: 14px; --r-sm: 10px; --r-xs: 7px;
  --tap: 44px;
  --font: system-ui, "Segoe UI", "Noto Sans Hebrew", "Heebo", "Arial Hebrew", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11130e; --surface: #1a1d16; --surface-2: #22261d; --surface-3: #2b3025;
    --ink: #e8e7dc; --ink-2: #cfcfc2; --muted: #a0a391; --line: #2f3429; --line-2: #3d4335;
    --accent: #a7bc7c; --accent-2: #b8cc8e; --accent-ink: #172010; --accent-soft: #2a3320;
    --warn: #e39a47; --warn-soft: #3a2a17; --bad: #e07a66; --bad-soft: #3b211c; --ok: #7fbf8d; --ok-soft: #1f3324;
    --info: #86aede; --info-soft: #1d2a3a; --none: #7f8176;
    --shadow: 0 1px 2px rgb(0 0 0 / .4); --shadow-lg: 0 10px 40px rgb(0 0 0 / .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11130e; --surface: #1a1d16; --surface-2: #22261d; --surface-3: #2b3025;
  --ink: #e8e7dc; --ink-2: #cfcfc2; --muted: #a0a391; --line: #2f3429; --line-2: #3d4335;
  --accent: #a7bc7c; --accent-2: #b8cc8e; --accent-ink: #172010; --accent-soft: #2a3320;
  --warn: #e39a47; --warn-soft: #3a2a17; --bad: #e07a66; --bad-soft: #3b211c; --ok: #7fbf8d; --ok-soft: #1f3324;
  --info: #86aede; --info-soft: #1d2a3a; --none: #7f8176;
  --shadow: 0 1px 2px rgb(0 0 0 / .4); --shadow-lg: 0 10px 40px rgb(0 0 0 / .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font);
  -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 20px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0; }
a { color: var(--accent); }
.num, bdi { unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.bold { font-weight: 650; }
.hidden { display: none !important; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 8px; }
.gap-lg { gap: 14px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { width: 20px; height: 20px; flex: none; } /* ברירת מחדל לאייקונים — מקומות ספציפיים דורסים */
.item > svg:last-child { width: 18px; height: 18px; color: var(--muted); }

/* ===== שלד ===== */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line); padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
}
.topbar .title { font-size: 17px; font-weight: 700; }
.topbar .sub { font-size: 12px; color: var(--muted); }
.main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 14px 16px 110px; }
.main.narrow { max-width: 640px; }
@media (min-width: 900px) { .main:not(.narrow):not([data-route="plan"]) { max-width: 860px; } }

.nav {
  position: fixed; inset: auto 0 0 0; z-index: 30; display: flex; background: var(--surface);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px;
  color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 600; min-height: 56px; position: relative;
}
.nav a svg { width: 24px; height: 24px; }
.nav a[aria-current="page"] { color: var(--accent); }
.nav a[aria-current="page"]::before {
  content: ""; position: absolute; top: 0; inset-inline: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent);
}
.nav .dot { position: absolute; top: 6px; inset-inline-start: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }

.nav .brand { display: none; } /* לפני ה-media: בחלון רחב הוא מוצג */
@media (min-width: 900px) {
  .shell { flex-direction: row; }
  .nav {
    position: sticky; top: 0; inset: auto; height: 100dvh; width: 220px; flex: none; flex-direction: column;
    border-top: 0; border-inline-end: 1px solid var(--line); padding: 16px 10px; gap: 4px;
  }
  .nav .brand { display: block; padding: 6px 10px 16px; }
  .nav a { flex: none; flex-direction: row; gap: 12px; font-size: 14.5px; padding: 10px 12px; border-radius: var(--r-sm); min-height: 0; }
  .nav a[aria-current="page"] { background: var(--accent-soft); }
  .nav a[aria-current="page"]::before { display: none; }
  .nav .dot { position: static; }
  .content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .main { padding: 20px 28px 40px; }
  .topbar { padding: 14px 28px; }
}
.nav .brand { font-weight: 750; font-size: 16px; }
.nav .brand small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }

/* ===== כרטיסים ורשימות ===== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card.pad { padding: 14px; }
.card + .card, .section + .section { margin-top: 12px; }
.card-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { flex: 1; }
.section-title { display: flex; align-items: center; gap: 8px; margin: 18px 2px 8px; }
.section-title h2 { flex: 1; font-size: 15px; color: var(--ink-2); }

.list { list-style: none; margin: 0; padding: 0; }
.item {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; min-height: 56px;
  border-top: 1px solid var(--line); background: none; width: 100%; text-align: start; border-inline: 0; border-bottom: 0;
}
.list > .item:first-child, .list > li:first-child > .item { border-top: 0; }
button.item:hover, a.item:hover { background: var(--surface-2); }
button.item:active { background: var(--surface-3); }
.item .main-line { font-weight: 600; }
.item .meta { font-size: 12.5px; color: var(--muted); }
.item.sel { background: var(--accent-soft); }
.item.stale { position: relative; }
.item.stale::after { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px; background: var(--warn); }
.item .check {
  width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line-2); flex: none; display: grid; place-items: center;
}
.item.sel .check { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.item .check svg { width: 14px; height: 14px; }
.item:not(.sel) .check svg { visibility: hidden; }

.group-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--surface-2);
  border-top: 1px solid var(--line); font-weight: 650; font-size: 14px; width: 100%; border-inline: 0; border-bottom: 0; text-align: start;
}
.group-head:first-child { border-top: 0; border-radius: var(--r) var(--r) 0 0; }
.group-head .count { font-weight: 500; color: var(--muted); font-size: 12.5px; }
.group-head .chev { transition: transform .15s; }
.group-head[aria-expanded="false"] .chev { transform: rotate(90deg); }

/* ===== כפתורים ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); padding: 0 16px;
  border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); font-weight: 600;
  text-decoration: none; color: var(--ink); white-space: nowrap; user-select: none; transition: background .12s, transform .06s;
}
.btn:active { transform: scale(.98); }
.btn:hover { background: var(--surface-2); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { min-height: 34px; padding: 0 11px; font-size: 13.5px; border-radius: var(--r-xs); }
.btn.lg { min-height: 52px; font-size: 16px; padding: 0 22px; }
.btn.block { display: flex; width: 100%; }
.btn.block > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.btn.icon { padding: 0; width: var(--tap); flex: none; }
.btn.sm.icon { width: 34px; }
/* אזור לחיצה מוגדל, בלי לשנות את המראה (האצבע רחבה מהכפתור) */
.btn.sm, .toast .btn, .check-btn, .avatar { position: relative; }
.btn.sm::before, .toast .btn::before, .avatar::before { content: ""; position: absolute; inset: -5px; }
.check-btn::before { content: ""; position: absolute; inset: -8px; }
@media (pointer: coarse) { .chip, .seg button { min-height: 40px; } }
.btn[disabled], .btn.busy { opacity: .55; pointer-events: none; }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.busy::after {
  content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.seg { display: flex; background: var(--surface-3); border-radius: var(--r-sm); padding: 3px; gap: 3px; }
.seg button {
  flex: 1; border: 0; background: none; border-radius: 8px; min-height: 36px; font-weight: 600; font-size: 14px; color: var(--muted); padding: 0 10px; white-space: nowrap;
}
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.seg svg { width: 17px; height: 17px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 36px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface); font-size: 13.5px; font-weight: 600; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .n { font-variant-numeric: tabular-nums; opacity: .75; }
.chip.st[aria-pressed="true"] { background: var(--c); border-color: var(--c); color: var(--c-on, #fff); }

/* ===== סטטוס ===== */
.pill {
  --c: var(--none);
  display: inline-flex; align-items: center; gap: 6px; padding-block: 3px; padding-inline: 10px 9px; border-radius: 999px; font-size: 13px; font-weight: 650;
  background: color-mix(in srgb, var(--c) 15%, var(--surface)); color: color-mix(in srgb, var(--c) 70%, var(--ink)); white-space: nowrap;
}
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.pill.none { --c: var(--none); background: transparent; border: 1.5px dashed var(--line-2); color: var(--muted); }
.pill.none::before { display: none; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--none)); flex: none; display: inline-block; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 650; padding: 1px 7px; border-radius: 6px;
  background: var(--surface-3); color: var(--ink-2); white-space: nowrap;
}
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.dash { background: transparent; border: 1px dashed var(--warn); color: var(--warn); }

/* ===== מדדים ===== */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; text-align: start;
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
button.kpi:hover { background: var(--surface-2); }
.kpi[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.kpi .v { font-size: 24px; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .l { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi.bad .v { color: var(--bad); }
.kpi.warn .v { color: var(--warn); }
.kpi.ok .v { color: var(--ok); }
@media (max-width: 520px) { .kpis { gap: 6px; } .kpi { padding: 6px 9px; gap: 0; } .kpi .v { font-size: 20px; } .kpi .l { font-size: 11.5px; } }
@media (max-width: 380px) { .kpi .v { font-size: 18px; } .kpi { padding: 6px 7px; } }

/* ===== טפסים ===== */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label, .label { font-size: 13px; font-weight: 650; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12.5px; color: var(--bad); font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%; min-height: var(--tap); padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line-2);
  background: var(--surface); font-size: 16px; /* 16px: iOS לא עושה זום */
}
textarea.input { padding: 10px 12px; min-height: 80px; resize: vertical; }
.input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); border-color: var(--accent); }
.input.bad { border-color: var(--bad); }
.search { position: relative; }
.search .input { padding-inline-start: 38px; }
.search svg { position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 420px) { .grid-2.stack { grid-template-columns: 1fr; } }
.toggle { display: flex; align-items: center; gap: 10px; min-height: var(--tap); font-weight: 600; }
.toggle input { width: 22px; height: 22px; accent-color: var(--accent); }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; }
.stepper button { width: 38px; height: 38px; border: 0; background: var(--surface-2); font-size: 18px; font-weight: 700; }
.stepper input { width: 48px; height: 38px; border: 0; text-align: center; background: var(--surface); font-size: 16px; font-variant-numeric: tabular-nums; }

/* ===== סטטוס גדול לבחירה ===== */
.status-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 520px) { .status-grid { grid-template-columns: repeat(3, 1fr); } }
.status-btn {
  --c: var(--none);
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 14px; border-radius: var(--r-sm);
  border: 1.5px solid color-mix(in srgb, var(--c) 35%, var(--line)); background: color-mix(in srgb, var(--c) 8%, var(--surface));
  font-weight: 700; font-size: 15px; text-align: start;
}
.status-btn::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; }
.status-btn[aria-pressed="true"] { background: var(--c); color: var(--c-on, #fff); border-color: var(--c); }
.status-btn[aria-pressed="true"]::before { background: #fff; }

/* ===== גיליון (bottom sheet בטלפון, דיאלוג במחשב) ===== */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgb(10 12 6 / .45); animation: fade .15s; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 620px; max-height: 92dvh; background: var(--surface); border-radius: 20px 20px 0 0; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: up .2s cubic-bezier(.2, .8, .2, 1);
}
.sheet.full { height: 100dvh; max-height: none; border-radius: 0; max-width: none; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { flex: 1; }
.sheet-body { padding: 14px 16px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.sheet-body > * { flex-shrink: 0; } /* אחרת שורת צ'יפים נגללת (overflow) מתכווצת לאפס */
.sheet-foot { padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; gap: 8px; }
.sheet-foot .btn { flex: 1; }
.grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 8px auto -4px; }
@media (min-width: 700px) {
  .scrim { align-items: center; padding: 24px; }
  .sheet { border-radius: 18px; }
  .sheet.full { height: auto; max-height: 92dvh; border-radius: 18px; max-width: 760px; }
  .grab { display: none; }
}
@keyframes up { from { transform: translateY(24px); opacity: .6; } }
@keyframes fade { from { opacity: 0; } }

/* ===== הודעות ===== */
.toasts { position: fixed; z-index: 60; inset-inline: 12px; bottom: calc(72px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
@media (min-width: 900px) { .toasts { bottom: 24px; } }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 520px; width: fit-content; padding: 10px; padding-inline-start: 16px;
  border-radius: 12px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); font-weight: 600; font-size: 14px; animation: up .2s;
}
.toast.bad { background: var(--bad); color: #fff; }
.toast .btn { min-height: 32px; background: transparent; color: inherit; border-color: color-mix(in srgb, currentColor 40%, transparent); }
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r-sm); font-size: 13.5px; font-weight: 600; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner.info { background: var(--info-soft); color: var(--info); }
.banner.ok { background: var(--ok-soft); color: var(--ok); }
.banner svg { width: 20px; height: 20px; flex: none; }
.offline-bar { position: sticky; top: 0; z-index: 25; }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty svg { width: 42px; height: 42px; opacity: .5; margin-bottom: 6px; }
.empty .t { font-weight: 650; color: var(--ink-2); }

.skel { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 300% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -150% 0; } }

/* פס פעולה צף (בחירה מרובה) */
.actionbar {
  position: fixed; z-index: 35; inset-inline: 12px; bottom: calc(68px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 8px;
  padding: 8px; padding-inline-start: 14px; border-radius: 16px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); animation: up .2s;
  max-width: 620px; margin: 0 auto;
}
.actionbar .btn.primary { background: var(--accent-2); border-color: var(--accent-2); color: var(--accent-ink); }
.actionbar .btn.ghost { color: var(--bg); }
@media (min-width: 900px) { .actionbar { bottom: 20px; inset-inline-start: 240px; } }

/* ===== לוח (board) ===== */
.board-row .who { min-width: 0; flex: 1; }
.board-row .who .n { font-weight: 650; }
.board-row .side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; max-width: 48%; }
.board-row .loc { font-size: 12px; color: var(--muted); }
/* סינון: בטלפון מאחורי כפתור; בחלון רחב תמיד גלוי והכפתור מוסתר */
.fbtn { position: relative; }
.fbtn.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.fbtn .fcount {
  position: absolute; top: -6px; inset-inline-end: -6px; min-width: 18px; height: 18px; border-radius: 999px; padding: 0 5px;
  background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 750; line-height: 18px; text-align: center;
}
.fsum { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); padding-inline-start: 4px; }
@media (max-width: 599px) { .fpanel.closed { display: none; } }
@media (min-width: 600px) { .fbtn, .fsum { display: none !important; } }
.badge.ro { background: var(--surface-3); color: var(--ink-2); gap: 5px; white-space: nowrap; }
.badge.ro svg { width: 14px; height: 14px; }

/* ===== טבלת תכנון ===== */
.plan-wrap { overflow: auto; max-height: calc(100dvh - 250px); border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
@media (min-width: 900px) { .plan-wrap { max-height: calc(100dvh - 210px); } }
table.plan { border-collapse: separate; border-spacing: 0; font-size: 12px; }
table.plan th, table.plan td { border-bottom: 1px solid var(--line); border-inline-start: 1px solid var(--line); padding: 0; }
table.plan thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); font-weight: 650; }
table.plan .name {
  position: sticky; inset-inline-start: 0; z-index: 1; background: var(--surface); text-align: start; padding: 0 10px;
  min-width: 112px; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: 13px; border-inline-start: 0;
}
table.plan thead .name { z-index: 3; background: var(--surface-2); }
table.plan .plat td { background: var(--surface-3); font-weight: 700; font-size: 12px; padding: 5px 10px; position: sticky; inset-inline-start: 0; }
table.plan .day { width: 34px; min-width: 34px; height: 40px; text-align: center; line-height: 1.15; padding: 3px 0; }
table.plan .day .d { font-size: 10.5px; color: var(--muted); font-weight: 500; }
table.plan .day.today { background: var(--accent-soft); color: var(--accent); }
table.plan .day.we { color: var(--muted); }
table.plan .cell { width: 34px; height: 36px; }
table.plan .cell button {
  --c: transparent; display: block; width: 100%; height: 36px; border: 0; background: var(--c); color: var(--c-on, #fff); font-weight: 700; font-size: 11px; padding: 0;
}
table.plan .cell button.none { background: repeating-linear-gradient(135deg, transparent 0 5px, color-mix(in srgb, var(--line) 70%, transparent) 5px 6px); color: var(--muted); }
table.plan .cell.today button { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent); }
table.plan .cell button.sel { box-shadow: inset 0 0 0 3px var(--ink), inset 0 0 0 5px var(--surface); }
@media (pointer: coarse) {
  table.plan .day, table.plan .cell { width: 40px; min-width: 40px; }
  table.plan .cell, table.plan .cell button { height: 42px; }
  table.plan .cell button { font-size: 12px; }
}
@media (max-width: 520px) { table.plan .name { min-width: 96px; max-width: 120px; padding: 0 8px; } }
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }

/* ===== שלי ===== */
.hero { padding: 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.hero .big { font-size: 26px; font-weight: 800; }
.timeline { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.tl-day { --c: transparent; border-radius: 10px; padding: 6px 2px; text-align: center; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.tl-day .dw { font-size: 11px; color: var(--muted); font-weight: 600; }
.tl-day .dd { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tl-day .bar { height: 6px; border-radius: 3px; background: var(--c); margin: 5px 6px 0; }
.tl-day.none .bar { background: var(--line-2); opacity: .5; }
.tl-day .sn { font-size: 10.5px; margin-top: 3px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
.tl-day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

/* ===== כניסה ===== */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; text-align: center; display: flex; flex-direction: column; gap: 16px; }
.logo { width: 64px; height: 64px; margin: 0 auto; border-radius: 18px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: var(--shadow); }
.logo svg { width: 36px; height: 36px; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 6px 0; direction: ltr; }
.pin-dots span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); }
.pin-dots span.on { background: var(--ink); border-color: var(--ink); }
.pin-dots.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; direction: ltr; }
.keypad button {
  height: 60px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); font-size: 24px; font-weight: 600; box-shadow: var(--shadow);
}
.keypad button:active { background: var(--surface-3); }
.keypad button.fn { background: transparent; box-shadow: none; border-color: transparent; font-size: 15px; }
/* אישור: בולט כשאפשר ללחוץ, דהוי כשהקוד עוד לא מלא */
.keypad button[data-k="ok"]:not(:disabled) { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.keypad button:disabled { opacity: .35; }

/* ===== חתימה ===== */
.sigpad { position: relative; border: 2px dashed var(--line-2); border-radius: var(--r); background: #fff; touch-action: none; height: 220px; }
.sigpad canvas { width: 100%; height: 100%; display: block; border-radius: var(--r); }
.sigpad .ph { position: absolute; inset: 0; display: grid; place-items: center; color: #9a9a90; pointer-events: none; font-weight: 600; }
.sigpad.has .ph { display: none; }
.sigpad::after { content: ""; position: absolute; inset-inline: 24px; bottom: 44px; border-bottom: 1.5px solid #cfcfc5; pointer-events: none; }

/* ===== טבלה (למחשב) ===== */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: start; font-size: 12.5px; color: var(--muted); font-weight: 650; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr.stale td:first-child { box-shadow: inset 4px 0 0 var(--warn); }
table.data tr:last-child td { border-bottom: 0; }
.only-wide { display: none; }
@media (min-width: 900px) { .only-wide { display: revert; } .only-narrow { display: none !important; } }

/* ===== הדפסה ===== */
#print-area { display: none; }
@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block; color: #000; font-size: 13px; }
  #print-area table { width: 100%; border-collapse: collapse; }
  #print-area th, #print-area td { border: 1px solid #555; padding: 5px 7px; text-align: start; }
  #print-area h1 { font-size: 18px; margin-bottom: 4px; }
  #print-area .sig { max-width: 240px; border-bottom: 1px solid #000; }
}

/* ===== תוספות ===== */
body.noscroll { overflow: hidden; }
.datenav { position: relative; }
.datebtn { justify-content: center; font-variant-numeric: tabular-nums; }
.date-hidden { position: absolute; inset-inline-start: 50%; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
.skel.line { height: 44px; }
.msg-preview { white-space: pre-wrap; font: inherit; margin: 0; font-size: 14px; }
.item .main-line, .item .meta { display: block; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 750; font-size: 14px; border: 0; }

/* ===== כללי ===== */
.center { text-align: center; }
.hint { font-size: 12px; color: var(--muted); }
.err { font-size: 12.5px; color: var(--bad); font-weight: 600; min-height: 1em; }
.err:empty { min-height: 0; }
.bad-t { color: var(--bad); }
.ok-t { color: var(--ok); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; }
textarea.mono { white-space: pre; overflow-x: auto; }
.ltr-in { direction: ltr; text-align: left; }
.ltr-in::placeholder { text-align: right; }
.sm-input { min-height: 36px; font-size: 16px; padding: 0 10px; width: 130px; flex: none; }
.ghostbtn { border: 0; background: none; padding: 0; text-align: start; font: inherit; color: inherit; min-height: var(--tap); }
.side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; text-align: end; }
svg.spin { animation: spin 1s linear infinite; }
.toggle.sm { min-height: 36px; gap: 6px; font-size: 13px; flex: none; }
.toggle.sm input { width: 18px; height: 18px; }
/* טאבים שהם צ'יפים — נשברים לשורות, כך שכולם גלויים גם בטלפון */
.chips.tabs { margin-bottom: 12px; }
.kpis.three { grid-template-columns: repeat(3, 1fr); }
tr.bad-row td { background: var(--bad-soft); }

/* ===== לוח ודו"ח ===== */
.board-modes { margin: 10px 0 12px; gap: 8px; flex-wrap: nowrap; }
.board-modes .seg { min-width: 0; }
.board-modes .seg button { padding: 0 6px; }
.board-modes > .row { flex: none; }
.board-modes .badge.ro { font-size: 13px; padding: 0 12px; min-height: 42px; border-radius: var(--r-sm); }
@media (max-width: 360px) { .board-modes .seg svg { display: none; } }
.report-actions { margin-top: 14px; }
.plan-tools { margin: 10px 0; }
.plan-skel { height: 320px; border-radius: var(--r); }
.dot.hatch { background: repeating-linear-gradient(135deg, transparent 0 2px, var(--line-2) 2px 3.5px); border: 1px solid var(--line-2); }
table.plan tfoot td.sum, table.plan tfoot th { position: sticky; bottom: 0; background: var(--surface-2); font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; height: 30px; }
table.plan tfoot tr:first-child td, table.plan tfoot tr:first-child th { bottom: 30px; }
table.plan tfoot th.name { z-index: 3; font-size: 12px; }
.big-pill .pill { font-size: 16px; padding-block: 6px; padding-inline: 14px 12px; }
.big-pill .pill::before { width: 10px; height: 10px; }
/* שורת שיבוץ: בטלפון השדה יורד לשורה משלו */
@media (max-width: 520px) {
  .item.col-mobile { flex-wrap: wrap; }
  .item.col-mobile .grow { flex-basis: calc(100% - 50px); }
  .item.col-mobile .sm-input { flex: 1; width: auto; }
}

/* ===== ציוד ===== */
.stock-n { font-variant-numeric: tabular-nums; font-size: 15px; white-space: nowrap; }
.stock-n b { font-size: 18px; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
dl.facts dt { color: var(--muted); font-weight: 600; }
dl.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.sig-img { display: block; max-width: 100%; max-height: 160px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px; }
.item.ret-row { flex-wrap: wrap; }
.item.ret-row.off > :not(.check-btn) { opacity: .45; }
.check-btn {
  width: 28px; height: 28px; flex: none; border-radius: 8px; border: 2px solid var(--line-2); background: var(--surface);
  display: grid; place-items: center; padding: 0; color: var(--accent-ink);
}
.check-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
.check-btn svg { width: 16px; height: 16px; }
select.cond { width: auto; min-height: 38px; flex: none; padding: 0 8px; }
.item.issue-line { gap: 8px; }
.input.serial { width: 120px; flex: none; min-height: 38px; direction: ltr; text-align: center; }
.item.count-row { gap: 10px; }
.count-in { width: 84px; flex: none; text-align: center; min-height: 40px; font-variant-numeric: tabular-nums; }
.gap { min-width: 34px; text-align: center; font-weight: 750; font-variant-numeric: tabular-nums; flex: none; }
.item.ret-row .grow { flex: 1 1 140px; } /* שורה אחת כשנכנס, אחרת כמות+מצב יורדים לשורה שנייה */
.item.ret-row select.cond { width: 100px; margin-inline-start: auto; }

/* ===== ניהול ===== */
.hstat { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-3); }
.hstat svg { width: 17px; height: 17px; }
.hstat.ok { background: var(--ok-soft); color: var(--ok); }
.hstat.warn { background: var(--warn-soft); color: var(--warn); }
.hstat.bad { background: var(--bad-soft); color: var(--bad); }
.item.list-row { gap: 6px; flex-wrap: wrap; padding-inline: 8px; }
.item.list-row .input.grow { min-width: 120px; min-height: 38px; }
.color-in { width: 38px; height: 38px; padding: 2px; border: 1px solid var(--line-2); border-radius: var(--r-xs); background: var(--surface); flex: none; }
.item.audit { align-items: flex-start; min-height: 0; }
.item.audit .side { font-size: 12px; line-height: 1.35; }

/* ===== כניסה ===== */
details.paste { text-align: start; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 0 14px; }
details.paste summary { min-height: var(--tap); display: flex; align-items: center; font-weight: 600; font-size: 14px; cursor: pointer; color: var(--ink-2); }
details.paste[open] { padding-bottom: 14px; }
details.paste[open] > :not(summary) + * { margin-top: 10px; }
.demo-box { text-align: start; border: 1.5px dashed var(--accent); border-radius: var(--r); padding: 14px; background: var(--accent-soft); }
.demo-users { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.demo-users .btn { justify-content: flex-start; min-height: 54px; padding: 6px 12px; text-align: start; white-space: normal; }
.demo-users .col { gap: 0; }
.demo-hint { color: var(--info); font-weight: 600; }
.demo-bar { border-radius: 0; justify-content: center; font-size: 12.5px; padding: 6px 14px; }
#pin-pad.busy, #ps-pad.busy { opacity: .5; pointer-events: none; }
.pin-sheet { max-width: 400px; }
.pin-sheet .sheet-body { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
ol.steps { margin: 0; padding-inline-start: 22px; display: flex; flex-direction: column; gap: 10px; }
ol.steps svg { width: 18px; height: 18px; vertical-align: -4px; }

/* ===== שלד: חייל (בלי ניווט) / "שלי" רק בחלון רחב ===== */
.shell.solo .main { padding-bottom: 40px; max-width: 640px; }
@media (max-width: 899px) { .nav a.wide-only { display: none; } }

/* טבלאות מספרים (דו"ח): מספרים במרכז, עמודה ראשונה בשורה אחת, ובטלפון כותרות נשברות במקום גלילה לצד */
table.data td:first-child { white-space: nowrap; }
table.data.num th:not(:first-child), table.data.num td:not(:first-child) { text-align: center; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) {
  table.data { font-size: 13.5px; }
  table.data th, table.data td { padding: 8px 6px; }
  table.data th:first-child, table.data td:first-child { padding-inline-start: 12px; }
  table.data.num th { white-space: normal; line-height: 1.2; vertical-align: bottom; }
}
.warn-t { color: var(--warn); }

/* ---------- כשירות: פק"ל והסמכות ---------- */
select.input.sk-sel { width: auto; max-width: 100%; min-height: 36px; border-radius: 999px; padding: 0 14px; font-weight: 600; flex: none; align-self: flex-start; }
select.input.sk-sel.on { background-color: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.warn:not([aria-pressed="true"]) { border-color: var(--warn); color: var(--warn); }
.chip.add { border-color: var(--accent); color: var(--accent); }
.chip.add svg { width: 15px; height: 15px; }
.chip.miss:not([aria-pressed="true"]) { border-style: dashed; border-color: var(--warn); color: var(--warn); }
.chip.sug { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.chip.radio::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; box-sizing: border-box; }
.chip.radio[aria-pressed="true"]::before { border: 4px solid var(--accent); background: var(--bg); }
.item.list-row .mv { display: flex; flex: none; }
.chip.sug[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.grid-2.cov { align-items: start; }
@media (max-width: 520px) { .grid-2.cov { grid-template-columns: 1fr; } }
.badge svg { width: 13px; height: 13px; }
