:root {
  --bg: #f3f0e8;
  --surface: #fffdf8;
  --surface-2: #ece7db;
  --ink: #1d262b;
  --ink-2: #55606a;
  --line: #ddd5c4;
  --accent: #2c5a4b;
  --accent-ink: #ffffff;
  --accent-soft: #dfe9e3;
  --danger: #a8321f;
  --danger-soft: #f6e0db;
  --warn: #9a5b00;
  --warn-soft: #f6ead2;
  --ok: #2b6e46;
  --ok-soft: #dcecdf;
  --radius: 12px;
  --nav-h: 64px;
  color-scheme: light;
}
/* Light by default. Dark only when the user switches it on (data-theme on <html>). */
:root[data-theme="dark"] {
  --bg: #151a1d; --surface: #1d2428; --surface-2: #263036; --ink: #e9ece8; --ink-2: #a3adb3;
  --line: #34404a; --accent: #6fb39a; --accent-ink: #0f1a16; --accent-soft: #23362f;
  --danger: #ef8a76; --danger-soft: #3d2420; --warn: #e7b25c; --warn-soft: #3a2f1c; --ok: #79c497; --ok-soft: #1f3529;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Heebo", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.boot { padding: 40vh 16px; text-align: center; color: var(--ink-2); }

/* layout */
.shell { max-width: 760px; margin: 0 auto; padding: 0 16px calc(var(--nav-h) + 32px); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 0 10px; }
.topbar .brand { font-weight: 800; font-size: 15px; letter-spacing: .01em; }
.topbar .who { color: var(--ink-2); font-size: 14px; }
.topbar .who button { background: none; border: 0; color: var(--ink-2); text-decoration: underline; cursor: pointer; padding: 0 6px; }
h1 { font-size: 26px; line-height: 1.2; margin: 8px 0 4px; font-weight: 800; }
h2 { font-size: 18px; margin: 28px 0 10px; font-weight: 700; }
h3 { font-size: 16px; margin: 0 0 6px; font-weight: 700; }
.sub { color: var(--ink-2); margin: 0 0 16px; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 12px; }
.card.tight { padding: 12px 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }

/* nav */
.nav {
  position: fixed; inset: auto 0 0 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line); display: flex; z-index: 10;
}
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--ink-2); font-size: 13px; font-weight: 500; position: relative;
}
.nav a svg { width: 22px; height: 22px; }
.nav a.on { color: var(--accent); font-weight: 700; }
.nav .dot { position: absolute; top: 9px; inset-inline-start: calc(50% + 6px); min-width: 18px; height: 18px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; display: grid; place-items: center; padding: 0 5px; font-weight: 700; }

/* buttons and inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line);
  background: var(--surface); padding: 10px 16px; border-radius: 10px; cursor: pointer; font-weight: 600; text-decoration: none; color: var(--ink);
  min-height: 44px;
}
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 6px 10px; min-height: 34px; font-size: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
label.field { display: block; margin: 0 0 12px; }
label.field > span { display: block; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); min-height: 44px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, .scale button:focus-visible, .chips button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.code-input { font-size: 28px; letter-spacing: .4em; text-align: center; direction: ltr; font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: plaintext; }

/* login */
.login { max-width: 400px; margin: 0 auto; padding: 14vh 16px 40px; }
.login h1 { font-size: 30px; }

/* status pills */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }

.banner { border-radius: var(--radius); padding: 14px 16px; margin: 0 0 12px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.danger { background: var(--danger-soft); color: var(--danger); }
.banner.accent { background: var(--accent-soft); color: var(--accent); }
.banner strong { color: inherit; }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.timeline li:first-child { border-top: 0; }
.timeline .t { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 14px; direction: ltr; text-align: right; padding-top: 1px; }
.timeline .topic { font-weight: 600; }
.timeline .lect { color: var(--ink-2); font-size: 14px; }
.timeline li.admin .topic { font-weight: 500; color: var(--ink-2); }
.timeline li.now { background: var(--accent-soft); margin: 0 -16px; padding-inline: 16px; border-radius: 8px; border-top-color: transparent; }
.timeline li.now + li { border-top-color: transparent; }
.timeline li.past .topic, .timeline li.past .lect { opacity: .55; }
.tag { font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 6px; margin-inline-start: 6px; vertical-align: 2px; }
.tag.sim { background: var(--warn-soft); color: var(--warn); }
.tag.now { background: var(--accent); color: var(--accent-ink); }

/* sign-in slots */
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slot { border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; background: var(--surface); }
.slot .n { font-weight: 700; }
.slot .w { font-size: 13px; color: var(--ink-2); direction: ltr; }
.slot.done { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.slot.open { border-color: var(--accent); }
.slot.missed { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.slot .btn { margin-top: 8px; width: 100%; }

/* days list */
.daylist { display: grid; gap: 8px; }
.dayhead { display: flex; gap: 12px; align-items: baseline; justify-content: space-between; cursor: pointer; list-style: none; }
.dayhead::-webkit-details-marker { display: none; }
details.card > summary { list-style: none; }
details.card[open] > summary { margin-bottom: 8px; }
.daynum { font-weight: 800; font-size: 13px; color: var(--accent); white-space: nowrap; }
.daydate { color: var(--ink-2); font-size: 14px; white-space: nowrap; flex: 0 1 auto; max-width: 42%; text-align: left; }
.daydate .small { white-space: normal; overflow-wrap: anywhere; }
.daydate .room { color: var(--ink); font-weight: 600; }
.dayhead > .grow { min-width: 0; flex: 1 1 58%; }

/* messages */
.msg.urgent { background: var(--danger-soft); border-color: transparent; }
.msg.unread h3::after { content: "חדש"; font-size: 12px; font-weight: 700; color: var(--accent-ink); background: var(--accent); padding: 1px 7px; border-radius: 6px; margin-inline-start: 8px; vertical-align: 2px; }
.msg .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .meta { font-size: 13px; color: var(--ink-2); margin-top: 8px; }

/* forms: rating */
.q { margin: 0 0 18px; }
.q > .qt { font-weight: 600; margin-bottom: 6px; display: block; }
.q > .qt .req { color: var(--danger); margin-inline-start: 2px; }
.q .hint { font-size: 13px; color: var(--ink-2); display: flex; justify-content: space-between; margin-top: 4px; }
.scale { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.scale button, .chips button {
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px; min-height: 44px; cursor: pointer; font-weight: 600;
}
.scale button.on, .chips button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.scale.wide { grid-auto-columns: minmax(0, 1fr); }
.scale.wide button { min-height: 40px; font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { padding: 8px 12px; font-weight: 500; text-align: right; }
.section-title { font-size: 13px; font-weight: 800; color: var(--accent); letter-spacing: .04em; margin: 26px 0 10px; }
.lecture-block { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.lecture-block:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.lecture-block.skipped .qs { display: none; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); cursor: pointer; margin: 4px 0 12px; }
.check input { width: 18px; height: 18px; }
.err { color: var(--danger); font-weight: 600; margin: 8px 0; }
.sticky-submit { position: sticky; bottom: calc(var(--nav-h) + 8px); margin-top: 20px; }

/* admin */
.subnav { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 12px; margin: 0 -16px; padding-inline: 16px; scrollbar-width: none; }
.subnav a { white-space: nowrap; padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.subnav a.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat .v { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .l { font-size: 13px; color: var(--ink-2); }
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.t th, table.t td { padding: 9px 10px; text-align: right; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { background: var(--surface-2); font-weight: 700; font-size: 13px; white-space: nowrap; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; display: flex; min-width: 80px; }
.bar i { display: block; height: 100%; }
.bar i.ok { background: var(--ok); } .bar i.warn { background: var(--warn); } .bar i.danger { background: var(--danger); }
.quotes { margin: 6px 0 0; padding: 0; list-style: none; }
.quotes li { padding: 8px 10px; background: var(--surface-2); border-radius: 8px; margin: 6px 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cellbtn { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: inherit; text-align: right; }

.modal-bg { position: fixed; inset: 0; background: rgba(10, 14, 16, .45); display: grid; place-items: end center; z-index: 50; }
.modal { background: var(--surface); width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .modal-bg { place-items: center; } .modal { border-radius: 16px; } }

#toast { position: fixed; inset-inline: 16px; bottom: calc(var(--nav-h) + 16px); display: flex; justify-content: center; pointer-events: none; z-index: 60; }
#toast div { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; max-width: 520px; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
#toast div.bad { background: var(--danger); color: #fff; }

@media (prefers-reduced-motion: no-preference) {
  #toast div { animation: up .18s ease-out; }
  @keyframes up { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
}
.topbar .who a { color: var(--ink-2); text-decoration: none; font-weight: 600; }
.topbar .who a.on { color: var(--accent); }
.nav a { font-size: 12px; }

/* home to-do list */
.tasks { list-style: none; margin: 0; padding: 4px 16px; }
.task { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.task:first-child { border-top: 0; }
.task .box { flex: none; width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--line); display: grid; place-items: center; font-size: 14px; font-weight: 800; }
.task .tt { font-weight: 600; }
.task.open .box { border-color: var(--accent); }
.task.done .box { background: var(--ok); border-color: var(--ok); color: #fff; }
.task.done .tt { color: var(--ink-2); }
.task.missed .box { background: var(--danger); border-color: var(--danger); color: #fff; }
.task.missed .tt { color: var(--danger); }
.task.later { opacity: .7; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; }
[hidden] { display: none !important; }
/* installed app on iOS draws under the status bar */
.topbar { padding-top: max(18px, calc(env(safe-area-inset-top) + 6px)); }
.login { padding-top: max(14vh, calc(env(safe-area-inset-top) + 40px)); }

.theme-btn { background: none; border: 1px solid var(--line); border-radius: 999px; width: 34px; height: 34px; display: inline-grid; place-items: center; cursor: pointer; color: var(--ink-2); padding: 0; margin-inline-end: 4px; vertical-align: middle; }
.theme-btn svg { width: 18px; height: 18px; }
.topbar .who { display: flex; align-items: center; gap: 4px; }

/* walkthrough */
.ob-dots { display: flex; gap: 6px; justify-content: center; }
.ob-dots span { width: 8px; height: 8px; border-radius: 4px; background: var(--line); }
.ob-dots span.on { width: 22px; background: var(--accent); }
.ob-body p { margin: 0 0 10px; }
.walk { margin: 0; padding-inline-start: 22px; }
.walk li { margin: 0 0 10px; line-height: 1.6; }

/* participants: compact list, details on tap */
.ulist { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.uitem { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.uitem.off { opacity: .55; }
.uitem summary { display: flex; gap: 10px; align-items: center; list-style: none; cursor: pointer; }
.uitem summary::-webkit-details-marker { display: none; }
.uname { font-weight: 700; font-size: 15px; }
.uside { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; white-space: nowrap; }
.udl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 10px 0; font-size: 14px; }
.udl dt { color: var(--ink-2); }
.udl dd { margin: 0; overflow-wrap: anywhere; }
.udl dd.ltr { text-align: right; }
.pastdays { background: var(--surface-2); }
.pastdays > .daylist { margin-top: 10px; }
.pastdays .card { opacity: .8; }

/* content zoom: only the main area and dialogs scale, top bar and bottom menu stay fixed */
html { touch-action: pan-x pan-y; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
main, .modal > * , .login { zoom: var(--z, 1); }

/* staff tasks */
.tbox { flex: none; width: 26px; height: 26px; border-radius: 7px; border: 2px solid var(--accent); background: var(--surface); color: #fff; font-weight: 800; cursor: pointer; padding: 0; margin-top: 2px; }
.tbox.on { background: var(--ok); border-color: var(--ok); }
.task-i.done .uname { color: var(--ink-2); text-decoration: line-through; }
.task-notes { margin-top:4px; color: var(--ink-2); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.task-i .grow { overflow-wrap: anywhere; }
/* staff tasks grouped by due date */
.tdate-tools { margin: 4px 0 10px; align-items: center; gap: 8px; }
details.tdate { margin-bottom: 8px; }
details.tdate > summary { display: flex; align-items: center; gap: 8px; list-style: none; cursor: pointer; padding: 10px 4px; font-weight: 700; font-size: 16px; border-bottom: 1px solid var(--line); }
details.tdate > summary::-webkit-details-marker { display: none; }
details.tdate > summary::before { content: "›"; display: inline-block; width: 12px; color: var(--ink-2); transition: transform .15s; }
details.tdate[open] > summary::before { transform: rotate(-90deg); }
details.tdate[open] > summary { margin-bottom: 8px; }
.tdate-l { flex: 1; min-width: 0; }
.tdate-n { min-width: 24px; padding: 1px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 600; text-align: center; }
.tdate-r { font-weight: 500; font-size: 14px; margin-inline-start: 6px; }
/* important phones (staff only) */
.kc-phone { font-weight: 600; margin-top: 2px; text-align: right; unicode-bidi: isolate; }
.kc-i > .row { flex-wrap: wrap; row-gap: 8px; }
.kc-acts { display: flex; gap: 6px; flex: 1 0 100%; }
.kc-acts .btn { flex: 1; }
.kc-acts .btn { text-align: center; }
details.kc-day { margin: 0 0 4px; padding-inline-start: 10px; }
details.kc-day > summary { font-size: 14px; padding: 8px 4px; color: var(--ink-2); }
