/* ==========================================================================
   School Portal Template — stylesheet (pure CSS, no JavaScript needed)
   Sections: tokens · base · components · app shell · pages · admin ·
             website · login · responsive
   Interactive parts work with CSS only:
     - mobile menus  → hidden checkbox + <label>
     - tabs          → hidden radio buttons + <label>
     - popups/modals → #anchor links + :target (close link: href="#close")
     - notifications → <details>/<summary>
     - dark mode     → follows the device setting (prefers-color-scheme)
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f1f4f9;
  --surface-3: #e6ebf3;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #64748b;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --primary-text: #4338ca;

  --success: #15803d;  --success-soft: #dcfce7;
  --warning: #b45309;  --warning-soft: #fef3c7;
  --danger: #dc2626;   --danger-soft: #fee2e2;  --danger-solid: #dc2626;
  --info: #0369a1;     --info-soft: #e0f2fe;

  --radius-lg: 18px;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 6px 20px rgba(15, 23, 42, .08);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, .18);
  --ring: 0 0 0 3px rgba(79, 70, 229, .22);

  --sidebar-w: 264px;
  --topbar-h: 68px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #111827;
    --surface-2: #182132;
    --surface-3: #222d41;
    --border: #253046;
    --text: #e6eaf2;
    --text-2: #b3bdcd;
    --muted: #8692a7;

    --primary: #6366f1;
    --primary-hover: #7c7ff5;
    --primary-soft: rgba(99, 102, 241, .16);
    --primary-text: #a5a8ff;

    --success: #4ade80;  --success-soft: rgba(74, 222, 128, .13);
    --warning: #fbbf24;  --warning-soft: rgba(251, 191, 36, .13);
    --danger: #f87171;   --danger-soft: rgba(248, 113, 113, .13);
    --info: #38bdf8;     --info-soft: rgba(56, 189, 248, .13);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 6px 20px rgba(0, 0, 0, .35);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
    --ring: 0 0 0 3px rgba(99, 102, 241, .35);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img, svg, video, iframe, object { display: block; max-width: 100%; }
a { color: var(--primary-text); text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
p { margin: 0 0 1em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
::selection { background: var(--primary); color: #fff; }

/* Icons: <svg class="icon"><use href="#i-home"/></svg> (symbols are at the top of each page) */
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hidden, [hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt { margin-top: 24px; }
.mb { margin-bottom: 24px; }
.ml-auto { margin-left: auto; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; color: var(--primary-text); }
.link .icon { width: 16px; height: 16px; transition: transform .15s; }
.link:hover .icon { transform: translateX(3px); }
.inline-form { display: inline; margin: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px;
  border: 1px solid transparent; border-radius: 10px;
  font-weight: 600; font-size: 14px; line-height: 1;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px -6px rgba(79, 70, 229, .6); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-soft { background: var(--primary-soft); color: var(--primary-text); }
.btn-soft:hover { background: var(--primary); color: #fff; }
.btn-danger { background: var(--danger-solid); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-light { background: #fff; color: #3730a3; }
.btn-light:hover { background: #eef2ff; }
.btn-glass { background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .3); }
.btn-glass:hover { background: rgba(255, 255, 255, .26); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-sm .icon { width: 16px; height: 16px; }
.btn-lg { height: 50px; padding: 0 24px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

.icon-btn {
  position: relative;
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; padding: 0;
  border: 1px solid transparent; border-radius: 10px;
  background: transparent; color: var(--text-2);
  cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 8px; }
.icon-btn.sm .icon { width: 17px; height: 17px; }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.icon-btn.success:hover { background: var(--success-soft); color: var(--success); }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.form-label .opt { font-weight: 400; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; height: 44px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .8; }
.textarea { height: auto; min-height: 104px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 18px;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.input[readonly] { background: var(--surface-2); color: var(--muted); }
.input-group { position: relative; }
.input-group > .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.input-group > .input { padding-left: 42px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.form-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); cursor: pointer; user-select: none; }
.checkbox input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); cursor: pointer; }

.file-input {
  width: 100%; padding: 14px; cursor: pointer;
  border: 2px dashed var(--border); border-radius: 12px;
  background: var(--surface-2); color: var(--text-2); font-size: 14px;
}
.file-input:hover { border-color: var(--primary); }
.file-input::file-selector-button {
  margin-right: 12px; padding: 8px 14px; cursor: pointer;
  border: 0; border-radius: 8px; background: var(--primary); color: #fff; font-weight: 600;
}

.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; }
.alert .icon { width: 18px; height: 18px; margin-top: 1px; }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert-success { background: var(--success-soft); color: var(--success); }

.check-list { max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 6px; }
.check-list .checkbox { display: flex; width: 100%; padding: 8px 10px; border-radius: 8px; }
.check-list .checkbox:hover { background: var(--surface-2); }
.check-list .checkbox small { margin-left: auto; color: var(--muted); font-size: 12px; }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { position: relative; }
.swatch input { position: absolute; opacity: 0; }
.swatch span { display: block; width: 32px; height: 32px; border-radius: 50%; background: var(--c); cursor: pointer; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border); }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--text); }
.swatch input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); min-width: 0; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-header h2, .card-header h3 { font-size: 16px; margin: 0; }
.card-body { padding: 20px; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.section-head h2 { font-size: 18px; margin: 0; }
.section-head p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

/* ---------- Badges & avatars ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-primary { background: var(--primary-soft); color: var(--primary-text); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft); color: var(--danger); }
.badge-glass   { background: rgba(255, 255, 255, .2); color: #fff; }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--surface-3); color: var(--text-2); }

.avatar {
  --size: 38px;
  width: var(--size); height: var(--size); flex: none;
  display: inline-grid; place-items: center;
  border-radius: 50%; background: var(--av, #4f46e5); color: #fff;
  font-weight: 700; font-size: calc(var(--size) * .38); letter-spacing: .02em;
  user-select: none;
}
.avatar.sm { --size: 30px; }
.avatar.xl { --size: 88px; }
.class-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }

/* ---------- Grids & layouts ---------- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.layout-main-side { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.layout-side-main { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; align-items: start; }
.stack { display: grid; gap: 20px; }

/* ---------- Stat tiles & bars ---------- */
.stat-card { display: flex; align-items: center; gap: 16px; padding: 18px 20px; }
.stat-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; flex: none; background: var(--primary-soft); color: var(--primary-text); }
.stat-icon.green  { background: var(--success-soft); color: var(--success); }
.stat-icon.amber  { background: var(--warning-soft); color: var(--warning); }
.stat-icon.sky    { background: var(--info-soft); color: var(--info); }
.stat-icon.rose   { background: var(--danger-soft); color: var(--danger); }
.stat-value { font-size: 26px; font-weight: 800; line-height: 1.1; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 13px; color: var(--muted); }

.bar-list { display: grid; gap: 14px; }
.bar-row { display: grid; grid-template-columns: 84px minmax(0, 1fr) 44px; align-items: center; gap: 12px; font-size: 13px; }
.bar-label { color: var(--text-2); font-weight: 500; }
.bar-track { height: 10px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 0 4px 4px 0; background: var(--primary); }
.bar-value { text-align: right; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--border); color: var(--text); transition: background .15s; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: var(--surface-2); }
.list-item.active { background: var(--primary-soft); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item h4 { font-size: 14px; font-weight: 600; margin: 0 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item h4 a { color: inherit; }
.list-item p { margin: 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-icon { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--danger-soft); color: var(--danger); font-size: 11px; font-weight: 800; letter-spacing: .03em; }
.file-icon.is-image { background: var(--info-soft); color: var(--info); }

.announce { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.announce:last-child { border-bottom: 0; }
.announce-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.announce h4 { font-size: 14px; margin: 0 0 4px; }
.announce p { font-size: 13.5px; color: var(--text-2); margin: 0; }

.people-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.people-row:last-child { border-bottom: 0; }
.people-row .grow { flex: 1; min-width: 0; }
.people-row strong { display: block; font-size: 14px; }
.people-row .grow > span { font-size: 12.5px; color: var(--muted); }

.schedule-item { display: flex; align-items: center; gap: 14px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.schedule-item:last-child { border-bottom: 0; }
.schedule-time { width: 46px; flex: none; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.schedule-bar { width: 4px; align-self: stretch; border-radius: 2px; background: var(--c); flex: none; }
.schedule-item strong { display: block; font-size: 14px; }
.schedule-item span { font-size: 12.5px; color: var(--muted); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; white-space: nowrap;
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); background: var(--surface-2);
  padding: 11px 20px; border-bottom: 1px solid var(--border);
}
.table th.right { text-align: right; }
.table td { padding: 13px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { font-variant-numeric: tabular-nums; }
.cell-user { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-user > div { min-width: 0; }
.cell-user strong { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-user > div > span { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actions { display: flex; gap: 2px; justify-content: flex-end; align-items: center; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); margin: 0; }
.toolbar .search { flex: 1 1 240px; max-width: 380px; }
.toolbar .select { width: auto; min-width: 160px; }
.toolbar .spacer { flex: 1; }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.pages { display: flex; gap: 4px; }
.page-link { min-width: 34px; height: 34px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 600; }
.page-link:hover { border-color: var(--primary); color: var(--primary-text); }
.page-link.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-link .icon { width: 16px; height: 16px; }

/* ---------- Tabs (CSS only: radio buttons + labels) ---------- */
.tab-radio { position: absolute; opacity: 0; pointer-events: none; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 20px 0 24px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 16px; margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.tab .icon { width: 18px; height: 18px; }
.tab:hover { color: var(--text); }
.tab[aria-current="page"] { color: var(--primary-text); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
#tab-1:checked ~ .tabs [for="tab-1"],
#tab-2:checked ~ .tabs [for="tab-2"],
#tab-3:checked ~ .tabs [for="tab-3"],
#tab-4:checked ~ .tabs [for="tab-4"],
#tab-5:checked ~ .tabs [for="tab-5"] { color: var(--primary-text); border-bottom-color: var(--primary); }
#tab-1:focus-visible ~ .tabs [for="tab-1"],
#tab-2:focus-visible ~ .tabs [for="tab-2"],
#tab-3:focus-visible ~ .tabs [for="tab-3"],
#tab-4:focus-visible ~ .tabs [for="tab-4"],
#tab-5:focus-visible ~ .tabs [for="tab-5"] { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: 8px 8px 0 0; }
#tab-1:checked ~ .panel-1,
#tab-2:checked ~ .panel-2,
#tab-3:checked ~ .panel-3,
#tab-4:checked ~ .panel-4,
#tab-5:checked ~ .panel-5 { display: block; animation: fadeIn .2s ease; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-icon { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.empty-icon .icon { width: 28px; height: 28px; }
.empty h3 { font-size: 16px; margin-bottom: 4px; }
.empty p { font-size: 14px; max-width: 360px; margin: 0 auto 16px; }

/* ---------- Modal (CSS only: open with <a href="#id">, close with <a href="#close">) ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  display: none; align-items: center; justify-content: center; padding: 20px;
  background: rgba(15, 23, 42, .55);
}
.modal-backdrop:target { display: flex; animation: fade .18s ease; }
body:has(.modal-backdrop:target) { overflow: hidden; }
.modal-dismiss { position: absolute; inset: 0; cursor: default; }
.modal {
  position: relative; z-index: 1;
  width: 100%; max-width: 560px; max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px);
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  animation: pop .2s ease;
}
.modal > form { display: flex; flex-direction: column; min-height: 0; flex: 1; margin: 0; }
.modal.lg { max-width: 760px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-header h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-body > p:last-child { margin-bottom: 0; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); }

/* ---------- Dropdown (CSS only: <details>) ---------- */
.dropdown { position: relative; }
.dropdown > summary { list-style: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  width: 340px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.dropdown[open] > .dropdown-menu { animation: fadeIn .15s ease; }
.dropdown-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 14px; }
.dropdown-menu .announce { padding: 12px 16px; }
.dropdown-foot { display: block; padding: 12px 16px; text-align: center; font-size: 13px; font-weight: 600; border-top: 1px solid var(--border); }
.dropdown-foot:hover { background: var(--surface-2); }
.notif-dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger-solid); border: 2px solid var(--bg); }

/* ==========================================================================
   App shell (sidebar + topbar)
   ========================================================================== */
.menu-check { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 50;
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border);
  transition: transform .25s ease;
}
.sidebar-brand { height: var(--topbar-h); flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 14px 0 20px; border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; font-size: 16px; line-height: 1.15; }
.brand small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: .02em; }
.brand-logo { width: 38px; height: 38px; border-radius: 11px; flex: none; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #4f46e5, #7c3aed); box-shadow: 0 6px 14px -6px rgba(79, 70, 229, .7); }
.brand-logo .icon { width: 22px; height: 22px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px; }
.nav-label { display: block; padding: 14px 12px 8px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin-bottom: 2px; border-radius: 10px;
  color: var(--text-2); font-size: 14px; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-link .icon { width: 19px; height: 19px; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.nav-link .count { margin-left: auto; }
.sidebar-footer { flex: none; padding: 14px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: var(--surface-2); }
.user-chip .meta { flex: 1; min-width: 0; }
.user-chip strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .meta > span { font-size: 12px; color: var(--muted); }
.sidebar-close, .menu-toggle { display: none !important; }
.sidebar-overlay { position: fixed; inset: 0; z-index: 45; background: rgba(15, 23, 42, .5); opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h); flex: none;
  display: flex; align-items: center; gap: 14px; padding: 0 28px;
  background: var(--bg); background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 19px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title p { margin: 0; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.topbar-user { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; margin-left: 6px; border-radius: 999px; color: var(--text); font-weight: 600; font-size: 14px; border: 1px solid var(--border); background: var(--surface); }
.topbar-user:hover { border-color: var(--primary); }
.content { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: 28px; }

/* ==========================================================================
   Page components
   ========================================================================== */
.welcome {
  position: relative; overflow: hidden; isolation: isolate;
  padding: 30px 32px; margin-bottom: 24px; border-radius: var(--radius-lg);
  color: #fff; background: linear-gradient(130deg, #4338ca 0%, #6d28d9 60%, #9333ea 100%);
}
.welcome::before, .welcome::after { content: ""; position: absolute; z-index: -1; border-radius: 50%; background: rgba(255, 255, 255, .09); }
.welcome::before { width: 320px; height: 320px; right: -80px; top: -140px; }
.welcome::after { width: 200px; height: 200px; right: 160px; bottom: -120px; }
.welcome h2 { color: #fff; font-size: 26px; margin-bottom: 6px; }
.welcome p { color: rgba(255, 255, 255, .88); max-width: 600px; margin-bottom: 20px; }
.welcome-date { display: inline-block; font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, .8); margin-bottom: 8px; }

/* Class cards */
.class-card { display: flex; flex-direction: column; overflow: hidden; transition: transform .18s, box-shadow .18s; }
.class-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.class-banner {
  position: relative; display: block; min-height: 112px; padding: 18px 20px; color: #fff; overflow: hidden;
  background: var(--c); background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 62%, #000));
}
.class-banner::before { content: ""; position: absolute; width: 180px; height: 180px; right: -50px; top: -80px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.class-banner h3 { position: relative; color: #fff; font-size: 18px; margin: 0 0 4px; padding-right: 50px; }
.class-banner p { position: relative; margin: 0; font-size: 13px; color: rgba(255, 255, 255, .88); }
.class-banner .avatar { position: absolute; right: 18px; bottom: 14px; --size: 44px; border: 3px solid rgba(255, 255, 255, .9); }
.class-body { flex: 1; padding: 16px 20px; }
.class-teacher { font-weight: 600; font-size: 14px; margin-bottom: 10px; }
.meta-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 13px; color: var(--text-2); }
.meta-list li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.meta-list .icon { width: 16px; height: 16px; color: var(--muted); }
.class-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--border); }

/* Lesson cards */
.lesson-card { display: flex; flex-direction: column; overflow: hidden; color: var(--text); transition: transform .18s, box-shadow .18s; }
.lesson-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.lesson-thumb { position: relative; height: 136px; display: grid; place-items: center; background: var(--surface-2); background: color-mix(in srgb, var(--c) 14%, var(--surface)); }
.pdf-doc { position: relative; width: 66px; height: 86px; border-radius: 6px; background: #fff; box-shadow: 0 10px 24px -8px rgba(15, 23, 42, .35); padding: 14px 10px; }
.pdf-doc::before { content: ""; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 16px 16px 0; border-color: transparent color-mix(in srgb, var(--c) 30%, #fff) transparent transparent; }
.pdf-doc i { display: block; height: 4px; border-radius: 2px; background: #e2e8f0; margin-bottom: 6px; }
.pdf-doc i:nth-child(2) { width: 70%; }
.pdf-doc b { position: absolute; left: -8px; bottom: 12px; padding: 2px 6px; border-radius: 4px; background: #dc2626; color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .04em; }
.pdf-doc.is-image b { background: #0369a1; }
.lesson-body { flex: 1; padding: 16px 18px; }
.lesson-body h3 { font-size: 16px; margin: 10px 0 6px; }
.lesson-body p { margin: 0; font-size: 13.5px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lesson-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }

/* Classroom page */
.class-hero {
  position: relative; overflow: hidden; isolation: isolate;
  min-height: 190px; padding: 32px; border-radius: var(--radius-lg);
  display: flex; flex-direction: column; justify-content: flex-end; color: #fff;
  background: var(--c); background: linear-gradient(130deg, var(--c), color-mix(in srgb, var(--c) 55%, #000));
}
.class-hero::before { content: ""; position: absolute; z-index: -1; width: 360px; height: 360px; right: -90px; top: -170px; border-radius: 50%; background: rgba(255, 255, 255, .1); }
.class-hero::after { content: ""; position: absolute; z-index: -1; width: 200px; height: 200px; right: 200px; bottom: -130px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.class-hero h2 { color: #fff; font-size: clamp(24px, 4vw, 32px); margin: 12px 0 10px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 14px; color: rgba(255, 255, 255, .92); }
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero-meta .icon { width: 16px; height: 16px; }

.composer { display: flex; gap: 12px; align-items: flex-start; padding: 16px 20px; }
.composer form { flex: 1; min-width: 0; margin: 0; }
.composer .textarea { min-height: 52px; }
.composer-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.feed { display: grid; gap: 16px; }
.post { padding: 18px 20px; }
.post-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.post-head > div { min-width: 0; }
.post-head strong { display: block; font-size: 14px; }
.post-head > div > span { font-size: 12px; color: var(--muted); }
.post h4 { font-size: 15px; margin: 0 0 4px; }
.post-body { font-size: 14px; color: var(--text-2); margin: 0; }
.attachment { display: flex; align-items: center; gap: 12px; max-width: 440px; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; color: var(--text); transition: background .15s, border-color .15s; }
.attachment:hover { background: var(--surface-2); border-color: var(--primary); }
.attachment .grow { flex: 1; min-width: 0; }
.attachment strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attachment .grow > span { font-size: 12px; color: var(--muted); }
.info-rows { display: grid; gap: 14px; margin: 0; }
.info-rows div { display: flex; flex-direction: column; gap: 2px; }
.info-rows dt { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.info-rows dd { margin: 0; font-size: 14px; font-weight: 500; }
.code-chip { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 15px; font-weight: 700; color: var(--primary-text); }

/* Breadcrumb */
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; font-size: 13px; color: var(--muted); }
.breadcrumb a { color: var(--text-2); font-weight: 500; }
.breadcrumb a:hover { color: var(--primary-text); }
.breadcrumb .icon { width: 14px; height: 14px; }
.breadcrumb span { color: var(--text); font-weight: 600; }

/* PDF lesson viewer (the browser's own PDF viewer — no JavaScript) */
.viewer-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 24px; align-items: start; }
.pdf-viewer { overflow: hidden; }
.pdf-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.pdf-name { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 14px; font-weight: 600; }
.pdf-name .file-icon { width: 34px; height: 34px; font-size: 10px; }
.pdf-name span { color: var(--muted); font-weight: 400; }
.pdf-frame { display: block; width: 100%; height: calc(100vh - var(--topbar-h) - 150px); min-height: 560px; border: 0; background: var(--surface-3); }
.pdf-fallback { display: grid; place-items: center; align-content: center; gap: 14px; min-height: 360px; padding: 40px 20px; text-align: center; color: var(--muted); }
.pdf-mobile { display: none; padding: 28px 20px; text-align: center; }
.pdf-mobile .pdf-doc { margin: 0 auto 18px; width: 88px; height: 114px; padding: 18px 12px; --c: #4f46e5; }
.pdf-mobile h3 { font-size: 17px; margin-bottom: 4px; }
.pdf-mobile p { color: var(--muted); font-size: 13px; }
/* Image lessons: shown directly on every screen size; a click opens the full image */
.image-view { display: grid; place-items: center; min-height: 320px; padding: 16px; background: var(--surface-3); cursor: zoom-in; }
.image-view img { display: block; max-width: 100%; max-height: calc(100vh - var(--topbar-h) - 190px); width: auto; height: auto; border-radius: 6px; background: #fff; box-shadow: var(--shadow); }
.lesson-aside { display: grid; gap: 20px; }
.lesson-aside h2 { font-size: 20px; margin: 12px 0 8px; }
.lesson-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Profile */
.profile-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.profile-head h2 { margin: 0 0 4px; font-size: 22px; }
.profile-head p { margin: 0 0 8px; color: var(--muted); }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   Admin panel
   ========================================================================== */
.admin .sidebar { background: #0f172a; border-right-color: #1e293b; }
.admin .sidebar-brand, .admin .sidebar-footer { border-color: #1e293b; }
.admin .sidebar .brand { color: #f8fafc; }
.admin .sidebar .brand small { color: #94a3b8; }
.admin .nav-label { color: #64748b; }
.admin .nav-link { color: #cbd5e1; }
.admin .nav-link:hover { background: #1e293b; color: #fff; }
.admin .nav-link.active { background: #4f46e5; color: #fff; }
.admin .nav-link .count { background: #1e293b; color: #cbd5e1; }
.admin .nav-link.active .count { background: rgba(255, 255, 255, .22); color: #fff; }
.admin .user-chip { background: #1e293b; }
.admin .user-chip strong { color: #f8fafc; }
.admin .user-chip .meta > span { color: #94a3b8; }
.admin .sidebar .icon-btn { color: #cbd5e1; }
.admin .sidebar .icon-btn:hover { background: #334155; color: #fff; }
.admin-badge { display: inline-flex; padding: 2px 8px; border-radius: 6px; background: rgba(99, 102, 241, .25); color: #c7d2fe !important; font-size: 10px !important; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

.quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quick-action {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  color: var(--text); font-weight: 600; font-size: 14px;
  transition: border-color .15s, background .15s;
}
.quick-action:hover { border-color: var(--primary); background: var(--primary-soft); }
.quick-action .stat-icon { width: 38px; height: 38px; border-radius: 10px; }
.quick-action .stat-icon .icon { width: 18px; height: 18px; }

.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--border); margin: 0; }
.setting-row:last-child { border-bottom: 0; }
.setting-row strong { display: block; font-size: 14px; }
.setting-row p { margin: 2px 0 0; font-size: 13px; color: var(--muted); max-width: 420px; }
.setting-row .file-input { width: auto; padding: 6px; font-size: 13px; }
.danger-text { color: var(--danger); }

/* ==========================================================================
   Public website (index.html)
   ========================================================================== */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface); background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav { position: relative; height: 72px; display: flex; align-items: center; gap: 16px; }
.nav-check { position: absolute; opacity: 0; pointer-events: none; }
.nav-menu { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-left: 24px; }
.nav-links { display: flex; align-items: center; gap: 2px; list-style: none; margin: 0; padding: 0; }
.nav-links a { display: block; padding: 8px 14px; border-radius: 8px; color: var(--text-2); font-weight: 500; font-size: 15px; transition: background .15s, color .15s; }
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-cta { display: flex; align-items: center; gap: 8px; }
.nav-toggle { display: none !important; }
.nav-toggle .i-close { display: none; }

.hero { position: relative; overflow: hidden; isolation: isolate; padding: 84px 0 76px; }
.hero::before, .hero::after { content: ""; position: absolute; z-index: -1; border-radius: 50%; filter: blur(70px); opacity: .55; }
.hero::before { width: 460px; height: 460px; left: -160px; top: -160px; background: #c7d2fe; }
.hero::after { width: 420px; height: 420px; right: -120px; bottom: -180px; background: #e9d5ff; }
@media (prefers-color-scheme: dark) {
  .hero::before { background: #312e81; opacity: .5; }
  .hero::after { background: #4c1d95; opacity: .4; }
}
.hero-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 56px; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; margin-bottom: 18px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-text); font-size: 13px; font-weight: 600; }
.eyebrow .icon { width: 16px; height: 16px; }
.hero h1 { font-size: clamp(34px, 5.2vw, 58px); line-height: 1.06; letter-spacing: -.03em; margin-bottom: 20px; }
.grad-text { background: linear-gradient(90deg, var(--primary), #a855f7); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lead { max-width: 540px; margin-bottom: 30px; font-size: 18px; color: var(--text-2); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-note { display: flex; align-items: center; gap: 10px; margin-top: 26px; font-size: 14px; color: var(--muted); }
.hero-note .icon { width: 18px; height: 18px; color: var(--success); }

.hero-art { position: relative; }
.mock { overflow: hidden; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-lg); }
.mock-bar { display: flex; gap: 6px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.mock-bar span { width: 10px; height: 10px; border-radius: 50%; }
.mock-bar span:nth-child(1) { background: #f87171; } .mock-bar span:nth-child(2) { background: #fbbf24; } .mock-bar span:nth-child(3) { background: #4ade80; }
.mock-body { display: grid; gap: 12px; padding: 18px; }
.mock-class { padding: 16px; border-radius: 14px; color: #fff; background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.mock-class strong { display: block; font-size: 16px; }
.mock-class span { font-size: 12px; opacity: .85; }
.mock-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; font-size: 13px; }
.mock-row .grow { flex: 1; min-width: 0; }
.mock-row strong { display: block; font-size: 13.5px; }
.mock-row .grow > span { color: var(--muted); font-size: 12px; }
.mock-row .file-icon { width: 36px; height: 36px; font-size: 10px; }
.float-card {
  position: absolute; display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface); box-shadow: var(--shadow-lg); font-size: 13px;
  animation: float 6s ease-in-out infinite;
}
.float-card strong { display: block; font-size: 13.5px; }
.float-card > div > span { color: var(--muted); font-size: 12px; }
.float-card.one { left: -34px; bottom: 40px; }
.float-card.two { right: -24px; top: -22px; animation-delay: -3s; }
@keyframes float { 50% { transform: translateY(-8px); } }

.stats-band { padding: 0 0 20px; }
.stat-big { padding: 24px; text-align: center; }
.stat-big .stat-value { font-size: 34px; }

.section { padding: 84px 0; }
.section.alt { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-title { max-width: 660px; margin: 0 auto 48px; text-align: center; }
.section-title h2 { font-size: clamp(26px, 3.6vw, 38px); letter-spacing: -.02em; }
.section-title p { font-size: 17px; color: var(--text-2); margin: 0; }
.h-display { font-size: clamp(26px, 3.6vw, 38px); letter-spacing: -.02em; }
.feature { padding: 26px; transition: transform .18s, box-shadow .18s; }
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.feature h3 { font-size: 18px; margin: 18px 0 8px; }
.feature p { font-size: 14.5px; color: var(--text-2); margin: 0; }

.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; }
.about-visual { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.about-tile { display: flex; flex-direction: column; justify-content: flex-end; min-height: 160px; padding: 20px; border-radius: 18px; color: #fff; }
.about-tile strong { font-size: 30px; line-height: 1; }
.about-tile span { font-size: 14px; opacity: .9; margin-top: 6px; }
.about-tile:nth-child(1) { background: linear-gradient(135deg, #4f46e5, #6d28d9); }
.about-tile:nth-child(2) { background: linear-gradient(135deg, #0891b2, #0e7490); transform: translateY(28px); }
.about-tile:nth-child(3) { background: linear-gradient(135deg, #d97706, #b45309); }
.about-tile:nth-child(4) { background: linear-gradient(135deg, #16a34a, #15803d); transform: translateY(28px); }
.check-list-plain { list-style: none; padding: 0; margin: 24px 0 30px; display: grid; gap: 12px; }
.check-list-plain li { display: flex; gap: 12px; align-items: flex-start; color: var(--text-2); }
.check-list-plain .icon { width: 22px; height: 22px; padding: 3px; border-radius: 50%; background: var(--success-soft); color: var(--success); margin-top: 1px; }

.news-card { display: flex; flex-direction: column; padding: 22px; }
.news-card h3 { font-size: 17px; margin: 14px 0 8px; }
.news-card p { font-size: 14px; color: var(--text-2); flex: 1; }
.news-card time { font-size: 13px; color: var(--muted); }

.contact-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 32px; align-items: start; }
.contact-item { display: flex; gap: 14px; align-items: flex-start; padding: 18px 0; border-bottom: 1px solid var(--border); }
.contact-item:last-child { border-bottom: 0; }
.contact-item strong { display: block; font-size: 15px; }
.contact-item > div > span { font-size: 14px; color: var(--text-2); }

.cta-band { padding: 48px; border-radius: 24px; text-align: center; color: #fff; background: linear-gradient(130deg, #4338ca, #7c3aed); }
.cta-band h2 { color: #fff; font-size: clamp(24px, 3.4vw, 34px); }
.cta-band p { color: rgba(255, 255, 255, .88); max-width: 560px; margin: 0 auto 26px; }
.cta-band .btn-row { justify-content: center; }

.site-footer { padding: 56px 0 28px; background: #0b1120; color: #94a3b8; font-size: 14px; }
.site-footer .brand { color: #fff; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px; margin-bottom: 40px; }
.site-footer h4 { color: #f1f5f9; font-size: 14px; margin-bottom: 14px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.site-footer a { color: #94a3b8; }
.site-footer a:hover { color: #fff; }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding-top: 24px; border-top: 1px solid #1e293b; font-size: 13px; }

/* ==========================================================================
   Login pages
   ========================================================================== */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--surface); }
.auth-visual {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  padding: 44px 48px; color: #fff;
  background: linear-gradient(140deg, #312e81 0%, #4f46e5 48%, #7c3aed 100%);
}
.auth-visual::before { content: ""; position: absolute; z-index: -1; width: 520px; height: 520px; right: -200px; top: -200px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.auth-visual::after { content: ""; position: absolute; z-index: -1; width: 380px; height: 380px; left: -140px; bottom: -160px; border-radius: 50%; background: rgba(255, 255, 255, .06); }
.auth-visual .brand { color: #fff; }
.auth-visual .brand small { color: rgba(255, 255, 255, .7); }
.auth-visual .brand-logo { background: rgba(255, 255, 255, .18); box-shadow: none; }
.auth-visual h2 { color: #fff; font-size: clamp(28px, 3vw, 40px); line-height: 1.15; max-width: 480px; letter-spacing: -.02em; }
.auth-visual p { color: rgba(255, 255, 255, .85); max-width: 440px; font-size: 16px; }
.auth-features { display: grid; gap: 12px; max-width: 420px; }
.auth-feature { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .14); }
.auth-feature .icon-wrap { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; background: rgba(255, 255, 255, .16); }
.auth-feature strong { display: block; font-size: 14.5px; }
.auth-feature > div > span { font-size: 13px; color: rgba(255, 255, 255, .78); }
.auth-copy { font-size: 13px; color: rgba(255, 255, 255, .65); }

.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-box { width: 100%; max-width: 420px; }
.auth-box h1 { font-size: 28px; margin-bottom: 6px; letter-spacing: -.02em; }
.auth-box .sub { color: var(--muted); margin-bottom: 28px; }
.auth-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 36px; }
.auth-top .brand-mobile { display: none; }
.auth-foot { margin-top: 26px; text-align: center; font-size: 14px; color: var(--muted); }
.auth-foot a { font-weight: 600; }

.admin-login {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 10% -10%, rgba(99, 102, 241, .35), transparent 60%),
              radial-gradient(900px 500px at 110% 110%, rgba(124, 58, 237, .3), transparent 60%), #0b1120;
}
.admin-login-wrap { width: 100%; max-width: 440px; text-align: center; }
.admin-card { padding: 36px; border-radius: 22px; text-align: left; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 40px 80px -20px rgba(0, 0, 0, .6); }
.admin-card .shield { width: 60px; height: 60px; margin: 0 auto 18px; border-radius: 18px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #0f172a, #4f46e5); box-shadow: 0 12px 24px -10px rgba(79, 70, 229, .8); }
.admin-card .shield .icon { width: 28px; height: 28px; }
.admin-card .shield.stopped { background: linear-gradient(135deg, #7f1d1d, #dc2626); box-shadow: 0 12px 24px -10px rgba(220, 38, 38, .8); }
.stopped-list { margin: 0 0 18px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.stopped-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.stopped-list > div:last-child { border-bottom: 0; }
.stopped-list .total { background: var(--surface-2); }
.admin-card h1 { text-align: center; font-size: 24px; margin-bottom: 4px; }
.admin-card .sub { text-align: center; color: var(--muted); margin-bottom: 26px; font-size: 14px; }
.admin-back { display: inline-flex; align-items: center; gap: 6px; margin-top: 22px; color: #94a3b8; font-size: 14px; }
.admin-back:hover { color: #fff; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (min-width: 992px) {
  .menu-check, .nav-check { display: none; }
}

@media (max-width: 1199px) {
  .grid-4, .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layout-main-side, .layout-side-main, .viewer-layout { grid-template-columns: minmax(0, 1fr); }
  .layout-side-main > aside { order: 2; }
  .pdf-frame { height: 78vh; min-height: 480px; }
  .lesson-aside { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .float-card.one { left: -12px; }
  .float-card.two { right: -8px; }
}

@media (max-width: 991px) {
  /* App: slide-out sidebar (checkbox #menu-toggle) */
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .menu-check:checked ~ .app .sidebar { transform: none; }
  .menu-check:checked ~ .app .sidebar-overlay { opacity: 1; visibility: visible; }
  body:has(.menu-check:checked) { overflow: hidden; }
  .menu-check:focus-visible ~ .app .menu-toggle { outline: 2px solid var(--primary); }
  .main { margin-left: 0; }
  .menu-toggle, .sidebar-close { display: inline-grid !important; }
  .topbar { padding: 0 16px 0 10px; gap: 8px; }
  .content { padding: 22px 16px 32px; }

  /* Website: dropdown menu (checkbox #nav-open) */
  .nav-toggle { display: inline-grid !important; margin-left: auto; }
  .nav-menu {
    position: absolute; left: -24px; right: -24px; top: 72px; margin: 0;
    display: none; flex-direction: column; align-items: stretch; gap: 14px;
    padding: 14px 24px 22px; background: var(--surface);
    border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
  }
  .nav-check:checked ~ .nav-menu { display: flex; }
  .nav-check:checked ~ .nav-toggle .i-open { display: none; }
  .nav-check:checked ~ .nav-toggle .i-close { display: block; }
  .nav-check:focus-visible ~ .nav-toggle { outline: 2px solid var(--primary); }
  .nav-links { flex-direction: column; align-items: stretch; }
  .nav-links a { padding: 12px 14px; }
  .nav-cta .btn { flex: 1; }
  .hero { padding: 52px 0 56px; }
  .hero-grid, .about-grid, .contact-grid { grid-template-columns: 1fr; gap: 44px; }
  .hero-art { max-width: 540px; width: 100%; margin: 0 auto; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Login */
  .auth { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-top .brand-mobile { display: flex; }
}

@media (max-width: 767px) {
  body { font-size: 14.5px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .lesson-aside { grid-template-columns: minmax(0, 1fr); }
  .welcome { padding: 24px 20px; }
  .welcome h2 { font-size: 22px; }
  .class-hero { padding: 24px 20px; min-height: 170px; }
  .section { padding: 60px 0; }
  .container { padding: 0 16px; }
  .nav-menu { left: -16px; right: -16px; padding: 14px 16px 20px; }
  .section-title { margin-bottom: 36px; }
  .float-card { display: none; }
  .cta-band { padding: 36px 20px; }
  .card-header, .toolbar, .pagination { padding-left: 16px; padding-right: 16px; }
  .list-item, .announce, .people-row, .post, .composer, .schedule-item { padding-left: 16px; padding-right: 16px; }
  .toolbar .search { max-width: none; flex-basis: 100%; }
  .toolbar .select { flex: 1; min-width: 0; }
  .hide-md { display: none !important; }

  /* PDF: phones open the file in their own PDF app */
  .pdf-frame { display: none; }
  .pdf-mobile { display: block; }
  .image-view { min-height: 0; padding: 10px; }
  .image-view img { max-height: none; }

  /* Tables become stacked cards (each <td> needs data-label="...") */
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr { padding: 14px 16px; border-bottom: 1px solid var(--border); }
  .table-cards tbody tr:last-child { border-bottom: 0; }
  .table-cards td { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 5px 0; border: 0; text-align: right; }
  .table-cards td::before { content: attr(data-label); flex: none; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); text-align: left; }
  .table-cards td.td-main { display: block; padding-bottom: 10px; text-align: left; }
  .table-cards td.td-main::before, .table-cards td.td-actions::before { display: none; }
  .table-cards td.td-actions { justify-content: flex-end; padding-top: 8px; }
}

@media (max-width: 575px) {
  .hide-sm { display: none !important; }
  .stats-grid { gap: 12px; }
  .stat-card { flex-direction: column; align-items: flex-start; gap: 12px; padding: 16px; }
  .stat-icon { width: 40px; height: 40px; border-radius: 12px; }
  .stat-value { font-size: 22px; }
  .topbar-title h1 { font-size: 17px; }
  .topbar-title p { display: none; }
  .topbar-user { padding: 3px; margin-left: 2px; }
  .dropdown-menu { position: fixed; left: 12px; right: 12px; top: calc(var(--topbar-h) + 4px); width: auto; max-width: none; }
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { max-width: none; border-radius: 20px 20px 0 0; max-height: 92vh; max-height: 92dvh; }
  .modal-footer .btn { flex: 1; }
  .admin-card { padding: 28px 20px; }
  .footer-grid { grid-template-columns: 1fr; }
  .hero-actions .btn { flex: 1 1 100%; }
  .lesson-nav { grid-template-columns: 1fr; }
  .tab { padding: 12px 10px; gap: 6px; }
  .bar-row { grid-template-columns: 70px minmax(0, 1fr) 40px; }
  .quick-actions { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* =============================================================================
   QUIZZES (quiz.php, classroom Quizzes tab)
   ============================================================================= */
.quiz-question { padding: 18px 20px; border-top: 1px solid var(--border); }
.quiz-question:first-child { border-top: 0; }
.quiz-question h4 { font-size: 15px; margin-bottom: 12px; display: flex; gap: 10px; align-items: flex-start; }
.quiz-question h4 .q-num { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); font-size: 13px; }
.quiz-question h4 .q-text { flex: 1; white-space: pre-line; }
.quiz-question h4 .q-points { flex: none; font-size: 12px; font-weight: 600; color: var(--muted); }
.quiz-options { display: grid; gap: 8px; padding-left: 36px; }
.quiz-option { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; color: var(--text-2); }
label.quiz-option { cursor: pointer; }
label.quiz-option:hover { border-color: var(--primary); }
.quiz-option input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }
.quiz-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--text); }
.quiz-option .opt-letter { font-weight: 700; color: var(--muted); text-transform: uppercase; }
.quiz-option .opt-tag { margin-left: auto; font-size: 12px; font-weight: 600; }
.quiz-option.correct { border-color: var(--success); background: var(--success-soft); color: var(--success); }
.quiz-option.wrong { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.quiz-timer { position: sticky; top: calc(var(--topbar-h) + 8px); z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; margin-bottom: 16px; }
.quiz-timer > span { display: inline-flex; align-items: center; gap: 8px; }
.quiz-timer .icon { width: 18px; height: 18px; }
.quiz-timer strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.quiz-timer.urgent strong { color: var(--danger); }
.quiz-score { font-size: 40px; font-weight: 800; line-height: 1; }
.quiz-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--text-2); font-size: 14px; }
.quiz-meta span { display: inline-flex; align-items: center; gap: 6px; }
.quiz-meta .icon { width: 16px; height: 16px; }
.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 575px) {
  .quiz-question { padding: 16px; }
  .quiz-options { padding-left: 0; }
  .options-grid { grid-template-columns: 1fr; }
}

/* =============================================================================
   RIGHT-TO-LEFT (Kurdish). <html dir="rtl"> mirrors the layout.
   ============================================================================= */
[dir="rtl"] { --font: 'Noto Sans Arabic', 'Inter', system-ui, -apple-system, 'Segoe UI', Tahoma, Arial, sans-serif; }
[dir="rtl"] body { line-height: 1.7; }
[dir="rtl"] * { letter-spacing: 0 !important; }          /* spacing breaks joined Arabic-script letters */
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }
[dir="rtl"] .link:hover .icon.flip-rtl { transform: scaleX(-1) translateX(3px); }
[dir="rtl"] .code-chip, [dir="rtl"] .input[type="email"], [dir="rtl"] .input[type="tel"], [dir="rtl"] .input[type="number"] { direction: ltr; text-align: right; }

[dir="rtl"] .ml-auto { margin-left: 0; margin-right: auto; }
[dir="rtl"] .select { padding-right: 14px; padding-left: 38px; background-position: left 12px center; }
[dir="rtl"] .input-group > .icon { left: auto; right: 14px; }
[dir="rtl"] .input-group > .input { padding-left: 14px; padding-right: 42px; }
[dir="rtl"] .file-input::file-selector-button { margin-right: 0; margin-left: 12px; }
[dir="rtl"] .check-list .checkbox small { margin-left: 0; margin-right: auto; }
[dir="rtl"] .bar-value { text-align: left; }
[dir="rtl"] .table th { text-align: right; }
[dir="rtl"] .table th.right { text-align: left; }
[dir="rtl"] .dropdown-menu { right: auto; left: 0; }
[dir="rtl"] .notif-dot { right: auto; left: 9px; }
[dir="rtl"] .notif-count { right: auto; left: 2px; }
[dir="rtl"] .gradebook .gb-name { left: auto; right: 0; }

/* App shell: sidebar on the right */
[dir="rtl"] .menu-check { left: auto; right: 0; }
[dir="rtl"] .sidebar { inset: 0 0 0 auto; border-right: 0; border-left: 1px solid var(--border); }
[dir="rtl"] .admin .sidebar { border-left-color: #1e293b; }
[dir="rtl"] .sidebar-brand { padding: 0 20px 0 14px; }
[dir="rtl"] .nav-link .count { margin-left: 0; margin-right: auto; }
[dir="rtl"] .main { margin-left: 0; margin-right: var(--sidebar-w); }
[dir="rtl"] .topbar-user { padding: 4px 4px 4px 10px; margin-left: 0; margin-right: 6px; }

[dir="rtl"] .class-banner h3 { padding-right: 0; padding-left: 50px; }
[dir="rtl"] .class-banner .avatar { right: auto; left: 18px; }
[dir="rtl"] .nav-menu { margin-left: 0; margin-right: 24px; }
[dir="rtl"] .admin-card { text-align: right; }
[dir="rtl"] .quiz-options { padding-left: 0; padding-right: 36px; }
[dir="rtl"] .quiz-option .opt-tag { margin-left: 0; margin-right: auto; }

@media (max-width: 991px) {
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  [dir="rtl"] .menu-check:checked ~ .app .sidebar { transform: none; }
  [dir="rtl"] .main { margin-right: 0; }
  [dir="rtl"] .topbar { padding: 0 10px 0 16px; }
  [dir="rtl"] .nav-toggle { margin-left: 0; margin-right: auto; }
  [dir="rtl"] .nav-menu { margin-right: 0; }
}
@media (max-width: 767px) {
  [dir="rtl"] .table-cards td { text-align: left; }
  [dir="rtl"] .table-cards td::before { text-align: right; }
  [dir="rtl"] .table-cards td.td-main { text-align: right; }
}
@media (max-width: 575px) {
  [dir="rtl"] .topbar-user { padding: 3px; margin-right: 2px; }
  [dir="rtl"] .quiz-options { padding-right: 0; }
}

/* =============================================================================
   Homework, attendance, gradebook, notifications
   ============================================================================= */
.hero-actions { margin-top: 16px; }

/* Bell: number of unread notifications, and the list items */
.topbar .dropdown-menu { max-height: calc(100vh - var(--topbar-h) - 24px); overflow-y: auto; overscroll-behavior: contain; }
.notif-count { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger-solid); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 18px; text-align: center; border: 2px solid var(--bg); box-sizing: content-box; }
.notif-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text); }
.notif-item:hover { background: var(--surface-2); }
.notif-item .grow { flex: 1; min-width: 0; }
.notif-item p { margin: 0 0 2px; font-size: 13.5px; line-height: 1.45; overflow-wrap: anywhere; }
.notif-item .grow > span { font-size: 12px; color: var(--muted); }
.notif-icon { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--muted); }
.notif-icon .icon { width: 16px; height: 16px; }
.notif-item.unread { background: var(--primary-soft); }
.notif-item.unread p { font-weight: 600; }
.notif-item.unread .notif-icon { background: var(--primary); color: #fff; }
.notif-item.due .notif-icon { background: var(--warning-soft); color: var(--warning); }

/* Homework: handed-in work and marking */
.work-row { padding: 16px 20px; border-bottom: 1px solid var(--border); scroll-margin-top: calc(var(--topbar-h) + 16px); }
.work-row:last-child { border-bottom: 0; }
.work-row:target { background: var(--primary-soft); }
.work-head { display: flex; align-items: center; gap: 12px; }
.work-head .grow { flex: 1; min-width: 0; }
.work-head strong { display: block; font-size: 14px; }
.work-head .grow > span { font-size: 12.5px; color: var(--muted); }
.work-body { display: grid; gap: 10px; }
.work-row .work-body { margin-top: 12px; padding-inline-start: 50px; }
.work-note { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 14px; white-space: pre-line; overflow-wrap: anywhere; }
.attachment-row { display: flex; align-items: center; gap: 12px; max-width: 460px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; }
.attachment-row .grow { flex: 1; min-width: 0; }
.attachment-row strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attachment-row .grow > span { font-size: 12px; color: var(--muted); }
.submission-preview { display: block; max-width: 460px; cursor: zoom-in; }
.submission-preview img { display: block; max-width: 100%; max-height: 280px; border-radius: 10px; border: 1px solid var(--border); background: #fff; }
.grade-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.grade-form .grow { flex: 1 1 220px; min-width: 0; }
.grade-form .textarea { min-height: 42px; }
/* Money box: "100 | ,000 IQD" (always left to right) */
.money-input { display: flex; align-items: stretch; width: 100%; }
.money-input .input { flex: 1; min-width: 0; border-start-end-radius: 0; border-end-end-radius: 0; }
.money-input > span { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--border); border-inline-start: 0; border-radius: 0 10px 10px 0; background: var(--surface-2); color: var(--muted); font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.fee-grid .money-input .input { min-width: 64px; }
.fee-grid .money-input > span { padding: 0 8px; }
.input-suffix { display: flex; align-items: center; gap: 8px; }
.input-suffix .input { width: 90px; }
.input-suffix span { color: var(--muted); font-size: 14px; white-space: nowrap; }

/* Attendance: present / late / absent / excused (CSS-only radio buttons) */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 3px; border-radius: 10px; background: var(--surface-2); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { padding: 6px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; user-select: none; }
.seg label:hover { color: var(--text); }
.seg input:focus-visible + label { outline: 2px solid var(--primary); outline-offset: 1px; }
.seg input:checked + .seg-present { background: var(--success); color: #fff; }
.seg input:checked + .seg-late { background: var(--warning); color: #fff; }
.seg input:checked + .seg-absent { background: var(--danger); color: #fff; }
.seg input:checked + .seg-excused { background: var(--primary); color: #fff; }
.attendance-row { flex-wrap: wrap; }
.attendance-rate { display: flex; align-items: baseline; gap: 8px; margin: 10px 0; }
.attendance-rate .rate { font-size: 30px; }

/* Percentages: 80%+ green, 50–79% amber, under 50% red */
.rate { font-weight: 800; font-variant-numeric: tabular-nums; }
.rate.grade-good { color: var(--success); }
.rate.grade-ok { color: var(--warning); }
.rate.grade-low { color: var(--danger); }

/* Gradebook table: the student column stays visible while scrolling sideways */
.gradebook { font-size: 13.5px; }
.gradebook th, .gradebook td { padding: 10px 12px; white-space: nowrap; text-align: center; }
.gradebook .gb-name { position: sticky; left: 0; z-index: 1; min-width: 170px; text-align: start; background: var(--surface); box-shadow: inset -1px 0 0 var(--border); }
.gradebook thead .gb-name { z-index: 2; background: var(--surface-2); }
.gradebook tbody tr:hover .gb-name { background: var(--surface-2); }
.gb-item a { display: grid; gap: 4px; justify-items: center; max-width: 150px; color: var(--text); text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.gb-item small { color: var(--muted); font-weight: 500; font-size: 11px; }
.gb-cell { font-weight: 600; font-variant-numeric: tabular-nums; }
.gb-cell.grade-good { background: var(--success-soft); color: var(--success); }
.gb-cell.grade-ok { background: var(--warning-soft); color: var(--warning); }
.gb-cell.grade-low { background: var(--danger-soft); color: var(--danger); }
.gb-cell.cell-pending { color: var(--muted); }
.gb-total { font-size: 15px; }
.gb-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; border-top: 1px solid var(--border); }
.gb-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend-box { display: inline-block; width: 14px; height: 14px; border-radius: 4px; }
.legend-box.grade-good { background: var(--success-soft); box-shadow: inset 0 0 0 1px var(--success); }
.legend-box.grade-ok { background: var(--warning-soft); box-shadow: inset 0 0 0 1px var(--warning); }
.legend-box.grade-low { background: var(--danger-soft); box-shadow: inset 0 0 0 1px var(--danger); }
.type-tag { display: inline-block; flex: none; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.type-quiz { background: var(--primary-soft); color: var(--primary-text); }
.type-homework { background: var(--warning-soft); color: var(--warning); }

/* Attendance register (attendance.php?view=register): one column per lesson day of the month */
.register th, .register td { padding: 8px 6px; }
.register .gb-name { padding-inline: 14px; }
.register .reg-day a { display: grid; justify-items: center; gap: 1px; min-width: 30px; color: var(--text); font-size: 13px; text-transform: none; letter-spacing: 0; }
.register .reg-day small { color: var(--muted); font-weight: 500; font-size: 10.5px; }
.register .reg-day.reg-missing a, .register .reg-day.reg-missing small { color: var(--warning); }
.register tfoot th, .register tfoot td { border-top: 1px solid var(--border); border-bottom: 0; }
.reg-cell { font-weight: 700; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.reg-present { color: var(--success); }
.reg-late { background: var(--warning-soft); color: var(--warning); }
.reg-absent { background: var(--danger-soft); color: var(--danger); }
.reg-excused { background: var(--primary-soft); color: var(--primary-text); }
.reg-none { color: var(--muted); }
.reg-key { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; font-weight: 700; font-size: 11.5px; box-shadow: inset 0 0 0 1px var(--border); }
.reg-key.reg-missing-key { color: var(--warning); font-weight: 700; }
.attendance-days { margin: 0 0 8px; font-size: 13.5px; }
.attendance-lessons { display: flex; align-items: center; gap: 6px; margin-bottom: 0; }
.attendance-lessons .icon { width: 14px; height: 14px; flex: none; }
.bar-fill.grade-good { background: var(--success); }
.bar-fill.grade-ok { background: var(--warning); }
.bar-fill.grade-low { background: var(--danger); }
.mt-sm { margin-top: 10px; }

@media (max-width: 767px) {
  .work-row .work-body { padding-inline-start: 0; }
  .attendance-row .seg { width: 100%; }
  .seg label { flex: 1; text-align: center; }
}
@media print {
  .sidebar, .topbar, .breadcrumb, .btn, .hero-actions { display: none !important; }
  .main { margin: 0 !important; }
}

/* =============================================================================
   Accounting: tabs, statement, receipts, chart
   ============================================================================= */
.subnav { display: flex; gap: 4px; margin: -4px 0 20px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.subnav::-webkit-scrollbar { display: none; }
.subnav-link { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap; }
.subnav-link .icon { width: 17px; height: 17px; }
.subnav-link:hover { color: var(--text); }
.subnav-link.active { color: var(--primary-text); border-bottom-color: var(--primary); }
.bar-track > span { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--primary); }
.grade-fees { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.grade-fees label { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); }
.fee-grid-wrap { border: 1px solid var(--border); border-radius: 10px; }
.fee-grid th, .fee-grid td { padding: 6px 8px; white-space: nowrap; }
.fee-grid tbody th { font-weight: 600; font-size: 13px; }
.fee-grid .input { min-width: 92px; }
.enroll-all { margin-bottom: 8px; }
.table td.nowrap { white-space: nowrap; }
.bar-title { margin: 20px 0 12px; font-size: 13px; font-weight: 600; color: var(--muted); }
.statement td, .statement th { padding: 9px 14px; white-space: nowrap; }
.table .right, .table td.right { text-align: right; }
.total-row td { background: var(--surface-2); }
.receipt-row { color: inherit; }
.receipt-row:hover { background: var(--surface-2); }
.receipt-row.voided strong, tr.voided td { text-decoration: line-through; color: var(--muted); }
tr.voided td .badge { text-decoration: none; }

/* A receipt, printable on A4 or a small receipt printer */
.receipt { position: relative; max-width: 720px; margin: 0 auto; overflow: hidden; }
.receipt-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding: 24px; border-bottom: 2px solid var(--text); }
.receipt-head h2 { margin: 0 0 4px; font-size: 20px; }
.receipt-head p { margin: 0; color: var(--muted); font-size: 13px; }
.receipt-no { display: grid; text-align: end; gap: 2px; font-size: 13px; color: var(--muted); }
.receipt-no strong { font-size: 20px; color: var(--text); font-variant-numeric: tabular-nums; }
.receipt-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 24px; margin: 0; padding: 20px 24px; }
.receipt-info div { display: grid; gap: 2px; }
.receipt-info dt { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.receipt-info dd { margin: 0; font-weight: 600; }
.receipt-lines th, .receipt-lines td { padding: 10px 24px; }
.receipt-lines tfoot th { font-size: 16px; border-top: 2px solid var(--text); background: var(--surface-2); }
.receipt-foot { display: flex; justify-content: space-between; gap: 24px; padding: 28px 24px 24px; font-size: 13px; color: var(--muted); }
.receipt-foot > div { display: grid; gap: 4px; }
.receipt-foot strong { color: var(--text); font-size: 14px; }
.receipt-sign { min-width: 200px; padding-top: 28px; border-top: 1px solid var(--text); text-align: center; }
.receipt-void { position: absolute; inset: 0; display: grid; place-items: center; font-size: 110px; font-weight: 800; letter-spacing: .1em; color: var(--danger); opacity: .12; transform: rotate(-18deg); pointer-events: none; }

/* Chart: income (slot 1) vs expenses (slot 2) — colours checked with the dataviz palette validator */
.viz { --viz-1: #2a78d6; --viz-2: #eb6834; --viz-grid: #e1e0d9; --viz-base: #c3c2b7; --viz-ink: #52514e; --viz-muted: #898781; padding-top: 8px; padding-bottom: 8px; }
.viz-chart { display: block; width: 100%; height: auto; overflow: visible; font-family: inherit; }
.viz-grid { stroke: var(--viz-grid); stroke-width: 1; shape-rendering: crispEdges; }
.viz-grid.viz-base { stroke: var(--viz-base); }
.viz-tick { fill: var(--viz-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz-label { fill: var(--viz-ink); font-size: 11px; font-weight: 600; }
.viz-s1 { fill: var(--viz-1); }
.viz-s2 { fill: var(--viz-2); }
.viz-hit { fill: transparent; }
.viz-col { outline: none; cursor: default; }
.viz-col:hover .viz-hit, .viz-col:focus-visible .viz-hit { fill: var(--surface-2); }
.viz-col:focus-visible .viz-hit { stroke: var(--primary); stroke-width: 1.5; }
.viz-legend { display: flex; gap: 16px; font-size: 13px; color: var(--text-2); }
.viz-legend span { display: inline-flex; align-items: center; gap: 6px; }
.viz-key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.viz-key-1 { background: var(--viz-1, #2a78d6); }
.viz-key-2 { background: var(--viz-2, #eb6834); }
.card-header .viz-legend, .viz-tip { --viz-1: #2a78d6; --viz-2: #eb6834; }
.viz-tip { position: fixed; z-index: 90; pointer-events: none; min-width: 180px; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 13px; }
.viz-tip-title { margin: 0 0 6px; color: var(--muted); font-size: 12px; }
.viz-tip-row { display: flex; align-items: center; gap: 8px; }
.viz-tip-row + .viz-tip-row { margin-top: 4px; }
.viz-tip-row i { width: 12px; height: 2px; border-radius: 1px; }
.viz-tip-row strong { color: var(--text); }
.viz-tip-row span { color: var(--muted); }
@media (prefers-color-scheme: dark) {
  .viz, .card-header .viz-legend, .viz-tip { --viz-1: #3987e5; --viz-2: #d95926; --viz-grid: #2c2c2a; --viz-base: #383835; --viz-ink: #c3c2b7; --viz-muted: #898781; }
}
@media (max-width: 767px) {
  .receipt-head, .receipt-foot { flex-direction: column; }
  .receipt-no { text-align: start; }
}
@media print {
  .no-print, .subnav, .flash, .alert-success { display: none !important; }
  .content { padding: 0 !important; }
  .receipt { max-width: none; border: 0; box-shadow: none; }
  body { background: #fff; }
}

/* Weekly timetable: a row per lesson of the day, a column per school day */
.tt-wrap { border: 1px solid var(--border); border-radius: 12px; }
.tt { table-layout: fixed; min-width: 680px; }
.tt th, .tt td { padding: 8px; vertical-align: top; border-inline-start: 1px solid var(--border); }
.tt thead th { text-align: center; }
.tt th.is-today { color: var(--primary-text); box-shadow: inset 0 -2px 0 var(--primary); }
.tt td.is-today { background: var(--surface-2); }
.tt .tt-period { width: 96px; border-inline-start: 0; font-size: 12px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.tt .tt-period strong { display: block; font-size: 16px; color: var(--text); }
.tt-lesson { position: relative; display: grid; gap: 2px; padding: 8px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); border-inline-start: 4px solid var(--c, var(--primary)); font-size: 13px; }
.tt-lesson + .tt-lesson { margin-top: 6px; }
.tt-lesson strong { overflow-wrap: anywhere; padding-inline-end: 22px; }
.tt-time { font-size: 12px; font-weight: 600; color: var(--muted); }
.tt-remove { position: absolute; top: 2px; inset-inline-end: 2px; }
.tt-add { display: grid; place-items: center; min-height: 48px; border: 1px dashed var(--border); border-radius: 8px; color: var(--muted); }
.tt-add:hover, .tt-add:focus-visible { color: var(--primary-text); border-color: var(--primary); }
.tt-other { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.day-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.print-title { display: none; margin: 0 0 16px; font-size: 18px; }

/* Quiz countdowns (quiz.php) */
.quiz-countdown { display: grid; justify-items: center; gap: 2px; margin: 14px auto; }
.quiz-countdown strong { font-size: 34px; font-weight: 800; letter-spacing: .02em; font-variant-numeric: tabular-nums; color: var(--primary-text); }

/* Exams, report cards, promotion */
.exam-line { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.exam-total { border-bottom: 0; font-weight: 700; }
.exam-attendance { margin-top: 4px; border-top: 1px solid var(--border); border-bottom: 0; }
.marks-row { flex-wrap: wrap; }
.marks-input { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.marks-input .input { width: 84px; text-align: center; }
.marks-table th, .marks-table td { white-space: nowrap; }
.marks-table th a { color: inherit; }
/* Results and promotion (admin/report-cards.php): the three steps, the grade lists, finishing the year */
.year-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 0; padding: 0; list-style: none; }
.year-steps li { display: flex; align-items: flex-start; gap: 12px; }
.year-steps p { margin: 4px 0 0; color: var(--text-2); font-size: 13.5px; line-height: 1.5; }
.year-step-n { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-text); font-size: 14px; font-weight: 700; }
.results td { vertical-align: middle; }
.results tr.is-repeat td { background: var(--warning-soft); }
.select-sm { width: auto; height: 36px; padding-inline-start: 10px; font-size: 13.5px; }
.finish-year h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font-size: 18px; }
.finish-plan { margin: 0 0 18px; padding-inline-start: 20px; line-height: 1.9; }
.finish-plan strong { font-size: 16px; font-variant-numeric: tabular-nums; }
@media (max-width: 991px) {
  .year-steps { grid-template-columns: minmax(0, 1fr); }
}
.nowrap { white-space: nowrap; }
.report-card + .report-card { margin-top: 24px; }
.report-lines td { vertical-align: top; }
.report-section { margin: 0; padding: 24px 24px 4px; font-size: 15px; }
.report-attendance th, .report-attendance td { padding-inline: 12px; white-space: nowrap; }
.report-attendance :is(th, td):first-child { padding-inline-start: 24px; white-space: normal; }
.report-attendance :is(th, td):last-child { padding-inline-end: 24px; }
@media print {
  .report-card { break-after: page; box-shadow: none; }
  .report-card:last-of-type { break-after: auto; }
  .print-title { display: block; }
  .tt { min-width: 0; }
  .tt-wrap { overflow: visible; }
  .tt-lesson { break-inside: avoid; }
}

/* Activity log */
.activity td { vertical-align: top; }
.activity-details { max-width: 420px; overflow-wrap: anywhere; font-size: 13.5px; color: var(--text-2); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
