/* Tapee University — 2026 interface refresh */
:root {
  --ink: #172033;
  --ink-soft: #43506a;
  --muted: #718096;
  --navy: #102a56;
  --navy-deep: #071d3e;
  --cobalt: #1664e8;
  --cobalt-dark: #0f4fc1;
  --teal: #0f9f91;
  --amber: #d98305;
  --danger: #d94645;
  --canvas: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f9fbfe;
  --line: #e2e8f2;
  --line-strong: #cbd6e6;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 2px 5px rgba(16, 42, 86, .05);
  --shadow: 0 12px 32px rgba(16, 42, 86, .09);
  --sidebar: 248px;
}

html { background: var(--canvas); }
body { background: var(--canvas); color: var(--ink); }
button, input, select, textarea { accent-color: var(--cobalt); }
button, a, summary { -webkit-tap-highlight-color: transparent; }
::selection { background: #cfe1ff; color: var(--navy); }

.skip-link { border-radius: var(--radius-sm); box-shadow: var(--shadow); font-weight: 700; }
.topbar {
  height: 76px;
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand { height: 100%; min-width: 0; }
.brand-mark {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(244, 194, 65, .9);
  border-radius: 50%;
  background: #0a3474;
  box-shadow: 0 0 0 3px rgba(38, 113, 229, .16), 0 7px 16px rgba(3, 17, 43, .25);
}
.brand-mark img {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  border-radius: 50%;
  transform: scale(1.12);
}
.brand-copy { min-width: 0; }
.brand strong { font-size: 1.17rem; letter-spacing: -.01em; }
.brand small { color: var(--muted); opacity: 1; }
.is-staff .brand {
  align-self: stretch;
  width: var(--sidebar);
  margin-left: -28px;
  padding: 0 24px;
  background: var(--navy-deep);
  color: #fff;
}
.is-staff .brand small { color: #b9cae6; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.top-user { gap: 11px; }
.top-user > span:not(.avatar) { line-height: 1.25; }
.top-user small { color: var(--muted); opacity: 1; }
.avatar {
  width: 42px;
  height: 42px;
  background: #e8f0ff;
  color: var(--cobalt);
  border: 1px solid #d5e3fb;
  box-shadow: inset 0 0 0 3px #fff;
}
.icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: var(--surface);
  font-size: 1.2rem;
  transition: .18s ease;
}
.icon-button:hover { color: var(--danger); border-color: #f0b7b7; background: #fff7f7; }
.menu-toggle { display: none; }

.app-frame { grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: calc(100vh - 76px); }
.sidebar {
  background: var(--navy-deep);
  border: 0;
  color: #d5e1f4;
  padding: 22px 16px 18px;
  position: sticky;
  top: 76px;
  height: calc(100vh - 76px);
  overflow: auto;
}
.sidebar-label {
  padding: 0 12px 9px;
  color: #7892bb;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.sidebar nav { gap: 5px; }
.sidebar a {
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 12px;
  color: #c9d7ed;
  gap: 11px;
  font-weight: 500;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.sidebar a i {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: #93acd1;
  font-size: 1.12rem;
  font-style: normal;
}
.sidebar a:hover { background: rgba(255,255,255,.07); color: #fff; transform: translateX(2px); }
.sidebar a.active {
  background: var(--cobalt);
  color: #fff;
  box-shadow: 0 8px 20px rgba(0, 56, 160, .32);
}
.sidebar a.active i { color: #fff; }
.sidebar hr { border-color: rgba(255,255,255,.1); margin: 8px 10px; width: auto; }
.sidebar > small {
  margin-top: 24px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 14px;
  color: #8fa6c9;
  line-height: 1.6;
}
.sidebar > small b { color: #65d6c8; display: block; font-size: .82rem; margin-bottom: 4px; }
.sidebar > small b::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #28c4b2; margin-right: 7px; box-shadow: 0 0 0 4px rgba(40,196,178,.14); }
.sidebar > small span { display: block; }
.sidebar-backdrop { display: none; }

.admin-main { min-width: 0; padding: 30px 34px 48px; }
.admin-heading {
  min-height: 84px;
  padding: 0 0 18px;
  margin-bottom: 4px;
  border-bottom-color: var(--line);
}
.admin-heading h1, .page-heading h1 {
  color: var(--ink);
  font-size: clamp(1.75rem, 2vw, 2.2rem);
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -.035em;
}
.admin-heading h1 { margin: 0 0 5px; }
.admin-heading p { color: var(--muted); margin: 0; }
.admin-heading-actions { align-items: center; flex-wrap: wrap; }
.eyebrow { color: var(--cobalt); font-size: .76rem; font-weight: 700; letter-spacing: .07em; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.section-heading h2 { margin: 3px 0 0; color: var(--ink); font-size: 1.25rem; }

.button {
  min-height: 42px;
  padding: .62rem 1.05rem;
  border-radius: 11px;
  border-color: var(--line-strong);
  font-weight: 650;
  box-shadow: none;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}
.button:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(16,42,86,.11); }
.button.primary { background: var(--cobalt); border-color: var(--cobalt); }
.button.primary:hover { background: var(--cobalt-dark); border-color: var(--cobalt-dark); }
.button.secondary { color: var(--navy); border-color: var(--line-strong); background: #fff; }
.button.secondary:hover { color: var(--cobalt); border-color: #a9c6f5; background: #f8fbff; }
.button.danger { color: var(--danger); border-color: #efb4b4; background: #fff; }
.button.small { min-height: 34px; border-radius: 9px; }
.link-button { color: var(--cobalt); font-weight: 650; }

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea {
  min-height: 42px;
  border: 1px solid var(--line-strong) !important;
  border-radius: 10px !important;
  background: #fff;
  padding: .58rem .75rem;
  transition: border .16s ease, box-shadow .16s ease, background .16s ease;
}
textarea { min-height: 92px; line-height: 1.55; }
input:hover, select:hover, textarea:hover { border-color: #9fb4d1 !important; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--cobalt) !important;
  box-shadow: 0 0 0 4px rgba(22,100,232,.12);
}
label { color: var(--ink-soft); }
fieldset { border-color: var(--line); border-radius: 12px; }
summary { color: var(--navy); font-weight: 650; cursor: pointer; }

.table-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.table-scroll { scrollbar-color: #bec9da transparent; }
table { font-size: .88rem; }
thead { position: relative; }
th {
  height: 46px;
  padding: .72rem .85rem;
  background: var(--surface-soft);
  border-bottom-color: var(--line);
  color: #5a6780;
  font-size: .77rem;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}
td { height: 58px; padding: .72rem .85rem; border-bottom-color: #edf1f6; }
tbody tr { transition: background .14s ease; }
tbody tr:hover { background: #f7faff; }
tbody tr:last-child td { border-bottom: 0; }
tr.selected { outline: none; background: #edf5ff; box-shadow: inset 3px 0 0 var(--cobalt); }
td small { display: block; margin-top: 3px; line-height: 1.35; }
.table-footer { background: var(--surface-soft); border-top: 1px solid var(--line); }
.table-footer b { border-radius: 8px; background: var(--cobalt); }
.empty { color: var(--muted); padding: 38px 20px; }

.status-text, .result {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 27px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #eaf2ff;
  color: var(--cobalt-dark);
  font-size: .78rem;
  font-weight: 700;
  line-height: 1.25;
}
.status-text::before, .result::before { content: ""; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; background: currentColor; }
.result.pass { color: #08796f; background: #e7f8f5; }
.result.fail { color: #ba3535; background: #fff0f0; }
.result.uncertain { color: #a35f00; background: #fff6df; }
.notice, .alert {
  border-radius: 13px;
  border-color: #efd194;
  background: #fff9ec;
  color: #78500d;
  padding: 13px 16px;
}

/* Dashboard */
.dashboard-welcome {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}
.dashboard-welcome h1 { margin: 4px 0 4px; color: var(--ink); font-size: clamp(2rem, 3vw, 2.65rem); line-height: 1.12; letter-spacing: -.045em; }
.dashboard-welcome p { margin: 0; color: var(--muted); }
.dashboard-date {
  min-width: 174px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 14px 14px 4px 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  display: grid;
}
.dashboard-date small { color: var(--muted); }
.dashboard-date strong { font-size: 1.1rem; color: var(--navy); }
.dashboard-date span { color: var(--teal); font-size: .76rem; font-weight: 700; }
.dashboard-stats { display: grid; grid-template-columns: repeat(6, minmax(145px, 1fr)); gap: 12px; margin: 0 0 18px; }
.dashboard-stats > a {
  position: relative;
  min-height: 165px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px 16px 5px 16px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, border .18s ease, box-shadow .18s ease;
}
.dashboard-stats > a:hover { transform: translateY(-3px); border-color: #b9cdf0; box-shadow: var(--shadow); }
.dashboard-stats .stat-icon { width: 38px; height: 38px; margin: 0 0 13px; display: grid; place-items: center; border-radius: 11px; background: #eaf2ff; color: var(--cobalt); font-size: 1.2rem; }
.dashboard-stats a:nth-child(2) .stat-icon, .dashboard-stats a:nth-child(5) .stat-icon { background: #e7f8f5; color: var(--teal); }
.dashboard-stats a:nth-child(6) .stat-icon { background: #fff3e2; color: var(--amber); }
.dashboard-stats a small { color: var(--muted); font-size: .72rem; font-weight: 650; }
.dashboard-stats a > strong { margin: 1px 0; color: var(--ink); font-size: 1.8rem; line-height: 1.1; }
.dashboard-stats a > b { color: var(--ink-soft); font-size: .8rem; font-weight: 600; }
.dashboard-stats a > span:last-child { margin-top: auto; color: var(--cobalt); font-size: .76rem; font-weight: 650; }
.dashboard-stats a > span:last-child i { font-style: normal; margin-left: 3px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .7fr); gap: 16px; }
.workflow-overview, .quick-actions {
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.section-heading > strong { color: var(--navy); font-size: 1.5rem; }
.section-heading > strong small { color: var(--muted); font-size: .75rem; }
.workflow-track { display: grid; gap: 13px; margin-top: 19px; }
.workflow-track > div > span { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 5px; font-size: .8rem; }
.workflow-track em { color: var(--muted); font-style: normal; }
.workflow-track > div > i { display: block; height: 8px; overflow: hidden; border-radius: 99px; background: #edf1f6; }
.workflow-track > div > i b { display: block; min-width: 4px; height: 100%; border-radius: inherit; background: var(--cobalt); }
.workflow-track > div > i b.payment, .workflow-track > div > i b.pickup { background: var(--teal); }
.workflow-track > div > i b.ready { background: #5b75d9; }
.workflow-track > div > i b.production { background: var(--amber); }
.quick-actions { display: flex; flex-direction: column; }
.quick-actions .section-heading { margin-bottom: 7px; }
.quick-actions > a { display: grid; grid-template-columns: 39px 1fr auto; align-items: center; gap: 11px; padding: 12px 3px; border-bottom: 1px solid var(--line); }
.quick-actions > a:last-child { border: 0; }
.quick-actions > a > i { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 10px; background: #edf4ff; color: var(--cobalt); font-style: normal; }
.quick-actions > a span { display: flex; flex-direction: column; }
.quick-actions > a small { color: var(--muted); }
.quick-actions > a em { color: var(--cobalt); font-style: normal; transition: transform .16s ease; }
.quick-actions > a:hover em { transform: translateX(3px); }
.dashboard-activity { margin-top: 18px; }
.dashboard-activity > .section-heading { margin: 0 2px 11px; }
.dashboard-activity > .section-heading > a { color: var(--cobalt); font-size: .82rem; font-weight: 650; }

/* Admin work surfaces */
.review-filters, .filter-bar, .audit-filter {
  margin: 14px 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.review-filters form { padding: 0; }
.review-filters > input, .review-filters > select, .filter-bar > input, .filter-bar > select { min-width: 150px; }
.search span { top: .55rem; color: var(--cobalt); }
.queue-counts { gap: 12px; margin: 14px 0; }
.queue-counts > div {
  min-height: 92px;
  border-color: var(--line);
  border-radius: 14px 14px 5px 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.queue-counts > div { grid-template-columns: 48px minmax(80px, 1fr) auto; }
.queue-counts > div > strong { justify-self: end; }
.count-icon { background: #edf4ff; border: 0; color: var(--cobalt); }
.count-icon.amber { background: #fff4df; color: var(--amber); border: 0; }
.count-icon.red { background: #fff0f0; color: var(--danger); border: 0; }
.queue-counts strong { color: var(--ink); }
.review-layout { gap: 14px; }
.review-layout.has-drawer { grid-template-columns: minmax(650px, 1fr) 370px; }
.review-drawer, .payment-review, .management-form {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.review-drawer { padding: 20px; }
.large-portrait { border-color: var(--line); border-radius: 12px; background: #edf2f8; }
.review-student h2 { color: var(--ink); }
.criteria { border-color: var(--line); border-radius: 12px; overflow: hidden; }
.criteria li { padding: .6rem .7rem; border-color: var(--line); }
.ai-summary { border: 0; background: #eaf8f5; border-radius: 11px; color: #086e65; }
.decision-form textarea { border-radius: 10px; }
.review-context-actions details, .entitlement-control { border-color: var(--line) !important; border-radius: 12px !important; background: #fff; }
.request-admin-control, .request-delete-control { margin-top: .75rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: .7rem .8rem; }
.request-admin-control summary, .request-delete-control summary, .entitlement-control summary { cursor: pointer; font-weight: 700; color: var(--navy); }
.request-admin-control form, .request-delete-control form, .entitlement-control form { display: grid; gap: .65rem; margin-top: .75rem; }
.request-admin-control label { display: grid; gap: .3rem; font-size: .82rem; font-weight: 650; }
.request-admin-control input, .request-delete-control input, .entitlement-control input, .entitlement-control select { width: 100%; }
.request-delete-control { border-color: #fecaca; background: #fffafa; }
.request-delete-control summary { color: #b42318; }
.request-identity { display: inline-flex; margin-top: .35rem; padding: .3rem .55rem; border-radius: 999px; background: #e8f1ff; color: #174ea6; font-size: .74rem; font-weight: 750; }
.latest-request-warning { display: grid; gap: .55rem; margin-top: .75rem; }
.latest-request-warning .button { justify-self: start; }
.mini-portrait { border-radius: 10px; background: #eaf2ff; color: var(--cobalt); }
.production-toolbar, .batch-toolbar {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.selection-warning { border-radius: 12px; background: #fff9e9; border-color: #efd99e; }
.batch-history { margin-top: 24px; }
.batch-history > h2 { color: var(--ink); font-size: 1.25rem; }
.compact-list article { border-color: var(--line); }
.batch-photo-thumb { border-radius: 9px; box-shadow: var(--shadow-sm); }
.export-field-picker { border-color: var(--line); background: var(--surface); border-radius: 14px; }
.preview-summary span { border-radius: 12px; border-color: var(--line); background: #fff; }

.settings-grid { gap: 16px; margin-top: 16px; }
.settings-section {
  padding: 20px !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius) !important;
  background: var(--surface) !important;
  box-shadow: var(--shadow-sm);
}
.settings-section h2 { margin-top: 0; color: var(--ink) !important; font-size: 1.2rem; }
.settings-section h2::before { content: ""; display: inline-block; width: 4px; height: 18px; margin-right: 9px; border-radius: 5px; background: var(--cobalt); vertical-align: -2px; }
.settings-help { color: var(--muted); line-height: 1.55; }
.admin-form label { gap: 5px; font-size: .8rem; font-weight: 600; }
.reference-admin {
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  align-items: start;
  gap: 18px;
}
.reference-admin > .admin-form {
  min-width: 0;
  grid-template-columns: minmax(0, 1fr);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
}
.reference-admin > .admin-form .span-2 { grid-column: auto; }
.reference-admin > .admin-form input,
.reference-admin > .admin-form select,
.reference-admin > .admin-form textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
.reference-admin-grid {
  min-width: 0;
  grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
  gap: 12px;
}
.reference-admin-grid article {
  min-width: 0;
  grid-template-columns: 84px minmax(0, 1fr);
  align-items: start;
  padding: 12px;
  border-color: var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
}
.reference-admin-grid img { width: 84px; height: 112px; border-radius: 9px; }
.reference-admin-grid article > div { min-width: 0; height: 100%; }
.reference-admin-grid strong,
.reference-admin-grid small { overflow-wrap: anywhere; }
.reference-admin-grid form { min-width: 0; }
.reference-admin-grid input { width: 100%; min-width: 0; }
.integration-health article { border-color: var(--line); border-radius: 13px; background: var(--surface-soft); }
.integration-settings > div { border-color: var(--line) !important; border-radius: 13px !important; background: var(--surface-soft); }
.management-split { gap: 16px; }
.management-form { padding: 20px; }
.management-form h2 { color: var(--ink); margin-top: 0; }
.finance-layout { gap: 14px; }
.payment-review { padding: 20px; }
.payment-review h2 { color: var(--ink); }

/* Student experience */
.is-student .topbar { background: var(--navy-deep); border-color: rgba(255,255,255,.08); color: #fff; }
.is-student .brand small, .is-student .top-user small { color: #b9cae6; }
.is-student .avatar { background: #fff; }
.is-student .icon-button { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16); color: #fff; }
.student-main { width: min(1280px, calc(100% - 48px)); padding-bottom: 60px; }
.student-nav {
  height: 62px;
  justify-content: flex-start;
  gap: 34px;
  border-bottom-color: var(--line);
}
.student-nav a { height: 62px; border-width: 2px; color: var(--muted); }
.student-nav a.active { color: var(--cobalt); border-bottom-color: var(--cobalt); }
.page-heading { padding: 18px 0 4px; }
.page-heading h1 { margin: 0; }
.round-strip { border: 0; background: #eaf2ff; border-radius: 13px; color: var(--navy); }
.round-strip strong { border-color: #bfd3f1; }
.steps { margin: 22px auto; }
.steps::before { background: var(--line-strong); }
.steps li { color: var(--muted); background: var(--canvas); }
.steps span { border: 2px solid var(--line-strong); box-shadow: 0 0 0 5px var(--canvas); }
.steps li.active span { background: var(--cobalt); border-color: var(--cobalt); }
.steps li.done span { background: #e7f8f5; border-color: var(--teal); color: var(--teal); }
.upload-layout { gap: 16px; }
.upload-workspace, .requirements, .student-summary, .fee-summary, .status-timeline, .reference-gallery, .student-status-grid > section, .payment-page > section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.upload-workspace { padding: 14px; gap: 14px; }
.portrait-preview { position: relative; border: 0; border-radius: 13px; background: #edf2f8; }
.dropzone { border: 2px dashed #9bbcf1; border-radius: 13px; background: #f8fbff; transition: .18s ease; }
.dropzone:hover, .dropzone.dragging { border-color: var(--cobalt); background: #edf5ff; transform: translateY(-1px); }
.upload-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 17px; background: #e7f0ff; font-size: 2rem; }
.dropzone-editor-note { max-width: 360px; color: var(--cobalt) !important; font-weight: 600; }
.photo-preview-actions {
  position: absolute;
  inset: auto 10px 10px;
  padding: 8px;
  border-radius: 11px;
  background: rgba(7, 29, 62, .86);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #fff;
  font-size: .72rem;
  font-weight: 650;
}
.photo-preview-actions .button { min-height: 34px; background: #fff; }
.photo-editor-open { overflow: hidden; }
.photo-editor-dialog {
  width: min(920px, calc(100% - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  border-radius: 22px 22px 8px 22px;
  background: #fff;
  box-shadow: 0 32px 90px rgba(7, 29, 62, .34);
  overflow: auto;
}
.photo-editor-dialog::backdrop { background: rgba(7, 20, 43, .76); backdrop-filter: blur(5px); }
.photo-editor-shell > header {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 20px;
}
.photo-editor-shell h2 { margin: 2px 0 4px; color: var(--ink); font-size: 1.55rem; }
.photo-editor-shell header p { margin: 0; color: var(--muted); }
.photo-editor-close {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--navy);
  font-size: 1.65rem;
  cursor: pointer;
}
.photo-editor-body { padding: 22px 24px; display: grid; grid-template-columns: minmax(300px, 1fr) 300px; gap: 24px; }
.photo-editor-stage {
  padding: 16px;
  border-radius: 17px;
  background: var(--navy-deep);
  display: grid;
  place-items: center;
}
.photo-editor-stage canvas {
  width: min(100%, 450px);
  height: auto;
  max-height: 62vh;
  border-radius: 10px;
  background: #d9e1ec;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .25);
  cursor: grab;
  touch-action: none;
}
.photo-editor-stage canvas.is-dragging { cursor: grabbing; }
.photo-editor-stage p { margin: 13px 0 0; color: #c7d5e8; font-size: .8rem; text-align: center; }
.photo-editor-controls { display: flex; flex-direction: column; gap: 12px; }
.photo-editor-controls > label { display: flex; justify-content: space-between; color: var(--ink); font-weight: 650; }
.photo-editor-controls output { color: var(--cobalt); }
.photo-editor-controls input[type="range"] { width: 100%; accent-color: var(--cobalt); }
.photo-editor-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.photo-editor-tools .button:last-child { grid-column: 1 / -1; }
.photo-editor-tip { margin-top: 6px; padding: 14px; border: 1px solid #cbdcf6; border-radius: 13px; background: #f3f7ff; display: grid; gap: 4px; }
.photo-editor-tip strong { color: var(--navy); }
.photo-editor-tip span { color: var(--muted); font-size: .82rem; line-height: 1.55; }
.photo-editor-error { margin: 0; padding: 11px 12px; border-radius: 10px; background: #fff0f0; color: var(--danger); font-size: .82rem; }
.photo-editor-shell > footer { position: sticky; z-index: 3; bottom: 0; padding: 16px 24px 20px; border-top: 1px solid var(--line); background: #fff; display: flex; justify-content: flex-end; gap: 10px; box-shadow: 0 -10px 24px rgba(16, 42, 86, .06); }
.requirements { padding: 18px 20px; }
.requirements h2, .status-timeline h2, .reference-gallery h2 { color: var(--ink); }
.requirements li { border-color: var(--line); }
.requirements li span { border: 0; background: #e7f8f5; color: var(--teal); }
.requirements .ai-note { margin: 14px -20px -18px; border: 0; border-radius: 0 0 15px 15px; background: #fff9e9; }
.student-summary { overflow: hidden; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.student-summary div { border-color: var(--line); }
.student-summary div:nth-of-type(5) { border-right: 0; }
.student-summary .registry-data-notice {
  grid-column: 1 / -1;
  margin: 12px 16px -12px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: #fff9e9;
  color: #6b4b08;
  line-height: 1.55;
  font-size: .86rem;
}
.student-summary .registry-data-notice span { margin-right: 6px; color: var(--amber); }
.student-summary .student-contact-editor {
  grid-column: 1 / -1;
  padding: 16px;
  border: 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: row;
  align-items: end;
  gap: 12px;
  background: #f8fbff;
}
.student-contact-editor label { flex: 1; display: grid; gap: 6px; color: var(--ink); font-size: .84rem; font-weight: 650; }
.student-contact-editor input { width: 100%; min-height: 42px; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; }
.student-summary details { grid-column: 1 / -1; margin: 12px 16px 0; }
.student-card-preview-panel {
  grid-column: 1 / -1;
  margin-top: 16px;
  padding: 20px;
  border: 1px solid #b9cff3;
  border-radius: 17px;
  background: #f8fbff;
  box-shadow: 0 14px 36px rgba(16, 42, 86, .08);
}
.student-card-preview-panel > header {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.student-card-preview-panel h2 { margin: 2px 0 0; color: var(--ink); font-size: 1.45rem; }
.card-preview-state {
  padding: 7px 11px;
  border: 1px solid #b9e0da;
  border-radius: 999px;
  background: #effaf8;
  color: #147267;
  font-size: .78rem;
  font-weight: 700;
}
.student-card-preview {
  position: relative;
  container-type: inline-size;
  width: min(100%, 1063px);
  aspect-ratio: 1063 / 638;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid #d7deea;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 46px rgba(7, 29, 62, .16);
  isolation: isolate;
}
.student-card-template { position: absolute; z-index: 0; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.student-card-photo {
  position: absolute;
  z-index: 1;
  left: 70.74%;
  top: 7.05%;
  width: 23.05%;
  height: 38.09%;
  border-radius: 4.5%;
  object-fit: cover;
  object-position: center 34%;
  background: #fff;
}
.card-preview-student-id,
.card-preview-name,
.card-preview-faculty,
.card-preview-program {
  position: absolute;
  z-index: 2;
  overflow: hidden;
  color: #111318;
  font-family: "Noto Sans Thai", Tahoma, sans-serif;
  line-height: 1.12;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .72);
}
.card-preview-student-id {
  left: 70.1%;
  top: 51.8%;
  width: 24.35%;
  text-align: center;
  font-size: clamp(10px, 2.95cqw, 32px);
  font-weight: 800;
  letter-spacing: .105em;
  line-height: 1;
}
.card-preview-name {
  left: 43.8%;
  top: 62.6%;
  width: 50.6%;
  text-align: center;
  font-size: clamp(12px, 4.8cqw, 51px);
  font-weight: 850;
  letter-spacing: -.015em;
}
.card-preview-name.is-long { font-size: clamp(10px, 3.8cqw, 40px); }
.card-preview-faculty {
  left: 61.7%;
  top: 75.2%;
  width: 34.7%;
  font-size: clamp(7px, 2.55cqw, 27px);
  font-weight: 750;
}
.card-preview-program {
  left: 64%;
  top: 86.2%;
  width: 32.4%;
  font-size: clamp(7px, 2.45cqw, 26px);
  font-weight: 750;
}
.card-preview-faculty.is-long,
.card-preview-program.is-long { font-size: clamp(6px, 2.05cqw, 22px); }
.card-preview-watermark {
  position: absolute;
  z-index: 3;
  left: 28%;
  top: 48%;
  width: 53%;
  transform: rotate(-16deg);
  color: rgba(118, 28, 36, .14);
  font-size: clamp(13px, 3.2vw, 38px);
  font-weight: 900;
  letter-spacing: .04em;
  text-align: center;
  pointer-events: none;
}
.student-card-preview-panel > p { margin: 14px auto 0; width: min(100%, 1063px); color: var(--muted); font-size: .82rem; line-height: 1.55; }
.student-card-preview-panel > p span { margin-right: 5px; color: var(--cobalt); }
.fee-summary { border-color: var(--line); }
.photo-consents { border-color: var(--line); border-radius: 13px; background: #fff; }
.status-timeline { padding: 20px; }
.current-status { background: #edf5ff; border-radius: 11px; }
.status-timeline li > span { background: var(--cobalt); box-shadow: 0 0 0 4px #e8f1ff; }
.request-complete-banner { border: 1px solid #b9e0da; border-radius: 14px; background: #effaf8; }
.reference-gallery { padding: 20px; }
.reference-gallery > div {
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 360px));
  justify-content: center;
  align-items: start;
}
.reference-gallery figure { border-radius: 12px; background: #f3f6fa; }
.reference-gallery img {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  object-position: center;
  background: #edf2f7;
}
.reference-gallery figcaption { background: var(--surface); }
.photo-version-list {
  margin: 0;
  padding: 0 18px 18px;
  border-top: 0;
  display: grid;
  gap: 10px;
}
.photo-version-list article {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
}
.photo-version-list article.is-current {
  border-color: #b9cff3;
  background: #f3f7ff;
  box-shadow: inset 4px 0 0 var(--cobalt);
}
.photo-version-list .photo-view-button {
  flex: 0 0 auto;
  min-width: 116px;
  min-height: 42px;
  color: #fff;
  box-shadow: 0 7px 18px rgba(22, 100, 232, .2);
}
.photo-version-list .photo-view-button:hover {
  color: #fff;
  box-shadow: 0 10px 24px rgba(22, 100, 232, .28);
}
.view-photo-icon { font-size: 1rem; line-height: 1; }

/* Authentication */
.login-page { background: var(--canvas); position: relative; overflow-x: hidden; }
.login-page::before {
  content: "";
  position: fixed;
  inset: 0 53% 0 0;
  background: var(--navy-deep);
  z-index: 0;
}
.login-page::after {
  content: "";
  position: fixed;
  width: 330px;
  height: 330px;
  left: -130px;
  bottom: -130px;
  border: 64px solid rgba(255,255,255,.05);
  border-radius: 50%;
  z-index: 0;
}
.login-page .topbar { background: transparent; border: 0; color: #fff; }
.login-page .brand small { color: #c4d2e7; }
.login-shell { position: relative; z-index: 1; min-height: calc(100vh - 76px); }
.login-copy { padding-right: 30px; }
.login-copy h1 { font-size: clamp(2.5rem, 5vw, 4rem); letter-spacing: -.045em; }
.login-copy p { color: #c5d2e7; line-height: 1.7; }
.login-copy ul { margin-top: 26px; padding: 0; list-style: none; }
.login-copy li { display: flex; gap: 10px; color: #e5edf8; }
.login-copy li::before { content: "✓"; color: #53d3c3; font-weight: 700; }
.login-panel { border: 1px solid var(--line); border-radius: 22px 22px 7px 22px; padding: 28px; box-shadow: 0 24px 60px rgba(16,42,86,.15); }
.login-panel > img { width: 78px; height: 78px; }
.login-panel h2 { color: var(--ink); font-size: 1.65rem; }
.staff-login label { font-size: .8rem; font-weight: 600; }
.privacy-note { margin-bottom: 0; }
.mfa-challenge, .mfa-setup, .password-change-card, .auth-card { border-color: var(--line); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow); }

.toast { right: 24px; bottom: 24px; border-radius: 13px 13px 4px 13px; background: var(--navy-deep); box-shadow: 0 16px 40px rgba(7,29,62,.22); }
.site-credit {
  width: min(1280px, calc(100% - 48px));
  margin: -34px auto 0;
  padding: 18px 0 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: .78rem;
}
.site-credit strong { color: var(--navy); font-weight: 650; }

@media (max-width: 1320px) {
  .dashboard-stats { grid-template-columns: repeat(3, 1fr); }
  .dashboard-stats > a { min-height: 145px; }
}

@media (max-width: 1100px) {
  .review-layout.has-drawer { grid-template-columns: 1fr; }
  .review-drawer { top: 76px; border-radius: var(--radius) 0 0 var(--radius); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .student-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .student-summary div { border-bottom: 1px solid var(--line); }
  .student-summary div:nth-of-type(even) { border-right: 0; }
  .reference-admin { grid-template-columns: 1fr; }
  .reference-admin > .admin-form { width: min(100%, 520px); }
}

@media (max-width: 960px) {
  .is-staff .topbar { padding-left: 16px; }
  .is-staff .brand { width: auto; margin-left: 0; padding: 0; background: transparent; color: var(--ink); }
  .is-staff .brand small { color: var(--muted); }
  .menu-toggle {
    width: 44px;
    height: 42px;
    padding: 9px 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fff;
  }
  .menu-toggle span { width: 20px; height: 2px; border-radius: 3px; background: var(--navy); transition: .18s ease; }
  .menu-toggle b { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .menu-open .menu-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .menu-open .menu-toggle span:nth-child(2) { opacity: 0; }
  .menu-open .menu-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  .app-frame { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 60;
    top: 76px;
    bottom: 0;
    left: 0;
    width: min(300px, 86vw);
    height: auto;
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: 18px 0 48px rgba(7,29,62,.2);
  }
  .sidebar a { justify-content: flex-start; font-size: 1rem; }
  .sidebar a span { display: inline; }
  .sidebar > small { display: block; }
  .menu-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 76px 0 0; z-index: 55; border: 0; background: rgba(7,29,62,.46); }
  .menu-open .sidebar-backdrop { display: block; }
  .admin-main { padding: 26px 22px 42px; }
}

@media (max-width: 760px) {
  .topbar { height: 68px; padding: 0 14px; }
  .brand-mark { width: 43px; height: 43px; flex-basis: 43px; }
  .brand strong { font-size: 1rem; }
  .brand small { font-size: .72rem; }
  .topbar-actions { gap: 8px; }
  .top-user > span:not(.avatar) { display: none; }
  .avatar { width: 38px; height: 38px; }
  .icon-button { width: 38px; height: 38px; }
  .sidebar { top: 68px; }
  .sidebar-backdrop { inset: 68px 0 0; }
  .admin-main { padding: 20px 14px 36px; }
  .admin-heading { display: block; }
  .admin-heading-actions { flex-direction: row; margin-top: 14px; }
  .admin-heading-actions .button { flex: 1 1 180px; }
  .dashboard-welcome { align-items: flex-start; }
  .dashboard-date { display: none; }
  .dashboard-welcome h1 { font-size: 2rem; }
  .dashboard-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .dashboard-stats > a { min-height: 142px; padding: 14px; }
  .dashboard-stats a > strong { font-size: 1.55rem; }
  .workflow-overview, .quick-actions { padding: 17px; }
  .section-heading { align-items: flex-start; }
  .section-heading > strong { font-size: 1.2rem; }
  .review-filters, .filter-bar, .audit-filter { padding: 10px; }
  .queue-counts { grid-template-columns: 1fr; }
  .student-main { width: min(100% - 28px, 1280px); }
  .site-credit { width: calc(100% - 28px); margin-top: -26px; flex-direction: column; gap: 3px; }
  .student-nav { gap: 24px; overflow-x: auto; justify-content: flex-start; }
  .student-nav a { white-space: nowrap; }
  .steps { padding: 0 6px; }
  .steps li { font-size: .7rem; width: auto; flex-direction: column; text-align: center; gap: 6px; background: var(--canvas); }
  .steps li span { font-size: .9rem; width: 38px; height: 38px; }
  .portrait-preview { min-height: 320px; }
  .photo-editor-dialog { width: calc(100% - 20px); max-height: calc(100dvh - 20px); border-radius: 17px; }
  .photo-editor-shell > header { padding: 18px; }
  .photo-editor-shell header p { font-size: .82rem; }
  .photo-editor-body { padding: 16px 18px; grid-template-columns: 1fr; gap: 16px; }
  .photo-editor-stage { padding: 12px; }
  .photo-editor-stage canvas { max-height: 48vh; }
  .photo-editor-shell > footer { padding: 14px 18px 18px; }
  .photo-editor-shell > footer .button { flex: 1; }
  .student-summary { grid-template-columns: 1fr; }
  .student-summary div { border-right: 0; border-bottom: 1px solid var(--line); }
  .student-summary .student-contact-editor { align-items: stretch; flex-direction: column; }
  .student-card-preview-panel { padding: 14px; }
  .student-card-preview-panel > header { align-items: flex-start; flex-direction: column; gap: 8px; }
  .student-card-preview-panel h2 { font-size: 1.2rem; }
  .student-card-preview { border-radius: 9px; }
  .photo-version-list article { align-items: stretch; flex-direction: column; }
  .photo-version-list .photo-view-button { width: 100%; }
  .form-actions { grid-template-columns: 1fr; }
  .login-page::before { inset: 0; }
  .login-page .topbar { position: relative; }
  .login-shell { grid-template-columns: 1fr; padding: 28px 0 48px; }
  .login-copy { display: none; }
  .login-panel { padding: 22px 18px; border: 0; }
  .login-page .student-main { width: min(100% - 28px, 520px); }
  th, td { padding-left: .7rem; padding-right: .7rem; }
}

@media (max-width: 420px) {
  .brand-copy { display: none; }
  .is-student .brand-copy, .is-auth .brand-copy { display: flex; }
  .is-student .brand small, .is-auth .brand small { display: none; }
  .is-student .brand strong, .is-auth .brand strong { font-size: .84rem; }
  .dashboard-stats { grid-template-columns: 1fr 1fr; }
  .dashboard-stats > a > span:last-child { display: none; }
  .dashboard-stats > a { min-height: 126px; }
  .stat-icon { width: 34px; height: 34px; margin-bottom: 9px; }
  .review-drawer { width: 100%; }
}

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