:root {
	--bg: #f5f7fb; --card: #ffffff; --text: #18203a; --muted: #5d6680; --line: #dde3ef;
	--brand: #2f4ea8; --brand-ink: #ffffff; --ok: #157347; --warn: #9a5b00; --bad: #b42318;
	--ok-bg: #e7f6ee; --warn-bg: #fff4dc; --bad-bg: #fde9e7;
	--hat-parent: #2f4ea8; --hat-staff: #0e7a5f; --hat-pta: #8a4bb7; --hat-student: #c2410c; --hat-moderator: #475569; --hat-temp: #64748b;
	color-scheme: light;
}
@media (prefers-color-scheme: dark) {
	:root {
		--bg: #0f1424; --card: #171e33; --text: #e8ecf7; --muted: #a2abc4; --line: #2a3350;
		--brand: #7f9cf5; --brand-ink: #0b1230; --ok: #4ade80; --warn: #fbbf24; --bad: #f87171;
		--ok-bg: #12301f; --warn-bg: #36290d; --bad-bg: #3a1717;
		--hat-parent: #7f9cf5; --hat-staff: #34d399; --hat-pta: #c084fc; --hat-student: #fb923c; --hat-moderator: #94a3b8; --hat-temp: #94a3b8;
		color-scheme: dark;
	}
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
	font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Hebrew", "Noto Sans Arabic", sans-serif; }
main { max-width: 640px; margin: 0 auto; padding: max(12px, env(safe-area-inset-top)) 16px 96px; }
h1 { font-size: 1.9rem; margin: .4em 0 .1em; }
h2 { font-size: 1.2rem; margin: 0 0 .6em; }
h3 { font-size: 1.02rem; margin: 1em 0 .3em; }
p { margin: .5em 0; }
a { color: var(--brand); }
.muted { color: var(--muted); } .small { font-size: .9rem; } .center { text-align: center; } .grow { flex: 1; min-width: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hero { text-align: center; padding: 20px 0 6px; }
.hero img { border-radius: 20px; }
.tag { color: var(--muted); margin: 0; }

/* top bar: the active hat always visible, coloured, so nobody acts in the wrong role */
.top { display: flex; align-items: center; gap: 6px; padding: 4px 0 6px; border-bottom: 4px solid var(--hat, var(--brand)); margin-bottom: 4px; }
.top img { border-radius: 8px; display: block; }
.hat-parent { --hat: var(--hat-parent); } .hat-staff { --hat: var(--hat-staff); } .hat-pta { --hat: var(--hat-pta); }
.hat-student { --hat: var(--hat-student); } .hat-moderator { --hat: var(--hat-moderator); } .hat-temp { --hat: var(--hat-temp); }
.hat { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--hat, var(--brand)); }
.hat select { font-weight: 700; color: var(--hat, var(--brand)); border-color: var(--hat, var(--brand)); max-width: 100%; }
.icon-btn { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; font-size: 1.25rem; position: relative; border-radius: 12px; }
.dot { position: absolute; top: 2px; inset-inline-end: 0; background: var(--bad); color: #fff; border-radius: 9px; font-size: .7rem; padding: 0 5px; }
.school { margin: 0 0 8px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin: 0 0 12px; }
.card.attention { border: 2px solid var(--warn); }
details.card > summary, details > summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.sub { border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 8px; }
.facts { background: var(--bg); border-radius: 12px; padding: 10px 12px; margin: 8px 0; }
.body { white-space: normal; margin: 8px 0; }
.guidance { background: var(--warn-bg); border-radius: 10px; padding: 8px 10px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.wrap { margin-bottom: 10px; }
.row input, .row select { width: auto; flex: 1; min-width: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 8px; border: 1px solid var(--line); border-radius: 14px;
	text-decoration: none; color: var(--text); text-align: center; font-weight: 600; min-height: 76px; justify-content: center; }
.tile span { font-size: 1.5rem; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list > li > a.grow { text-decoration: none; color: inherit; }
.day li.r0 { border-inline-start: 4px solid var(--bad); padding-inline-start: 8px; }
.day li.r1 { border-inline-start: 4px solid var(--warn); padding-inline-start: 8px; }
.day li.r2 { border-inline-start: 4px solid var(--brand); padding-inline-start: 8px; }

button, .button { font: inherit; font-weight: 600; min-height: 44px; padding: 8px 14px; border-radius: 12px; cursor: pointer;
	border: 1px solid var(--line); background: var(--bg); color: var(--text); text-decoration: none;
	display: inline-flex; align-items: center; justify-content: center; gap: 6px; margin: 2px 0; }
button:disabled { opacity: .55; cursor: progress; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.big { min-height: 54px; width: 100%; font-size: 1.05rem; margin-top: 8px; }
.danger { background: var(--bad-bg); color: var(--bad); border: 2px solid var(--bad); }
.link { background: none; border: 0; color: var(--brand); text-decoration: underline; padding: 6px; font-weight: 500; }
.danger-text { color: var(--bad); }

label.field { display: grid; gap: 4px; margin: 10px 0; font-weight: 600; }
label.check { display: flex; gap: 8px; align-items: center; margin: 10px 0; min-height: 44px; }
label.check input { width: 22px; height: 22px; min-height: 0; }
input, select, textarea { font: inherit; min-height: 44px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line);
	background: var(--bg); color: var(--text); width: 100%; }
textarea { min-height: 80px; }
select[multiple] { min-height: 120px; }
input.qty { width: 80px; flex: 0 0 80px; }
.lang { display: flex; align-items: center; gap: 8px; justify-content: center; margin: 10px 0; color: var(--muted); }
.lang select { width: auto; }

.badge { display: inline-block; font-size: .8rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.flash { padding: 10px 12px; border-radius: 12px; margin: 8px 0; }
.flash.ok { background: var(--ok-bg); color: var(--ok); } .flash.warn { background: var(--warn-bg); color: var(--warn); } .flash.bad { background: var(--bad-bg); color: var(--bad); }

.chat { display: grid; gap: 6px; margin: 8px 0; }
.msg { background: var(--bg); border-radius: 14px; padding: 8px 12px; max-width: 85%; display: grid; gap: 2px; }
.msg.mine { justify-self: end; background: var(--ok-bg); }
.msg.internal { background: var(--warn-bg); }
.slots { display: flex; flex-wrap: wrap; gap: 6px; }
.slot { padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); }
.slot.taken { opacity: .45; text-decoration: line-through; }
.slot.mine { background: var(--ok-bg); }
.thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg); padding: 8px; border-radius: 10px; }
table { width: 100%; border-collapse: collapse; } td { border-bottom: 1px solid var(--line); padding: 6px; }

nav.bottom { position: fixed; bottom: 0; inset-inline: 0; display: flex; justify-content: center; background: var(--card); border-top: 1px solid var(--line);
	padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
nav.bottom a { flex: 1; max-width: 128px; display: flex; flex-direction: column; align-items: center; gap: 0; padding: 6px 2px; text-decoration: none; color: var(--muted);
	font-size: .78rem; min-height: 56px; justify-content: center; }
nav.bottom a span { font-size: 1.3rem; }
nav.bottom a.on { color: var(--hat, var(--brand)); font-weight: 700; }
@media print { nav.bottom, .top, button, .button, summary { display: none !important; } .card { border: 0; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* the children bar and the parent / student choice */
.kids { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; }
.kids::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; min-height: 40px; border-radius: 99px; padding: 6px 12px; background: var(--card); border: 1px solid var(--line); white-space: nowrap; }
.chip.on { background: var(--hat, var(--brand)); color: #fff; border-color: transparent; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 12px; }
.seg button { min-height: 56px; font-size: 1.05rem; }
.seg button.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* attendance: three-state choice per student */
.seg3 { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg3 button { border: 0; border-radius: 0; margin: 0; min-width: 64px; }
.seg3 button.on.present { background: var(--ok-bg); color: var(--ok); }
.seg3 button.on.absent { background: var(--bad-bg); color: var(--bad); }
.seg3 button.on.late { background: var(--warn-bg); color: var(--warn); }
