/* حاضر | Hadir — school attendance. Palette sampled from the school logo. */
@font-face { font-family: Cairo; font-weight: 400; font-display: swap; src: url(../fonts/Cairo-Regular.ttf) format("truetype"); }
@font-face { font-family: Cairo; font-weight: 500; font-display: swap; src: url(../fonts/Cairo-Medium.ttf) format("truetype"); }
@font-face { font-family: Cairo; font-weight: 600; font-display: swap; src: url(../fonts/Cairo-SemiBold.ttf) format("truetype"); }
@font-face { font-family: Cairo; font-weight: 700; font-display: swap; src: url(../fonts/Cairo-Bold.ttf) format("truetype"); }
@font-face { font-family: Cairo; font-weight: 800; font-display: swap; src: url(../fonts/Cairo-ExtraBold.ttf) format("truetype"); }

:root {
  --bg: #f5f1e6; --bg-2: #eee8d9; --surface: #fffdf8; --line: #e6ddc9; --line-2: #d6cab0;
  --ink: #10231b; --ink-2: #3c5047; --muted: #77847d;
  --green: #12553e; --green-2: #0d4c37; --green-3: #074330; --green-4: #062a21; --green-soft: #e2ede6;
  --gold: #b7915a; --gold-2: #9c7742; --gold-3: #d7af76; --gold-soft: #f5ecdc;
  --ok: #17784a; --ok-soft: #dff0e5;
  --late: #b1680a; --late-soft: #fbedd5;
  --bad: #b23a2e; --bad-soft: #f8e1dc;
  --exc: #2f6690; --exc-soft: #e0ebf4;
  --early: #7b4ea3; --early-soft: #efe6f6;
  --radius: 16px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16,35,27,.05), 0 8px 24px -12px rgba(16,35,27,.18);
  --side: 264px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.65 Cairo, "Segoe UI", Tahoma, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--green); text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.i { width: 20px; height: 20px; flex: none; }
.num { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 18px 14px;
  background: var(--green-4); color: #d9e2dc; overflow-y: auto;
  background-image: radial-gradient(120% 60% at 100% 0%, rgba(183,145,90,.16), transparent 60%), radial-gradient(80% 50% at 0% 100%, rgba(18,85,62,.55), transparent 70%);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 6px 18px; margin-bottom: 6px; border-bottom: 1px solid rgba(215,175,118,.18); }
.brand-mark { width: 52px; height: 52px; border-radius: 14px; background: #fbf8f0; display: grid; place-items: center; padding: 5px; box-shadow: 0 0 0 1px rgba(215,175,118,.5); }
.brand b { display: block; font-size: 20px; font-weight: 800; color: #fff; line-height: 1.1; }
.brand small { display: block; font-size: 11.5px; color: var(--gold-3); line-height: 1.4; margin-top: 3px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 12px; color: #cdd8d1; transition: background .15s, color .15s; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.on { background: rgba(215,175,118,.14); color: #fff; }
.nav a.on::before { content: ""; position: absolute; inset-inline-start: -14px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--gold-3); }
.nav a .i { color: var(--gold-3); }
.nav .t { display: flex; flex-direction: column; line-height: 1.25; }
.nav .t span { font-weight: 700; }
.nav .t small { font-size: 10.5px; letter-spacing: .06em; color: #8fa498; font-weight: 600; }
.nav-sep { height: 1px; background: rgba(215,175,118,.14); margin: 10px 4px; }
.side-foot { margin-top: auto; padding: 12px; border-radius: 14px; background: rgba(0,0,0,.18); display: flex; align-items: center; gap: 10px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: var(--green-4); font-weight: 800; flex: none; }
.side-foot .who { min-width: 0; flex: 1; line-height: 1.3; }
.side-foot .who b { display: block; color: #fff; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who small { color: #9fb2a7; font-size: 12px; }
.side-foot button { background: none; border: 0; color: #cdd8d1; cursor: pointer; padding: 6px; border-radius: 8px; display: grid; }
.side-foot button:hover { background: rgba(255,255,255,.08); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 26px 32px 14px; flex-wrap: wrap; }
.top h1 { font-size: 26px; font-weight: 800; }
.eyebrow { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-2); margin-bottom: 2px; }
.top-date { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-weight: 600; font-size: 14px; }
.top-date .i { color: var(--gold-2); width: 18px; height: 18px; }
.page { padding: 4px 32px 56px; width: 100%; max-width: 1320px; }
.mtop, .tabbar { display: none; }

/* ---------- flash ---------- */
.flash { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 12px; margin: 0 0 14px; font-weight: 600; border: 1px solid; }
.flash .i { margin-top: 2px; }
.flash-ok { background: var(--ok-soft); color: #0f5534; border-color: #bfdfca; }
.flash-bad { background: var(--bad-soft); color: #8b2a20; border-color: #ecc3bb; }
.flash-info { background: var(--gold-soft); color: #6d4f22; border-color: #e7d3b0; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-h h2 { font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.card-h h2 .i { color: var(--gold-2); }
.card-b { padding: 18px; }
.stack { display: grid; gap: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.rule { display: flex; align-items: center; gap: 12px; color: var(--gold-2); font-weight: 700; font-size: 13px; margin: 6px 0 12px; }
.rule::before, .rule::after { content: ""; height: 1px; flex: 1; background: linear-gradient(90deg, transparent, var(--gold-3), transparent); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 11px; border: 1px solid transparent;
  font-weight: 700; font-size: 14.5px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn .i { width: 18px; height: 18px; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-3); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--gold-2); }
.btn-ghost { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.btn-ghost:hover { border-color: var(--gold); background: #fff; }
.btn-danger { background: #fff; border-color: #e7c1ba; color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-wa { background: #1f9d55; color: #fff; }
.btn-wa:hover { background: #17834a; }
.btn-sm { min-height: 34px; padding: 0 11px; font-size: 13.5px; border-radius: 9px; }
.btn-icon { width: 36px; min-height: 36px; padding: 0; }
.btn-block { width: 100%; }
.btn-lg { min-height: 52px; font-size: 16px; padding: 0 22px; border-radius: 14px; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- forms ---------- */
.form { display: grid; gap: 16px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.field { display: grid; gap: 6px; align-content: start; }
.field > label, .label { font-weight: 700; font-size: 13.5px; color: var(--ink-2); }
.input, .select, .textarea { width: 100%; min-height: 44px; border: 1px solid var(--line-2); border-radius: 11px; background: #fff; padding: 8px 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
.textarea { min-height: 120px; resize: vertical; line-height: 1.7; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(183,145,90,.18); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%239c7742' stroke-width='2'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 14px center; padding-left: 36px; }
.hint { color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--green); }
.input-icon { position: relative; }
.input-icon .i { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon .input { padding-right: 40px; }
.input-icon .i { right: 12px; inset-inline-start: auto; }

/* ---------- chips + tabs ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap; line-height: 1.7; }
.chip small { font-weight: 600; opacity: .8; font-size: 11.5px; }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-late { background: var(--late-soft); color: var(--late); }
.chip-bad { background: var(--bad-soft); color: var(--bad); }
.chip-exc { background: var(--exc-soft); color: var(--exc); }
.chip-early { background: var(--early-soft); color: var(--early); }
.chip-muted { background: var(--bg-2); color: var(--muted); }
.chip-gold { background: var(--gold-soft); color: var(--gold-2); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-2); font-weight: 700; font-size: 13.5px; background: var(--surface); }
.tabs a b { font-size: 12px; min-width: 22px; text-align: center; padding: 0 6px; border-radius: 999px; background: var(--bg-2); color: var(--ink-2); }
.tabs a.on { background: var(--green); border-color: var(--green); color: #fff; }
.tabs a.on b { background: rgba(255,255,255,.2); color: #fff; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1 1 220px; }
.toolbar .select, .toolbar .input { width: auto; min-width: 150px; }

/* ---------- dashboard ---------- */
.hero { position: relative; overflow: hidden; border-radius: 22px; padding: 24px; color: #f4efe2; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 26px; align-items: center;
  background: var(--green-4); background-image: radial-gradient(100% 80% at 0% 0%, rgba(18,85,62,.9), transparent 60%), radial-gradient(70% 70% at 100% 100%, rgba(183,145,90,.28), transparent 65%); box-shadow: var(--shadow); }
.hero::after { content: ""; position: absolute; inset-inline-end: -40px; bottom: -60px; width: 260px; height: 300px; opacity: .08; pointer-events: none;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 120'%3E%3Cpath d='M4 120V52C4 26 26 12 50 2c24 10 46 24 46 50v68z' fill='none' stroke='%23d7af76' stroke-width='3'/%3E%3Cpath d='M18 120V56c0-18 15-29 32-37 17 8 32 19 32 37v64z' fill='none' stroke='%23d7af76' stroke-width='2'/%3E%3C/svg%3E"); }
.ring { position: relative; width: 150px; height: 150px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { stroke: rgba(255,255,255,.12); }
.ring .bar { stroke: var(--gold-3); stroke-linecap: round; transition: stroke-dasharray .6s ease; }
.ring .val { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.ring .val b { font-size: 36px; font-weight: 800; color: #fff; }
.ring .val small { font-size: 12px; color: var(--gold-3); font-weight: 700; margin-top: 4px; }
.hero h2 { font-size: 22px; font-weight: 800; color: #fff; }
.hero p { margin: 4px 0 16px; color: #c7d4cc; }
.hero .stats { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-bottom: 18px; }
.hero .stats div { line-height: 1.2; }
.hero .stats b { font-size: 22px; font-weight: 800; color: #fff; display: block; }
.hero .stats small { color: #b6c6bd; font-size: 12.5px; font-weight: 600; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi { position: relative; padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: inherit; display: block; transition: border-color .15s, transform .15s; }
a.kpi:hover { border-color: var(--gold-3); transform: translateY(-1px); }
.kpi .ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 10px; }
.kpi .n { font-size: 30px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--ink-2); font-size: 13.5px; font-weight: 700; }
.kpi .s { color: var(--muted); font-size: 12px; }
.tone-ok .ic { background: var(--ok-soft); color: var(--ok); }
.tone-late .ic { background: var(--late-soft); color: var(--late); }
.tone-bad .ic { background: var(--bad-soft); color: var(--bad); }
.tone-early .ic { background: var(--early-soft); color: var(--early); }
.tone-muted .ic { background: var(--bg-2); color: var(--muted); }
.classes { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; padding: 16px; }
.cls { display: block; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: inherit; transition: border-color .15s, box-shadow .15s; }
.cls:hover { border-color: var(--gold-3); box-shadow: var(--shadow); }
.cls-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.cls-h b { font-size: 20px; font-weight: 800; color: var(--green-3); font-variant-numeric: tabular-nums; }
.cls-h span { font-size: 13px; color: var(--muted); font-weight: 700; }
.bar { display: flex; height: 9px; border-radius: 99px; overflow: hidden; background: var(--bg-2); }
.bar i { display: block; height: 100%; }
.bar .b-ok { background: var(--ok); } .bar .b-late { background: #e2a03f; } .bar .b-bad { background: #d56b5f; } .bar .b-exc { background: #6f9cc2; }
.cls-n { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-inline-end: 4px; vertical-align: middle; }
.feed { list-style: none; margin: 0; padding: 4px 0; }
.feed li { display: flex; align-items: center; gap: 12px; padding: 10px 18px; }
.feed li + li { border-top: 1px dashed var(--line); }
.feed .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.feed .ic .i { width: 18px; height: 18px; }
.feed .t { flex: 1; min-width: 0; line-height: 1.35; }
.feed .t b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed .t small { color: var(--muted); }
.feed time { color: var(--ink-2); font-weight: 700; font-size: 13px; white-space: nowrap; }
.feed .undone { opacity: .45; text-decoration: line-through; }
.warns { display: grid; gap: 10px; }
.warn { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px; background: var(--gold-soft); border: 1px solid #e8d5b2; color: #5f4520; font-weight: 600; flex-wrap: wrap; }
.warn .i { color: var(--gold-2); }
.warn span { flex: 1 1 240px; }

/* ---------- register rows ---------- */
.rows { margin: 0; padding: 0; list-style: none; }
.grp-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 18px; background: var(--bg-2); border-top: 1px solid var(--line); font-weight: 800; color: var(--green-3); }
.grp-h:first-child { border-top: 0; border-radius: var(--radius) var(--radius) 0 0; }
.grp-h small { color: var(--muted); font-weight: 700; }
.r { display: grid; grid-template-columns: minmax(0, 1fr) 120px 96px 96px auto; gap: 12px; align-items: center; padding: 11px 18px; border-top: 1px solid var(--line); }
.grp-h + .r { border-top: 0; }
.r-st { grid-template-columns: minmax(0, 1fr) 140px 150px auto; }
.grid-dash { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.r .who { min-width: 0; line-height: 1.35; }
.r .who a, .r .who b { font-weight: 700; color: var(--ink); }
.r .who small { display: block; color: var(--muted); font-size: 12.5px; }
.r .tm { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink-2); font-size: 13.5px; }
.r .tm small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.r .acts { display: flex; gap: 6px; justify-content: flex-end; }
.r .note { grid-column: 1 / -1; margin-top: -4px; font-size: 12.5px; color: var(--ink-2); background: var(--gold-soft); padding: 4px 10px; border-radius: 8px; justify-self: start; }
.sent { color: var(--ok); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 2px; }
.sent .i { width: 14px; height: 14px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: start; font-size: 12.5px; color: var(--ink-2); font-weight: 800; padding: 10px 14px; background: var(--bg-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th a { color: inherit; }
.tbl th a.on { color: var(--green); }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .c { text-align: center; font-variant-numeric: tabular-nums; }
.tbl tbody tr:hover { background: #fffaf0; }
.rate { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.rate .bar { flex: 1; height: 7px; }
.rate b { font-size: 13px; min-width: 38px; }

/* ---------- misc ---------- */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .ic { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 12px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold-2); }
.empty .ic .i { width: 30px; height: 30px; }
.empty h3 { color: var(--ink); font-size: 17px; margin-bottom: 4px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 700; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .08em; direction: ltr; unicode-bidi: isolate; background: var(--bg-2); padding: 1px 8px; border-radius: 6px; font-size: 13px; }
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.mini-stats div { padding: 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); text-align: center; }
.mini-stats b { display: block; font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.mini-stats small { color: var(--ink-2); font-weight: 700; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .h { text-align: center; font-size: 11.5px; color: var(--muted); font-weight: 700; }
.cal .d { aspect-ratio: 1; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--bg); color: var(--muted); border: 1px solid transparent; position: relative; }
.cal .d.ok { background: var(--ok-soft); color: var(--ok); }
.cal .d.late { background: var(--late-soft); color: var(--late); }
.cal .d.bad { background: var(--bad-soft); color: var(--bad); }
.cal .d.exc { background: var(--exc-soft); color: var(--exc); }
.cal .d.today { border-color: var(--gold); }
.cal .d.early::after { content: ""; position: absolute; bottom: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--early); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.daily { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding: 10px 4px 0; }
.daily .col { flex: 1; min-width: 6px; display: flex; flex-direction: column-reverse; border-radius: 6px 6px 2px 2px; overflow: hidden; background: var(--bg-2); height: 100%; position: relative; }
.daily .col i { display: block; }
.daily .col .p { background: var(--green); }
.daily .col .l { background: #e2a03f; }
.daily-x { display: flex; gap: 4px; padding: 4px 4px 0; font-size: 10.5px; color: var(--muted); }
.daily-x span { flex: 1; text-align: center; min-width: 6px; overflow: hidden; }
.creds { background: var(--green-4); color: #f2ecdc; border-radius: 16px; padding: 18px; display: grid; gap: 8px; }
.creds b { color: var(--gold-3); }
.creds .code { background: rgba(255,255,255,.1); color: #fff; font-size: 15px; }

/* ---------- dialog ---------- */
dialog.dlg { border: 0; padding: 0; border-radius: 20px; width: min(520px, calc(100vw - 24px)); background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(6,42,33,.5); }
dialog.dlg::backdrop { background: rgba(6,42,33,.5); backdrop-filter: blur(3px); }
.dlg-h { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.dlg-h h3 { font-size: 17px; font-weight: 800; }
.dlg-b { padding: 18px 20px; }
.dlg-f { display: flex; gap: 8px; justify-content: flex-start; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--bg); border-radius: 0 0 20px 20px; flex-wrap: wrap; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; text-align: center; padding: 9px 4px; border-radius: 10px; border: 1px solid var(--line-2); font-weight: 700; font-size: 13.5px; cursor: pointer; background: #fff; }
.seg input:checked + span { background: var(--green); color: #fff; border-color: var(--green); }
.seg input:focus-visible + span { box-shadow: 0 0 0 3px rgba(183,145,90,.35); }

/* ---------- auth ---------- */
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg);
  background-image: radial-gradient(60% 50% at 50% 0%, rgba(215,175,118,.25), transparent 70%), radial-gradient(50% 40% at 50% 100%, rgba(18,85,62,.12), transparent 70%); }
.auth-card { width: min(430px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 28px; box-shadow: 0 30px 70px -30px rgba(6,42,33,.35); overflow: hidden; }
.auth-logo { padding: 18px 40px 0; background: #fbf9f3; }
.auth-logo img { width: 100%; max-width: 300px; margin: 0 auto; }
.auth-body { padding: 8px 28px 28px; }
.auth-title { text-align: center; margin-bottom: 18px; }
.auth-title h1 { font-size: 22px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 10px; }
.auth-title p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.app-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 99px; background: var(--green-4); color: var(--gold-3); font-weight: 800; font-size: 13px; }
.auth-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 18px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-dash { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { display: block; }
  .side, .top { display: none; }
  .mtop { display: flex; align-items: center; gap: 12px; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); background: var(--green-4); color: #fff; position: sticky; top: 0; z-index: 20;
    background-image: radial-gradient(100% 120% at 100% 0%, rgba(183,145,90,.2), transparent 60%); }
  .mtop .brand-mark { width: 40px; height: 40px; border-radius: 11px; padding: 3px; }
  .mtop .t { flex: 1; min-width: 0; line-height: 1.25; }
  .mtop .t b { display: block; font-size: 17px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mtop .t small { color: var(--gold-3); font-size: 11.5px; font-weight: 600; }
  .page { padding: 16px 16px 110px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset-inline: 0; bottom: 0; z-index: 30; background: rgba(255,253,248,.96); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line); padding: 6px 6px max(8px, env(safe-area-inset-bottom)); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 4px 0; }
  .tabbar a.on { color: var(--green); }
  .tabbar a.scan-fab { margin-top: -26px; }
  .tabbar a.scan-fab span.f { width: 58px; height: 58px; border-radius: 20px; background: var(--green); color: #fff; display: grid; place-items: center; box-shadow: 0 10px 24px -8px rgba(7,67,48,.7); border: 3px solid var(--gold-3); }
  .tabbar a.scan-fab .i { width: 26px; height: 26px; }
  .hero { grid-template-columns: 1fr; text-align: center; padding: 20px; gap: 14px; }
  .ring { margin: 0 auto; width: 132px; height: 132px; }
  .hero .stats { justify-content: center; }
  .hero .btns { justify-content: center; }
  .r { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 12px 16px; }
  .r .st { grid-column: 2; grid-row: 1; justify-self: end; }
  .r .tm { grid-row: 2; font-size: 12.5px; }
  .r .tm small { display: inline; margin-inline-end: 4px; }
  .r .tm.t-in { grid-column: 1; }
  .r .tm.t-out { grid-column: 1; grid-row: 3; }
  .r .acts { grid-column: 2; grid-row: 2 / span 2; align-self: center; }
  .grp-h { position: sticky; top: 64px; z-index: 5; }
  .card-h, .card-b { padding-inline: 14px; }
  .feed li { padding-inline: 14px; }
  .classes { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); padding: 12px; }
  .toolbar .select, .toolbar .input { flex: 1 1 140px; }
}
@media (max-width: 420px) {
  .kpi { padding: 14px; }
  .kpi .n { font-size: 26px; }
  .seg { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- print ---------- */
@media print {
  body { background: #fff; }
  .side, .mtop, .tabbar, .toolbar, .no-print, .acts, .flash { display: none !important; }
  .app { display: block; }
  .top { padding: 0 0 10px; }
  .page { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #ccc; }
  .grp-h { position: static; }
}

/* ---------- schedule ---------- */
.ic-ok { background: var(--ok-soft); color: var(--ok); } .ic-bad { background: var(--bad-soft); color: var(--bad); } .ic-exc { background: var(--exc-soft); color: var(--exc); }
.ic-gold { background: var(--gold-soft); color: var(--gold-2); } .ic-muted { background: var(--bg-2); color: var(--muted); } .ic-late { background: var(--late-soft); color: var(--late); }
.dot-ok { background: var(--ok); } .dot-bad { background: var(--bad); } .dot-exc { background: var(--exc); } .dot-gold { background: var(--gold); } .dot-muted { background: var(--muted); }
.mcal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.mcal .h { text-align: center; font-size: 12px; color: var(--muted); font-weight: 700; padding-bottom: 2px; }
.mcal .d { position: relative; min-height: 92px; border-radius: 12px; background: #fff; border: 1px solid var(--line); padding: 4px 5px 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mcal .d.out { background: transparent; border-color: transparent; }
.mcal .d.wkend { background: var(--bg); }
.mcal .d.today { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(183,145,90,.25); }
.mcal .n { font-size: 12.5px; font-weight: 800; color: var(--ink-2); }
.mcal .d.today .n { color: #fff; background: var(--gold); border-radius: 6px; padding: 0 6px; align-self: flex-start; }
.mcal .ev { display: block; font-size: 11.5px; font-weight: 700; line-height: 1.5; padding: 1px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-ok { background: var(--ok-soft); color: var(--ok); } .ev-bad { background: var(--bad-soft); color: var(--bad); } .ev-exc { background: var(--exc-soft); color: var(--exc); }
.ev-gold { background: var(--gold-soft); color: var(--gold-2); } .ev-muted { background: var(--bg-2); color: var(--ink-2); }
.mcal .more { font-size: 11px; color: var(--muted); font-weight: 700; }
.mcal .add { position: absolute; inset-inline-end: 4px; bottom: 4px; width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; color: var(--muted); opacity: 0; transition: opacity .15s; }
.mcal .add .i { width: 15px; height: 15px; }
.mcal .d:hover .add { opacity: 1; background: var(--gold-soft); color: var(--gold-2); }
.agenda { padding: 6px 0; }
.ag-day { display: flex; gap: 12px; padding: 10px 16px; }
.ag-day + .ag-day { border-top: 1px dashed var(--line); }
.ag-date { width: 56px; flex: none; text-align: center; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); padding: 6px 0; line-height: 1.15; align-self: flex-start; }
.ag-date b { display: block; font-size: 22px; font-weight: 800; color: var(--green-3); }
.ag-date small { display: block; font-size: 11px; color: var(--muted); font-weight: 700; }
.ag-date.is-today { background: var(--green); border-color: var(--green); }
.ag-date.is-today b, .ag-date.is-today small { color: #fff; }
.ag-items { flex: 1; min-width: 0; display: grid; gap: 6px; }
.ag-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; color: inherit; border: 1px solid transparent; transition: background .15s, border-color .15s; }
.ag-item:hover { background: #fffaf0; border-color: var(--line); }
.ag-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; font-style: normal; }
.ag-ic .i { width: 19px; height: 19px; }
.ag-t { flex: 1; min-width: 0; line-height: 1.35; }
.ag-t b { display: block; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-t small { color: var(--muted); font-size: 12.5px; }
.ag-flag { color: var(--gold-2); display: grid; }
.ag-flag .i { width: 17px; height: 17px; }
.kinds { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.kinds label { position: relative; }
.kinds input { position: absolute; opacity: 0; }
.kinds span { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; font-weight: 800; font-size: 14px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.kinds input:checked + span { border-color: var(--green); box-shadow: 0 0 0 4px rgba(18,85,62,.12); }
.kinds input:focus-visible + span { box-shadow: 0 0 0 4px rgba(183,145,90,.35); }
.pick-chip { position: relative; }
.pick-chip input { position: absolute; opacity: 0; }
.pick-chip span { display: inline-block; padding: 7px 14px; border-radius: 999px; border: 1.5px solid var(--line-2); background: #fff; font-weight: 700; font-size: 14px; cursor: pointer; }
.pick-chip.sm span { padding: 3px 10px; font-size: 13px; }
.pick-chip input:checked + span { background: var(--green); border-color: var(--green); color: #fff; }
.exam-rows td { padding: 6px; min-width: 110px; }
.exam-rows td:first-child { min-width: 150px; }
.exam-rows td:last-child { min-width: 0; }
.exam-rows .input, .exam-rows .select { min-height: 40px; }
.sc-events { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.up-list { list-style: none; margin: 0; padding: 4px 0; }
@media (max-width: 900px) {
  .mcal { gap: 3px; }
  .mcal .d { min-height: 54px; padding: 3px; border-radius: 9px; }
  .mcal .ev { font-size: 0; height: 6px; padding: 0; border-radius: 3px; }
  .mcal .h { font-size: 10px; }
  .kinds { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ag-day { padding-inline: 12px; }
}

/* ---------- dashboard: welcome + gradient tiles (e-class style, school palette) ---------- */
.welcome { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: center; padding: 24px; border-radius: 24px; position: relative; overflow: hidden;
  background: radial-gradient(70% 90% at 100% 0%, rgba(215,175,118,.22), transparent 60%), linear-gradient(135deg, #fffdf8, #f6f0e2); border: 1px solid var(--line); box-shadow: var(--shadow); }
.wl-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 99px; background: var(--green-soft); color: var(--green-3); font-weight: 800; font-size: 12.5px; }
.wl-badge .i { width: 16px; height: 16px; }
.welcome h2 { font-size: 28px; font-weight: 800; color: var(--green-4); margin: 10px 0 4px; }
.welcome p { margin: 0 0 14px; color: var(--ink-2); }
.wl-dates { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.wl-dates span { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 12px; background: #fff; border: 1px solid var(--line); font-weight: 700; font-size: 13.5px; }
.wl-dates .i { width: 17px; height: 17px; color: var(--gold-2); }
.wl-quote { padding: 10px 16px; border-radius: 12px; background: linear-gradient(90deg, rgba(18,85,62,.08), transparent); border-inline-start: 4px solid var(--green); font-weight: 800; color: var(--green-3); }
.wl-card { border-radius: 22px; padding: 20px; color: #fff; text-align: center; display: grid; gap: 12px; justify-items: center;
  background: radial-gradient(100% 70% at 0% 0%, rgba(26,120,85,.9), transparent 60%), radial-gradient(70% 70% at 100% 100%, rgba(183,145,90,.35), transparent 70%), #062a21; box-shadow: 0 24px 44px -24px rgba(6,42,33,.8); }
.wl-card .ring { width: 140px; height: 140px; }
.wl-card-n { color: #c7d4cc; font-weight: 600; }
.wl-card-n b { color: #fff; font-size: 18px; }
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.tile { position: relative; overflow: hidden; display: flex; flex-direction: column; padding: 16px 18px 14px; min-height: 150px; border-radius: 20px; color: #fff; box-shadow: 0 16px 30px -18px rgba(0,0,0,.45); transition: transform .15s, box-shadow .15s; }
.tile:hover { transform: translateY(-3px); box-shadow: 0 22px 36px -18px rgba(0,0,0,.5); }
.tile::before, .tile::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.12); pointer-events: none; }
.tile::before { width: 130px; height: 130px; inset-inline-start: -40px; top: -50px; }
.tile::after { width: 80px; height: 80px; inset-inline-end: -20px; bottom: -30px; background: rgba(255,255,255,.08); }
.tl-ic { width: 44px; height: 44px; border-radius: 14px; background: rgba(255,255,255,.22); display: grid; place-items: center; align-self: flex-start; }
.tl-ic .i { width: 22px; height: 22px; }
.tile b { font-size: 38px; font-weight: 800; line-height: 1.1; margin-top: auto; }
.tl-l { font-weight: 800; font-size: 15px; }
.tl-go { position: absolute; inset-inline-end: 14px; bottom: 14px; width: 30px; height: 30px; border-radius: 10px; background: rgba(255,255,255,.22); display: grid; place-items: center; }
.tl-go .i { width: 17px; height: 17px; }
.t-green { background: linear-gradient(135deg, #1f9a68, #0b4a35); }
.t-amber { background: linear-gradient(135deg, #f0b44c, #c47a12); }
.t-red { background: linear-gradient(135deg, #ec7a6b, #b23a2e); }
.t-slate { background: linear-gradient(135deg, #95a39b, #5c6d64); }
.t-purple { background: linear-gradient(135deg, #a681cf, #6a3f96); }
.t-blue { background: linear-gradient(135deg, #5aa1d6, #2f6690); }
.feed .ic.ic-ok, .feed .ic.ic-bad, .feed .ic.ic-exc, .feed .ic.ic-gold, .feed .ic.ic-muted { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
@media (max-width: 1200px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .welcome { grid-template-columns: 1fr; padding: 18px; }
  .welcome h2 { font-size: 22px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { min-height: 124px; padding: 14px; }
  .tile b { font-size: 30px; }
  .t-blue { grid-column: span 2; min-height: 96px; }
}

/* ---------- users & permissions ---------- */
.ucards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.ucard { display: grid; gap: 10px; padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: inherit; transition: border-color .15s, transform .15s; }
.ucard:hover { border-color: var(--gold-3); transform: translateY(-2px); }
.ucard.off { opacity: .6; }
.uc-h { display: flex; align-items: center; gap: 12px; }
.uc-who { flex: 1; min-width: 0; line-height: 1.3; }
.uc-who b { display: block; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uc-who small { color: var(--muted); font-size: 12.5px; }
.uc-edit { color: var(--muted); }
.uc-edit .i { width: 18px; height: 18px; }
.avatar.av-gold { background: var(--green); color: var(--gold-3); }
.uc-perms { display: flex; flex-wrap: wrap; gap: 4px; }
.uc-perms span { font-size: 11.5px; font-weight: 700; color: var(--ink-2); background: var(--bg); border: 1px solid var(--line); padding: 1px 8px; border-radius: 7px; }
.roles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.role-opt { position: relative; }
.role-opt input { position: absolute; opacity: 0; }
.role-opt span { display: grid; gap: 2px; height: 100%; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.role-opt b { font-size: 14.5px; font-weight: 800; }
.role-opt small { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.role-opt input:checked + span { border-color: var(--green); box-shadow: 0 0 0 4px rgba(18,85,62,.12); background: #fbfdfb; }
.role-opt input:disabled + span { opacity: .45; cursor: not-allowed; }
.role-opt input:focus-visible + span { box-shadow: 0 0 0 4px rgba(183,145,90,.35); }
.perm-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.perm-group { margin: 0; padding: 10px 12px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); display: grid; gap: 6px; }
.perm-group legend { font-weight: 800; font-size: 13.5px; color: var(--green-3); padding: 0 6px; }
.perm { display: flex; gap: 10px; align-items: flex-start; padding: 6px 4px; border-radius: 10px; cursor: pointer; }
.perm:hover { background: #fff; }
.perm input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--green); flex: none; }
.perm span { display: grid; line-height: 1.4; }
.perm b { font-size: 14px; }
.perm small { color: var(--muted); font-size: 12px; }
.summary-box { padding: 14px 18px; border-radius: 14px; background: var(--green-soft); border: 1px solid #c4dccd; color: var(--green-4); line-height: 1.9; }
a.tile:not([href]), a.cls:not([href]) { cursor: default; }
a.tile:not([href]):hover { transform: none; }
