/* הגופן מוטמע בתיקייה ולא מסתמך על התקנה במערכת: התקנה ברמת משתמש
   (בלי הרשאות מנהל) לא תמיד נראית לדפדפן, ובלי זה הממשק היה נופל ל-Segoe UI. */
@font-face {
  font-family: "Varela Round";
  src: url("fonts/VarelaRound-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ===== ערכת נושא =====
   כל המראה של האפליקציה נשלט מהמשתנים שלמטה. לשינוי הגופן די להחליף
   את --font בשורה אחת; ראו את הערת ההסבר שמעל ההגדרה. */
:root {
  /* גופן הממשק. הדפדפן לוקח את הראשון שמותקן במחשב, ולכן אפשר לרשום
     כמה אפשרויות בזו אחר זו. גופנים עבריים נעימים: Rubik, Assistant,
     Heebo, Alef, Varela Round. אם הגופן אינו מותקן — ראו את הסעיף
     "עיצוב וגופנים" ב-README. */
  --font: "Varela Round", "Rubik", "Assistant", "Segoe UI", system-ui, "Arial Hebrew", Arial, sans-serif;
  --font-size: 14px;

  /* Varela Round קיים במשקל אחד בלבד. כדי לא להישען על "מודגש" מזויף
     שהדפדפן מייצר, ההיררכיה נבנית מגודל וצבע. --weight-strong מרוכז כאן
     כדי שהחלפה לגופן עם משקלים אמיתיים תדרוש שינוי בשורה אחת. */
  --weight-strong: 400;

  /* פלטה רגועה: נייטרלים חמימים במקום אפור כחלחל, ומבטא עמום ולא זועק */
  --bg: #f3f2ef;
  --surface: #ffffff;
  --surface-2: #f9f8f6;
  --border: #eceae5;
  --border-strong: #dcd9d2;
  --text: #2b2e33;
  --text-dim: #71757d;
  --text-faint: #a6a8ad;
  --accent: #52789e;
  --accent-soft: #eaf0f6;
  --danger: #c0574f;
  --danger-soft: #f9ecea;
  --warn: #b8801f;
  --warn-soft: #faf1de;
  --shadow-sm: 0 1px 2px rgba(43, 46, 51, .04);
  --shadow-md: 0 2px 10px rgba(43, 46, 51, .07);
  --shadow-lg: 0 16px 44px rgba(43, 46, 51, .16);
  --radius: 14px;
  --radius-sm: 10px;
  --gutter-w: 62px;

  /* קווי הלוח: שעה עגולה כהה, חצי שעה אפור ברור, רבע שעה עדין */
  --grid-hour: #c4c0b8;
  --grid-half: #dbd7d0;
  --grid-faint: #eeece7;
  /* גוון הזמן שכבר חלף */
  --past-shade: rgba(120, 120, 124, .10);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17181a;
    --surface: #1f2124;
    --surface-2: #26282c;
    --border: #2e3135;
    --border-strong: #3f4348;
    --text: #e6e5e2;
    --text-dim: #9ca0a6;
    --text-faint: #6d7178;
    --accent: #7fa3c9;
    --accent-soft: #222c36;
    --danger: #d9756c;
    --danger-soft: #352422;
    --warn: #cfa254;
    --warn-soft: #332a1c;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .25);
    --shadow-md: 0 2px 10px rgba(0, 0, 0, .35);
    --shadow-lg: 0 16px 44px rgba(0, 0, 0, .5);
    --grid-hour: #4a4e54;
    --grid-half: #3a3e43;
    --grid-faint: #2c2f33;
    --past-shade: rgba(0, 0, 0, .22);
  }
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  font-size: var(--font-size);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

h1, h2, h3 { margin: 0; font-weight: var(--weight-strong); }

/* ===== רכיבי בסיס ===== */
.btn {
  font: inherit;
  font-size: 13px;
  padding: 8px 15px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background .14s, border-color .14s;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: var(--weight-strong);
}
.btn-primary:hover { filter: brightness(1.08); background: var(--accent); border-color: var(--accent); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn-danger { color: var(--danger); border-color: var(--border); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-sm { padding: 4px 9px; font-size: 12px; }

.icon-btn {
  font: inherit;
  font-size: 17px;
  line-height: 1;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }

.input {
  font: inherit;
  font-size: 13px;
  width: 100%;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  transition: background .14s, border-color .14s;
}
.input:hover { border-color: var(--border); }
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); background: var(--surface); }
.input-sm { padding: 5px 7px; font-size: 12px; }
textarea.input { resize: vertical; min-height: 74px; line-height: 1.55; }
/* גדל לפי התוכן — גרירה ידנית תתנגש עם החישוב האוטומטי */
textarea.is-autogrow { resize: none; overflow-y: hidden; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}
.checkbox-row input { accent-color: var(--accent); margin: 0; }

/* ===== סרגל עליון ===== */
.topbar {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  height: 58px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 20;
}

/* מתג הרחבת הלוח יושב במרכז הסרגל, ללא תלות ברוחב האלמנטים משני צדיו */
#toggle-wide {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 15px;
}
.topbar-side { display: flex; align-items: center; gap: 6px; min-width: 0; }
/* השם תופס את כל המרווח הפנוי, וכך ניווט התאריכים נדחף שמאלה וצמוד לכפתורים */
.topbar-side:first-child { flex: 1 1 auto; }
.topbar-actions { flex: 0 0 auto; justify-content: flex-end; }
.brand-logo { flex: none; display: block; width: 28px; height: 28px; border-radius: 8px; }
.brand { font-size: 16px; letter-spacing: .01em; white-space: nowrap; }

.date-nav { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; margin-inline-end: 10px; }
.date-display { position: relative; display: flex; align-items: center; }
#date-label {
  font-weight: var(--weight-strong);
  font-size: 13.5px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  cursor: pointer;
}
#date-label:hover { background: var(--surface-2); }
#date-picker {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  font: inherit;
  border: 0;
  width: 100%;
}

/* ===== פריסה ===== */
.layout {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  gap: 1px;
  background: var(--border);
}

/* --- מאגר --- */
.pool {
  flex: 0 0 990px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
}
.pool-head {
  flex: none;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.pool-title-row { display: flex; align-items: center; gap: 8px; }
.pool-title-row h2 { font-size: 15px; letter-spacing: .01em; }
.pool-title-row .spacer { flex: 1 1 auto; }

.pool-filters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }

/* block ולא flex: בפריסת flex עם גובה חסום הילדים מתכווצים במקום לגלוש,
   וזה מה שרמס את הקטגוריות כשהיו הרבה משימות. */
.pool-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 18px 24px;
  display: block;
}
.pool-foot { flex: none; padding: 10px 18px; border-top: 1px solid var(--border); }

/* --- כרזת ה-INBOX מהנייד --- */
.inbox-banner {
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  padding: 10px 12px;
  margin-bottom: 14px;
}
.ib-head { display: flex; align-items: center; gap: 9px; }
.ib-count {
  flex: none;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ib-title { flex: 1 1 auto; font-size: 13px; color: var(--accent); }
.ib-list {
  margin: 8px 0 0;
  padding-inline-start: 18px;
  font-size: 12.5px;
  color: var(--text-dim);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 14px;
}
.ib-list li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-more { margin-top: 4px; font-size: 11.5px; color: var(--text-faint); }
body.is-wide-schedule .ib-list { grid-template-columns: minmax(0, 1fr); }

/* --- קבוצות קטגוריה במאגר --- */
/* כותרת הקבוצה היא כותרת, לא תיבה: נקודת צבע ושם, בלי מסגרות */
.cat-group-head {
  position: sticky;
  top: -4px;
  z-index: 3;
  display: flex;
  align-items: stretch;
  width: 100%;
  margin-top: 26px;
  border-bottom: 1px solid var(--cat);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  /* אותו מילוי בדיוק כמו בלוק של הקטגוריה בלוח */
  background: color-mix(in srgb, var(--cat) 20%, var(--surface));
  overflow: hidden;
}
.cat-group-head:first-child { margin-top: 0; }
.cat-group-head:hover { background: color-mix(in srgb, var(--cat) 30%, var(--surface)); }

.cgh-toggle {
  flex: 1 1 auto;
  font: inherit;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 8px 4px 8px 10px;
  border: 0;
  background: none;
  color: var(--text);
  cursor: pointer;
  text-align: start;
}
.cgh-toggle::before {
  content: "";
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--cat);
}
.cat-group-head.is-none .cgh-toggle::before { background: none; box-shadow: inset 0 0 0 1.5px var(--text-faint); }

.cgh-add {
  flex: none;
  font: inherit;
  font-size: 12px;
  padding: 0 12px;
  border: 0;
  border-inline-start: 1px solid color-mix(in srgb, var(--cat) 35%, transparent);
  background: none;
  color: color-mix(in srgb, var(--cat) 70%, var(--text));
  cursor: pointer;
  white-space: nowrap;
}
.cgh-add:hover { background: color-mix(in srgb, var(--cat) 45%, var(--surface)); color: var(--text); }

.cgh-chevron {
  flex: none;
  font-size: 13px;
  line-height: 1;
  color: var(--text-faint);
  transition: transform .18s;
  order: 3;
}
.cat-group-head.is-collapsed .cgh-chevron { transform: rotate(90deg); }
.cgh-name {
  flex: 1 1 auto;
  font-weight: var(--weight-strong);
  font-size: 14px;
  letter-spacing: .01em;
  transition: color .14s;
}
.cgh-count {
  flex: none;
  font-size: 12px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* ארבעה טורי משימות, כדי לראות כמה שיותר בבת אחת */
.cat-group-body {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
  gap: 8px;
  padding: 12px 0 4px;
  border: 0;
  background: none;
}

.empty-state {
  padding: 34px 18px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1.7;
}

/* --- כרטיס משימה --- */
/* מסגרת דקה מסביב, פס קטגוריה מלא בצד הפנימי,
   ומילוי בחמישית מעוצמת המילוי של כותרת הקבוצה (4% מול 20%) */
.task-card {
  position: relative;
  border: 1px solid var(--border-strong);
  border-inline-start: 5px solid var(--cat, var(--border-strong));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--cat, transparent) 4%, var(--surface));
  padding: 10px 12px 10px 10px;
  cursor: grab;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .14s, background .14s, border-color .14s;
  touch-action: none;
  user-select: none;
}
.task-card:hover {
  box-shadow: var(--shadow-md);
  background: color-mix(in srgb, var(--cat, transparent) 9%, var(--surface));
  border-color: var(--text-faint);
  border-inline-start-color: var(--cat, var(--border-strong));
}
/* התגיות שומרות על ניגוד מול המילוי הצבעוני */
.task-card .chip { background: color-mix(in srgb, var(--surface) 78%, transparent); }
.task-card:hover .chip { background: color-mix(in srgb, var(--surface) 88%, transparent); }
.task-card.is-dragging { opacity: .35; }
.is-close-btn { font-size: 11px; letter-spacing: -2px; }
.is-close-btn:hover { background: #1c2128 !important; color: #fff !important; border-color: #1c2128 !important; }
.pool-hint { font-size: 11.5px; color: var(--text-faint); }

.task-top { display: flex; align-items: flex-start; gap: 8px; }
.task-title {
  font-weight: var(--weight-strong);
  font-size: 14px;
  line-height: 1.35;
  color: var(--text);
  flex: 1 1 auto;
  word-break: break-word;
}
.task-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-top: 7px; }

/* תגיות בלי מסגרת — מילוי רך בלבד */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 0;
  color: var(--text-dim);
  white-space: nowrap;
}
.task-card:hover .chip { background: var(--bg); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cat, var(--text-faint)); flex: none; }

/* תגית הקטגוריה נושאת את הצבע במלואו, לא רק נקודה */
.chip-cat {
  background: color-mix(in srgb, var(--cat) 16%, var(--surface));
  color: color-mix(in srgb, var(--cat) 72%, var(--text));
}
.task-card:hover .chip-cat { background: color-mix(in srgb, var(--cat) 22%, var(--surface)); }
.chip-dur { font-variant-numeric: tabular-nums; }
.chip-sched { background: var(--accent-soft); color: var(--accent); }

.flag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: var(--weight-strong);
  white-space: nowrap;
  border: 0;
}
/* הדרגה הראשונה היא אותו צבע של הדרגה השנייה בחצי עוצמה — אותה משפחה, פחות צעקנית.
   הטקסט בה כהה ולא לבן, כי על רקע בחצי עוצמה לבן כמעט לא נקרא.
   var(--text) ולא שחור מוחלט, כדי שיישאר קריא גם במצב כהה. */
.flag-imp1 { background: color-mix(in srgb, var(--accent) 50%, transparent); color: var(--text); }
.flag-imp2 { background: var(--accent); color: #fff; }
.flag-urg1 { background: color-mix(in srgb, var(--danger) 50%, transparent); color: var(--text); }
.flag-urg2 { background: var(--danger); color: #fff; }

.chip-notes { color: var(--text-dim); }

/* רשימה שטוחה — אותם ארבעה טורים, בלי חלוקה לקטגוריות */
.flat-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
  gap: 8px;
  padding: 12px 0 4px;
}

.task-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity .12s;
  flex: none;
}
.task-card:hover .task-actions,
.task-card:focus-within .task-actions { opacity: 1; }
.task-actions .icon-btn { width: 24px; height: 24px; font-size: 13px; }

/* --- לוח זמנים --- */
.schedule {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--surface);
}
/* --- פילוח שעות לפי קטגוריה --- */
.cat-load {
  flex: none;
  padding: 8px 16px 9px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.cl-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}
.cl-title { font-size: 11.5px; font-weight: var(--weight-strong); color: var(--text-dim); }
.cl-conflicts { font-size: 11.5px; color: var(--warn); margin-inline-end: auto; }
.cl-total { font-size: 11.5px; color: var(--text-faint); }
.cl-total b { color: var(--text); font-variant-numeric: tabular-nums; }

.cl-bar {
  display: flex;
  height: 15px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
  gap: 2px;
}
/* אותו מתכון כמו בלוק בלוח: מילוי בגוון הקטגוריה וקו בצבע המלא */
.cl-seg {
  min-width: 3px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--cat) 20%, var(--surface));
  box-shadow: inset 0 0 0 1px var(--cat);
}

.cl-items {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 7px;
}
.cl-item { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; white-space: nowrap; }
.cl-swatch { width: 9px; height: 9px; border-radius: 3px; background: var(--cat); flex: none; }
.cl-name { color: var(--text-dim); }
.cl-item.is-none .cl-name { font-style: italic; }
.cl-time { font-variant-numeric: tabular-nums; }
.cl-pct { font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }

.schedule-scroll { flex: 1 1 auto; overflow-y: auto; position: relative; }

.grid { position: relative; display: flex; align-items: stretch; padding: 10px 16px 40px; }
.gutter { flex: 0 0 var(--gutter-w); position: relative; }
.lanes {
  flex: 1 1 auto;
  position: relative;
  border-inline-start: 1px solid var(--border-strong);
  min-width: 0;
}

/* --- עמודות ימים (עמודה אחת בתצוגת יום, שבע בתצוגת שבוע) --- */
.day-cols { position: absolute; inset: 0; display: flex; }
.day-col {
  flex: 1 1 0;
  position: relative;
  min-width: 0;
  border-inline-start: 1px solid var(--border);
}
.day-col:first-child { border-inline-start: 0; }
/* זמן פנוי נשאר לבן תמיד — רק מה שחלף מקבל גוון */
.day-col.is-focus { box-shadow: inset 0 0 0 1px var(--accent); }
.day-col.is-drop-target { background: var(--accent-soft); }

.past-shade {
  position: absolute;
  inset-inline: 0;
  top: 0;
  background: var(--past-shade);
  pointer-events: none;
  z-index: 1;
}

/* --- כותרות הימים (נדבקות לראש אזור הגלילה) --- */
.day-headers {
  position: sticky;
  top: 0;
  z-index: 14;
  display: flex;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-strong);
}
/* ‎+1px‎ מפצה על ה-border-inline-start של ‎.lanes‎, כדי שהכותרות יתיישרו בדיוק עם העמודות */
.dh-gutter { flex: 0 0 calc(var(--gutter-w) + 1px); }
.dh-cell {
  flex: 1 1 0;
  min-width: 0;
  font: inherit;
  display: grid;
  grid-template-columns: auto auto;
  justify-content: center;
  align-items: baseline;
  gap: 0 5px;
  padding: 6px 4px;
  border: 0;
  border-inline-start: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
}
.dh-cell:first-of-type { border-inline-start: 0; }
.dh-cell:hover { background: var(--surface-2); }
.dh-cell.is-weekend { background: rgba(127, 140, 160, .06); }
.dh-cell.is-today .dh-name { color: var(--danger); }
.dh-cell.is-focus { box-shadow: inset 0 -2px 0 var(--accent); }
.dh-name { font-size: 12.5px; font-weight: var(--weight-strong); color: var(--text); }
.dh-date { font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.dh-load { grid-column: 1 / -1; font-size: 10.5px; color: var(--text-faint); text-align: center; }

.segmented-sm button { font-size: 12px; padding: 5px 12px; }

.hour-label {
  position: absolute;
  inset-inline-end: 10px;
  transform: translateY(-50%);
  font-size: 11.5px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  user-select: none;
}
.hour-label.is-hour { color: var(--text-dim); font-weight: var(--weight-strong); font-size: 12px; }

/* קווי שעה כהים, קווי חצי־שעה אפורים וברורים, ורבעי שעה עדינים */
.grid-line { position: absolute; inset-inline: 0; pointer-events: none; border-top: 1px solid var(--grid-faint); }
.grid-line.is-half { border-top-color: var(--grid-half); }
.grid-line.is-hour { border-top-color: var(--grid-hour); }

.now-line {
  position: absolute;
  inset-inline: -4px 0;
  height: 0;
  border-top: 2px solid var(--danger);
  pointer-events: none;
  z-index: 6;
}
.now-line::before {
  content: "";
  position: absolute;
  inset-inline-start: -5px;
  top: -5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}

/* --- בלוק בלו"ז --- */
.block {
  position: absolute;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--cat, var(--border-strong));
  border-inline-start: 5px solid var(--cat, var(--border-strong));
  box-shadow: var(--shadow-sm);
  padding: 4px 9px;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  touch-action: none;
  z-index: 3;
}
.block::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--cat, var(--accent));
  opacity: .2;
  pointer-events: none;
}
.block:hover { box-shadow: var(--shadow-md); z-index: 5; }
.block.is-selected { outline: 2px solid var(--accent); outline-offset: 1px; z-index: 7; }
.block.is-dragging { z-index: 9; box-shadow: var(--shadow-lg); cursor: grabbing; }
/* התנגשות מסומנת בקו היקפי, בלי לגעת בפס הקטגוריה */
.block.is-conflict { box-shadow: inset 0 0 0 1.5px var(--warn), var(--shadow-sm); }
.block.is-swap-target { outline: 2px dashed var(--accent); outline-offset: 1px; }
.block.is-adhoc { border-inline-start-style: dotted; border-inline-start-width: 5px; }

.block-title {
  font-weight: var(--weight-strong);
  font-size: 12.5px;
  line-height: 1.35;
  position: relative;
  z-index: 1;
  word-break: break-word;
}
.block-sub {
  font-size: 11px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
/* טווחי שעות נשארים LTR גם בתוך משפט עברי */
.time-range { direction: ltr; unicode-bidi: isolate; }

.block-flags { display: flex; gap: 3px; position: relative; z-index: 1; }
.block-flags span {
  width: 6px; height: 6px; border-radius: 50%;
}
.block-flags .f-imp { background: var(--accent); }
.block-flags .f-urg { background: var(--danger); }

.block.is-short { padding-block: 1px; }
.block.is-short .block-inner { display: flex; align-items: center; gap: 6px; }
.block.is-short .block-title { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.block.is-short .block-sub { font-size: 10.5px; }

/* --- שיבוץ מסומן או שחלף --- */
.block.is-done .block-title { text-decoration: line-through; }
.block.is-done, .block.is-past { background: var(--surface-2); }
.block.is-done::after, .block.is-past::after { opacity: .07; }
.block.is-done .block-title, .block.is-past .block-title,
.block.is-done .block-sub, .block.is-past .block-sub { color: var(--text-dim); }
.block.is-closed { opacity: .8; }
/* בלוק שחלף מתבהר בריחוף, כדי שעדיין יהיה נוח לערוך אותו */
.block.is-past:hover { background: var(--surface); }
/* קבוצת הפקדים נצמדת לפינה הפנימית (שמאל ב-RTL).
   row-reverse ולא direction:ltr — שינוי direction היה הופך גם את
   המשמעות של inset-inline-end ומעיף את הקבוצה לצד השני. */
.block-actions {
  position: absolute;
  inset-inline-end: 3px;
  top: 3px;
  z-index: 4;
  display: flex;
  flex-direction: row-reverse;
  gap: 3px;
  opacity: 0;
  transition: opacity .12s;
}
.block:hover .block-actions,
.block:focus-within .block-actions { opacity: 1; }

.block-mark {
  font: inherit;
  height: 18px;
  border-radius: 4px;
  border: 0;
  background: var(--surface);
  color: var(--text-dim);
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.block-skip { padding: 0 6px; font-size: 10.5px; min-width: 18px; }
.block-dup { padding: 0 6px; font-size: 10.5px; }
.block-dup:hover { background: var(--accent); color: #fff; }

/* שורת השכפול בתצוגה השבועית — מתחת לשורת הפקדים, צמודה לאותו צד */
.block-actions-2 {
  position: absolute;
  inset-inline-end: 3px;
  top: 24px;
  z-index: 4;
  opacity: 0;
  transition: opacity .12s;
  max-width: calc(100% - 6px);
  overflow: hidden;
}
.block:hover .block-actions-2,
.block:focus-within .block-actions-2 { opacity: 1; }
/* בבלוק נמוך אין מקום לשורה שנייה */
.block.is-short .block-actions-2 { display: none; }
/* גם אם הבלוק צר במיוחד, הקבוצה לא תגלוש מעבר לגבולותיו */
.block-actions { max-width: calc(100% - 6px); overflow: hidden; }
.block-closed { width: 24px; font-size: 11px; letter-spacing: -2px; }
.block-remove { width: 18px; font-size: 13px; }

/* שני הסימונים מקבלים רקע שחור בריחוף ובמצב פעיל */
.block-skip:hover, .block-closed:hover,
.block-skip[aria-pressed="true"], .block-closed[aria-pressed="true"] {
  background: #1c2128;
  color: #fff;
}
.block-skip[aria-pressed="true"], .block-closed[aria-pressed="true"] { opacity: 1; }
.block-remove:hover { background: var(--danger-soft); color: var(--danger); }

/* סימון פעיל נשאר גלוי גם בלי ריחוף */
.block:has(.block-mark[aria-pressed="true"]) .block-actions { opacity: 1; }
.block.is-short .block-actions { top: 1px; }

.block-handle {
  position: absolute;
  inset-inline: 0;
  height: 7px;
  cursor: ns-resize;
  z-index: 4;
}
.block-handle.top { top: -1px; }
.block-handle.bottom { bottom: -1px; }
.block-handle::after {
  content: "";
  position: absolute;
  inset-inline: 34% 34%;
  top: 50%;
  height: 2px;
  border-radius: 2px;
  background: var(--text-faint);
  opacity: 0;
  transform: translateY(-50%);
}
.block:hover .block-handle::after { opacity: .6; }

/* בתחתית הבלוק, כדי לא להתנגש בקבוצת הפקדים שבראשו */
.conflict-tag {
  position: absolute;
  inset-inline-end: 4px;
  bottom: 3px;
  font-size: 10px;
  font-weight: var(--weight-strong);
  color: var(--warn);
  background: var(--warn-soft);
  border-radius: 4px;
  padding: 0 5px;
  z-index: 4;
  pointer-events: none;
}

/* --- תצוגה מקדימה בגרירה --- */
.drop-preview {
  position: absolute;
  border-radius: var(--radius-sm);
  border: 2px dashed var(--accent);
  background: var(--accent-soft);
  z-index: 8;
  pointer-events: none;
  display: flex;
  align-items: flex-start;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: var(--weight-strong);
  color: var(--accent);
  gap: 6px;
  font-variant-numeric: tabular-nums;
}

.drag-layer { position: fixed; inset: 0; pointer-events: none; z-index: 900; }
.drag-ghost {
  position: absolute;
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--accent);
  border-inline-start: 4px solid var(--cat, var(--accent));
  box-shadow: var(--shadow-lg);
  font-size: 12.5px;
  font-weight: var(--weight-strong);
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: translate(50%, -50%);
}
body.is-dragging, body.is-dragging * { cursor: grabbing !important; }
body.is-resizing, body.is-resizing * { cursor: ns-resize !important; }

.hint {
  flex: none;
  margin: 0;
  padding: 8px 16px;
  font-size: 11.5px;
  color: var(--text-faint);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

/* ===== מודאלים ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 19, 26, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  animation: fade .12s ease-out;
}
@keyframes fade { from { opacity: 0; } }

.modal {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 460px;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  animation: pop .14s ease-out;
}
.modal.modal-wide { max-width: 560px; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.modal-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 15px; }
.modal-body { flex: 1 1 auto; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot {
  flex: none;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 13px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 14px 14px;
}
.modal-foot .spacer { flex: 1 1 auto; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; font-weight: var(--weight-strong); color: var(--text-dim); }
.field-row { display: flex; gap: 12px; }
.field-row > .field { flex: 1 1 0; min-width: 0; }
.field-hint { font-size: 11.5px; color: var(--text-faint); }

.segmented { display: flex; gap: 0; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.segmented button {
  flex: 1 1 0;
  font: inherit;
  font-size: 12.5px;
  padding: 7px 4px;
  border: 0;
  border-inline-end: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
}
.segmented button:last-child { border-inline-end: 0; }
.segmented button:hover { background: var(--surface-2); }
.segmented button.is-on { background: var(--accent); color: #fff; font-weight: var(--weight-strong); }

.dur-presets { display: flex; gap: 5px; flex-wrap: wrap; }
.dur-presets button {
  font: inherit;
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
}
.dur-presets button:hover { background: var(--surface-2); color: var(--text); }
.dur-presets button.is-clear { border-style: dashed; }

/* --- חזרה בעורך המשימה --- */
.repeat-field {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  background: var(--surface-2);
}
.repeat-details { display: flex; flex-direction: column; gap: 11px; margin-top: 11px; }
.day-toggles { display: flex; gap: 5px; flex-wrap: wrap; }
.day-toggle {
  font: inherit;
  font-size: 12.5px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
}
.day-toggle:hover { border-color: var(--accent); color: var(--text); }
.day-toggle.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.day-toggle.is-all { width: auto; padding: 0 11px; border-radius: 999px; border-style: dashed; }

.chip-repeat { background: var(--accent-soft); color: var(--accent); }

.cat-list { display: flex; flex-direction: column; gap: 7px; }
.cat-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.cat-row input[type="color"] {
  flex: none;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: none;
  cursor: pointer;
}
.cat-row .input { flex: 1 1 auto; }
.cat-row .count { font-size: 11.5px; color: var(--text-faint); white-space: nowrap; }

.menu {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 5px;
  z-index: 1100;
  min-width: 178px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.menu button {
  font: inherit;
  font-size: 13px;
  text-align: start;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: var(--danger); }
.menu button.danger:hover { background: var(--danger-soft); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 2px; }

.toast {
  position: fixed;
  bottom: 22px;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 1200;
  animation: fade .15s ease-out;
}
html[dir="rtl"] .toast { transform: translateX(50%); }

/* ===== דוחות ===== */
.rp-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
.rp-title { flex: 1 1 auto; font-size: 15px; font-weight: var(--weight-strong); text-align: center; margin: 0; }

.rp-body { display: flex; flex-direction: column; gap: 14px; }
.rp-chart { display: flex; justify-content: center; }
.chart { width: 100%; height: auto; }
.chart-pie { max-width: 270px; }

.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .grid.is-base { stroke: var(--border-strong); }
.chart .tick { fill: var(--text-faint); font-size: 11px; }
.chart .axis-title { fill: var(--text-dim); font-size: 11.5px; font-weight: var(--weight-strong); }
.chart .pie-total { fill: var(--text); font-size: 16px; font-weight: var(--weight-strong); }
.chart .pie-sub { fill: var(--text-faint); font-size: 11px; }

.rp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rp-table th {
  text-align: start;
  font-size: 11.5px;
  font-weight: var(--weight-strong);
  color: var(--text-dim);
  padding: 5px 8px;
  border-bottom: 1px solid var(--border-strong);
}
.rp-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); }
.rp-table tfoot td { border-bottom: 0; border-top: 1px solid var(--border-strong); font-weight: var(--weight-strong); }
.rp-table .rp-num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rp-table .rp-pct { color: var(--text-dim); }
.rp-table .rp-name { font-weight: var(--weight-strong); }
.rp-swatch { display: block; width: 12px; height: 12px; border-radius: 3px; background: var(--cat); }

/* ===== גיליון הדפסה =====
   כל המידות במ"מ, כדי שהפריסה תהיה זהה במסך ובנייר ותיכנס לעמוד A4 אחד. */

#print-root { display: none; }

.print-sheet {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  background: #fff;
  color: #14181f;
  /* הגיליון תמיד על נייר לבן, גם כשהמערכת במצב כהה */
  --surface: #ffffff;
  --text: #14181f;
  --text-dim: #4a525e;
  --text-faint: #5b6472;
  font-family: var(--font);
  overflow: hidden;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}
.print-sheet * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }

.p-head {
  flex: none;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6mm;
  border-bottom: 0.5mm solid #14181f;
  padding-bottom: 1.5mm;
}
.p-title { font-size: 13pt; font-weight: 700; }
.p-sub { display: flex; gap: 4mm; font-size: 8pt; color: #4a525e; white-space: nowrap; }

.p-daynames { flex: none; display: flex; align-items: stretch; }
.p-dayname {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5mm;
  border-inline-start: 0.2mm solid #c9cfd8;
  font-size: 8pt;
}
.p-dayname:first-of-type { border-inline-start: 0; }
.p-dayname.is-weekend { background: #f0f2f5; }
.p-dayname.is-today b { text-decoration: underline; }
.p-dayname span { font-size: 7pt; color: #5b6472; }

.p-grid { flex: none; display: flex; position: relative; }
.p-schedule { flex: 1 1 auto; display: flex; min-width: 0; }

/* הדפסת יום: הלו"ז בחצי הימני, החצי השמאלי ריק לגמרי לכתיבה ביד */
.p-grid.is-half .p-schedule { flex: 0 0 50%; }
.p-notes { flex: 1 1 auto; min-width: 0; }

.p-gutter { flex: none; position: relative; }
.p-hour {
  position: absolute;
  inset-inline-end: 1.5mm;
  transform: translateY(-50%);
  font-size: 7pt;
  color: #4a525e;
  font-variant-numeric: tabular-nums;
}
.p-cols { flex: 1 1 auto; position: relative; display: flex; border-inline-start: 0.3mm solid #8b95a3; }
.p-line { position: absolute; inset-inline: 0; border-top: 0.15mm solid #dde1e7; }
.p-line.is-hour { border-top: 0.2mm solid #b3bac4; }
.p-col { flex: 1 1 0; position: relative; min-width: 0; border-inline-start: 0.2mm solid #c9cfd8; }
.p-col.is-first { border-inline-start: 0; }
.p-col.is-weekend { background: #f4f6f8; }

.p-block {
  position: absolute;
  overflow: hidden;
  background: color-mix(in srgb, var(--cat) 12%, #fff);
  border: 0.15mm solid color-mix(in srgb, var(--cat) 55%, #fff);
  border-inline-start: 0.9mm solid var(--cat);
  border-radius: 0.7mm;
  padding: 0.3mm 1.2mm;
  line-height: 1.18;
}
.p-btime { font-size: 6.5pt; color: #4a525e; font-variant-numeric: tabular-nums; }
.p-btitle { font-size: 8pt; font-weight: 600; }
.p-bnotes { font-size: 6.5pt; color: #4a525e; margin-top: 0.4mm; white-space: pre-wrap; }
.p-marks { font-weight: 700; }
.p-block.is-dense { padding: 0 1.2mm; }
.p-line1 {
  font-size: 6.5pt;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p-legend {
  flex: none;
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4mm;
  border-top: 0.2mm solid #dde1e7;
  padding-top: 1mm;
  overflow: hidden;
}
.p-legend-items { display: flex; flex-wrap: wrap; gap: 0.5mm 3mm; }
.p-legend-item { font-size: 7pt; padding-inline-start: 1.6mm; border-inline-start: 0.9mm solid var(--cat); white-space: nowrap; }
.p-legend-note { font-size: 7pt; color: #5b6472; white-space: nowrap; }

/* --- מצב שחור-לבן --- */
/* דיו שחור בלבד, בלי גווני אפור: ההבחנה בין קטגוריות עוברת לסגנון הפס. */
.print-sheet.is-mono {
  color: #000;
  --text: #000;
  --text-dim: #000;
  --text-faint: #000;
}
.is-mono .p-title, .is-mono .p-hour, .is-mono .p-dayname,
.is-mono .p-dayname span, .is-mono .p-btime, .is-mono .p-btitle,
.is-mono .p-bnotes, .is-mono .p-line1, .is-mono .p-legend-item,
.is-mono .p-legend-note { color: #000; }

.is-mono .p-block { background: #fff; border-color: #000; }
.is-mono .p-col.is-weekend, .is-mono .p-dayname.is-weekend { background: #fff; }
.is-mono .p-line { border-top-color: #000; }
.is-mono .p-line:not(.is-hour) { border-top-width: 0.08mm; }
.is-mono .p-line.is-hour { border-top-width: 0.2mm; }
.is-mono .p-cols { border-inline-start-color: #000; }
.is-mono .p-col { border-inline-start-color: #000; border-inline-start-width: 0.1mm; }
.is-mono .p-head { border-bottom-color: #000; }
.is-mono .p-legend { border-top-color: #000; }
.is-mono .p-notes { border-color: #000; }

/* ארבעה סגנונות פס מתחלפים, במקום ארבעה צבעים */
.is-mono .p-block[data-cat-index="0"],
.is-mono .p-legend-item[data-cat-index="0"] { border-inline-start-style: solid; }
.is-mono .p-block[data-cat-index="1"],
.is-mono .p-legend-item[data-cat-index="1"] { border-inline-start-style: dashed; }
.is-mono .p-block[data-cat-index="2"],
.is-mono .p-legend-item[data-cat-index="2"] { border-inline-start-style: dotted; }
.is-mono .p-block[data-cat-index="3"],
.is-mono .p-legend-item[data-cat-index="3"] { border-inline-start-style: double; border-inline-start-width: 1.4mm; }
.is-mono .p-legend-item { border-inline-start-color: #000; border-inline-start-width: 0.9mm; }

/* --- מסמך רשימת המשימות --- */
.print-tasks {
  height: auto;
  min-height: 0;
  display: block;
  padding-bottom: 4mm;
}
.pt-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6mm;
  border-bottom: 0.5mm solid #000;
  padding-bottom: 1.5mm;
  margin-bottom: 4mm;
}
.pt-date { font-size: 9pt; display: flex; gap: 1.5mm; }
.pt-sep { opacity: .6; }
/* שם הקטגוריה בתוך הפריט, כשאין כותרת קטגוריה שתסמן אותו */
.pt-taskcat { font-size: 6.5pt; border-top: 0.1mm solid #000; padding-top: 0.7mm; }

.pt-group { break-inside: auto; margin-bottom: 6mm; }
/* שם הקטגוריה מודגש ומתחתיו קו לרוחב, כדי שהחלוקה תיקרא במבט */
.pt-cat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4mm;
  font-size: 11.5pt;
  font-weight: 700;
  border-bottom: 0.4mm solid #000;
  padding-bottom: 1.2mm;
  margin: 0 0 2.5mm;
  break-after: avoid;
}
.pt-count { font-size: 8.5pt; font-weight: 400; }

/* חמישה טורים, וכל משימה בתוך מסגרת דקה משלה */
.pt-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1.6mm;
  align-items: start;
}
.pt-task {
  display: flex;
  flex-direction: column;
  gap: 1mm;
  padding: 1.6mm 1.8mm;
  border: 0.15mm solid #000;
  border-radius: 1mm;
  font-size: 8.5pt;
  line-height: 1.3;
  break-inside: avoid;
  overflow-wrap: anywhere;
}
.pt-title { font-weight: 400; }
.pt-marks { display: flex; flex-wrap: wrap; gap: 1mm; }
.pt-mark {
  font-size: 6.5pt;
  padding: 0.2mm 1.2mm;
  border: 0.15mm solid #000;
  border-radius: 0.8mm;
  white-space: nowrap;
}
.pt-mark.is-strong { background: #000; color: #fff; }
.pt-empty { font-size: 10pt; padding: 6mm 0; }

/* --- בחירת קטגוריות במסך ההדפסה --- */
.print-cats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.print-cats-actions { display: flex; gap: 6px; margin-top: 7px; }

/* --- גיליון הדפסת דוח --- */
.print-report { gap: 6mm; }
.print-report .pr-chart { flex: none; display: flex; justify-content: center; }
.print-report .pr-chart svg { max-height: 120mm; width: auto; max-width: 100%; }
.print-report .chart-pie { max-width: 95mm; }
.print-report .rp-table { font-size: 10pt; }
.print-report .rp-table th { color: #4a525e; border-bottom-color: #b3bac4; }
.print-report .rp-table td { border-bottom-color: #dde1e7; }
.print-report .rp-table tfoot td { border-top-color: #b3bac4; }
.print-report .chart .grid { stroke: #dde1e7; }
.print-report .chart .grid.is-base { stroke: #b3bac4; }
.print-report .chart .tick { fill: #4a525e; }
.print-report .chart .axis-title { fill: #2b2e33; }
.print-report .chart .pie-total { fill: #14181f; }
.print-report .chart .pie-sub { fill: #5b6472; }
.print-report .pr-note { margin-top: auto; font-size: 8pt; color: #5b6472; }

/* --- תצוגה מקדימה בתוך המודאל --- */
/* מסמך רשימת המשימות עשוי להיות ארוך מעמוד, ולכן התצוגה המקדימה חסומה בגובה וגוללת */
.print-preview {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #8d949e;
  padding: 10px;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: 46vh;
}
.print-preview-holder { position: relative; }
.print-preview .print-sheet { box-shadow: 0 2px 10px rgba(0, 0, 0, .35); }

/* ===== הדפסה בפועל ===== */
@media print {
  body { display: block; overflow: visible; background: #fff; height: auto; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block; }
  .print-sheet { box-shadow: none; }
  /* מסמך הרשימה זורם על פני עמודים; הכותרת חוזרת בראש כל עמוד */
  .print-tasks { overflow: visible; }
}

/* ===== מסכים צרים ===== */
/* מצב "לוח רחב": הלו"ז תופס 83% מהמסך והמאגר מצטמצם ל-17% */
body.is-wide-schedule .pool { flex: 0 0 17%; min-width: 150px; }
body.is-wide-schedule .cat-group-body,
body.is-wide-schedule .flat-list { grid-template-columns: minmax(0, 1fr); }
body.is-wide-schedule .cgh-add { padding: 0 7px; font-size: 11px; }
body.is-wide-schedule .pool-filters { grid-template-columns: 1fr 1fr; }
#toggle-wide[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

/* מצטמצם בהדרגה כשאין מספיק מקום ללוח הזמנים */
@media (max-width: 1700px) {
  .pool { flex: 0 0 760px; }
  .cat-group-body, .flat-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1400px) {
  .pool { flex: 0 0 540px; }
  .cat-group-body, .flat-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1120px) {
  .pool { flex: 0 0 330px; }
  .pool-filters { grid-template-columns: 1fr 1fr; }
  .cat-group-body, .flat-list { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 880px) {
  body { overflow: auto; }
  .layout { flex-direction: column; }
  .pool { flex: none; }
  .pool-list { max-height: 44vh; }
  .topbar { height: auto; flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .topbar-side { flex: 0 0 auto; }
  .date-nav { order: 3; flex: 1 1 100%; justify-content: center; }
}
