/* ==========================================================================
   Elimu Yetu SRMS — interface
   Milky base + glass panels. Institution colours (orange / green / blue) are
   used as information, not decoration: each area of the centre owns one hue,
   and the tri-colour ribbon marks composition (present/late/absent, staff/
   students). No web fonts — the system runs offline on the centre LAN.
   ========================================================================== */

:root {
  /* Institution palette */
  --ey-orange:      #EE7A1B;
  --ey-orange-deep: #C85E0A;
  --ey-green:       #17915A;
  --ey-green-deep:  #0E6E43;
  --ey-blue:        #1567AE;
  --ey-blue-deep:   #0E4C83;

  /* Milk & ink */
  --milk:      #F4F6F2;
  --milk-hi:   #FCFDFB;
  --ink:       #14231D;
  --ink-soft:  #5A6B64;
  --ink-faint: #8A9A93;
  --line:      rgba(20, 35, 29, .10);

  --danger:  #C0392B;
  --warn:    #B4690E;

  /* Glass */
  --glass:        linear-gradient(155deg, rgba(255,255,255,.78), rgba(255,255,255,.52));
  --glass-solid:  rgba(255,255,255,.72);
  --glass-edge:   rgba(255,255,255,.85);
  --glass-blur:   saturate(1.35) blur(18px);
  --shadow-sm:    0 1px 2px rgba(20,35,29,.06), 0 4px 12px -6px rgba(20,35,29,.12);
  --shadow-md:    0 2px 6px rgba(20,35,29,.05), 0 18px 40px -22px rgba(20,35,29,.28);

  --radius:    16px;
  --radius-sm: 10px;
  --radius-lg: 22px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;

  --rail: 264px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--milk);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Ambient brand blooms + faint paper grid: what the glass panels blur. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(46rem 30rem at 8% -6%,  rgba(238,122,27,.16), transparent 62%),
    radial-gradient(40rem 30rem at 92% 4%,  rgba(21,103,174,.16), transparent 60%),
    radial-gradient(52rem 34rem at 62% 104%, rgba(23,145,90,.16), transparent 62%);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(rgba(20,35,29,.16) .5px, transparent .5px);
  background-size: 22px 22px;
  opacity: .35;
}

a { color: var(--ey-blue-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 3px solid var(--ey-blue);
  outline-offset: 2px;
  border-radius: 4px;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.012em; line-height: 1.25; }
h1 { font-size: 25px; }
h2 { font-size: 18px; }
h3 { font-size: 15.5px; }
p  { margin: 0 0 .8em; }

@media (max-width: 600px) {
  h1 { font-size: 20px; }
  h2 { font-size: 16px; }
  h3 { font-size: 15px; }
}

.mono   { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.eyebrow {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .14em; color: var(--ink-faint);
}
.muted  { color: var(--ink-soft); }
.tiny   { font-size: 12.5px; }
.right  { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.stack > * + * { margin-top: 14px; }
.hide { display: none !important; }

/* ── The tri-colour ribbon: the one signature mark ───────────────────────── */
.ribbon {
  height: 3px; border-radius: 3px; overflow: hidden;
  background: linear-gradient(90deg,
    var(--ey-orange) 0 33.3%, var(--ey-green) 33.3% 66.6%, var(--ey-blue) 66.6% 100%);
}

/* ==========================================================================
   Shell
   ========================================================================== */
.shell { display: flex; min-height: 100dvh; }

/* ── Sidebar rail ───────────────────────────────────────────────────────── */
.rail {
  width: var(--rail);
  flex: 0 0 var(--rail);
  position: sticky; top: 0;
  height: 100dvh;
  display: flex; flex-direction: column;
  background: linear-gradient(170deg, rgba(255,255,255,.82), rgba(255,255,255,.58));
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--glass-edge);
  box-shadow: 1px 0 24px -14px rgba(20,35,29,.35);
  z-index: 40;
}
.rail__brand {
  display: flex; align-items: center; gap: 11px;
  padding: 18px 18px 14px;
}
.rail__mark {
  width: 38px; height: 38px; flex: none;
  border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--ey-orange), var(--ey-green) 55%, var(--ey-blue));
  color: #fff; font-weight: 800; font-size: 14px; letter-spacing: .02em;
  box-shadow: 0 6px 16px -8px rgba(20,35,29,.6);
}
.rail__name { font-weight: 700; font-size: 14px; line-height: 1.15; }
.rail__motto { font-size: 10.5px; color: var(--ink-faint); font-style: italic; }

.rail__nav { flex: 1; overflow-y: auto; padding: 4px 12px 18px; scrollbar-width: thin; }
.rail__section + .rail__section { margin-top: 16px; }
.rail__label {
  padding: 0 8px 6px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .15em; color: var(--ink-faint);
}
.rail__link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--ink); font-size: 13.5px; font-weight: 500;
  border-left: 3px solid transparent;
  transition: background .16s, border-color .16s;
}
.rail__link:hover { background: rgba(255,255,255,.75); text-decoration: none; }
.rail__link svg { width: 17px; height: 17px; flex: none; opacity: .72; }
.rail__link.is-active {
  background: rgba(255,255,255,.92);
  border-left-color: var(--ey-blue);
  font-weight: 650;
  box-shadow: var(--shadow-sm);
}
.rail__link.is-active svg { opacity: 1; color: var(--ey-blue); }
/* Each section carries its own hue so location is legible at a glance. */
.rail__section--green .rail__link.is-active { border-left-color: var(--ey-green); }
.rail__section--green .rail__link.is-active svg { color: var(--ey-green); }
.rail__section--orange .rail__link.is-active { border-left-color: var(--ey-orange); }
.rail__section--orange .rail__link.is-active svg { color: var(--ey-orange-deep); }

.rail__foot { padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.rail__foot .tiny { color: var(--ink-faint); }

/* ── Main column ────────────────────────────────────────────────────────── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 22px;
  background: rgba(252,253,251,.72);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-edge);
}
.topbar__title { min-width: 0; flex: 1; }
.topbar__title h1 { font-size: 19px; }
.topbar__title .tiny { color: var(--ink-soft); }
.topbar__spacer { flex: 1; }

.burger {
  display: none;
  width: 38px; height: 38px; flex: none;
  border: 1px solid var(--line); border-radius: 11px;
  background: var(--glass-solid); color: var(--ink);
  align-items: center; justify-content: center; cursor: pointer;
}

.userchip {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 12px 5px 6px;
  border-radius: 999px;
  background: var(--glass-solid);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--shadow-sm);
}
.userchip:hover { text-decoration: none; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11.5px; font-weight: 700; color: #fff;
  background: linear-gradient(145deg, var(--ey-blue), var(--ey-green));
  flex: none; object-fit: cover;
}
.avatar--orange { background: linear-gradient(145deg, var(--ey-orange), var(--ey-orange-deep)); }
.userchip__name { font-size: 13px; font-weight: 600; line-height: 1.1; }
.userchip__role { font-size: 10.5px; color: var(--ink-soft); }

.content { padding: 22px; max-width: 1280px; width: 100%; }

/* ==========================================================================
   Panels
   ========================================================================== */
.panel {
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.panel__head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.panel__head h2 { flex: 1; min-width: 140px; }
.panel__body { padding: 18px; }
.panel__body--flush { padding: 0; }
.panel__foot {
  padding: 12px 18px; border-top: 1px solid var(--line);
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: rgba(255,255,255,.35);
}

.grid { display: grid; gap: 16px; }
.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--sidebar {
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  align-items: start;
  gap: 12px;
}
.grid--sidebar > .stack { margin-top: 0; }
.grid--sidebar > .stack:last-child > .panel:first-child {
  margin-top: 0;
}

/* ── Stat tiles ─────────────────────────────────────────────────────────── */
.stat {
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius);
  padding: 15px 16px 14px;
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
  display: block; color: inherit;
}
.stat:hover { text-decoration: none; box-shadow: var(--shadow-md); }
.stat::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--ey-blue);
}
.stat--green::before  { background: var(--ey-green); }
.stat--orange::before { background: var(--ey-orange); }
.stat--ink::before    { background: var(--ink); }
.stat__label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-faint); }
.stat__value {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 29px; font-weight: 600; line-height: 1.15; margin-top: 4px;
  letter-spacing: -.02em;
}
.stat__value small { font-size: 14px; font-weight: 500; color: var(--ink-soft); }
.stat__note { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

/* ── Segment bar: composition as colour (the ribbon doing real work) ─────── */
.segbar { display: flex; height: 9px; border-radius: 99px; overflow: hidden; background: rgba(20,35,29,.07); }
.segbar span { display: block; height: 100%; }
.seg-p { background: var(--ey-green); }
.seg-l { background: var(--ey-orange); }
.seg-e { background: var(--ey-blue); }
.seg-a { background: #C9CFCC; }
.seg-teachers { background: var(--ey-blue); }
.seg-students { background: var(--ey-orange); }
.seglegend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; font-size: 12px; color: var(--ink-soft); }
.seglegend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 5px; }

/* ── Sparkline bars (pure CSS, no chart library) ─────────────────────────── */
.spark { display: flex; align-items: flex-end; gap: 6px; height: 84px; }
.spark__col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; min-width: 0; }
.spark__bar { border-radius: 4px 4px 0 0; min-height: 2px; }
.spark__bar--t { background: var(--ey-blue); }
.spark__bar--s { background: var(--ey-orange); }
.spark__x { font-size: 10px; color: var(--ink-faint); text-align: center; margin-top: 5px; font-family: var(--mono); }

/* ==========================================================================
   Tables
   ========================================================================== */
.tablewrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.tablewrap::after {
  content: "← Swipe to scroll →";
  position: absolute;
  bottom: 2px; right: 8px;
  font-size: 11px;
  color: var(--ink-faint);
  pointer-events: none;
  display: none;
}

@media (max-width: 860px) {
  .tablewrap::after {
    display: block;
  }
}
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; color: var(--ink-faint);
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.5);
  position: sticky; top: 0;
}
table.data td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr:hover { background: rgba(255,255,255,.6); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td .mono { font-size: 13px; }
table.data.compact th, table.data.compact td { padding: 7px 10px; }
/* Second header row under a colspan group, e.g. teachers/students under "Tea" */
table.data thead tr.subhead th {
  padding-top: 0; padding-bottom: 7px; top: 34px;
  font-size: 10px; letter-spacing: .08em; color: var(--ink-faint); font-weight: 600;
}

/* Advanced timetable grid (time rows × weekdays) */
.timetable-adv { width: 100%; border-collapse: collapse; font-size: 14px; }
.timetable-adv thead th { background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,.82)); border-bottom: 2px solid var(--line); padding: 8px 6px; text-transform: uppercase; font-size: 10.5px; font-weight:700; color:var(--ink-faint); letter-spacing: .04em; }
.timetable-adv th.time-head { width: 120px; text-align:left; padding-left:10px; }
.timetable-adv td, .timetable-adv th { border: 1px solid rgba(20,35,29,.06); vertical-align: middle; }
.timetable-adv tbody td { padding: 8px; min-height: 54px; }
.time-col { font-weight:700; color:var(--ink-soft); padding-left:10px; white-space:nowrap; font-size:11.5px; }
.ttcell { background: #fff; }
.timetable-adv thead th { background: linear-gradient(180deg,#EAF6FF,#DCEFFB); color:#0E4C83; }
.timetable-adv thead th.day-friday { background: linear-gradient(180deg,#FDECEA,#F8E2E0); color: #C85E0A; }
.timetable-adv td.day-friday { background: #FFF6F5; }
.timetable-adv td { border-color: rgba(20,35,29,.06); }
.timetable-adv thead th { border-bottom-width:1px; }
.timetable-adv { border: 1px solid rgba(20,35,29,.06); }

.timetable-adv-wrap {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 6px;
  border-radius: 10px;
}
.timetable-adv-wrap::-webkit-scrollbar {
  display: none;
}
.timetable-adv {
  width: 100%;
  min-width: 720px;
  display: table;
  table-layout: fixed;
}

/* Friday Talent Show whole-day cell */
.timetable-adv td.day-friday-cell {
  background: #FFF6F5;
  text-align: center;
  vertical-align: middle;
  padding: 16px 8px;
  border-color: rgba(200, 94, 10, 0.12);
}

.talent-show-vertical {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  text-orientation: upright;
  letter-spacing: 0.22em;
  font-weight: 800;
  font-size: 16px;
  color: #C85E0A;
  text-transform: uppercase;
  user-select: none;
  margin: 0 auto;
  line-height: 1.2;
}

.friday-vertical { display: none; }

/* Narrow Friday column */
.timetable-adv thead th.day-friday { width: 82px; }
.timetable-adv td.day-friday-cell,
.timetable-adv td:nth-child(6) { width: 82px; }
.tt-entry { display:flex; flex-direction:column; gap:4px; align-items:flex-start; }
.tt-entry__subject { font-weight:700; font-size:13px; color:var(--ey-blue-deep); line-height:1.2; }
.tt-entry__meta { font-size:11.5px; color:var(--ink-soft); line-height:1.2; }
.tt-entry__loc {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; color: var(--ink-faint);
  background: rgba(14,76,131,.07); border-radius: 4px;
  padding: 1px 5px; line-height: 1.5; margin-top: 1px;
}
/* Location sub-header row */
.tt-loc-row th { border-top: none !important; }
.tt-loc-head {
  font-size: 10px !important; font-weight: 600 !important;
  letter-spacing: .03em; text-transform: none !important;
  color: #2563a0 !important; padding: 4px 6px !important;
  background: linear-gradient(180deg,#d4eaf9,#c6e1f5) !important;
  border-bottom: 1px solid rgba(20,35,29,.09) !important;
  white-space: nowrap;
}
.tt-loc-head.day-friday {
  color: #b05010 !important;
  background: linear-gradient(180deg,#f5d9d4,#eecec8) !important;
}
.timetable-adv .empty-cell { text-align:center; color:var(--ink-faint); padding:24px; }

@media (max-width: 900px) {
  .timetable-adv thead th.time-head { display:none; }
  .timetable-adv td.time-col { display:none; }
  .timetable-adv td, .timetable-adv th { font-size:12.5px; padding:6px; }
  .tt-entry__subject { font-size:12px; }
  .tt-entry__meta { font-size:11px; }
}

.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person__name { font-weight: 600; line-height: 1.2; }
.person__meta { font-size: 11.5px; color: var(--ink-soft); font-family: var(--mono); }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 650; letter-spacing: .01em;
  border: 1px solid transparent; white-space: nowrap;
}
.badge--green   { background: rgba(23,145,90,.13);  color: var(--ey-green-deep);  border-color: rgba(23,145,90,.25); }
.badge--orange  { background: rgba(238,122,27,.15); color: var(--ey-orange-deep); border-color: rgba(238,122,27,.28); }
.badge--blue    { background: rgba(21,103,174,.13); color: var(--ey-blue-deep);   border-color: rgba(21,103,174,.25); }
.badge--red     { background: rgba(192,57,43,.12);  color: var(--danger);         border-color: rgba(192,57,43,.24); }
.badge--neutral { background: rgba(20,35,29,.07);   color: var(--ink-soft);       border-color: var(--line); }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  padding: 9px 15px; border-radius: 11px;
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  border: 1px solid var(--line);
  background: var(--glass-solid); color: var(--ink);
  cursor: pointer; text-decoration: none;
  transition: transform .12s, box-shadow .16s, background .16s;
  box-shadow: var(--shadow-sm);
  min-width: 44px; min-height: 44px;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn--primary { background: linear-gradient(160deg, var(--ey-blue), var(--ey-blue-deep)); color: #fff; border-color: transparent; }
.btn--green   { background: linear-gradient(160deg, var(--ey-green), var(--ey-green-deep)); color: #fff; border-color: transparent; }
.btn--orange  { background: linear-gradient(160deg, var(--ey-orange), var(--ey-orange-deep)); color: #fff; border-color: transparent; }
.btn--ghost   { background: transparent; box-shadow: none; }
.btn--danger  { background: rgba(192,57,43,.08); color: var(--danger); border-color: rgba(192,57,43,.3); }
.btn--sm      { padding: 6px 11px; font-size: 12.5px; border-radius: 9px; min-width: 40px; min-height: 40px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ==========================================================================
   Forms
   ========================================================================== */
.field { margin-bottom: 10px; }
.field > label, .label {
  display: block; margin-bottom: 4px;
  font-size: 12px; font-weight: 650; color: var(--ink-soft);
}
.field .hint { font-size: 11.5px; color: var(--ink-faint); margin-top: 4px; }
.req { color: var(--ey-orange-deep); }

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="number"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.5;
}

.course-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}
.course-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.course-group__title {
  font-size: 10px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 0 2px;
}
.course-group__items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.choice {
  display: block;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255,255,255,.54);
  transition: border-color .15s, background .15s, box-shadow .15s;
  box-sizing: border-box;
}
.choice input {
  display: block;
  width: 100%;
  margin: 0 0 5px;
  accent-color: var(--ey-blue);
}
.choice.is-selected {
  border-color: rgba(21,103,174,.38);
  background: rgba(21,103,174,.08);
  box-shadow: inset 0 0 0 1px rgba(21,103,174,.08);
}
.choice__body {
  display: block;
  width: 100%;
}
.choice__title {
  display: block;
  width: 100%;
  font-weight: 650;
  color: var(--ink);
  line-height: 1.2;
}
.choice__meta {
  display: none;
}
.selected-course-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 22px;
}
.selected-course-list--compact {
  padding: 2px 0 4px;
}
.course-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(21,103,174,.10);
  border: 1px solid rgba(21,103,174,.18);
  color: var(--ey-blue-deep);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}
.course-pill .mono {
  font-size: 11.5px;
  letter-spacing: .02em;
}
.empty-inline {
  font-size: 12px;
  color: var(--ink-faint);
}

.student-profile {
  gap: 12px;
}
.student-profile__stack {
  gap: 12px;
}
.student-profile .panel__head {
  padding: 10px 14px;
}
.student-profile .panel__body {
  padding: 12px 14px;
}
.student-profile .panel__foot {
  padding: 10px 14px;
}
.student-profile .section-head {
  margin: 12px 0 8px;
  padding-bottom: 6px;
}
.student-profile .dl > dt,
.student-profile .dl > dd {
  padding-top: 6px;
  padding-bottom: 6px;
}
.student-profile .selected-course-list--compact {
  padding: 0 0 2px;
}
.student-profile .course-pill {
  padding: 5px 8px;
  font-size: 11.5px;
}
.student-profile .tablewrap th,
.student-profile .tablewrap td {
  padding-top: 8px;
  padding-bottom: 8px;
}

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], input[type=time], input[type=month], input[type=search],
input[type=tel], select, textarea {
  width: 100%; padding: 9px 12px;
  font-family: inherit; font-size: 14px; color: var(--ink);
  background: rgba(255,255,255,.82);
  border: 1px solid rgba(20,35,29,.16);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input:hover, select:hover, textarea:hover { border-color: rgba(20,35,29,.28); }
input:focus, select:focus, textarea:focus {
  outline: none; background: #fff;
  border-color: var(--ey-blue);
  box-shadow: 0 0 0 3.5px rgba(21,103,174,.14);
}
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%235A6B64' d='M1 1l5 5 5-5'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
input[type=file] { padding: 7px; background: rgba(255,255,255,.6); }
input[readonly] { background: rgba(20,35,29,.05); color: var(--ink-soft); }

.formgrid { display: grid; gap: 0 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.formgrid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span2 { grid-column: 1 / -1; }

fieldset { border: 0; padding: 0; margin: 0 0 6px; }
legend { padding: 0; }
.section-head {
  display: flex; align-items: center; gap: 9px;
  margin: 20px 0 12px; padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
}
.section-head:first-child { margin-top: 0; }
.section-head span:first-child {
  width: 3px; height: 15px; border-radius: 3px; background: var(--ey-green); flex: none;
}

.toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.toolbar .field { margin: 0; }
.toolbar .grow { flex: 1; min-width: 170px; }

/* Attendance radio pills */
.att { display: flex; gap: 5px; }
.att input { position: absolute; opacity: 0; width: 0; height: 0; }
.att label {
  min-width: 34px; padding: 5px 0; text-align: center;
  border: 1px solid var(--line); border-radius: 9px;
  font-size: 12px; font-weight: 700; cursor: pointer;
  background: rgba(255,255,255,.7); color: var(--ink-soft);
  transition: all .13s;
}
.att input:focus-visible + label { outline: 2.5px solid var(--ey-blue); outline-offset: 1px; }
.att input:checked + label { color: #fff; border-color: transparent; }
.att input[value=P]:checked + label { background: var(--ey-green); }
.att input[value=L]:checked + label { background: var(--ey-orange); }
.att input[value=E]:checked + label { background: var(--ey-blue); }
.att input[value=A]:checked + label { background: #6B7A74; }

/* ── Alerts ─────────────────────────────────────────────────────────────── */
.alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); font-size: 13.5px;
  margin-bottom: 14px;
  background: var(--glass-solid);
}
.alert strong { font-weight: 650; }
.alert--ok    { background: rgba(23,145,90,.1);  border-color: rgba(23,145,90,.28);  color: var(--ey-green-deep); }
.alert--warn  { background: rgba(238,122,27,.12); border-color: rgba(238,122,27,.3); color: var(--ey-orange-deep); }
.alert--error { background: rgba(192,57,43,.09); border-color: rgba(192,57,43,.28);  color: var(--danger); }
.alert--info  { background: rgba(21,103,174,.09); border-color: rgba(21,103,174,.26); color: var(--ey-blue-deep); }

/* ── Empty states: an invitation, not a shrug ────────────────────────────── */
.empty { padding: 40px 24px; text-align: center; }
.empty__mark {
  width: 46px; height: 46px; margin: 0 auto 12px;
  border-radius: 14px; display: grid; place-items: center;
  background: rgba(255,255,255,.7); border: 1px solid var(--glass-edge);
  color: var(--ink-faint);
}
.empty h3 { margin-bottom: 4px; }
.empty p { color: var(--ink-soft); max-width: 44ch; margin: 0 auto 14px; }

/* ── Pager ──────────────────────────────────────────────────────────────── */
.pager { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 12px 18px; }
.pager__meta { font-size: 12px; color: var(--ink-soft); margin-right: auto; font-family: var(--mono); }
.pager__link {
  min-width: 31px; padding: 5px 8px; text-align: center;
  border: 1px solid var(--line); border-radius: 9px;
  font-size: 12.5px; font-family: var(--mono); color: var(--ink);
  background: rgba(255,255,255,.65);
}
.pager__link:hover { text-decoration: none; background: #fff; }
.pager__link.is-current { background: var(--ey-blue); color: #fff; border-color: transparent; font-weight: 700; }
.pager__gap { color: var(--ink-faint); padding: 0 2px; }

/* ── Definition rows (profile fields) ───────────────────────────────────── */
.dl { display: grid; grid-template-columns: 40% 60%; gap: 0; font-size: 13.5px; }
.dl > dt { padding: 8px 0; color: var(--ink-soft); border-bottom: 1px solid var(--line); font-size: 12.5px; }
.dl > dd { padding: 8px 0; margin: 0; border-bottom: 1px solid var(--line); font-weight: 550; }
.dl > dt:last-of-type, .dl > dd:last-of-type { border-bottom: 0; }

/* ── Tabs ───────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; padding: 0 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs a {
  padding: 10px 13px; font-size: 13px; font-weight: 600; color: var(--ink-soft);
  border-bottom: 2.5px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.is-active { color: var(--ey-blue-deep); border-bottom-color: var(--ey-blue); }

/* ── Timetable grid ─────────────────────────────────────────────────────── */
.tt { width: 100%; border-collapse: separate; border-spacing: 6px; font-size: 12.5px; }
.tt th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-faint); padding-bottom: 2px; }
.tt td { vertical-align: top; width: calc(100% / 6); }
.ttcard {
  border-radius: var(--radius-sm); padding: 8px 10px;
  background: rgba(255,255,255,.8); border: 1px solid var(--glass-edge);
  border-left: 3px solid var(--ey-green);
  box-shadow: var(--shadow-sm); margin-bottom: 6px;
}
.ttcard__time { font-family: var(--mono); font-size: 11px; color: var(--ink-soft); }
.ttcard__subject { font-weight: 650; line-height: 1.25; }
.ttcard__meta { font-size: 11px; color: var(--ink-soft); }
.ttcard--blue { border-left-color: var(--ey-blue); }
.ttcard--orange { border-left-color: var(--ey-orange); }

/* ==========================================================================
   Auth screen
   ========================================================================== */
.authwrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.authcard {
  width: 100%; max-width: 400px;
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 70px -30px rgba(20,35,29,.45);
  overflow: hidden;
}
.authcard__body { padding: 26px 26px 22px; }
.authcard__mark {
  width: 54px; height: 54px; border-radius: 17px; margin-bottom: 14px;
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 18px;
  background: linear-gradient(145deg, var(--ey-orange), var(--ey-green) 55%, var(--ey-blue));
  box-shadow: 0 10px 24px -10px rgba(20,35,29,.6);
}
.authcard__foot { padding: 14px 26px; border-top: 1px solid var(--line); background: rgba(255,255,255,.42); font-size: 12px; color: var(--ink-soft); }

/* ==========================================================================
   Responsive — the rail becomes a drawer
   ========================================================================== */
@media (max-width: 1080px) {
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--sidebar { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .rail {
    position: fixed; inset: 0 auto 0 0;
    transform: translateX(-102%);
    transition: transform .22s ease;
    box-shadow: 0 0 60px rgba(20,35,29,.4);
  }
  body.nav-open .rail { transform: none; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .scrim {
    position: fixed; inset: 0; z-index: 35;
    background: rgba(20,35,29,.35);
    backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity .2s;
    border: 0; padding: 0;
  }
  .burger { display: inline-flex; order: 1; }
  .content { padding: 16px 14px 40px; }
  .topbar {
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 10px 12px;
  }
  .topbar__title {
    order: 2;
    flex: 1 1 auto;
    min-width: 0;
  }
  .topbar__title h1 {
    font-size: 16.5px;
    line-height: 1.25;
    word-break: break-word;
  }
  .topbar__title .tiny {
    font-size: 11.5px;
    line-height: 1.4;
    word-break: break-word;
  }
  .topbar .userchip {
    order: 3;
    margin-left: auto;
    flex-shrink: 0;
  }
  .topbar > a[href*="logout"] {
    order: 4;
    flex-shrink: 0;
  }
  .topbar > .btnrow {
    order: 5;
    flex-basis: 100%;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding-top: 8px;
    margin-top: 2px;
    border-top: 1px solid var(--line);
  }
  .topbar > .btnrow form {
    display: inline-flex;
    margin: 0;
  }
  .topbar > .btnrow .btn {
    padding: 7px 12px;
    font-size: 12.5px;
  }
  .grid--2, .grid--3, .grid--4 { grid-template-columns: minmax(0, 1fr); }
  .formgrid, .formgrid--3 { grid-template-columns: minmax(0, 1fr); }
  .panel__head { padding: 12px 14px; }
  .panel__body { padding: 14px; }
  .panel__foot { padding: 10px 14px; }
  .section-head { margin: 18px 0 10px; }
  .field { margin-bottom: 8px; }
  .course-picker { max-height: 240px; gap: 6px; }
  .course-group__items { gap: 5px; }
  .choice { padding: 5px 7px; }
  .userchip__name, .userchip__role { display: none; }
  .userchip { padding: 4px; }
  .dl { grid-template-columns: minmax(0, 1fr); }
  .dl > dt { padding-bottom: 0; border-bottom: 0; }
  .dl > dd { padding-top: 2px; }
  .stat__value { font-size: 25px; }
  table.data th { position: static; }
  .tt, .tt tbody, .tt tr, .tt td, .tt th { display: block; width: auto; }
  .tt thead { display: none; }
  .tt td { margin-bottom: 10px; }
  .tt td:empty { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ==========================================================================
   Print — screen furniture disappears, documents remain
   ========================================================================== */
@media print {
  .rail, .topbar, .scrim, .no-print, .btnrow, .toolbar, .pager { display: none !important; }
  body { background: #fff; }
  body::before, body::after { display: none; }
  .shell { display: block; }
  .content { padding: 0; max-width: none; }
  .panel { border: 0; box-shadow: none; background: #fff; backdrop-filter: none; }
  table.data th { background: #f0f0f0 !important; color: #000; }
  a { color: #000; text-decoration: none; }
}

/* Big blunt number inputs — used by the kitchen daily count */
input.bignum {
  font-family: var(--mono); font-size: 30px; font-weight: 600; letter-spacing: -.02em;
  text-align: center; padding: 10px 12px; font-variant-numeric: tabular-nums;
}

/* Totals row on data tables */
table.data tfoot th {
  position: static; background: rgba(20,35,29,.045); color: var(--ink);
  font-size: 12.5px; text-transform: none; letter-spacing: 0; border-top: 1px solid var(--line);
}

/* Inline checkbox rows */
.check {
  display: flex; align-items: flex-start; gap: 9px; margin: 12px 0 4px;
  font-size: 13px; color: var(--ink-soft); cursor: pointer; line-height: 1.5;
}
.check input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--ey-green); flex: 0 0 auto; }
.check:hover { color: var(--ink); }

/* Photo / camera controls */
.photo-panel img.photo-preview-large, .photo-panel video.photo-preview-large { width:100%; max-width:150px; border-radius:12px; border:1px solid var(--glass-edge); margin-bottom:10px; display:block; object-fit:cover; }
.cam-area { display:flex; gap:12px; align-items:flex-start; }
.cam-video, .cam-canvas, .photo-preview { border-radius:8px; }
.cam-video { background:#111; width:160px; height:120px; display:none; border-radius:8px; object-fit:cover; }
.cam-canvas { display:none; }
.photo-preview { width:100%; max-width:160px; border-radius:8px; border:1px solid var(--glass-edge); display:none; object-fit:cover; }
.cam-controls { flex:0 0 120px; display:flex; flex-direction:column; gap:8px; align-items:flex-start; }
.cam-controls .btn { width:100%; }
.photo-controls-wrap { margin-top:12px; }

.cam-media { flex: 0 0 160px; }
.photo-hint { margin: 6px 0 0; }

/* Passport size helper - displayed in pixels for capture area */
.passport-size { width: 360px !important; height: 480px !important; max-width: 100%; }
@media (max-width: 600px) {
  .passport-size { width: 80vw !important; height: auto !important; }
}

@media (max-width: 600px) {
  .panel__head { padding: 11px 12px; }
  .panel__body { padding: 12px; }
  .panel__foot {
    flex-direction: column;
    align-items: stretch;
  }
  .panel__foot .btn {
    width: 100%;
    justify-content: center;
  }
  .field > label, .label { font-size: 11.5px; }
  input, select, textarea, button { font-size: 16px; }
  .course-picker { max-height: 220px; }
  .choice__title { font-size: 12.5px; }
  .cam-area { flex-direction: column; gap:10px; }
  .cam-video, .photo-preview { width:100%; max-width:100%; height:auto; }
  .cam-controls { flex-direction:row; gap:8px; }
  .cam-controls .btn { flex:1; }
}

/* Fullscreen camera view for mobile */
.cam-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 9999 !important;
  border-radius: 0 !important;
  object-fit: cover !important;
  background: #000 !important;
}

.cam-fullscreen + .cam-controls { display: none !important; }


/* ==========================================================================
   Timetable — responsive views (grid on wide screens, day cards on phones)
   ========================================================================== */
.timetable-adv-wrap { scrollbar-width: thin; }
.timetable-adv-wrap::-webkit-scrollbar { display: block; height: 8px; }
.timetable-adv-wrap::-webkit-scrollbar-thumb { background: rgba(20,35,29,.18); border-radius: 8px; }
.timetable-adv .time-col,
.timetable-adv th.time-head {
  position: sticky; left: 0; z-index: 2;
  background: #fff;
  box-shadow: 1px 0 0 rgba(20,35,29,.08);
}
.timetable-adv th.time-head { background: #EAF6FF; }
.timetable-adv .tt-entry__subject { overflow-wrap: anywhere; }

.tt-switch { display: none; gap: 6px; margin-bottom: 12px; }
.tt-switch .btn.is-active { background: var(--ey-blue); color: #fff; border-color: var(--ey-blue); }
.tt-mobile { display: none; }

.tt-day {
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
  margin-bottom: 12px; overflow: hidden;
}
.tt-day__head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 12px; font-size: 12px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: #0E4C83;
  background: linear-gradient(180deg,#EAF6FF,#DCEFFB);
}
.tt-day--friday .tt-day__head { color: #C85E0A; background: linear-gradient(180deg,#FDECEA,#F8E2E0); }
.tt-day.is-today { border-color: var(--ey-blue); box-shadow: 0 0 0 2px rgba(21,103,174,.12); }
.tt-day__today {
  font-size: 10px; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px;
  background: var(--ey-blue); color: #fff;
}
.tt-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 12px; border-top: 1px solid var(--line);
}
.tt-day__head + .tt-item { border-top: 0; }
.tt-item__time {
  flex: 0 0 52px; font-size: 12px; line-height: 1.35; font-weight: 700; color: var(--ink-soft);
}
.tt-item__body { flex: 1; min-width: 0; }
.tt-item__title { font-weight: 650; font-size: 14px; overflow-wrap: anywhere; }
.tt-item__meta {
  display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 3px;
  font-size: 12px; color: var(--ink-soft);
}
.tt-item__meta span { display: inline-flex; align-items: center; gap: 4px; }
.tt-item__actions { margin-top: 6px; }
.tt-item--fixed { background: #fdf5e6; }
.tt-item--fixed .tt-item__title { color: #b05010; font-weight: 600; }
.tt-item--talent { justify-content: center; flex-direction: column; align-items: center; text-align: center; background: #FFF6F5; }
.tt-item--talent .tt-item__title { color: #C85E0A; text-transform: uppercase; letter-spacing: .1em; }
.tt-item--talent .tt-item__meta { justify-content: center; }
.tt-item--empty { color: var(--ink-faint); font-size: 13px; font-style: italic; }

@media (max-width: 760px) {
  .tt-switch { display: flex; }
  .tt-views .tt-mobile { display: block; }
  .tt-views .timetable-adv-wrap { display: none; }
  .tt-views.show-grid .tt-mobile { display: none; }
  .tt-views.show-grid .timetable-adv-wrap { display: block; }
  .timetable-adv { font-size: 12.5px; min-width: 640px; }
  .timetable-adv th.time-head { width: 84px; }
  .timetable-adv .time-col { font-size: 10.5px; padding-left: 6px; white-space: normal; }
  .timetable-adv tbody td { padding: 6px; }
}
/* Without JavaScript the list view still shows on phones (grid stays hidden) */

.tt-global__dept { margin: 14px 0 8px; }
.tt-global__dept:first-child { margin-top: 0; }

/* ==========================================================================
   Data tables that turn into stacked cards on phones (add .stack-mobile)
   ========================================================================== */
@media (max-width: 640px) {
  .tablewrap--stack::after { display: none !important; }
  table.data.stack-mobile thead { display: none; }
  table.data.stack-mobile,
  table.data.stack-mobile tbody,
  table.data.stack-mobile tr,
  table.data.stack-mobile td { display: block; width: 100%; }
  table.data.stack-mobile tr {
    border: 1px solid var(--line); border-radius: 10px; background: #fff;
    margin: 0 0 10px; padding: 6px 0;
  }
  table.data.stack-mobile td {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 5px 12px !important; border: 0; white-space: normal; overflow-wrap: anywhere;
  }
  table.data.stack-mobile td::before {
    content: attr(data-label);
    flex: 0 0 86px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--ink-faint); padding-top: 2px;
  }
}

/* ==========================================================================
   Registration photo — webcam / phone camera
   ========================================================================== */
.photo-panel .photo-box {
  width: 150px; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden;
  border: 1px dashed rgba(20,35,29,.25); background: rgba(20,35,29,.03);
  display: grid; place-items: center; margin-bottom: 10px; position: relative;
}
.photo-panel .photo-box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-panel .photo-box__empty { font-size: 12px; color: var(--ink-faint); text-align: center; padding: 8px; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.photo-actions .btn { display: inline-flex; align-items: center; gap: 6px; }
.photo-file-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.photo-status { font-size: 12px; color: var(--ey-green-deep); margin-top: 4px; min-height: 1em; }
.photo-status.is-error { color: var(--danger); }

.cam-modal {
  position: fixed; inset: 0; z-index: 10000; display: none;
  background: rgba(10,16,13,.92);
  align-items: center; justify-content: center; padding: 16px;
}
.cam-modal.is-open { display: flex; }
.cam-modal__box {
  width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 12px; align-items: center;
}
.cam-modal__title { color: #fff; font-weight: 650; font-size: 15px; text-align: center; }
.cam-modal__stage {
  position: relative; width: 100%; max-width: 360px; aspect-ratio: 3 / 4;
  border-radius: 14px; overflow: hidden; background: #000;
}
.cam-modal__stage video,
.cam-modal__stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-modal__stage video.is-mirrored { transform: scaleX(-1); }
.cam-modal__guide {
  position: absolute; inset: 10% 16% 18%; border: 2px dashed rgba(255,255,255,.55);
  border-radius: 50% 50% 45% 45%; pointer-events: none;
}
.cam-modal__controls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; width: 100%; }
.cam-modal__controls .btn { min-width: 110px; justify-content: center; }
.cam-modal__controls .btn--light { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.3); }
.cam-modal__msg { color: #ffd9c2; font-size: 13px; text-align: center; min-height: 1em; }
body.cam-lock { overflow: hidden; }

@media (max-width: 600px) {
  .cam-modal { padding: 0; }
  .cam-modal__box { max-width: none; height: 100%; justify-content: center; padding: 12px; }
  .cam-modal__stage { max-width: none; width: 100%; max-height: 72vh; aspect-ratio: 3 / 4; }
  .cam-modal__controls .btn { flex: 1 1 40%; }
}
