/* My School — design tokens. Emerald identity, Tajawal (Arabic) / Plus Jakarta Sans (English), 16/12px radii, indigo night mode. */
:root {
  --ink: #053b2e; --ink-2: #0a5240; --ink-fg: #e7f5ef; --ink-mute: #9cc9b8;
  --paper: #eef2f5; --surface: #ffffff; --surface-2: #f7f9fb; --line: #dde4eb; --line-2: #c4cfda;
  --fg: #0f1b2a; --muted: #5f6f82; --faint: #8a98a8;
  --pri: #059669; --pri-d: #047857; --pri-soft: #e6f7f0; --pri-line: #a7e3cb;
  --ok: #047857; --ok-bg: #dcf5ea; --warn: #9a5b00; --warn-bg: #fdf0d2; --bad: #b4233b; --bad-bg: #fde4e8;
  --info: #1d4ed8; --info-bg: #e2ebfe; --violet: #6d28d9; --violet-bg: #efe7fe;
  --shadow: 0 1px 2px rgba(15, 27, 42, .05), 0 4px 16px rgba(15, 27, 42, .06);
  --shadow-lg: 0 24px 60px -16px rgba(15, 27, 42, .35);
  --r: 16px; --rc: 12px; --rs: 8px;
  --font: "Tajawal", system-ui, "Segoe UI", Tahoma, sans-serif;
  --fs: 1;
  --side-w: 268px;
  color-scheme: light;
}
:root[lang="en"] { --font: "Plus Jakarta Sans", "Tajawal", system-ui, "Segoe UI", sans-serif; }
:root[data-theme="dark"] {
  --ink: #0b1230; --ink-2: #16204a; --ink-fg: #e3e8fb; --ink-mute: #8f9bd0;
  --paper: #0e1428; --surface: #151c36; --surface-2: #1a2342; --line: #27315a; --line-2: #36427a;
  --fg: #e6eaf7; --muted: #a2acce; --faint: #7882aa;
  --pri: #34d399; --pri-d: #10b981; --pri-soft: #12372f; --pri-line: #1f6e57;
  --ok: #6ee7b7; --ok-bg: #12372f; --warn: #fbbf24; --warn-bg: #3a2e12; --bad: #fb7185; --bad-bg: #3e1622;
  --info: #93b4ff; --info-bg: #1b2a57; --violet: #c4b5fd; --violet-bg: #2a2156;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  color-scheme: dark;
}
:root { box-sizing: border-box; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
*, *::before, *::after { box-sizing: inherit; }
body { margin: 0; background: var(--paper); color: var(--fg); font-family: var(--font); font-size: calc(15px * var(--fs)); line-height: 1.6; -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 60; background: var(--ink); }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 800; text-wrap: balance; }
h1 { font-size: 1.55em; } h2 { font-size: 1.2em; } h3 { font-size: 1.05em; }
p { margin: 0 0 .6em; }
a { color: var(--pri-d); }
:root[data-theme="dark"] a { color: var(--pri); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--pri); outline-offset: 2px; }
[hidden] { display: none !important; }
.num, td.num { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: .86em; } .tiny { font-size: .78em; }
.nowrap { white-space: nowrap; } .grow { flex: 1; min-width: 0; } .center { text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.side {
  position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--side-w); z-index: 40;
  background: var(--ink); color: var(--ink-fg); display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
}
.main { flex: 1; min-width: 0; margin-inline-start: var(--side-w); display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.brand-logo { width: 42px; height: 42px; border-radius: 12px; background: rgba(255, 255, 255, .1); display: grid; place-items: center; overflow: hidden; flex: none; }
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-name { font-weight: 800; font-size: .98em; line-height: 1.25; }
.brand-sub { font-size: .76em; color: var(--ink-mute); }
.nav { flex: 1; overflow-y: auto; padding: 10px 10px 16px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.nav-sec { margin-top: 4px; }
.nav-head, .nav-link {
  display: flex; align-items: center; gap: 11px; width: 100%; border: 0; background: none; color: inherit; text-decoration: none;
  padding: 9px 12px; border-radius: 10px; cursor: pointer; text-align: start; font-weight: 600; font-size: .93em;
}
.nav-head:hover, .nav-link:hover { background: rgba(255, 255, 255, .07); }
.nav-head .ico { opacity: .85; }
.nav-head.on { background: rgba(255, 255, 255, .1); }
.nav-head .chev { margin-inline-start: auto; transition: transform .2s; opacity: .6; }
.nav-sec.open .chev { transform: rotate(180deg); }
.nav-sub { display: none; padding: 2px 0 6px; }
.nav-sec.open .nav-sub { display: block; }
.nav-link { font-weight: 500; padding: 7px 12px 7px 12px; padding-inline-start: 44px; color: var(--ink-mute); font-size: .9em; }
.nav-link.on { color: #fff; background: rgba(52, 211, 153, .16); box-shadow: inset 3px 0 0 #34d399; }
[dir="rtl"] .nav-link.on { box-shadow: inset -3px 0 0 #34d399; }
.nav-badge { margin-inline-start: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #f59e0b; color: #1f1300; font-size: .74em; font-weight: 800; display: inline-grid; place-items: center; }
.side-foot { border-top: 1px solid rgba(255, 255, 255, .08); padding: 10px; display: flex; align-items: center; gap: 8px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
.me { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; border: 0; background: none; color: inherit; padding: 6px; border-radius: 10px; cursor: pointer; text-align: start; }
.me:hover { background: rgba(255, 255, 255, .07); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #34d399; color: #053b2e; display: grid; place-items: center; font-weight: 800; flex: none; font-size: .9em; }
.me-name { font-weight: 700; font-size: .88em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-role { font-size: .74em; color: var(--ink-mute); }
.side .icon-btn { color: var(--ink-fg); position: relative; }
.side .icon-btn:hover { background: rgba(255, 255, 255, .08); }
.dot { position: absolute; top: 4px; inset-inline-end: 4px; min-width: 17px; height: 17px; border-radius: 9px; background: #f43f5e; color: #fff; font-size: .68em; font-weight: 800; display: grid; place-items: center; padding: 0 4px; }

.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-in { display: flex; align-items: center; gap: 12px; padding: 12px 28px; max-width: 1280px; margin: 0 auto; width: 100%; }
.topbar h1 { font-size: 1.15em; }
.icon-btn.menu-btn { display: none; }
.content { padding: 24px 28px 64px; max-width: 1280px; margin: 0 auto; width: 100%; }
.banner { display: flex; gap: 10px; align-items: center; padding: 10px 28px; font-size: .9em; font-weight: 600; }
.banner.arch { background: var(--warn-bg); color: var(--warn); }
.scrim { display: none; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-h h2, .card-h h3 { flex: 1; min-width: 0; }
.card-b { padding: 18px 20px; }
.card + .card, .stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.between { justify-content: space-between; }
.ph { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.ph .grow p { color: var(--muted); margin: 4px 0 0; max-width: 72ch; }
.sep { height: 1px; background: var(--line); margin: 16px 0; border: 0; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 0 16px; border-radius: 11px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--fg); font-weight: 700; font-size: .92em; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--pri); color: var(--pri-d); }
:root[data-theme="dark"] .btn:hover { color: var(--pri); }
.btn.pri { background: var(--pri); border-color: var(--pri); color: #fff; }
:root[data-theme="dark"] .btn.pri { color: #04261d; }
.btn.pri:hover { background: var(--pri-d); border-color: var(--pri-d); color: #fff; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.danger:hover { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--line); }
.btn.sm { min-height: 32px; padding: 0 11px; font-size: .84em; border-radius: 9px; }
.btn[disabled], .btn.busy { opacity: .5; pointer-events: none; }
.icon-btn { width: 38px; height: 38px; display: inline-grid; place-items: center; border: 0; background: none; border-radius: 10px; cursor: pointer; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--fg); }
.ico { width: 19px; height: 19px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn .ico { width: 17px; height: 17px; }
[dir="rtl"] .flip { transform: scaleX(-1); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .lbl { font-size: .84em; font-weight: 700; color: var(--muted); }
.field .hint { font-size: .78em; color: var(--faint); }
.req::after { content: " *"; color: var(--bad); }
input[type="text"], input[type="password"], input[type="email"], input[type="date"], input[type="time"], input[type="number"], input[type="url"], input[type="search"], input[type="tel"], select, textarea {
  width: 100%; min-height: 42px; padding: 8px 12px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--surface); color: var(--fg); font-size: max(16px, .95em);
}
textarea { min-height: 84px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pri); box-shadow: 0 0 0 3px var(--pri-soft); }
input[readonly] { background: var(--surface-2); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--pri); }
.form { display: grid; gap: 14px; }
.f2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.f3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 700; font-size: .86em; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 4px 12px; font-size: .84em; cursor: pointer; font-weight: 600; }
.pill.on { background: var(--pri-soft); border-color: var(--pri); color: var(--pri-d); }
:root[data-theme="dark"] .pill.on { color: var(--pri); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { padding: 10px 14px; border: 0; background: none; cursor: pointer; font-weight: 700; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; font-size: .92em; }
.tabs .on { color: var(--fg); border-bottom-color: var(--pri); }

/* ---------- data display ---------- */
.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: .92em; }
.tbl th { text-align: start; font-size: .78em; font-weight: 800; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.tbl .acts { text-align: end; white-space: nowrap; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: .78em; font-weight: 800; white-space: nowrap; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.chip.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.chip.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.chip.info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.chip.violet { background: var(--violet-bg); color: var(--violet); border-color: transparent; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .ico { width: 36px; height: 36px; opacity: .45; margin-bottom: 8px; }
.empty h3 { color: var(--fg); margin-bottom: 4px; }
.kpi { padding: 16px 18px; }
.kpi .v { font-size: 1.9em; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: .86em; font-weight: 600; }
.kpi .s { font-size: .8em; margin-top: 6px; }
.bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--line); }
.bar > i { display: block; height: 100%; background: var(--pri); border-radius: 4px; }
.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--rc); font-size: .92em; border: 1px solid; }
.callout .ico { margin-top: 2px; }
.callout.info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.callout.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.callout.danger { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.callout.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.callout b { color: inherit; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: .92em; }
.kv dt { color: var(--muted); font-weight: 700; }
.kv dd { margin: 0; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9em; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; direction: ltr; unicode-bidi: isolate; }
pre.code { padding: 10px 12px; overflow-x: auto; white-space: pre; display: block; text-align: left; }

/* setup steps */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.steps li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.steps li:last-child { border-bottom: 0; }
.steps .n { counter-increment: s; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; font-size: .8em; font-weight: 800; flex: none; color: var(--muted); }
.steps .n::before { content: counter(s); }
.steps li.done .n { background: var(--pri); border-color: var(--pri); color: #fff; }
.steps li.done .n::before { content: "✓"; }
.steps li.next .n { border-color: var(--pri); color: var(--pri-d); box-shadow: 0 0 0 4px var(--pri-soft); }
.steps li.done .st-t { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-2); }
.st-t { font-weight: 700; }
.st-d { font-size: .84em; color: var(--muted); }

/* week navigator */
.weeknav { display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.weeknav .wk { padding: 0 10px; font-weight: 700; font-size: .9em; white-space: nowrap; }
.weeknav input[type="date"] { min-height: 34px; width: auto; border: 0; padding: 4px 6px; }

/* plan grid */
.daycell { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface-2); min-height: 72px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; text-align: start; width: 100%; color: inherit; }
.daycell:hover { border-color: var(--pri); }
.daycell.filled { background: var(--surface); }
.daycell.off { cursor: default; opacity: .6; background: repeating-linear-gradient(135deg, var(--surface-2), var(--surface-2) 6px, transparent 6px, transparent 12px); }
.daycell .d { font-size: .78em; font-weight: 800; color: var(--muted); }
.daycell .t { font-weight: 700; font-size: .92em; }
.daycell .hw { font-size: .82em; color: var(--muted); }
.days { display: grid; grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr)); gap: 10px; }
.ttg { border-collapse: separate; border-spacing: 6px; width: 100%; min-width: 640px; }
.ttg th { font-size: .78em; color: var(--muted); font-weight: 800; padding: 4px; }
.ttg td { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px; font-size: .84em; vertical-align: top; height: 58px; }
.ttg td.has { background: var(--pri-soft); border-color: var(--pri-line); }
.ttg td.click { cursor: pointer; }
.ttg td.click:hover { border-color: var(--pri); }
.ttg td.brk { background: none; border-style: dashed; color: var(--faint); text-align: center; height: auto; }

/* ---------- overlays ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(9, 16, 28, .55); z-index: 80; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow-y: auto; animation: fade .15s ease; }
.modal { background: var(--surface); border-radius: 18px; width: 100%; max-width: 560px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
.modal.wide { max-width: 860px; } .modal.xwide { max-width: 1100px; }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-h h2 { flex: 1; font-size: 1.1em; }
.modal-b { padding: 18px 20px; }
.modal-f { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0 } }
.toasts { position: fixed; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); inset-inline-end: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 36px)); }
.toast { background: var(--fg); color: var(--paper); padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 600; font-size: .92em; animation: fade .2s; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
:root[data-theme="dark"] .toast.ok { color: #04261d; }
.pop { position: fixed; z-index: 90; background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); width: 340px; max-width: calc(100vw - 24px); max-height: min(70vh, 560px); display: flex; flex-direction: column; overflow: hidden; }
.pop-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 800; }
.pop-b { overflow-y: auto; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 14px; border: 0; background: none; cursor: pointer; text-align: start; font-weight: 600; font-size: .92em; color: inherit; }
.menu-item:hover { background: var(--surface-2); }
.menu-group { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.menu-group:last-child { border-bottom: 0; }
.notif { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: color-mix(in srgb, var(--pri-soft) 55%, transparent); }
.notif .t { font-weight: 700; font-size: .9em; line-height: 1.4; }
.notif .w { font-size: .76em; color: var(--faint); }
.notif.setup .t { color: var(--pri-d); }
.drop { border: 2px dashed var(--line-2); border-radius: 14px; padding: 26px; text-align: center; cursor: pointer; background: var(--surface-2); }
.drop:hover, .drop.over { border-color: var(--pri); background: var(--pri-soft); }

/* auth & portal */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(1200px 500px at 85% -10%, color-mix(in srgb, var(--pri) 22%, transparent), transparent 60%), var(--paper); }
.auth-card { width: 100%; max-width: 440px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.auth-brand .brand-logo { background: var(--ink); color: #fff; }
.langsw { position: fixed; top: calc(14px + env(safe-area-inset-top, 0px)); inset-inline-end: 14px; }
.portal { max-width: 980px; margin: 0 auto; padding: 22px 16px 60px; }
.portal-head { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.subj { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface); }
.subj + .subj { margin-top: 8px; }

/* guide */
.guide { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: start; }
.toc { position: sticky; top: 80px; }
.toc a { display: block; padding: 6px 10px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .9em; }
.toc a:hover { background: var(--surface-2); color: var(--fg); }
.doc h2 { margin: 6px 0 10px; } .doc h3 { margin: 18px 0 6px; }
.doc p, .doc li { max-width: 78ch; }
.doc ol, .doc ul { padding-inline-start: 22px; margin: 0 0 10px; }
.doc li { margin-bottom: 4px; }
.doc section { scroll-margin-top: 80px; }
.doc .callout { margin: 10px 0; }
details.faq { border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; margin-bottom: 8px; background: var(--surface-2); }
details.faq summary { cursor: pointer; padding: 12px 0; font-weight: 700; }
details.faq[open] { background: var(--surface); }
details.faq > div { padding-bottom: 12px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .side { transform: translateX(-105%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  [dir="rtl"] .side { transform: translateX(105%); }
  .app.nav-open .side { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(9, 16, 28, .5); z-index: 35; }
  .main { margin-inline-start: 0; }
  .icon-btn.menu-btn { display: inline-grid; }
  .topbar-in { padding: 10px 16px; }
  .content { padding: 18px 16px 56px; }
  .banner { padding: 10px 16px; }
  .guide { grid-template-columns: 1fr; } .toc { position: static; }
}
@media (max-width: 640px) {
  .g2, .g3, .g4, .f2, .f3 { grid-template-columns: minmax(0, 1fr); }
  .days { grid-template-columns: minmax(0, 1fr); }
  .card-h, .card-b { padding-inline: 14px; }
  .modal-back { padding: 0; align-items: flex-end; }
  .modal { border-radius: 18px 18px 0 0; max-height: 92vh; display: flex; flex-direction: column; }
  .modal-b { overflow-y: auto; }
  .modal-f { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  .modal-f .btn { flex: 1; }
  .ph h1 { font-size: 1.3em; }
  .tbl.cards thead { display: none; }
  .tbl.cards tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  .tbl.cards td { display: flex; gap: 10px; border: 0; padding: 4px 14px; }
  .tbl.cards td::before { content: attr(data-l); color: var(--muted); font-weight: 700; font-size: .82em; min-width: 92px; }
  .tbl.cards td.acts { justify-content: flex-start; flex-wrap: wrap; }
  .tbl.cards td.acts::before { display: none; }
  .hide-sm { display: none !important; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- print ---------- */
.print-only { display: none; }
@media print {
  body { background: #fff; color: #000; font-size: 12px; }
  .side, .topbar, .no-print, .toasts, .banner { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #bbb; break-inside: avoid; }
  .print-only { display: block; }
  .tbl th { background: #eee !important; }
  a { color: #000; text-decoration: none; }
  @page { size: A4; margin: 0; }
  body { padding: 12mm; }
}
[dir="ltr"] .flip-ltr { transform: scaleX(-1); }
.pill:focus-within { outline: 2px solid var(--pri); outline-offset: 2px; }
.f2 > *, .f3 > *, .form > * { min-width: 0; }
input, select, textarea { min-width: 0; }
details.faq .f3 { padding-top: 4px; }
@media (min-width: 901px) { .topbar h1#page-title { visibility: hidden; } }
@media (min-width: 901px) { .topbar:has(#term-switch:empty) { display: none; } }
.grid > .card + .card, .row > .card + .card { margin-top: 0; }
@media (max-width: 640px) {
  .weeknav { flex-wrap: wrap; width: 100%; justify-content: space-between; }
  .weeknav .wk { flex: 1; text-align: center; order: 0; }
  .weeknav input[type="date"] { display: none; }
  .ph > select, .ph > .btn { flex: 1 1 auto; }
  #term-switch select { max-width: 52vw !important; font-size: 14px; }
  .topbar h1 { font-size: 1em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
html, body { overflow-x: clip; }
.ph > .grow { flex: 1 1 320px; }

/* announcement / circular text: keeps line breaks, wraps long addresses */
.ltxt { white-space: pre-wrap; overflow-wrap: anywhere; }
.ltxt a.autolink { color: var(--pri-d, var(--pri)); text-decoration: underline; unicode-bidi: isolate; }
