/* ==========================================================================
   St. Hugh PK4 Camera Rolls — Warm Keepsake design system
   See DESIGN.md. Paper-cream surfaces, warm cocoa ink, single ember accent,
   Fraunces display serif + Geist. Faces are the hero.
   ========================================================================== */

:root {
  /* Surfaces */
  --bg: #fbf8f3;            /* Paper Cream — primary canvas */
  --paper: #fffefb;        /* Warm Surface — panels */
  --surface: #ffffff;      /* Pure surface — cards, inputs */
  --surface-soft: #f3ede3; /* Sunlit Linen — recessed zones, skeleton base */
  --surface-mint: #fbeae1; /* Soft ember wash — tinted chips/states */

  /* Ink */
  --ink: #241f1b;          /* Cocoa Ink — primary text (never pure black) */
  --ink-soft: #4a423b;     /* Secondary headings */
  --muted: #7a7066;        /* Soft Taupe — metadata, captions */
  --line: rgba(36, 31, 27, 0.12);   /* Hairline */
  --line-strong: rgba(36, 31, 27, 0.2);

  /* Accent (single brand accent) */
  --primary: #c75d3c;      /* Ember Clay */
  --primary-dark: #a8482c; /* Deeper ember for tint-on-text + hover */
  --primary-wash: rgba(199, 93, 60, 0.1);
  --accent: #c75d3c;

  /* Functional signals (used sparingly, never as second brand color) */
  --sage: #5b7a5c;         /* Confidence */
  --sage-wash: #eaf0e7;
  --amber: #b8893b;        /* Needs review */
  --amber-wash: #f7eeda;
  --danger: #b23a23;
  --danger-wash: #fbe9e3;

  /* Depth — warm shadows tinted to the canvas, never gray */
  --shadow: 0 26px 60px rgba(36, 31, 27, 0.14);
  --soft-shadow: 0 12px 30px rgba(36, 31, 27, 0.07);
  --card-shadow: 0 10px 26px rgba(36, 31, 27, 0.08);

  /* Geometry */
  --radius: 14px;
  --radius-lg: 22px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  /* Type */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;

  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
  box-sizing: border-box;
}

/* The `hidden` attribute must win over author `display` rules (e.g. the
   inline-flex header buttons), otherwise hidden elements still render. */
[hidden] {
  display: none !important;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
  touch-action: pan-x pan-y;
}

body {
  width: 100%;
  max-width: 100%;
  min-width: 320px;
  overflow-x: hidden;
  margin: 0;
  background:
    radial-gradient(1200px 520px at 78% -8%, rgba(199, 93, 60, 0.07), transparent 60%),
    radial-gradient(900px 480px at 0% 0%, rgba(91, 122, 92, 0.06), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  touch-action: pan-x pan-y;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

::selection {
  background: var(--primary-wash);
  color: var(--ink);
}

/* --- Type primitives -------------------------------------------------------- */

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

h1 {
  margin-bottom: 0;
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-size: clamp(2.3rem, 5vw, 4.4rem);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.015em;
}

.hero-panel h2,
.auth-copy h2,
.roll-title h2,
.review-head h2,
.admin-head h2,
.pipeline-copy h2,
.toolbar h2,
.not-found h2,
.empty-roll h3,
.student-card h3 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary-dark);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: 12px;
  z-index: 60;
  transform: translateY(-160%);
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: transform 160ms var(--ease-out);
}

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

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

/* --- Shell + header --------------------------------------------------------- */

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

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

.site-header h1 {
  font-size: clamp(1.9rem, 3.4vw, 2.9rem);
}

.app-shell {
  padding: 8px 0 72px;
}

/* --- Buttons + links -------------------------------------------------------- */

.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;
  gap: 8px;
  border: 0;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
  transition:
    transform 200ms var(--ease-out),
    border-color 200ms var(--ease-out),
    background-color 200ms var(--ease-out),
    box-shadow 200ms var(--ease-out);
}

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

.header-action:hover,
.ghost-link:hover,
.ghost-button:hover {
  background: var(--surface);
  border-color: var(--ink-soft);
}

.primary-link,
.primary-button {
  background: var(--primary);
  color: #fff;
  padding: 11px 18px;
  box-shadow: 0 12px 24px rgba(199, 93, 60, 0.26);
}

.primary-link:hover,
.primary-button:hover {
  background: var(--primary-dark);
  box-shadow: 0 16px 30px rgba(199, 93, 60, 0.32);
}

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

.header-action:active,
.primary-link:active,
.ghost-link:active,
.primary-button:active,
.ghost-button:active,
.approve-button:active,
.reject-button:active {
  transform: translateY(0);
}

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

/* --- Shared panel surface --------------------------------------------------- */

.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-lg);
  background: var(--paper);
  box-shadow: var(--soft-shadow);
}

/* --- Directory hero --------------------------------------------------------- */

/* Compact directory hero — headline + a quiet stat strip, no image */
.directory-hero {
  margin-bottom: clamp(16px, 3vw, 26px);
}

.hero-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 36px;
  padding: clamp(20px, 3vw, 30px) clamp(22px, 3.5vw, 36px);
}

.hero-lede {
  min-width: 0;
}

.hero-panel h2 {
  max-width: 24ch;
  margin: 6px 0 0;
  font-size: clamp(1.5rem, 2.6vw, 2.15rem);
  line-height: 1.04;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(18px, 3vw, 36px);
  margin: 0;
}

.hero-stats > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hero-stats dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.hero-stats dt {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
}

/* WhatsApp intake banner — the upfront, primary way to add photos */
.whatsapp-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: clamp(16px, 3vw, 26px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  padding: clamp(15px, 2.4vw, 20px) clamp(16px, 2.6vw, 22px);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--soft-shadow);
  transition: transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out),
    border-color 200ms var(--ease-out);
}

.whatsapp-banner:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow);
  border-color: rgba(37, 168, 90, 0.45);
}

.whatsapp-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-pill);
  background: rgba(37, 211, 102, 0.14);
  color: #1ea952;
}

.whatsapp-icon svg {
  width: 24px;
  height: 24px;
}

.whatsapp-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.whatsapp-copy strong {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.12rem;
  letter-spacing: -0.01em;
}

.whatsapp-copy span {
  color: var(--muted);
  font-size: 0.92rem;
}

.whatsapp-copy b {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--ink);
}

.whatsapp-go {
  margin-left: auto;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--primary);
  font-weight: 600;
  white-space: nowrap;
}

.whatsapp-banner:hover .whatsapp-go {
  color: var(--primary-dark);
}

/* Header settings cog */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header-icon {
  width: 44px;
  padding: 0;
  color: var(--ink);
}

.header-icon svg {
  width: 20px;
  height: 20px;
}

.header-icon:hover {
  color: var(--primary);
}

/* Settings modal (whitelist management) */
.has-modal {
  overflow: hidden;
}

@keyframes sheetIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  align-content: start;
  justify-items: center;
  overflow-y: auto;
  background: rgba(26, 20, 16, 0.5);
  padding: clamp(20px, 8vh, 90px) 16px 40px;
  animation: fadeIn 200ms var(--ease-out);
}

.settings-sheet {
  width: min(560px, 100%);
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  padding: clamp(22px, 4vw, 32px);
  box-shadow: var(--shadow);
  animation: sheetIn 240ms var(--ease-out);
}

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

.settings-head h2 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.4rem, 2.4vw, 1.85rem);
  letter-spacing: -0.015em;
}

.settings-intro {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.settings-sheet .whitelist-form {
  grid-template-columns: 1fr;
  border-top: 0;
  padding-top: 0;
}

.settings-account {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px 16px;
}

.account-label {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.settings-account strong {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.98rem;
}

.settings-section {
  display: grid;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.settings-section-head h3 {
  margin: 4px 0 6px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}

.settings-section-head .settings-intro {
  margin: 0;
}

/* Intake modal — add a student (primary) or upload photos (secondary) */
.intake-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  align-content: start;
  justify-items: center;
  overflow-y: auto;
  background: rgba(26, 20, 16, 0.5);
  padding: clamp(20px, 8vh, 90px) 16px 40px;
  animation: fadeIn 200ms var(--ease-out);
}

.intake-sheet {
  width: min(540px, 100%);
  display: grid;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  padding: clamp(22px, 4vw, 32px);
  box-shadow: var(--shadow);
  animation: sheetIn 240ms var(--ease-out);
}

.intake-note {
  margin: 0;
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--ink-soft);
  padding: 12px 14px;
  font-size: 0.92rem;
}

.intake-note strong {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--ink);
}

.intake-block {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
}

.intake-block-head h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.intake-block-head p,
.intake-block > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.intake-block label {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 600;
}

.intake-block input[type="text"] {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  padding: 0 14px;
  transition: border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}

.intake-block input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-wash);
}

.intake-file input[type="file"] {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 8px;
  color: var(--ink);
}

.intake-file input[type="file"]::file-selector-button {
  min-height: 32px;
  margin-right: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-mint);
  color: var(--primary-dark);
  font-weight: 600;
}

.intake-block .primary-button {
  width: 100%;
}

.intake-secondary {
  border-top: 1px solid var(--line);
  padding-top: 6px;
}

.intake-secondary > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  list-style: none;
  padding: 6px 0;
}

.intake-secondary > summary::-webkit-details-marker {
  display: none;
}

.intake-secondary > summary::before {
  content: "+ ";
  color: var(--primary);
  font-family: var(--font-mono);
}

.intake-secondary[open] > summary::before {
  content: "\2013 ";
}

.intake-secondary .intake-block {
  margin-top: 8px;
}

.intake-status {
  margin: 0;
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 0.9rem;
  font-weight: 500;
  background: var(--surface-soft);
  color: var(--ink-soft);
}

.intake-status.is-running {
  background: var(--primary-wash);
  color: var(--primary-dark);
}

.intake-status.is-done {
  background: var(--sage-wash);
  color: #3c5640;
}

.intake-status.is-error {
  background: var(--danger-wash);
  color: #8a2c19;
}

/* Per-roll review — confirm candidate photos on the student's own profile */
.roll-review {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
  padding: clamp(18px, 3vw, 26px);
}

.roll-review-head h3 {
  margin: 6px 0 6px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.3rem, 2.2vw, 1.7rem);
  letter-spacing: -0.015em;
}

.roll-review-head p {
  margin: 0;
  max-width: 60ch;
  color: var(--muted);
}

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

.roll-review-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
  box-shadow: var(--card-shadow);
}

.roll-review-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.roll-review-crop,
.roll-review-ref {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.roll-review-ref {
  outline: 2px solid var(--sage-wash);
  outline-offset: -2px;
}

.roll-review-actions {
  display: grid;
  gap: 8px;
}

/* --- Auth ------------------------------------------------------------------- */

.auth-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(320px, 0.7fr);
  gap: clamp(22px, 4vw, 48px);
  align-items: center;
  margin-top: clamp(10px, 4vw, 40px);
  padding: clamp(28px, 5vw, 56px);
}

.auth-copy h2 {
  max-width: 16ch;
  margin-bottom: 14px;
  font-size: clamp(2.1rem, 4.6vw, 3.8rem);
  line-height: 1.02;
}

.auth-copy p:not(.eyebrow) {
  max-width: 52ch;
  color: var(--muted);
  font-size: 1.05rem;
}

.auth-form {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 22px;
  box-shadow: var(--card-shadow);
}

.auth-form label,
.whitelist-form label,
.upload-form label {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 600;
}

.auth-form input,
.whitelist-form input,
.upload-form input,
.search-field {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  padding: 0 14px;
  transition: border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}

.auth-form input:focus,
.whitelist-form input:focus,
.upload-form input:focus,
.search-field:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-wash);
}

.temp-auth-form {
  grid-column: 2;
  background: var(--surface-soft);
}

.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: 3px solid var(--sage);
  border-radius: var(--radius-sm);
  background: var(--sage-wash);
  color: #3c5640;
  padding: 11px 13px;
  font-size: 0.92rem;
  font-weight: 500;
}

.auth-message.is-error {
  border-left-color: var(--danger);
  background: var(--danger-wash);
  color: #8a2c19;
}

.auth-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  border-radius: var(--radius);
  padding: 12px 16px;
}

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

/* --- Admin / whitelist ------------------------------------------------------ */

.admin-panel {
  display: grid;
  gap: 20px;
  margin: 0 0 clamp(18px, 3vw, 28px);
  padding: clamp(20px, 3vw, 30px);
}

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

.admin-head h2,
.review-head h2 {
  margin-bottom: 7px;
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  line-height: 1.12;
}

.admin-head p:not(.eyebrow),
.review-head p:not(.eyebrow) {
  max-width: 64ch;
  margin-bottom: 0;
  color: var(--muted);
}

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

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

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

.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;
}

.whitelist-item span {
  font-family: var(--font-mono);
}

/* --- Pipeline / intake ------------------------------------------------------ */

.pipeline-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: 22px;
  margin: 0 0 clamp(18px, 3vw, 28px);
  padding: clamp(20px, 3vw, 30px);
}

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

.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: 76px;
  align-content: center;
  gap: 3px;
  padding: 14px;
  text-align: center;
}

.pipeline-actions small {
  color: currentColor;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 400;
  opacity: 0.74;
}

.upload-form {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 14px;
}

.upload-form input {
  padding: 8px;
}

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

.whatsapp-intake {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 0.75fr) minmax(240px, 1.25fr);
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 16px;
}

.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: 10px;
  margin: 0;
}

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

.whatsapp-intake dt {
  color: var(--primary-dark);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

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

.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: var(--radius-pill);
  padding: 5px 12px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
}

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

.count-pill {
  align-self: center;
  background: var(--amber-wash);
  color: #7d5a1c;
}

.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: 9px;
  border-radius: var(--radius-pill);
  background: var(--primary);
  vertical-align: middle;
  animation: pulse 1.6s var(--ease-out) infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.7);
  }
}

.job-log {
  min-height: 92px;
  max-height: 176px;
  overflow: auto;
  margin: 0;
  border: 1px solid rgba(36, 31, 27, 0.5);
  border-radius: var(--radius);
  background: #2b241f;
  color: #f0e7dd;
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

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

/* --- Review queue ----------------------------------------------------------- */

.review-panel {
  display: grid;
  gap: 20px;
  margin: 0 0 clamp(18px, 3vw, 28px);
  padding: clamp(20px, 3vw, 30px);
}

.review-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 20px;
}

.review-summary {
  display: grid;
  min-width: 108px;
  align-content: center;
  border-radius: var(--radius);
  background: var(--amber-wash);
  color: #7d5a1c;
  padding: 12px 16px;
  text-align: center;
}

.review-summary strong {
  font-family: var(--font-mono);
  font-size: 1.7rem;
  font-weight: 500;
  line-height: 1;
}

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

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

.review-item {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 16px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
  box-shadow: var(--card-shadow);
}

.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-sm);
  object-fit: cover;
  background: var(--surface-soft);
}

.review-reference {
  outline: 2px solid var(--sage-wash);
  outline-offset: -2px;
}

.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(--sage);
  font-family: var(--font-mono);
  font-weight: 500;
}

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

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

.approve-button,
.reject-button {
  min-height: 40px;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.86rem;
}

.approve-button {
  border: 1px solid rgba(91, 122, 92, 0.32);
  background: var(--sage-wash);
  color: #3c5640;
}

.approve-button:hover {
  background: #dfe9da;
}

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

.reject-button:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* --- Directory toolbar + grid ----------------------------------------------- */

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: clamp(16px, 3vw, 28px) 0 18px;
}

.toolbar h2 {
  margin-bottom: 0;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
}

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

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

.search-field {
  box-shadow: var(--card-shadow);
}

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

.student-card {
  display: flex;
  min-height: 312px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-decoration: none;
  box-shadow: var(--card-shadow);
  transition:
    transform 220ms var(--ease-out),
    box-shadow 220ms var(--ease-out),
    border-color 220ms var(--ease-out);
}

.student-card:hover {
  transform: translateY(-4px);
  border-color: rgba(199, 93, 60, 0.4);
  box-shadow: var(--shadow);
}

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

.portrait {
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--surface-soft);
}

.portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 500ms var(--ease-out);
}

.student-card:hover .portrait img {
  transform: scale(1.04);
}

.student-card-body {
  display: grid;
  min-height: 96px;
  align-content: center;
  gap: 8px;
  padding: 16px 16px 18px;
}

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

.card-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

.card-count {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

/* Always-visible "Open roll →" so it's obvious each card opens a camera roll,
   even on touch where there's no hover. */
.card-cta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--primary);
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
}

.card-cta::after {
  content: "\2192"; /* → */
  font-size: 0.95rem;
  transition: transform 220ms var(--ease-out);
}

.student-card:hover .card-cta {
  color: var(--primary-dark);
}

.student-card:hover .card-cta::after {
  transform: translateX(3px);
}

/* --- Roll view -------------------------------------------------------------- */

.roll-view {
  display: grid;
  gap: clamp(18px, 3vw, 26px);
}

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

.roll-header {
  display: grid;
  grid-template-columns: minmax(150px, 240px) minmax(0, 1fr);
  gap: clamp(20px, 4vw, 38px);
  overflow: hidden;
  padding: clamp(20px, 4vw, 38px);
}

.roll-header .portrait {
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

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

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

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

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

/* Instagram-style photo wall — square tiles, no captions */
.roll-feed-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(4px, 0.6vw, 8px);
  width: min(940px, 100%);
  margin: 0 auto;
}

.roll-feed-tile {
  aspect-ratio: 1;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  padding: 0;
  background: var(--surface-soft);
}

.roll-feed-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 450ms var(--ease-out), opacity 200ms var(--ease-out);
}

.roll-feed-tile:hover img,
.roll-feed-tile:focus-visible img {
  transform: scale(1.05);
  opacity: 0.92;
}

.roll-feed-tile:active img {
  transform: scale(1.02);
}

/* --- Lightbox --------------------------------------------------------------- */

.has-lightbox {
  overflow: hidden;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Feed viewer — tap a tile, scroll the whole roll vertically like a feed */
.feed-viewer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(12px, 2.2vw, 26px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: auto;
  background: #1a1410;
  padding: 76px 16px 76px;
  animation: fadeIn 200ms var(--ease-out);
}

.feed-viewer-close {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 60;
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-sm);
  background: rgba(251, 248, 243, 0.94);
  color: var(--ink);
  padding: 9px 16px;
  font-weight: 600;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
  transition: transform 180ms var(--ease-out), background-color 180ms var(--ease-out);
}

.feed-viewer-close:hover {
  background: #fff;
  transform: translateY(-1px);
}

.feed-post {
  width: min(600px, 100%);
  margin: 0;
  scroll-margin-top: 76px;
}

.feed-post img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 86vh;
  margin: 0 auto;
  border-radius: var(--radius);
  object-fit: contain;
  background: #100d0b;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.45);
}

/* --- Empty + not-found ------------------------------------------------------ */

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

.empty-roll h3 {
  margin-bottom: 6px;
  font-size: 1.3rem;
}

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

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

.placeholder-tile {
  min-height: 152px;
  border-radius: var(--radius);
  background:
    linear-gradient(
      100deg,
      var(--surface-soft) 30%,
      rgba(255, 255, 255, 0.7) 50%,
      var(--surface-soft) 70%
    );
  background-size: 220% 100%;
  animation: shimmer 1.8s linear infinite;
}

@keyframes shimmer {
  from {
    background-position: 180% 0;
  }
  to {
    background-position: -80% 0;
  }
}

.not-found {
  padding: clamp(26px, 5vw, 40px);
}

.not-found h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

/* --- Responsive ------------------------------------------------------------- */

@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,
  .app-shell {
    width: min(100% - 24px, 1240px);
  }

  .site-header {
    align-items: flex-start;
    padding-top: 24px;
  }

  .whatsapp-banner {
    flex-wrap: wrap;
  }

  .whatsapp-copy {
    flex: 1 1 60%;
  }

  .whatsapp-go {
    margin-left: calc(46px + 16px);
    margin-top: 2px;
  }

  .header-action:not(.header-icon) {
    display: none;
  }

  .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,
  .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: 100px minmax(0, 1fr);
  }

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

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

  .student-card h3 {
    font-size: 1.05rem;
  }

  .roll-feed-grid {
    width: 100%;
    gap: 2px;
  }

  .roll-feed-tile {
    border-radius: 0;
  }

  .feed-viewer {
    padding: 64px 0 72px;
    gap: 6px;
  }

  .feed-post img {
    border-radius: 0;
  }
}

@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;
  }
}
