@font-face { font-family: "Heebo"; src: url("heebo.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #f7f2ec; --surface: #fffdfa; --surface-2: #f1e9e0; --line: #e4d8cb;
  --text: #2b2622; --muted: #7a6e63; --accent: #a34f2b; --accent-ink: #fff; --accent-soft: #f6e4d9;
  --sage: #57735f; --sage-soft: #e3ebe2; --danger: #b3261e; --danger-soft: #fbe3e0; --warn: #9a6a00; --warn-soft: #fbefd0;
  --radius: 14px; --shadow: 0 1px 2px rgb(60 40 20 / .06), 0 4px 14px rgb(60 40 20 / .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1916; --surface: #25211d; --surface-2: #2e2924; --line: #3b342d;
    --text: #efe7de; --muted: #a99c8f; --accent: #e08a62; --accent-ink: #1c1916; --accent-soft: #3d2a20;
    --sage: #9cbca4; --sage-soft: #26322a; --danger: #ff8a80; --danger-soft: #3a2220; --warn: #e6c26a; --warn-soft: #3a3020;
    --shadow: none; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  direction: rtl; font-family: "Heebo", system-ui, sans-serif; font-size: 16px; line-height: 1.55;
  background: var(--bg); color: var(--text); -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.err { color: var(--danger); min-height: 1.2em; margin: 0; }
.stack > * + * { margin-top: 10px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* כפתורים ושדות */
.btn { border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 10px; cursor: pointer; min-height: 40px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 4px 10px; min-height: 32px; font-size: .9rem; }
.btn:disabled { opacity: .55; cursor: default; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 4px; text-decoration: underline; }
input[type=text], input[type=password], input[type=date], input[type=time], input[type=email], input:not([type]), select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 12px; min-height: 42px;
}
textarea { min-height: 90px; resize: vertical; }
label.f { display: block; }
label.f > span { display: block; font-size: .88rem; color: var(--muted); margin-bottom: 3px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* כניסה */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px 22px; text-align: center; box-shadow: var(--shadow); }
.login-card h1 { font-size: 1.3rem; margin: 12px 0 16px; }
.logo { width: 54px; height: 54px; margin: 0 auto; border-radius: 16px; background: radial-gradient(circle at 30% 30%, #e9a27c 0 22%, transparent 23%), radial-gradient(circle at 68% 40%, #8fae97 0 20%, transparent 21%), radial-gradient(circle at 45% 72%, #e6c26a 0 18%, transparent 19%), var(--accent-soft); }
.logo.sm { width: 28px; height: 28px; border-radius: 9px; margin: 0; display: inline-block; }

/* מבנה */
.app { min-height: 100dvh; }
.nav { position: fixed; z-index: 10; inset-inline: 0; bottom: 0; display: flex; justify-content: space-around; background: var(--surface); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
.nav .brand { display: none; }
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 2px; text-decoration: none; color: var(--muted); font-size: .76rem; border-radius: 10px; }
.nav a svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav a.on { color: var(--accent); font-weight: 600; }
.main { padding: 16px 16px 96px; max-width: 860px; margin: 0 auto; outline: none; }
@media (min-width: 900px) {
  .nav { inset: 0 0 0 auto; width: 220px; flex-direction: column; justify-content: flex-start; gap: 2px; border-top: 0; border-inline-start: 1px solid var(--line); padding: 18px 12px; }
  .nav .brand { display: flex; gap: 10px; align-items: center; font-weight: 700; padding: 0 8px 16px; }
  .nav a { flex: 0; flex-direction: row; gap: 10px; font-size: 1rem; padding: 10px 12px; }
  .nav a.on { background: var(--accent-soft); }
  .main { margin-inline-start: 220px; margin-inline-end: auto; padding: 28px 32px 40px; }
}

.head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.head h1 { flex: 1; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.card + .card, .section + .section { margin-top: 14px; }
.section-title { display: flex; align-items: center; gap: 8px; margin: 18px 0 8px; }
.section-title h2 { font-size: 1.05rem; flex: 1; }
.empty { color: var(--muted); padding: 6px 0; }
.callout { background: var(--accent-soft); border: 1px solid transparent; border-radius: var(--radius); padding: 14px 16px; }
.callout.sage { background: var(--sage-soft); }

/* רשימות */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list .body { flex: 1; min-width: 0; }
.list .title { font-weight: 500; overflow-wrap: anywhere; }
.list .meta { font-size: .86rem; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.list button.item { all: unset; cursor: pointer; display: block; width: 100%; }
.list button.item:focus-visible { outline: 2px solid var(--accent); border-radius: 6px; }
.check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); background: none; cursor: pointer; flex: none; margin-top: 1px; display: grid; place-items: center; padding: 0; }
.check.on { background: var(--sage); border-color: var(--sage); color: #fff; }
.check svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 3; fill: none; }
.done .title { text-decoration: line-through; color: var(--muted); }
.badge { display: inline-block; font-size: .78rem; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.badge.urgent { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.badge.high { background: var(--warn-soft); color: var(--warn); }
.badge.mail { background: var(--sage-soft); color: var(--sage); }
.badge.late { background: var(--danger-soft); color: var(--danger); }
.time { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 46px; font-size: .92rem; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 4px 12px; cursor: pointer; font-size: .9rem; min-height: 34px; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.quickadd { display: flex; gap: 8px; }
.quickadd input { flex: 1; }

/* מערכת שעות */
.timetable { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.timetable .day { background: var(--surface-2); border-radius: 10px; padding: 6px; min-height: 64px; }
.timetable .day h3 { font-size: .82rem; color: var(--muted); text-align: center; margin-bottom: 4px; }
.timetable .day.today { outline: 2px solid var(--accent); }
.slot { background: var(--surface); border-radius: 8px; padding: 4px 6px; font-size: .8rem; margin-top: 4px; border-inline-start: 3px solid var(--accent); overflow-wrap: anywhere; }
@media (max-width: 560px) { .timetable { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.daygroup h3 { font-size: .95rem; margin: 14px 0 4px; color: var(--muted); }
.daygroup h3.today { color: var(--accent); }

/* קורסים */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.course { cursor: pointer; text-align: start; border-inline-start: 4px solid var(--accent); width: 100%; font: inherit; color: inherit; }

/* צ'אט */
.chat { display: flex; flex-direction: column; height: calc(100dvh - 32px - 80px); }
@media (min-width: 900px) { .chat { height: calc(100dvh - 68px); } }
.msgs { flex: 1; overflow-y: auto; padding: 4px 2px 12px; }
.msg { max-width: 88%; margin: 8px 0; padding: 10px 14px; border-radius: 16px; overflow-wrap: anywhere; }
.msg.user { background: var(--accent-soft); margin-inline-start: auto; border-end-start-radius: 4px; white-space: pre-wrap; }
.msg.assistant { background: var(--surface); border: 1px solid var(--line); margin-inline-end: auto; border-end-end-radius: 4px; }
.msg.assistant p { margin: 0 0 6px; } .msg.assistant p:last-child { margin: 0; }
.msg.assistant ul, .msg.assistant ol { margin: 4px 0 8px; padding-inline-start: 20px; }
.msg .files { font-size: .85rem; color: var(--muted); margin-top: 4px; }
.activity { font-size: .85rem; color: var(--muted); margin: 4px 6px; }
.composer { display: flex; gap: 6px; align-items: flex-end; border-top: 1px solid var(--line); padding-top: 10px; }
.composer textarea { min-height: 44px; max-height: 160px; flex: 1; }
.iconbtn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; display: grid; place-items: center; flex: none; padding: 0; }
.iconbtn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.iconbtn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.iconbtn.rec { background: var(--danger); color: #fff; border-color: var(--danger); }
.attached { font-size: .85rem; color: var(--muted); padding: 4px 2px; }
.suggest { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }

/* דיאלוג */
dialog { border: 0; padding: 0; border-radius: 18px; background: var(--surface); color: var(--text); width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 40px); box-shadow: 0 10px 40px rgb(0 0 0 / .25); }
dialog::backdrop { background: rgb(20 15 10 / .45); }
.dlg { padding: 18px; }
.dlg h2 { margin-bottom: 12px; }
.dlg .actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.sessions .srow { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr auto; gap: 6px; margin-top: 6px; }
@media (max-width: 480px) { .sessions .srow { grid-template-columns: 1fr 1fr; } }

.toast { position: fixed; bottom: 90px; inset-inline: 0; margin: auto; width: max-content; max-width: calc(100vw - 32px); background: var(--text); color: var(--bg); padding: 8px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50; }
.toast.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

.statusgrid { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .92rem; }
.ok { color: var(--sage); font-weight: 600; } .bad { color: var(--danger); font-weight: 600; }
pre.log { white-space: pre-wrap; font-size: .82rem; color: var(--muted); max-height: 240px; overflow: auto; margin: 0; font-family: inherit; }
