/* ===== שפה עיצובית: מערכת הרישום (תואמת לאזור האישי) ===== */
@font-face { font-family: Heebo; src: url('/hebrew.woff2') format('woff2'); font-weight: 400 800; font-display: swap; unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: Heebo; src: url('/latin.woff2') format('woff2'); font-weight: 400 800; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --ink: #29342c; --muted: #566057; --faint: #7a837b;
  --brand: #334237; --brand-2: #3f5a48; --brand-ink: #24583a; --gold: #b58a2a;
  --canvas: #f5f2ea; --paper: #fffdf8; --soft: #ece8dd; --border: #e0dacf; --border-strong: #c9c1b2;
  --focus: #1d5fa8;
  --present: #24583a; --present-bg: #e3efe6;
  --late: #7a4f00; --late-bg: #fbefd5;
  --absent: #97302a; --absent-bg: #f7e3e1;
  --approved: #34506b; --approved-bg: #e6edf4;
  --none: #5d665f; --none-bg: #eef0ee;
  --susp: #7d786d; --susp-bg: #f1eee8;
  --green-pct: #e3efe6; --yellow-pct: #fbefd5; --red-pct: #f7e3e1;
  --radius: 14px; --radius-sm: 10px;
  --shadow: 0 3px 12px #3228180d; --shadow-lg: 0 18px 48px #1e1a1238;
  --sidebar: 264px;
  font-family: Heebo, Arial, sans-serif; color: var(--ink); background: var(--canvas);
  font-size: 16px; line-height: 1.5; color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-inline-size: 300px; background: var(--canvas); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.25; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: -9999px; top: 8px; z-index: 100; background: var(--paper); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); }
.skip:focus { inset-inline-start: 8px; }
.icon { flex: none; }
.num { font-variant-numeric: tabular-nums; }

/* ===== מבנה: תפריט צד + תוכן ===== */
.layout { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.layout.no-sidebar { grid-template-columns: 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--paper); border-inline-start: 1px solid var(--border); display: flex; flex-direction: column; padding: 14px 12px; gap: 6px; }
.bh { font-size: .8rem; color: var(--muted); align-self: flex-start; }
.brand-block { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 6px 4px 14px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.brand-block img { width: 52px; height: 52px; border-radius: 50%; }
.brand-name { font-weight: 800; font-size: 1.05rem; color: var(--brand); line-height: 1.3; }
.brand-sub { font-size: .85rem; color: var(--muted); }
.nav-group { display: grid; gap: 2px; margin-top: 6px; }
.nav-label { font-size: .75rem; font-weight: 700; color: var(--faint); padding: 8px 12px 2px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 600; min-height: 44px; }
.nav-link:hover { background: var(--soft); }
.nav-link[aria-current="page"] { background: #e6e1d4; color: var(--brand); }
.nav-link .badge { margin-inline-start: auto; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 10px; display: grid; gap: 6px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.avatar-sm { width: 34px; height: 34px; border-radius: 50%; background: var(--soft); color: var(--brand); display: grid; place-items: center; font-weight: 800; font-size: .85rem; flex: none; }
.user-chip .who-name { font-weight: 700; line-height: 1.2; }
.user-chip .who-role { font-size: .8rem; color: var(--muted); }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: var(--paper); border-bottom: 1px solid var(--border); min-height: 60px; }
.topbar .menu-btn { display: none; }
.topbar-title { font-weight: 700; color: var(--brand); }
.topbar-end { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; }
main { padding: 24px; width: 100%; max-width: 1480px; margin: 0 auto; flex: 1; }
main:focus { outline: none; }
.footer { text-align: center; color: var(--faint); font-size: .85rem; padding: 18px; }

.drawer-backdrop { display: none; }
@media (max-width: 1023px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(86vw, 300px); z-index: 60; transform: translateX(100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .drawer-backdrop.open { display: block; position: fixed; inset: 0; background: #1b1d1a66; z-index: 55; }
  .topbar .menu-btn { display: inline-grid; }
  main { padding: 16px; }
  .topbar { padding: 8px 12px; }
}

/* ===== מחוון חיבור ===== */
.conn { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-size: .88rem; font-weight: 600; background: var(--present-bg); color: var(--present); white-space: nowrap; }
.conn.busy { background: var(--late-bg); color: var(--late); }
.conn.off { background: #fde7c2; color: #6b4300; }
.conn .warn { color: var(--absent); font-weight: 800; }

/* ===== כפתורים ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--radius-sm); border: 1px solid transparent; font-weight: 700; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #26332a; }
.btn-secondary { background: var(--paper); color: var(--brand); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--soft); }
.btn-quiet { background: transparent; color: var(--brand-2); padding: 0 10px; }
.btn-quiet:hover:not(:disabled) { background: var(--soft); }
.btn-danger { background: var(--absent); color: #fff; }
.btn-lg { min-height: 56px; font-size: 1.05rem; padding: 0 22px; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: .9rem; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; color: var(--ink); }
.icon-btn:hover { background: var(--soft); }
.link { background: none; border: 0; color: var(--brand-2); text-decoration: underline; cursor: pointer; padding: 6px 0; min-height: 44px; }

/* ===== כותרת דף, כרטיסים ===== */
.page { display: grid; gap: 18px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-title { margin: 0; font-size: 1.65rem; font-weight: 800; }
.page-title:focus { outline: none; }
.page-sub { margin: 4px 0 0; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 0; }
.card-head h2 { margin: 0; font-size: 1.12rem; }
.card-body { padding: 16px 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.stat { display: grid; gap: 4px; }
.stat .stat-label { color: var(--muted); font-weight: 600; font-size: .92rem; display: flex; gap: 8px; align-items: center; }
.stat .stat-value { font-size: 2rem; font-weight: 800; line-height: 1.1; }
.stat .stat-note { color: var(--muted); font-size: .85rem; }
.hero { background: linear-gradient(120deg, #2a3a2f, #3b4c40); color: #fff; border-radius: var(--radius); padding: 22px 24px; display: flex; flex-wrap: wrap; gap: 18px; align-items: center; }
.hero h1, .hero h2 { margin: 0; }
.hero .eyebrow { color: #e7c77c; font-weight: 700; font-size: .9rem; }
.hero .hero-sub { opacity: .88; margin: 4px 0 0; }

/* ===== תוויות ===== */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .85rem; font-weight: 700; white-space: nowrap; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-present { background: var(--present-bg); color: var(--present); }
.pill-late { background: var(--late-bg); color: var(--late); }
.pill-absent { background: var(--absent-bg); color: var(--absent); }
.pill-approved { background: var(--approved-bg); color: var(--approved); }
.pill-none { background: var(--none-bg); color: var(--none); }
.pill-suspended { background: var(--susp-bg); color: var(--susp); }
.pill-unmarked { background: transparent; color: var(--faint); border: 1px dashed var(--border-strong); }
.badge { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; background: var(--absent); color: #fff; font-size: .78rem; font-weight: 800; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: .78rem; font-weight: 700; background: var(--soft); color: var(--muted); }
.tag-internal { background: #fbefd5; color: #7a4f00; }
.tag-external { background: #e6edf4; color: #34506b; }

/* ===== אחוזים ===== */
.pct { display: inline-grid; gap: 0; text-align: center; padding: 4px 10px; border-radius: 10px; min-width: 64px; font-variant-numeric: tabular-nums; }
.pct strong { font-size: 1.02rem; }
.pct small { font-size: .74rem; color: var(--muted); font-weight: 500; }
.pct-green { background: var(--green-pct); }
.pct-yellow { background: var(--yellow-pct); }
.pct-red { background: var(--red-pct); }
.pct-none { color: var(--faint); }
.pct-big { padding: 10px 18px; }
.pct-big strong { font-size: 2rem; }

/* ===== טפסים ===== */
.field { display: grid; gap: 6px; align-content: start; }
.field label { font-weight: 700; font-size: .95rem; }
.field .req { color: var(--absent); }
.field-hint { margin: 0; color: var(--muted); font-size: .85rem; }
.field-error { margin: 0; color: var(--absent); font-size: .88rem; font-weight: 600; min-height: 0; }
.field-error:empty { display: none; }
.input { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; }
.input:disabled { background: var(--soft); color: var(--muted); }
.input[aria-invalid] { border-color: var(--absent); box-shadow: 0 0 0 1px var(--absent); }
textarea.input { resize: vertical; min-height: 90px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px 16px; }
.form-section { border: 1px solid var(--border); border-radius: var(--radius); background: var(--paper); padding: 16px 18px; margin: 0; }
.form-section legend { font-weight: 800; padding: 0 6px; color: var(--brand); }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.inline-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.date-trigger { display: flex; align-items: center; gap: 10px; text-align: start; cursor: pointer; }
.date-texts { display: grid; line-height: 1.2; }
.date-sub { font-size: .75rem; color: var(--faint); }

/* לוח שנה עברי */
.calendar { display: grid; gap: 8px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; }
.cal-title { margin: 0; font-size: 1.1rem; }
.cal-weekdays, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal-weekdays span { font-weight: 700; color: var(--muted); font-size: .85rem; }
.cal-day { display: grid; place-items: center; gap: 0; min-height: 48px; border-radius: 10px; border: 1px solid transparent; background: transparent; cursor: pointer; }
.cal-day:hover:not(:disabled) { background: var(--soft); }
.cal-day.today { border-color: var(--gold); }
.cal-day.selected { background: var(--brand); color: #fff; }
.cal-day.selected .cal-greg { color: #d9e2da; }
.cal-day:disabled { opacity: .35; cursor: not-allowed; }
.cal-heb { font-weight: 700; font-size: 1rem; line-height: 1.1; }
.cal-greg { font-size: .68rem; color: var(--faint); }

/* ===== חלוניות ===== */
.dialog { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); box-shadow: var(--shadow-lg); background: var(--paper); color: var(--ink); }
.dialog-sm { width: min(420px, calc(100vw - 24px)); }
.dialog-lg { width: min(820px, calc(100vw - 24px)); }
.dialog::backdrop { background: #1b1d1a73; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px 6px; position: sticky; top: 0; background: var(--paper); z-index: 1; }
.dialog-head h2 { margin: 0; font-size: 1.2rem; }
.dialog-body { padding: 8px 18px 18px; display: grid; gap: 14px; }
.dialog-foot { display: flex; gap: 10px; padding: 12px 18px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; position: sticky; bottom: 0; background: var(--paper); }
.confirm-text { margin: 0; font-size: 1.02rem; }

/* ===== הודעות קופצות ===== */
.toasts { position: fixed; bottom: 18px; inset-inline: 0; display: grid; justify-items: center; gap: 8px; z-index: 90; pointer-events: none; padding: 0 12px; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; background: #233027; color: #fff; padding: 10px 12px 10px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); max-width: min(560px, 100%); font-weight: 600; animation: rise .18s ease-out; }
.toast-error { background: #7f2621; }
.toast.leaving { opacity: 0; transition: opacity .2s; }
.toast-action { background: #ffffff1f; color: #ffe2a3; border: 0; border-radius: 8px; padding: 6px 12px; font-weight: 800; cursor: pointer; min-height: 36px; }
.toast-close { background: none; border: 0; color: #fff; opacity: .8; cursor: pointer; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ===== לשוניות ===== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: thin; }
.tab { border: 0; background: none; padding: 12px 16px; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; min-height: 46px; }
.tab[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }
.tab:hover { color: var(--ink); }

/* ===== סרגל כלים, שבבים ===== */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar .input { width: auto; min-width: 160px; }
.search { position: relative; flex: 1 1 240px; }
.search .icon { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search .input { padding-inline-start: 40px; width: 100%; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--paper); cursor: pointer; font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; }
.segmented button { border: 0; background: var(--paper); padding: 0 14px; min-height: 42px; font-weight: 600; cursor: pointer; }
.segmented button + button { border-inline-start: 1px solid var(--border); }
.segmented button[aria-pressed="true"] { background: var(--brand); color: #fff; }

/* ===== טבלאות ===== */
.table-wrap { overflow: auto; background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); max-height: 72vh; box-shadow: var(--shadow); }
table.data { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .95rem; }
table.data th, table.data td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: start; vertical-align: middle; }
table.data thead th { position: sticky; top: 0; background: #f1ede3; z-index: 2; font-weight: 800; font-size: .88rem; color: var(--muted); white-space: nowrap; }
table.data tbody tr:hover td, table.data tbody tr:hover th { background: #faf7f0; }
table.data tr.clickable { cursor: pointer; }
table.data tr.row-muted td { color: var(--faint); }
table.data .sticky-col { position: sticky; inset-inline-start: 0; background: var(--paper); z-index: 1; }
table.data thead .sticky-col { z-index: 3; background: #f1ede3; }
.th-sort { background: none; border: 0; font: inherit; color: inherit; cursor: pointer; padding: 0; display: inline-flex; align-items: center; gap: 4px; }
.table-foot { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: .9rem; padding: 4px 2px; }

/* טבלת נוכחות */
table.att { font-size: .9rem; }
table.att th, table.att td { padding: 6px 6px; }
table.att thead tr:first-child th { top: 0; }
table.att thead tr:nth-child(2) th { top: 38px; }
table.att .day-head { text-align: center; border-inline-start: 2px solid var(--border-strong); font-size: .82rem; color: var(--ink); }
table.att .day-head small { display: block; color: var(--muted); font-weight: 600; }
table.att .seder-head { text-align: center; font-size: .8rem; min-width: 40px; }
table.att .seder-head.day-start, table.att td.day-start { border-inline-start: 2px solid var(--border-strong); }
table.att td.cell { text-align: center; padding: 3px; }
.cellmark { display: inline-grid; place-items: center; width: 34px; height: 30px; border-radius: 7px; font-weight: 800; font-size: .85rem; }
.cellmark.present { background: var(--present-bg); color: var(--present); }
.cellmark.late { background: var(--late-bg); color: var(--late); font-size: .74rem; }
.cellmark.absent { background: var(--absent-bg); color: var(--absent); }
.cellmark.approved { background: var(--approved-bg); color: var(--approved); }
.cellmark.none { color: #a3aaa4; }
.cellmark.suspended { color: #b4ada0; }
button.cellmark { border: 0; cursor: pointer; }

/* ===== מצבים ===== */
.empty { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 40px 16px; color: var(--muted); }
.empty h3 { margin: 4px 0 0; color: var(--ink); }
.empty p { margin: 0; max-width: 46ch; }
.empty-error .icon { color: var(--absent); }
.skeleton { display: grid; gap: 12px; padding: 20px; }
.sk-line { height: 18px; border-radius: 8px; background: linear-gradient(90deg, #ebe6da 0%, #f5f1e8 50%, #ebe6da 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
.sk-line:nth-child(3n) { width: 70%; } .sk-line:nth-child(3n+2) { width: 88%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: #fdf3dc; color: #5f4000; }
.notice-info { background: var(--approved-bg); color: var(--approved); }

/* ===== כניסה ===== */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 100% 0, #e9eee4, var(--canvas)); }
.auth-card { width: min(440px, 100%); background: var(--paper); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 28px; display: grid; gap: 14px; }
.auth-brand { display: grid; justify-items: center; gap: 6px; text-align: center; }
.auth-brand img { width: 64px; height: 64px; border-radius: 50%; }
.auth-brand h1 { margin: 0; font-size: 1.35rem; color: var(--brand); }
.auth-alt { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: .85rem; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ===== מסך הרישום ===== */
.reg { display: grid; gap: 14px; }
.seder-bar { background: linear-gradient(120deg, #2a3a2f, #3b4c40); color: #fff; border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 12px; }
.seder-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.seder-pick { display: grid; gap: 2px; }
.seder-pick select { font-size: 1.25rem; font-weight: 800; background: transparent; color: #fff; border: 1px solid #ffffff40; border-radius: 10px; padding: 6px 10px; min-height: 48px; max-width: 100%; }
.seder-pick select option { color: var(--ink); }
.seder-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: .92rem; opacity: .92; }
.seder-meta span { display: inline-flex; gap: 6px; align-items: center; }
.counters { display: flex; gap: 8px; flex-wrap: wrap; }
.counter { background: #ffffff1a; border-radius: 12px; padding: 8px 14px; text-align: center; min-width: 86px; }
.counter strong { display: block; font-size: 1.45rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.counter span { font-size: .8rem; opacity: .9; }
.counter.warn strong { color: #ffd38a; }
.reg-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.reg-foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; color: var(--muted); }
.status-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.choice { display: grid; justify-items: center; gap: 4px; padding: 14px 8px; border-radius: 14px; border: 2px solid var(--border); background: var(--paper); font-weight: 800; font-size: 1.05rem; cursor: pointer; min-height: 76px; }
.choice[aria-pressed="true"] { outline: 3px solid var(--focus); outline-offset: 1px; }
.choice.present { color: var(--present); border-color: #9cc6ab; background: var(--present-bg); }
.choice.late { color: var(--late); border-color: #e6c77f; background: var(--late-bg); }
.choice.absent { color: var(--absent); border-color: #e2aaa4; background: var(--absent-bg); }
.minutes { display: flex; align-items: center; gap: 8px; }
.minutes .input { width: 90px; text-align: center; font-weight: 800; font-size: 1.1rem; }
.mark-dialog-head { display: flex; align-items: center; gap: 12px; }
.muted { color: var(--muted); }

/* ===== כרטיס תלמיד ===== */
.student-hero .hero-main { flex: 1; min-width: 220px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
.facts dt { color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; }
.day-card { background: var(--paper); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; }
.day-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.day-card li { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: .9rem; }
.note-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.note-list li { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--paper); display: grid; gap: 6px; }
.note-list p { margin: 0; white-space: pre-wrap; }
.note-meta { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: .85rem; flex-wrap: wrap; }

/* ===== אשף ===== */
.steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0; flex-wrap: wrap; }
.steps li { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--soft); color: var(--muted); font-weight: 700; font-size: .9rem; }
.steps li[aria-current="step"] { background: var(--brand); color: #fff; }
.steps li.done { background: var(--present-bg); color: var(--present); }
.steps .n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #ffffff55; font-size: .8rem; }
.preview-sms { background: #eef3ee; border-radius: 16px 16px 4px 16px; padding: 12px 14px; white-space: pre-wrap; max-width: 420px; border: 1px solid #d5e3d7; }
.cell-off { color: #b9b3a6; }
.picklist { max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: 12px; padding: 6px; display: grid; gap: 2px; background: #fff; }
.picklist label { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.picklist label:hover { background: var(--soft); }
.chosen { display: flex; flex-wrap: wrap; gap: 6px; }
.chosen .pill { background: var(--soft); color: var(--ink); }
.chosen .pill button { border: 0; background: none; cursor: pointer; padding: 0 2px; display: grid; place-items: center; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print { .sidebar, .topbar, .toolbar, .page-actions { display: none !important; } .layout { display: block; } main { padding: 0; } .table-wrap { max-height: none; overflow: visible; box-shadow: none; } }

.flip { transform: rotate(180deg); }

/* תיקונים אחרי בדיקה חזותית */
.page > *, .reg > *, .main-col > * { min-width: 0; }
.segmented { flex-wrap: wrap; }
.reg-tools > select.input, .toolbar > select.input { width: auto; min-width: 170px; flex: 0 1 auto; }
table.att th.sticky-col { white-space: nowrap; }
table.att .day-head strong { display: block; font-size: .85rem; }
table.att .day-head small { font-weight: 500; }
button.cellmark { background: transparent; }
button.cellmark.present { background: var(--present-bg); }
button.cellmark.late { background: var(--late-bg); }
button.cellmark.absent { background: var(--absent-bg); }
button.cellmark.approved { background: var(--approved-bg); }
button.cellmark:hover { outline: 2px solid var(--border-strong); }
table.att thead tr:first-child th { height: 50px; }
table.att thead tr:nth-child(2) th { top: 50px; }
.day-card { min-width: 0; }
.day-card li { flex-wrap: wrap; }
.day-card .pill { font-size: .78rem; padding: 2px 8px; }
a { color: var(--brand-2); }
table.data a { text-decoration: none; font-weight: 700; color: var(--brand); }
table.data a:hover, table.data a:focus-visible { text-decoration: underline; }
.card-body > *, .dialog-body > *, .field > *, [style*="display: grid"] > * { min-width: 0; }
.card-body { min-width: 0; }

/* ===================== גרסה 2: רכיבים ומסכים חדשים ===================== */
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.contact-link { color: var(--brand-ink); font-weight: 600; text-decoration: none; }
.contact-link:hover, .contact-link:focus-visible { text-decoration: underline; }
.ext-link { display: inline-flex; gap: 4px; align-items: center; }
.link-btn { border: 0; background: none; padding: 0; cursor: pointer; color: var(--brand); font-weight: 700; text-align: start; }
.link-btn:hover { text-decoration: underline; }
.plain-list { margin: 6px 0 0; padding-inline-start: 18px; }
.mini-title { margin: 0 0 6px; font-size: .95rem; color: var(--muted); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.inline-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--muted); }
.inline-label .input { width: auto; min-width: 170px; }
.name-cell { display: inline-flex; align-items: center; gap: 8px; }
.btn-ai { background: linear-gradient(120deg, #2f4a3a, #46664f); color: #fff; min-height: 40px; padding: 0 14px; }
.btn-ai:hover { filter: brightness(1.08); }
.card-head { gap: 10px; flex-wrap: wrap; }
.card-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-actions .input { width: auto; min-height: 38px; padding: 4px 10px; }

/* תמונות */
.avatar { display: inline-grid; place-items: center; flex: none; border-radius: 50%; overflow: hidden; background: var(--soft); color: var(--brand); font-weight: 800; border: 0; padding: 0; line-height: 1; }
.avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-zoom { cursor: zoom-in; }
.avatar-zoom:hover, .avatar-zoom:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.photo-view { display: grid; justify-items: center; gap: 10px; }
.photo-large { max-width: 100%; max-height: 70vh; border-radius: 14px; background: var(--soft); object-fit: contain; min-width: 220px; min-height: 220px; }
.hero-photo { position: relative; flex: none; }
.student-hero .avatar.photo { border: 3px solid #e7d9b5; background: #ffffff22; color: #fff; }
.photo-edit { position: absolute; inset-block-end: -2px; inset-inline-start: -2px; width: 34px; height: 34px; border-radius: 50%; border: 2px solid #fff; background: var(--gold); color: #fff; display: grid; place-items: center; cursor: pointer; }
.hero-stat { text-align: center; }
.hero-stat-label { font-size: .85rem; opacity: .85; }
.hero .page-actions .btn { background: #ffffff1f; color: #fff; border-color: #ffffff40; }
.hero .page-actions .btn:hover { background: #ffffff33; }

/* מסך הרישום: כרטיס אופקי. התמונה היא כפתור נפרד (הגדלה), וכל השאר כפתור הרישום. */
.cards { display: grid; gap: 8px; align-content: start; }
.cards.size-1 { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
.cards.size-2 { grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); }
.cards.size-3 { grid-template-columns: repeat(auto-fill, minmax(226px, 1fr)); }
.cards.size-4 { grid-template-columns: repeat(auto-fill, minmax(264px, 1fr)); }
.cards.size-5 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.scell { position: relative; min-width: 0; }
.scard { display: flex; align-items: center; width: 100%; height: 100%; min-height: calc(var(--photo, 58px) + 20px); padding: 8px 10px; padding-inline-start: calc(var(--photo, 58px) + 20px); background: var(--paper); border: 2px solid var(--border); border-radius: 14px; cursor: pointer; text-align: start; transition: background .12s, border-color .12s; }
.scard:active { transform: scale(.99); }
.scard .stext { display: grid; gap: 2px; min-width: 0; width: 100%; }
.scard .sname { font-weight: 800; line-height: 1.25; font-size: 1rem; overflow-wrap: anywhere; }
.scard .smeta { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scard .sstate { display: flex; margin-top: 2px; }
.size-1 .scard .sname { font-size: .9rem; } .size-1 .scard .smeta { display: none; }
.size-5 .scard .sname { font-size: 1.15rem; }
.scell .sphoto { position: absolute; inset-inline-start: 10px; top: 50%; transform: translateY(-50%); z-index: 1; }
.scell span.sphoto { pointer-events: none; }
.scard.present { border-color: #7fb293; background: #f3f9f4; }
.scard.late { border-color: #e0b75e; background: #fdf8ec; }
.scard.absent { border-color: #d99a94; background: #fcf2f1; }
.scard.approved { border-style: dashed; border-color: #9fb2c6; background: #f5f8fb; }
.scard.suspended { opacity: .6; }
.scard:disabled { cursor: default; }
.cards-divider { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; color: var(--muted); font-weight: 700; font-size: .9rem; margin-top: 6px; }
.cards-divider::after { content: ''; flex: 1; height: 1px; background: var(--border-strong); }
.reg-tools .chip { display: inline-flex; align-items: center; gap: 6px; }

/* מקרא וטווח תאריכים בטבלת הנוכחות */
.legend { display: flex; gap: 8px 16px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: .88rem; margin: 0; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend-item .cellmark { display: inline-grid; place-items: center; flex: none; }
.legend-note { flex-basis: 100%; font-size: .82rem; }
.range-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.range-field { display: grid; gap: 4px; flex: 0 1 260px; min-width: 200px; }
.range-label { font-size: .85rem; font-weight: 700; color: var(--muted); }
table.att.dense { font-size: .82rem; }
table.att.dense th, table.att.dense td { padding: 2px 4px; }
table.att.dense .cellmark { width: 28px; height: 24px; font-size: .78rem; }
.day-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; }

/* בחירה מרובה, תפריטים וסינון */
.selection-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 10px; background: var(--soft); border-radius: 12px; min-height: 48px; }
.selection-count { font-weight: 700; margin-inline-end: 6px; }
.menu { position: relative; display: inline-block; }
.menu-list { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 30; min-width: 230px; background: var(--paper); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; display: grid; gap: 2px; }
.menu-item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 6px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: start; font-weight: 600; white-space: nowrap; }
.menu-item:hover, .menu-item:focus-visible { background: var(--soft); }
.hero .menu-list { color: var(--ink); }
.filters > summary { cursor: pointer; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; padding: 6px 2px; color: var(--brand); }
.active-filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--brand); background: #eef3ee; color: var(--brand); font-weight: 700; cursor: pointer; font-size: .88rem; }
.filter-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter-label { font-weight: 700; color: var(--muted); }
.search-wide { flex: 2 1 320px; }
.view-switch button { display: inline-grid; place-items: center; min-width: 44px; padding: 0 10px; }
.check-col { width: 36px; text-align: center !important; }
.row-check { width: 20px; height: 20px; accent-color: var(--brand); cursor: pointer; flex: none; }
table.data tr.selected td, table.data tr.selected th { background: #eef3ee; }
.cols-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 12px; }
.pill-x, .chosen .pill button { border: 0; background: none; cursor: pointer; padding: 0 2px; display: grid; place-items: center; color: inherit; }
.pick-group { margin-inline-start: auto; font-size: .85rem; }
.picker { display: grid; gap: 10px; }

/* מסד התלמידים: אריחים ורשימה */
.stiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.stiles.size-1 { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.stiles.size-2 { grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); }
.stiles.size-4 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.stiles.size-5 { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.stile { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--paper); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); min-width: 0; }
.stile.selected { border-color: var(--brand); background: #f3f7f3; }
.stile .row-check { position: absolute; inset-block-start: 8px; inset-inline-end: 8px; }
.stile-main { display: grid; gap: 3px; min-width: 0; flex: 1; text-decoration: none; color: inherit; }
.stile-main:hover .stile-name { text-decoration: underline; }
.stile-name { font-size: 1rem; line-height: 1.25; overflow-wrap: anywhere; padding-inline-end: 22px; }
.stile-meta { color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stile-foot { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.stiles-large { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.stiles-large.size-1 { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.stiles-large.size-2 { grid-template-columns: repeat(auto-fill, minmax(164px, 1fr)); }
.stiles-large.size-4 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.stiles-large.size-5 { grid-template-columns: repeat(auto-fill, minmax(256px, 1fr)); }
.stile-large { flex-direction: column; text-align: center; padding: 16px 12px 12px; }
.stile-large .stile-main { justify-items: center; }
.stile-large .stile-name { padding-inline-end: 0; }
.stile-large .stile-foot { justify-content: center; }
.slist { list-style: none; margin: 0; padding: 0; }
.slist li { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-bottom: 1px solid var(--border); }
.slist li:last-child { border-bottom: 0; }
.slist li.selected { background: #eef3ee; }
.slist-main { display: grid; min-width: 0; flex: 1; text-decoration: none; color: inherit; }
.slist-main:hover strong { text-decoration: underline; }
.slist-contact { min-width: 150px; text-align: end; }

/* טפסים */
.phone-field { display: flex; align-items: stretch; direction: ltr; }
.phone-prefix { display: grid; place-items: center; padding: 0 12px; background: var(--soft); border: 1px solid var(--border-strong); border-inline-end: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); font-weight: 700; color: var(--muted); }
.phone-field .input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.sticky-actions { position: sticky; bottom: 0; background: var(--canvas); padding: 12px 0; z-index: 2; }
.list-editor { display: grid; gap: 8px; }
.list-row { display: flex; gap: 12px; align-items: center; }
.list-row .input { max-width: 420px; }

/* נוכחות בכרטיס התלמיד (כמו באזור האישי) */
.att-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.att-tile { display: grid; gap: 4px; padding: 14px; border-radius: 14px; background: var(--paper); border: 1px solid var(--border); }
.att-tile-main { background: #f1ede3; }
.att-tile-label { color: var(--muted); font-weight: 700; font-size: .9rem; }
.att-tile-value { font-size: 1.9rem; line-height: 1.1; }
.att-tile-note { color: var(--muted); font-size: .82rem; }
.att-bar { display: block; height: 8px; border-radius: 999px; background: var(--soft); overflow: hidden; min-width: 60px; }
.att-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--brand-2); }
.tone-green .att-bar > span { background: #3d8a5b; } .tone-yellow .att-bar > span { background: #c79a2c; } .tone-red .att-bar > span { background: #c0554c; }
.tone-green .att-tile-value { color: var(--present); } .tone-yellow .att-tile-value { color: var(--late); } .tone-red .att-tile-value { color: var(--absent); }
.day-cards { display: grid; grid-template-columns: repeat(var(--per-row, 4), minmax(0, 1fr)); gap: 10px; }
.day-month { grid-column: 1 / -1; margin: 8px 0 0; font-size: .95rem; color: var(--muted); border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.day-card { border-inline-start: 4px solid var(--border-strong); }
.day-card.tone-present { border-inline-start-color: #7fb293; } .day-card.tone-late { border-inline-start-color: #e0b75e; } .day-card.tone-absent { border-inline-start-color: #d99a94; }
.day-card h4 { margin: 0; font-size: .92rem; display: flex; justify-content: space-between; gap: 6px; color: var(--ink); }
.day-card .day-week { color: var(--muted); font-weight: 600; }
.pill-btn { border: 0; background: none; padding: 0; cursor: pointer; border-radius: 999px; }
.pill-btn:hover .pill { outline: 2px solid var(--border-strong); }
@media (max-width: 1180px) { .day-cards { grid-template-columns: repeat(min(var(--per-row, 4), 3), minmax(0, 1fr)); } }
@media (max-width: 760px) { .day-cards { grid-template-columns: repeat(min(var(--per-row, 4), 2), minmax(0, 1fr)); } }
@media (max-width: 440px) { .day-cards { grid-template-columns: 1fr; } }

/* סמס: שיחות ושליחה */
.conv-layout, .mail-layout { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
.conv-side, .mail-side { display: grid; grid-template-rows: auto 1fr; max-height: calc(100vh - 230px); min-height: 360px; overflow: hidden; }
.conv-tools, .mail-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px; border-bottom: 1px solid var(--border); }
.mail-tools .input { min-height: 40px; }
.conv-list, .mail-list { overflow: auto; display: grid; align-content: start; }
.conv-item, .mail-item { display: grid; gap: 2px; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--border); background: none; text-align: start; cursor: pointer; min-width: 0; }
.conv-item:hover, .mail-item:hover { background: #faf7f0; }
.conv-item.active, .mail-item.active { background: #eef3ee; box-shadow: inset -4px 0 0 var(--brand); }
.conv-top, .mail-item-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.conv-top time, .mail-item-top time { font-size: .78rem; white-space: nowrap; }
.conv-top strong, .mail-item-top strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unread .conv-top strong, .unread .mail-item-top strong, .unread .mail-item-subject { font-weight: 800; }
.conv-sub { font-size: .8rem; color: var(--muted); }
.conv-text, .mail-item-snippet { color: var(--muted); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-item-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-item-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.dot-new { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--focus); margin-inline-end: 6px; }
.conv-main, .mail-main { min-height: 360px; min-width: 0; }
.conv-view { display: grid; grid-template-rows: auto 1fr auto; max-height: calc(100vh - 230px); min-height: 360px; }
.conv-head, .mail-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.conv-head h2, .mail-head h2 { margin: 0; font-size: 1.1rem; overflow-wrap: anywhere; }
.bubbles { overflow: auto; padding: 16px; display: grid; gap: 8px; align-content: start; }
.bubble { max-width: min(78%, 520px); padding: 8px 12px; border-radius: 16px; display: grid; gap: 2px; }
.bubble p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.in { justify-self: start; background: var(--soft); border-end-start-radius: 4px; }
.bubble.out { justify-self: end; background: #dcebdf; border-end-end-radius: 4px; }
.bubble-meta { font-size: .72rem; color: var(--muted); }
.conv-reply { display: flex; gap: 8px; align-items: end; padding: 12px; border-top: 1px solid var(--border); }
.recipients-table { max-height: 420px; }
.chan-col { text-align: center !important; white-space: nowrap; }
.chan-col input { width: 20px; height: 20px; accent-color: var(--brand); }
.chan-col input:disabled { opacity: .35; cursor: not-allowed; }
.chan-head { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.chan-head.is-off { opacity: .5; cursor: not-allowed; }
.compose-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(240px, 1fr); gap: 20px; }
.preview-list { display: grid; gap: 10px; align-content: start; }
.send-card { position: sticky; bottom: 8px; z-index: 5; box-shadow: var(--shadow-lg); }
.send-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.send-summary { font-weight: 700; }

/* מייל */
.mail-folders { display: flex; gap: 6px; flex-wrap: wrap; }
.mail-folders .chip { min-height: 34px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; }
.mail-view { display: grid; align-content: start; }
.mail-messages { display: grid; gap: 10px; padding: 14px 16px; }
.mail-msg { border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.mail-msg > summary { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; padding: 10px 14px; cursor: pointer; }
.mail-msg > summary time { margin-inline-start: auto; font-size: .82rem; }
.mail-to { margin: 0; padding: 0 14px; font-size: .82rem; overflow-wrap: anywhere; }
.mail-body { padding: 10px 14px 14px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.mail-attachments { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 14px 12px; }

/* מכשירים חכמים */
.stage-tiles, .stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stage-tile { display: grid; gap: 2px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--paper); cursor: pointer; text-align: start; }
.stage-tile strong { font-size: 1.6rem; line-height: 1.1; }
.stage-tile span { color: var(--muted); font-weight: 600; font-size: .9rem; }
.stage-tile.active { border-color: var(--brand); background: #eef3ee; }
.score { display: inline-flex; align-items: center; gap: 6px; }
.score-bar { display: block; width: 46px; height: 6px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.score-bar > span { display: block; height: 100%; background: #9aa69c; }
.score-high .score-bar > span { background: #c0554c; } .score-mid .score-bar > span { background: #c79a2c; } .score-low .score-bar > span { background: #3d8a5b; }
.stat-card.tone-absent { border-color: #d99a94; } .stat-card.tone-late { border-color: #e0b75e; }

/* יומנים */
.log-table td { font-size: .9rem; }
.log-json { margin: 0; max-height: 60vh; overflow: auto; background: #f4f1e9; border-radius: 10px; padding: 12px; font-size: .82rem; white-space: pre-wrap; overflow-wrap: anywhere; text-align: left; }

/* עוזר AI */
.assistant { position: fixed; inset-block: 0; inset-inline-end: 0; z-index: 60; width: min(460px, 100vw); display: grid; grid-template-rows: auto 1fr auto; background: var(--paper); border-inline-start: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); }
.assistant-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: linear-gradient(120deg, #2a3a2f, #3b4c40); color: #fff; }
.assistant-head h2 { margin: 0; font-size: 1.05rem; }
.assistant-actions { margin-inline-start: auto; display: flex; gap: 2px; }
.assistant-head .icon-btn { color: #fff; width: 40px; height: 40px; }
.assistant-head .icon-btn:hover { background: #ffffff26; }
.ai-log { overflow: auto; padding: 14px; display: grid; gap: 12px; align-content: start; }
.ai-msg { display: grid; gap: 6px; min-width: 0; }
.ai-user { justify-self: start; max-width: 88%; background: #dcebdf; border-radius: 16px; border-end-start-radius: 4px; padding: 8px 12px; }
.ai-user p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-bot { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }
.ai-tools { display: flex; gap: 4px; flex-wrap: wrap; }
.ai-tools:empty { display: none; }
.ai-working { margin: 0; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.ai-dots { width: 22px; height: 8px; background: radial-gradient(circle, var(--brand-2) 3px, transparent 4px) 0 50% / 8px 8px repeat-x; animation: ai-pulse 1s infinite steps(3); }
@keyframes ai-pulse { 0% { opacity: .3; } 50% { opacity: 1; } 100% { opacity: .3; } }
.ai-copy { justify-self: start; min-height: 30px; }
.ai-welcome { display: grid; gap: 10px; color: var(--muted); }
.ai-welcome p { margin: 0; }
.ai-ideas { display: flex; gap: 6px; flex-wrap: wrap; }
.ai-ideas .chip { min-height: 36px; font-size: .9rem; text-align: start; }
.ai-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ai-history li { display: flex; align-items: center; gap: 8px; }
.ai-history li .muted { margin-inline-start: auto; font-size: .8rem; white-space: nowrap; }
.assistant-foot { border-top: 1px solid var(--border); padding: 10px 12px; display: grid; gap: 4px; }
.ai-input { display: flex; gap: 8px; align-items: end; }
.ai-input textarea { resize: none; min-height: 46px; }
.ai-disclaimer { margin: 0; font-size: .74rem; color: var(--faint); }
.rich { display: grid; gap: 8px; min-width: 0; overflow-wrap: anywhere; line-height: 1.6; }
.rich p, .rich h3, .rich h4, .rich ul, .rich ol { margin: 0; }
.rich h3 { font-size: 1.02rem; color: var(--brand); } .rich h4 { font-size: .95rem; }
.rich ul, .rich ol { padding-inline-start: 20px; display: grid; gap: 4px; }
@media (min-width: 1400px) { body.assistant-open .main-col { margin-inline-end: 460px; } }

@media (max-width: 900px) {
  .conv-layout, .mail-layout, .compose-grid { grid-template-columns: 1fr; }
  .conv-side, .mail-side { max-height: 46vh; min-height: 0; }
  .slist-contact { display: none; }
  .hero .page-actions { width: 100%; }
}
@media print { .assistant, .selection-bar, .filters-card, .send-card { display: none !important; } }

/* תיקונים אחרי בדיקה בדפדפן */
table.data .name-cell { white-space: nowrap; }
table.data th[scope="row"] { font-weight: 700; }
.stat-grid .stat-value { font-size: 1.7rem; }

/* רוחב טלפון: כל שורת כפתורים נשברת לשורה חדשה במקום לגלוש */
.page-head { flex-wrap: wrap; }
.page-actions { flex-wrap: wrap; max-width: 100%; }
.page-actions > *, .toolbar > *, .card-actions > * { max-width: 100%; }
.segmented { max-width: 100%; }
@media (max-width: 520px) {
  .stiles, .stiles[class*="size-"] { grid-template-columns: 1fr; }
  .stiles-large, .stiles-large[class*="size-"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards, .cards[class*="size-"] { grid-template-columns: 1fr; }
  .att-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .range-field { flex: 1 1 100%; }
  .toolbar .input, .toolbar > select.input, .inline-label .input { min-width: 0; }
  .assistant { width: 100vw; }
}

/* סרגל עליון בטלפון: כפתור העוזר מציג רק סמל, והכותרת מתקצרת */
.topbar-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-end { flex: none; }
@media (max-width: 640px) {
  .topbar { padding-inline: 12px; gap: 8px; }
  .btn-ai { padding: 0 10px; min-width: 44px; }
  .btn-ai .btn-label { display: none; }
  .conn { font-size: .8rem; padding: 6px 8px; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
}

/* ===== גרסה 3: מהירות, קיפול, תצוגות צפופות ===== */

/* פס התקדמות דק בראש המסך בזמן מעבר בין מסכים. מופיע רק אם המעבר לא מיידי. */
.nav-progress { position: fixed; top: 0; inset-inline: 0; height: 3px; z-index: 200; pointer-events: none; opacity: 0; background: linear-gradient(90deg, transparent, var(--gold), transparent); background-size: 40% 100%; background-repeat: no-repeat; }
.nav-progress.on { opacity: 1; animation: nav-slide 1s linear infinite; transition: opacity .1s .12s; }
@keyframes nav-slide { from { background-position: 140% 0; } to { background-position: -40% 0; } }

/* "יש נתונים מעודכנים" */
.fresh-pill { position: sticky; top: 70px; z-index: 15; justify-self: center; margin: 0 auto 10px; display: flex; align-items: center; gap: 8px; padding: 8px 16px; min-height: 40px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--paper); color: var(--brand); font-weight: 700; cursor: pointer; box-shadow: var(--shadow-lg); }
.fresh-pill:hover { background: var(--soft); }

/* רשימות ארוכות: הדפדפן מצייר רק את מה שנמצא על המסך */
.stile, .slist li, .scell { content-visibility: auto; }
.stile { contain-intrinsic-size: auto 96px; }
.stile-large { contain-intrinsic-size: auto 230px; }
.slist li { contain-intrinsic-size: auto 54px; }
.scell { contain-intrinsic-size: auto 78px; }

/* ===== קיפול התפריט הצדדי ===== */
.sidebar-fold { position: absolute; inset-block-start: 8px; inset-inline-end: 6px; width: 36px; height: 36px; color: var(--muted); }
.sidebar-fold svg { transition: transform .15s; }
@media (min-width: 1024px) {
  .layout.sidebar-folded { grid-template-columns: 64px 1fr; }
  .sidebar-folded .sidebar { padding: 10px 8px; align-items: center; overflow-x: hidden; }
  .sidebar-folded .sidebar-fold { position: static; }
  .sidebar-folded .sidebar-fold svg { transform: rotate(180deg); }
  .sidebar-folded .bh, .sidebar-folded .brand-name, .sidebar-folded .brand-sub, .sidebar-folded .nav-link span, .sidebar-folded .user-chip > div { display: none; }
  .sidebar-folded .brand-block { padding: 4px 0 10px; }
  .sidebar-folded .brand-block img { width: 38px; height: 38px; }
  .sidebar-folded .nav-link { justify-content: center; padding: 10px; width: 48px; }
  .sidebar-folded .nav-group { display: grid; gap: 2px; justify-items: center; }
  .sidebar-folded .user-chip { justify-content: center; padding: 6px 0; }
}
@media (max-width: 1023px) { .sidebar-fold { display: none; } }

/* ===== מסך הרישום: תצוגה מצומצמת וקיפול החלק העליון ===== */
.seder-row .fold-btn { color: #fff; flex: none; }
.seder-row .fold-btn:hover { background: #ffffff22; }
.fold-btn svg { transition: transform .15s; transform: rotate(180deg); }
.fold-btn[aria-pressed="true"] svg { transform: none; }
.reg.folded { gap: 8px; }
.reg.folded .reg-tools, .reg.folded .reg-foot p, .reg.folded .seder-meta { display: none; }
.reg.folded .seder-bar { position: sticky; top: 60px; z-index: 12; padding: 6px 10px; border-radius: 12px; }
.reg.folded .seder-row { flex-wrap: nowrap; gap: 8px; }
.reg.folded .seder-pick { min-width: 0; flex: 1 1 auto; }
.reg.folded .seder-pick select { font-size: 1rem; min-height: 40px; padding: 4px 8px; width: 100%; }
.reg.folded .counters { flex-wrap: nowrap; gap: 4px; }
.reg.folded .counter { min-width: 0; padding: 3px 8px; border-radius: 9px; }
.reg.folded .counter strong { font-size: 1rem; }
.reg.folded .counter span { font-size: .68rem; white-space: nowrap; }
@media (max-width: 1023px) { .reg.folded .seder-bar { top: 52px; } }
@media (max-width: 560px) { .reg.folded .counter span { display: none; } .reg.folded .counter:nth-child(n+2):not(.warn) { display: none; } }

.cards.size-0 { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 4px; }
.size-0 .scard { min-height: 40px; padding: 3px 6px; padding-inline-start: 38px; border-width: 1.5px; border-radius: 9px; }
.size-0 .scard .sname { font-size: .82rem; font-weight: 700; line-height: 1.15; }
.size-0 .scard .smeta, .size-0 .scard .sstate { display: none; }
.size-0 .scell .sphoto { inset-inline-start: 6px; }
.size-0 .scell { contain-intrinsic-size: auto 42px; }
/* בתצוגה המצומצמת הסטטוס מסומן גם בסימן, לא רק בצבע */
.size-0 .scard.present .sname::after { content: ' ✓'; color: var(--present); }
.size-0 .scard.late .sname::after { content: ' ◷'; color: var(--late); }
.size-0 .scard.absent .sname::after { content: ' ✕'; color: var(--absent); }
.size-0 .scard.approved .sname::after { content: ' ✎'; color: var(--muted); }

/* ===== טבלת הנוכחות: ציור חלקי (רק מה שעל המסך) ===== */
.att-wrap { max-height: 76vh; }
table.att.vt { table-layout: fixed; width: auto; }
table.att.vt th, table.att.vt td { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 2px 4px; box-sizing: border-box; }
table.att.vt tbody tr { height: var(--row); }
table.att.vt thead tr:first-child th { height: var(--h1); top: 0; }
table.att.vt thead tr:nth-child(2) th { height: var(--h2); top: var(--h1); }
table.att.vt .name-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
table.att.vt .name-cell span { overflow: hidden; text-overflow: ellipsis; }
table.att.vt .pct { display: inline-block; min-width: 0; padding: 2px 6px; font-size: .82rem; font-weight: 800; border-radius: 8px; }
table.att.vt td.cell { padding: 0; }
table.att.vt .vt-gap { padding: 0; border-bottom: 0; background: transparent; }
table.att.vt tr.vt-space td { padding: 0; border: 0; }
table.att.vt tr.vt-space:hover td { background: transparent; }
table.att.vt .cellmark { width: 32px; height: 28px; }
table.att.vt.dense { font-size: .76rem; }
table.att.vt.dense .cellmark { width: 21px; height: 19px; font-size: .68rem; border-radius: 4px; }
table.att.vt.dense .cellmark.late { font-size: .6rem; }
table.att.vt.dense .pct { padding: 0 3px; font-size: .72rem; background: transparent; }
table.att.vt.dense .day-head { font-size: .7rem; font-weight: 700; padding: 0 2px; }
table.att.vt.dense .seder-head { font-size: .64rem; min-width: 0; padding: 0; }
table.att.vt.dense thead th { font-size: .72rem; }
table.att.vt.dense th.sticky-col { font-size: .78rem; }

/* ===== טבלת הימים בכרטיס התלמיד ===== */
.daytable-wrap { max-height: 70vh; box-shadow: none; }
table.daytable { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .93rem; }
.daytable th, .daytable td { padding: 5px 8px; text-align: center; border-bottom: 1px solid var(--border); vertical-align: middle; }
.daytable thead th { position: sticky; top: 0; z-index: 1; background: #f1ede3; font-size: .82rem; font-weight: 800; color: var(--muted); white-space: nowrap; }
.daytable th.dt-date { text-align: start; white-space: nowrap; font-weight: 700; border-inline-start: 4px solid transparent; padding-inline-start: 10px; }
.daytable tr.tone-absent th.dt-date { border-inline-start-color: #d99a94; }
.daytable tr.tone-late th.dt-date { border-inline-start-color: #e0b75e; }
.daytable tr.tone-present th.dt-date { border-inline-start-color: #7fb293; }
.daytable .dt-week { color: var(--muted); font-weight: 500; font-size: .82rem; margin-inline-start: 8px; }
.daytable tbody tr:hover td, .daytable tbody tr:hover th { background: #faf7f0; }
.daytable tr.week-start td, .daytable tr.week-start th { border-bottom: 2px solid var(--border-strong); }
.daytable tr.dt-month th { text-align: start; background: var(--soft); color: var(--brand); font-size: .86rem; padding: 4px 12px; position: static; }
.daytable td.dt-sum { color: var(--muted); font-size: .84rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.daytable td.dt-empty { background: repeating-linear-gradient(135deg, transparent 0 6px, #f4f1e9 6px 7px); }
.dt-ok { color: var(--present); font-weight: 800; font-size: 1rem; }
.dt-none { color: #b4ada0; }
.dt-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.dt-chip.late { background: var(--late-bg); color: var(--late); }
.dt-chip.absent { background: var(--absent-bg); color: var(--absent); }
.dt-chip.approved { background: var(--approved-bg); color: var(--approved); }
.dt-btn { border: 0; background: none; padding: 2px 4px; border-radius: 8px; cursor: pointer; min-width: 40px; min-height: 30px; display: inline-grid; place-items: center; }
.dt-btn:hover { outline: 2px solid var(--border-strong); }
@media (min-width: 701px) { .daytable .short { display: none; } }
@media (max-width: 700px) {
  .daytable .full { display: none; }
  .daytable abbr.short { text-decoration: none; }
  .daytable th, .daytable td { padding: 4px 2px; }
  .daytable th.dt-date { padding-inline-start: 6px; font-size: .84rem; }
  .daytable .dt-week { display: block; margin: 0; font-size: .72rem; }
  .dt-chip { padding: 2px 5px; font-size: .72rem; gap: 2px; }
  .dt-btn { min-width: 30px; padding: 2px 1px; }
  .daytable td.dt-sum { font-size: .72rem; }
}

/* חלונית התמונה המוגדלת */
.photo-large { width: min(100%, 420px); height: auto; aspect-ratio: auto; min-width: 0; min-height: 0; }

/* ===== עוזר ה־AI ===== */
.ai-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: .84rem; color: var(--muted); }
.ai-steps:empty { display: none; }
.ai-steps li { display: flex; align-items: center; gap: 8px; }
.ai-step-mark { width: 14px; height: 14px; flex: none; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--brand-2); animation: ai-spin .8s linear infinite; }
.ai-steps li.done .ai-step-mark { animation: none; border: 0; background: var(--present-bg); position: relative; }
.ai-steps li.done .ai-step-mark::after { content: '✓'; position: absolute; inset: 0; display: grid; place-items: center; font-size: .62rem; font-weight: 800; color: var(--present); }
@keyframes ai-spin { to { transform: rotate(360deg); } }
.ai-answer-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.ai-meta, .ai-month { font-size: .74rem; color: var(--faint); }
.ai-followups { margin-top: 2px; }
.ai-followups .chip { border-style: dashed; }
.ai-foot-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ai-mode button { min-height: 30px; padding: 0 10px; font-size: .8rem; }
.btn-ai.has-news { position: relative; }
.btn-ai.has-news::after { content: ''; position: absolute; top: 4px; inset-inline-end: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); border: 2px solid var(--paper); }
.rich { display: grid; gap: 8px; min-width: 0; overflow-wrap: anywhere; line-height: 1.55; }
.rich > * { margin: 0; }
.rich h3 { font-size: 1.02rem; margin-top: 6px; color: var(--brand); }
.rich h4 { font-size: .95rem; margin-top: 4px; }
.rich ul, .rich ol { padding-inline-start: 20px; display: grid; gap: 3px; }
.rich code { background: var(--soft); border-radius: 4px; padding: 0 4px; font-size: .88em; }
.rich hr { border: 0; border-top: 1px solid var(--border); width: 100%; }
.rich-link { color: var(--brand-2); font-weight: 700; text-decoration: underline; text-decoration-color: #b9c9bd; text-underline-offset: 3px; }
.rich-link:hover { text-decoration-color: currentColor; }
.rich blockquote { margin: 0; padding: 10px 12px; background: #f6f3ea; border-inline-start: 4px solid var(--gold); border-radius: 8px; display: grid; gap: 6px; }
.rich blockquote p { margin: 0; white-space: pre-wrap; }
.rich-table { overflow-x: auto; }
.rich-table table { border-collapse: collapse; font-size: .88rem; width: 100%; }
.rich-table th, .rich-table td { border: 1px solid var(--border); padding: 4px 8px; text-align: start; vertical-align: top; }
.rich-table th { background: #f1ede3; font-weight: 800; }

/* ===== מכשירים חכמים: הסברי הדירוגים ===== */
.help-box { background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }
.help-box summary { cursor: pointer; font-weight: 700; color: var(--brand); display: flex; align-items: center; gap: 8px; min-height: 32px; }
.help-box[open] { display: grid; gap: 10px; }
.help-list { margin: 0; display: grid; gap: 6px; }
.help-list dt { font-weight: 800; }
.help-list dd { margin: 0 0 4px; color: var(--muted); }
.score-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.score-card { background: var(--paper); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; align-content: start; }
.score-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.score-card-help { margin: 0; font-size: .82rem; color: var(--muted); }
.score-card-basis { margin: 0; font-size: .88rem; }
.score-edit summary { cursor: pointer; font-size: .84rem; color: var(--brand-2); font-weight: 700; }
@media (max-width: 860px) { .score-cards { grid-template-columns: 1fr; } }

/* ===== מייל: הדגשת מילות חיפוש ===== */
mark { background: #ffe58a; color: inherit; border-radius: 3px; padding: 0 2px; }
.note-list li.mail-hit { background: #fffbe8; border-radius: 8px; padding: 6px 8px; margin: -2px -8px; }
.tag-hit { background: #ffe58a; color: #5c4700; }

/* עמודות הסיכום הנעוצות בטבלת הנוכחות, וכפתורי "צ'יפ" עם סמל */
table.att.vt .sum-col { text-align: center; }
table.att.vt .sum-last { box-shadow: -1px 0 0 var(--border-strong); }
table.att.vt tbody tr:hover .sticky-col { background: #faf7f0; }
.chip { display: inline-flex; align-items: center; gap: 6px; }

/* טבלת הימים: רוחב נוח לקריאה במסך רחב, ובנייד בלי גלילה פנימית */
table.daytable { max-width: 920px; }
@media (max-width: 700px) {
  .daytable-wrap { overflow: visible; max-height: none; }
  .daytable thead th { top: 52px; }
}

/* שורת הסדר במסך הרישום לא חורגת מרוחב המסך בטלפון */
.seder-row { min-width: 0; }
.seder-pick { min-width: 0; max-width: 100%; flex: 1 1 200px; }
.seder-pick select { width: 100%; min-width: 0; text-overflow: ellipsis; }
.seder-meta { min-width: 0; }
