/* =========================================================
   School Management System — UI
   Light & dark themes via [data-theme] on <html>
   ========================================================= */
:root {
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --bg: #f4f6f5;
  --bg-2: #eaefed;
  --surface: #ffffff;
  --surface-2: #f8faf9;
  --border: #e1e7e4;
  --border-strong: #cdd6d2;
  --text: #13201c;
  --text-2: #4a5a55;
  --muted: #7b8a85;
  --accent: #0f766e;
  --accent-2: #115e59;
  --accent-soft: #e2f3f0;
  --accent-ink: #ffffff;
  --gold: #b7791f;
  --green: #15803d; --green-soft: #e3f5e8;
  --red: #c2410c;   --red-soft: #fdebe2;
  --amber: #a16207; --amber-soft: #fbf1d6;
  --blue: #1d4ed8;  --blue-soft: #e5ecfd;
  --violet: #6d28d9;--violet-soft: #efe8fd;
  --gray-soft: #edf0ef;
  --shadow: 0 1px 2px rgba(16,32,28,.05), 0 4px 16px rgba(16,32,28,.05);
  --shadow-lg: 0 10px 40px rgba(16,32,28,.14);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar: 264px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0b1211;
  --bg-2: #101a18;
  --surface: #131d1b;
  --surface-2: #17231f;
  --border: #22312d;
  --border-strong: #2f413c;
  --text: #e6eeeb;
  --text-2: #a9b8b3;
  --muted: #74857f;
  --accent: #2dd4bf;
  --accent-2: #5eead4;
  --accent-soft: #123a35;
  --accent-ink: #062521;
  --gold: #f0b54a;
  --green: #4ade80; --green-soft: #12301d;
  --red: #fb8a5c;   --red-soft: #3a1d12;
  --amber: #fbbf24; --amber-soft: #352a0d;
  --blue: #7aa2ff;  --blue-soft: #18233f;
  --violet: #b69bff;--violet-soft: #251b40;
  --gray-soft: #1c2826;
  --shadow: 0 1px 2px rgba(0,0,0,.3);
  --shadow-lg: 0 14px 44px rgba(0,0,0,.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14.5px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
small, .muted { color: var(--muted); }
code { background: var(--gray-soft); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.ico { flex: none; vertical-align: middle; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar); flex: none; background: var(--surface); border-right: 1px solid var(--border); position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40; transition: transform .25s ease; }
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; }
.brand-logo { width: 40px; height: 40px; object-fit: contain; border-radius: 10px; background: var(--surface-2); }
.brand-text { min-width: 0; flex: 1; }
.brand-text strong { display: block; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { font-size: 11.5px; color: var(--muted); }
.nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; scrollbar-width: thin; }
.nav-group { font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); padding: 16px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8.5px 10px; border-radius: 10px; color: var(--text-2); font-weight: 500; font-size: 14px; margin: 1px 0; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.sidebar-foot { border-top: 1px solid var(--border); padding: 12px; }
.me { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 10px; color: var(--text); }
.me:hover { background: var(--surface-2); text-decoration: none; }
.me strong { display: block; font-size: 13px; } .me span { font-size: 11.5px; color: var(--muted); }
.main { flex: 1; margin-left: var(--sidebar); min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--border); }
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 1.25rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title p { margin: 0; color: var(--muted); font-size: 12.5px; }
.content { padding: 22px 28px 40px; flex: 1; width: 100%; max-width: 1480px; }
.app-foot { padding: 14px 28px 24px; color: var(--muted); font-size: 12px; }
.scrim { display: none; }
.only-mobile { display: none !important; }
.bottom-nav { display: none; }

.global-search { position: relative; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 14px; width: 300px; color: var(--muted); }
.global-search input { border: 0; background: transparent; outline: none; color: var(--text); padding: 9px 0; width: 100%; font: inherit; }
.global-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-pop { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); overflow: hidden; z-index: 50; min-width: 280px; }
.search-pop a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; color: var(--text); }
.search-pop a:hover, .search-pop a.hl { background: var(--surface-2); text-decoration: none; }
.search-pop small { display: block; }

.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; padding: 0; }
.icon-btn:hover { background: var(--surface); border-color: var(--border); color: var(--text); }
#themeToggle .i-moon { display: none; }
[data-theme="dark"] #themeToggle .i-moon { display: inline; }
[data-theme="dark"] #themeToggle .i-sun { display: none; }

.dropdown { position: relative; }
.dropdown .menu { display: none; position: absolute; right: 0; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 210px; padding: 6px; z-index: 60; }
.dropdown.open .menu { display: block; }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--surface-2); text-decoration: none; }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-head strong { display: block; } .menu-head span { font-size: 12px; color: var(--muted); }

/* ---------- avatar ---------- */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; object-fit: cover; flex: none; font-weight: 700; color: hsl(var(--h,170) 45% 30%); background: hsl(var(--h,170) 55% 90%); letter-spacing: .02em; }
[data-theme="dark"] .avatar:not(img) { color: hsl(var(--h,170) 60% 80%); background: hsl(var(--h,170) 30% 22%); }
.avatar.sq { border-radius: 16px; }

/* ---------- layout primitives ---------- */
.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)); }
.g-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 16px; }
.spacer { flex: 1; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; } .mt0 { margin-top: 0; }
.right { text-align: right; } .center { text-align: center; }
.nowrap { white-space: nowrap; }
.w100 { width: 100%; }
.hidden { display: none !important; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-h h2, .card-h h3 { margin: 0; font-size: 15px; flex: 1; display: flex; align-items: center; gap: 8px; }
.card-b { padding: 18px; }
.card-b.tight { padding: 0; }
.card-f { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.page-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }

/* ---------- stats ---------- */
.stat { padding: 16px 18px; display: flex; gap: 14px; align-items: center; }
.stat .s-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.stat .s-ico.green { background: var(--green-soft); color: var(--green); }
.stat .s-ico.amber { background: var(--amber-soft); color: var(--amber); }
.stat .s-ico.violet { background: var(--violet-soft); color: var(--violet); }
.stat .s-ico.blue { background: var(--blue-soft); color: var(--blue); }
.stat .s-ico.red { background: var(--red-soft); color: var(--red); }
.stat .s-val { font-size: 1.55rem; font-weight: 750; line-height: 1.1; letter-spacing: -.02em; }
.stat .s-lbl { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat a { color: inherit; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; line-height: 1.2; transition: filter .15s, transform .05s; }
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.soft { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger.ghost { background: var(--surface); color: var(--red); border-color: var(--border-strong); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.xs { padding: 3px 8px; font-size: 12px; border-radius: 7px; gap: 5px; }
.btn.icon { padding: 7px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px 16px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.form-grid.one { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.span2 { grid-column: span 2; } .field.span3, .field.full { grid-column: 1 / -1; }
label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
label .req { color: var(--red); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=search], input[type=tel], input[type=url], input[type=month], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; padding: 9px 12px; outline: none; transition: border-color .15s, box-shadow .15s; min-height: 40px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=file] { font: inherit; color: var(--text-2); max-width: 100%; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 17px; height: 17px; vertical-align: middle; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text); font-size: 14px; cursor: pointer; }
.hint { font-size: 12px; color: var(--muted); }
.fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 16px; background: var(--surface); }
.fieldset > legend, .section-title { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); padding: 0 6px; }
.section-title { padding: 0; margin: 4px 0 12px; display: flex; align-items: center; gap: 8px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { min-width: 150px; flex: 1; max-width: 240px; }
.filters .field.grow { max-width: none; flex: 2; }
.inline-input { min-height: 34px !important; padding: 5px 9px !important; border-radius: 8px !important; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th { text-align: left; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
.t td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover td { background: var(--surface-2); }
.t .num { text-align: right; font-variant-numeric: tabular-nums; }
.t td.actions { white-space: nowrap; text-align: right; }
.t td.actions .btn + .btn, .t td.actions form { margin-left: 4px; display: inline-block; }
.t.compact td { padding: 7px 12px; }
.t tfoot td { font-weight: 700; background: var(--surface-2); }
.person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.person strong { display: block; font-weight: 600; color: var(--text); }
.person small { display: block; }
.person a { color: inherit; }

/* ---------- badges, chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 650; padding: 3px 9px; border-radius: 999px; white-space: nowrap; background: var(--gray-soft); color: var(--text-2); }
.b-green { background: var(--green-soft); color: var(--green); }
.b-red { background: var(--red-soft); color: var(--red); }
.b-amber { background: var(--amber-soft); color: var(--amber); }
.b-blue { background: var(--blue-soft); color: var(--blue); }
.b-violet { background: var(--violet-soft); color: var(--violet); }
.b-accent { background: var(--accent-soft); color: var(--accent); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; color: var(--text-2); }
.chip.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 600; }
a.chip:hover { text-decoration: none; border-color: var(--border-strong); }

/* ---------- alerts ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; border: 1px solid transparent; font-weight: 500; }
.alert-success { background: var(--green-soft); color: var(--green); }
.alert-error { background: var(--red-soft); color: var(--red); }
.alert-warning { background: var(--amber-soft); color: var(--amber); }
.alert-info { background: var(--blue-soft); color: var(--blue); }
.alert ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 18px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button { padding: 10px 14px; color: var(--text-2); font-weight: 600; font-size: 14px; border: 0; border-bottom: 2px solid transparent; background: none; cursor: pointer; white-space: nowrap; display: inline-flex; gap: 7px; align-items: center; margin-bottom: -1px; font-family: inherit; }
.tabs a:hover, .tabs button:hover { color: var(--text); text-decoration: none; }
.tabs .on { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; } .tab-panel.on { display: block; }
.count { background: var(--gray-soft); color: var(--muted); font-size: 11px; padding: 1px 7px; border-radius: 999px; font-weight: 700; }

/* ---------- profile ---------- */
.profile-hero { display: flex; gap: 20px; align-items: center; padding: 22px; position: relative; overflow: hidden; }
.profile-hero::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 76px; background: linear-gradient(120deg, var(--accent-soft), transparent 70%); }
.profile-hero > * { position: relative; }
.profile-hero .avatar { border: 4px solid var(--surface); box-shadow: var(--shadow); }
.profile-hero h2 { font-size: 1.45rem; margin: 0 0 4px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--text-2); font-size: 13.5px; }
.meta span { display: inline-flex; gap: 6px; align-items: center; }
dl.kv { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 0; margin: 0; }
dl.kv dt, dl.kv dd { padding: 9px 0; border-bottom: 1px dashed var(--border); margin: 0; }
dl.kv dt { color: var(--muted); font-size: 13px; font-weight: 500; }
dl.kv dd { font-weight: 550; word-break: break-word; }
dl.kv dt:last-of-type, dl.kv dd:last-of-type { border-bottom: 0; }

/* ---------- lists / feed ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list strong { display: block; font-weight: 600; }
.date-tile { width: 46px; flex: none; text-align: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent); padding: 5px 0; line-height: 1.1; }
.date-tile b { display: block; font-size: 17px; } .date-tile span { font-size: 10.5px; text-transform: uppercase; font-weight: 700; }
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding: 0 0 18px; }
.tl-item::before { content: ""; position: absolute; left: -20px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); }
.tl-item.gold::before { border-color: var(--gold); }

/* ---------- bars & charts ---------- */
.bar { height: 8px; background: var(--gray-soft); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 160px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bars .b i { width: 100%; max-width: 34px; background: var(--accent); border-radius: 6px 6px 2px 2px; min-height: 2px; opacity: .9; }
.bars .b span { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bars .b em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--text-2); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.ring { --p: 0; --c: var(--accent); width: 86px; height: 86px; border-radius: 50%; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--gray-soft) 0); display: grid; place-items: center; flex: none; }
.ring::after { content: attr(data-label); width: 66px; height: 66px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 750; font-size: 16px; }

/* ---------- attendance toggles ---------- */
.att-opts { display: inline-flex; gap: 4px; background: var(--surface-2); padding: 3px; border-radius: 10px; border: 1px solid var(--border); }
.att-opts label { cursor: pointer; }
.att-opts input { position: absolute; opacity: 0; pointer-events: none; }
.att-opts span { display: inline-grid; place-items: center; min-width: 34px; height: 30px; padding: 0 8px; border-radius: 7px; font-weight: 700; font-size: 12.5px; color: var(--muted); }
.att-opts input:checked + span.p { background: var(--green); color: #fff; }
.att-opts input:checked + span.a { background: var(--red); color: #fff; }
.att-opts input:checked + span.l { background: var(--amber); color: #fff; }
.att-opts input:checked + span.e { background: var(--blue); color: #fff; }
[data-theme="dark"] .att-opts input:checked + span { color: #0b1211; }
.reg td, .reg th { text-align: center; padding: 6px 4px !important; font-size: 12px; min-width: 26px; }
.reg td:first-child, .reg th:first-child { text-align: left; min-width: 170px; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.cell-P { color: var(--green); font-weight: 700; } .cell-A { color: var(--red); font-weight: 700; } .cell-L { color: var(--amber); font-weight: 700; } .cell-E { color: var(--blue); font-weight: 700; }

/* ---------- timetable ---------- */
.tt { border-collapse: separate; border-spacing: 6px; width: 100%; min-width: 760px; }
.tt th { font-size: 12px; color: var(--muted); font-weight: 700; padding: 6px; text-align: center; }
.tt th small { display: block; font-weight: 500; }
.tt td { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px; vertical-align: top; height: 62px; font-size: 13px; }
.tt td.brk { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 6px, var(--bg-2) 6px, var(--bg-2) 12px); text-align: center; color: var(--muted); vertical-align: middle; }
.tt td strong { display: block; font-weight: 650; }
.tt td small { display: block; }
.tt td.filled { background: var(--accent-soft); border-color: transparent; }

/* ---------- calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 6px; }
.cal .dow { font-size: 11.5px; font-weight: 700; color: var(--muted); text-align: center; padding: 4px; text-transform: uppercase; }
.cal .day { min-height: 96px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 6px; font-size: 12px; overflow: hidden; }
.cal .day.out { opacity: .45; }
.cal .day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal .day .n { font-weight: 700; font-size: 12.5px; margin-bottom: 4px; display: block; }
.cal .ev { display: block; padding: 2px 6px; border-radius: 5px; margin-bottom: 3px; background: var(--accent-soft); color: var(--accent); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; }
.cal .ev.Holiday { background: var(--red-soft); color: var(--red); }
.cal .ev.Exam { background: var(--violet-soft); color: var(--violet); }
.cal .ev.Sports, .cal .ev.Activity { background: var(--green-soft); color: var(--green); }
.cal .ev.Meeting { background: var(--amber-soft); color: var(--amber); }

/* ---------- misc ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty h2 { color: var(--text); }
.empty-ico { width: 68px; height: 68px; border-radius: 20px; display: grid; place-items: center; margin: 0 auto 14px; background: var(--accent-soft); color: var(--accent); }
.pager { display: flex; gap: 4px; flex-wrap: wrap; padding: 14px 18px; justify-content: center; }
.pager a, .pager span { min-width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 9px; border: 1px solid var(--border); color: var(--text-2); font-weight: 600; font-size: 13px; padding: 0 8px; }
.pager a.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pager span { border: 0; }
.notice { padding: 14px 18px; border-bottom: 1px solid var(--border); }
.notice:last-child { border-bottom: 0; }
.notice.high { border-left: 3px solid var(--red); }
.notice .body { color: var(--text-2); white-space: pre-line; margin-top: 4px; }
.kpi-mini { display: flex; gap: 18px; flex-wrap: wrap; }
.kpi-mini div { min-width: 90px; }
.kpi-mini b { display: block; font-size: 1.3rem; letter-spacing: -.02em; }
.kpi-mini span { font-size: 12px; color: var(--muted); }
.house-card { padding: 18px; border-radius: var(--radius); color: #fff; position: relative; overflow: hidden; min-height: 130px; }
.house-card h3 { font-size: 1.05rem; margin: 0 0 2px; }
.house-card .pts { font-size: 2.2rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; margin-top: 12px; }
.house-card .rank { position: absolute; right: 14px; top: 10px; font-size: 3.4rem; font-weight: 800; opacity: .22; line-height: 1; }
.house-card small { color: rgba(255,255,255,.85); }
.cat-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.toolbar-sticky { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); padding: 12px 18px; display: flex; gap: 10px; justify-content: flex-end; border-radius: 0 0 var(--radius) var(--radius); z-index: 5; flex-wrap: wrap; align-items: center; }
.photo-pick { display: flex; gap: 16px; align-items: center; }
.photo-pick img, .photo-pick .avatar { width: 92px; height: 92px; border-radius: 18px; object-fit: cover; }

/* ---------- auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { background: radial-gradient(1200px 600px at -10% -10%, #14b8a6 0%, transparent 55%), radial-gradient(900px 600px at 110% 110%, #0e7490 0%, transparent 55%), #0b3b37; color: #e9fbf7; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::after { content: ""; position: absolute; inset: auto -120px -160px auto; width: 460px; height: 460px; border-radius: 50%; border: 60px solid rgba(255,255,255,.05); }
.auth-art h1 { font-size: 2.4rem; letter-spacing: -.03em; max-width: 14ch; }
.auth-art p { color: #b8e9df; max-width: 42ch; }
.auth-art ul { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 10px; color: #d6f5ee; }
.auth-art li { display: flex; gap: 10px; align-items: center; }
.auth-form { display: grid; place-items: center; padding: 32px 20px; background: var(--bg); }
.auth-box { width: 100%; max-width: 400px; }
.auth-box .logo { width: 64px; height: 64px; object-fit: contain; margin-bottom: 14px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .global-search { width: 220px; }
}
@media (max-width: 960px) {
  .g-side, .g3 { grid-template-columns: 1fr; }
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); width: min(300px, 86vw); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
  .main { margin-left: 0; }
  .only-mobile { display: inline-grid !important; }
  .topbar { padding: 10px 14px; }
  .content { padding: 16px 14px 96px; }
  .app-foot { display: none; }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--border); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); padding: 6px 0; border-radius: 10px; }
  .bottom-nav a.active { color: var(--accent); }
  .bottom-nav a:hover { text-decoration: none; }
  .global-search { display: none; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 14px; }
  .g2, .g4, .form-grid, .form-grid.two { grid-template-columns: 1fr; }
  .field.span2, .field.span3 { grid-column: auto; }
  .grid.g4.stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
  .stat { padding: 12px; gap: 10px; flex-direction: column; align-items: flex-start; }
  .stat .s-ico { width: 36px; height: 36px; }
  .stat .s-val { font-size: 1.3rem; }
  .profile-hero { flex-direction: column; text-align: center; align-items: center; }
  .profile-hero .meta { justify-content: center; }
  .profile-hero .row { justify-content: center; }
  .filters .field { max-width: none; min-width: 46%; }
  .card-h { padding: 12px 14px; } .card-b { padding: 14px; }
  .page-actions .btn { flex: 1; }
  /* tables become cards */
  table.t.responsive thead { display: none; }
  table.t.responsive, table.t.responsive tbody, table.t.responsive tr, table.t.responsive td { display: block; width: 100%; }
  table.t.responsive tr { border-bottom: 1px solid var(--border); padding: 8px 4px; }
  table.t.responsive td { border: 0; padding: 4px 12px; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.t.responsive td::before { content: attr(data-label); font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; text-align: left; flex: none; }
  table.t.responsive td.primary { text-align: left; }
  table.t.responsive td.primary::before { display: none; }
  table.t.responsive td.actions { justify-content: flex-end; }
  table.t.responsive td.actions::before { display: none; }
  .cal { gap: 3px; }
  .cal .day { min-height: 62px; padding: 4px; }
  .cal .ev { font-size: 10px; padding: 1px 4px; }
  .cal .dow { font-size: 10px; }
  dl.kv { grid-template-columns: 1fr; }
  dl.kv dt { border-bottom: 0; padding-bottom: 0; }
}

/* ---------- print ---------- */
@media print {
  .sidebar, .topbar, .bottom-nav, .page-actions, .no-print, .app-foot, .scrim, .alert { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0 !important; max-width: none; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #ccc; }
}
@media print {
  .tab-panel { display: block !important; margin-bottom: 18px; page-break-inside: avoid; }
  .tabs { display: none !important; }
  .grid.g-side, .grid.g2, .grid.g3 { grid-template-columns: 1fr 1fr; }
}
.global-search input[type=search] { border: 0; box-shadow: none; background: transparent; min-height: 0; padding: 9px 0; border-radius: 0; }
.global-search input[type=search]:focus { box-shadow: none; }
.topbar { background: var(--bg); }
@supports (background: color-mix(in srgb, red 50%, transparent)) { .topbar { background: color-mix(in srgb, var(--bg) 82%, transparent); } }
