/* ICT Course Portal: design tokens, base styles and components (doc 04) */
:root {
  --bg-start: #F4F5F0;
  --bg-end: #F0EDE4;
  --card: #FFFFFF;
  --text: #1B1B1B;
  --text-muted: #6B6B6B;
  --field-select: #EFEFEF;
  --border: #DCDCDC;
  --accent: #C9B893;
  --accent-hover: #BDAA7E;
  --accent-soft: #F8F9F4;
  --success: #2E7D32;
  --warning: #B26A00;
  --danger: #B3261E;
  --overlay: rgba(0, 0, 0, 0.35);
  --radius-card: 20px;
  --radius-control: 8px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Roboto, system-ui, -apple-system, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg-start), var(--bg-end));
  background-attachment: fixed;
}
h1 { font-size: 24px; font-weight: 700; margin: 0 0 8px; }
h2 { font-size: 20px; font-weight: 500; margin: 0 0 8px; }
h3 { font-size: 16px; font-weight: 500; margin: 0 0 8px; }
p { margin: 0 0 12px; }
a { color: var(--text); }
.muted { color: var(--text-muted); }
.hint { font-size: 14px; color: var(--text-muted); }
.center { text-align: center; }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap;
}
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; box-shadow: 0 0 0 4px var(--accent); }

/* Layout */
.container { width: 100%; max-width: 480px; margin: 0 auto; padding: 16px; }
.container-wide { max-width: 960px; }
.page-title { margin-top: 8px; }
.lead { color: var(--text-muted); }
.card {
  background: var(--card);
  border-radius: var(--radius-card);
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
@media (max-width: 599px) {
  .card.sheet {
    border-radius: var(--radius-card) var(--radius-card) 0 0;
    margin: 0 -16px;
    padding: 24px 16px 32px;
  }
}

/* Header and footer */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; min-height: 64px;
}
.brand { font-weight: 700; font-size: 18px; text-decoration: none; }
.header-link { font-size: 14px; color: var(--text-muted); text-decoration: none; padding: 12px 8px; }
.header-link:hover { text-decoration: underline; }
.site-footer { text-align: center; padding: 24px 16px; font-size: 14px; color: var(--text-muted); }

/* Public page shell: header on the page background, then a white sheet that holds the content and footer */
.page { display: flex; flex-direction: column; min-height: 100vh; }
.sheet-page {
  flex: 1; width: 100%; display: flex; flex-direction: column;
  background: #fff; padding: 32px 16px 0;
  border-radius: var(--radius-card) var(--radius-card) 0 0;
}
.sheet-page > main { flex: 1; }
.sheet-page .page-title { margin-top: 0; }
.site-footer-line {
  margin: 32px -16px 0; padding: 24px 16px; text-align: center;
  border-top: 1px solid var(--border); font-size: 14px; color: var(--text-muted);
}
.site-footer-line p { margin: 0; }
.divider { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }
@media (min-width: 600px) {
  .site-header { width: 100%; max-width: 640px; margin: 0 auto; }
  .sheet-page {
    flex: none; max-width: 640px; margin: 0 auto 32px; padding: 32px 32px 0;
    border-radius: var(--radius-card);
  }
  .site-footer-line { margin: 32px -32px 0; }
}

/* Home option cards */
.home-cards { display: flex; flex-direction: column; gap: 12px; margin: 24px 0; }
.option-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 48px; padding: 16px; background: #fff; border: 1px solid var(--border);
  border-radius: 16px; text-decoration: none; color: var(--text);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.option-card:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); border-color: var(--accent); }
.option-card-primary { background: var(--accent-soft); border-color: var(--accent); padding: 20px 16px; }
.option-title { display: block; font-size: 18px; font-weight: 500; }
.option-card-primary .option-title { font-size: 22px; }
.option-text { display: block; margin-top: 4px; color: var(--text-muted); }
.option-chevron { flex-shrink: 0; width: 24px; height: 24px; }
.token-section h2 { margin-bottom: 4px; }
.token-section .btn { gap: 12px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 20px; border: 1px solid transparent;
  border-radius: var(--radius-control); font: inherit; font-weight: 500;
  cursor: pointer; text-decoration: none; transition: background-color 0.15s;
}
.btn-primary { background: var(--accent); color: var(--text); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--accent-soft); }
.btn-danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn:disabled, .btn[aria-disabled="true"] {
  background: var(--accent-soft); color: #8A8A8A; border-color: var(--border); cursor: not-allowed;
}
.btn-block { width: 100%; }
.btn-small { min-height: 40px; padding: 8px 14px; font-size: 14px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* Fields */
.field { margin-bottom: 24px; }
.field label { display: block; font-weight: 500; margin-bottom: 8px; }
.input, .select, .textarea {
  display: block; width: 100%; min-height: 48px; padding: 12px 16px;
  font: inherit; color: var(--text); background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius-control);
}
.textarea { min-height: 96px; resize: vertical; }
.select {
  background-color: var(--field-select);
  -webkit-appearance: none; appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231B1B1B' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center;
}
.input.invalid, .select.invalid { border-color: var(--danger); }
.field-error { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; font-size: 15px; color: var(--danger); }
.field-error::before {
  content: ""; flex-shrink: 0; width: 18px; height: 18px; background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 8v4M12 16h.01'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 8v4M12 16h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}
.field .hint { margin: 8px 0 0; }

/* Alerts and toasts */
.alert {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 16px;
  border-radius: var(--radius-control); border-left: 4px solid; margin-bottom: 16px; background: #fff;
}
.alert strong::before { margin-right: 8px; font-weight: 700; }
.alert-success { border-color: var(--success); color: var(--success); }
.alert-success strong::before { content: "\2713"; }
.alert-warning { border-color: var(--warning); color: var(--warning); }
.alert-warning strong::before { content: "!"; }
.alert-error { border-color: var(--danger); color: var(--danger); }
.alert-error strong::before { content: "\2715"; }
.alert-info { border-color: var(--text-muted); color: var(--text); }
.alert-info strong::before { content: "i"; }
.alert span { color: var(--text); }

.toast-wrap {
  position: fixed; left: 0; right: 0; bottom: 16px; z-index: 1100;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 0 16px; pointer-events: none;
}
.toast {
  pointer-events: auto; max-width: 480px; padding: 12px 16px;
  background: var(--text); color: #fff; border-radius: var(--radius-control);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); animation: fadeIn 0.2s ease;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }

/* Badges */
.badge {
  display: inline-block; padding: 2px 10px; font-size: 13px; font-weight: 500;
  border-radius: 999px; border: 1px solid transparent; white-space: nowrap;
}
.badge-green { background: #E6F2E7; color: var(--success); }
.badge-amber { background: #FBEFD9; color: var(--warning); }
.badge-red { background: #FBE6E4; color: var(--danger); }
.badge-tan { background: #F1EBDD; color: var(--text); }
.badge-grey { background: #EFEFEF; color: var(--text-muted); }
.badge-outline { background: #fff; color: var(--text); border-color: var(--text); }

/* Loader */
.loader-overlay {
  position: fixed; inset: 0; z-index: 1200; background: var(--overlay);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
}
.loader-ring {
  width: 56px; height: 56px; border-radius: 50%;
  border: 5px solid #fff; border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
.loader-text { color: #fff; margin: 0; padding: 0 16px; text-align: center; }

/* Modal (bottom sheet on phones) */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000; background: var(--overlay);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  background: #fff; padding: 24px 16px 32px; animation: slideUp 0.2s ease;
  border-radius: var(--radius-card) var(--radius-card) 0 0;
}
.modal-actions { display: flex; flex-direction: column-reverse; gap: 8px; margin-top: 16px; }
@media (min-width: 600px) {
  .modal-backdrop { align-items: center; }
  .modal { border-radius: var(--radius-card); padding: 24px; }
  .modal-actions { flex-direction: row; justify-content: flex-end; }
}

/* Tables: stacked cards on phones */
.table-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius-card); border: 1px solid var(--border); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { position: sticky; top: 0; background: var(--accent-soft); font-weight: 500; white-space: nowrap; }
.table tbody tr:hover { background: var(--accent-soft); }
.empty-state { padding: 32px 16px; text-align: center; color: var(--text-muted); }
@media (max-width: 599px) {
  .table-wrap { background: transparent; border: 0; overflow: visible; }
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive tr {
    background: #fff; border: 1px solid var(--border); border-radius: 16px;
    margin-bottom: 12px; padding: 8px 0;
  }
  .table.responsive td { border: 0; padding: 6px 16px; display: flex; justify-content: space-between; gap: 16px; }
  .table.responsive td::before { content: attr(data-label); color: var(--text-muted); font-size: 14px; }
}

/* Filter bar and stat cards (used in later batches) */
.filter-bar { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 16px; }
@media (min-width: 600px) { .filter-bar { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1025px) { .filter-bar { grid-template-columns: repeat(4, 1fr); } }
.stat-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 24px; }
@media (min-width: 600px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1025px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-card { background: #fff; border-radius: var(--radius-card); padding: 16px; }
.stat-value { font-size: 24px; font-weight: 700; }
.stat-label { font-size: 14px; color: var(--text-muted); }

/* ---------- Public shell v2: footer outside the sheet, wide home layout, login ---------- */
.site-footer-line { margin: 0; background: #fff; }
.home-layout { display: block; }
.token-section .divider { margin: 32px 0 24px; }
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 52px; }
.password-toggle {
  position: absolute; top: 0; right: 0; width: 52px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 0; color: var(--text-muted); cursor: pointer;
}
.text-link {
  display: block; width: 100%; margin: 24px auto 0; padding: 12px; text-align: center;
  background: none; border: 0; font: inherit; color: var(--text); cursor: pointer;
  text-decoration: underline; text-underline-offset: 4px;
}
@media (min-width: 600px) {
  .site-footer-line { margin: auto 0 0; background: transparent; border-top: 0; }
  .sheet-page.sheet-narrow { max-width: 480px; }
}
@media (min-width: 1025px) {
  .site-header { max-width: 1264px; padding: 12px 32px; }
  .sheet-page { width: calc(100% - 64px); max-width: 1200px; margin: 0 auto 32px; padding: 32px; }
  .home-layout {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 0 48px;
    grid-template-areas: "intro cards" "token cards"; grid-template-rows: auto 1fr; align-items: start;
  }
  .home-intro { grid-area: intro; }
  .home-layout .home-cards { grid-area: cards; margin: 0; }
  .home-layout .token-section { grid-area: token; }
  .token-section .divider { margin: 24px 0; }
  .token-section .btn { width: auto; }
}

/* ---------- Admin shell v2: top bar and slide-in menu ---------- */
.shell-topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 12px;
  min-height: 64px; padding: 8px 16px; background: #fff; border-bottom: 1px solid var(--border);
}
.shell-title { font-size: 18px; font-weight: 700; }
.shell-spacer { flex: 1; }
.shell-user { display: none; font-size: 14px; color: var(--text-muted); }
.role-pill {
  display: inline-block; padding: 6px 14px; background: #fff; border: 1px solid var(--text);
  border-radius: 999px; font-size: 14px; font-weight: 500; white-space: nowrap;
}
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 48px; min-height: 48px; padding: 0 8px; background: none; border: 0;
  border-radius: var(--radius-control); color: var(--text); font: inherit; cursor: pointer;
}
.icon-btn:hover { background: var(--accent-soft); }
.shell-logout-text { display: none; }
.shell-main { width: 100%; max-width: 1280px; margin: 0 auto; padding: 24px 16px 48px; }
.shell-heading { margin-bottom: 24px; }
.shell-heading h1 { font-size: 28px; margin-bottom: 4px; }
.shell-backdrop {
  position: fixed; inset: 0; z-index: 1040; background: var(--overlay);
  opacity: 0; visibility: hidden; transition: opacity 0.2s, visibility 0.2s;
}
.shell-backdrop.open { opacity: 1; visibility: visible; }
.shell-drawer {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 1050; width: 280px; max-width: 85vw;
  display: flex; flex-direction: column; background: #fff; padding: 16px 12px;
  transform: translateX(-100%); visibility: hidden; transition: transform 0.2s, visibility 0.2s;
  box-shadow: 4px 0 16px rgba(0, 0, 0, 0.15);
}
.shell-drawer.open { transform: none; visibility: visible; }
.shell-drawer-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 4px 8px 16px; }
.shell-drawer-title { font-size: 18px; font-weight: 700; }
.shell-drawer-sub { font-size: 14px; color: var(--text-muted); }
.shell-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.shell-link {
  display: flex; align-items: center; gap: 16px; min-height: 48px; padding: 0 16px;
  border-radius: 12px; text-decoration: none; color: var(--text);
}
.shell-link:hover { background: var(--accent-soft); }
.shell-link.active { background: var(--accent); font-weight: 500; }
.shell-link.soon { color: #8A8A8A; cursor: default; }
.shell-link.soon:hover { background: transparent; }
.shell-soon-tag { margin-left: auto; padding: 0 8px; font-size: 12px; border: 1px solid var(--border); border-radius: 999px; }
.shell-foot { padding-top: 12px; border-top: 1px solid var(--border); }
.shell-foot .shell-link { color: var(--text-muted); }
@media (min-width: 600px) {
  .shell-user, .shell-logout-text { display: inline; }
  .shell-main { padding: 32px 24px 48px; }
}

/* ---------- Page heading row and structure tree ---------- */
.shell-heading-row { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 16px; }
.icon-btn-sm { min-width: 40px; min-height: 40px; padding: 0 6px; }
.btn .icon-plus, .btn svg { flex-shrink: 0; }
.tree-card { margin-bottom: 16px; padding: 16px; }
.tree-row { display: flex; align-items: center; gap: 8px; }
.tree-name { flex: 1; min-width: 0; }
.tree-name .hint { margin: 0; }
.tree-title { font-weight: 500; overflow-wrap: anywhere; }
.tree-title-lg { font-size: 18px; }
.tree-actions { display: flex; flex-shrink: 0; }
.tree-toggle svg { transform: rotate(-90deg); transition: transform 0.15s; }
.tree-toggle.open svg { transform: none; }
.tree-children { margin-top: 12px; padding-left: 12px; border-left: 2px solid var(--border); }
.tree-dept { padding: 12px 0 16px; border-bottom: 1px solid var(--border); }
.tree-children > .tree-dept:last-of-type { border-bottom: 0; }
.tree-levels { list-style: none; margin: 8px 0 12px; padding: 0 0 0 8px; }
.tree-level { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.tree-level .tree-title { flex: 1; min-width: 0; font-weight: 400; }
.inactive > .tree-row .tree-title, .tree-dept.inactive > .tree-row .tree-title, .tree-level.inactive .tree-title { color: var(--text-muted); }
.tree-children > .btn { margin-top: 12px; }

/* ---------- Tabs and price rows ---------- */
.tabs {
  display: inline-flex; max-width: 100%; gap: 4px; padding: 4px; margin-bottom: 16px;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
}
.tab {
  min-height: 44px; padding: 0 16px; background: none; border: 0; border-radius: var(--radius-control);
  font: inherit; color: var(--text); cursor: pointer;
}
.tab[aria-selected="true"] { background: var(--accent); font-weight: 500; }
.price-card { margin-bottom: 16px; }
.price-card h2 { margin-bottom: 8px; }
.price-dept { margin: 20px 0 0; font-size: 16px; font-weight: 700; }
.price-row {
  display: grid; grid-template-columns: 1fr; gap: 12px; align-items: end;
  padding: 16px 0; border-top: 1px solid var(--border);
}
.price-level { display: flex; align-items: center; gap: 8px; min-height: 24px; font-weight: 500; }
.price-field { margin: 0; }
.price-field label { margin-bottom: 4px; font-size: 14px; font-weight: 400; color: var(--text-muted); }
.money-wrap { position: relative; }
.money-wrap span { position: absolute; top: 50%; left: 14px; transform: translateY(-50%); color: var(--text-muted); }
.money-wrap .input { padding-left: 34px; }
@media (min-width: 700px) {
  .price-row { grid-template-columns: 1.2fr 1fr 1fr auto; }
  .price-row-assignment { grid-template-columns: 1.2fr 1fr auto; }
  .price-level { min-height: 48px; }
  .price-row .btn { min-height: 48px; }
}

/* ---------- Prices: filters and collapsible cards ---------- */
[hidden] { display: none !important; }
.filter-bar .field { margin: 0; }
.filter-actions { margin: 12px 0 8px; }
.price-card { padding: 16px; }
.price-card .price-card-heading { margin: 0; font-size: 20px; font-weight: 500; }
.price-card-head {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 0;
  background: none; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.price-card-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 20px; font-weight: 500; }
.price-card-summary { margin-left: auto; font-size: 14px; font-weight: 400; color: var(--text-muted); }
.price-card-chevron svg { display: block; transition: transform 0.15s; }
.price-card.collapsed .price-card-chevron svg { transform: rotate(-90deg); }
.price-card.collapsed .price-body { display: none; }
.price-body { margin-top: 8px; }
.price-dept-group { margin-top: 4px; }

/* ---------- Students page ---------- */
.select:disabled, .input:disabled { background-color: var(--accent-soft); color: #8A8A8A; cursor: not-allowed; }
.students-table .student-name { font-weight: 500; }
.students-table td { overflow-wrap: anywhere; }
.students-table .cell-actions { white-space: nowrap; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.pager-info { font-size: 14px; color: var(--text-muted); text-align: center; }
@media (max-width: 599px) {
  .students-table.responsive td { text-align: right; }
  .students-table.responsive td::before { text-align: left; }
  .students-table.responsive .cell-actions { justify-content: flex-end; }
}

/* ---------- Import page ---------- */
.import-card { margin-bottom: 24px; }
.import-steps { margin: 0 0 12px; padding-left: 20px; }
.import-steps li { margin-bottom: 4px; }
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 32px 16px; text-align: center; color: var(--text); cursor: pointer;
  background: var(--accent-soft); border: 2px dashed var(--border); border-radius: 16px;
}
.dropzone:hover, .dropzone.dragging { border-color: var(--accent); background: #fff; }
.dropzone:focus-within { outline: 2px solid var(--text); outline-offset: 2px; box-shadow: 0 0 0 4px var(--accent); }
.dropzone p { margin: 0; }
.dropzone-title { font-weight: 500; }
.file-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 16px; padding: 12px 16px; background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius-control);
}
.file-chip-name { min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.import-actions { margin-top: 16px; }
.import-stats { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 16px 0; }
.import-stats .stat-card { border: 1px solid var(--border); }
.text-link-inline { color: var(--text); text-underline-offset: 4px; }
@media (min-width: 600px) { .import-stats { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 599px) {
  .import-card .table.responsive td { text-align: right; overflow-wrap: anywhere; }
  .import-card .table.responsive td::before { text-align: left; }
}

/* ---------- Public pay pages ---------- */
.back-link { display: inline-block; margin-bottom: 16px; padding: 8px 0; color: var(--text-muted); text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.name-results { list-style: none; margin: 0 0 24px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.name-result {
  display: flex; flex-direction: column; align-items: flex-start; width: 100%; min-height: 48px;
  padding: 12px 16px; background: #fff; border: 1px solid var(--border); border-radius: 16px;
  font: inherit; color: var(--text); text-align: left; cursor: pointer;
}
.name-result:hover { border-color: var(--accent); background: var(--accent-soft); }
.name-result-name { font-weight: 500; }
.name-result-dept { font-size: 14px; color: var(--text-muted); }
.chosen-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 16px;
}
.fee-card {
  margin: 0 0 16px; padding: 20px 16px; text-align: center;
  background: var(--accent-soft); border: 1px solid var(--border); border-radius: 16px;
}
.fee-card p { margin: 0; }
.fee-label { font-weight: 500; }
.fee-amount { margin: 4px 0 8px; font-size: 32px; font-weight: 700; }
#paid-card .btn { margin-top: 8px; }

/* ---------- Payment callback ---------- */
.detail-list { margin: 16px 0 24px; padding: 0; }
.detail-row {
  display: flex; justify-content: space-between; gap: 16px; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.detail-row dt { color: var(--text-muted); }
.detail-row dd { margin: 0; font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.btn-gap { margin-top: 8px; }

/* ---------- Receipt QR code ---------- */
.qr-block {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  margin: 0 0 24px; padding: 16px; background: #fff;
  border: 1px solid var(--border); border-radius: 16px;
}
.qr-block p { margin: 0; text-align: center; }
.qr-img { display: block; width: 160px; height: 160px; background: #fff; }

/* ---------- Assignment: file stepper and token ---------- */
.stepper { display: flex; align-items: center; gap: 16px; }
.stepper-btn {
  width: 48px; height: 48px; padding: 0; font: inherit; font-size: 24px; line-height: 1; color: var(--text);
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-control); cursor: pointer;
}
.stepper-btn:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.stepper-btn:disabled { color: #8A8A8A; background: var(--accent-soft); cursor: not-allowed; }
.stepper-value { min-width: 48px; text-align: center; font-size: 20px; font-weight: 500; }
.token-card {
  margin: 16px 0 16px; padding: 20px 16px; text-align: center;
  background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 16px;
}
.token-card p { margin: 0; }
.token-label { font-weight: 500; }
.token-code {
  margin: 8px 0 12px; font-size: 32px; font-weight: 700; letter-spacing: 0.08em;
  overflow-wrap: anywhere; user-select: all;
}
.token-meta { margin-top: 16px; font-size: 16px; }
.countdown { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.countdown-warn { color: var(--warning); }
.countdown-low { color: var(--danger); }
#continue-upload { margin-bottom: 8px; }

/* ---------- Upload page ---------- */
.token-input {
  text-align: center; font-size: 24px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.dropzone.disabled { cursor: not-allowed; background: var(--accent-soft); color: #8A8A8A; }
.dropzone.disabled:hover { border-color: var(--border); background: var(--accent-soft); }
.upload-count { margin: 12px 0 8px; }
.file-list { list-style: none; margin: 0 0 16px; padding: 0; }
.file-list .file-chip { margin-top: 8px; }
.file-chip-info { min-width: 0; }
.file-chip-info > span { display: block; }
#confirm-box .btn-row { margin-top: 8px; }

/* ---------- Tokens admin page ---------- */
.token-panel { margin-bottom: 24px; }
.token-panel .btn-row { margin-top: 16px; }
.token-panel .name-results { margin-bottom: 16px; }
.token-panel .chosen-card { margin-bottom: 24px; }

/* ---------- Buy handout ---------- */
.choice-set { border: 0; padding: 0; margin: 0 0 24px; }
.choice-set legend { padding: 0; margin-bottom: 8px; font-weight: 500; }
.choice {
  display: flex; align-items: center; gap: 12px; min-height: 48px; margin-bottom: 8px;
  padding: 12px 16px; background: #fff; border: 1px solid var(--border); border-radius: 16px; cursor: pointer;
}
.choice:hover { border-color: var(--accent); background: var(--accent-soft); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { flex-shrink: 0; width: 20px; height: 20px; margin: 0; accent-color: var(--text); }
.choice-title { display: block; font-weight: 500; }
.choice-text { display: block; font-size: 14px; color: var(--text-muted); }
#delivery-note { margin: 0 0 16px; }

/* ---------- Submissions: row selection ---------- */
.col-check { width: 48px; }
.row-check, #check-all { width: 24px; height: 24px; accent-color: var(--text); cursor: pointer; }

/* ---------- Reports ---------- */
.report-tabs { display: flex; gap: 8px; margin-bottom: 24px; overflow-x: auto; }
.report-tab {
  flex-shrink: 0; min-height: 48px; padding: 0 16px; font: inherit; color: var(--text);
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-control); cursor: pointer;
}
.report-tab:hover { border-color: var(--accent); }
.report-tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); font-weight: 500; }
.chart-card { margin-bottom: 24px; }
.chart-card h2 { margin-bottom: 4px; }
.chart-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; margin-top: 16px; }
.chart-value { font-weight: 500; }
.chart-bar {
  grid-column: 1 / -1; width: 100%; height: 12px; border: 1px solid var(--border);
  border-radius: 6px; overflow: hidden; background: var(--accent-soft);
  -webkit-appearance: none; appearance: none;
}
.chart-bar::-webkit-progress-bar { background: var(--accent-soft); }
.chart-bar::-webkit-progress-value { background: var(--accent-hover); }
.chart-bar::-moz-progress-bar { background: var(--accent-hover); }

/* ---------- Overview ---------- */
.overview-section { margin-bottom: 24px; }
.overview-section h2 { margin-bottom: 16px; }
.attention-list { list-style: none; margin: 0; padding: 0; }
.attention-item {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 16px; padding: 12px 0; border-top: 1px solid var(--border);
}
.attention-item:first-child { border-top: 0; padding-top: 0; }
.overview-more { margin-top: 16px; }

/* ---------- Prices: extra Departmental fee column ---------- */
@media (min-width: 700px) {
  .price-row-three { grid-template-columns: 1.2fr 1fr 1fr 1fr auto; }
}

/* ---------- Audit log ---------- */
.audit-changes { list-style: none; margin: 0 0 16px; padding: 0; }
.audit-changes li { padding: 8px 0; border-top: 1px solid var(--border); word-break: break-word; }
.audit-changes li:first-child { border-top: 0; }
.audit-json {
  margin: 8px 0 16px; padding: 12px; max-height: 280px; overflow: auto;
  background: var(--accent-soft); border: 1px solid var(--border); border-radius: var(--radius-control);
  font-size: 13px; white-space: pre-wrap; word-break: break-word;
}

/* ---------- Site header with logo ---------- */
.site-header { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.brand-logo-link { justify-self: start; display: inline-flex; }
.brand-logo { display: block; width: 44px; height: 44px; object-fit: contain; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; font-size: 13px; line-height: 1.25; }
.brand-school { font-weight: 700; font-size: 13px; }
.brand-portal { font-weight: 500; font-size: 11px; letter-spacing: 0.08em; color: var(--text-muted); }
.site-header .header-link { justify-self: end; }
@media (min-width: 600px) {
  .site-header { grid-template-columns: 1fr auto 1fr; }
  .brand-logo { width: 52px; height: 52px; }
  .brand-school { font-size: 18px; }
  .brand-portal { font-size: 14px; }
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: 0.01ms !important; }
  .loader-ring { animation: spin 2.4s linear infinite !important; animation-duration: 2.4s !important; }
}

