/* Permit2Route — shared product UI */
:root {
  --bg: #09090b;
  --bg-elevated: #0f0f12;
  --surface: #141416;
  --surface-hover: #1a1a1e;
  --surface-inset: #0c0c0e;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #fafafa;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;
  --ai: #f59e0b;
  --ai-soft: rgba(245, 158, 11, 0.12);
  --ai-glow: rgba(245, 158, 11, 0.35);
  --accent-b: #38bdf8;
  --accent-b-soft: rgba(56, 189, 248, 0.12);
  --accent-b-glow: rgba(56, 189, 248, 0.35);
  --warn: #f59e0b;
  --danger: #ef4444;
  --success: #22c55e;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.45);
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "Fira Code", "Consolas", monospace;
  --header-h: 64px;
  --max-w: 1120px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body.page-text {
  --accent-b: #38bdf8;
  --accent-b-soft: rgba(56, 189, 248, 0.12);
  --accent-b-glow: rgba(56, 189, 248, 0.35);
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% -10%, var(--ai-soft), transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 80%, var(--accent-b-soft), transparent 50%),
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: auto, auto, 64px 64px, 64px 64px;
  pointer-events: none;
  z-index: 0;
}

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  border-bottom: 1px solid var(--border);
  background: rgba(9, 9, 11, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.site-header__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}

.brand__mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--ai) 0%, var(--accent-b) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px var(--ai-glow);
}

.brand__mark svg { width: 18px; height: 18px; color: #fff; }

.brand__text {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
}

.brand__text .ai { color: var(--ai); }
.brand__text .b { color: var(--accent-b); }

.nav-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.nav-tabs a {
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-secondary);
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
}

.nav-tabs a:hover { color: var(--text); }

.nav-tabs a.active {
  color: var(--text);
  background: var(--surface-hover);
  box-shadow: var(--shadow-sm);
}

.nav-tabs a svg {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin-right: 0.35rem;
  opacity: 0.7;
}

/* ── Main layout ── */
.main {
  position: relative;
  z-index: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.hero {
  text-align: center;
  margin-bottom: 2.5rem;
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  margin-bottom: 1rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
}

.hero__badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.hero h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.hero p {
  margin: 0 auto;
  max-width: 520px;
  color: var(--text-secondary);
  font-size: 1rem;
}

.hero__pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.pill {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-tertiary);
  background: var(--surface);
  border: 1px solid var(--border);
}

.workspace {
  display: grid;
  gap: 1.25rem;
  align-items: start;
}

@media (min-width: 900px) {
  .workspace { grid-template-columns: 1fr 1fr; }
}

/* ── Panels ── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.panel__title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.panel__title svg {
  width: 16px;
  height: 16px;
  opacity: 0.6;
}

.panel__body { padding: 1.25rem; }

/* ── Form controls ── */
.field {
  display: block;
  margin-top: 1rem;
}

.field:first-child { margin-top: 0; }

.field__label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.field__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

select,
.input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

select:focus,
.input:focus,
textarea:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

textarea.input {
  min-height: 220px;
  max-height: 420px;
  resize: vertical;
  line-height: 1.55;
}

textarea.input.code-mode {
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.5;
  tab-size: 2;
}

.char-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.char-meta .warn { color: var(--warn); }

/* ── Dropzone ── */
.dropzone {
  position: relative;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
  background: var(--surface-inset);
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--ai);
  background: var(--ai-soft);
}

.dropzone.has-file {
  border-style: solid;
  border-color: var(--border);
  padding: 1rem;
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone__icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.dropzone__icon svg { width: 22px; height: 22px; }

.dropzone__title {
  font-weight: 600;
  font-size: 0.9375rem;
  margin-bottom: 0.25rem;
}

.dropzone__hint {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

.dropzone__formats {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.preview {
  margin-top: 1rem;
  display: none;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.preview.visible { display: block; }

.preview img {
  display: block;
  max-width: 100%;
  max-height: 260px;
  margin: 0 auto;
  object-fit: contain;
  background: #000;
}

.file-meta {
  margin-top: 0.65rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-secondary);
  word-break: break-all;
  text-align: left;
}

/* ── Button ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  margin-top: 1.25rem;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, box-shadow var(--transition), opacity var(--transition);
}

.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--ai) 0%, #6d28d9 100%);
  box-shadow: 0 2px 12px var(--ai-glow);
}

body.page-text .btn--primary {
  background: linear-gradient(135deg, #0284c7 0%, var(--accent-b) 100%);
  box-shadow: 0 2px 12px var(--accent-b-glow);
}

.btn--primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--ai-glow);
}

body.page-text .btn--primary:hover:not(:disabled) {
  box-shadow: 0 4px 20px var(--accent-b-glow);
}

.btn--primary:active:not(:disabled) { transform: translateY(0); }
.btn--primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

.btn svg { width: 18px; height: 18px; }

/* ── Status ── */
.status {
  display: none;
  align-items: flex-start;
  gap: 0.65rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.status.visible { display: flex; }

.status--loading {
  background: var(--ai-soft);
  border: 1px solid rgba(139, 92, 246, 0.25);
  color: #c4b5fd;
}

body.page-text .status--loading {
  background: var(--accent-b-soft);
  border-color: rgba(56, 189, 248, 0.25);
  color: #7dd3fc;
}

.status--error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.status--ok {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: #86efac;
}

.spinner {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

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

/* ── Results panel ── */
#results { opacity: 0.6; transition: opacity var(--transition); }
#results.visible { opacity: 1; }

.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.empty-state__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  border-radius: 14px;
  background: var(--surface-inset);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
}

.empty-state__icon svg { width: 26px; height: 26px; }

.empty-state h3 {
  margin: 0 0 0.35rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.empty-state p {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  max-width: 260px;
  margin-inline: auto;
}

/* ── Score display ── */
.score-block {
  animation: fadeUp 0.45s ease;
}

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

.verdict-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.verdict-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.verdict-badge.likely_ai {
  background: var(--ai-soft);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.verdict-badge.likely_real,
.verdict-badge.likely_human {
  background: var(--accent-b-soft);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

body.page-text .verdict-badge.likely_human { color: #7dd3fc; border-color: rgba(56, 189, 248, 0.3); }

.verdict-badge.uncertain {
  background: rgba(245, 158, 11, 0.12);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.verdict-badge.mixed {
  background: rgba(161, 161, 170, 0.1);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.confidence-chip {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: var(--surface-inset);
  border: 1px solid var(--border);
}

.confidence-chip strong { color: var(--text-secondary); font-weight: 600; }

.gauge-wrap {
  position: relative;
  width: 180px;
  height: 180px;
  margin: 0 auto 1.5rem;
}

.gauge-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }

.gauge-wrap .track { fill: none; stroke: var(--surface-inset); stroke-width: 10; }

.gauge-wrap .arc-ai {
  fill: none;
  stroke: url(#gaugeAiGrad);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gauge-center__value {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

.gauge-center__label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-top: 0.25rem;
}

.gauge-center__value.ai-color { color: var(--ai); }
.gauge-center__value.b-color { color: var(--accent-b); }

.stat-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--surface-inset);
  border: 1px solid var(--border);
  text-align: center;
}

.stat-card__label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 0.35rem;
}

.stat-card__value {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

.stat-card__value .unit { font-size: 0.9rem; font-weight: 600; opacity: 0.65; }

.stat-card--ai .stat-card__value { color: var(--ai); }
.stat-card--b .stat-card__value { color: var(--accent-b); }

.meter-bar {
  display: flex;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-inset);
  margin-bottom: 1.25rem;
}

.meter-bar__ai {
  background: linear-gradient(90deg, #6d28d9, var(--ai));
  transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.meter-bar__b {
  flex: 1;
  background: linear-gradient(90deg, #059669, var(--accent-b));
}

.meter-labels {
  display: flex;
  justify-content: space-between;
  margin-top: -1rem;
  margin-bottom: 1.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
}

.meter-labels .ai { color: var(--ai); }
.meter-labels .b { color: var(--accent-b); }

.summary-box {
  padding: 1rem 1.125rem;
  margin-bottom: 1.25rem;
  border-radius: var(--radius);
  background: var(--surface-inset);
  border: 1px solid var(--border);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
  border-left-width: 3px;
}

.summary-box.ai-lean { border-left-color: var(--ai); }
.summary-box.b-lean { border-left-color: var(--accent-b); }
.summary-box.uncertain-lean { border-left-color: var(--warn); }

.section { margin-bottom: 1.25rem; }
.section:last-child { margin-bottom: 0; }

.section__title {
  margin: 0 0 0.75rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}

.indicator-list { display: flex; flex-direction: column; gap: 0.5rem; }

.indicator {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 0.875rem;
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
  border: 1px solid var(--border);
  font-size: 0.8125rem;
}

.indicator__icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.indicator__icon.ai { background: var(--ai-soft); color: var(--ai); }
.indicator__icon.b { background: var(--accent-b-soft); color: var(--accent-b); }
.indicator__icon.neutral { background: rgba(161,161,170,0.1); color: var(--text-tertiary); }

.indicator__cat {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
}

.indicator__strength {
  font-weight: 400;
  text-transform: lowercase;
  margin-left: 0.25rem;
}

.indicator__desc {
  margin-top: 0.2rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.meta-grid {
  display: grid;
  gap: 0.5rem;
  padding: 0.875rem;
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
  border: 1px solid var(--border);
  font-size: 0.8125rem;
}

.meta-grid__row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--text-secondary);
}

.meta-grid__val.yes { color: var(--success); font-weight: 500; }
.meta-grid__val.no { color: var(--danger); font-weight: 500; }

.note-text {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  line-height: 1.55;
  margin: 0;
}

.content-type-tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.625rem;
  font-weight: 700;
  background: var(--surface-inset);
  color: var(--text-tertiary);
  vertical-align: middle;
}

/* ── Raw JSON ── */
details.raw {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

details.raw summary {
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-tertiary);
  user-select: none;
}

details.raw summary:hover { color: var(--text-secondary); }

pre.raw-json {
  margin: 0.75rem 0 0;
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.6875rem;
  line-height: 1.5;
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-secondary);
}

/* ── Footer ── */
.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: 1.5rem;
  margin-top: 2rem;
}

.site-footer__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-footer__brand {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.site-footer__disclaimer {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  max-width: 480px;
  line-height: 1.5;
  text-align: right;
}

@media (max-width: 640px) {
  .site-header__inner { padding: 0 1rem; }
  .nav-tabs a span.label { display: none; }
  .main { padding: 1.5rem 1rem 3rem; }
  .field__row { grid-template-columns: 1fr; }
  .site-footer__disclaimer { text-align: left; }
}

/* ── Admin ── */
body.page-admin { --accent-b: #f59e0b; --accent-b-soft: rgba(245, 158, 11, 0.12); }

.admin-login {
  max-width: 400px;
  margin: 4rem auto;
  padding: 0 1.5rem;
}

.admin-shell {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 0;
  min-height: calc(100vh - var(--header-h));
  max-width: 1400px;
  margin: 0 auto;
}

@media (max-width: 960px) {
  .admin-shell { grid-template-columns: 1fr; }
}

.admin-sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--header-h));
  position: sticky;
  top: var(--header-h);
}

.admin-sidebar__toolbar {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.admin-filter {
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.admin-filter.active {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border-strong);
}

.admin-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.admin-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.75rem;
  margin-bottom: 0.35rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.admin-item:hover { background: var(--surface); }
.admin-item.active {
  background: var(--surface);
  border-color: var(--border-strong);
}

.admin-item__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.admin-item__type {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.admin-item__type.image { background: rgba(34, 197, 94, 0.15); color: #86efac; }
.admin-item__type.text { background: rgba(56, 189, 248, 0.15); color: #7dd3fc; }

.admin-item__date { font-size: 0.7rem; color: var(--text-tertiary); }

.admin-item__summary {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.admin-item__verdict {
  font-size: 0.7rem;
  font-weight: 600;
  margin-top: 0.35rem;
}

.admin-item__verdict.fail { color: var(--danger); }

.admin-main {
  padding: 1.25rem 1.5rem 2rem;
  overflow-y: auto;
}

.admin-detail-grid {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 900px) {
  .admin-detail-grid { grid-template-columns: 1fr 1fr; }
}

.admin-preview-img {
  max-width: 100%;
  max-height: 420px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: block;
  margin: 0 auto;
  background: #000;
}

.admin-preview-text {
  width: 100%;
  min-height: 280px;
  max-height: 420px;
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-inset);
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.5;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.admin-meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.admin-meta-bar .chip {
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.admin-empty {
  text-align: center;
  padding: 4rem 1.5rem;
  color: var(--text-tertiary);
}

.admin-pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}

.admin-pagination button {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.admin-pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Permit2Route ── */
body.page-permit .brand__text .accent { color: var(--ai); }

.preview--pdf {
  margin-top: 1rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  height: 220px;
}

.preview--pdf embed {
  width: 100%;
  height: 100%;
  border: 0;
}

.permit-card,
.route-card {
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.permit-card__head,
.route-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.permit-card h3,
.route-card h3 {
  margin: 0;
  font-size: 0.95rem;
}

.permit-grid {
  display: grid;
  grid-template-columns: minmax(120px, 38%) 1fr;
  gap: 0.45rem 1rem;
  margin: 0;
}

.permit-grid dt {
  margin: 0;
  color: var(--text-tertiary);
  font-size: 0.82rem;
}

.permit-grid dd {
  margin: 0;
  font-size: 0.88rem;
}

.list-block {
  margin-bottom: 0.85rem;
}

.list-block h4,
.segments h4,
.export-actions h4,
.warnings-block h4 {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.list-block ul,
.warnings-block ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.86rem;
}

.route-summary {
  margin: 0 0 0.85rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.conf-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.conf-high { background: rgba(34, 197, 94, 0.15); color: #86efac; }
.conf-medium { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }
.conf-low { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }

.route-type-badge {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  margin-left: 0.35rem;
}

.map-regions {
  margin: 0.75rem 0;
  font-size: 0.85rem;
}

.map-regions ul {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
}

.route-empty {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
}

.table-wrap { overflow-x: auto; }

.waypoint-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.waypoint-table th,
.waypoint-table td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.waypoint-table th {
  color: var(--text-tertiary);
  font-weight: 500;
}

.waypoint-table .mono {
  font-family: var(--mono);
  font-size: 0.78rem;
}

.segments ol {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.86rem;
}

.muted { color: var(--text-tertiary); }

.warnings-block {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}

.extraction-banner {
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.extraction-banner--complete {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.extraction-banner--partial {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.extraction-banner--insufficient {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.extraction-banner p {
  margin: 0.45rem 0 0;
  color: var(--text-secondary);
}

.extraction-banner ul {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

.route-map {
  margin-bottom: 1rem;
}

.route-map-wrap {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.map-disclaimer {
  margin: 0;
  padding: 0.55rem 0.75rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: rgba(148, 163, 184, 0.08);
  border-bottom: 1px solid var(--border);
}

.route-map-canvas {
  height: 280px;
}

.waypoint-links {
  margin-top: 0.75rem;
  font-size: 0.82rem;
}

.waypoint-links ul {
  margin: 0.5rem 0;
  padding-left: 1.2rem;
}

.waypoint-table a {
  color: var(--accent, #f59e0b);
  text-decoration: none;
}

.waypoint-table a:hover {
  text-decoration: underline;
}

.map-pin-link {
  font-size: 0.78rem;
  font-weight: 500;
}

.map-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: rgba(245, 158, 11, 0.06);
}

.btn--sm {
  font-size: 0.78rem;
  padding: 0.35rem 0.65rem;
}

.p2r-pin {
  background: transparent;
  border: none;
}

.p2r-pin__bubble {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #f59e0b;
  color: #1a1a1a;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  border: 2px solid #fff;
}

.p2r-pin__bubble--muted {
  background: #94a3b8;
  color: #fff;
}

.waypoint-links li {
  margin: 0.25rem 0;
}

.map-empty {
  padding: 1rem;
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

.export-actions {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.export-hint {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

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

.btn--outline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
}

.btn--ghost {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
}

.btn--secondary:hover,
.btn--outline:hover { background: var(--surface-hover); }

.btn--orange {
  width: auto;
  margin-top: 0;
  flex-shrink: 0;
  color: #fff;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 2px 12px rgba(245, 158, 11, 0.35);
}

.btn--orange:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.45);
}

.btn--orange:active:not(:disabled) {
  transform: translateY(0);
}

.wim-toolbar .btn {
  width: auto;
  margin-top: 0;
}

.results { animation: fadeIn 0.25s ease; }

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

.admin-preview-pdf {
  width: 100%;
  height: 420px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.admin-item__type.permit {
  color: var(--ai);
}

/* ── WIM station map tool ── */
body.page-wim {
  --accent-b: #38bdf8;
  --accent-b-soft: rgba(56, 189, 248, 0.12);
}

.main--wim {
  max-width: 1100px;
}

.hero--compact {
  margin-bottom: 1.25rem;
}

.hero--compact h1 {
  font-size: clamp(1.65rem, 4vw, 2.1rem);
}

.wim-tool {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.wim-toolbar {
  padding: 1rem 1.1rem;
}

.wim-toolbar.panel {
  margin-bottom: 0;
}

.wim-toolbar__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
}

.wim-field {
  flex: 0 1 160px;
  min-width: 120px;
  margin: 0;
}

.wim-field--search {
  flex: 1 1 200px;
  max-width: 280px;
}

.wim-stats {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.wim-map-panel .panel__body--flush {
  padding: 0;
}

.wim-map-canvas {
  height: min(70vh, 620px);
  min-height: 360px;
  width: 100%;
  background: var(--surface-inset);
}

.wim-attribution {
  margin: 0;
  padding: 0.65rem 1rem;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border);
}

.wim-attribution a {
  color: var(--accent-b, #38bdf8);
  text-decoration: none;
}

.wim-attribution a:hover {
  text-decoration: underline;
}

.wim-pin {
  background: transparent;
  border: none;
}

.wim-pin__dot {
  width: 12px;
  height: 12px;
  margin: 1px;
  border-radius: 50%;
  background: #38bdf8;
  border: 2px solid #0f172a;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.5);
}

.wim-popup dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.2rem 0.75rem;
  margin: 0.5rem 0;
  font-size: 0.82rem;
}

.wim-popup dt {
  margin: 0;
  color: #64748b;
}

.wim-popup dd {
  margin: 0;
}

.wim-popup a {
  color: #0284c7;
  font-size: 0.82rem;
}

.leaflet-container {
  font-family: inherit;
}

@media (max-width: 640px) {
  .wim-field,
  .wim-field--search {
    flex: 1 1 100%;
    max-width: none;
  }

  .wim-map-canvas {
    min-height: 300px;
  }
}
