/* styles.css — עיצוב RTL לאפליקציית ניהול הפנימיה (על בסיס העיצוב של אפליקציית החקלאות, בפלטה כחולה) */
:root {
  --brand: #1d4e89;
  --brand-dark: #143b69;
  --brand-light: #e3edf9;
  --accent: #0d9488;
  --bg: #f4f6f8;
  --card: #ffffff;
  --border: #e2e7ec;
  --text: #1c2733;
  --muted: #6b7884;
  --danger: #c62828;
  --ok: #16a34a;
  --warn: #d97706;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  /* טוקנים בסגנון Monday (Vibe) — ריווח, פינות וצללים */
  --sp-xs: 4px; --sp-s: 8px; --sp-m: 16px; --sp-l: 24px; --sp-xl: 32px;
  --r-s: 4px; --r-m: 8px; --r-b: 16px;
  --sh-xs: 0 4px 6px -4px rgba(0,0,0,.12);
  --sh-s: 0 4px 8px rgba(0,0,0,.10);
  --sh-m: 0 6px 20px rgba(0,0,0,.12);
  --row-h: 48px;
  /* שמות תפקידי הצבע התקניים (לפי CLAUDE.md) — ממופים לפלטה הכחולה של האפליקציה.
     בלעדיהם רכיבים שמשתמשים ב---primary נופלים לירוק של האפליקציה החקלאית. */
  --primary: var(--brand);
  --primary-dark: var(--brand-dark);
  --primary-light: var(--brand-light);
}

/* מסך התחברות לענן */
.login-overlay { position: fixed; inset: 0; background: linear-gradient(160deg, #143b69, #1d4e89); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.login-box { background: #fff; border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,.35); padding: 32px 28px; width: min(360px, 92vw); text-align: center; }
.login-box h2 { margin: 6px 0 2px; color: #143b69; font-size: 22px; }
.login-box input { width: 100%; margin: 6px 0; padding: 11px 12px; font-size: 15px; }
.login-err { color: #c62828; font-size: 13px; min-height: 18px; margin-top: 4px; }
.login-err.ok { color: #16a34a; }
.login-forgot { background: none; border: 0; color: var(--brand-dark); font-family: inherit; font-size: 13px; cursor: pointer; margin-top: 10px; text-decoration: underline; }
.login-forgot:hover { color: var(--brand); }
.login-forgot:disabled { opacity: .6; cursor: wait; }
.pass-wrap { position: relative; }
.pass-wrap input { width: 100%; padding-inline-end: 40px; box-sizing: border-box; }
.pass-eye { position: absolute; inset-inline-end: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 17px; opacity: .65; padding: 4px; }
.pass-eye:hover { opacity: 1; }
.btn-spin { display: inline-block; width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: -3px; margin-inline-end: 7px; }
@keyframes spin { to { transform: rotate(360deg); } }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  /* מחסנית הפונטים של Monday: Figtree + Noto Sans Hebrew, עם נפילה חזרה לפונטי המערכת */
  font-family: "Figtree", "Noto Sans Hebrew", "Segoe UI", "Rubik", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
/* כותרות: משקל מלא ומעט tracking שלילי — כמו בטוקנים של Vibe */
h1, h2, h3 { letter-spacing: -0.2px; }

/* ---------- פריסה: סרגל צד + תוכן ---------- */
.layout { display: flex; align-items: flex-start; }
.sidebar {
  width: 230px; flex: 0 0 230px; background: var(--card);
  border-left: 1px solid var(--border); min-height: 100vh;
  padding: 14px 12px; position: sticky; top: 0; display: flex; flex-direction: column;
}
.content { flex: 1; min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.brand-logo { width: 40px; height: 40px; border-radius: 11px; background: var(--brand); display: flex; align-items: center; justify-content: center; font-size: 22px; flex: 0 0 auto; overflow: hidden; }
.brand-logo img { width: 100%; height: 100%; object-fit: cover; border-radius: 11px; display: block; }
.brand-txt { display: flex; flex-direction: column; font-weight: 700; color: var(--brand-dark); font-size: 15px; line-height: 1.2; }
.brand-txt small { font-weight: 500; color: var(--muted); font-size: 12px; }
.tabs { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.tabs button {
  display: flex; align-items: center; gap: 10px; background: transparent;
  color: var(--text); border: 0; padding: 10px 12px; border-radius: 9px;
  cursor: pointer; font-size: 14.5px; font-family: inherit; text-align: right;
  width: 100%; font-weight: 500; transition: background .15s;
}
.nav-sec { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .3px; padding: 12px 12px 3px; }
.nav-sec:first-child { padding-top: 2px; }
.tabs button:hover { background: var(--bg); }
.tabs button.active { background: var(--brand-light); color: var(--brand-dark); font-weight: 700; }
.tabs button.tab-foot { margin-top: auto; justify-content: center; color: var(--muted); border-top: 1px solid var(--border); border-radius: 0; padding-top: 12px; }
/* אייקוני הניווט — צבע אחיד שמתעדכן עם הטאב הפעיל */
.nav-ico { display: inline-flex; align-items: center; color: var(--muted); flex: 0 0 auto; }
.tabs button:hover .nav-ico { color: var(--text); }
.tabs button.active .nav-ico { color: var(--brand); }
.tabs button.tab-foot.active { background: var(--brand-light); color: var(--brand-dark); }

/* ---------- סרגל עליון רזה ---------- */
.topbar {
  background: var(--card); color: var(--text); padding: 10px 18px;
  display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border);
}
.status { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.usermenu { position: relative; }
.avatar { width: auto; min-width: 34px; height: 34px; padding: 0 12px; border-radius: 999px; background: var(--brand-light); color: var(--brand-dark); border: 0; font-weight: 700; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.avatar:hover { filter: brightness(.97); }
.usermenu-pop { position: absolute; top: 42px; left: 0; min-width: 200px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.16); padding: 6px; display: none; z-index: 60; }
.usermenu-pop.open { display: block; }
.um-name { font-size: 14px; font-weight: 700; color: var(--text); padding: 8px 12px 0; }
.um-name + .um-email { padding-top: 2px; }
.um-email { font-size: 12px; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; direction: ltr; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.um-item { display: block; width: 100%; background: none; border: 0; text-align: right; padding: 9px 12px; font-size: 14px; font-family: inherit; color: var(--text); cursor: pointer; border-radius: 8px; }
.um-item:hover { background: var(--bg); }
.um-item.um-logout { color: var(--danger); }
.um-role { font-size: 11px; color: var(--muted); padding: 2px 12px 6px; }
.sb-toggle { display: none; align-items: center; background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--brand-dark); padding: 2px 6px; line-height: 1; }
.sb-close { margin-inline-start: auto; background: none; border: 0; font-size: 20px; cursor: pointer; color: var(--muted); padding: 2px 6px; line-height: 1; }
.sb-close:hover { color: var(--brand-dark); }
#headerSync { display: inline-flex; align-items: center; gap: 6px; }

/* כיווץ הסרגל בדסקטופ — כפתור הפתיחה (☰) מופיע רק כשהסרגל סגור */
@media (min-width: 861px) {
  .layout.collapsed .sidebar { display: none; }
  .layout.collapsed .sb-toggle { display: inline-flex; }
}

@media (max-width: 860px) {
  .sidebar {
    position: fixed; inset: 0 0 0 auto; z-index: 50; transform: translateX(100%);
    transition: transform .25s; box-shadow: -4px 0 16px rgba(0,0,0,.18);
    /* בנייד: גובה לפי האזור הגלוי בפועל (dvh) + גלילה, כדי שהגלגל בתחתית לא ייחתך מתחת לסרגל הדפדפן */
    min-height: 0; height: 100vh; height: 100dvh; overflow-y: auto;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }
  .sidebar.open { transform: translateX(0); }
  .sb-toggle { display: inline-flex; }
  .sidebar.open ~ .content .sb-toggle { display: none; }
}

/* ---------- אזור תוכן ---------- */
main { padding: 18px; max-width: 1400px; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h2 { margin: 0; font-size: 20px; color: var(--brand-dark); }
.spacer { flex: 1; }

/* ---------- כפתורים ---------- */
/* כפתור בסגנון Monday: גובה קבוע 32px, radius 4, בלי צל, מעבר עדין */
.btn {
  background: var(--brand); color: #fff; border: 1px solid var(--brand);
  padding: 0 16px; min-height: 32px; border-radius: var(--r-s, 4px);
  cursor: pointer; font-size: 14px; font-weight: 500; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); filter: none; }
.btn.secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { background: transparent; border-color: var(--brand); color: var(--brand); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn.danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.small { padding: 0 10px; min-height: 26px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ico { gap: 0; }
/* כפתור שמכיל אייקון בלבד — ריפוד מרובע במקום רוחב של כפתור טקסט */
.btn:has(> svg:only-child) { padding: 0 8px; }
.btn.small:has(> svg:only-child) { padding: 0 6px; }
.btn.ico .wa-ico, .wa-ico { width: 17px; height: 17px; display: inline-block; vertical-align: -3px; }
.xls-ico { width: 17px; height: 17px; display: inline-block; vertical-align: -3px; }

/* ---------- טפסים ---------- */
/* שדות בסגנון Monday: radius 4, מסגרת דקה, פוקוס במסגרת כחולה בלי הילה עבה */
input, select, textarea {
  font-family: inherit; font-size: 14px; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: var(--r-s, 4px);
  background: #fff; color: var(--text);
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:hover, select:hover, textarea:hover { border-color: #c3c6d4; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand);
}
label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 4px; }

/* בוררי זמן/תאריך — האייקון המובנה של הדפדפן מוחלף באייקון קו בסגנון האפליקציה */
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator {
  width: 16px; height: 16px; padding: 0; margin-inline-start: 4px;
  background-repeat: no-repeat; background-size: 16px 16px; background-position: center;
  opacity: .6; cursor: pointer; transition: opacity .12s ease;
}
input[type="time"]::-webkit-calendar-picker-indicator:hover,
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
input[type="month"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }
input[type="time"]::-webkit-calendar-picker-indicator { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23676879%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%229%22%2F%3E%3Cpath%20d%3D%22M12%207.5V12l3%201.8%22%2F%3E%3C%2Fsvg%3E"); }
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23676879%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%223%22%20y%3D%225%22%20width%3D%2218%22%20height%3D%2216%22%20rx%3D%222%22%2F%3E%3Cpath%20d%3D%22M3%2010h18M8%203v4M16%203v4%22%2F%3E%3C%2Fsvg%3E"); }

body.dark input[type="time"]::-webkit-calendar-picker-indicator { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%239aa6b8%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%229%22%2F%3E%3Cpath%20d%3D%22M12%207.5V12l3%201.8%22%2F%3E%3C%2Fsvg%3E"); }
body.dark input[type="date"]::-webkit-calendar-picker-indicator,
body.dark input[type="datetime-local"]::-webkit-calendar-picker-indicator,
body.dark input[type="month"]::-webkit-calendar-picker-indicator { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%239aa6b8%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%223%22%20y%3D%225%22%20width%3D%2218%22%20height%3D%2216%22%20rx%3D%222%22%2F%3E%3Cpath%20d%3D%22M3%2010h18M8%203v4M16%203v4%22%2F%3E%3C%2Fsvg%3E"); }

.field { margin-bottom: 10px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
/* min-width:0 מאפשר לשדה להתכווץ מתחת לרוחב התוכן שלו — בלעדיו קלט
   עם placeholder ארוך גולש מהמסגרת ומתנגש בשדה השכן (קרה בנייד). */
.row > .field { flex: 1 1 160px; min-width: 0; }
/* שדה בתוך .field ממלא את הרוחב ולא מקבל רוחב מובנה מהדפדפן */
.field > input, .field > select, .field > textarea { width: 100%; max-width: 100%; }
/* עריכה ישירה בתא — שקוף עד פוקוס. הקיזוז מיישר את הטקסט מתחת לכותרת העמודה. */
.transp { border: 1px solid transparent; background: transparent; padding: 4px 6px; margin-inline: -7px; }
.transp:focus { background: var(--card); border-color: var(--border); }
/* שדה שעה בתוך טבלה — כרום מיישר את הערך לשמאל בתוך הקלט; מצמידים לימין
   כדי שהשעה תשב בדיוק מתחת לכותרת "שעה" */
table.grid input[type="time"] { direction: ltr; text-align: right; }
/* בתוך טבלה מסתירים את אייקון הבורר — הוא תפס את המקום שמתחת לכותרת
   ודחף את השעה שמאלה. הקלדה ישירה עדיין עובדת. */
table.grid input[type="time"]::-webkit-calendar-picker-indicator { display: none; }
input.invalid, select.invalid, textarea.invalid { border-color: var(--danger) !important; background: #fef2f2; }
.field-err { color: var(--danger); font-size: 12px; margin-top: 2px; min-height: 0; }

/* ---------- טבלאות ---------- */
/* טבלה בסגנון Monday — כותרת אפורה עדינה, שורות גבוהות, קווי הפרדה דקים.
   זהו סגנון הבסיס לכל הטבלאות באפליקציה (המחלקה m-grid נשמרת לתאימות). */
table.grid {
  width: 100%; border-collapse: collapse; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--r-m, 8px);
  overflow: hidden; box-shadow: none;
}
table.grid th, table.grid td { text-align: right; }
table.grid td {
  font-variant-numeric: tabular-nums; padding: 6px 14px;
  height: var(--row-h, 48px); border-bottom: 1px solid #eef1f4;
}
table.grid th {
  background: #fbfcfd; color: var(--muted); font-weight: 600; font-size: 12px;
  letter-spacing: .2px; padding: 10px 14px; border-bottom: 1px solid var(--border);
}
table.grid th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
table.grid th.sortable:hover { background: #f1f4f8; color: var(--text); }
table.grid tbody tr { transition: background .12s ease; }
table.grid tbody tr:hover td { background: #f7f9fc; }
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid thead th { position: sticky; top: 0; z-index: 3; box-shadow: 0 1px 0 var(--border); }
@media (min-width: 861px) { .tbl-scroll { overflow-x: visible; } }
table.grid td.sorted-col { background: #fafbfd; }
table.grid th.sorted-col { background: #f1f4f8; color: var(--text); }
table.grid td.actions { white-space: nowrap; text-align: left; }
.muted { color: var(--muted); }
.center { text-align: center; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.tbl-scroll { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- כרטיסים ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }

/* כרטיס בסגנון Monday — שטוח, מסגרת דקה, בלי פס צבע עליון.
   הסטטוס מסומן בנקודה (.m-cdot) ליד הכותרת במקום בפס. */
.card.m-card {
  border: 1px solid var(--border); border-radius: var(--r-m, 8px);
  box-shadow: none; padding: 16px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.card.m-card:hover { box-shadow: 0 4px 6px -4px rgba(0,0,0,.10); }
.m-cdot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }

/* ---------- תת-טאבים ---------- */
/* תת-טאבים בסגנון Monday: טקסט נקי עם קו תחתון לפעיל, בלי גלולות */
.subtabs { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.subtabs button {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 0; border-bottom: 2px solid transparent;
  padding: 8px 12px; margin-bottom: -1px; cursor: pointer; font-family: inherit;
  font-size: 14px; font-weight: 500; color: var(--muted); border-radius: 0;
  transition: color .12s ease, border-color .12s ease;
}
.subtabs button:hover { color: var(--text); }
.subtabs button.active { background: transparent; color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* ---------- תגים וצ'יפים ---------- */
.tag { display: inline-block; background: var(--brand-light); color: var(--brand-dark); border-radius: var(--r-s, 4px); padding: 2px 8px; font-size: 12px; font-weight: 500; }
.grade-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 21px; padding: 0 6px; border-radius: 6px; font-size: 12px; font-weight: 800; color: #fff; flex: 0 0 auto; }
.grade-badge.gb0 { background: #2563eb; }
.grade-badge.gb1 { background: #16a34a; }
.grade-badge.gb2 { background: #0d9488; }
.grade-badge.gb3 { background: #d97706; }
.grade-badge.gb4 { background: #7c3aed; }
.grade-badge.gbx { background: #64748b; }
.range-chip { display: inline-flex; align-items: center; gap: 7px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-s, 4px); padding: 5px 12px; font-size: 13px; font-weight: 500; color: var(--text); box-shadow: none; }
.range-chip .rc-ic { opacity: .75; display: inline-flex; align-items: center; }
.chip-date-input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }

/* פיל סטטוס (דווח/ממתין, פתוח/סגור) */
.ds-report { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: var(--r-s, 4px); white-space: nowrap; }
.ds-report.done { background: #dcfce7; color: #166534; }
.ds-report.wait { background: #fef3c7; color: #92400e; }
.ds-report.off { background: #eef2f6; color: #64748b; }
.ds-report.closed { background: #dbeafe; color: #1e40af; }

/* רמזור חינוכי */
.tl { display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; padding: 2px 10px; border-radius: var(--r-s, 4px); white-space: nowrap; }
.tl-green { background: #dcfce7; color: #166534; }
.tl-orange { background: #fef3c7; color: #92400e; }
.tl-red { background: #fee2e2; color: #b91c1c; }
.tl-none { background: #eef2f6; color: #64748b; }
.tl-btn { cursor: pointer; border: 1.5px solid transparent; background-clip: padding-box; }
.tl-btn.sel { border-color: currentColor; }

/* ---------- שורות סימון נוכחות (בסגנון "מצב שטח") ---------- */
.field-students { display: flex; flex-direction: column; gap: 7px; }
.field-student { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; box-shadow: var(--shadow); }
.field-student.done { border-color: var(--ok); background: #f3fbf4; }
.field-student.absent { border-color: var(--danger); background: #fdecea; }
.field-student.home { border-color: var(--warn); background: #fffaf0; }
.field-student.sick { border-color: #7c3aed; background: #f9f6ff; }
.field-student .fstu-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.field-student .fstu-name { font-size: 15px; font-weight: 600; flex: 1; min-width: 110px; }
.field-student .fstu-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.field-student .fstu-by { font-size: 11px; color: var(--muted); margin-top: 4px; }
.fbtn { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 7px; border: 1.5px solid var(--border); background: #fff; cursor: pointer; min-height: 30px; font-family: inherit; }
.fbtn.present.on { background: var(--ok); color: #fff; border-color: var(--ok); }
.fbtn.absent.on { background: var(--danger); color: #fff; border-color: var(--danger); }
.fbtn.home.on { background: var(--warn); color: #fff; border-color: var(--warn); }
.fbtn.sick.on { background: #7c3aed; color: #fff; border-color: #7c3aed; }
.fwent-grp { display: flex; gap: 7px; flex-wrap: wrap; }
.frate-wrap { display: flex; align-items: center; gap: 7px; }
.frate { display: flex; gap: 5px; }
.frbtn { width: 30px; height: 30px; border-radius: 7px; border: 1.5px solid var(--border); background: #fff; font-size: 13px; font-weight: 700; cursor: pointer; color: var(--text); font-family: inherit; }
.frbtn.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.fstu-note { width: 100%; margin-top: 7px; padding: 7px 10px; font-size: 13px; border: 1px solid var(--border); border-radius: 8px; }
.field-team-head { font-weight: 700; color: var(--brand-dark); background: var(--brand-light); border: 1px solid #cfe0f2; border-radius: 8px; padding: 5px 10px; margin: 12px 0 4px; font-size: 13px; }

/* פס התקדמות סימון */
.fprog { margin-bottom: 10px; }
.fprog-track { height: 10px; background: #fef3c7; border-radius: 6px; overflow: hidden; }
.fprog-fill { height: 100%; background: #d97706; border-radius: 6px; transition: width .3s ease; }
.fprog-fill.done { background: #16a34a; }
.fprog-lbl { font-size: 13px; font-weight: 700; color: #92400e; margin-top: 4px; }
.fprog-lbl.done { color: #166534; }

/* בורר תלמידים (מודאל) */
.fadd-search { width: 100%; padding: 9px 11px; font-size: 14px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; }
.fadd-list { display: flex; flex-direction: column; gap: 6px; max-height: 52vh; overflow-y: auto; }
.fadd-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; font-size: 15px; border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; text-align: right; font-family: inherit; }
.fadd-item:hover { background: var(--brand-light); border-color: var(--brand); }
.fadd-item.sel { background: var(--brand-light); border-color: var(--brand); font-weight: 700; }
.fadd-plus { color: var(--brand); font-weight: 700; }
.fadd-note { font-size: 12px; opacity: .7; }

/* ---------- גרף פסים לפי כיתה ---------- */
.cls-chart { display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px; max-width: 560px; }
.cls-row { display: flex; align-items: center; gap: 10px; }
.cls-lbl { flex: 0 0 auto; width: 90px; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cls-track { flex: 1; height: 14px; background: #f1f5f9; border-radius: 7px; overflow: hidden; }
.cls-fill { height: 100%; border-radius: 7px; transition: width .4s ease; background: var(--brand); }
.cls-val { font-size: 13px; font-weight: 700; min-width: 42px; font-variant-numeric: tabular-nums; }

/* ---------- סיכומים ---------- */
.totbar { display: flex; gap: 16px; flex-wrap: wrap; margin: 8px 0 16px; }
.totbar .t { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px 16px; }
.totbar .t b { font-size: 20px; color: var(--brand-dark); display: block; }
.totbar .t span { font-size: 12px; color: var(--muted); }

/* ---------- מודאל ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; border-radius: var(--r-b, 16px); box-shadow: 0 15px 50px rgba(0,0,0,.25); width: min(560px, 92vw); max-height: 88vh; overflow-y: auto; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal-head h3 { margin: 0; font-size: 18px; font-weight: 600; color: var(--text); }
.modal-head .x { margin-right: auto; cursor: pointer; font-size: 22px; color: var(--muted); background: none; border: 0; }
.modal-body { padding: 18px; }
.modal-foot { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-start; }

/* ---------- הדפסה ---------- */
@media print {
  .no-print, .topbar, .page-head .btn, .subtabs { display: none !important; }
  body { background: #fff; }
  main { padding: 0; max-width: 100%; }
  table.grid { box-shadow: none; }
  table.grid th, table.grid td { border: 1px solid #999; }
}
.print-only { display: none; }
@media print { .print-only { display: block; } }

/* ---------- דשבורד מנהלים ---------- */
.kpi-grid {
  display: grid; gap: 12px; margin: 4px 0 20px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  grid-auto-rows: 1fr;            /* גם כשהמונים נשברים לשתי שורות — אותו גובה */
}
/* כרטיס מדד בסגנון Monday: שטוח, מסגרת עדינה, מספר גדול ותווית אפורה.
   בלי אימוג'י בקופסה פסטלית ובלי פס צבע — הצבע מסומן בנקודה קטנה בלבד. */
.kpi {
  position: relative; display: flex; align-items: flex-start; gap: 10px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-m, 8px);
  padding: 16px; box-shadow: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.kpi:hover { border-color: var(--brand); box-shadow: var(--sh-xs, 0 4px 6px -4px rgba(0,0,0,.12)); }
/* נקודת צבע קטנה במקום אייקון — מסמנת מצב בלי להעמיס */
.kpi-ic {
  width: 8px; height: 8px; flex: 0 0 auto; margin-top: 8px; border-radius: 50%;
  font-size: 0; color: transparent; overflow: hidden;
  background: var(--kpi-c, var(--brand));
}
.kpi-body { min-width: 0; }
.kpi-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.kpi-val {
  font-size: 28px; font-weight: 600; line-height: 1.15; color: var(--text);
  letter-spacing: -.4px; font-variant-numeric: tabular-nums;
}
.kpi-lbl { font-size: 14px; color: var(--muted); margin-top: 4px; font-weight: 400; }
.kpi-sub { font-size: 11px; color: var(--muted); margin-top: 2px; opacity: .85; }
.kpi-badge { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: var(--r-s, 4px); white-space: nowrap; }
.kpi-badge.up { background: #dcfce7; color: #16a34a; }
.kpi-badge.down { background: #fee2e2; color: #dc2626; }
.kpi-badge.flat { background: #eef2f6; color: #64748b; }
.kpi-good   { --kpi-c: #16a34a; --kpi-bg: #dcfce7; }
.kpi-bad    { --kpi-c: #dc2626; --kpi-bg: #fee2e2; }
.kpi-warn   { --kpi-c: #d97706; --kpi-bg: #fef3c7; }
.kpi-info   { --kpi-c: #2563eb; --kpi-bg: #dbeafe; }
.kpi-purple { --kpi-c: #7c3aed; --kpi-bg: #ede9fe; }
.kpi-neutral{ --kpi-c: #64748b; --kpi-bg: #eef2f6; }

.dash-cols { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; margin-bottom: 18px; align-items: start; }
@media (max-width: 900px) { .dash-cols { grid-template-columns: 1fr; } }
.dash-panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-m, 8px); box-shadow: none; padding: 16px 18px; }
.dash-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 8px; }
.dash-panel-head h3 { margin: 0; font-size: 16px; color: var(--brand-dark); }
.dash-empty { color: var(--muted); font-size: 14px; padding: 18px 6px; text-align: center; }
.dash-mini { margin: 0; }
.dash-mini th { font-size: 12px; }
.dash-sec { font-weight: 700; color: var(--brand-dark); font-size: 14px; margin: 18px 0 8px; }
.dash-sec:first-of-type { margin-top: 6px; }
.dash-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.dash-row:last-child { border-bottom: 0; }

/* כרטיסי "ספוט" (הדגשות) */
.spot-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 14px; }
.spot { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); border-inline-start: 5px solid var(--brand); }
.spot-good { border-inline-start-color: #16a34a; }
.spot-bad { border-inline-start-color: #dc2626; }
.spot-warn { border-inline-start-color: #d97706; }
.spot-info { border-inline-start-color: #2563eb; }
.spot-ic { font-size: 24px; flex: 0 0 auto; }
.spot-body { min-width: 0; }
.spot-lbl { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.spot-name { font-size: 15px; font-weight: 800; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spot-val { font-size: 13px; font-weight: 700; color: var(--brand-dark); }

/* ---------- גרף עמודות מגמה ---------- */
.trend { display: flex; align-items: flex-end; gap: 8px; height: 140px; padding-top: 6px; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; min-width: 0; }
.trend-bar { width: 70%; max-width: 44px; background: #9dc1ec; border-radius: 6px 6px 0 0; min-height: 2px; }
.trend-bar.cur { background: var(--brand); }
.trend-val { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.trend-lbl { font-size: 11px; color: var(--muted); white-space: nowrap; }
.trend-val.cur, .trend-lbl.cur { color: var(--brand-dark); font-weight: 700; }
.trend-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.trend-scroll .trend { min-width: 560px; }

/* ---------- לוח נוכחות חודשי (מטריצה צבעונית) ---------- */
table.att-matrix th, table.att-matrix td { padding: 4px 5px; text-align: center; }
table.att-matrix td:first-child, table.att-matrix th:first-child { text-align: right; white-space: nowrap; position: sticky; right: 0; background: var(--card); z-index: 2; }
table.att-matrix thead th:first-child { background: var(--brand-light); z-index: 4; }
.att-cell { width: 21px; height: 21px; border-radius: 5px; display: inline-block; vertical-align: middle; }
.att-cell.present { background: var(--ok); }
.att-cell.absent { background: var(--danger); }
.att-cell.home { background: var(--warn); }
.att-cell.sick { background: #7c3aed; }
.att-cell.none { background: var(--border); opacity: .55; }
.att-legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--muted); margin: 8px 0 12px; }
.att-legend span { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- תגית תעסוקת ערב ---------- */
.ev-pill { display: inline-block; padding: 2px 10px; border-radius: var(--r-s, 4px); font-size: 12.5px; font-weight: 600; background: var(--bg); color: var(--muted); white-space: nowrap; }

/* ---------- טוסטים ---------- */
.toast-wrap { position: fixed; bottom: 18px; left: 18px; z-index: 300; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 9px; background: #1e293b; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; box-shadow: 0 6px 24px rgba(0,0,0,.25); opacity: 0; transform: translateY(12px); transition: opacity .25s, transform .25s; max-width: 340px; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-ic { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; font-size: 12px; font-weight: 800; flex: 0 0 auto; }
.toast-success .toast-ic { background: #16a34a; }
.toast-error .toast-ic { background: #dc2626; }
.toast-info .toast-ic { background: #2563eb; }
@media (max-width: 640px) { .toast-wrap { left: 12px; right: 12px; bottom: 12px; } .toast { max-width: none; } }

/* ---------- הבהוב חיווי שמירה ---------- */
@keyframes save-flash { 0% { color: #16a34a; transform: scale(1.08); } 100% { color: inherit; transform: scale(1); } }
.status .flash { display: inline-block; animation: save-flash 0.9s ease-out; }

/* ---------- שלד טעינה ---------- */
.skeleton { padding: 10px 0; }
.sk-line { height: 16px; border-radius: 8px; margin-bottom: 14px; background: linear-gradient(90deg, #eceff1 25%, #f7f9fa 50%, #eceff1 75%); background-size: 400% 100%; animation: sk-shimmer 1.3s infinite; }
.sk-line.lg { height: 30px; width: 40%; }
.sk-card { height: 90px; border-radius: 12px; margin-bottom: 12px; background: linear-gradient(90deg, #eceff1 25%, #f7f9fa 50%, #eceff1 75%); background-size: 400% 100%; animation: sk-shimmer 1.3s infinite; }
@keyframes sk-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ---------- מיקוד מקלדת ---------- */
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- אזור סכנה (הגדרות) ---------- */
.danger-zone { border: 1px solid #fecaca !important; background: #fef7f7; margin-top: 28px; }
.danger-zone .btn.danger { box-shadow: none; }

/* ---------- מצב-ריק עם פעולה ---------- */
.empty-actions { display: flex; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }

/* לוגו מותאם בתצוגת ההגדרות */
.logo-prev { width: 40px; height: 40px; border-radius: 11px; background: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-size: 22px; overflow: hidden; flex: 0 0 auto; }
.logo-prev img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- תפריט פעולות ⋮ אחיד בכותרות ---------- */
.amenu { position: relative; display: inline-block; }
.amenu-btn { font-weight: 800; font-size: 16px; }
.amenu-pop { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; min-width: 225px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.16); padding: 5px; display: none; z-index: 70; }
.amenu-pop.open { display: block; }
.amenu-item { display: flex; align-items: center; gap: 9px; width: 100%; background: none; border: 0; padding: 9px 11px; border-radius: 8px; font-family: inherit; font-size: 14px; color: var(--text); cursor: pointer; text-align: right; }
.amenu-item:hover { background: var(--bg); }
.amenu-ic { width: 20px; display: inline-flex; justify-content: center; flex: 0 0 auto; }
.amenu-ic .wa-ico { color: #25D366; }
.amenu-ic .xls-ico, .amenu-ic .wa-ico { width: 17px; height: 17px; }
.amenu-sep { height: 1px; background: var(--border); margin: 4px 6px; }

/* מתג מצב לילה — פס מעוגל עם כפתור מחליק בין ☀️ ל-🌙 */
.mode-switch {
  position: relative; width: 54px; height: 28px; flex: 0 0 auto;
  border-radius: 999px; border: 1px solid var(--border); cursor: pointer; padding: 0;
  background: linear-gradient(90deg, #dbeafe, #eef4fa);
  transition: background .35s, border-color .35s;
}
.mode-switch:hover { filter: brightness(1.03); }
.mode-switch .ms-ico { position: absolute; top: 50%; transform: translateY(-50%); font-size: 12px; line-height: 1; transition: opacity .3s; pointer-events: none; }
.mode-switch .ms-sun { inset-inline-start: 7px; opacity: 1; }
.mode-switch .ms-moon { inset-inline-end: 7px; opacity: .45; }
.mode-switch .ms-knob {
  position: absolute; top: 2.5px; inset-inline-start: 3px; width: 21px; height: 21px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35);
  transition: transform .3s cubic-bezier(.45, 1.6, .5, 1);
}
.mode-switch.on { background: linear-gradient(90deg, #1e293b, #33415c); border-color: #33415c; }
.mode-switch.on .ms-knob { transform: translateX(-26px); background: #cbd5e1; }
.mode-switch.on .ms-sun { opacity: .4; }
.mode-switch.on .ms-moon { opacity: 1; }

/* ============ התאמה לנייד ============ */
@media (max-width: 860px) {
  html, body { overflow-x: hidden; }
  .layout { overflow-x: hidden; max-width: 100vw; }
  .sidebar { width: min(290px, 86vw); flex-basis: auto; }

  main { padding: 12px 10px; }

  .page-head { gap: 8px; margin-bottom: 12px; }
  .page-head h2 { font-size: 18px; width: 100%; }
  .page-head .spacer { display: none; }

  .btn { padding: 9px 13px; font-size: 14px; }
  .btn.small { padding: 7px 10px; font-size: 13px; }

  /* טפסים — font-size 16px מונע זום אוטומטי באייפון */
  input, select, textarea { font-size: 16px; padding: 9px 10px; }

  table.grid { font-size: 13px; }
  table.grid th, table.grid td { padding: 7px 8px; }
  table.grid td.actions { white-space: normal; }

  .card { padding: 12px; }
  .totbar { gap: 10px; }
  .totbar .t { padding: 7px 12px; flex: 1 1 40%; }
  .totbar .t b { font-size: 18px; }

  /* כפתורי סימון נוכחות — יעדי מגע גדולים */
  .fbtn { min-height: 38px; padding: 6px 12px; font-size: 14px; }
  .frbtn { width: 36px; height: 36px; }

  .kpi-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .kpi { padding: 12px; gap: 10px; }
  .kpi-val { font-size: 22px; }
  .dash-panel { padding: 14px 12px; }

  .modal { width: 96vw; max-height: 90vh; }
  .modal-body { padding: 14px; }
  .modal-foot { padding: 12px 14px; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .totbar .t { flex: 1 1 100%; }
}

/* דשבורד קומפקטי בנייד */
@media (max-width: 640px) {
  .kpi { padding: 10px 12px; gap: 0; }
  .kpi-ic { display: none; }
  .kpi-sub { display: none; }
  .kpi-val { font-size: 19px; }
  .kpi-lbl { font-size: 11.5px; margin-top: 2px; }
  .kpi-badge { font-size: 10px; padding: 1px 6px; }
  .dash-sec { margin: 12px 0 6px; font-size: 13px; }
}

/* ---------- מצב לילה ---------- */
body.dark {
  color-scheme: dark;
  --brand: #4d82c4;
  --brand-dark: #9dc1ec;
  --brand-light: #1a2a40;
  --accent: #2fb3a5;
  --bg: #0f151c;
  --card: #19222d;
  --border: #2b3946;
  --text: #e7ecf2;
  --muted: #9aa8b6;
  --danger: #f08079;
  --shadow: 0 1px 3px rgba(0,0,0,.55), 0 1px 2px rgba(0,0,0,.4);
  /* חובה לחזור כאן — ערך שהוצב ב-:root לא מתעדכן אוטומטית כשה-brand משתנה */
  --primary: #4d82c4;
  --primary-dark: #9dc1ec;
  --primary-light: #1a2a40;
}
/* רכיבים עם רקע לבן קבוע — עוברים לרקע כרטיס כהה */
body.dark input, body.dark select, body.dark textarea,
body.dark .fbtn, body.dark .frbtn,
body.dark .fadd-item, body.dark .modal, body.dark .login-box { background: var(--card); }
/* כפתורים משניים ותת-טאבים שקופים גם במצב חשוך — הרקע מגיע מהעמוד */
body.dark .btn.secondary { color: var(--text); }
body.dark .btn.secondary:hover { color: var(--brand); }
body.dark input:hover, body.dark select:hover, body.dark textarea:hover { border-color: #46536a; }
body.dark table.grid tr:hover td { background: #1f2a36; }
body.dark table.grid th.sortable:hover, body.dark table.grid th.sorted-col { background: #26323f; color: var(--text); }
body.dark table.grid td.sorted-col { background: #1c2733; }
body.dark .cls-track, body.dark .sk-line, body.dark .sk-card { background: #232e3a; }
body.dark .field-student.done { background: #17281c; }
body.dark .field-student.absent { background: #35211f; }
body.dark .field-student.home { background: #33291a; }
body.dark .field-student.sick { background: #261f33; }
body.dark input.invalid, body.dark select.invalid, body.dark textarea.invalid { background: #3a2020; }
body.dark .danger-zone { background: #2a1d1d; }
/* רקעים בהירים קבועים — טקסט כהה כדי להישאר קריא */
body.dark .kpi-badge.up, body.dark .ds-report.done, body.dark .tl-green,
body.dark .ds-report.wait, body.dark .tl-orange { color: #1c2733; }

/* ---------- ניהול עובדים (emp.js / week.js) ---------- */
.def-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px 20px; }
.def-item label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.def-item .def-val { font-size: 15px; display: flex; align-items: center; }
.cards-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.wdays { display: flex; gap: 8px; flex-wrap: wrap; }
.wday { min-width: 44px; padding: 8px 0; text-align: center; border: 1px solid var(--border); border-radius: 8px; background: var(--card); cursor: pointer; font-weight: 600; font-family: inherit; font-size: 15px; color: var(--text); }
.wday:hover { border-color: var(--brand); }
.wday.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.wday:disabled { cursor: default; opacity: .7; }
.wd-mini { font-size: 13px; color: var(--brand-dark); font-weight: 600; letter-spacing: 1px; }
.week-grid td.wd-cell { text-align: center; color: #bbb; }
.week-grid td.wd-cell.on { background: var(--brand-light); color: var(--brand-dark); font-weight: 700; }
body.dark .week-grid td.wd-cell.on { background: rgba(77, 130, 196, .18); color: #9ec5f0; }
body.dark .wd-mini { color: #9ec5f0; }
.whours { display: flex; flex-direction: column; gap: 6px; max-width: 420px; }
.whour-row { display: flex; align-items: center; gap: 10px; }
.whour-row .wday { min-width: 44px; flex-shrink: 0; }
.whour-times { display: inline-flex; align-items: center; gap: 6px; }
.whour-times input[type=time] { width: 110px; padding: 6px 8px; }
.whour-times input:disabled { opacity: .45; }
.week-grid td.wd-cell.on { font-size: 13px; white-space: nowrap; }

/* ============================================================
   שדרוג "מודרני" בסגנון Monday — טבלאות, סטטוסים, אווטארים
   ============================================================ */

/* m-grid — הסגנון עבר לבסיס table.grid; המחלקה נשמרת לתאימות בקוד קיים */

/* --- תא סטטוס בסגנון Monday: כל התא צבוע, טקסט לבן מודגש --- */
.m-status {
  appearance: none; -webkit-appearance: none;
  width: 100%; min-width: 104px; border: 0; border-radius: var(--r-s);
  padding: 9px 10px; text-align: center; text-align-last: center;
  color: #fff; font-weight: 700; font-size: 13px; font-family: inherit;
  cursor: pointer; transition: filter .12s ease; box-shadow: var(--sh-xs);
}
/* גרסת שורת-כותרת: רוחב לפי תוכן, כדי שהסטטוס לא ידחוף כפתורים לשורה חדשה */
.m-status.m-status-auto { width: auto; min-width: 110px; padding: 6px 12px; }
.m-status:hover { filter: brightness(1.07); }
.m-status:focus { outline: 2px solid rgba(0,0,0,.25); outline-offset: 1px; }
.m-status option { background: #fff; color: var(--text); font-weight: 600; }

/* --- אווטאר עגול עם ראשי תיבות --- */
.m-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; letter-spacing: .3px;
  box-shadow: var(--sh-xs); user-select: none;
}
.m-owner { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; border-radius: 999px; padding: 3px 8px 3px 3px; transition: background .12s ease; }
.m-owner:hover { background: var(--brand-light); }
.m-owner .m-oname { font-size: 13px; font-weight: 600; }
.m-owner.empty { color: var(--muted); font-size: 12px; border: 1px dashed var(--border); padding: 5px 10px; }

/* --- פעולות שורה: מופיעות בריחוף --- */
.m-actions { display: flex; gap: 4px; opacity: 0; transition: opacity .12s ease; }
tr:hover .m-actions, .m-actions:focus-within { opacity: 1; }
@media (hover: none) { .m-actions { opacity: 1; } }
.m-iconbtn {
  border: 1px solid transparent; background: transparent; cursor: pointer;
  width: 30px; height: 30px; border-radius: var(--r-s); font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s ease, border-color .12s ease;
}
.m-iconbtn:hover { background: #eef2f7; border-color: var(--border); }

/* --- כותרת קבוצה עם פס צבע (Monday groups) --- */
.m-group {
  display: flex; align-items: center; gap: 10px; margin: var(--sp-l) 0 var(--sp-s);
  font-weight: 700; font-size: 15px; cursor: pointer; user-select: none;
  background: none; border: 0; font-family: inherit; padding: 4px 2px; width: 100%; text-align: right;
}
.m-group .m-gbar { width: 5px; height: 20px; border-radius: 3px; flex: 0 0 auto; }
.m-group .m-gcount { font-size: 12px; font-weight: 600; color: var(--muted); background: #eef2f7; border-radius: var(--r-s, 4px); padding: 2px 10px; }
.m-group:hover .m-gname { text-decoration: underline; }

/* --- עמודת עדיפות כגלולה צבעונית --- */
.m-prio {
  appearance: none; -webkit-appearance: none; border: 0; border-radius: var(--r-s, 4px);
  padding: 6px 14px; font-size: 12px; font-weight: 700; font-family: inherit;
  cursor: pointer; text-align: center; text-align-last: center; min-width: 78px;
}
.m-prio option { background: #fff; color: var(--text); }

/* --- תת-משימות (Subitems) --- */
.m-chev {
  border: 0; background: none; cursor: pointer; color: #b6c0cc;
  width: 20px; height: 24px; flex: 0 0 auto; font-size: 12px; padding: 0;
  border-radius: var(--r-s); transition: color .12s ease, background .12s ease;
}
.m-chev:hover { background: #eef2f7; color: var(--brand); }
.m-chev.has { color: var(--brand); font-weight: 700; }
.m-chev.open { color: var(--brand-dark); }
.m-rollup {
  display: inline-flex; align-items: center; gap: 6px; margin: 2px 0 0 6px;
  font-size: 11.5px; font-weight: 700; color: var(--brand-dark);
  border: 1px solid var(--border); border-radius: var(--r-s, 4px); padding: 2px 9px; background: #fbfcfd;
}
.m-rbar { width: 40px; height: 5px; border-radius: 3px; background: #e2e7ec; overflow: hidden; display: inline-block; }
.m-rbar > span { display: block; height: 100%; border-radius: 3px; }
tr.m-subrow > td { background: #f7f9fc; padding: 4px 14px 14px !important; border-bottom: 1px solid var(--border); }
.m-subwrap { border-inline-start: 3px solid var(--brand); padding-inline-start: 12px; margin-top: 2px; }
table.m-subgrid { box-shadow: none; }
table.m-subgrid th { background: transparent; font-size: 11px; padding: 6px 10px; }
table.m-subgrid td { height: 40px; padding: 4px 10px; }

/* --- שורת "+ הוספה" בתחתית קבוצה --- */
.m-addrow { margin: 6px 0 2px; }
.m-addinput {
  width: 100%; max-width: 460px; border: 1px dashed var(--border); background: transparent;
  border-radius: var(--r-m); padding: 10px 14px; font-family: inherit; font-size: 14px;
  color: var(--text); transition: border-color .12s ease, background .12s ease;
}
.m-addinput::placeholder { color: var(--muted); }
.m-addinput:hover { border-color: var(--brand); background: #fff; }
.m-addinput:focus { outline: none; border-style: solid; border-color: var(--brand); background: #fff; box-shadow: var(--sh-xs); }

/* --- סרגל כלים קומפקטי (חיפוש + סינון + מיון + קיבוץ) --- */
.m-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.m-search {
  min-width: 210px; flex: 0 1 260px; border: 1px solid var(--border); border-radius: var(--r-m);
  padding: 9px 13px; font-family: inherit; font-size: 14px; background: var(--card);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.m-search:focus { outline: none; border-color: var(--brand); box-shadow: var(--sh-xs); }
.m-popbtn { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.m-popbtn.on { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-light); font-weight: 700; }
.m-badge {
  background: var(--brand); color: #fff; border-radius: 999px; font-size: 11px;
  font-weight: 700; min-width: 18px; height: 18px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
}
.m-pop { position: relative; }
.m-poppanel { min-width: 250px; padding: 12px; }
.m-popsec { margin-bottom: 10px; }
.m-popsec > label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.m-popsec select { width: 100%; }
.m-popitem {
  display: block; width: 100%; text-align: right; background: none; border: 0;
  padding: 9px 12px; border-radius: var(--r-m); font-family: inherit; font-size: 14px;
  color: var(--text); cursor: pointer;
}
.m-popitem:hover { background: var(--bg); }
.m-popitem.on { background: var(--brand-light); color: var(--brand-dark); font-weight: 700; }
.m-duechip {
  border: 1px solid var(--border); background: #fff; border-radius: var(--r-s, 4px);
  padding: 5px 11px; font-size: 12px; font-family: inherit; cursor: pointer; color: var(--text);
}
.m-duechip:hover { border-color: var(--brand); }
.m-duechip.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }

/* צ'יפים של סינונים פעילים */
.m-chiprow { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 0 0 12px; }
.m-fchip {
  background: var(--brand-light); color: var(--brand-dark); border: 1px solid var(--brand);
  border-radius: var(--r-s, 4px); padding: 4px 12px; font-size: 12.5px; font-weight: 600;
  font-family: inherit; cursor: pointer; transition: filter .12s ease;
}
.m-fchip:hover { filter: brightness(.95); }
.m-clearall { background: none; border: 0; color: var(--muted); font-size: 12.5px; font-family: inherit; cursor: pointer; text-decoration: underline; padding: 4px 6px; }
.m-clearall:hover { color: var(--danger); }

/* ============================================================
   התאמות נייד — פאנלים, סרגלים וטבלאות
   ============================================================ */
@media (max-width: 640px) {
  /* פאנלים נפתחים (סינון/מיון/קיבוץ/⋮) — לא נחתכים מחוץ למסך */
  .amenu-pop {
    position: fixed; inset-inline: 12px; top: auto; min-width: 0; width: auto;
    max-height: 65vh; overflow-y: auto; box-shadow: 0 -6px 30px rgba(0,0,0,.28);
    border-radius: var(--r-b);
  }
  .amenu-pop.open { display: block; }
  .m-poppanel { padding: 14px; }
  .m-popsec select { padding: 11px 12px; font-size: 15px; }
  .m-popitem { padding: 12px; font-size: 15px; }
  .m-duechip { padding: 8px 13px; font-size: 13px; }

  /* סרגל הכלים — שורה אחת נגללת במקום לגלוש לשורות רבות */
  .m-toolbar { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .m-toolbar::-webkit-scrollbar { height: 0; }
  .m-search { flex: 1 0 150px; min-width: 150px; }
  .m-popbtn { flex: 0 0 auto; padding: 8px 11px; font-size: 13px; }

  /* טאבים ותת-טאבים — גלילה אופקית במקום שבירה */
  .subtabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .subtabs::-webkit-scrollbar { height: 0; }
  .subtabs button { flex: 0 0 auto; white-space: nowrap; }

  /* כרטיסי הסיכום — נגללים במקום להצטופף */
  .kpi-row { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .kpi-row::-webkit-scrollbar { height: 0; }
  .kpi { flex: 0 0 auto; }

  /* הוספה מהירה — רק תיאור + כפתור */
  .m-quickadd .m-qa-extra { display: none !important; }
  .m-quickadd input:first-child { flex: 1 1 100%; }

  /* טבלה — שורות נמוכות מעט וריפוד קטן יותר */
  table.grid td { padding: 6px 10px; height: 44px; }
  table.grid th { padding: 8px 10px; }
  .m-addinput { max-width: none; }
}

/* ============================================================
   מצב חושך — תיקון הרכיבים החדשים (m-*) שהיו בצבעים בהירים קשיחים
   ============================================================ */
body.dark table.grid { border-color: var(--border); }
body.dark table.grid th { background: #1f2a36; color: var(--muted); border-bottom-color: var(--border); }
body.dark table.grid td { border-bottom-color: #222d3a; }
body.dark table.grid tbody tr:hover td { background: #1f2a36; }
body.dark .m-iconbtn:hover { background: #26323f; border-color: var(--border); }
body.dark .m-group .m-gcount { background: #26323f; color: var(--muted); }
body.dark .m-chev { color: #64748b; }
body.dark .m-chev:hover { background: #26323f; color: var(--brand-dark); }
body.dark .m-rollup { background: #1f2a36; border-color: var(--border); color: var(--brand-dark); }
body.dark .m-rbar { background: #2b3946; }
body.dark tr.m-subrow > td { background: #16202b; border-bottom-color: var(--border); }
body.dark table.m-subgrid th { background: transparent; }
body.dark .m-duechip { background: var(--card); color: var(--text); border-color: var(--border); }
body.dark .m-duechip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
body.dark .m-addinput { border-color: var(--border); color: var(--text); }
body.dark .m-addinput:hover, body.dark .m-addinput:focus { background: var(--card); border-color: var(--brand); }
body.dark .m-search { background: var(--card); color: var(--text); border-color: var(--border); }
body.dark .m-owner:hover { background: #26323f; }
body.dark .m-popitem { color: var(--text); }
body.dark .m-popitem:hover { background: #26323f; }
body.dark .m-clearall { color: var(--muted); }

/* מצבי שורה (איחור / הושלם) — כמחלקות, כדי שיתהפכו נכון בחושך */
table.grid tbody tr.row-over > td { background: #fef2f2; }
table.grid tbody tr.row-done > td { background: var(--brand-light); }
table.grid tbody tr.row-over:hover > td { background: #fde8e8; }
table.grid tbody tr.row-done:hover > td { background: var(--brand-light); }
body.dark table.grid tbody tr.row-over > td { background: #3a2126; }
body.dark table.grid tbody tr.row-over:hover > td { background: #46272c; }
body.dark table.grid tbody tr.row-done > td { background: #17281c; }
body.dark table.grid tbody tr.row-done:hover > td { background: #1c3123; }

/* --- מצב חושך: כרטיסי סיכום (KPI) — הרקעים הפסטליים היו בהירים קבועים,
       מה שיצר אייקון בהיר על רקע בהיר (בלתי קריא). --- */
/* הנקודה בהירה יותר במצב חשוך כדי לשמור על ניגודיות */
body.dark .kpi-good    { --kpi-c: #4ade80; }
body.dark .kpi-bad     { --kpi-c: #f87171; }
body.dark .kpi-warn    { --kpi-c: #fbbf24; }
body.dark .kpi-info    { --kpi-c: #60a5fa; }
body.dark .kpi-purple  { --kpi-c: #a78bfa; }
body.dark .kpi-neutral { --kpi-c: #94a3b8; }
body.dark .kpi-badge.down { background: #3a1f22; color: #f08079; }
body.dark .kpi-badge.flat { background: #26323f; color: var(--muted); }

/* ===== בטיחות ורישוי ===== */
/* שורת "רישיון מוסד" הראשית — המטרה שכל שאר האישורים משרתים */
table.grid tr.sf-main > td { font-weight: 600; background: var(--brand-light); }
table.grid tr.sf-main > td:first-child { box-shadow: inset -3px 0 0 var(--brand); }
.sf-link {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 500;
  color: var(--brand); text-align: right; text-decoration: underline;
}
.sf-link:hover { color: var(--brand-dark); }
/* רקע לפי מצב — גם במצב חשוך */
table.grid tr.sf-expired > td { background: #fef2f2; }
table.grid tr.sf-soon > td    { background: #fffbeb; }
table.grid tr.sf-na   > td    { opacity: .55; }
body.dark table.grid tr.sf-expired > td { background: #3a1f22; }
body.dark table.grid tr.sf-soon > td    { background: #362b16; }

/* ===== דשבורד מנהלים ===== */
.dash-cards {
  display: grid; gap: 16px; margin-top: 16px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  align-items: start;
}
.dash-line {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.dash-line:last-child { border-bottom: 0; }
.dash-hero {
  background: var(--brand-light); border-radius: var(--r-m, 8px);
  padding: 12px; margin-bottom: 8px;
}
.dash-bar {
  height: 8px; border-radius: 999px; background: var(--border); overflow: hidden;
}
.dash-bar > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.dash-clear {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px; border-color: #16a34a44; background: #f0fdf4;
}
body.dark .dash-clear { background: #16281c; border-color: #16a34a55; }

/* ===== בורר תאריך/חודש מעוצב (מחליף את לוח השנה של הדפדפן) ===== */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator { pointer-events: none; }
.dp {
  position: fixed; z-index: 120; min-width: 268px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-m, 8px); box-shadow: 0 12px 32px rgba(0,0,0,.16);
  padding: 12px; user-select: none;
}
.dp-head { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.dp-title { flex: 1; text-align: center; font-weight: 600; font-size: 15px; }
.dp-nav {
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: var(--r-s, 4px); cursor: pointer; color: var(--muted);
}
.dp-nav svg { width: 18px; height: 18px; }
.dp-nav:hover { background: var(--brand-light); color: var(--brand); }
.dp-wd, .dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-wd { margin-bottom: 4px; }
.dp-wd span { text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; }
.dp-day {
  height: 32px; display: flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: var(--r-s, 4px);
  font: inherit; font-size: 14px; color: var(--text); cursor: pointer;
}
.dp-day:hover { background: var(--brand-light); }
.dp-day.today { box-shadow: inset 0 0 0 1px var(--brand); font-weight: 600; }
.dp-day.on { background: var(--brand); color: #fff; font-weight: 600; }
.dp-empty { cursor: default; }
.dp-months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.dp-mon {
  padding: 8px 4px; background: none; border: 0; border-radius: var(--r-s, 4px);
  font: inherit; font-size: 13px; color: var(--text); cursor: pointer;
}
.dp-mon:hover { background: var(--brand-light); }
.dp-mon.today { box-shadow: inset 0 0 0 1px var(--brand); }
.dp-mon.on { background: var(--brand); color: #fff; font-weight: 600; }
.dp-foot {
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border);
}
.dp-link {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 500; color: var(--brand);
}
.dp-link:hover { text-decoration: underline; }
.dp.dp-sheet {
  top: auto; right: 50%; bottom: 12px; transform: translateX(50%);
  width: min(320px, calc(100vw - 24px));
}
.dash-title {
  display: flex; align-items: center; gap: 6px;
  margin: 0 0 8px; font-size: 16px; cursor: pointer; color: var(--text);
}
.dash-title:hover { color: var(--brand); }
.dash-chev { display: flex; color: var(--muted); }
.dash-chev svg { width: 16px; height: 16px; }
.dash-title:hover .dash-chev { color: var(--brand); }

/* ===== תגיות עובד — צבע לכל תגית ===== */
.tag.tg-a { --tgc: #2563eb; --tgbg: #dbeafe; }   /* מורה */
.tag.tg-b { --tgc: #7c3aed; --tgbg: #ede9fe; }   /* פנימיה */
.tag.tg-c { --tgc: #0d9488; --tgbg: #ccfbf1; }   /* מנהלה */
.tag.tg-d { --tgc: #d97706; --tgbg: #fef3c7; }   /* מתגבר */
.tag.tg-x { --tgc: #64748b; --tgbg: #eef2f6; }
.tag[class*="tg-"] {
  background: var(--tgbg); border-color: color-mix(in srgb, var(--tgc) 35%, transparent);
  color: var(--tgc); font-weight: 600;
}
.tag[class*="tg-"].on { background: var(--tgc); color: #fff; border-color: var(--tgc); }
body.dark .tag.tg-a { --tgbg: #17263f; --tgc: #7aa7f0; }
body.dark .tag.tg-b { --tgbg: #241d3d; --tgc: #b9a2f5; }
body.dark .tag.tg-c { --tgbg: #10302c; --tgc: #58c8bb; }
body.dark .tag.tg-d { --tgbg: #35270f; --tgc: #e8ab4b; }
body.dark .tag.tg-x { --tgbg: #26323f; --tgc: #9aa6b8; }
body.dark .tag[class*="tg-"].on { color: #0f1620; }

/* ===== ידית גרירה לשורות טבלה ===== */
.row-grip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 26px; color: var(--muted); cursor: grab; opacity: .55;
}
.row-grip:hover { opacity: 1; color: var(--brand); }
tr.row-drag { opacity: .4; }
tr.row-drop-before td { box-shadow: inset 0 2px 0 var(--brand); }

/* ===== שדה עם סיומת קבועה (%, ₪) ===== */
.suffix-field { display: inline-flex; align-items: center; gap: 2px; }
.suffix-field > .sfx { color: var(--muted); font-size: 13px; font-weight: 600; }

/* ===== כפתורי סעיף בכרטיס אירוע (לו"ז · משימות · אישורי הורים) ===== */
.m-sec {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-s, 4px);
  padding: 7px 12px; min-height: 32px;
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.m-sec:hover { border-color: var(--brand); color: var(--brand); }
.m-sec.open {
  background: var(--brand-light); border-color: var(--brand); color: var(--brand-dark);
}
.m-sec-ic { display: inline-flex; color: var(--brand); }
.m-sec.open .m-sec-ic { color: var(--brand-dark); }
.m-sec-chev { display: inline-flex; color: var(--muted); transition: transform .15s ease; }
.m-sec-chev svg { width: 14px; height: 14px; }
.m-sec.open .m-sec-chev { transform: rotate(-90deg); color: var(--brand-dark); }

/* צ'יפ טווח שעות — האייקון של הצ'יפ מספיק, בלי השעונים של הדפדפן */
.range-chip input[type="time"]::-webkit-calendar-picker-indicator { display: none; }
.range-chip input[type="time"] { min-width: 62px; }

/* ===== כרטיס אירוע ===== */
/* בנייד: השם תופס שורה משלו, והסטטוס + הארכיון יורדים יחד לשורה הבאה */
@media (max-width: 640px) {
  .ev-head > .spacer { flex: 1 0 100%; height: 0; margin: 0; }
  .ev-head input { flex: 1 1 100%; min-width: 0; }
}
.ev-sumrow { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 13px; color: var(--muted); }
.ev-sum { display: inline-flex; align-items: center; gap: 5px; }
.ev-sum svg { width: 14px; height: 14px; opacity: .8; }

/* ===== סרגל עליון — צ'יפ המשתמש בסגנון האפליקציה ===== */
.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-s, 4px);
  padding: 3px 10px 3px 4px; min-height: 32px; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--text);
  transition: border-color .12s ease, background .12s ease;
}
.user-chip:hover { border-color: var(--brand); }
.user-ini {
  width: 24px; height: 24px; border-radius: 50%; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .3px;
}
.user-nm { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.um-item svg { display: inline-block !important; width: 15px; height: 15px; vertical-align: -3px; margin-inline-end: 6px; }
.usermenu-pop { border-radius: var(--r-m, 8px); }

/* מודאל רחב — לדוחות טבלאיים (דוח שעות חודשי) */
.modal.modal-wide { width: min(860px, 96vw); }
/* ===== דוח שעות חודשי (עבודה בזמן מילואים) ===== */
.mil-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.mil-tbl th, .mil-tbl td { border: 1px solid var(--border); padding: 3px 6px; text-align: center; }
.mil-tbl th { background: var(--bg); font-weight: 600; font-size: 12px; position: sticky; top: 0; z-index: 1; }
.mil-tbl td.mil-day { font-weight: 600; width: 34px; }
.mil-tbl td.mil-date { width: 62px; white-space: nowrap; }
.mil-tbl input { width: 100%; border: 1px solid transparent; background: transparent; padding: 3px 4px; text-align: center; font-size: 13px; }
.mil-tbl input:focus { background: var(--card); border-color: var(--brand); }
.mil-tbl input[type="time"] { min-width: 74px; }
.mil-tbl input[type="time"]::-webkit-calendar-picker-indicator { display: none; }
.mil-tbl tr.mil-rest td { background: var(--bg); color: var(--muted); }
.mil-tbl tr.mil-duty td { background: #eef4fd; }
.mil-tbl td.mil-sum { font-weight: 600; color: var(--brand-dark); width: 58px; }
.mil-foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 15px; font-weight: 600; }
body.dark .mil-tbl tr.mil-duty td { background: #16233a; }

/* ===== ניהול תקציב ===== */
.b-sheet td, .b-sheet th { vertical-align: middle; }
tr.b-main td { background: var(--brand-light); font-weight: 700; }
tr.b-grand td { background: var(--bg); font-weight: 700; border-top: 2px solid var(--border); }
.b-link {
  background: none; border: 0; padding: 0; cursor: pointer; font: inherit;
  font-weight: 500; color: var(--text); text-align: right;
}
.b-link:hover { color: var(--brand); }
.b-chev { color: var(--muted); font-size: 11px; }
/* פס ניצול עם סמן "איפה היינו אמורים להיות" */
.bpb { position: relative; height: 16px; min-width: 120px; border-radius: 999px; background: var(--border); overflow: hidden; }
.bpb-fill { height: 100%; border-radius: 999px; }
.bpb.pb-green .bpb-fill { background: #16a34a; }
.bpb.pb-orange .bpb-fill { background: #d97706; }
.bpb.pb-red .bpb-fill { background: #dc2626; }
.bpb-marker { position: absolute; top: -2px; width: 2px; height: 20px; background: var(--text); opacity: .55; }
.bpb-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.35); }
/* פיזור חודשי — 12 חודשים בשש עמודות (חצי שנה בכל שורה), כך שהרשת תמיד יוצאת שלמה.
   auto-fill נתן 9 עמודות ועוד שורה של 3 יתומים, וזה נראה שבור. */
.b-months { display: grid; gap: 8px; grid-template-columns: repeat(6, 1fr); }
@media (max-width: 1180px) { .b-months { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 820px)  { .b-months { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px)  { .b-months { grid-template-columns: repeat(2, 1fr); } }
.b-month {
  border: 1px solid var(--border); border-radius: var(--r-m, 8px);
  background: var(--card); padding: 8px 8px 7px; font-size: 12px; text-align: center;
}
.b-month.over { border-color: #dc2626; background: #fef2f2; }
body.dark .b-month.over { background: #3a1f22; }
.b-month-lbl { font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 3px; }
/* התכנון — המספר הראשי בריבוע */
.b-month-plan { font-size: 15px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
/* פס דק: כמה מהתכנון כבר נוצל באותו חודש */
.b-mbar { height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; margin: 6px 0 5px; }
.b-mbar > span { display: block; height: 100%; border-radius: 2px; background: var(--brand); }
.b-month.over .b-mbar > span { background: #dc2626; }
.b-month-act { font-size: 11px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.b-month.over .b-month-act { color: #b91c1c; font-weight: 600; }
/* גרף תוכנן מול בפועל */
.b-chart { display: flex; gap: 6px; align-items: flex-end; height: 170px; overflow-x: auto; padding-bottom: 4px; }
.b-bar-col { flex: 1 1 42px; min-width: 42px; display: flex; flex-direction: column; align-items: center; height: 100%; }
.b-bars { flex: 1; display: flex; align-items: flex-end; gap: 3px; width: 100%; }
.b-bar { flex: 1; border-radius: 3px 3px 0 0; min-height: 2px; }
.b-bar.plan { background: #94a3b8; }
.b-bar.act { background: var(--brand); }
.b-bar.act.over { background: #dc2626; }
.b-bar-lbl { font-size: 10px; color: var(--muted); margin-top: 4px; white-space: nowrap; }
.b-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; }
.b-key.plan { background: #94a3b8; }
.b-key.act { background: var(--brand); }
.b-chevbtn { background: none; border: 0; padding: 2px 4px; cursor: pointer; color: var(--muted); }
.b-chevbtn:hover { color: var(--brand); }
tr.b-add td { background: var(--bg); padding: 4px 0; }
tr.b-add button { display: inline-flex; align-items: center; gap: 6px; }
tr.b-add button svg { width: 14px; height: 14px; }

/* ===== קולות קוראים — מסלול, צ'ק-ליסט ומסמך ===== */
/* פס השלבים: הגשה → מימוש → דיווח. שטוח, מסגרת דקה, הצבע רק על השלב הנוכחי. */
.kk-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
@media (max-width: 640px) { .kk-steps { grid-template-columns: 1fr; } }
.kk-step {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); border-radius: var(--r-m, 8px);
  background: var(--card); padding: 10px 12px;
}
.kk-step-n {
  width: 24px; height: 24px; flex: 0 0 auto; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg); color: var(--muted); font-size: 12px; font-weight: 700;
}
.kk-step-lbl { font-weight: 600; font-size: 14px; color: var(--muted); }
.kk-step-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.kk-step.done .kk-step-n { background: #dcfce7; color: #166534; }
.kk-step.done .kk-step-lbl { color: var(--text); }
.kk-step.cur { border-color: var(--brand); box-shadow: var(--sh-xs); }
.kk-step.cur .kk-step-n { background: var(--brand); color: #fff; }
.kk-step.cur .kk-step-lbl { color: var(--brand-dark); }
body.dark .kk-step.done .kk-step-n { background: #17281c; color: #4ade80; }

/* כותרת רשימת המשימות + פס התקדמות */
.kk-steps-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.kk-prog { display: inline-block; width: 90px; height: 5px; border-radius: 3px; background: var(--border); overflow: hidden; }
.kk-prog > span { display: block; height: 100%; border-radius: 3px; background: #16a34a; }

/* שורת משימה */
.kk-tasks { display: flex; flex-direction: column; }
.kk-task { border-bottom: 1px solid var(--border); padding: 8px 0; }
.kk-task:last-child { border-bottom: 0; }
.kk-task-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kk-task-head input[type="checkbox"] { width: 17px; height: 17px; flex: 0 0 auto; accent-color: var(--brand); cursor: pointer; }
.kk-task-title { flex: 1 1 200px; min-width: 0; font-size: 14px; }
.kk-task.done .kk-task-title { text-decoration: line-through; color: var(--muted); }
.kk-task-hint { font-size: 12.5px; color: var(--muted); line-height: 1.6; padding: 4px 27px 2px; }
.kk-task-help { padding: 6px 27px 2px; }
.m-iconbtn.on { background: var(--brand-light); color: var(--brand-dark); }
.kk-empty { padding: 18px 6px 10px; text-align: center; }

/* שורת הכסף המצומצמת בשלב הדיווח */
.kk-strip { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.kk-strip-c { min-width: 84px; }
.kk-strip-v { font-size: 18px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.kk-strip-l { font-size: 12px; color: var(--muted); }
.kk-chip { cursor: pointer; border: 1px solid var(--brand); background: var(--brand-light); color: var(--brand-dark); font-family: inherit; text-decoration: none; }
.kk-chip:hover { filter: brightness(.97); }
/* ידית גרירה למשימות קול קורא — גרירה חיה, לכן touch-action:none כדי שהעמוד לא יגלול */
.kk-grip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 24px; flex: 0 0 auto; color: var(--muted);
  cursor: grab; opacity: .45; touch-action: none;
}
.kk-grip:hover { opacity: 1; color: var(--brand); }
.kk-grip svg { width: 16px; height: 16px; }
.kk-task.kk-dragging {
  background: var(--brand-light); border-radius: var(--r-s, 4px);
  box-shadow: var(--sh-s); position: relative; z-index: 2;
}
.kk-task.kk-dragging .kk-grip { cursor: grabbing; opacity: 1; color: var(--brand); }
/* אייקון עזרה שכבר יש מאחוריו תוכן */
.m-iconbtn.has { color: var(--brand); }
.m-iconbtn svg { width: 16px; height: 16px; }
