:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-secondary: #475569;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --success: #15803d;
  --success-bg: #dcfce7;
  --warning: #b45309;
  --warning-bg: #fef3c7;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --purple: #6d28d9;
  --purple-bg: #ede9fe;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.16);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.tnum {
  font-variant-numeric: tabular-nums;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

/* Loading */
.loading-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12.5px;
}

.btn-lg {
  padding: 11px 22px;
  font-size: 15px;
  font-weight: 600;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-alt);
}

.btn-success {
  background: var(--success);
  color: #ffffff;
}

.btn-success:hover:not(:disabled) {
  background: #166534;
}

.btn-warning {
  background: #d97706;
  color: #ffffff;
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-todo-purple {
  background: var(--purple);
  color: #ffffff;
}

.btn-todo-purple:hover:not(:disabled) {
  background: #5b21b6;
}

.btn-alert-soft {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #b45309;
  font-weight: 600;
}

.btn-alert-soft:hover:not(:disabled) {
  background: #fef3c7;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: #e2e8f0;
}

/* Badges / Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-draft {
  background: #f1f5f9;
  color: #475569;
}

.badge-pending,
.badge-unidirectional {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-approved,
.badge-matched {
  background: var(--success-bg);
  color: var(--success);
}

.badge-revision,
.badge-rejected,
.badge-target_withdrawn,
.badge-not_found {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-rejected {
  background: #fee2e2;
  color: #991b1b;
}

.badge-withdrawn {
  background: #e2e8f0;
  color: #475569;
  text-decoration: line-through;
}

.badge-free {
  background: var(--purple-bg);
  color: var(--purple);
}

.badge-blue {
  background: var(--primary-soft);
  color: var(--primary);
}

.quick-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Cards & Forms */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

.card-title {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  align-items: start;
}

.field-full {
  grid-column: 1 / -1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.req {
  color: #dc2626;
  margin-left: 2px;
}

.hint {
  font-size: 12px;
  color: var(--muted);
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  background: #f1f5f9;
  color: var(--muted);
  cursor: not-allowed;
}

.textarea {
  resize: vertical;
  min-height: 76px;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.check-row input[type="checkbox"],
.check-row input[type="radio"] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.conditional-box {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  border: 1px dashed var(--border-strong);
}

/* Alerts */
.alert {
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13.5px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.alert-success {
  background: var(--success-bg);
  border-color: #bbf7d0;
  color: #166534;
}

/* Login View */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px 40px;
  background-color: #eef4fb;
  background-image:
    radial-gradient(circle at 18% 18%, rgba(59, 130, 246, 0.14), transparent 46%),
    radial-gradient(circle at 84% 82%, rgba(217, 119, 6, 0.08), transparent 44%),
    linear-gradient(160deg, #f5f8fd 0%, #eaf1fb 100%);
}

.login-shell {
  width: 100%;
  max-width: 860px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-split-card {
  display: grid;
  grid-template-columns: 1.04fr 1fr;
  border-radius: 20px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid rgba(203, 213, 225, 0.72);
  box-shadow:
    0 24px 56px -16px rgba(15, 23, 42, 0.14),
    0 4px 12px rgba(15, 23, 42, 0.04);
}

.login-cover {
  position: relative;
  overflow: hidden;
  min-height: 468px;
  padding: 28px 26px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background-color: #dbeafe;
  background-image:
    linear-gradient(155deg, rgba(248, 251, 255, 0.92) 0%, rgba(219, 234, 254, 0.88) 50%, rgba(186, 220, 255, 0.92) 100%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.28) 0 18px, transparent 18px 36px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.28) 0 18px, transparent 18px 36px);
  border-right: 1px solid rgba(148, 163, 184, 0.22);
}

.login-cover-brand {
  position: relative;
  z-index: 2;
  max-width: 265px;
}

.login-logo-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
}

.login-cover-logo {
  display: block;
  width: 192px;
  max-width: 100%;
  height: auto;
  filter: drop-shadow(0 2px 0 rgba(255, 255, 255, 0.94)) drop-shadow(0 4px 12px rgba(30, 58, 138, 0.12));
}

.login-ver-pill {
  background: #2563eb;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.4;
  margin-bottom: 4px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
}

.login-cover-meta {
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: #1e3a8a;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.login-cover-mascot {
  position: absolute;
  right: -16px;
  bottom: -14px;
  width: 344px;
  height: auto;
  z-index: 1;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 10px 22px rgba(15, 23, 42, 0.14));
}

.login-cover-foot {
  position: relative;
  z-index: 2;
}

.login-cover-tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: #1e293b;
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.login-form-pane {
  padding: 38px 36px 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #ffffff;
}

.login-pane-head {
  margin-bottom: 22px;
}

.login-pane-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.login-pane-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.login-form-pane .stack {
  gap: 16px;
}

.login-form-pane .input {
  background: #f8fafc;
  border-color: #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
}

.login-form-pane .input:hover:not(:disabled) {
  border-color: #cbd5e1;
}

.login-form-pane .input:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3.5px rgba(37, 99, 235, 0.12);
}

.login-form-pane .btn-primary {
  min-height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.22);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.login-form-pane .btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28);
  filter: brightness(1.03);
}

.login-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid #f1f5f9;
}

.login-foot .text-link-btn {
  padding: 4px 6px;
  margin: 0 -6px;
}

/* Top Navbar */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-title {
  font-size: 16px;
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Booth Workspace */
.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 20px 60px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Image Uploader */
.upload-zone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: var(--surface-alt);
}

.upload-zone-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

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

.thumb-item {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.thumb-item img {
  width: 100%;
  height: 96px;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

.thumb-cap {
  padding: 4px 6px;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thumb-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 23, 42, 0.72);
  color: #ffffff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.thumb-del:hover {
  background: #dc2626;
}

/* Summary KV */
.kv-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kv-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 13.5px;
}

.kv-row span:first-child {
  color: var(--text-secondary);
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 280px;
  overflow-y: auto;
}

.timeline-item {
  border-left: 2px solid var(--border-strong);
  padding-left: 10px;
  font-size: 12.5px;
}

.timeline-item .time {
  color: var(--muted);
  font-size: 11.5px;
}

/* Admin Console */
.admin-shell {
  display: flex;
  min-height: calc(100vh - 57px);
}

.admin-sidebar {
  width: 224px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-item:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.admin-main {
  flex: 1;
  min-width: 0;
  padding: 20px 24px 50px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.kpi-label {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
}

.kpi-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

.kpi-card.kpi-alert {
  border-color: #fde68a;
  border-left: 4px solid #d97706;
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 70%);
}

.kpi-card.kpi-alert .kpi-value {
  color: #b45309;
}

.kpi-card.kpi-danger {
  border-color: #fecaca;
  border-left: 4px solid #dc2626;
  background: linear-gradient(135deg, #fef2f2 0%, #ffffff 70%);
}

.kpi-card.kpi-danger .kpi-value {
  color: #b91c1c;
}

.kpi-alert-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.mini-alert-btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
  cursor: pointer;
  background: transparent;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.mini-alert-btn:hover {
  transform: translateY(-1px);
  filter: brightness(0.96);
}

.mini-alert-btn.tag-warn {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #b45309;
}

.mini-alert-btn.tag-danger {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

.mini-alert-btn.tag-purple {
  background: var(--purple-bg);
  border-color: #c4b5fd;
  color: var(--purple);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data-table th,
table.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

table.data-table th {
  background: var(--surface-alt);
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

table.data-table tbody tr:hover {
  background: #f8fafc;
}

table.data-table tr.row-warn {
  background: #fffbeb;
}

table.data-table tr.row-conflict,
table.data-table tr.row-conflict td {
  background: #fef2f2;
}

.conflict-banner {
  padding: 10px 12px;
  border-radius: 8px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 13px;
  line-height: 1.5;
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.export-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}

/* Modal & Lightbox */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.56);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-box.modal-wide {
  max-width: 1040px;
}

.modal-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-head h3 {
  margin: 0;
  font-size: 16px;
}

.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.review-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 18px;
}

.lightbox-img {
  max-width: 100%;
  max-height: 75vh;
  display: block;
  margin: 0 auto;
  border-radius: 8px;
}

/* Toast */
#toast-root {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}

.toast {
  padding: 10px 14px;
  border-radius: 8px;
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  background: #0f172a;
}

.toast-success {
  background: #15803d;
}

.toast-error {
  background: #b91c1c;
}

.toast-warn {
  background: #b45309;
}

pre.rules-pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  margin: 0;
  line-height: 1.7;
  color: var(--text-secondary);
}

/* Segmented Switch (Normal Doujin vs Craft vs SHOW) */
.seg-switch {
  display: inline-flex;
  padding: 4px;
  border-radius: 11px;
  background: #e8eef6;
  border: 1.5px solid #cbd5e1;
  gap: 4px;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
}

.mode-show .seg-switch {
  background: #f6efe2;
  border-color: #e7cfa3;
}

.seg-btn {
  border: none;
  background: transparent;
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.seg-btn:hover:not(.active):not(:disabled) {
  background: rgba(255, 255, 255, 0.72);
  color: #0f172a;
}

.seg-btn.active {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.28);
}

.mode-show .seg-btn.active {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(180, 83, 9, 0.28);
}

.seg-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.inline-checks {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.other-input-wrap {
  margin-top: 4px;
}

.extra-pass-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.extra-pass-inline .select {
  width: auto;
  min-width: 185px;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 6px 10px;
}

/* Ultra-Minimalist Single-Column Booth Sheet */
.min-page {
  min-height: 100vh;
  background: #f7f9fc;
}

.min-page.mode-normal {
  --mode-accent: #2563eb;
  --mode-soft: #eff6ff;
  background:
    radial-gradient(ellipse 900px 320px at 50% -60px, rgba(37, 99, 235, 0.07), transparent 70%),
    #f7f9fc;
}

.min-page.mode-show {
  --mode-accent: #b45309;
  --mode-soft: #fffbeb;
  background:
    radial-gradient(ellipse 900px 320px at 50% -60px, rgba(180, 83, 9, 0.08), transparent 70%),
    #fcfaf6;
}

.min-page.mode-show .btn-primary {
  background: linear-gradient(135deg, #b45309 0%, #92400e 100%);
  box-shadow: 0 3px 10px rgba(180, 83, 9, 0.18);
}

.min-page.mode-show .btn-primary:hover:not(:disabled) {
  background: #92400e;
}

.min-page.mode-show .input:focus,
.min-page.mode-show .select:focus,
.min-page.mode-show .textarea:focus {
  border-color: #b45309;
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.12);
}

.min-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
}

.min-topbar-inner {
  max-width: 740px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.min-topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.min-code {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.min-mode-tag {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--mode-soft);
  color: var(--mode-accent);
}

.min-topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.text-link-btn {
  background: none;
  border: none;
  padding: 4px 8px;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
}

.text-link-btn:hover:not(:disabled) {
  color: #0f172a;
  background: #f1f5f9;
}

.text-link-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.min-sheet {
  width: calc(100% - 24px);
  max-width: 720px;
  margin: 22px auto 60px;
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-top: 3px solid var(--mode-accent);
  border-radius: 16px;
  box-shadow:
    0 10px 28px -8px rgba(15, 23, 42, 0.07),
    0 1px 3px rgba(15, 23, 42, 0.03);
  overflow: hidden;
}

.min-sheet .input,
.min-sheet .select,
.min-sheet .textarea {
  border-radius: 9px;
  border-color: #dce3ec;
}

.min-status-bar {
  padding: 13px 24px;
  background: #fafafa;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

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

.min-status-left {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #475569;
}

.min-err-line {
  font-size: 12.5px;
  color: #b91c1c;
}

.min-section {
  padding: 18px 24px;
  border-bottom: 1px solid #f1f5f9;
}

.min-section:last-child {
  border-bottom: none;
}

.min-sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 14.5px;
  font-weight: 600;
  color: #0f172a;
}

.min-details {
  border-top: 1px dashed #e2e8f0;
  padding-top: 10px;
  margin-top: 4px;
}

.min-details summary {
  cursor: pointer;
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
  user-select: none;
}

.min-details summary:hover {
  color: #0f172a;
}

.min-details-body {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.submit-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Booth Application Receipt View */
.receipt-sheet {
  max-width: 760px;
}

.receipt-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px 24px 16px;
  background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
  border-bottom: 1px solid #e2e8f0;
}

.mode-show .receipt-head {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.receipt-head-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #16a34a;
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(22, 163, 74, 0.24);
}

.receipt-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

.receipt-head p {
  margin: 4px 0 0;
  font-size: 13px;
  color: #475569;
  line-height: 1.5;
}

.receipt-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 24px;
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
}

.receipt-stage {
  padding: 20px 24px 26px;
  background: #f1f5f9;
}

.receipt-loading {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
  font-size: 13.5px;
}

.receipt-image {
  display: block;
  width: 100%;
  max-width: 680px;
  height: auto;
  margin: 0 auto;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 12px 32px -8px rgba(15, 23, 42, 0.14);
  cursor: zoom-in;
}

/* Responsive */
@media (max-width: 960px) {
  .review-grid {
    grid-template-columns: 1fr;
  }

  .admin-shell {
    flex-direction: column;
  }

  .admin-sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 8px 12px;
    gap: 6px;
    position: sticky;
    top: 0;
    z-index: 15;
  }

  .admin-sidebar::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    width: auto;
    flex-shrink: 0;
    white-space: nowrap;
  }

  .admin-main {
    padding: 14px 12px 48px;
  }
}

@media (max-width: 768px) {
  .login-shell {
    max-width: 440px;
  }

  .login-split-card {
    grid-template-columns: 1fr;
    border-radius: 16px;
  }

  .login-cover {
    min-height: 168px;
    padding: 20px 18px 18px;
    justify-content: center;
    border-right: none;
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  }

  .login-cover-brand {
    max-width: 66%;
  }

  .login-cover-logo {
    width: 138px;
  }

  .login-cover-meta {
    font-size: 11.5px;
    margin-top: 8px;
    white-space: nowrap;
    letter-spacing: 0.01em;
  }

  .login-cover-mascot {
    width: 178px;
    right: -8px;
    bottom: -28px;
  }

  .login-cover-foot {
    display: none;
  }

  .login-form-pane {
    padding: 22px 18px 18px;
  }
}

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

  .input,
  .select,
  .textarea {
    font-size: 16px;
    min-height: 44px;
  }

  .inline-checks {
    gap: 10px 14px;
  }

  .inline-checks .select {
    width: auto;
    min-height: 38px;
    font-size: 14px;
  }

  .check-row {
    min-height: 32px;
    align-items: center;
  }

  .check-row input[type="checkbox"],
  .check-row input[type="radio"] {
    margin-top: 0;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }

  .login-page {
    min-height: 100dvh;
    padding: calc(20px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  }

  .login-pane-title {
    font-size: 18px;
  }

  .login-form-pane .btn-primary {
    width: 100%;
    min-height: 46px;
  }

  .login-foot .text-link-btn {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }

  .topbar {
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
    gap: 8px;
  }

  .topbar-title {
    font-size: 15px;
  }

  .container {
    padding: 14px 12px 48px;
  }

  .min-topbar-inner {
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
    gap: 8px;
  }

  .min-topbar-right .text-link-btn {
    padding: 6px 8px;
    min-height: 34px;
  }

  .min-sheet {
    width: calc(100% - 16px);
    margin: 12px auto calc(36px + env(safe-area-inset-bottom));
    border-radius: 14px;
  }

  .min-section,
  .min-status-bar {
    padding: 14px 15px;
  }

  .min-status-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .min-sec-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .seg-switch {
    display: flex;
    width: 100%;
  }

  .seg-btn {
    flex: 1;
    padding: 10px 8px;
    font-size: 14px;
    text-align: center;
  }

  .submit-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .submit-actions .btn-lg {
    width: 100%;
    min-height: 46px;
  }

  .submit-actions > div {
    display: flex;
    justify-content: center;
  }

  .receipt-head {
    padding: 16px 15px 14px;
    gap: 12px;
  }

  .receipt-head h2 {
    font-size: 16px;
  }

  .receipt-actions {
    padding: 12px 15px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .receipt-actions .btn {
    width: 100%;
    min-height: 44px;
  }

  .receipt-stage {
    padding: 14px 10px 20px;
  }

  .receipt-image {
    border-radius: 10px;
  }

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

  .thumb-del {
    width: 26px;
    height: 26px;
    font-size: 14px;
  }

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

  .kpi-card {
    padding: 12px;
  }

  .kpi-value {
    font-size: 20px;
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar-group {
    width: 100%;
  }

  #f-q {
    max-width: 100% !important;
    width: 100%;
  }

  .toolbar-group .select {
    flex: 1 1 calc(50% - 4px);
    min-width: 130px;
  }

  table.data-table th,
  table.data-table td {
    padding: 8px 10px;
    font-size: 12.5px;
  }

  .export-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .kv-row {
    flex-direction: column;
    gap: 2px;
  }

  .kv-row strong {
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }

  .modal-box {
    max-height: 92dvh;
    border-radius: 16px 16px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .modal-head {
    padding: 14px 16px;
  }

  .modal-body {
    padding: 14px 16px;
  }

  .modal-foot {
    padding: 12px 16px;
  }

  #toast-root {
    left: 12px;
    right: 12px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    max-width: none;
  }
}

@media (max-width: 380px) {
  .login-cover-logo {
    width: 126px;
  }

  .login-cover-mascot {
    width: 160px;
    right: -10px;
    bottom: -22px;
  }

  .min-section,
  .min-status-bar {
    padding: 12px 14px;
  }

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