/* ==========================================================================
   portal.css — פורטל מנהלי המוסדות. עיצוב נקי, ידידותי, RTL, מותאם נייד.
   פלטה מכוונת: כחול-אינדיגו רגוע + נגיעת זהב חמה (האלמנט הבולט היחיד).
   ========================================================================== */
:root {
  --ink:      #1d2438;
  --muted:    #6c7488;
  --faint:    #99a0b0;
  --line:     #e3e7f0;
  --bg:       #eef1f7;
  --surface:  #ffffff;
  --brand:    #2f4a86;
  --brand-deep:#243a6a;
  --brand-soft:#eaf0fb;
  --accent:   #d8a534;   /* זהב חם — הדגשה נקודתית בלבד */
  --accent-soft:#fbf3dd;
  --pos:      #2f8a63;
  --pos-soft: #e6f4ec;
  --warn:     #c68320;
  --warn-soft:#fbf0da;
  --neg:      #cf4747;
  --neg-soft: #fbe9e9;
  --radius:   14px;
  --radius-sm:10px;
  --shadow:   0 1px 2px rgba(29,36,56,.05), 0 8px 24px rgba(29,36,56,.06);
  --shadow-lg:0 12px 40px rgba(29,36,56,.14);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Rubik", system-ui, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
}
a { color: var(--brand); text-decoration: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* קישור "דלג לתוכן" — מופיע רק בניווט מקלדת */
.skip {
  position: absolute; inset-inline-start: 12px; top: -60px; z-index: 100;
  background: var(--surface); color: var(--brand); font-weight: 600;
  padding: 10px 16px; border-radius: 0 0 10px 10px; box-shadow: var(--shadow);
  transition: top .15s;
}
.skip:focus { top: 0; }

/* ---------- שלד ---------- */
.topbar {
  background: var(--brand-deep);
  color: #fff;
  padding: 0 18px;
  display: flex; align-items: center; gap: 14px;
  min-height: 62px;
}
/* הפס העליון והטאבים — ננעצים יחד (גובה הפס משתנה בטלפון, ולכן לא top קבוע לטאבים) */
.head { position: sticky; top: 0; z-index: 30; }
.topbar .school { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 18px; min-width: 0; }
/* שם מוסד ארוך מתקצר ולא דוחף את התג/התאריך מחוץ לשורה */
.topbar .school > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .school .mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--accent); color: var(--brand-deep);
  display: grid; place-items: center; font-weight: 800; font-size: 18px;
}
.topbar .line-pill {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px; padding: 5px 13px; font-size: 13px; font-weight: 500; white-space: nowrap;
}
.topbar .line-pill:hover { background: rgba(255,255,255,.22); }
.topbar .line-pill .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; box-shadow: 0 0 0 3px rgba(255,255,255,.14); }
/* כמה הורים על הקו עכשיו (ספירה בלבד) */
.live-wrap { position: relative; }
.live-pill { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font: inherit; font-size: 13px;
             background: rgba(255,255,255,.08); color: rgba(255,255,255,.75); border: 1px solid rgba(255,255,255,.18);
             border-radius: 999px; padding: 5px 12px; white-space: nowrap; }
.live-pill[hidden] { display: none; }
.live-pill svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.live-pill.on { background: #e3f7ec; color: #14804a; border-color: #b8e6cc; font-weight: 600; }
.live-pop { display: none; position: absolute; top: calc(100% + 8px); inset-inline-start: 0; z-index: 60; min-width: 190px;
            background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px;
            box-shadow: 0 10px 30px rgba(20,24,40,.18); font-size: 13.5px; }
.live-pop.open { display: block; }
.live-pop div { display: flex; justify-content: space-between; gap: 18px; padding: 5px 0; border-bottom: 1px solid #f0f1f5; }
.live-pop div:last-child { border-bottom: 0; }
.live-pop .none { color: var(--muted); }
@media (max-width: 720px) { .live-pill { padding: 4px 9px; font-size: 12px; } }
.topbar .meeting { margin-inline-start: auto; font-size: 13.5px; opacity: .9; display: flex; align-items: center; gap: 7px; }
.topbar .refresh {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: transparent; border: none; color: rgba(255,255,255,.8);
  font-family: inherit; font-size: 12.5px; padding: 6px 8px; border-radius: 8px;
}
.topbar .refresh:hover { background: rgba(255,255,255,.12); color: #fff; }
.topbar .refresh svg { width: 15px; height: 15px; }
.topbar .logout {
  color: #fff; border: 1px solid rgba(255,255,255,.3); border-radius: 9px;
  padding: 7px 12px; font-size: 14px; display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.06);
}
.topbar .logout:hover { background: rgba(255,255,255,.16); }
.topbar svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ניווט טאבים — פשוט, נגלל בנייד */
.tabs {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex; gap: 4px; padding: 0 12px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.tabs a {
  padding: 15px 16px; color: var(--muted); font-weight: 500; font-size: 15px;
  white-space: nowrap; border-bottom: 3px solid transparent; display: inline-flex; align-items: center; gap: 8px;
}
.tabs a svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--brand); border-bottom-color: var(--accent); font-weight: 600; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 22px 16px 60px; }
.page-title { font-size: 24px; font-weight: 700; margin: 4px 0 20px; letter-spacing: -.01em; }
.section-title { font-size: 17px; font-weight: 600; margin: 0 0 12px; }

/* ---------- כרטיסים ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px;
}
.card + .card { margin-top: 18px; }

/* ---------- אריחי KPI (האלמנט הבולט) ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 18px 16px; position: relative; overflow: hidden;
}
.kpi .num { font-size: 42px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.kpi .lbl { color: var(--muted); font-size: 14px; margin-top: 8px; }
.kpi .ic { position: absolute; inset-inline-end: 14px; top: 14px; width: 26px; height: 26px; opacity: .35;
           fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.kpi--hero { background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%); color: #fff; border: none;
             padding-inline-end: 94px; /* מקום לטבעת האחוזים כדי שהטקסט לא ייכנס מתחתיה */ }
.kpi--hero .lbl { color: rgba(255,255,255,.85); }
.kpi--hero .num { color: #fff; }
.kpi--hero .ring { --p: 0; }
.kpi .pct-ring {
  --p: 0; width: 66px; height: 66px; border-radius: 50%; position: absolute; inset-inline-end: 16px; top: 16px;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), rgba(255,255,255,.22) 0);
  display: grid; place-items: center;
}
.kpi .pct-ring::after { content: ""; width: 50px; height: 50px; border-radius: 50%; background: var(--brand-deep); }
.kpi--pos .num { color: var(--pos); }
.kpi--warn .num { color: var(--warn); }

/* ---------- ברי התקדמות ---------- */
.bar { height: 9px; background: var(--line); border-radius: 999px; overflow: hidden; min-width: 90px; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--brand); }
.bar.is-low > span  { background: var(--neg); }
.bar.is-mid > span  { background: var(--warn); }
.bar.is-high > span { background: var(--pos); }

/* ---------- טבלאות ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
thead th {
  text-align: right; font-weight: 600; color: var(--muted); font-size: 13px;
  padding: 11px 12px; border-bottom: 2px solid var(--line); background: #fafbfe; white-space: nowrap;
}
tbody td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfe; }
.t-strong { font-weight: 600; }

/* ---------- תגים ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: #fff; }
.badge--pos { background: var(--pos); } .badge--warn { background: var(--warn); }
.badge--neg { background: var(--neg); } .badge--muted { background: #9aa1ac; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.chip--pos { background: var(--pos-soft); color: var(--pos); }
.chip--warn { background: var(--warn-soft); color: var(--warn); }
.chip--neg { background: var(--neg-soft); color: var(--neg); }
.chip--brand { background: var(--brand-soft); color: var(--brand); }

/* ---------- כפתורים ---------- */
.btn, .btn-line, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  padding: 11px 18px; border-radius: 11px; border: 1px solid transparent; transition: background .15s, border-color .15s;
}
.btn { background: var(--brand); color: #fff; }
.btn:hover { background: var(--brand-deep); }
.btn--accent { background: var(--accent); color: #3a2c05; }
.btn--accent:hover { filter: brightness(.96); }
.btn--pos { background: var(--pos); color: #fff; }
.btn--neg { background: var(--neg); color: #fff; }
.btn-line { background: var(--surface); color: var(--brand); border-color: var(--line); }
.btn-line:hover { border-color: var(--brand); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--brand-soft); color: var(--brand); }
.btn-sm { padding: 8px 13px; font-size: 14px; border-radius: 9px; }
.btn:disabled, .btn-line:disabled { opacity: .5; cursor: not-allowed; }
.btn svg, .btn-line svg, .btn-ghost svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- טפסים ---------- */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
input[type=text], input[type=password], input[type=tel], input[type=number],
input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; font-family: inherit; font-size: 15.5px; color: var(--ink);
  padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px; background: #fff;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }

/* ---------- כלים ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .grow { flex: 1; min-width: 160px; }
.muted { color: var(--muted); }
.right { margin-inline-start: auto; }
.stack > * + * { margin-top: 14px; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.empty svg { width: 42px; height: 42px; stroke: var(--faint); fill: none; stroke-width: 1.6; margin-bottom: 8px; }

/* ---------- הודעות flash ---------- */
.flash { padding: 13px 16px; border-radius: 11px; font-size: 15px; margin-bottom: 16px; font-weight: 500; }
.flash-ok { background: var(--pos-soft); color: #1e6647; }
.flash-error { background: var(--neg-soft); color: #a12d2d; }
.flash-toast { position: fixed; inset-inline: 16px auto; bottom: 20px; z-index: 60; box-shadow: var(--shadow-lg); max-width: 400px; }

/* ---------- מסך התחברות ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px;
        background: radial-gradient(900px 500px at 85% -10%, #34508f 0, var(--brand-deep) 60%); }
.auth-stack { width: 100%; max-width: 400px; }
.auth-brand { text-align: center; margin-bottom: 22px; }
.wm { font: 900 34px/1 'Rubik', Arial, sans-serif; letter-spacing: -.01em; color: #fff; white-space: nowrap; }
.wm__t { position: relative; display: inline-block; color: #e9bf5c; }
.wm__badge { position: absolute; left: -.2em; top: -.16em; width: .44em; height: .44em; overflow: visible; }
.auth-help { text-align: center; color: rgba(255,255,255,.75); font-size: 14px; margin-top: 18px; }
.auth-help a { color: #fff; font-weight: 600; }
.auth-box { width: 100%; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 34px 30px; }
.auth-logo { width: 56px; height: 56px; border-radius: 15px; background: var(--brand); color: var(--accent);
             display: grid; place-items: center; font-weight: 800; font-size: 26px; margin: 0 auto 16px; }
.auth-box h1 { font-size: 22px; text-align: center; margin: 0 0 4px; }
.auth-box .sub { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 22px; }

/* ---------- מסך סיום (תפוגה) ---------- */
.thanks { min-height: 100vh; display: grid; place-items: center; padding: 24px; text-align: center; }
.thanks .box { max-width: 460px; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 44px 32px; }
.thanks .ic { width: 74px; height: 74px; border-radius: 50%; background: var(--pos-soft); color: var(--pos);
              display: grid; place-items: center; margin: 0 auto 18px; }
.thanks .ic svg { width: 40px; height: 40px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.thanks h1 { font-size: 24px; margin: 0 0 12px; }
.thanks p { color: var(--muted); margin: 4px 0; }

/* ---------- מודאל ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(20,26,42,.5); z-index: 50; display: none; align-items: center; justify-content: center; padding: 18px; }
.modal-back.open { display: flex; }
.modal { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 460px; padding: 24px; }
.modal h3 { margin: 0 0 6px; font-size: 19px; }
.modal .modal-foot { display: flex; gap: 10px; justify-content: flex-start; margin-top: 20px; }

/* ---------- רספונסיב ---------- */
@media (max-width: 900px) {
  /* האריח הראשי על כל הרוחב, ושלושת האחרים בשורה אחת מתחתיו */
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .kpi--hero { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpis > .kpi:nth-child(4):last-child { grid-column: 1 / -1; }   /* לא להשאיר אריח בודד בשורה */
}
@media (max-width: 560px) {
  body { font-size: 15.5px; }
  .kpi .num { font-size: 34px; }
  .kpi--hero .num { font-size: 40px; }
  /* תאריך האסיפה נשאר גם בנייד (הקשר חיוני) — רק מתקצר */
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar .school { font-size: 15.5px; }
  .topbar .school .mark { width: 30px; height: 30px; font-size: 15px; }
  .topbar .meeting { font-size: 12px; margin-inline-start: auto; }
  .topbar .meeting .meeting-label { display: none; }
  .topbar .logout span, .topbar .logout { font-size: 13px; padding: 6px 9px; }
  .wrap { padding: 16px 12px 50px; }
  .page-title { font-size: 21px; }
}
@media (max-width: 380px) { .topbar .meeting { display: none; } }

/* ---- טאבלט/טלפון: השלמות ---- */
@media (max-width: 760px) {
  .rpt-head { flex-wrap: wrap; gap: 10px; }
  .rpt-head .ttl h2 { font-size: 17px; }
  .rpt-head .cls b { font-size: 21px; }
}
@media (max-width: 560px) {
  .card { padding: 15px; }
  .section-title { font-size: 15.5px; }
  .toolbar { gap: 8px; }
  .toolbar .grow { min-width: 100%; }
  .btn, .btn-line, .btn-ghost { padding: 10px 14px; }
  .modal { padding: 12px; }
}
@media (max-width: 560px) {
  .topbar .line-pill { padding: 4px 10px; font-size: 12px; }
  .topbar .refresh span { display: none; }   /* בנייד רק האייקון */
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ==========================================================================
   דוח להדפסה — "מה שרואים זה מה שמדפיסים"
   ========================================================================== */
.rpt { background: #fff; color: #000; --rfs: 13px; --rpad: 6px; }
/* סקאלות גודל — חלות על ה-.rpt כולו או על כיתה בודדת (התאמה אוטומטית) */
.s-lg { --rfs: 15px;   --rpad: 9px; }
.s-md { --rfs: 13px;   --rpad: 6px; }
.s-sm { --rfs: 11px;   --rpad: 4px; }
.s-xs { --rfs: 9.5px;  --rpad: 2.5px; }

.rpt-class {
  background: #fff; border: 1px solid #d8dde8; border-radius: 10px;
  padding: 16px 18px; margin-bottom: 16px; break-inside: avoid;
}
.rpt-head { display: flex; align-items: center; gap: 14px; border-bottom: 2px solid #222; padding-bottom: 10px; margin-bottom: 12px; }
.rpt-head .logo { max-height: 58px; max-width: 130px; object-fit: contain; flex: none; }
.rpt-head .ttl { flex: 1; }
.rpt-head .ttl h2 { margin: 0; font-size: 19px; font-weight: 700; }
.rpt-head .ttl .sub { font-size: 14px; color: #333; margin-top: 3px; }
.rpt-head .cls { text-align: center; flex: none; }
.rpt-head .cls b { display: block; font-size: 25px; line-height: 1.1; }
.rpt-head .cls span { font-size: 12.5px; color: #333; }

.rpt table { width: 100%; border-collapse: collapse; font-size: var(--rfs); }
.rpt thead { display: table-header-group; } /* חוזר בראש כל עמוד */
.rpt th {
  background: #eef1f7; color: #000; font-weight: 700; font-size: calc(var(--rfs) - .5px);
  border: 1px solid #b9c1d1; padding: var(--rpad) 8px; text-align: right;
}
.rpt td { border: 1px solid #ccd3e0; padding: var(--rpad) 8px; }
.rpt td.time { font-weight: 700; text-align: right; direction: ltr; white-space: nowrap; }
.rpt td.vbox { width: 34px; text-align: center; }
.rpt tr.free td { color: #888; }
.rpt tr.brk td { background: #f1f3f9; color: #555; font-style: italic; }  /* שורת הפסקה */
.rpt-foot { margin-top: 9px; font-size: 11px; color: #555; display: flex; justify-content: space-between; }

/* מצב "דף נפרד לכל כיתה" */
.rpt.per-class .rpt-class { break-after: page; page-break-after: always; }
.rpt.per-class .rpt-class:last-child,
.rpt.per-class .rpt-class.is-last { break-after: auto; page-break-after: auto; }

@media print {
  .topbar, .tabs, .no-print, .skip { display: none !important; }
  body { background: #fff; font-size: 12px; }
  .wrap { max-width: none; padding: 0; }
  .rpt-class { border: none; border-radius: 0; padding: 0 0 6px; margin-bottom: 10px; box-shadow: none; }
  .card { box-shadow: none; border: none; }
  @page { size: A4 portrait; margin: 11mm 10mm; }
  /* דף נפרד לכל כיתה: שורת "להזמנת מערכת" נדחפת לתחתית הדף ולא נשארת מיד אחרי הטבלה */
  .rpt.per-class .rpt-class { display: flex; flex-direction: column; box-sizing: border-box; min-height: 262mm; }
  .rpt.per-class .rpt-class.is-off,
  .rpt.per-class .rpt-class.is-empty { display: none; }   /* אחרת ה-flex מחזיר להדפסה כיתות שלא סומנו */
  .rpt.per-class .rpt-class > .rpt-foot { margin-top: auto; padding-top: 8px; }
}

/* ---------- סרגל שליחה נדבק (תזכורות) ----------
   הסכום והכפתור נשארים גלויים גם ברשימת נמענים ארוכה. */
.send-bar {
  position: sticky; bottom: 0; z-index: 10;
  margin: 16px -20px -20px; padding: 14px 20px;
  background: rgba(255,255,255,.97); backdrop-filter: blur(6px);
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.send-bar .tot { font-size: 15px; font-weight: 600; white-space: nowrap; }
.send-bar .tot b { font-size: 20px; color: var(--accent); }
.send-bar .ok { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; cursor: pointer; flex: 1; min-width: 210px; }
.send-bar .btn { white-space: nowrap; }
@media (max-width: 560px) { .send-bar { margin: 14px -16px -16px; padding: 12px 16px; } }

/* ── קו הטלפון: סטטוס גדול + כפתורי פעולה (זהה 1:1 לכרטיס שב-CRM) ────────── */
.ph-status { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--radius-sm); }
.ph-status .ic { flex: none; width: 46px; height: 46px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; }
.ph-status .ic svg { width: 22px; height: 22px; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ph-status .tx b { display: block; font-size: 17px; line-height: 1.3; }
.ph-status .tx > span { font-size: 13px; opacity: .85; }
.ph-status--pos  { background: var(--pos-soft);  color: var(--pos); }
.ph-status--pos .ic svg  { stroke: var(--pos); }
.ph-status--neg  { background: var(--neg-soft);  color: var(--neg); }
.ph-status--neg .ic svg  { stroke: var(--neg); }
.ph-status--warn { background: var(--warn-soft); color: var(--warn); }
.ph-status--warn .ic svg { stroke: var(--warn); }

.ph-actions { margin-top: 18px; }
.ph-actions h4 { margin: 0 0 9px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.abtns { display: grid; grid-template-columns: repeat(auto-fit, minmax(205px, 1fr)); gap: 10px; }
.abtn { display: flex; align-items: center; gap: 9px; padding: 14px 16px; cursor: pointer; text-align: start;
        font: inherit; font-size: 14.5px; font-weight: 500; color: var(--ink);
        background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-sm); transition: .14s; }
.abtn svg { flex: none; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.abtn:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.abtn.is-primary { background: var(--pos); border-color: var(--pos); color: #fff; }
.abtn.is-danger  { background: var(--neg); border-color: var(--neg); color: #fff; }
.abtn.is-primary:hover, .abtn.is-danger:hover { filter: brightness(.94); color: #fff; }
.abtn.is-primary:hover { background: var(--pos); border-color: var(--pos); }
.abtn.is-danger:hover  { background: var(--neg); border-color: var(--neg); }

/* אייקון עגול בראש מודאל אישור */
.m-ic { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 12px; }
.m-ic svg { width: 24px; height: 24px; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.m-ic--pos   { background: var(--pos-soft); }   .m-ic--pos svg   { stroke: var(--pos); }
.m-ic--neg   { background: var(--neg-soft); }   .m-ic--neg svg   { stroke: var(--neg); }
.m-ic--brand { background: var(--brand-soft); } .m-ic--brand svg { stroke: var(--brand); }
.modal { max-width: 430px; }
.modal h3 { font-size: 17px; margin: 0 0 6px; }
.modal .muted { font-size: 13.5px; line-height: 1.6; margin: 0; }
.modal-foot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }

/* ── מסך הדוח: הגדרות מימין, תצוגה מקדימה חיה משמאל ─────────────────────── */
.rpt-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 16px; align-items: start; }
.rpt-opts { position: sticky; top: 10px; max-height: calc(100vh - 20px); overflow: auto; }
.rpt-opts .card { padding: 16px; }
.rpt-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; position: sticky; top: 0; z-index: 5; background: var(--surface); padding: 16px 0 10px; margin-top: -16px; box-shadow: 0 8px 8px -8px rgba(0,0,0,.12); }
.rpt-bar .btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rpt-saved { font-size: 12.5px; color: var(--pos); opacity: 0; transition: opacity .2s; white-space: nowrap; }
.rpt-saved.show { opacity: 1; }
.rpt-opts .field { margin-bottom: 12px; }
.rpt-opts .field label { font-size: 13px; }

.opt-group { display: flex; flex-direction: column; gap: 9px; padding: 12px; margin-top: 4px;
             background: var(--brand-soft); border-radius: var(--radius-sm); }
.ck { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; cursor: pointer; }
.ck input { width: auto; margin: 0; flex: none; }
.ck span { flex: 1; min-width: 0; }
.ck em { font-style: normal; font-size: 12px; color: var(--muted); }
.sub-opt { padding-inline-start: 24px; display: flex; flex-direction: column; gap: 7px; }
.opt-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
            margin: 16px 0 8px; font-size: 13px; font-weight: 600; }
.opt-head a { color: var(--brand); font-weight: 500; }
.cls-list { display: flex; flex-direction: column; gap: 8px; max-height: 210px; overflow: auto;
            border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }

.prev-pane { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
             padding: 14px; max-height: calc(100vh - 20px); overflow: auto; }
.prev-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
             margin-bottom: 12px; font-size: 13px; font-weight: 600; color: var(--muted); }
.prev-pane .rpt-class { box-shadow: 0 1px 4px rgba(29,36,56,.08); }

/* מתגי התצוגה — מה שמוסתר כאן לא יודפס */
.rpt.no-phone .c-phone,
.rpt.no-vcol  .c-vcol,
.rpt.brk-hide tr.brk,
.rpt-class.is-off               { display: none; }
.rpt:not(.with-free) tr.free    { display: none; }
.rpt.no-tz .c-tz,
.rpt.no-num .c-num,
.rpt-class.is-empty,
.rpt:not(.with-unbooked) .rpt-unbooked,
.rpt.only-unbooked .rpt-class > table,
.rpt.only-unbooked .rpt-foot .cnt { display: none; }
.rpt.only-unbooked .rpt-unbooked { margin-top: 4px; }

/* מספור תלמידים — רק שורות תלמיד (לא פנוי/הפסקה), מתחיל מחדש בכל טבלה */
.rpt tbody { counter-reset: rn; }
.rpt tbody tr:not(.free):not(.brk) td.c-num::before { counter-increment: rn; content: counter(rn); }
.rpt td.c-num { text-align: center; color: #666; font-size: .9em; }
.rpt-foot .ad { color: #555; display: inline-flex; align-items: center; gap: 9px; }
.rpt-wm { font: 800 13px/1 'Rubik', Arial, sans-serif; color: #1b2d55; white-space: nowrap; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.rpt-wm .t { position: relative; display: inline-block; color: #c99a2e; }
.rpt-wm svg { position: absolute; left: -.2em; top: -.16em; width: .44em; height: .44em; overflow: visible; }

/* רשימת "לא קבעו תור" בסוף הכיתה */
.rpt-unbooked { margin-top: 14px; }
.rpt-unbooked .ub-title { font-weight: 700; font-size: calc(var(--rfs) + 1px); margin-bottom: 6px;
                          padding-bottom: 4px; border-bottom: 1.5px solid #222; }
.rpt-unbooked td { padding-top: calc(var(--rpad) * .7); padding-bottom: calc(var(--rpad) * .7); }

/* בחירת כיתות לפי מחזור + הפרדת ההנהלה ברשימה */
.grade-picks { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.grade-picks .gp { border: 1px solid var(--line); background: #fff; color: var(--muted); font: inherit; font-size: 12.5px;
                   font-weight: 600; padding: 4px 10px; border-radius: 999px; cursor: pointer; }
.grade-picks .gp:hover { border-color: var(--brand); color: var(--brand); }
.grade-picks .gp.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.cls-list .ck-pr { border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 2px; }
.prev-note { font-size: 12.5px; color: var(--warn); background: var(--warn-soft); border-radius: 9px;
             padding: 8px 12px; margin-bottom: 10px; }
.rpt.brk-blank .brk-txt         { visibility: hidden; }
.rpt.src-booked .ph-up,
.rpt:not(.src-booked) .ph-bk    { display: none; }

@media (max-width: 1000px) {
  .rpt-layout { grid-template-columns: 1fr; }
  .rpt-opts, .prev-pane { position: static; max-height: none; overflow: visible; }
}
@media print {
  .rpt-layout { display: block; }
  .prev-pane { border: 0; padding: 0; background: #fff; max-height: none; overflow: visible; }
}

/* ---------- סקירה (index.php): שורות לחיצות, שעות לכל יום, שורת ההנהלה ---------- */
tr.row-link { cursor: pointer; }
tr.row-link td a { color: inherit; }
tr.row-link:hover td a { color: var(--brand); text-decoration: underline; }
.hrs-day { white-space: nowrap; line-height: 1.5; }
.hrs-day .hrs-d { font-size: 12px; color: var(--faint); }
.tb-pr tr td { background: #f7f9fd; border-top: 2px dashed var(--line); }
.tb-pr tr:hover td { background: var(--brand-soft); }

/* ---------- עריכת שעות (_sched.php): כפתור + חלון ---------- */
.sched-btn { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: #fff;
             color: var(--brand); font: inherit; font-size: 12.5px; font-weight: 600; padding: 4px 10px;
             border-radius: 999px; cursor: pointer; vertical-align: middle; white-space: nowrap; }
.sched-btn:hover { border-color: var(--brand); background: var(--brand-soft); }
.sched-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sched-btn--sm { padding: 1px 8px; font-size: 12px; margin-inline-start: 6px; }
.day-title .sched-btn { margin-inline-start: 8px; }
.btn--warn { background: var(--warn); color: #fff; }
.btn--warn:hover { filter: brightness(.95); background: var(--warn); }
.sched-modal { max-width: 560px; }
.sched-body { margin-top: 12px; }
.sc-note { font-size: 13px; color: var(--muted); background: #f6f8fc; border-radius: 9px; padding: 8px 12px; margin: 0 0 12px; line-height: 1.6; }
.sc-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.sc-row label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; }
.sc-row select, .sc-row input { height: 40px; padding: 0 10px; font-size: 15px; }
.sc-prev { margin-top: 14px; }
.sc-sum { font-size: 14px; background: var(--brand-soft); color: var(--brand-deep); border-radius: 9px; padding: 9px 12px; }
.sc-conf { margin-top: 10px; font-size: 13.5px; background: var(--neg-soft); color: #8a2d2d; border-radius: 9px; padding: 10px 12px; line-height: 1.6; }
.sc-crow { display: flex; align-items: center; gap: 10px; margin-top: 6px; background: #fff; border-radius: 8px; padding: 4px 8px; }
.sc-crow span:nth-child(2) { flex: 1; color: var(--ink); }
.sc-crow .btn-ghost { color: var(--neg); }
.sc-warn { margin-top: 10px; font-size: 13.5px; background: var(--warn-soft); color: #8a5a10; border-radius: 9px; padding: 9px 12px; }
.sc-err { color: var(--neg); font-size: 14px; margin: 0; }
@media (max-width: 560px) { .sc-row { grid-template-columns: 1fr 1fr; } }

/* ==========================================================================
   עץ כיתות — appointments.php + pending.php (רכיבים: _tree.php, assets/tree.js)
   ========================================================================== */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; }
.page-head .page-title { margin: 0; }
.page-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.page-action { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }   /* כפתורים באותו גובה ובאותו קו */

/* ---------- שיבוץ אוטומטי: חלונית התצוגה המקדימה (pending.php) ---------- */
.aa-modal { max-width: 800px; padding: 0; overflow: hidden; }
.aa-modal #aaBody { max-height: calc(100vh - 36px); max-height: calc(100dvh - 36px); overflow-y: auto; }
.aa-load { padding: 48px 20px; text-align: center; color: var(--muted); }
.aa-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 20px; background: #fff7e6; border-bottom: 1px solid #f3d9a4; }
.aa-badge { background: #f0b429; color: #3a2c05; font-weight: 700; font-size: 13px; padding: 3px 11px; border-radius: 999px; }
.aa-note { font-weight: 600; color: #7a5300; }
.aa-chips { margin-inline-start: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.aa-pad { padding: 14px 20px 6px; }
.aa-opts { display: flex; gap: 18px; flex-wrap: wrap; margin: 0 0 10px; }
.aa-opts label { cursor: pointer; display: flex; align-items: center; gap: 6px; }
.aa-opts input { width: auto; }
.aa-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; color: var(--muted); font-size: 14px; }
.aa-scroll { max-height: 48vh; overflow: auto; border: 1px solid var(--line); border-radius: 11px; }
.aa-fam { background: var(--brand-soft); font-size: 13px; font-weight: 600; padding: 5px 12px; }
.aa-un { margin: 12px 0 6px; font-size: 13.5px; color: var(--muted); }
.aa-un summary { cursor: pointer; font-weight: 600; color: var(--neg); }
.aa-foot { display: flex; gap: 10px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); }
.aa-page { padding: 0; overflow: hidden; }
.aa-run { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; border-inline-start: 4px solid var(--brand); }
.aa-run-t { flex: 1; min-width: 220px; }

/* סרגל כלים: סינון מימין, תצוגה/עץ משמאל — כל הפקדים בגובה אחיד */
.ap-bar { display: flex; align-items: center; gap: 12px; flex-wrap: nowrap; justify-content: space-between;
          margin-bottom: 16px; padding: 12px 14px; }
/* שורה אחת: הסינון מתכווץ (שמות כיתות ארוכים נחתכים בשלוש נקודות), כפתורי התצוגה נשארים במקומם */
.ap-filters { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; flex: 1 1 0; min-width: 0; }
.ap-tools { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; flex: 0 0 auto; }
.ap-bar select { width: auto; flex: 1 1 140px; min-width: 0; max-width: 320px; height: 40px; padding: 0 12px; font-size: 14.5px; text-overflow: ellipsis; }
.ap-search { position: relative; display: inline-flex; align-items: center; flex: 0 1 230px; min-width: 120px; height: 40px; }
.ap-search svg { position: absolute; inset-inline-start: 11px; width: 17px; height: 17px; color: var(--faint); pointer-events: none;
                 fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.ap-search input { height: 40px; padding: 0 12px; padding-inline-start: 35px; font-size: 14.5px; }
.ap-check { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 6px; font-size: 14px; font-weight: 500;
            cursor: pointer; white-space: nowrap; flex: 0 0 auto; }
.ap-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); }

.seg { display: inline-flex; height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: #f6f8fc; }
.seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--muted);
              font: inherit; font-size: 13.5px; font-weight: 600; padding: 0 11px; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.seg button.on { background: var(--surface); color: var(--brand); box-shadow: 0 1px 3px rgba(29,36,56,.12); }
.seg--icons button { padding: 0 9px; }
.seg--icons button span { display: none; }  /* פתח/סגור הכל — אייקון בלבד, הטקסט ב-title */

/* כרטיס כיתה = ענף בעץ */
.cls-card { margin-bottom: 12px; padding: 0; overflow: hidden;
            scroll-margin-top: 130px; }  /* קפיצה לעוגן (#cls-ID) — שהכותרת לא תיבלע מתחת לסרגל העליון הנדבק */
.cls-card + .cls-card { margin-top: 0; }
.cls-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; cursor: pointer; user-select: none; }
.cls-head:hover { background: #fafbfe; }
.cls-chev { display: inline-flex; width: 26px; height: 26px; border-radius: 8px; align-items: center; justify-content: center;
            background: var(--brand-soft); color: var(--brand); flex: none; transition: transform .15s; }
.cls-chev svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.cls-card.is-closed .cls-chev { transform: rotate(90deg); }
.cls-name { font-size: 16.5px; font-weight: 700; line-height: 1.3; }
.cls-sub { font-size: 13px; }
.cls-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-inline-start: auto; }
.cls-body { padding: 2px 16px 16px; border-top: 1px solid var(--line); }
.cls-card.is-closed .cls-body { display: none; }
#apList.searching .cls-card.is-closed .cls-body { display: block; }  /* בחיפוש רואים הכל */
.cls-nohit { font-size: 14px; padding: 12px 0 0; }

.day-grp + .day-grp { margin-top: 14px; }
.day-title { font-size: 14px; font-weight: 700; color: var(--brand); margin: 14px 0 8px;
             padding-bottom: 6px; border-bottom: 2px solid var(--accent-soft); }
.num { font-variant-numeric: tabular-nums; }

/* קביעה לתלמידים שטרם קבעו (בתוך כיתה, בדף התורים) */
.pend { margin: 12px 0 4px; border: 1px dashed #e7b7b7; background: #fffafa; border-radius: var(--radius-sm); }
.pend summary { cursor: pointer; padding: 9px 14px; font-weight: 600; font-size: 14.5px; color: var(--neg);
                display: flex; align-items: center; gap: 8px; list-style: none; }
.pend summary::-webkit-details-marker { display: none; }
.pend summary svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.pend[open] summary svg { transform: rotate(45deg); }
.pend-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; padding: 0 12px 12px; }
.pend-row { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line);
            border-radius: 10px; padding: 7px 10px; }
/* השם המלא תמיד נראה (נשבר לשורה שנייה במקום להיחתך ב"…") — כדי שאפשר יהיה לזהות את התלמיד; ת"ז מתחתיו */
.pend-row .who { flex: 1; min-width: 0; }
.pend-row .t-strong { white-space: normal; overflow-wrap: anywhere; line-height: 1.3; }
.pend-row .num { font-size: 12.5px; margin-top: 2px; }
.pend-empty { padding: 0 14px 12px; margin: 0; font-size: 14px; }

/* ---- פריט (אותו DOM לשתי התצוגות) ---- */
.slot .s-act form { margin: 0; }
.s-meta { color: var(--muted); font-size: 12px; }
.s-meta .sep { margin: 0 4px; color: var(--faint); }
.s-meta .sep[hidden] { display: none; }
.s-cancel { color: var(--neg) !important; padding: 4px 8px !important; }
.s-cancel svg { width: 14px !important; height: 14px !important; }
.quick-book { display: flex; gap: 6px; align-items: center; }
.quick-book select { flex: 1; min-width: 0; height: 34px; padding: 0 8px; font-size: 14px; border-radius: 9px; }
.quick-book .btn-sm { height: 34px; padding: 0 12px; }

/* קוביות (ברירת מחדל) */
.view-grid .slot-head { display: none; }
.view-grid .slot-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(174px, 1fr)); gap: 8px; margin-top: 10px; }
.view-grid .slot { position: relative; display: flex; flex-direction: column; gap: 1px;
                   border: 1px solid var(--line); border-radius: 11px; padding: 8px 9px; background: var(--surface); }
.view-grid .slot--booked { border-inline-start: 4px solid var(--pos); }
.view-grid .slot--free   { border: 1px dashed #e2c48c; background: #fffcf5; }
.view-grid .slot--brk    { background: #f4f5f8; border-style: dashed; }
.view-grid .s-time { font-size: 15.5px; font-weight: 800; text-align: right; }
/* שם תלמיד מלא — נשבר לשורה שנייה במקום להיחתך ב"…" */
.view-grid .s-name { font-size: 14px; line-height: 1.3; white-space: normal; overflow-wrap: anywhere; }
.view-grid .s-meta { text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.view-grid .s-meta:empty { display: none; }
.view-grid .s-act { position: absolute; top: 4px; inset-inline-end: 4px; }
.view-grid .slot--free .s-act, .view-grid .slot--pend .s-act { position: static; margin-top: 6px; }
.view-grid .slot--free .s-act .btn-line { width: 100%; padding: 5px 10px; }
.view-grid .s-cancel span { display: none; }
.view-grid .slot--booked .s-act { opacity: .35; transition: opacity .15s; }
.view-grid .slot--booked:hover .s-act, .view-grid .slot--booked:focus-within .s-act { opacity: 1; }
/* כפתור "הפסקה" על תור פנוי + ביטול הפסקה */
.s-brk { color: var(--muted) !important; padding: 4px 9px !important; font-size: 12.5px !important; }
.s-brk:hover { color: var(--ink) !important; }
.view-grid .slot--free .s-act { display: flex; }
.view-grid .slot--free .s-act .btn-line { flex: 1; width: auto; }
.view-grid .slot--brk .s-act { opacity: .35; transition: opacity .15s; }
.view-grid .slot--brk:hover .s-act, .view-grid .slot--brk:focus-within .s-act { opacity: 1; }
/* חלון ההפסקה */
.brk-opts { display: grid; gap: 8px; margin-top: 14px; }
.brk-opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line);
           border-radius: 10px; cursor: pointer; font-size: 14px; }
.brk-opt:has(input:checked) { border-color: var(--brand); background: #f5f7ff; }
.brk-opt input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--brand); flex: none; }
.brk-opt small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.brk-sum { margin-top: 12px; padding: 9px 12px; border-radius: 10px; background: #eef7f1; color: #1d7a4a; font-size: 13.5px; }
.brk-sum.is-warn { background: #fff4e0; color: #9a5b00; }

/* דף "לא קבעו" — קובייה רחבה מעט יותר, כדי שבחירת התור תיכנס בתוכה */
.view-grid .slot-list--pend { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.view-grid .slot--pend { border-inline-start: 4px solid var(--neg); }

/* שורות */
.view-rows .slot-head, .view-rows .slot {
  display: grid; grid-template-columns: 62px minmax(120px, 220px) 110px 120px 1fr;
  gap: 12px; align-items: center; padding: 8px 10px; }
.view-rows .slot-head--pend, .view-rows .slot--pend { grid-template-columns: minmax(120px, 220px) 110px 120px 1fr; }
.view-rows .slot-head { font-size: 12.5px; font-weight: 600; color: var(--muted); background: #fafbfe;
                        border-bottom: 2px solid var(--line); margin-top: 10px; border-radius: 8px 8px 0 0; }
.view-rows .slot { border-bottom: 1px solid var(--line); font-size: 14.5px; }
.view-rows .slot:hover { background: #fafbfe; }
.view-rows .slot:last-child { border-bottom: 0; }
.view-rows .slot--free { background: #fffcf5; }
.view-rows .slot--brk { color: var(--muted); background: #f7f8fb; }
.view-rows .s-time { font-weight: 700; text-align: right; }
.view-rows .s-name { white-space: normal; overflow-wrap: anywhere; line-height: 1.3; }
.view-rows .s-meta { display: contents; }            /* ת"ז וטלפון — עמודות נפרדות */
.view-rows .s-meta .sep { display: none; }
.view-rows .s-tz, .view-rows .s-ph { text-align: right; font-size: 13.5px; color: var(--muted); }
.s-ph { white-space: nowrap; }                       /* הטלפון ו"+N" (עוד טלפונים) באותה שורה */
.s-ph .chip { margin-inline-start: 4px; padding: 0 6px; font-size: 11px; line-height: 1.5; vertical-align: baseline; }
.view-rows .slot--brk .s-meta, .view-rows .slot--free .s-meta { display: block; grid-column: span 2; }
.view-rows .s-act { justify-self: end; }
.view-rows .quick-book { width: 260px; max-width: 100%; }

/* ---- students.php: פריט תלמיד + הוספה ---- */
.ap-add { height: 40px; padding: 0 14px; }
.ap-add svg { width: 16px; height: 16px; }
.s-status { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.s-status .chip { padding: 3px 9px; font-size: 12px; }
.s-edit { padding: 4px 8px !important; }
.s-edit svg { width: 14px !important; height: 14px !important; }
.s-act { display: inline-flex; gap: 2px; align-items: center; }
.view-grid .slot--stu { border-inline-start: 4px solid var(--line); }
.view-grid .slot--stu.is-booked { border-inline-start-color: var(--pos); }
.view-grid .slot--stu.is-open   { border-inline-start-color: var(--warn); }
.view-grid .slot--stu .s-status { margin-top: 5px; }
.view-grid .slot--stu .s-name { padding-inline-end: 52px; } /* מקום לכפתורי עריכה/מחיקה */
.view-grid .slot--stu .s-act { opacity: .4; transition: opacity .15s; }
.view-grid .slot--stu:hover .s-act, .view-grid .slot--stu:focus-within .s-act { opacity: 1; }
.view-grid .s-edit span { display: none; }
.slot--add { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 64px;
             border: 1.5px dashed #c9d3ea !important; background: transparent !important; color: var(--brand);
             font: inherit; font-size: 14px; font-weight: 600; border-radius: 11px; cursor: pointer; }
.slot--add:hover { background: var(--brand-soft) !important; }
.slot--add svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.view-rows .slot-head--stu, .view-rows .slot--stu { grid-template-columns: minmax(120px, 220px) 110px 158px minmax(130px, 1fr) auto; }
.view-rows .slot--add { margin-top: 8px; min-height: 42px; }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; margin-top: 14px; }

@media (max-width: 1000px) {
  .ap-bar, .ap-filters { flex-wrap: wrap; }
  .ap-filters { flex: 1 1 100%; }
  .ap-tools { width: 100%; }
  .ap-search { flex: 0 1 230px; }
}
@media (max-width: 760px) {
  .ap-filters { width: 100%; }
  .ap-search { width: 100%; flex: 1 1 100%; }
  .ap-filters select { flex: 1 1 40%; min-width: 0; }
  .ap-check { width: 100%; height: auto; padding: 2px 4px; }
  .seg button span { display: none; }
  .view-grid .slot-list { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .view-grid .s-meta { white-space: normal; overflow: visible; }  /* בטלפון: הטלפון יורד שורה במקום להיחתך */
  .view-grid .s-meta .sep { display: none; }
  .view-grid .s-meta .s-ph { display: block; }
  .view-rows .slot-head { display: none; }
  .view-rows .slot { grid-template-columns: 54px 1fr auto; grid-template-areas: "t n a" "t m a"; row-gap: 2px; }
  .view-rows .slot--pend { grid-template-columns: 1fr auto; grid-template-areas: "n a" "m a"; }
  .view-rows .s-time { grid-area: t; } .view-rows .s-name { grid-area: n; } .view-rows .s-act { grid-area: a; }
  .view-rows .s-meta, .view-rows .slot--brk .s-meta, .view-rows .slot--free .s-meta { display: block; grid-area: m; grid-column: auto; font-size: 12.5px; }
  .view-rows .s-meta .sep { display: inline; }
  .view-rows .quick-book { width: 180px; }
  .view-rows .slot--stu { grid-template-columns: 1fr auto; grid-template-areas: "n a" "m a" "s a"; }
  .view-rows .slot--stu .s-status { grid-area: s; }
  .form-2 { grid-template-columns: 1fr; }
  .view-grid .slot--stu .s-name { white-space: normal; }  /* שם ארוך יורד שורה במקום להיחתך */
  .cls-head { padding: 11px 13px; } .cls-body { padding: 2px 13px 13px; }
  .cls-chips { margin-inline-start: 38px; width: 100%; }
}
@media print {
  .ap-bar, .pend, .s-act, .cls-chev { display: none !important; }
  .cls-card.is-closed .cls-body { display: block; }
}

/* סקירה: תג קטן "מלא · N לא קבעו" (אין תורים פנויים ויש שלא קבעו) — מתריע בעדינות */
.full-chip { display: inline-block; margin-inline-start: 6px; padding: 1px 8px; border-radius: 999px;
             font-size: 11.5px; font-weight: 600; background: var(--warn-soft); color: var(--warn); vertical-align: middle; }

/* ==========================================================================
   טאבלט וטלפון: פס עליון וטאבים
   ========================================================================== */
.tabs-toggle { display: none; }
.tabs a > span { min-width: 0; }

/* טאבלט (לאורך ולרוחב צר): כל 7 הטאבים בשורה אחת — אייקון ומתחתיו השם, בלי גלילה הצידה */
@media (max-width: 1100px) {
  .tabs { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; padding: 0 6px; overflow: visible; }
  .tabs a { flex-direction: column; gap: 4px; padding: 10px 4px 9px; font-size: 13px; line-height: 1.2;
            white-space: normal; text-align: center; justify-content: center; min-height: 62px; }
  .tabs a svg { width: 20px; height: 20px; }
  /* פס עליון: מפנים מקום לשם המוסד */
  .topbar .meeting-label { display: none; }
  .topbar .refresh span { display: none; }
  .topbar { gap: 10px; }
  /* טבלאות: תאים צפופים יותר והתקדמות צרה — נכנסות ברוחב בלי גלילה הצידה */
  .rt thead th, .rt tbody td { padding: 10px 8px; }
  .rt thead th { white-space: normal; }
  .rt thead th[style*="min-width"] { min-width: 90px !important; }
  .rt .bar { min-width: 60px; }
}

/* טלפון: פס עליון בשתי שורות, והטאבים נפתחים מכפתור */
@media (max-width: 600px) {
  .topbar { flex-wrap: wrap; padding: 8px 12px; row-gap: 8px; min-height: 0; }
  .topbar .school { flex: 1 1 calc(100% - 100px); order: 0; }
  .topbar .logout { order: 1; }
  .topbar .line-pill, .topbar .live-wrap, .topbar .meeting, .topbar .refresh { order: 2; }
  .topbar .meeting { margin-inline-start: auto; }

  .tabs { display: block; padding: 0; }
  .tabs-toggle { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px;
                 background: none; border: 0; font: inherit; font-size: 15.5px; font-weight: 600; color: var(--brand);
                 padding: 11px 14px; cursor: pointer; min-height: 48px; }
  .tabs-toggle .tt-btn { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: var(--muted); font-weight: 500;
                         border: 1px solid var(--line); border-radius: 9px; padding: 6px 11px; }
  .tabs-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
  .tabs a { display: none; }
  .tabs.open { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 0 10px 10px; }
  .tabs.open .tabs-toggle { grid-column: 1 / -1; padding-inline: 4px; }
  .tabs.open a { display: flex; flex-direction: row; justify-content: flex-start; gap: 9px; font-size: 14.5px; text-align: start;
                 padding: 12px; min-height: 48px; border: 1px solid var(--line); border-radius: 10px; border-bottom-width: 1px; }
  .tabs.open a.on { background: var(--brand-soft); border-color: var(--brand-soft); }
}

/* טלפון: כל שורת טבלה = כרטיס, עם שם העמודה ליד הערך (התוויות נוספות ב-JS ב-_layout.php) */
@media (max-width: 600px) {
  table.rt, .rt tbody, .rt tr, .rt td { display: block; width: 100%; }
  .rt thead { display: none; }
  .table-wrap:has(> table.rt) { overflow: visible; }
  .rt tbody tr { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; margin-bottom: 10px; }
  .rt td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); text-align: start; }
  .rt td:last-child { border-bottom: none; }
  .rt td::before { content: attr(data-label); color: var(--muted); font-size: 13px; font-weight: 500; flex: none; max-width: 42%; }
  .rt td[data-label=""]::before { display: none; }
  .rt td.rt-wide { display: block; }
  .rt td.rt-wide::before { display: none; }
  .rt td .bar { flex: 1; max-width: 55%; }
  .rt td { flex-wrap: wrap; }
  .rt td > * { min-width: 0; max-width: 100%; }
  .rt td [style*="nowrap"], .rt td .nowrap { white-space: normal !important; }
}

/* חלונות קופצים: לעולם לא גבוהים מהמסך — גלילה בתוך החלון (טאבלט לרוחב / טלפון) */
.modal { max-height: calc(100vh - 36px); max-height: calc(100dvh - 36px); overflow-y: auto; overscroll-behavior: contain; }

/* =========================================================================
   מסכי מגע (טאבלט / טלפון): אין ריחוף — כפתורי הפעולה גלויים תמיד ובגודל אצבע
   ========================================================================= */
@media (pointer: coarse) {
  .view-grid .slot--booked .s-act, .view-grid .slot--brk .s-act, .view-grid .slot--stu .s-act { opacity: 1; }
  .s-edit, .s-cancel { padding: 8px 10px !important; min-height: 38px; }
  .s-edit svg, .s-cancel svg { width: 17px !important; height: 17px !important; }
  .s-brk { padding: 8px 11px !important; min-height: 38px; }
  .view-grid .slot--stu .s-name { padding-inline-end: 86px; }
  .view-grid .s-act { gap: 4px; }
  .quick-book select, .quick-book .btn-sm { height: 42px; }
  .btn-sm { min-height: 40px; }
  input[type=text], input[type=password], input[type=tel], input[type=number],
  input[type=datetime-local], input[type=search], input[type=date], input[type=time], select, textarea { font-size: 16px; min-height: 44px; }
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; }
  .live-pill, .topbar .line-pill { min-height: 34px; }
  .topbar .refresh { min-width: 40px; min-height: 40px; justify-content: center; }
}

/* דוח להדפסה בטאבלט לאורך: ההגדרות בשתי עמודות, כדי שהתצוגה המקדימה תופיע מהר יותר בגלילה */
@media (min-width: 641px) and (max-width: 1000px) {
  #opts { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; align-items: start; }
  #opts > .opt-head, #opts > .grade-picks, #opts > .cls-list, #opts > noscript { grid-column: 1 / -1; }
  #opts > .opt-group { margin-bottom: 15px; }
  #opts .cls-list { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 18px; max-height: none; }
}
