/* ==========================================================================
   TEACHING ATLAS — "The Folio"
   A private academic archive: inked charcoal, oxblood, antique gold,
   grained ivory paper. Editorial serif for voice, grotesque for data.
   ========================================================================== */

:root {
  --ink:          #191C20;
  --ink-2:        #23272D;
  --ink-3:        #2E333B;
  --oxblood:      #8A1024;
  --oxblood-deep: #5E0A18;
  --oxblood-soft: rgba(138, 16, 36, 0.08);
  --gold:         #B08A3C;
  --gold-bright:  #C9A250;
  --gold-soft:    rgba(176, 138, 60, 0.16);
  --paper:        #F4EFE3;
  --paper-2:      #EFE7D3;
  --plate:        #FBF8F0;
  --line:         #DED2B8;
  --line-soft:    #E8DFC9;
  --text:         #2B2A25;
  --text-soft:    #7A7362;
  --green:        #557A46;
  --red:          #B23A48;
  --blue:         #657C8A;
  --slate:        #6B7280;
  --font-ui:      'Inter', system-ui, -apple-system, sans-serif;
  --font-serif:   'Fraunces', 'Iowan Old Style', Georgia, serif;
  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;
  --shadow-1: 0 1px 2px rgba(25, 28, 32, .05), 0 8px 24px rgba(25, 28, 32, .05);
  --shadow-2: 0 2px 4px rgba(25, 28, 32, .07), 0 18px 44px rgba(25, 28, 32, .10);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 640px at 88% -8%, rgba(176, 138, 60, .10), transparent 55%),
    radial-gradient(1000px 620px at -12% 108%, rgba(138, 16, 36, .07), transparent 52%),
    var(--paper);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14.5px;
  line-height: 1.55;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: var(--grain);
  pointer-events: none;
  z-index: 1000;
}

::selection { background: var(--oxblood); color: var(--paper); }

a { color: var(--oxblood); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

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

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; border: 2px solid var(--paper); }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* ==========================================================================
   SHELL
   ========================================================================== */
.shell { display: flex; min-height: 100vh; }
.main  { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ==========================================================================
   SIDEBAR — inked panel with gold hairline
   ========================================================================== */
.sidebar {
  width: 250px;
  flex-shrink: 0;
  background:
    linear-gradient(180deg, rgba(176,138,60,.06), transparent 30%),
    var(--ink);
  background-blend-mode: overlay;
  color: var(--paper);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(176, 138, 60, .22);
}
.sidebar::after {
  content: '';
  position: absolute;
  top: 0; right: -1px; bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, var(--gold) 0%, transparent 35%, transparent 65%, var(--gold) 100%);
  opacity: .5;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 20px 20px;
  border-bottom: 1px solid rgba(244, 239, 227, .07);
}

.brand { display: flex; align-items: center; gap: 12px; color: var(--paper); }
.brand:hover { text-decoration: none; }

.brand-seal {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #A31730, var(--oxblood-deep));
  color: var(--paper);
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 1px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1.5px rgba(244, 239, 227, .25), 0 2px 8px rgba(0,0,0,.35);
}
.brand-seal::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  border: 1px dashed rgba(244, 239, 227, .35);
}
.brand-seal-sm { width: 30px; height: 30px; font-size: 11px; }

.brand-name {
  display: block;
  font-family: var(--font-serif);
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: .3px;
}
.brand-sub {
  display: block;
  font-size: 9.5px;
  color: var(--gold-bright);
  letter-spacing: 2.2px;
  text-transform: uppercase;
  margin-top: 1px;
}

.nav-close {
  display: none;
  background: none;
  border: 1px solid rgba(244, 239, 227, .25);
  border-radius: 50%;
  width: 34px; height: 34px;
  color: var(--paper);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.sidebar-search {
  display: none; /* mobile drawer only */
  align-items: center;
  gap: 8px;
  margin: 16px 18px 4px;
  padding: 10px 14px;
  border: 1px solid rgba(244, 239, 227, .18);
  border-radius: 99px;
  color: rgba(244, 239, 227, .55);
}
.sidebar-search input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--paper);
  font-family: inherit;
  font-size: 14px;
  width: 100%;
}
.sidebar-search input::placeholder { color: rgba(244, 239, 227, .4); }

.sidenav {
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  counter-reset: nav;
  overflow-y: auto;
}
.sidenav-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 2.6px;
  text-transform: uppercase;
  color: rgba(244, 239, 227, .32);
  padding: 0 12px 10px;
}

.sidenav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 9px;
  color: rgba(244, 239, 227, .66);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: .2px;
  counter-increment: nav;
  transition: background .16s, color .16s;
}
.sidenav-link:hover { background: rgba(244, 239, 227, .06); color: var(--paper); text-decoration: none; }
.sidenav-icon { opacity: .75; flex-shrink: 0; }
.sidenav-link:hover .sidenav-icon { opacity: 1; }

.sidenav-link.is-active {
  background: linear-gradient(90deg, rgba(138,16,36,.9), rgba(138,16,36,.55));
  color: var(--paper);
}
.sidenav-link.is-active::before {
  content: '';
  position: absolute;
  left: -14px; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--gold-bright);
}
.sidenav-link.is-active .sidenav-icon { opacity: 1; }

.sidebar-foot {
  padding: 18px 22px 20px;
  font-size: 10.5px;
  line-height: 1.7;
  letter-spacing: .4px;
  color: rgba(244, 239, 227, .34);
  font-style: italic;
  font-family: var(--font-serif);
}
.foot-rule {
  display: block;
  width: 34px; height: 1px;
  background: var(--gold);
  opacity: .5;
  margin-bottom: 10px;
}

.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(25, 28, 32, .55);
  backdrop-filter: blur(2px);
  z-index: 90;
  opacity: 0;
  transition: opacity .2s;
}

/* ==========================================================================
   MOBILE APP BAR
   ========================================================================== */
.mobile-bar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 80;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--ink);
  color: var(--paper);
  border-bottom: 1px solid rgba(176, 138, 60, .35);
}
.mobile-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--paper);
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .3px;
}
.mobile-brand:hover { text-decoration: none; }
.nav-toggle, .mobile-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: 10px;
  background: rgba(244, 239, 227, .07);
  border: 1px solid rgba(244, 239, 227, .12);
  color: var(--paper);
  cursor: pointer;
}

/* ==========================================================================
   TOPBAR (desktop)
   ========================================================================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 36px;
  background: rgba(244, 239, 227, .82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  max-width: 440px;
  background: var(--plate);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 8px 16px;
  color: var(--text-soft);
  transition: border-color .15s, box-shadow .15s;
}
.topbar-search:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
.topbar-search input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
}
.search-kbd {
  font-family: var(--font-ui);
  font-size: 10.5px;
  color: var(--text-soft);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
  background: var(--paper);
}

.topbar-user { display: flex; align-items: center; gap: 14px; }
.topbar-user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: .2px;
}
.topbar-sep { width: 1px; height: 18px; background: var(--line); }
.topbar-icon { color: var(--text-soft); display: inline-flex; }
.topbar-icon:hover { color: var(--oxblood); }
.topbar-logout {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--oxblood);
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 99px;
  transition: background .15s, border-color .15s;
}
.topbar-logout:hover { background: var(--oxblood-soft); border-color: var(--oxblood); text-decoration: none; }

/* ==========================================================================
   CONTENT
   ========================================================================== */
.content {
  padding: 30px 36px 64px;
  max-width: 1420px;
  width: 100%;
  animation: pageIn .35s ease both;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 26px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.page-head::after {
  content: '';
  position: absolute;
  left: 0; bottom: -1px;
  width: 72px; height: 2px;
  background: linear-gradient(90deg, var(--gold), transparent);
}

.crumb {
  margin: 0 0 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 2.4px;
  text-transform: uppercase;
}
.crumb a { color: var(--text-soft); }
.crumb a:hover { color: var(--oxblood); }

.page-title {
  font-family: var(--font-serif);
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 600;
  margin: 0;
  color: var(--ink);
  letter-spacing: .2px;
  line-height: 1.12;
}
.page-sub { margin: 6px 0 0; color: var(--text-soft); font-size: 13.5px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ==========================================================================
   KPI PLATES — framed ledger plates with serif numerals
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}
.kpi-grid-6 { grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); }

.kpi-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--plate);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px 18px 15px;
  box-shadow: var(--shadow-1);
  color: var(--text);
  overflow: hidden;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s;
}
.kpi-card::before {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(176, 138, 60, .18);
  border-radius: calc(var(--r-md) - 5px);
  pointer-events: none;
}
.kpi-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--kpi-tone, var(--slate));
}
a.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-2);
  border-color: var(--gold);
  text-decoration: none;
}

.kpi-value {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.05;
  font-variant-numeric: lining-nums;
}
.kpi-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  gap: 6px;
}
.kpi-label::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--kpi-tone, var(--slate));
  flex-shrink: 0;
}

.kpi-oxblood { --kpi-tone: var(--oxblood); }
.kpi-gold    { --kpi-tone: var(--gold); }
.kpi-green   { --kpi-tone: var(--green); }
.kpi-red     { --kpi-tone: var(--red); }
.kpi-blue    { --kpi-tone: var(--blue); }
.kpi-slate   { --kpi-tone: var(--slate); }
.kpi-muted   { --kpi-tone: var(--line); }

/* ==========================================================================
   CARDS
   ========================================================================== */
.card {
  position: relative;
  background: var(--plate);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: 22px 24px;
  margin-bottom: 24px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
  position: relative;
}
.card-head::after {
  content: '';
  position: absolute;
  left: 0; bottom: -1px;
  width: 44px; height: 2px;
  background: var(--gold);
}
.card-head h2 {
  font-family: var(--font-serif);
  font-size: 17.5px;
  font-weight: 600;
  margin: 0;
  color: var(--ink);
  letter-spacing: .2px;
}
.card-note { color: var(--text-soft); font-size: 13px; margin: 0 0 14px; }
.card-note code {
  background: var(--paper-2);
  padding: 1px 7px;
  border-radius: 5px;
  font-size: 12px;
  border: 1px solid var(--line-soft);
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; }

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  padding: 9px 18px;
  border-radius: 99px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .16s, border-color .16s, transform .12s, box-shadow .16s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: linear-gradient(180deg, #9A1830, var(--oxblood-deep));
  color: var(--paper);
  box-shadow: 0 2px 10px rgba(138, 16, 36, .28), inset 0 1px 0 rgba(255,255,255,.14);
}
.btn-primary:hover { background: linear-gradient(180deg, #A81C36, var(--oxblood)); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover { background: var(--paper-2); border-color: var(--gold); }

.btn-plain {
  background: transparent;
  color: var(--text-soft);
  padding-left: 10px;
  padding-right: 10px;
}
.btn-plain:hover { color: var(--oxblood); }

.btn-block { width: 100%; }

/* ==========================================================================
   FILTER BAR
   ========================================================================== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 22px;
  padding: 12px 14px;
  background: var(--plate);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
}
.filter-bar select {
  font-family: inherit;
  font-size: 13px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--paper);
  color: var(--text);
  max-width: 210px;
  cursor: pointer;
}
.filter-bar select:focus { outline: none; border-color: var(--gold); }
.filter-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-soft);
}
.filter-check input { accent-color: var(--oxblood); }

/* ==========================================================================
   TABLES — headers centred; data centred; long text left
   ========================================================================== */
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.table th, .table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
  text-align: center;              /* default: centred */
}
.table th {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-soft);
  background: var(--paper-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 2;
}
.table th:first-child { border-radius: 7px 0 0 7px; }
.table th:last-child  { border-radius: 0 7px 7px 0; }

/* Long text columns read better left-aligned */
.table td:has(.s-name),
.table td:has(.link-soft),
.table td.t-left,
.table td.note-cell { text-align: left; }

.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: rgba(176, 138, 60, .07); }
.table td.num, .table th.num { font-variant-numeric: tabular-nums; }

.table-sortable th { cursor: pointer; user-select: none; }
.table-sortable th:hover { color: var(--oxblood); }
.table-sortable th.sort-asc::after,
.table-sortable th.sort-desc::after {
  display: inline-block;
  margin-left: 5px;
  font-size: 8px;
  color: var(--gold);
}
.table-sortable th.sort-asc::after  { content: '▲'; }
.table-sortable th.sort-desc::after { content: '▼'; }

.link-strong { font-weight: 600; }
.link-soft { color: var(--text); }
.link-soft:hover { color: var(--oxblood); }

.empty-note { color: var(--text-soft); font-size: 13.5px; text-align: center; padding: 22px 0; font-style: italic; font-family: var(--font-serif); }
.note-cell { font-size: 12px; color: var(--text-soft); white-space: normal; }

/* ==========================================================================
   CHIPS & MARKS
   ========================================================================== */
.chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2.5px 10px;
  border-radius: 99px;
  letter-spacing: .4px;
  border: 1px solid;
}
.chip-gold  { background: var(--gold-soft);              border-color: rgba(176,138,60,.45);  color: #7E6226; }
.chip-green { background: rgba(85, 122, 70, .10);        border-color: rgba(85,122,70,.4);    color: var(--green); }
.chip-red   { background: rgba(178, 58, 72, .09);        border-color: rgba(178,58,72,.4);    color: var(--red); }
.chip-blue  { background: rgba(101, 124, 138, .12);      border-color: rgba(101,124,138,.4);  color: #4E6473; }
.chip-slate { background: rgba(107, 114, 128, .10);      border-color: rgba(107,114,128,.35); color: var(--slate); }
.chip-muted { background: rgba(107, 114, 128, .06);      border-color: var(--line);           color: var(--text-soft); }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.dot-gold { background: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }

.family-tag {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--gold);
  background: var(--gold-soft);
  border: 1px solid rgba(176, 138, 60, .35);
  padding: 3px 12px;
  border-radius: 99px;
}

/* ==========================================================================
   NAME PRIVACY
   ========================================================================== */
.s-name-mask { color: var(--text-soft); font-style: italic; font-family: var(--font-serif); font-size: 13px; }
.s-name-real { display: none; }
body.show-names .s-name-real { display: inline; }
body.show-names .s-name-mask { display: none; }

.name-toggle {
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 5px 14px;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.name-toggle:hover { color: var(--oxblood); border-color: var(--gold); background: var(--gold-soft); }

/* ==========================================================================
   CHARTS / ATTENTION
   ========================================================================== */
.chart-box { position: relative; height: 300px; }
.chart-box-short { height: 240px; }

.attention-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.attention-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--blue);
  background: var(--paper);
  color: var(--text);
  transition: background .15s, transform .15s, box-shadow .15s;
}
.attention-card:hover { background: var(--plate); text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-1); }
.attn-red  { border-left-color: var(--red); }
.attn-blue { border-left-color: var(--blue); }
.attn-title { font-weight: 700; font-size: 13px; color: var(--ink); }
.attn-body { font-size: 12.5px; color: var(--text-soft); }

/* ==========================================================================
   FORMS
   ========================================================================== */
.form-stack { display: flex; flex-direction: column; gap: 15px; }
.form-stack label, .login-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-soft);
}
.form-stack input, .form-stack select, .login-form input {
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text);
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  transition: border-color .15s, box-shadow .15s;
}
.form-stack input:focus, .form-stack select:focus, .login-form input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
  background: #FFFDF8;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-note { font-size: 12px; color: var(--text-soft); margin: 0; font-style: italic; }
.form-inline-actions { display: flex; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* ==========================================================================
   FLASH
   ========================================================================== */
.flash {
  padding: 12px 18px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 18px;
  border: 1px solid;
  border-left-width: 3px;
}
.flash-success { background: rgba(85, 122, 70, .08); border-color: rgba(85, 122, 70, .35); color: var(--green); }
.flash-error   { background: rgba(178, 58, 72, .07); border-color: rgba(178, 58, 72, .35); color: var(--red); }

/* ==========================================================================
   DRAWERS / MODALS
   ========================================================================== */
.drawer {
  position: fixed;
  inset: 0;
  background: rgba(25, 28, 32, .5);
  backdrop-filter: blur(3px);
  z-index: 100;
  display: flex;
  justify-content: flex-end;
}
.drawer[hidden] { display: none; }

.drawer-panel {
  background: var(--plate);
  width: 430px;
  max-width: 94vw;
  height: 100%;
  overflow-y: auto;
  padding: 26px 28px 44px;
  box-shadow: -16px 0 48px rgba(25, 28, 32, .3);
  animation: slideIn .22s cubic-bezier(.2, .8, .3, 1);
  border-left: 1px solid var(--gold);
}
.drawer-wide { width: 720px; }
.drawer-modal { justify-content: center; align-items: center; padding: 16px; }
.drawer-modal .drawer-panel {
  height: auto;
  max-height: 92vh;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  animation: fadeUp .2s ease;
}

@keyframes slideIn { from { transform: translateX(36px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeUp  { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }

.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}
.drawer-head h2 { font-family: var(--font-serif); font-size: 20px; font-weight: 600; margin: 0; color: var(--ink); }
.drawer-sub { font-size: 13px; color: var(--gold); font-family: var(--font-ui); font-weight: 600; }
.drawer-close {
  background: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 32px; height: 32px;
  font-size: 20px;
  line-height: 1;
  color: var(--text-soft);
  cursor: pointer;
}
.drawer-close:hover { color: var(--oxblood); border-color: var(--oxblood); }

.row-edit {
  background: none;
  border: 1px solid transparent;
  border-radius: 99px;
  color: var(--text-soft);
  cursor: pointer;
  padding: 5px 8px;
  display: inline-flex;
  transition: color .15s, border-color .15s, background .15s;
}
.row-edit:hover { color: var(--oxblood); border-color: var(--gold); background: var(--gold-soft); }

/* ==========================================================================
   PROFILE
   ========================================================================== */
.profile-head { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.profile-photo-wrap { position: relative; flex-shrink: 0; }
.profile-photo {
  width: 104px; height: 104px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 3px solid var(--plate);
  outline: 1px solid var(--gold);
  outline-offset: 3px;
  box-shadow: var(--shadow-2);
}
.profile-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 34% 30%, #A31730, var(--oxblood-deep));
  color: var(--paper);
  font-family: var(--font-serif);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: 1px;
}
.photo-edit {
  position: absolute;
  right: -2px; bottom: -2px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--plate);
  border: 1px solid var(--line);
  color: var(--text-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-1);
}
.photo-edit:hover { color: var(--oxblood); border-color: var(--gold); }

.profile-id { flex: 1; min-width: 220px; }
.profile-meta { margin: 6px 0 2px; font-size: 14px; color: var(--text-soft); }
.profile-matric {
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 1.5px;
  font-variant-numeric: tabular-nums;
}
.profile-contact { margin: 0; font-size: 13px; color: var(--text-soft); }

/* ==========================================================================
   CROP MODAL
   ========================================================================== */
.crop-flow { display: flex; flex-direction: column; gap: 16px; }
.crop-pick { align-self: flex-start; }
.crop-stage { display: grid; grid-template-columns: 1fr 190px; gap: 20px; }
.crop-canvas-wrap { max-height: 420px; overflow: hidden; background: var(--paper-2); border-radius: var(--r-md); }
.crop-canvas-wrap img { max-width: 100%; display: block; }
.crop-side { display: flex; flex-direction: column; gap: 10px; }
.crop-hint { font-size: 12px; color: var(--text-soft); margin: 0; font-style: italic; }
.crop-zoom { display: flex; gap: 8px; }
.crop-preview {
  width: 120px; height: 120px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--plate);
  outline: 1px solid var(--gold);
  outline-offset: 2px;
  background: var(--paper-2);
}
.crop-preview img { max-width: none; }
.crop-status { font-size: 12.5px; color: var(--green); margin: 0; min-height: 18px; }

/* ==========================================================================
   MISC
   ========================================================================== */
.plain-list { margin: 0; padding-left: 20px; }
.plain-list li { margin-bottom: 7px; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.course-family { margin-bottom: 24px; }

/* ==========================================================================
   LOGIN — split folio
   ========================================================================== */
.login-body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink);
}
.login-body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: var(--grain);
  pointer-events: none;
  z-index: 1000;
}

.login-split { display: flex; min-height: 100vh; }

.login-hero {
  flex: 1.1;
  background:
    radial-gradient(900px 700px at 20% 10%, rgba(138, 16, 36, .35), transparent 60%),
    radial-gradient(700px 600px at 90% 100%, rgba(176, 138, 60, .16), transparent 55%),
    var(--ink);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}
.hero-frame {
  border: 1px solid rgba(176, 138, 60, .4);
  border-radius: 4px;
  padding: 10px;
  max-width: 460px;
  width: 100%;
}
.hero-inner {
  border: 1px solid rgba(176, 138, 60, .2);
  border-radius: 2px;
  padding: 56px 44px;
  text-align: center;
}
.hero-seal {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 76px; height: 76px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #A31730, var(--oxblood-deep));
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 2px;
  margin-bottom: 30px;
  box-shadow: inset 0 0 0 2px rgba(244, 239, 227, .25), 0 6px 24px rgba(0,0,0,.45);
}
.hero-seal::after {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  border: 1px dashed rgba(244, 239, 227, .35);
}
.hero-kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--gold-bright);
  margin: 0 0 14px;
}
.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(40px, 5vw, 56px);
  font-weight: 600;
  line-height: 1.02;
  margin: 0 0 18px;
  letter-spacing: .5px;
}
.hero-title em {
  font-style: italic;
  font-weight: 500;
  color: var(--gold-bright);
}
.hero-tag {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 14.5px;
  line-height: 1.7;
  color: rgba(244, 239, 227, .6);
  margin: 0 0 26px;
}
.hero-rule { display: flex; justify-content: center; margin-bottom: 22px; }
.hero-rule span {
  width: 54px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.hero-meta {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 2.6px;
  text-transform: uppercase;
  color: rgba(244, 239, 227, .42);
  margin: 0;
}

.login-panel {
  flex: 1;
  background:
    radial-gradient(800px 500px at 80% 0%, rgba(176, 138, 60, .1), transparent 55%),
    var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
}
.login-box { width: 100%; max-width: 360px; }
.login-kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 8px;
}
.login-heading {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 26px;
}
.login-form { display: flex; flex-direction: column; gap: 17px; }
.login-form .btn-block { margin-top: 6px; padding: 12px 18px; }
.login-foot {
  font-family: var(--font-serif);
  font-style: italic;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-soft);
  margin-top: 26px;
}

/* ==========================================================================
   RESPONSIVE — a dedicated mobile experience
   ========================================================================== */
@media (max-width: 1100px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .crop-stage { grid-template-columns: 1fr; }
  .drawer-wide { width: 560px; }
}

@media (max-width: 920px) {

  /* App bar replaces the desktop topbar */
  .mobile-bar { display: flex; }
  .topbar { display: none; }

  /* Sidebar becomes a full drawer */
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(84vw, 330px);
    height: 100dvh;
    z-index: 95;
    transform: translateX(-102%);
    transition: transform .26s cubic-bezier(.2, .8, .3, 1);
    box-shadow: 20px 0 60px rgba(0, 0, 0, .4);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .nav-backdrop { display: block; opacity: 1; }
  body.nav-open { overflow: hidden; }

  .nav-close { display: inline-flex; align-items: center; justify-content: center; }
  .sidebar-search { display: flex; }

  /* Drawer nav becomes a numbered serif index */
  .sidenav { padding: 20px 18px; gap: 4px; }
  .sidenav-label { padding: 0 6px 12px; }
  .sidenav-link {
    font-family: var(--font-serif);
    font-size: 19px;
    font-weight: 500;
    letter-spacing: .3px;
    padding: 11px 6px;
    border-radius: var(--r-sm);
    border-bottom: 1px solid rgba(244, 239, 227, .06);
    gap: 14px;
  }
  .sidenav-link::after {
    content: counter(nav, decimal-leading-zero);
    margin-left: auto;
    font-family: var(--font-ui);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: var(--gold-bright);
    opacity: .7;
  }
  .sidenav-link.is-active { background: rgba(138, 16, 36, .5); padding-left: 12px; }
  .sidenav-link.is-active::before { display: none; }

  /* Content rhythm */
  .content { padding: 20px 16px 72px; }
  .page-head { margin-bottom: 20px; padding-bottom: 14px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }

  /* KPIs: bold two-up plates */
  .kpi-grid, .kpi-grid-6 { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi-card { padding: 14px 14px 12px; }
  .kpi-value { font-size: 24px; }
  .kpi-label { font-size: 9px; letter-spacing: 1.1px; }

  .card { padding: 16px 16px; border-radius: var(--r-md); }
  .chart-box { height: 240px; }

  /* Filters scroll horizontally as a pill rail */
  .filter-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 10px 12px;
  }
  .filter-bar::-webkit-scrollbar { display: none; }
  .filter-bar select { flex-shrink: 0; max-width: none; }
  .filter-bar .btn, .filter-check { flex-shrink: 0; white-space: nowrap; }

  /* Tables: comfortable scroll with edge fade */
  .table-wrap {
    margin: 0 -16px;
    padding: 0 16px;
    -webkit-overflow-scrolling: touch;
    mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 14px), transparent);
  }
  .table { font-size: 12.5px; }
  .table th, .table td { padding: 9px 10px; }

  /* Full-width sheets instead of side drawers */
  .drawer { justify-content: center; align-items: flex-end; }
  .drawer-panel, .drawer-wide {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 88dvh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    border-left: none;
    border-top: 3px solid var(--gold);
    animation: sheetUp .24s cubic-bezier(.2, .8, .3, 1);
    padding: 22px 20px calc(30px + env(safe-area-inset-bottom));
  }
  @keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
  .drawer-modal .drawer-panel { border-radius: var(--r-lg) var(--r-lg) 0 0; }

  .form-row { grid-template-columns: 1fr; }

  .profile-head { gap: 16px; }
  .profile-photo { width: 84px; height: 84px; }
  .attention-grid { grid-template-columns: 1fr; }

  /* Login stacks: hero becomes a compact masthead */
  .login-split { flex-direction: column; }
  .login-hero { flex: none; padding: 30px 22px; }
  .hero-frame { max-width: 420px; }
  .hero-inner { padding: 30px 22px; }
  .hero-seal { width: 58px; height: 58px; font-size: 18px; margin-bottom: 18px; }
  .hero-title { font-size: 34px; }
  .hero-tag br { display: none; }
  .login-panel { flex: 1; padding: 34px 24px 48px; align-items: flex-start; }
}

@media (max-width: 380px) {
  .kpi-grid, .kpi-grid-6 { gap: 8px; }
  .kpi-value { font-size: 21px; }
}

/* ==========================================================================
   STUDENT PROFILE — social-style hero
   ========================================================================== */
.profile-hero {
  background: var(--plate);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  margin-bottom: 24px;
  overflow: hidden;
}

.hero-cover {
  position: relative;
  height: 200px;
  background:
    radial-gradient(720px 320px at 12% 0%, rgba(138, 16, 36, .55), transparent 60%),
    radial-gradient(560px 300px at 92% 110%, rgba(176, 138, 60, .3), transparent 55%),
    linear-gradient(180deg, var(--ink-2), var(--ink));
}
.hero-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--grain);
  opacity: .8;
}
/* Giant watermark of the matric number */
.hero-cover::after {
  content: attr(data-matric);
  position: absolute;
  right: 22px;
  bottom: -14px;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 600;
  font-size: 120px;
  line-height: 1;
  letter-spacing: 4px;
  color: transparent;
  -webkit-text-stroke: 1px rgba(176, 138, 60, .35);
  pointer-events: none;
  user-select: none;
}

.cover-edit {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  background: rgba(244, 239, 227, .1);
  border: 1px solid rgba(244, 239, 227, .3);
  color: var(--paper);
  backdrop-filter: blur(4px);
}
.cover-edit:hover { background: rgba(244, 239, 227, .2); border-color: var(--gold-bright); }

.hero-body {
  display: flex;
  align-items: flex-end;
  gap: 26px;
  padding: 0 30px 26px;
  flex-wrap: wrap;
}

.hero-avatar-wrap {
  position: relative;
  margin-top: -86px;
  flex-shrink: 0;
  z-index: 2;
}
.hero-avatar {
  display: block;
  width: 172px;
  height: 172px;
  border-radius: 50%;
  object-fit: cover;
  border: 5px solid var(--plate);
  outline: 2px solid var(--gold);
  outline-offset: 0;
  box-shadow: 0 14px 40px rgba(25, 28, 32, .35);
  background: var(--paper-2);
}
.hero-avatar-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 34% 28%, #A31730, var(--oxblood-deep));
  color: var(--paper);
  font-family: var(--font-serif);
  font-size: 56px;
  font-weight: 600;
  letter-spacing: 2px;
}
.photo-edit-lg {
  width: 40px;
  height: 40px;
  right: 6px;
  bottom: 6px;
  border: 1px solid var(--gold);
  color: var(--ink);
}
.photo-edit-lg:hover { background: var(--gold-soft); }

.hero-info { flex: 1; min-width: 240px; padding-bottom: 2px; }

.hero-name {
  font-family: var(--font-serif);
  font-size: clamp(26px, 3.2vw, 38px);
  font-weight: 600;
  color: var(--ink);
  margin: 12px 0 4px;
  line-height: 1.08;
  letter-spacing: .2px;
}
.hero-handle {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.hero-matric {
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 1.6px;
  font-variant-numeric: tabular-nums;
}
.hero-dot { color: var(--line); }

.hero-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 6px 14px;
}
.hero-chip svg { color: var(--gold); flex-shrink: 0; }
.hero-chip.is-empty { color: var(--text-soft); font-style: italic; }
.hero-chip.is-empty svg { color: var(--line); }

@media (max-width: 920px) {
  .hero-cover { height: 148px; }
  .hero-cover::after { font-size: 72px; right: 14px; bottom: -8px; }

  .hero-body {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0;
    padding: 0 18px 22px;
  }
  .hero-avatar-wrap { margin-top: -72px; }
  .hero-avatar { width: 140px; height: 140px; }
  .hero-avatar-initials { font-size: 44px; }

  .hero-info { padding-bottom: 0; min-width: 0; }
  .hero-name { margin-top: 14px; }
  .hero-handle { justify-content: center; }
  .hero-chips { justify-content: center; }
  .hero-chip { font-size: 12px; padding: 5px 12px; }

  .cover-edit { top: 12px; right: 12px; padding: 7px 14px; font-size: 10.5px; }
}

/* ==========================================================================
   STUDENT FOLIO — gallery portrait + letters
   ========================================================================== */
.folio {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  gap: 40px;
  margin-bottom: 30px;
  align-items: start;
}
.folio-side {
  position: sticky;
  top: 86px;
}

/* --- The frame: ink moulding, gold fillet, ivory mat, full square picture */
.portrait-frame {
  position: relative;
  margin: 0;
  background:
    linear-gradient(145deg, #2B3037, #16181C 55%, #23272D),
    var(--ink);
  padding: 15px;
  border-radius: 3px;
  box-shadow:
    0 24px 60px rgba(25, 28, 32, .35),
    0 4px 14px rgba(25, 28, 32, .25),
    inset 0 1px 0 rgba(244, 239, 227, .12);
}
.portrait-frame::before {
  content: '';
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(176, 138, 60, .75);
  border-radius: 1px;
  pointer-events: none;
  z-index: 2;
}
.portrait-mat {
  background: var(--plate);
  padding: 14px;
  box-shadow: inset 0 0 10px rgba(25, 28, 32, .12);
}
.portrait-img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--paper-2);
  box-shadow: inset 0 0 0 1px rgba(25, 28, 32, .18);
}
.portrait-vacant {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background:
    repeating-linear-gradient(45deg, transparent 0 14px, rgba(176, 138, 60, .05) 14px 15px),
    var(--paper-2);
  border: 1px dashed var(--line);
}
.vacant-initials {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 84px;
  font-weight: 600;
  letter-spacing: 6px;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--gold);
  line-height: 1;
}
.vacant-note {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 13px;
  color: var(--text-soft);
}
.portrait-edit {
  position: absolute;
  right: -12px;
  bottom: -12px;
  z-index: 3;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--plate);
  border: 1px solid var(--gold);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-2);
  transition: background .15s, transform .15s;
}
.portrait-edit:hover { background: var(--gold-soft); transform: scale(1.06); }

/* --- Brass placard under the frame */
.placard {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  margin: 18px auto 0;
  max-width: 86%;
  padding: 12px 18px 13px;
  text-align: center;
  background: linear-gradient(180deg, #C9A250, #A5813A 60%, #B99147);
  border-radius: 4px;
  border: 1px solid rgba(94, 10, 24, .25);
  box-shadow: inset 0 1px 0 rgba(255, 248, 230, .55), inset 0 -2px 4px rgba(94, 60, 10, .35), 0 6px 18px rgba(25, 28, 32, .18);
}
.placard-matric {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 2.5px;
  color: #3A2C10;
  font-variant-numeric: tabular-nums;
}
.placard-line { width: 46px; height: 1px; background: rgba(58, 44, 16, .45); }
.placard-prog {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: rgba(58, 44, 16, .8);
}

/* --- Identity block */
.folio-ident { margin-bottom: 26px; }
.folio-kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 3.4px;
  text-transform: uppercase;
  color: var(--gold);
  margin: 6px 0 10px;
}
.folio-name {
  font-family: var(--font-serif);
  font-size: clamp(30px, 3.6vw, 46px);
  font-weight: 600;
  line-height: 1.06;
  color: var(--ink);
  margin: 0 0 16px;
  letter-spacing: .2px;
  position: relative;
  padding-bottom: 16px;
}
.folio-name::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 84px; height: 2px;
  background: linear-gradient(90deg, var(--oxblood), var(--gold), transparent);
}
.chip-action {
  cursor: pointer;
  font-family: inherit;
  color: var(--oxblood);
  border-color: rgba(138, 16, 36, .35);
  background: var(--oxblood-soft);
  font-weight: 600;
}
.chip-action:hover { border-color: var(--oxblood); }
.chip-action svg { color: var(--oxblood); }

/* --- "In their own words" */
.intro-heading {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 19px;
  color: var(--ink);
  margin: 0 0 16px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.intro-count {
  font-family: var(--font-ui);
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--gold);
  background: var(--gold-soft);
  border: 1px solid rgba(176, 138, 60, .35);
  padding: 3px 10px;
  border-radius: 99px;
}

.intro-stack { display: flex; flex-direction: column; gap: 22px; }

.intro-letter {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 0 4px;
  background: var(--plate);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px 28px 22px 18px;
  box-shadow: var(--shadow-1);
  position: relative;
  overflow: hidden;
}
.intro-letter::after {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--gold), rgba(176, 138, 60, .15));
}
.intro-stack .intro-letter:nth-child(odd)::after {
  background: linear-gradient(180deg, var(--oxblood), rgba(138, 16, 36, .12));
}

.intro-rule { text-align: center; }
.intro-mark {
  font-family: var(--font-serif);
  font-size: 52px;
  line-height: .9;
  color: var(--gold);
  opacity: .85;
}
.intro-stack .intro-letter:nth-child(odd) .intro-mark { color: var(--oxblood); opacity: .55; }

.intro-body {
  font-family: var(--font-serif);
  font-size: 15.5px;
  line-height: 1.85;
  color: var(--text);
  overflow-wrap: anywhere;
}
.intro-body::first-letter {
  font-size: 1.6em;
  font-weight: 600;
  color: var(--oxblood);
}

/* Short intro → pull-quote treatment */
.intro-pull .intro-body {
  font-size: 18.5px;
  line-height: 1.75;
  font-style: italic;
  color: var(--ink);
}
.intro-pull .intro-body::first-letter { font-size: 1.3em; }

/* Long intro → clamp with a paper fade + reveal */
.intro-clamp:not(.is-open) .intro-body {
  max-height: 236px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 62%, transparent 98%);
  mask-image: linear-gradient(180deg, #000 62%, transparent 98%);
}
.intro-more {
  margin-top: 10px;
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-ui);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--oxblood);
  cursor: pointer;
  border-bottom: 1px solid rgba(138, 16, 36, .35);
  padding-bottom: 2px;
}
.intro-more:hover { color: var(--oxblood-deep); border-color: var(--oxblood-deep); }

.intro-cite {
  margin-top: 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.cite-dash { width: 26px; height: 1px; background: var(--gold); }
.intro-cite a { color: var(--text-soft); }
.intro-cite a:hover { color: var(--oxblood); }

/* No intro at all → quiet fleuron panel */
.intro-vacant {
  border: 1px dashed var(--line);
  border-radius: var(--r-lg);
  padding: 40px 30px;
  text-align: center;
  background: repeating-linear-gradient(45deg, transparent 0 18px, rgba(176, 138, 60, .04) 18px 19px);
}
.fleuron {
  display: block;
  font-size: 26px;
  color: var(--gold);
  margin-bottom: 12px;
}
.intro-vacant p {
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-soft);
  margin: 0;
}
.intro-vacant em { color: var(--gold); }

/* --- Folio responsive */
@media (max-width: 1100px) {
  .folio { grid-template-columns: minmax(280px, 340px) 1fr; gap: 28px; }
}
@media (max-width: 920px) {
  .folio { grid-template-columns: 1fr; gap: 6px; }
  .folio-side { position: static; max-width: 430px; margin: 0 auto; width: 100%; }
  .portrait-frame { padding: 12px; }
  .portrait-mat { padding: 10px; }
  .portrait-edit { right: 2px; bottom: 2px; }
  .placard { margin-top: 14px; }

  .folio-ident { text-align: center; margin: 24px 0 22px; }
  .folio-name { padding-bottom: 14px; }
  .folio-name::after { left: 50%; transform: translateX(-50%); background: linear-gradient(90deg, transparent, var(--gold), transparent); }
  .hero-chips { justify-content: center; }

  .intro-heading { justify-content: center; }
  .intro-letter { grid-template-columns: 34px 1fr; padding: 18px 18px 18px 12px; }
  .intro-mark { font-size: 38px; }
  .intro-body { font-size: 14.5px; }
  .intro-pull .intro-body { font-size: 16.5px; }
}

/* --- Portrait modal actions --- */
.crop-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: rgba(178, 58, 72, .4);
}
.btn-danger:hover { background: rgba(178, 58, 72, .08); border-color: var(--red); }

/* ==========================================================================
   SCROLL FIX — the portrait column no longer floats independently;
   the whole page scrolls as one piece.
   ========================================================================== */
.folio-side { position: static; }

/* --- Intro editing --- */
.form-stack textarea {
  font-family: var(--font-serif);
  font-size: 14.5px;
  line-height: 1.7;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  resize: vertical;
  min-height: 180px;
  transition: border-color .15s, box-shadow .15s;
}
.form-stack textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
  background: #FFFDF8;
}
.intro-edit { margin-left: auto; }
.intro-add { margin-top: 18px; }

/* ==========================================================================
   THE CLASS WALL — padlet, reimagined as an archive gallery
   ========================================================================== */
.wall { margin-bottom: 28px; }

.wall-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.wall-head::after {
  content: '';
  position: absolute;
  left: 0; bottom: -1px;
  width: 64px; height: 2px;
  background: linear-gradient(90deg, var(--oxblood), var(--gold), transparent);
}
.wall-kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 6px;
}
.wall-title {
  font-family: var(--font-serif);
  font-size: clamp(20px, 2.4vw, 27px);
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}
.wall-title em { font-style: italic; font-weight: 500; color: var(--oxblood); }
.wall-sub { margin: 5px 0 0; font-size: 13px; color: var(--text-soft); }

/* Masonry: cards flow into columns like a pinboard */
.wall-grid {
  columns: 3 320px;
  column-gap: 20px;
}
.wall-card {
  position: relative;
  display: inline-block;
  width: 100%;
  break-inside: avoid;
  margin-bottom: 20px;
  background: var(--plate);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px 18px 18px;
  box-shadow: var(--shadow-1);
  overflow: hidden;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s;
}
.wall-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-2);
  border-color: var(--gold);
}
.wall-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), rgba(176, 138, 60, .15));
}
.wall-grid .wall-card:nth-child(odd)::before {
  background: linear-gradient(90deg, var(--oxblood), rgba(138, 16, 36, .12));
}

/* Full picture, matted like the profile frame */
.wall-photo-mat {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  padding: 9px;
  margin-bottom: 14px;
  box-shadow: inset 0 0 8px rgba(25, 28, 32, .06);
}
.wall-photo {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--paper-2);
  box-shadow: inset 0 0 0 1px rgba(25, 28, 32, .14);
}
.wall-photo-vacant {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    repeating-linear-gradient(45deg, transparent 0 14px, rgba(176, 138, 60, .05) 14px 15px),
    var(--paper-2);
  border: 1px dashed var(--line);
}
.wall-photo-vacant .vacant-initials { font-size: 54px; }

.wall-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
}
.wall-name-link {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
}
.wall-name-link:hover { color: var(--oxblood); text-decoration: none; }
.wall-matric {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.6px;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.wall-body {
  font-size: 14px;
  line-height: 1.8;
}
.wall-card .intro-more { margin-top: 12px; }

/* Wall responsive */
@media (max-width: 1200px) { .wall-grid { columns: 2 300px; } }
@media (max-width: 920px) {
  .wall-grid { columns: 1; }
  .wall-card { padding: 12px 14px 16px; }
  .wall-name-link { font-size: 17px; }
}

/* Collapsible class wall */
.wall.is-collapsed .wall-grid { display: none; }
.wall.is-collapsed { margin-bottom: 24px; }
.wall.is-collapsed .wall-head { border-bottom-style: dashed; }

/* Intro paragraphs: a blank line reads as a small pause, not a chasm */
.intro-body p { margin: 0 0 0.7em; }
.intro-body p:last-child { margin-bottom: 0; }
.intro-body p:first-child::first-letter {
  font-size: 1.6em;
  font-weight: 600;
  color: var(--oxblood);
}
.intro-pull .intro-body p:first-child::first-letter { font-size: 1.3em; }

/* ==========================================================================
   TABLE FRAMES — proper bordered grid, softly ruled like a ledger
   ========================================================================== */
.table-wrap {
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--plate);
}
.table {
  border-collapse: separate;
  border-spacing: 0;
}
/* uniform type inside tables, no matter what lands in a cell */
.table th, .table td { font-size: 13px; line-height: 1.5; }
.table td a { font-size: inherit; }

.table th, .table td {
  border-bottom: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
}
.table th:last-child, .table td:last-child { border-right: none; }
.table tbody tr:last-child td { border-bottom: none; }

.table thead th {
  border-top: none;
  border-bottom: 1px solid var(--line);
}
.table th:first-child { border-radius: 11px 0 0 0; }
.table th:last-child  { border-radius: 0 11px 0 0; }
.table tbody tr:last-child td:first-child { border-radius: 0 0 0 11px; }
.table tbody tr:last-child td:last-child  { border-radius: 0 0 11px 0; }

/* gentle zebra so long tables stay readable */
.table tbody tr:nth-child(even) { background: rgba(239, 231, 215, 0.28); }
.table tbody tr:hover { background: rgba(176, 138, 60, 0.09); }

@media (max-width: 920px) {
  .table-wrap {
    margin: 0;
    padding: 0;
    -webkit-mask-image: none;
    mask-image: none;
  }
}

/* ==========================================================================
   BIRTHDAY CALENDAR
   ========================================================================== */
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin-bottom: 24px;
}
.cal-heading {
  font-family: var(--font-serif);
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 600;
  color: var(--ink);
  margin: 0;
  min-width: 220px;
  text-align: center;
}
.cal-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--plate);
  color: var(--text-soft);
  transition: color .15s, border-color .15s, background .15s;
}
.cal-arrow:hover { color: var(--oxblood); border-color: var(--gold); background: var(--gold-soft); text-decoration: none; }

/* --- Year view: twelve mini plates --- */
.cal-year {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}
.cal-mini {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--plate);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px 16px 12px;
  box-shadow: var(--shadow-1);
  color: var(--text);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.cal-mini:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-2);
  border-color: var(--gold);
  text-decoration: none;
}
.cal-mini-name {
  font-family: var(--font-serif);
  font-size: 15.5px;
  font-weight: 600;
  color: var(--ink);
}
.cal-mini-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}
.cal-mini-dow {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--text-soft);
  padding-bottom: 2px;
}
.cal-mini-day {
  position: relative;
  font-size: 10.5px;
  padding: 3px 0;
  border-radius: 6px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.cal-mini-day.has-bday {
  background: var(--gold-soft);
  color: #7E6226;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(176, 138, 60, .35);
}
.cal-mini-day.is-today {
  background: var(--oxblood);
  color: var(--paper);
  font-weight: 700;
}
.cal-mini-foot {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--gold);
  border-top: 1px solid var(--line-soft);
  padding-top: 8px;
}

/* --- Month view --- */
.cal-month { padding: 18px; }
.cal-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cal-dow {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-soft);
  padding: 6px 0 8px;
}
.cal-day {
  min-height: 96px;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 8px 9px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.cal-day-blank { background: transparent; border-style: dashed; opacity: .45; }
.cal-day.is-today {
  border-color: var(--oxblood);
  box-shadow: inset 0 0 0 1px var(--oxblood);
  background: rgba(138, 16, 36, .04);
}
.cal-day-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}
.cal-day.is-today .cal-day-num { color: var(--oxblood); }

.cal-avas { display: flex; flex-wrap: wrap; gap: 5px; }
.cal-ava {
  position: relative;
  display: inline-flex;
  width: 34px; height: 34px;
  border-radius: 50%;
  overflow: visible;
  flex-shrink: 0;
}
.cal-ava img, .cal-ava-init {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--plate);
  outline: 1px solid var(--gold);
  box-shadow: var(--shadow-1);
  transition: transform .14s;
}
.cal-ava-init {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 34% 30%, #A31730, var(--oxblood-deep));
  color: var(--paper);
  font-family: var(--font-serif);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .5px;
}
.cal-ava:hover img, .cal-ava:hover .cal-ava-init { transform: scale(1.15); }

/* elegant hover tooltip with the full name */
.cal-ava::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(3px);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
  padding: 5px 12px;
  border-radius: 99px;
  border: 1px solid rgba(176, 138, 60, .5);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s, transform .15s;
  z-index: 30;
}
.cal-ava:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 920px) {
  .cal-heading { min-width: 150px; }
  .cal-year { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .cal-mini { padding: 12px 10px 10px; }
  .cal-month { padding: 10px; }
  .cal-month-grid { gap: 3px; }
  .cal-dow { font-size: 8px; letter-spacing: .6px; }
  .cal-day { min-height: 58px; padding: 5px 5px; border-radius: 7px; }
  .cal-ava { width: 24px; height: 24px; }
  .cal-ava-init { font-size: 8.5px; }
}

/* ==========================================================================
   ACADEMIC CALENDAR — events, holidays, colour keys
   ========================================================================== */
:root {
  --t-teach:   #8A1024;   /* teaching — oxblood */
  --t-break:   #B08A3C;   /* breaks — gold */
  --t-study:   #657C8A;   /* study week — blue-grey */
  --t-exam:    #23272D;   /* examinations — ink */
  --t-reg:     #6B7280;   /* registration — slate */
  --t-holiday: #557A46;   /* public holidays — green */
  --t-other:   #7A7362;
}

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  justify-content: center;
  margin-bottom: 18px;
}
.cal-key {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--text-soft);
}
.cal-key i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.k-teach   { background: var(--t-teach); }
.k-break   { background: var(--t-break); }
.k-study   { background: var(--t-study); }
.k-exam    { background: var(--t-exam); }
.k-reg     { background: var(--t-reg); }
.k-holiday { background: var(--t-holiday); }
.k-bday    { background: transparent; border: 2px solid var(--gold); border-radius: 50%; width: 8px; height: 8px; }

/* --- Year view tints: whole-day background per dominant activity --- */
.cal-mini-day { position: relative; }
.cal-mini-day.t-teach   { background: rgba(138, 16, 36, .16); }
.cal-mini-day.t-break   { background: rgba(176, 138, 60, .22); }
.cal-mini-day.t-study   { background: rgba(101, 124, 138, .24); }
.cal-mini-day.t-exam    { background: rgba(35, 39, 45, .82); color: var(--paper); font-weight: 700; }
.cal-mini-day.t-reg     { background: rgba(107, 114, 128, .22); }
.cal-mini-day.t-holiday { background: rgba(85, 122, 70, .78); color: var(--paper); font-weight: 700; }
/* birthday: gold ring dot under the number */
.cal-mini-day.has-bday::after {
  content: '';
  position: absolute;
  left: 50%; bottom: 0;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--gold);
}
.cal-mini-day.is-today {
  outline: 2px solid var(--oxblood);
  outline-offset: -2px;
  font-weight: 700;
}
/* old highlight superseded by tints */
.cal-mini-day.has-bday { box-shadow: none; }

/* --- Month view: range bands + single-day pills --- */
.cal-day { overflow: visible; min-height: 108px; }

.cal-band {
  display: block;
  width: calc(100% + 20px);
  margin: 0 -10px;
  border: none;
  text-align: left;
  min-height: 17px;
  padding: 2px 10px;
  font-family: var(--font-ui);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .4px;
  color: #fff;
  cursor: pointer;
  border-radius: 0;
  opacity: .92;
  transition: opacity .12s, transform .12s;
}
.cal-band:hover { opacity: 1; transform: scaleY(1.12); }
.cal-band.band-start { border-radius: 99px 0 0 99px; margin-left: 0; width: calc(100% + 10px); }
.cal-band.band-end   { border-radius: 0 99px 99px 0; margin-right: 0; width: calc(100% + 10px); }
.cal-band.band-start.band-end { border-radius: 99px; margin: 0; width: 100%; }
.cal-band-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  max-width: 100%;
}

.cal-pill {
  display: block;
  width: 100%;
  border: none;
  text-align: left;
  padding: 3px 9px;
  border-radius: 7px;
  font-family: var(--font-ui);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .4px;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: .92;
  transition: opacity .12s, transform .12s;
}
.cal-pill:hover { opacity: 1; transform: translateY(-1px); }

.cal-band.t-teach,   .cal-pill.t-teach   { background: var(--t-teach); }
.cal-band.t-break,   .cal-pill.t-break   { background: var(--t-break); }
.cal-band.t-study,   .cal-pill.t-study   { background: var(--t-study); }
.cal-band.t-exam,    .cal-pill.t-exam    { background: var(--t-exam); }
.cal-band.t-reg,     .cal-pill.t-reg     { background: var(--t-reg); }
.cal-band.t-holiday, .cal-pill.t-holiday { background: var(--t-holiday); }
.cal-band.t-other,   .cal-pill.t-other   { background: var(--t-other); }

@media (max-width: 920px) {
  .cal-legend { gap: 8px 12px; }
  .cal-key { font-size: 9px; letter-spacing: .5px; }
  .cal-day { min-height: 74px; }
  .cal-band, .cal-pill { font-size: 8px; min-height: 13px; padding: 1.5px 6px; }
  .cal-band { width: calc(100% + 12px); margin: 0 -6px; }
  .cal-band.band-start, .cal-band.band-end { width: calc(100% + 6px); }
  .cal-band.band-start.band-end { width: 100%; }
}

/* ==========================================================================
   LEGEND FILTERS — click a key to hide/show that layer
   ========================================================================== */
button.cal-key {
  background: var(--plate);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 5px 13px;
  cursor: pointer;
  font-family: inherit;
  transition: opacity .15s, border-color .15s, background .15s;
}
button.cal-key:hover { border-color: var(--gold); background: var(--gold-soft); }
button.cal-key.is-off { opacity: .38; }
button.cal-key.is-off i { background: var(--line) !important; border-color: var(--line) !important; }

body.calhide-teach   .cal-band.t-teach,   body.calhide-teach   .cal-pill.t-teach   { display: none; }
body.calhide-break   .cal-band.t-break,   body.calhide-break   .cal-pill.t-break   { display: none; }
body.calhide-study   .cal-band.t-study,   body.calhide-study   .cal-pill.t-study   { display: none; }
body.calhide-exam    .cal-band.t-exam,    body.calhide-exam    .cal-pill.t-exam    { display: none; }
body.calhide-reg     .cal-band.t-reg,     body.calhide-reg     .cal-pill.t-reg     { display: none; }
body.calhide-holiday .cal-band.t-holiday, body.calhide-holiday .cal-pill.t-holiday { display: none; }

body.calhide-teach   .cal-mini-day.t-teach,
body.calhide-break   .cal-mini-day.t-break,
body.calhide-study   .cal-mini-day.t-study,
body.calhide-reg     .cal-mini-day.t-reg { background: transparent; }
body.calhide-exam    .cal-mini-day.t-exam    { background: transparent; color: var(--text); font-weight: 400; }
body.calhide-holiday .cal-mini-day.t-holiday { background: transparent; color: var(--text); font-weight: 400; }

body.calhide-bday .cal-avas { display: none; }
body.calhide-bday .cal-mini-day.has-bday::after { display: none; }

/* ==========================================================================
   ACADEMIC TABLES — collapsible semester schedules
   ========================================================================== */
.acad-sem {
  background: var(--plate);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  margin-bottom: 16px;
  overflow: hidden;
}
.acad-summary {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 22px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background .15s;
}
.acad-summary::-webkit-details-marker { display: none; }
.acad-summary:hover { background: var(--paper-2); }

.acad-code {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 700;
  color: var(--paper);
  background: radial-gradient(circle at 34% 30%, #A31730, var(--oxblood-deep));
  border-radius: 9px;
  padding: 6px 14px;
  letter-spacing: 1px;
  flex-shrink: 0;
}
.acad-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
}
.acad-title em { font-style: italic; font-weight: 500; color: var(--gold); }
.acad-meta {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-soft);
}
.acad-chevron { color: var(--text-soft); display: inline-flex; transition: transform .18s; }
.acad-sem[open] .acad-chevron { transform: rotate(180deg); }
.acad-sem[open] .acad-summary { border-bottom: 1px solid var(--line-soft); }

.acad-table { border: none; border-radius: 0; margin: 0; }
.acad-table .table th:first-child, .acad-table .table th:last-child { border-radius: 0; }
.acad-table .table td { white-space: normal; }
.acad-remarks ul { margin: 0; padding-left: 16px; }
.acad-remarks li { margin: 2px 0; font-size: 12.5px; color: var(--text-soft); }

@media (max-width: 920px) {
  .acad-summary { flex-wrap: wrap; gap: 10px; padding: 13px 14px; }
  .acad-meta { margin-left: 0; width: 100%; order: 4; }
  .acad-title { font-size: 15px; }
}

/* ==========================================================================
   OUTCOME CELLS — count + share, with a stacked distribution bar
   ========================================================================== */
.split-n {
  display: block;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: 1.2;
}
.split-pct {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .4px;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.dist-bar {
  display: inline-flex;
  width: 74px;
  height: 11px;
  border-radius: 99px;
  overflow: hidden;
  background: var(--paper-2);
  box-shadow: inset 0 0 0 1px var(--line-soft);
  vertical-align: middle;
}
/* Clear, high-contrast traffic-light scheme: green = A/A+, amber = other pass, red = fail */
.dist-bar i { display: block; height: 100%; }
.dist-bar .d-aa    { background: #2E7D4F; }
.dist-bar .d-other { background: #E0A32E; }
.dist-bar .d-fail  { background: #C0392B; }
.dist-bar i + i { box-shadow: inset 1px 0 0 rgba(255,255,255,.55); }
.dist-empty { opacity: .5; }

@media (max-width: 920px) {
  .dist-bar { width: 64px; }
}

/* ==========================================================================
   DENSE STAT TABLES — two-line headers, combined rows, fit-on-screen
   ========================================================================== */
/* Tighter header labels so multi-word/two-line headers stay compact */
.table thead th {
  letter-spacing: .4px;
  line-height: 1.25;
  vertical-align: middle;
}
.table th, .table td { padding: 9px 9px; }

/* Course-name column may wrap to two lines instead of forcing a wide column */
.table td.col-cname,
.table th.col-cname {
  white-space: normal;
  text-align: left;
  max-width: 190px;
  line-height: 1.3;
}

/* Combined (equivalent-course) aggregate row */
.table tbody tr.row-combined td {
  background: var(--gold-soft);
  font-weight: 600;
}
.table tbody tr.row-combined:hover td { background: rgba(176,138,60,.22); }
.combined-tag {
  display: inline-block;
  padding: 1px 7px;
  margin-right: 4px;
  border-radius: 99px;
  background: var(--oxblood);
  color: var(--paper);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  vertical-align: middle;
}
