:root {
  --bg: #f3eee4;
  --bg-accent: #ebe2d2;
  --card: rgba(255, 251, 244, 0.96);
  --card-muted: #f5ecdd;
  --ink: #221b14;
  --muted: #746759;
  --line: rgba(34, 27, 20, 0.12);
  --primary: #8a6a35;
  --primary-dark: #5d4520;
  --primary-soft: #eadbbd;
  --accent: #b38a46;
  --success: #3f8757;
  --error: #b14f42;
  --shadow: 0 26px 56px rgba(90, 63, 22, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(179, 138, 70, 0.16), transparent 26%),
    linear-gradient(180deg, #f8f3ea 0%, var(--bg) 55%, var(--bg-accent) 100%);
}

.page-shell {
  margin: 0 auto;
  padding: 20px 20px 64px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin: 0 0 28px;
  padding: 10px 12px;
  border: 1px solid rgba(34, 27, 20, 0.1);
  border-radius: 18px;
  background: rgba(255, 250, 242, 0.92);
  box-shadow: 0 14px 34px rgba(90, 63, 22, 0.08);
  backdrop-filter: blur(12px);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
}

.hero h1,
.card h2,
.section-head h2 {
  margin: 0;
}

.brand-logo {
  display: block;
  width: auto;
  height: 44px;
  max-width: min(36vw, 210px);
  object-fit: contain;
}

.brand-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.brand-copy strong {
  font-size: 0.94rem;
  line-height: 1.1;
}

.brand-copy span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.1;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.76rem;
  color: var(--primary);
  font-weight: 800;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.site-nav a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 0.86rem;
  font-weight: 800;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  border-color: rgba(34, 27, 20, 0.12);
  background: rgba(255, 251, 244, 0.78);
}

.site-nav a.active {
  background: var(--ink);
  color: #fffaf0;
  border-color: var(--ink);
}

.nav-divider {
  width: 1px;
  height: 24px;
  background: rgba(34, 27, 20, 0.14);
}

.nav-workflow-link {
  background: rgba(255, 251, 244, 0.46);
}

.hero {
  display: grid;
  gap: 12px;
  margin-bottom: 28px;
  padding: 0 0 12px;
}

.hero h1 {
  max-width: 900px;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(2.7rem, 5vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
}

.subtitle,
.section-head p,
.drop-zone-text,
.result-meta,
.match-meta {
  color: var(--muted);
}

.page-content {
  display: grid;
  gap: 22px;
}

.workspace {
  display: grid;
  gap: 22px;
}

.status-grid {
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  align-items: start;
}

.status-grid .card {
  min-width: 0;
  padding: 18px;
  border-radius: 20px;
}

.status-grid .section-head.compact {
  margin-bottom: 10px;
}

.card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 28px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.quiet-card {
  padding-top: 34px;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 24px;
}

.section-head.compact {
  margin-bottom: 18px;
}

.section-head > p {
  max-width: 560px;
  margin: 0;
  line-height: 1.65;
}

.section-head h2 {
  font-family: "Cormorant Garamond", serif;
  font-size: 2rem;
  font-weight: 700;
}

.upload-form {
  display: grid;
  gap: 18px;
}

.toggle-row {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.search-results-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.result-download-tools {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.search-results-tools .result-download-tools,
.result-download-tools .result-quality-toggle {
  margin-top: 0;
}

.result-quality-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffaf1;
}

.result-quality-toggle button {
  min-height: 34px;
  padding: 8px 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  font-size: 0.86rem;
  font-weight: 800;
}

.result-quality-toggle button.active {
  background: var(--primary);
  color: #fffaf2;
}

.result-quality-current {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.drop-zone,
.single-upload {
  border: 1.5px dashed rgba(138, 106, 53, 0.32);
  border-radius: 28px;
  min-height: 240px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 28px;
  background:
    radial-gradient(circle at top, rgba(179, 138, 70, 0.09), transparent 36%),
    linear-gradient(180deg, rgba(255, 252, 246, 0.95), rgba(247, 239, 226, 0.96));
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
  cursor: pointer;
}

.drop-zone.drag-over,
.single-upload.drag-over,
.single-upload:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  background:
    radial-gradient(circle at top, rgba(179, 138, 70, 0.14), transparent 42%),
    linear-gradient(180deg, rgba(255, 251, 243, 1), rgba(255, 255, 255, 1));
  box-shadow: 0 18px 34px rgba(138, 106, 53, 0.12);
}

.drop-zone-title {
  display: block;
  font-family: "Cormorant Garamond", serif;
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-start;
}

button,
.secondary-button {
  border: 0;
  border-radius: 999px;
  padding: 15px 24px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  color: #fffaf2;
  background: linear-gradient(135deg, #7a5929, var(--primary));
  box-shadow: 0 14px 28px rgba(122, 89, 41, 0.18);
}

.secondary-button {
  color: var(--primary-dark);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  box-shadow: none;
}

.inline-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--primary-dark);
  font-weight: 800;
}

.inline-control select {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: #fffdf8;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
}

.status-surface {
  min-height: 84px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--card-muted);
  padding: 18px;
  display: flex;
  align-items: center;
  line-height: 1.6;
}

.status-surface.loading-state {
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
}

.status-loader-message {
  min-width: 0;
  overflow-wrap: anywhere;
}

.upload-status-surface {
  display: grid;
  gap: 12px;
  align-items: stretch;
  min-width: 0;
  line-height: 1.35;
}

.upload-status-surface.success {
  border-color: rgba(63, 135, 87, 0.28);
  background: rgba(63, 135, 87, 0.08);
}

.upload-status-surface.warning {
  border-color: rgba(177, 118, 43, 0.32);
  background: rgba(177, 118, 43, 0.08);
}

.upload-status-surface.error {
  border-color: rgba(177, 79, 66, 0.3);
  background: rgba(177, 79, 66, 0.08);
}

.upload-status-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.upload-status-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.upload-status-copy strong {
  color: var(--ink);
  font-size: 0.98rem;
  overflow-wrap: anywhere;
}

.upload-status-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.upload-status-spinner {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  border: 2px solid rgba(138, 106, 53, 0.22);
  border-top-color: var(--primary-dark);
  border-radius: 999px;
  animation: upload-status-spin 750ms linear infinite;
}

@keyframes upload-status-spin {
  to {
    transform: rotate(360deg);
  }
}

.upload-status-copy span {
  color: var(--muted);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.upload-status-badge {
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(138, 106, 53, 0.12);
  color: var(--primary-dark);
  font-size: 0.76rem;
  font-weight: 900;
  white-space: nowrap;
}

.upload-status-progress {
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: rgba(138, 106, 53, 0.14);
}

.upload-status-progress span {
  display: block;
  height: 100%;
  min-width: 8px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--success));
  transition: width 180ms ease;
}

.upload-status-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.upload-status-metric {
  display: grid;
  gap: 2px;
  min-width: 0;
  border: 1px solid rgba(138, 106, 53, 0.14);
  border-radius: 12px;
  padding: 7px 8px;
  background: rgba(255, 255, 255, 0.68);
}

.upload-status-metric.metric-total {
  background: #f1f6ff;
  border-color: #d8e5ff;
}

.upload-status-metric.metric-uploaded {
  background: #f4f1ff;
  border-color: #ded8f7;
}

.upload-status-metric.metric-indexed {
  background: #eef9f2;
  border-color: #d3ecd9;
}

.upload-status-metric.metric-failed {
  background: #fff0ee;
  border-color: #f3d1cc;
}

.upload-status-metric.metric-uploading {
  background: #fff8e8;
  border-color: #f1dfb8;
}

.upload-status-metric.metric-waiting {
  background: #eef7f8;
  border-color: #cfe6e8;
}

.upload-status-metric span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.upload-status-metric strong {
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.05;
}

.upload-status-error {
  border-radius: 12px;
  padding: 9px 10px;
  background: rgba(177, 79, 66, 0.1);
  color: #9b2c1f;
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
}

.pill-list li {
  max-width: 100%;
  overflow-wrap: anywhere;
  background: linear-gradient(180deg, #fff, #f7fbfd);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 7px 10px;
  font-size: 0.82rem;
  line-height: 1.3;
}

.status-grid .pill-list {
  max-height: 148px;
  overflow: auto;
  padding-right: 2px;
}

.result-scroll-sentinel {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 700;
  text-align: center;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
  margin-top: 14px;
}

#bulk-results.results-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: start;
}

.result-card,
.match-card {
  min-width: 0;
  background: linear-gradient(180deg, #fffdf8, #f8f0e3);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
}

.result-card {
  display: grid;
  gap: 16px;
  align-content: start;
}

.result-card h4,
.match-card h4 {
  margin: 6px 0 0;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.55rem;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.match-current-quality {
  display: inline-flex;
  width: fit-content;
  margin-top: 8px;
}

.result-card-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  min-width: 0;
}

.result-card-head > div {
  min-width: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 12px;
  width: fit-content;
}

.badge.success {
  background: rgba(30, 157, 103, 0.12);
  color: var(--success);
}

.badge.error {
  background: rgba(217, 72, 95, 0.12);
  color: var(--error);
}

.result-meta,
.match-meta {
  display: grid;
  gap: 6px;
  font-size: 0.93rem;
  line-height: 1.55;
}

.result-preview-shell {
  border-radius: 20px;
  overflow: hidden;
  background: #efe3cf;
}

.result-preview {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
  border-radius: 18px;
}

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

.stat-chip {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.52);
}

.stat-label,
.subsection-title,
.meta-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--primary);
}

.stat-chip strong {
  font-size: 1rem;
  line-height: 1.2;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.meta-list {
  display: grid;
  gap: 10px;
}

.meta-list.compact {
  gap: 8px;
}

.meta-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.meta-value {
  color: var(--ink);
  line-height: 1.5;
  min-width: 0;
  overflow-wrap: anywhere;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.8rem;
}

.face-gallery-block {
  display: grid;
  gap: 12px;
  padding-top: 4px;
  border-top: 1px solid rgba(34, 27, 20, 0.08);
}

.face-gallery {
  display: grid;
  gap: 12px;
}

.face-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px;
  background: linear-gradient(180deg, #fbf5ea, #f5ead7);
  min-width: 0;
}

.face-card img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 12px;
}

.face-meta {
  display: grid;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
  min-width: 0;
}

.face-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.face-card-head strong {
  font-size: 0.98rem;
  color: var(--ink);
}

.face-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.72rem;
  font-weight: 700;
}

.face-status.ok {
  background: rgba(63, 135, 87, 0.12);
  color: var(--success);
}

.face-status.fail {
  background: rgba(177, 79, 66, 0.12);
  color: var(--error);
}

.match-image-shell {
  position: relative;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 16px;
  background: #efe3cf;
}

.match-image-button {
  width: 100%;
  height: 100%;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
  box-shadow: none;
  cursor: zoom-in;
}

.match-card .match-image,
.search-media-image {
  width: 100%;
  height: 100%;
  object-fit: fill;
  border-radius: 16px;
  display: block;
}

.match-box-overlay {
  position: absolute;
  border: 2px solid #1c9a50;
  border-radius: 8px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.55),
    0 0 0 1px rgba(10, 28, 16, 0.18);
  pointer-events: none;
}

.match-card.hide-overlays .match-box-overlay {
  display: none;
}

.search-media-viewer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
}

.search-media-viewer.hidden,
.search-media-overlay.hidden {
  display: none;
}

.search-media-backdrop {
  position: absolute;
  inset: 0;
  padding: 0;
  border-radius: 0;
  background: rgba(10, 8, 5, 0.78);
  box-shadow: none;
}

.search-media-stage {
  position: relative;
  z-index: 1;
  width: min(96vw, 1180px);
  max-height: 92vh;
  display: grid;
  gap: 12px;
  place-items: center;
}

.search-media-image-shell {
  position: relative;
  max-width: 100%;
  max-height: calc(92vh - 58px);
  overflow: hidden;
  border-radius: 18px;
  background: #111;
}

.search-media-image {
  max-width: min(96vw, 1180px);
  max-height: calc(92vh - 58px);
  border-radius: 18px;
}

.search-media-close {
  position: absolute;
  top: -14px;
  right: -14px;
  z-index: 2;
  width: 42px;
  height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  background: #fffaf2;
  color: var(--ink);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.22);
}

.search-media-caption {
  color: #fffaf2;
  font-weight: 800;
  text-align: center;
  overflow-wrap: anywhere;
}

.empty-state {
  color: var(--muted);
}

.result-link-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
}

.result-link-panel.hidden {
  display: none;
}

.result-link-panel span {
  font-weight: 800;
  color: var(--primary-dark);
}

.result-link-panel input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  font: inherit;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  margin-bottom: 18px;
  padding: 18px 2px 8px;
}

.home-hero h1 {
  max-width: 980px;
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(2.1rem, 4vw, 4.35rem);
  line-height: 1;
}

.home-hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.primary-action,
.secondary-button {
  text-decoration: none;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: #fffaf0;
  padding: 10px 16px;
  font-weight: 900;
}

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

.home-action-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  min-height: 174px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 14px 30px rgba(90, 63, 22, 0.08);
}

.home-action-card:hover,
.home-action-card:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(34, 27, 20, 0.22);
}

.home-action-kicker {
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.home-action-card strong {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.55rem;
  line-height: 1;
}

.home-action-card span:last-child {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

@media (max-width: 1100px) {
  .home-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .status-grid {
    grid-template-columns: 1fr;
  }

  .result-stats {
    grid-template-columns: 1fr;
  }

  #bulk-results.results-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 16px 14px 44px;
  }

  .card {
    padding: 20px;
    border-radius: 24px;
  }

  .brand-mark {
    align-items: flex-start;
  }

  .brand-logo {
    height: 40px;
    max-width: min(52vw, 190px);
  }

  .brand-copy {
    display: none;
  }

  .site-nav {
    width: 100%;
  }

  .site-nav a,
  .nav-logout-form {
    flex: 1 1 0;
  }

  .site-nav a,
  .nav-logout-button {
    text-align: center;
  }

  .nav-logout-button {
    width: 100%;
  }

  .home-hero,
  .home-action-grid {
    grid-template-columns: 1fr;
  }

  .home-hero-actions {
    justify-content: flex-start;
  }

  .drop-zone,
  .single-upload {
    min-height: 180px;
  }

  .result-link-panel {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: 3rem;
  }

  .face-card {
    grid-template-columns: 1fr;
  }

  .meta-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .face-card img {
    width: 100%;
    height: 180px;
  }

  #bulk-results.results-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-app-body .page-shell {
    padding: 0;
  }

  .search-app-body .page-content {
    min-height: 100vh;
  }

  .phone-frame {
    width: 100%;
    height: 100vh;
    border-radius: 0;
    padding: 0;
  }

  .phone-notch {
    display: none;
  }

  .whatsapp-app {
    border-radius: 0;
  }
}

@media (max-width: 520px) {
  #bulk-results.results-grid {
    grid-template-columns: 1fr;
  }
}

.result-logo-header {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 28px;
}

.result-logo-header .brand-logo {
  height: 68px;
  max-width: min(72vw, 360px);
}

.field-stack {
  display: grid;
  gap: 8px;
  font-weight: 800;
  color: var(--primary-dark);
}

.field-stack input {
  width: min(100%, 520px);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font: inherit;
}

.hidden {
  display: none !important;
}

.event-qr-result {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.qr-preview-shell {
  width: min(100%, 360px);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: #fff;
}

.qr-preview-shell img {
  display: block;
  width: 100%;
  height: auto;
}

.field-stack select {
  width: min(100%, 720px);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font: inherit;
}

.danger-button {
  background: linear-gradient(135deg, #8f2e25, #b14f42);
}

.event-candidate-panel {
  display: grid;
  gap: 14px;
  min-height: 84px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--card-muted);
  padding: 18px;
  line-height: 1.6;
}

.event-candidate-panel .meta-row {
  grid-template-columns: 120px minmax(0, 1fr);
}

.event-candidate-panel .meta-value {
  overflow-wrap: anywhere;
}

.status-note {
  border-radius: 16px;
  padding: 12px 14px;
  font-weight: 800;
}

.status-note.success {
  background: rgba(63, 135, 87, 0.12);
  color: var(--success);
}

.status-note.error,
.event-candidate-panel.error {
  background: rgba(177, 79, 66, 0.1);
  color: var(--error);
}

.event-card-grid {
  display: grid;
  gap: 16px;
}

.admin-events-section {
  display: grid;
  gap: 16px;
}

.event-admin-card {
  display: grid;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 22px;
  min-width: 0;
}

.event-card-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.event-card-title {
  min-width: 0;
}

.event-card-title h3 {
  margin: 3px 0 4px;
  color: var(--ink);
  font-size: 1.22rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.event-card-date {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.event-card-admin-actions,
.event-health-strip,
.event-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.event-card-grid.deleting .event-admin-card:not(.is-deleting) {
  opacity: 0.58;
}

.event-admin-card.is-deleting {
  outline: 2px solid rgba(176, 71, 50, 0.28);
  outline-offset: 3px;
}

button.is-loading {
  cursor: progress;
  position: relative;
}

button.is-loading::after {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -2px;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.event-resource-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.event-card-admin-actions {
  justify-content: flex-end;
  align-items: flex-start;
}

.event-health-strip {
  justify-content: flex-end;
}

.event-card-actions {
  justify-content: center;
}

.compact-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 14px;
  font-size: 0.88rem;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

.compact-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.event-card-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 18px;
  align-items: stretch;
}

.event-resource-list {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.event-resource-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 250, 242, 0.74);
  padding: 14px;
  min-width: 0;
}

.event-resource-copy {
  min-width: 0;
}

.event-resource-card p {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
}

.event-resource-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.event-qr-panel {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 250, 242, 0.74);
  padding: 14px;
}

.event-qr-panel.unavailable {
  justify-items: start;
  color: var(--muted);
}

.event-qr-panel.unavailable p {
  margin: 8px 0 0;
  line-height: 1.5;
}

.event-card-qr {
  width: 100%;
  max-width: 170px;
  padding: 8px;
  border-radius: 14px;
}

.resource-status {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.resource-status.active {
  color: var(--success);
  background: rgba(63, 135, 87, 0.12);
}

.resource-status.missing {
  color: var(--error);
  background: rgba(177, 79, 66, 0.1);
}

.resource-status.progress {
  color: #2f6f9e;
  background: rgba(47, 111, 158, 0.12);
}

.resource-status.rollback {
  color: #9a5c12;
  background: rgba(154, 92, 18, 0.12);
}

.resource-status.deleted {
  color: var(--muted);
  background: rgba(116, 103, 89, 0.12);
}

.resource-status.neutral {
  color: var(--primary-dark);
  background: rgba(138, 106, 53, 0.12);
}

@media (max-width: 860px) {
  .event-card-header,
  .event-card-body,
  .event-resource-card {
    grid-template-columns: 1fr;
  }

  .event-card-header {
    display: grid;
  }

  .event-card-admin-actions,
  .event-health-strip,
  .event-card-actions {
    justify-content: flex-start;
  }

  .event-qr-panel {
    justify-items: start;
  }

  .event-card-qr {
    max-width: 220px;
  }
}

.wa-event-select-row {
  padding: 8px 10px;
  background: #f4efe7;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.wa-event-select-row select {
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 14px;
  padding: 9px 10px;
  background: #fff;
  color: #1f2a22;
  font: inherit;
  font-size: 0.9rem;
}

.whatsapp-gallery-upload-page {
  display: grid;
  gap: 16px;
  width: min(100%, 560px);
  margin: 0 auto;
}


.upload-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(96px, 1fr));
  gap: 10px;
  overflow-x: auto;
}

.whatsapp-gallery-upload-page .upload-choice-panel {
  min-height: 150px;
  min-width: 96px;
  box-sizing: border-box;
  gap: 8px;
  overflow: hidden;
  padding: 12px 6px;
}

.camera-choice-panel {
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.camera-capture-panel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.98), rgba(247, 239, 226, 0.94));
}

.gallery-camera-shell {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(138, 106, 53, 0.2);
  border-radius: 18px;
  background: #101010;
  aspect-ratio: 4 / 3;
}

.gallery-camera-video {
  display: block;
  width: 100%;
  height: 100%;
  background: #111;
  object-fit: cover;
}

.gallery-camera-video.is-front-camera {
  transform: scaleX(-1);
}

.camera-tool-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.camera-tool-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 999px;
}

.camera-tool-button svg {
  width: 22px;
  height: 22px;
}

.gallery-zoom-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  border: 1px solid rgba(138, 106, 53, 0.2);
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
}

.gallery-zoom-control input {
  min-width: 0;
  width: 100%;
}

.gallery-zoom-control strong {
  min-width: 34px;
  text-align: right;
  white-space: nowrap;
}

.gallery-camera-preview {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  min-height: 54px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 8px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.gallery-camera-preview.empty-state {
  display: grid;
  place-items: center;
  border: 1px dashed rgba(138, 106, 53, 0.28);
  border-radius: 14px;
  padding: 12px;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
}

.gallery-camera-thumb {
  display: grid;
  gap: 8px;
  flex: 0 0 132px;
  width: 132px;
  min-width: 132px;
  border: 1px solid rgba(138, 106, 53, 0.2);
  border-radius: 14px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.74);
  scroll-snap-align: start;
}

.gallery-camera-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  object-fit: cover;
  background: #111;
}

.gallery-camera-thumb-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
  font-size: 0.78rem;
  line-height: 1.2;
}

.gallery-camera-thumb-meta strong,
.gallery-camera-thumb-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-camera-thumb-actions {
  display: grid;
  justify-items: stretch;
}

.camera-mini-button {
  display: grid;
  place-items: center;
  min-height: 34px;
  padding: 7px 6px;
  border-radius: 10px;
  line-height: 1;
}

.camera-mini-button svg {
  width: 18px;
  height: 18px;
}

.camera-mini-button.danger {
  background: #fff2ef;
  color: #9b2c1f;
}

.camera-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

@media (max-width: 380px) {
  .camera-tool-row,
  .camera-action-row {
    grid-template-columns: 1fr;
  }

  .camera-tool-button {
    justify-self: center;
  }
}

.whatsapp-gallery-upload-page .upload-choice-panel .drop-zone-title {
  max-width: 100%;
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: center;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.2;
}

@media (max-width: 380px) {
  .whatsapp-gallery-upload-page .upload-choice-panel .drop-zone-title {
    font-size: 0.82rem;
  }
}

.whatsapp-gallery-upload-page .upload-icon {
  display: block;
  width: 44px;
  height: 44px;
  color: var(--primary-dark);
  flex: 0 0 auto;
}

.whatsapp-gallery-upload-page .upload-form {
  gap: 14px;
}

.whatsapp-gallery-upload-page #selected-files {
  display: none;
}

.compact-actions {
  gap: 10px;
}

.selfie-capture-page {
  display: grid;
  gap: 18px;
  width: min(100%, 520px);
  margin: 0 auto;
}

.selfie-camera-shell {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: #111;
  aspect-ratio: 3 / 4;
}

.selfie-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

#selfie-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #111;
}

.selfie-shutter {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: #fff;
  opacity: 0;
}

.selfie-shutter.is-active {
  animation: selfieShutterFlash 220ms ease-out;
}

.selfie-upload-overlay {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(18, 28, 24, 0.84);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

.selfie-upload-overlay.hidden {
  display: none;
}

.selfie-upload-spinner {
  width: 18px;
  height: 18px;
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: upload-status-spin 750ms linear infinite;
  flex: 0 0 auto;
}

.selfie-face-guide {
  position: absolute;
  left: 15%;
  top: 16%;
  width: 70%;
  height: 72%;
  z-index: 4;
  pointer-events: none;
  transition: filter 160ms ease, opacity 160ms ease;
}

.selfie-face-guide-head {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 100%;
  border: 5px solid #d92d20;
  border-radius: 48% 48% 45% 45% / 40% 40% 56% 56%;
  background: rgba(217, 45, 32, 0.07);
  box-shadow: 0 0 0 999px rgba(10, 13, 12, 0.08), 0 0 22px rgba(217, 45, 32, 0.45);
}

.selfie-face-guide-neck {
  display: none;
}

.selfie-face-guide.is-valid .selfie-face-guide-head,
.selfie-face-guide.is-valid .selfie-face-guide-neck {
  border-color: #16a34a;
  box-shadow: 0 0 0 999px rgba(10, 13, 12, 0.04), 0 0 24px rgba(22, 163, 74, 0.58);
}

.selfie-face-guide.is-valid .selfie-face-guide-head {
  background: rgba(22, 163, 74, 0.08);
}

.selfie-status {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font-weight: 800;
  line-height: 1.4;
}

.selfie-actions {
  display: flex;
  justify-content: center;
}

.selfie-actions button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.selfie-complete {
  justify-content: center;
  text-align: center;
  color: var(--success);
  font-weight: 900;
}

.selfie-liveness-panel {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 12px;
  z-index: 6;
  display: grid;
  gap: 8px;
}

.selfie-liveness-panel .selfie-status {
  position: static;
  left: auto;
  right: auto;
  bottom: auto;
}

.selfie-prompt {
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(18, 28, 24, 0.78);
  color: #fffaf2;
  font-size: clamp(0.98rem, 4.4vw, 1.2rem);
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
}

.selfie-prompt-inline,
.selfie-blink-eyes {
  display: inline-flex;
  align-items: center;
}

.selfie-prompt-inline {
  gap: 0.55em;
}

.selfie-blink-eyes {
  gap: 0.24em;
  font-size: 1em;
}

.selfie-blink-eye {
  position: relative;
  width: 0.74em;
  height: 0.42em;
  border: 0.12em solid currentColor;
  border-radius: 999px 999px 70% 70%;
  background: rgba(255, 255, 255, 0.16);
  transform-origin: center;
  animation: selfieInlineBlink 1.25s ease-in-out infinite;
}

.selfie-blink-eye::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.2em;
  height: 0.2em;
  border-radius: 999px;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.selfie-blink-eye + .selfie-blink-eye {
  animation-delay: 0.03s;
}

.selfie-marks {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.selfie-marks span {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.86);
}

.selfie-marks span.complete {
  background: var(--success);
  border-color: var(--success);
}

.selfie-countdown {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  background: rgba(18, 28, 24, 0.42);
  color: #fffaf2;
  font-size: clamp(5rem, 24vw, 9rem);
  font-weight: 900;
  line-height: 1;
}

.selfie-countdown.is-message {
  padding: 24px;
  text-align: center;
  font-size: clamp(2rem, 11vw, 4rem);
  line-height: 1.05;
}

.selfie-countdown.is-paused {
  background: transparent;
}

@keyframes selfieInlineBlink {
  0%, 36%, 100% { transform: scaleY(1); }
  46%, 54% { transform: scaleY(0.12); }
}

@keyframes selfieShutterFlash {
  0% { opacity: 0; }
  16% { opacity: 0.88; }
  100% { opacity: 0; }
}

.selfie-cue {
  display: none;
  position: absolute;
  inset: 8% 0 auto;
  place-items: center;
  pointer-events: none;
  opacity: 0.74;
  z-index: 2;
  perspective: 900px;
}

.cue-head {
  position: relative;
  width: min(46vw, 190px);
  aspect-ratio: 0.82 / 1;
  transform-style: preserve-3d;
  transform-origin: 50% 58%;
}

.cue-face {
  position: absolute;
  inset: 0;
  border: 3px solid rgba(255, 250, 242, 0.78);
  border-radius: 46% 46% 43% 43% / 42% 42% 50% 50%;
  background:
    radial-gradient(circle at 50% 46%, rgba(255, 250, 242, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(255, 250, 242, 0.18), rgba(18, 28, 24, 0.1));
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.24), inset 0 0 36px rgba(255, 250, 242, 0.08);
  transform-style: preserve-3d;
}

.cue-ear {
  position: absolute;
  top: 39%;
  width: 12%;
  height: 18%;
  border: 3px solid rgba(255, 250, 242, 0.58);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.1);
}

.cue-ear-left {
  left: -7%;
}

.cue-ear-right {
  right: -7%;
}

.cue-brow {
  position: absolute;
  top: 32%;
  width: 20%;
  height: 4%;
  border-top: 4px solid rgba(255, 250, 242, 0.72);
  border-radius: 999px;
}

.cue-brow-left {
  left: 25%;
  transform: rotate(-5deg);
}

.cue-brow-right {
  right: 25%;
  transform: rotate(5deg);
}

.cue-eye {
  position: absolute;
  top: 39%;
  width: 18%;
  height: 9%;
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.86);
  box-shadow: inset 0 -4px 0 rgba(18, 28, 24, 0.18);
  overflow: hidden;
}

.cue-eye::before,
.cue-eye::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 50%;
  background: rgba(18, 28, 24, 0.68);
  transform: scaleY(0);
  z-index: 2;
}

.cue-eye::before {
  top: 0;
  transform-origin: top;
  border-radius: 999px 999px 0 0;
}

.cue-eye::after {
  bottom: 0;
  transform-origin: bottom;
  border-radius: 0 0 999px 999px;
}

.cue-eye i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44%;
  height: 82%;
  border-radius: 999px;
  background: radial-gradient(circle at 45% 42%, rgba(255, 255, 255, 0.9) 0 9%, rgba(18, 28, 24, 0.82) 10% 100%);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px rgba(18, 28, 24, 0.12);
}

.cue-eye-left {
  left: 27%;
}

.cue-eye-right {
  right: 27%;
}

.cue-nose {
  position: absolute;
  left: 50%;
  top: 49%;
  width: 8%;
  height: 20%;
  border-left: 3px solid rgba(255, 250, 242, 0.5);
  border-bottom: 3px solid rgba(255, 250, 242, 0.34);
  border-radius: 0 0 0 12px;
  transform: translateX(-30%);
}

.cue-mouth {
  position: absolute;
  left: 39%;
  right: 39%;
  top: 75%;
  height: 6%;
  border-bottom: 3px solid rgba(255, 250, 242, 0.62);
  border-radius: 0 0 999px 999px;
}

.cue-blink .cue-eye {
  animation: cueHumanBlink 2s ease-in-out infinite;
  transform-origin: center;
}

.cue-blink .cue-brow-left,
.cue-blink .cue-brow-right {
  animation: cueBlinkBrow 2s ease-in-out infinite;
}

.cue-look-left .cue-head {
  animation: cueHeadLeft 1.55s ease-in-out infinite;
}

.cue-look-right .cue-head {
  animation: cueHeadRight 1.55s ease-in-out infinite;
}

.cue-look-left .cue-eye i {
  animation: cueIrisLeft 1.55s ease-in-out infinite;
}

.cue-look-right .cue-eye i {
  animation: cueIrisRight 1.55s ease-in-out infinite;
}

.cue-look-left .cue-ear-left,
.cue-look-left .cue-ear-right,
.cue-look-right .cue-ear-left,
.cue-look-right .cue-ear-right {
  animation-duration: 1.55s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

.cue-look-left .cue-ear-left {
  animation-name: cueNearEarLeft;
}

.cue-look-left .cue-ear-right {
  animation-name: cueFarEarLeft;
}

.cue-look-right .cue-ear-left {
  animation-name: cueFarEarRight;
}

.cue-look-right .cue-ear-right {
  animation-name: cueNearEarRight;
}

.cue-look-left .cue-nose,
.cue-look-left .cue-mouth,
.cue-look-right .cue-nose,
.cue-look-right .cue-mouth {
  animation-duration: 1.55s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

.cue-look-left .cue-nose,
.cue-look-left .cue-mouth {
  animation-name: cueFeatureLeft;
}

.cue-look-right .cue-nose,
.cue-look-right .cue-mouth {
  animation-name: cueFeatureRight;
}

.cue-complete .cue-face {
  border-color: rgba(63, 135, 87, 0.95);
  background: rgba(63, 135, 87, 0.18);
}

@keyframes cueHumanBlink {
  0%, 38%, 52%, 100% {
    transform: scaleY(1);
  }
  43% {
    transform: scaleY(0.16);
  }
  46% {
    transform: scaleY(0.06);
  }
  49% {
    transform: scaleY(0.45);
  }
}

@keyframes cueBlinkBrow {
  0%, 38%, 52%, 100% {
    transform: translateY(0) rotate(var(--brow-tilt, 0deg));
  }
  45%, 48% {
    transform: translateY(1px) rotate(var(--brow-tilt, 0deg));
  }
}

.cue-brow-left {
  --brow-tilt: -5deg;
}

.cue-brow-right {
  --brow-tilt: 5deg;
}

@keyframes cueHeadLeft {
  0%, 100% {
    transform: rotateY(0deg) rotateZ(0deg) translateX(0) scaleX(1);
  }
  50% {
    transform: rotateY(-58deg) rotateZ(-4deg) translateX(-24px) scaleX(0.78);
  }
}

@keyframes cueHeadRight {
  0%, 100% {
    transform: rotateY(0deg) rotateZ(0deg) translateX(0) scaleX(1);
  }
  50% {
    transform: rotateY(58deg) rotateZ(4deg) translateX(24px) scaleX(0.78);
  }
}

@keyframes cueIrisLeft {
  0%, 100% {
    transform: translate(-50%, -50%);
  }
  50% {
    transform: translate(-88%, -50%);
  }
}

@keyframes cueIrisRight {
  0%, 100% {
    transform: translate(-50%, -50%);
  }
  50% {
    transform: translate(-12%, -50%);
  }
}

@keyframes cueNearEarLeft {
  0%, 100% {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
  50% {
    transform: translateX(-14px) scale(1.18);
    opacity: 1;
  }
}

@keyframes cueFarEarLeft {
  0%, 100% {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
  50% {
    transform: translateX(-10px) scale(0.72);
    opacity: 0.22;
  }
}

@keyframes cueNearEarRight {
  0%, 100% {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
  50% {
    transform: translateX(14px) scale(1.18);
    opacity: 1;
  }
}

/* Neutral human face guide for selfie liveness. */
.cue-face {
  inset: 6% 9% 6%;
  border: 2px solid rgba(255, 250, 242, 0.88);
  border-radius: 50% / 50%;
  background: rgba(18, 28, 24, 0.08);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.14);
  overflow: visible;
}

.cue-face::before,
.cue-face::after {
  content: none;
}

.cue-face > * {
  z-index: 2;
}

.cue-ear {
  top: 41%;
  width: 6%;
  height: 13%;
  border-width: 2px;
  border-color: rgba(255, 250, 242, 0.7);
  border-radius: 50% 36% 36% 50%;
  background: transparent;
}

.cue-ear-left {
  left: 4%;
}

.cue-ear-right {
  right: 4%;
  border-radius: 36% 50% 50% 36%;
}

.cue-brow {
  top: 32%;
  width: 17%;
  height: 3%;
  border-top-width: 2px;
  border-color: rgba(255, 250, 242, 0.76);
}

.cue-brow-left {
  left: 27%;
}

.cue-brow-right {
  right: 27%;
}

.cue-eye {
  top: 39%;
  width: 14%;
  height: 5.5%;
  border: 2px solid rgba(255, 250, 242, 0.82);
  background: rgba(255, 250, 242, 0.18);
  box-shadow: none;
}

.cue-eye i {
  width: 28%;
  height: 78%;
  background: rgba(18, 28, 24, 0.84);
  box-shadow: none;
}

.cue-eye-left {
  left: 29%;
}

.cue-eye-right {
  right: 29%;
}

.cue-nose {
  top: 50%;
  width: 6%;
  height: 17%;
  border-left-width: 2px;
  border-bottom-width: 2px;
  border-color: rgba(255, 250, 242, 0.52);
}

.cue-mouth {
  left: 42%;
  right: 42%;
  top: 69%;
  height: 3%;
  border-bottom-width: 2px;
  border-color: rgba(255, 250, 242, 0.66);
}

@keyframes cueFarEarRight {
  0%, 100% {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
  50% {
    transform: translateX(10px) scale(0.72);
    opacity: 0.22;
  }
}

@keyframes cueFeatureLeft {
  0%, 100% {
    margin-left: 0;
    opacity: 1;
  }
  50% {
    margin-left: -18px;
    opacity: 0.78;
  }
}

@keyframes cueFeatureRight {
  0%, 100% {
    margin-left: 0;
    opacity: 1;
  }
  50% {
    margin-left: 18px;
    opacity: 0.78;
  }
}

.selfie-debug {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 12px;
  z-index: 4;
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(18, 28, 24, 0.72);
  color: #fffaf2;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.78rem;
  line-height: 1.25;
  text-align: center;
}

.nav-logout-form {
  display: flex;
  margin: 0;
}

.nav-logout-button {
  appearance: none;
  border: 1px solid rgba(34, 27, 20, 0.1);
  border-radius: 999px;
  background: rgba(255, 251, 244, 0.68);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  line-height: normal;
  padding: 12px 18px;
  white-space: nowrap;
}

.nav-logout-button:hover,
.nav-logout-button:focus-visible {
  border-color: rgba(34, 27, 20, 0.22);
  color: var(--ink);
}

.admin-login-card {
  max-width: 520px;
  margin-inline: auto;
}

.error-state {
  border-color: rgba(170, 46, 46, 0.24);
  background: #fff1f0;
  color: #8d2424;
}

.admin-config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.admin-config-wide {
  grid-column: 1 / -1;
}

.admin-secret-status {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.admin-secret-pill {
  min-width: 0;
  border: 1px solid rgba(30, 57, 50, 0.12);
  border-radius: 8px;
  padding: 12px;
  background: #f7fbf8;
  display: grid;
  gap: 4px;
}

.admin-secret-pill.missing {
  background: #fff4ee;
  border-color: rgba(170, 92, 46, 0.18);
}

.admin-secret-pill span,
.admin-secret-pill small {
  color: #65736f;
  font-size: 0.78rem;
}

.admin-secret-pill strong {
  color: #12312b;
}

.admin-secret-pill code {
  overflow-wrap: anywhere;
  font-size: 0.78rem;
  color: #233a35;
}

@media (max-width: 720px) {
  .admin-config-grid,
  .admin-secret-status {
    grid-template-columns: 1fr;
  }
}

.secret-preview {
  overflow-wrap: anywhere;
  border-radius: 6px;
  padding: 6px 8px;
  background: rgba(18, 49, 43, 0.06);
  color: #12312b;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.78rem;
}

.admin-page .hero {
  display: none;
}

.admin-page .page-shell {
  padding-top: 18px;
}

.admin-page .topbar {
  margin-bottom: 18px;
  padding-bottom: 14px;
}

.admin-page .page-content {
  gap: 16px;
}

.admin-top-grid {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.admin-page .card {
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 14px 30px rgba(90, 63, 22, 0.09);
}

.admin-page .quiet-card {
  padding-top: 18px;
}

.admin-page .section-head,
.admin-page .section-head.compact {
  margin-bottom: 12px;
}

.admin-page .section-head h2 {
  font-family: "Manrope", sans-serif;
  font-size: 1.18rem;
  line-height: 1.2;
}

.admin-page .eyebrow {
  margin-bottom: 4px;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
}

.admin-page .upload-form,
.admin-page .compact-form {
  gap: 12px;
}

.admin-page .field-stack {
  gap: 6px;
  font-size: 0.86rem;
}

.admin-page .field-stack input,
.admin-page .field-stack select {
  width: 100%;
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 42px;
}

.admin-page .actions {
  gap: 8px;
  margin-top: 2px;
}

.admin-page .status-surface,
.admin-page .event-candidate-panel {
  min-height: 60px;
  border-radius: 14px;
  padding: 12px;
  font-size: 0.9rem;
}

.admin-page .event-candidate-panel {
  gap: 10px;
}

.admin-page .event-candidate-panel .meta-row {
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 10px;
}

.admin-page .status-note {
  border-radius: 10px;
  padding: 9px 10px;
}

.admin-page .event-qr-result {
  gap: 12px;
  margin-top: 12px;
}

.admin-page .event-qr-result .qr-preview-shell {
  width: min(100%, 220px);
  padding: 8px;
  border-radius: 12px;
}

.admin-page .admin-secret-pill {
  border-radius: 10px;
  padding: 10px;
  gap: 3px;
}

.admin-page .admin-events-section {
  gap: 12px;
}

.section-head-with-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.gallery-review-card {
  display: grid;
  gap: 12px;
}

.approval-page .page-content {
  gap: 14px;
}

.approval-summary-card,
.approval-detail-card {
  display: grid;
  gap: 12px;
}

.approval-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.approval-metric-card {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 250, 242, 0.74);
  padding: 12px;
  min-width: 0;
}

.approval-metric-card span,
.approval-metric-card small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.approval-metric-card strong {
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1.15;
}

.approval-events-section {
  display: grid;
  gap: 12px;
}

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

.approval-event-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 10px 22px rgba(90, 63, 22, 0.08);
  padding: 14px;
  min-width: 0;
  cursor: pointer;
}

.approval-event-card:hover,
.approval-event-card:focus-visible,
.approval-event-card.active {
  border-color: rgba(138, 106, 53, 0.5);
  outline: 2px solid rgba(138, 106, 53, 0.14);
  outline-offset: 2px;
}

.approval-event-card.empty {
  opacity: 0.72;
}

.approval-event-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.approval-event-card h3 {
  margin: 2px 0 0;
  color: var(--ink);
  font-family: "Manrope", sans-serif;
  font-size: 1rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.approval-event-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
}

.approval-detail-card.hidden {
  display: none;
}

.approval-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 250, 242, 0.72);
  padding: 10px;
}

.approval-pagination.hidden {
  display: none;
}

.approval-pagination span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

@media (max-width: 1100px) {
  .approval-event-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 720px) {
  .approval-event-grid,
  .approval-metrics-grid {
    grid-template-columns: 1fr;
  }

  .approval-event-card-head {
    display: grid;
  }
}

.gallery-review-list {
  display: grid;
  gap: 10px;
}

.gallery-review-item {
  display: grid;
  grid-template-columns: auto 92px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 250, 242, 0.74);
  padding: 10px;
  min-width: 0;
}

.gallery-review-select input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.gallery-review-thumb {
  width: 92px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(34, 27, 20, 0.08);
}

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

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

.gallery-review-title-row,
.gallery-review-meta,
.gallery-review-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.gallery-review-title-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.gallery-review-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.gallery-review-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  overflow-wrap: anywhere;
}

.gallery-review-row-actions {
  justify-content: flex-end;
}

@media (max-width: 860px) {
  .gallery-review-item {
    grid-template-columns: auto 82px minmax(0, 1fr);
  }

  .gallery-review-row-actions {
    grid-column: 2 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .section-head-with-actions,
  .gallery-review-item {
    grid-template-columns: 1fr;
  }

  .section-head-with-actions {
    display: grid;
  }

  .gallery-review-row-actions {
    grid-column: auto;
  }
}

.admin-page .event-card-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.admin-page .event-admin-card {
  gap: 12px;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 10px 22px rgba(90, 63, 22, 0.08);
}

.admin-page .event-card-header {
  gap: 10px;
}

.admin-page .event-card-title h3 {
  font-size: 1rem;
  margin: 2px 0 3px;
}

.admin-page .event-card-date {
  font-size: 0.78rem;
}

.admin-page .event-health-strip {
  gap: 6px;
}

.admin-page .event-card-admin-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.admin-page .resource-status {
  padding: 3px 7px;
  font-size: 0.68rem;
}

.admin-page .compact-button {
  min-height: 34px;
  padding: 8px 10px;
  font-size: 0.78rem;
}

.admin-page .event-card-body {
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 10px;
}

.admin-page .event-resource-list {
  gap: 8px;
}

.admin-page .event-resource-card,
.admin-page .event-qr-panel {
  border-radius: 12px;
  padding: 10px;
}

.admin-page .event-resource-card {
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.admin-page .event-resource-card p {
  margin-top: 4px;
  font-size: 0.78rem;
  line-height: 1.35;
}

.admin-page .event-resource-actions,
.admin-page .event-card-actions {
  justify-content: flex-start;
}

.admin-page .event-qr-panel {
  gap: 8px;
}

.admin-page .event-card-qr {
  max-width: 112px;
  padding: 6px;
  border-radius: 10px;
}

@media (max-width: 1100px) {
  .admin-top-grid,
  .admin-page .event-card-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .admin-page .page-shell {
    padding: 14px 12px 40px;
  }

  .admin-page .card {
    padding: 14px;
  }

  .admin-page .event-card-body {
    grid-template-columns: 1fr;
  }

  .admin-page .event-card-qr {
    max-width: 160px;
  }
}

.admin-runtime-config-card .status-surface {
  min-height: 48px;
}

.runtime-config-editor,
.runtime-config-panel-body {
  display: grid;
  gap: 12px;
}

.runtime-config-fields {
  display: grid;
  gap: 12px;
}

.runtime-config-group {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 250, 242, 0.72);
  overflow: hidden;
}

.runtime-config-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.runtime-config-group summary::-webkit-details-marker {
  display: none;
}

.runtime-config-group[open] .runtime-config-disclosure {
  transform: rotate(90deg);
}

.runtime-config-group .runtime-config-grid {
  padding: 0 12px 12px;
}

.runtime-config-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.runtime-config-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(34, 27, 20, 0.1);
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.76);
  font-size: 0.82rem;
  font-weight: 800;
}

.runtime-config-field input {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 0.82rem;
}

.runtime-config-field small {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.35;
}

.runtime-config-toggle {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.runtime-config-toggle input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  accent-color: var(--primary);
}

.runtime-config-toggle small {
  grid-column: 1 / -1;
}

.runtime-json-panel,
.runtime-config-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 250, 242, 0.72);
  overflow: hidden;
}

.runtime-json-panel summary,
.runtime-config-panel summary {
  cursor: pointer;
  padding: 9px 11px;
  color: var(--primary-dark);
  font-size: 0.84rem;
  font-weight: 900;
  list-style: none;
}

.runtime-json-panel summary::-webkit-details-marker,
.runtime-config-panel summary::-webkit-details-marker {
  display: none;
}

.runtime-json-panel textarea {
  width: calc(100% - 20px);
  min-height: 180px;
  max-height: 420px;
  margin: 0 10px 10px;
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  resize: vertical;
}

.event-runtime-config-panel {
  margin-top: 2px;
}

.event-runtime-config-panel > summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.runtime-config-summary-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.runtime-config-disclosure {
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid currentColor;
  transition: transform 160ms ease;
}

.event-runtime-config-panel[open] .runtime-config-disclosure {
  transform: rotate(90deg);
}

.runtime-config-summary-note {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.event-runtime-config-panel .runtime-config-panel-body {
  padding: 0 10px 10px;
}

.event-runtime-config-panel .runtime-config-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.event-runtime-config-panel .runtime-json-panel textarea {
  min-height: 150px;
}

@media (max-width: 1100px) {
  .runtime-config-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .runtime-config-grid,
  .event-runtime-config-panel .runtime-config-grid {
    grid-template-columns: 1fr;
  }
}

.analytics-page .page-content {
  gap: 12px;
}

.analytics-page .status-surface {
  min-height: 0;
  padding: 10px 12px;
}

.analytics-summary-card .section-head {
  align-items: center;
}

.analytics-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.analytics-filter-bar label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.analytics-filter-bar select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.9);
  color: var(--ink);
  padding: 6px 28px 6px 10px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
}

.analytics-global-sections,
.analytics-metric-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  align-items: start;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.analytics-metric-section {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 250, 242, 0.66);
}

.analytics-metric-section h4 {
  margin: 0;
  color: var(--primary-dark);
  font-size: 0.88rem;
}

.analytics-metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
}

.analytics-metric-grid.compact {
  min-width: 0;
}

.analytics-metric-card {
  min-width: 0;
  position: relative;
  display: grid;
  gap: 3px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.78);
}

.analytics-metric-card span {
  min-height: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.25;
}

.analytics-metric-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  max-width: 100%;
}

.analytics-tooltip-trigger {
  cursor: help;
  outline: none;
}

.analytics-tooltip-mark {
  display: inline-grid;
  place-items: center;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border: 1px solid rgba(41, 64, 72, 0.28);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1;
}

.analytics-tooltip-trigger::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 8px;
  right: 8px;
  top: 32px;
  z-index: 20;
  display: none;
  padding: 8px 10px;
  border: 1px solid rgba(41, 64, 72, 0.2);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  box-shadow: 0 10px 24px rgba(41, 64, 72, 0.14);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.35;
}

.analytics-tooltip-trigger:hover::after,
.analytics-tooltip-trigger:focus-visible::after {
  display: block;
}

.analytics-metric-card strong {
  color: var(--ink);
  font-size: 1.12rem;
  line-height: 1;
}

.analytics-event-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.analytics-event-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 10px 22px rgba(90, 63, 22, 0.08);
}

.analytics-event-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.analytics-event-head h3 {
  margin: 2px 0 3px;
  font-size: 1rem;
}

.analytics-errors {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid rgba(177, 79, 66, 0.2);
  border-radius: 10px;
  background: #fff1f0;
  color: #8d2424;
  font-size: 0.78rem;
}

.analytics-errors p {
  margin: 0;
}

@media (max-width: 1100px) {
  .analytics-global-sections,
  .analytics-metric-sections {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .analytics-global-sections,
  .analytics-metric-sections,
  .analytics-metric-grid,
  .analytics-event-list {
    grid-template-columns: 1fr;
  }

  .analytics-event-head {
    display: grid;
  }
}

.stack-log-panel {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 250, 242, 0.72);
  overflow: hidden;
}

.stack-log-panel summary {
  cursor: pointer;
  padding: 10px 12px;
  color: var(--primary-dark);
  font-weight: 900;
  list-style-position: inside;
}

.stack-log-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding: 0 10px 10px;
}

.stack-log-row {
  display: grid;
  gap: 5px;
  border-left: 3px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fffdf8;
  font-size: 0.78rem;
}

.stack-log-row.failed {
  border-left-color: var(--error);
  background: #fff1f0;
}

.stack-log-row.complete {
  border-left-color: var(--success);
  background: rgba(63, 135, 87, 0.08);
}

.stack-log-row.running {
  border-left-color: var(--primary);
}

.stack-log-main,
.stack-log-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.stack-log-main strong,
.stack-log-row p {
  overflow-wrap: anywhere;
}

.stack-log-main span,
.stack-log-meta,
.stack-log-row p,
.stack-log-empty {
  color: var(--muted);
}

.stack-log-row p {
  margin: 0;
  line-height: 1.45;
}

.stack-log-status {
  color: var(--ink);
  font-weight: 900;
}

.stack-log-empty {
  padding: 10px 2px;
  font-size: 0.84rem;
}

.app-dialog-root {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 18px;
}

.app-dialog-root.hidden {
  display: none;
}

.app-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(34, 27, 20, 0.42);
  backdrop-filter: blur(3px);
}

.app-dialog {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 14px;
  background: #fffaf2;
  box-shadow: 0 28px 70px rgba(34, 27, 20, 0.24);
  padding: 18px;
}

.app-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.app-dialog-header h2 {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 1.05rem;
}

.app-dialog-close {
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 251, 244, 0.9);
  color: var(--muted);
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
  text-align: center;
}

.app-dialog-message {
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-line;
}

.app-dialog-field {
  margin-top: 14px;
}

.app-dialog-input-label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
}

.app-dialog-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
}

.app-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.app-dialog-button {
  min-width: 104px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.app-dialog-button.secondary {
  background: rgba(255, 251, 244, 0.84);
  color: var(--muted);
}

.app-dialog-button.primary {
  border-color: var(--ink);
  background: var(--ink);
  color: #fffaf0;
}

.app-dialog-button.danger {
  border-color: var(--error);
  background: var(--error);
  color: #fffaf0;
}

.nav-user-chip {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(34, 27, 20, 0.1);
  border-radius: 999px;
  background: rgba(255, 251, 244, 0.7);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 7px 10px;
  white-space: nowrap;
}

.admin-user-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  display: grid;
  align-items: end;
}

.admin-users-list {
  display: grid;
  gap: 12px;
}

.admin-user-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.9fr);
  gap: 14px;
  align-items: center;
  border: 1px solid rgba(34, 27, 20, 0.1);
  border-radius: 14px;
  background: rgba(255, 251, 244, 0.74);
  padding: 14px;
}

.admin-user-card h3 {
  margin: 2px 0 4px;
  font-size: 1rem;
}

.admin-user-controls {
  display: grid;
  grid-template-columns: 96px 96px minmax(130px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.admin-user-controls select,
.admin-user-controls input {
  width: 100%;
  min-height: 36px;
  border: 1px solid rgba(34, 27, 20, 0.12);
  border-radius: 10px;
  background: #fffdf8;
  padding: 8px 10px;
}

.inline-toggle {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.inline-toggle input {
  width: auto;
  min-height: auto;
}

@media (max-width: 820px) {
  .admin-user-form,
  .admin-user-card,
  .admin-user-controls {
    grid-template-columns: 1fr;
  }
}


/* Compact, stable cards for gallery upload status results. */
#bulk-results.results-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  align-items: stretch;
}

#bulk-results .result-card {
  gap: 12px;
  min-height: 0;
  border-radius: 14px;
  padding: 12px;
  overflow: hidden;
}

#bulk-results .result-card-head {
  display: grid;
  gap: 6px;
}

#bulk-results .result-card-head h4 {
  display: -webkit-box;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-family: "Manrope", sans-serif;
  font-size: 0.94rem;
  line-height: 1.25;
}

#bulk-results .badge {
  margin: 0;
  max-width: 100%;
  padding: 4px 8px;
  font-size: 0.68rem;
  line-height: 1.1;
  text-transform: uppercase;
}

#bulk-results .result-preview-shell {
  border-radius: 12px;
}

#bulk-results .result-preview {
  aspect-ratio: 4 / 3;
  border-radius: 12px;
}

#bulk-results .result-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

#bulk-results .stat-chip {
  min-width: 0;
  border-radius: 10px;
  padding: 8px;
}

#bulk-results .stat-label,
#bulk-results .meta-label,
#bulk-results .subsection-title {
  font-size: 0.58rem;
  letter-spacing: 0.08em;
}

#bulk-results .stat-chip strong {
  font-size: 0.82rem;
  line-height: 1.25;
}

#bulk-results .meta-list {
  gap: 7px;
  min-width: 0;
}

#bulk-results .meta-row {
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
}

#bulk-results .meta-value {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
  font-size: 0.78rem;
}

#bulk-results .mono {
  font-size: 0.7rem;
}

#bulk-results .face-gallery-block {
  gap: 8px;
}

#bulk-results .face-card {
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 8px;
  border-radius: 12px;
  padding: 8px;
}

#bulk-results .face-card img {
  width: 58px;
  height: 58px;
  border-radius: 9px;
}

#bulk-results .face-meta {
  gap: 6px;
  font-size: 0.76rem;
}

#bulk-results .face-card-head {
  gap: 6px;
}

#bulk-results .face-card-head strong {
  font-size: 0.82rem;
}

#bulk-results .face-status {
  padding: 3px 6px;
  font-size: 0.62rem;
}

@media (max-width: 720px) {
  #bulk-results.results-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px) {
  #bulk-results .result-stats,
  #bulk-results .meta-row,
  #bulk-results .face-card {
    grid-template-columns: 1fr;
  }

  #bulk-results .face-card img {
    width: 100%;
    height: 140px;
  }
}
