:root {
  --bg: #f4f6f4;
  --paper: #fffdf8;
  --surface: #ffffff;
  --surface-soft: #f7ebe4;
  --surface-mint: #e9f5f0;
  --ink: #18202f;
  --muted: #687385;
  --line: #d8ded8;
  --primary: #146c5d;
  --primary-dark: #0b4f44;
  --accent: #c94f3e;
  --gold: #e3ad35;
  --blue: #476a9f;
  --shadow: 0 18px 48px rgba(24, 32, 47, 0.12);
  --soft-shadow: 0 10px 24px rgba(24, 32, 47, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(233, 245, 240, 0.95), rgba(244, 246, 244, 0.2) 420px),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: 12px;
  z-index: 10;
  transform: translateY(-160%);
  background: var(--ink);
  color: white;
  padding: 10px 14px;
  border-radius: var(--radius);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header,
.app-shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 0 18px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--primary-dark);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2.2rem, 5vw, 4.4rem);
  line-height: 0.95;
}

.header-action,
.primary-link,
.ghost-link,
.primary-button,
.ghost-button,
.approve-button,
.reject-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius);
  font-weight: 850;
  text-decoration: none;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.header-action,
.ghost-link,
.ghost-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  padding: 10px 14px;
}

.primary-link,
.primary-button {
  background: var(--primary);
  color: white;
  padding: 11px 16px;
  box-shadow: 0 10px 20px rgba(20, 108, 93, 0.2);
}

.header-action:hover,
.primary-link:hover,
.ghost-link:hover,
.primary-button:hover,
.ghost-button:hover,
.approve-button:hover,
.reject-button:hover,
.student-card:hover {
  transform: translateY(-2px);
}

.header-action:focus-visible,
.primary-link:focus-visible,
.ghost-link:focus-visible,
.primary-button:focus-visible,
.ghost-button:focus-visible,
.approve-button:focus-visible,
.reject-button:focus-visible,
.roll-photo-button:focus-visible,
.lightbox-close:focus-visible,
.lightbox-nav:focus-visible,
.student-card:focus-visible,
.search-field:focus-visible,
.auth-form input:focus-visible,
.whitelist-form input:focus-visible,
.upload-form input:focus-visible {
  outline: 3px solid rgba(201, 79, 62, 0.4);
  outline-offset: 3px;
}

.app-shell {
  padding: 10px 0 52px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.directory-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 390px);
  gap: 20px;
  align-items: stretch;
  margin-bottom: 18px;
}

.hero-panel,
.hero-rail,
.roll-header,
.auth-panel,
.auth-bar,
.admin-panel,
.empty-roll,
.pipeline-panel,
.review-panel,
.not-found {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--soft-shadow);
}

.hero-panel {
  display: flex;
  min-height: 300px;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(24px, 4vw, 42px);
}

.hero-panel h2 {
  max-width: 760px;
  margin-bottom: 12px;
  font-size: clamp(2rem, 4.7vw, 4.2rem);
  line-height: 0.98;
}

.hero-panel p {
  max-width: 650px;
  color: var(--muted);
  font-size: 1.06rem;
}

.auth-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(320px, 0.65fr);
  gap: clamp(20px, 4vw, 44px);
  align-items: center;
  padding: clamp(24px, 5vw, 48px);
  background: linear-gradient(135deg, rgba(255, 253, 248, 0.98) 0%, rgba(237, 246, 241, 0.92) 100%);
}

.auth-copy h2 {
  max-width: 700px;
  margin-bottom: 12px;
  font-size: clamp(2rem, 4.6vw, 4rem);
  line-height: 1;
}

.auth-copy p:not(.eyebrow) {
  max-width: 580px;
  color: var(--muted);
  font-size: 1.04rem;
}

.auth-form {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  padding: 18px;
  box-shadow: 0 10px 24px rgba(24, 32, 47, 0.08);
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.auth-form input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  padding: 0 13px;
}

.temp-auth-form {
  grid-column: 2;
  background: rgba(255, 255, 255, 0.7);
}

.temp-auth-form h3 {
  margin-bottom: 4px;
  font-size: 1rem;
}

.temp-auth-form p:not(.eyebrow) {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.auth-message {
  margin: 0;
  border-left: 4px solid var(--primary);
  background: var(--surface-mint);
  color: var(--primary-dark);
  padding: 10px 12px;
  font-size: 0.92rem;
  font-weight: 750;
}

.auth-message.is-error {
  border-left-color: var(--accent);
  background: #fff0ed;
  color: #9f2419;
}

.auth-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding: 10px 12px;
}

.auth-bar span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.admin-panel {
  display: grid;
  gap: 18px;
  margin: 0 0 20px;
  padding: clamp(18px, 3vw, 28px);
  background: linear-gradient(135deg, rgba(255, 253, 248, 0.96) 0%, rgba(238, 244, 255, 0.72) 100%);
}

.admin-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.admin-head h2 {
  margin-bottom: 6px;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  line-height: 1.1;
}

.admin-head p:not(.eyebrow) {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
}

.whitelist-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.whitelist-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.whitelist-form input {
  min-height: 46px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  padding: 0 13px;
}

.whitelist-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.whitelist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  padding: 12px;
}

.whitelist-item div {
  min-width: 0;
}

.whitelist-item strong,
.whitelist-item span,
.whitelist-item small {
  display: block;
}

.whitelist-item span,
.whitelist-item small {
  color: var(--muted);
  font-size: 0.82rem;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 28px;
}

.stat {
  min-height: 78px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  background: white;
  padding: 12px 13px;
}

.stat:nth-child(2) {
  border-top-color: var(--primary);
  background: var(--surface-mint);
}

.stat:nth-child(3) {
  border-top-color: var(--gold);
  background: #fff7df;
}

.stat:nth-child(4) {
  border-top-color: var(--blue);
  background: #eef4ff;
}

.stat strong {
  display: block;
  font-size: 1.65rem;
  line-height: 1;
}

.stat span {
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 750;
}

.hero-rail {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  background: var(--surface);
}

.hero-photo {
  min-height: 230px;
  overflow: hidden;
}

.hero-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 23%;
}

.hero-note {
  display: grid;
  gap: 2px;
  border-top: 1px solid var(--line);
  background: var(--ink);
  color: white;
  padding: 15px 16px;
}

.hero-note span {
  color: #cbd5e1;
  font-size: 0.82rem;
  font-weight: 800;
}

.hero-note strong {
  font-size: 1.06rem;
}

.pipeline-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: 20px;
  margin: 0 0 20px;
  padding: clamp(18px, 3vw, 28px);
  background: linear-gradient(135deg, rgba(255, 253, 248, 0.94) 0%, rgba(237, 246, 241, 0.84) 100%);
}

.pipeline-copy h2 {
  margin-bottom: 8px;
  font-size: clamp(1.35rem, 3vw, 2.1rem);
  line-height: 1.08;
}

.pipeline-copy p,
.job-status p {
  color: var(--muted);
}

.pipeline-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-content: start;
}

.pipeline-actions > .primary-button,
.pipeline-actions > .ghost-button {
  display: grid;
  min-height: 72px;
  align-content: center;
  gap: 2px;
  padding: 12px 14px;
  text-align: center;
}

.pipeline-actions small {
  color: currentColor;
  font-size: 0.75rem;
  font-weight: 700;
  opacity: 0.72;
}

.upload-form {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  border: 1px solid #cbd8d1;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  padding: 12px;
}

.upload-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.upload-form input {
  min-height: 46px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 7px;
  color: var(--ink);
}

.upload-form input::file-selector-button {
  min-height: 32px;
  margin-right: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-mint);
  color: var(--primary-dark);
  font-weight: 800;
}

.whatsapp-intake {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 0.75fr) minmax(240px, 1.25fr);
  gap: 14px;
  border: 1px solid #cbd8d1;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  padding: 14px;
}

.whatsapp-intake h3 {
  margin-bottom: 4px;
  font-size: 1rem;
}

.whatsapp-intake p:not(.eyebrow) {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.whatsapp-intake dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.whatsapp-intake dl div {
  min-width: 0;
}

.whatsapp-intake dt {
  color: var(--primary-dark);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.whatsapp-intake dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 0.83rem;
  font-weight: 750;
}

.job-status {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 0.7fr) minmax(260px, 1.3fr);
  gap: 16px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.status-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-badge,
.count-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 850;
}

.status-badge {
  background: var(--surface-mint);
  color: var(--primary-dark);
  text-transform: capitalize;
}

.count-pill {
  align-self: center;
  background: #fff0ed;
  color: #9f2419;
}

.job-status h3 {
  margin-bottom: 4px;
  font-size: 1.05rem;
}

.job-status.is-running h3::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 8px;
  border-radius: 999px;
  background: var(--accent);
  vertical-align: middle;
}

.job-log {
  min-height: 88px;
  max-height: 170px;
  overflow: auto;
  margin: 0;
  border: 1px solid #253143;
  border-radius: var(--radius);
  background: #111827;
  color: #e5eef8;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.76rem;
  white-space: pre-wrap;
}

.job-log.is-empty {
  display: grid;
  align-items: center;
  border-color: var(--line);
  background: white;
  color: var(--muted);
  font-family: inherit;
}

.review-panel {
  display: grid;
  gap: 18px;
  margin: 0 0 20px;
  padding: clamp(18px, 3vw, 28px);
  background: rgba(255, 253, 248, 0.92);
}

.review-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.review-head h2 {
  margin-bottom: 6px;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  line-height: 1.1;
}

.review-head p:not(.eyebrow) {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
}

.review-summary {
  display: grid;
  min-width: 104px;
  border-radius: var(--radius);
  background: #fff0ed;
  color: #9f2419;
  padding: 12px 14px;
  text-align: center;
}

.review-summary strong {
  font-size: 1.75rem;
  line-height: 1;
}

.review-summary span {
  font-size: 0.78rem;
  font-weight: 850;
}

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 12px 0 16px;
}

.toolbar h2 {
  margin-bottom: 0;
  font-size: 1.42rem;
}

.toolbar .eyebrow {
  margin-bottom: 2px;
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.review-item {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 14px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  padding: 12px;
  box-shadow: 0 6px 14px rgba(24, 32, 47, 0.06);
}

.review-image-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.review-crop,
.review-reference {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  object-fit: cover;
  background: #dfe7ef;
}

.review-reference {
  border: 2px solid var(--surface-mint);
}

.review-copy {
  display: grid;
  min-width: 0;
  gap: 10px;
}

.review-item strong,
.review-item span,
.review-item small {
  display: block;
}

.review-item span {
  color: var(--primary-dark);
  font-weight: 850;
}

.review-item small {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.78rem;
}

.review-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.approve-button,
.reject-button {
  min-height: 38px;
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 0.84rem;
}

.approve-button {
  border: 1px solid rgba(20, 108, 93, 0.24);
  background: var(--surface-mint);
  color: var(--primary-dark);
}

.reject-button {
  border: 1px solid var(--line);
  background: white;
  color: var(--muted);
}

.search-wrap {
  position: relative;
  width: min(100%, 340px);
}

.search-field {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  padding: 0 14px;
  box-shadow: 0 4px 12px rgba(24, 32, 47, 0.05);
}

.student-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
  gap: 14px;
}

.student-card {
  display: flex;
  min-height: 306px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(24, 32, 47, 0.08);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.student-card:hover {
  border-color: rgba(20, 108, 93, 0.45);
  box-shadow: var(--shadow);
}

.student-card:active {
  transform: translateY(0);
}

.portrait {
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #dfe7ef;
}

.portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.student-card-body {
  display: grid;
  min-height: 92px;
  gap: 9px;
  padding: 12px;
}

.student-card h3 {
  margin-bottom: 0;
  font-size: 1rem;
  line-height: 1.18;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.enter-pill {
  display: inline-flex;
  min-width: 58px;
  justify-content: center;
  border-radius: 999px;
  background: var(--surface-mint);
  color: var(--primary-dark);
  padding: 5px 9px;
}

.roll-view {
  display: grid;
  gap: 18px;
}

.back-row {
  display: flex;
  justify-content: flex-start;
}

.roll-header {
  display: grid;
  grid-template-columns: minmax(150px, 230px) minmax(0, 1fr);
  gap: clamp(18px, 4vw, 34px);
  overflow: hidden;
  padding: clamp(18px, 4vw, 34px);
  background: linear-gradient(135deg, white 0%, #edf6f1 100%);
}

.roll-header .portrait {
  border-radius: var(--radius);
  box-shadow: 0 12px 28px rgba(24, 32, 47, 0.16);
}

.roll-title {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.roll-title h2 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
}

.roll-title p {
  max-width: 680px;
  color: var(--muted);
}

.roll-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.roll-photo {
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 6px 16px rgba(24, 32, 47, 0.07);
}

.roll-photo-button {
  display: grid;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}

.roll-photo-button:hover .roll-photo-image img {
  transform: scale(1.035);
}

.roll-photo-button:active .roll-photo-image img {
  transform: scale(1.01);
}

.roll-photo-image {
  display: block;
  overflow: hidden;
  background: #dfe7ef;
}

.roll-photo-image img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 220ms ease;
}

.roll-photo-caption {
  display: grid;
  gap: 3px;
  padding: 10px;
}

.roll-photo-caption strong {
  color: var(--primary-dark);
}

.roll-photo-caption span {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.78rem;
}

.has-lightbox {
  overflow: hidden;
}

.lightbox-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(12, 18, 30, 0.88);
  padding: 20px;
}

.lightbox-shell {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  width: min(1180px, 100%);
  height: min(860px, calc(100vh - 40px));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  background: #0f1724;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.45);
}

.lightbox-stage {
  display: grid;
  min-height: 0;
  place-items: center;
  padding: 64px 76px 18px;
  touch-action: pan-y;
}

.lightbox-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius);
  object-fit: contain;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.lightbox-close {
  top: 16px;
  right: 16px;
  min-height: 42px;
  border-radius: var(--radius);
  padding: 9px 13px;
  font-weight: 850;
}

.lightbox-nav {
  top: 50%;
  display: grid;
  width: 52px;
  height: 64px;
  place-items: center;
  border-radius: var(--radius);
  transform: translateY(-50%);
  font-size: 3rem;
  line-height: 1;
}

.lightbox-prev {
  left: 16px;
}

.lightbox-next {
  right: 16px;
}

.lightbox-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 23, 36, 0.94);
  color: white;
  padding: 14px 18px;
}

.lightbox-caption div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.lightbox-caption div:last-child {
  text-align: right;
}

.lightbox-caption strong,
.lightbox-caption span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lightbox-caption span {
  color: #cbd5e1;
  font-size: 0.86rem;
}

.empty-roll {
  display: grid;
  gap: 18px;
  padding: clamp(18px, 4vw, 32px);
}

.empty-roll h3 {
  margin-bottom: 4px;
  font-size: 1.2rem;
}

.empty-roll p {
  margin-bottom: 0;
  color: var(--muted);
}

.placeholder-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.placeholder-tile {
  min-height: 150px;
  border: 1px dashed #a8b8c7;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(20, 108, 93, 0.1), rgba(201, 79, 62, 0.08)), white;
}

.not-found {
  padding: 28px;
}

@media (max-width: 920px) {
  .directory-hero,
  .auth-panel,
  .pipeline-panel,
  .job-status,
  .whatsapp-intake,
  .whitelist-form,
  .roll-header {
    grid-template-columns: 1fr;
  }

  .stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .site-header {
    align-items: flex-start;
    padding-top: 22px;
  }

  .header-action {
    display: none;
  }

  .app-shell,
  .site-header {
    width: min(100% - 24px, 1220px);
  }

  .hero-panel,
  .hero-photo {
    min-height: auto;
  }

  .stats-row,
  .pipeline-actions,
  .upload-form,
  .placeholder-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .auth-bar,
  .auth-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .review-head {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-head,
  .whitelist-item {
    align-items: stretch;
    flex-direction: column;
  }

  .temp-auth-form {
    grid-column: auto;
  }

  .review-summary {
    min-width: 0;
    grid-template-columns: auto auto;
    justify-content: center;
    gap: 6px;
  }

  .search-wrap {
    width: 100%;
  }

  .review-grid {
    grid-template-columns: 1fr;
  }

  .review-item {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .student-grid {
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 12px;
  }

  .student-card {
    min-height: 286px;
  }

  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
    gap: 12px;
  }

  .roll-photo-image img {
    aspect-ratio: 1;
  }

  .lightbox-backdrop {
    padding: 0;
  }

  .lightbox-shell {
    width: 100%;
    height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .lightbox-stage {
    padding: 64px 12px 12px;
  }

  .lightbox-nav {
    top: auto;
    bottom: 78px;
    width: 48px;
    height: 48px;
    font-size: 2.3rem;
    transform: none;
  }

  .lightbox-prev {
    left: 12px;
  }

  .lightbox-next {
    right: 12px;
  }

  .lightbox-caption {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
  }

  .lightbox-caption div:last-child {
    text-align: left;
  }
}

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