:root { --mid: #0b0b0b; --gold: #d6af57; --gold-deep: #84661d; --ivory: #f7f3eb; --card: #fffdf8; --line: #ddd6c8; --muted: #57534c; --bad: #a2301b; --ok: #1f6256; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--ivory); color: var(--mid); min-height: 100vh; }
[dir=rtl] body, [dir=rtl] button, [dir=rtl] select, [dir=rtl] textarea { font-family: "IBM Plex Sans Arabic", system-ui, sans-serif; }
button, select, textarea, input { font: inherit; color: inherit; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--mid); color: var(--ivory); }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; margin-inline-end: auto; min-width: 0; }
.brand b { display: block; font: 500 1.05rem/1.2 Georgia, serif; }
.brand small { display: block; color: #cfc7b6; font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46vw; }
.mark { flex: none; width: 34px; height: 34px; border: 1px solid var(--gold); border-radius: 50%; display: grid; place-items: center; color: var(--gold); font: 500 1.1rem Georgia, serif; }
.lang { background: none; border: 1px solid #555; color: var(--ivory); border-radius: 999px; padding: 4px 12px; font-size: .85rem; cursor: pointer; }
.out { color: var(--gold); font-size: .85rem; white-space: nowrap; }
main { padding: 20px 16px 40px; max-width: 980px; margin: 0 auto; }
h1 { font: 500 1.8rem/1.2 Georgia, serif; margin: 4px 0 2px; }
.muted { color: var(--muted); margin: 0 0 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 18px; }
.tile { position: relative; display: grid; gap: 6px; align-content: start; min-height: 112px; padding: 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); color: inherit; text-decoration: none; }
.tile b { font-size: 1.02rem; }
.tile span { font-size: .85rem; color: var(--muted); }
.tile .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--mid); color: var(--gold); font-weight: 700; }
a.tile:hover, a.tile:focus-visible { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px rgba(214,175,87,.25); }
.tile.soon { opacity: .62; }
.tile .badge { position: absolute; top: 12px; inset-inline-end: 12px; font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; background: #ece6d8; color: var(--muted); padding: 2px 8px; border-radius: 999px; }
.tile.cp { background: var(--mid); color: var(--ivory); border-color: var(--mid); }
.tile.cp span { color: #cfc7b6; } .tile.cp .ico { background: var(--gold); color: var(--mid); }
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px 0; }
.bar .grow { flex: 1; }
select, textarea { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 10px; }
textarea { width: 100%; min-height: 90px; }
.btn { border: 1px solid var(--mid); background: transparent; border-radius: 999px; padding: 8px 16px; cursor: pointer; }
.btn.primary { background: var(--gold); border-color: var(--gold); font-weight: 600; }
.back { display: inline-block; color: var(--gold-deep); text-decoration: none; font-size: .9rem; margin-bottom: 6px; }
.list { display: grid; gap: 10px; }
.req { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; width: 100%; text-align: start; padding: 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); cursor: pointer; }
.req:hover, .req:focus-visible { border-color: var(--gold); outline: none; }
.req b { font-size: 1rem; } .req small { color: var(--muted); }
.tag { justify-self: end; align-self: start; font-size: .75rem; padding: 2px 10px; border-radius: 999px; background: #ece6d8; }
.tag.new { background: var(--gold); } .tag.booked { background: #cfe5df; } .tag.closed { background: #e2e2e2; color: var(--muted); }
dialog { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 20px)); max-height: calc(100dvh - 24px); background: var(--card); color: var(--mid); box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); }
dialog::backdrop { background: rgba(11,11,11,.55); }
#dlgBody { padding: 22px 18px; }
.x { position: absolute; inset-inline-end: 8px; top: 6px; } .x button { background: none; border: 0; font-size: 1.6rem; cursor: pointer; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 12px 0; }
dl.kv dt { color: var(--muted); text-transform: capitalize; } dl.kv dd { margin: 0; overflow-wrap: anywhere; }
label { display: block; font-weight: 600; font-size: .9rem; margin: 12px 0 4px; }
.err { color: var(--bad); font-weight: 600; }
.center { text-align: center; padding: 40px 10px; }
#toast { position: fixed; bottom: calc(18px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: var(--mid); color: var(--ivory); padding: 10px 18px; border-radius: 999px; opacity: 0; transition: opacity .2s; pointer-events: none; }
#toast.show { opacity: 1; } #toast.bad { background: var(--bad); }
/* Phase 2: students, families, enrollment */
h2 { font: 500 1.25rem/1.3 Georgia, serif; margin: 26px 0 10px; }
h3 { font-size: 1rem; margin: 20px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.form h3:first-child { border: 0; padding: 0; }
input[type=text], input[type=search], input[type=tel], input[type=email], input[type=date] { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 10px; width: 100%; }
.form label { font-weight: 600; } .form label input, .form label select, .form label textarea { display: block; width: 100%; margin-top: 4px; font-weight: 400; }
label.chk { display: flex; gap: 8px; align-items: center; font-weight: 400; } label.chk input { width: auto; margin: 0; }
.form .btn.primary { margin-top: 14px; }
a.req { color: inherit; text-decoration: none; }
.card { display: grid; gap: 3px; padding: 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.card small { color: var(--muted); } .card .tag { justify-self: start; }
.card .warn { color: var(--bad); font-weight: 600; }
.card .enr { color: var(--mid); }
.acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.btn.sm { padding: 5px 12px; font-size: .85rem; }
.link { background: none; border: 0; color: var(--bad); text-decoration: underline; cursor: pointer; font-size: .85rem; padding: 0 4px; }
.tag.active { background: #cfe5df; } .tag.trial, .tag.waiting { background: var(--gold); } .tag.left { background: #e2e2e2; color: var(--muted); }
/* Phase 2 week 2: timetable, attendance, setup */
fieldset { border: 1px solid var(--line); border-radius: 12px; margin: 12px 0 0; padding: 8px 12px 12px; }
legend { font-weight: 600; font-size: .9rem; padding: 0 4px; }
.days label.chk { flex-wrap: wrap; margin: 6px 0; } .days .dn { min-width: 40px; } .days label.chk { gap: 6px; } .days input[type=time] { width: auto; padding: 5px 6px; }
input[type=time], input[type=number] { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 10px; width: 100%; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.seg label { display: flex; align-items: center; gap: 4px; margin: 0; font-weight: 400; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; background: #fff; }
.seg label:has(input:checked) { border-color: var(--gold); background: #fbf3df; font-weight: 600; }
fieldset.att small.warn { display: block; color: var(--bad); font-weight: 600; }
.lesson.cancelled { opacity: .55; } .tag.cancelled { background: #e2e2e2; } .tag.done { background: #cfe5df; } .tag.scheduled:empty { display: none; }
.link.go { color: var(--gold-deep); }
.card a { color: inherit; }
.bar input[type=date] { width: auto; }
.form .seg label input, .form label.chk input { display: inline-block; width: auto; margin: 0; }
.form .days label.chk input[type=time] { display: inline-block; width: auto; }
fieldset.att { display: grid; gap: 4px; } fieldset.att input[type=text] { width: 100%; }
.form .seg label { font-weight: 400; }
a.btn { text-decoration: none; color: inherit; display: inline-block; }
/* Phase 2 week 3: progress, events, store, printing */
.pre { white-space: pre-wrap; }
.tag.late, .tag.not_passed { background: #f3d2cb; color: var(--bad); } .tag.passed, .tag.merit, .tag.distinction { background: #cfe5df; }
ol.prog { padding: 0; list-style: none; counter-reset: p; } ol.prog li { counter-increment: p; } ol.prog li b::before { content: counter(p) ". "; color: var(--gold-deep); }
.stockrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 400; margin: 0; }
.stockrow span { display: grid; } .stockrow input { width: 100px; flex: none; }
@media print {
  body.printing > :not(dialog) { display: none !important; }
  body.printing dialog { position: static; box-shadow: none; max-height: none; width: auto; background: #fff; }
  body.printing .x, body.printing .noprint { display: none; }
  body.printing dialog::backdrop { background: none; }
}
/* Family view */
.narrow { max-width: 420px; margin: 20px auto; }
.form.inline { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px 12px; align-items: end; margin-bottom: 12px; }
.form.inline label { margin: 0; }
.card.off { opacity: .55; }
.tag.present { background: #cfe5df; } .tag.absent { background: #f3d2cb; color: var(--bad); } .tag.excused { background: #e2e2e2; }
button.out { background: none; border: 0; cursor: pointer; text-decoration: underline; }
/* Week 4 part B: news, dashboard, tables */
.news { display: grid; gap: 8px; margin: 14px 0 4px; } .news .card { border-inline-start: 4px solid var(--gold); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; gap: 2px; }
.stat b { font: 500 1.6rem/1.1 Georgia, serif; } .stat span { color: var(--muted); font-size: .85rem; }
.card.row { display: flex; justify-content: space-between; align-items: center; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; } th, td { padding: 8px 10px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; } input[type=month] { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 10px; }
.tag.learning { background: #ece6d8; } .tag.ready { background: var(--gold); } .tag.performed { background: #cfe5df; }
