:root {
  color-scheme: dark;
  --bg: #0f1117;
  --panel: #171a22;
  --border: #2a3140;
  --text: #e8ecf4;
  --muted: #9aa7bd;
  --accent: #6ee7b7;
  --accent-dim: #1f3d34;
  --danger: #f87171;
  --radius: 14px;
  font-family: "IBM Plex Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 10% -10%, #1a2740 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #14261f 0%, transparent 50%),
    var(--bg);
  color: var(--text);
}

.shell {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.admin-shell { max-width: 960px; }

.hero { margin-bottom: 1.5rem; }
.hero.compact { margin-bottom: 1rem; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--accent);
  margin: 0 0 0.35rem;
}
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin: 0 0 0.5rem; }
.lede { color: var(--muted); margin: 0; line-height: 1.5; }

.progress {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  margin: 1.25rem 0 0.5rem;
  overflow: hidden;
}
#progressBar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #34d399, #6ee7b7);
  transition: width 0.25s ease;
}
.phase-label { color: var(--muted); font-size: 0.9rem; margin: 0; }

.scroll-form { display: flex; flex-direction: column; gap: 1rem; }

.field-block {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: opacity 0.2s ease;
}
.field-block.research-locked {
  opacity: 0.55;
}
.field-block.research-locked input,
.field-block.research-locked textarea,
.field-block.research-locked select,
.field-block.research-locked button {
  pointer-events: none;
}
.field-block.follow-up {
  margin-left: 0.75rem;
  padding-left: 1rem;
  border-left: 3px solid var(--accent-dim);
}
.field-block.disabled:not(.research-locked) { opacity: 0.7; }

.field-heading,
.section-title {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
}
.field-label { display: block; margin-bottom: 0.75rem; }

.rich-text { line-height: 1.6; color: var(--text); }
.rich-text p { margin: 0.5rem 0; }
.rich-text p:first-child { margin-top: 0; }
.rich-text p:last-child { margin-bottom: 0; }
.rich-text h2 { font-size: 1.15rem; margin: 0 0 0.75rem; }
.rich-text strong { color: var(--text); font-weight: 600; }
.rich-text em { font-style: italic; }
.rich-text u { text-underline-offset: 2px; }
.rich-text a { color: var(--accent); }

.phase, .card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.phase h2, .card h2 { margin-top: 0; font-size: 1.15rem; }
.hidden { display: none !important; }

label { display: block; margin: 0.75rem 0; }
input[type="text"],
input[type="tel"],
input[type="email"],
textarea,
select {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0d1016;
  color: var(--text);
}
textarea { resize: vertical; }

.check, .radio-card {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 0.5rem 0;
}
.radio-card { cursor: pointer; }
.check.muted { opacity: 0.75; }
.check input, .radio-card input { margin-top: 0.2rem; }

button {
  border: none;
  border-radius: 10px;
  padding: 0.7rem 1rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #052e1e;
}
button.secondary {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid #2d6b55;
}
button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
button:disabled { opacity: 0.45; cursor: not-allowed; }

.nav {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.status { color: var(--muted); font-size: 0.9rem; min-height: 1.25rem; }
.status.error { color: var(--danger); }
.status.ok { color: var(--accent); }

.summary-list { padding-left: 1.1rem; line-height: 1.6; color: var(--muted); }
.review {
  background: #0d1016;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
  line-height: 1.55;
  margin-bottom: 1rem;
}

.hint { color: var(--muted); font-size: 0.9rem; margin-top: 0; }
.preview {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.75rem;
  background: var(--accent-dim);
  border-radius: 10px;
  color: var(--accent);
  font-size: 0.95rem;
}

.entry-success-card {
  border: 1px solid #2d6b55;
  background: linear-gradient(180deg, #14261f 0%, var(--panel) 100%);
  border-radius: var(--radius);
  padding: 0.25rem 0;
}

.completion-card {
  border: 1px solid #2d6b55;
  background: linear-gradient(180deg, #1a2e28 0%, var(--panel) 55%);
  border-radius: var(--radius);
  padding: 0.5rem 0 0.25rem;
  text-align: center;
}
.completion-card .rich-text h2 {
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  color: var(--accent);
}
.completion-recap {
  margin: 1rem 0 0;
  text-align: center;
  color: var(--text);
}
.completion-recap strong { color: var(--accent); }

.scroll-form.form-complete {
  gap: 0;
}
.scroll-form.form-complete .completion-card {
  padding: 1.5rem 1rem;
}
.name-grid {
  display: grid;
  grid-template-columns: 1fr 6rem 1fr;
  gap: 0.75rem;
}
@media (max-width: 560px) {
  .name-grid { grid-template-columns: 1fr 1fr; }
  .name-grid label:last-child { grid-column: 1 / -1; }
}

/* Admin */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.metric {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
  text-align: center;
}
.metric span {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
}
.metric small { color: var(--muted); }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 720px) {
  .grid-2 { grid-template-columns: 1fr; }
}

.kv-list, .event-feed {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.9rem;
}
.kv-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}
.event-feed {
  max-height: 320px;
  overflow: auto;
}
.event-feed li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}
.entry-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
  max-height: 360px;
  overflow: auto;
}
.entries-tools { align-items: center; }
.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.draw-log {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.draw-log li { padding: 0.25rem 0; }
.entry-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
}
.entry-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.tester-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fde68a;
  background: #3b2f1a;
  border: 1px solid #78581d;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}
.bonus-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #bbf7d0;
  background: #14532d;
  border: 1px solid #166534;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}
.bonus-summary strong {
  color: var(--text);
}
.completion-bonus {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}
.completion-bonus.ok {
  border-color: #166534;
  background: rgba(20, 83, 45, 0.25);
}
.completion-bonus.muted {
  color: var(--muted);
}
.entry-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}
.entry-meta strong { display: block; }
.entry-meta small {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.15rem;
}
.entry-row button {
  flex-shrink: 0;
  padding: 0.45rem 0.7rem;
  font-size: 0.85rem;
}
.phone-verified { margin: 0.75rem 0 0; }
.phone-actions { margin-top: 0.5rem; }
.submission-list,
.detail-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
}
.submission-row {
  border-bottom: 1px solid var(--border);
}
.submission-row details { padding: 0.55rem 0; }
.submission-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  cursor: pointer;
  list-style: none;
}
.submission-summary::-webkit-details-marker { display: none; }
.submission-meta { color: var(--muted); font-size: 0.9rem; }
.submission-detail {
  margin: 0.75rem 0 0.25rem;
  padding: 0.85rem 1rem;
  background: #0d1016;
  border-radius: 10px;
  font-size: 0.92rem;
  line-height: 1.55;
}

.flow-diagram-wrap {
  margin: 0 0 0.85rem;
}

.flow-live-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  color: var(--accent);
}

.flow-live-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(110, 231, 183, 0.6);
  animation: flow-live-pulse 1.8s ease-out infinite;
}

@keyframes flow-live-pulse {
  70% { box-shadow: 0 0 0 6px rgba(110, 231, 183, 0); }
  100% { box-shadow: 0 0 0 0 rgba(110, 231, 183, 0); }
}

.flow-diagram {
  display: block;
  width: 100%;
  max-width: 11.5rem;
  height: auto;
}

.flow-edge {
  stroke: #3d4654;
  stroke-width: 1.5;
  stroke-dasharray: 3 4;
}

.flow-edge--done {
  stroke: #4ade80;
  stroke-width: 2;
  stroke-dasharray: none;
}

.flow-edge--current {
  stroke: #fbbf24;
  stroke-width: 2;
  stroke-dasharray: 4 3;
}

.flow-node {
  fill: transparent;
  stroke: #4b5563;
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
}

.flow-node-label {
  fill: #9ca3af;
  font-size: 11px;
  font-weight: 500;
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  pointer-events: none;
}

.flow-marker {
  pointer-events: none;
}

.flow-marker--done {
  fill: #22c55e;
}

.flow-marker-check {
  fill: none;
  stroke: #052e16;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.flow-marker--current {
  stroke: #fbbf24;
}

.flow-marker--upcoming {
  stroke: #6b7280;
}

.flow-marker--ineligible {
  fill: #ef4444;
}

.flow-marker-x {
  fill: none;
  stroke: #450a0a;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.flow-node-group--done .flow-node {
  fill: #14532d;
  stroke: #4ade80;
  stroke-width: 1.5;
  stroke-dasharray: none;
}

.flow-node-group--done .flow-node-label {
  fill: #dcfce7;
  font-weight: 600;
}

.flow-node-group--current .flow-node {
  fill: #422006;
  stroke: #fbbf24;
  stroke-width: 2.5;
  stroke-dasharray: none;
}

.flow-node-group--current .flow-node-label {
  fill: #fef3c7;
  font-weight: 700;
}

.flow-node-group--upcoming .flow-node {
  fill: #12151c;
  stroke: #4b5563;
  stroke-dasharray: 5 4;
}

.flow-node-group--upcoming .flow-node-label {
  fill: #6b7280;
  font-weight: 500;
}

.flow-node-group--ineligible .flow-node {
  fill: #450a0a;
  stroke: #f87171;
  stroke-width: 2;
  stroke-dasharray: none;
}

.flow-node-group--ineligible .flow-node-label {
  fill: #fecaca;
  font-weight: 600;
  text-decoration: line-through;
  text-decoration-color: #f87171;
}

.status-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
}
.status-in_progress {
  color: #93c5fd;
  background: #1e293b;
  border: 1px solid #334155;
}
.status-entered {
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid #2d6b55;
}
.status-research_saved {
  color: #fde68a;
  background: #3b2f1a;
  border: 1px solid #78581d;
}
.detail-list li {
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}
.filters label { margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; align-items: flex-end; }
.row label.grow { flex: 1 1 12rem; margin: 0; }
.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.flow-compact-wrap {
  display: flex;
  justify-content: center;
  padding: 0.35rem 0.25rem;
  border-radius: 8px;
  background: #0d1016;
  border: 1px solid var(--border);
}

.flow-compact-wrap--live {
  border-color: #2d6b55;
  box-shadow: 0 0 0 1px rgba(110, 231, 183, 0.15);
}

.flow-diagram-compact {
  display: block;
  width: 3rem;
  height: auto;
}

.collage-card h3 {
  margin: 1rem 0 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.collage-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.collage-tile {
  width: 5.5rem;
  text-align: center;
}

.collage-tile--live .flow-compact-wrap {
  animation: flow-live-pulse 1.8s ease-out infinite;
}

.collage-tile-label {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.65rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collage-complete-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 5.5rem;
  min-height: 5rem;
  padding: 0.5rem;
  border-radius: 8px;
  background: var(--accent-dim);
  border: 1px solid #2d6b55;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
}

.sync-progress-card {
  margin-bottom: 1rem;
}

.sync-bar {
  margin-top: 0.65rem;
}

.sync-bar-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  margin-bottom: 0.25rem;
}

.sync-bar-count {
  color: var(--muted);
  font-size: 0.78rem;
}

.sync-bar-track {
  height: 0.45rem;
  border-radius: 999px;
  background: #1a1f28;
  overflow: hidden;
}

.sync-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2d6b55, var(--accent));
  transition: width 0.3s ease;
}

.campaign-lifecycle {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.campaign-lifecycle h3 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}

.inline-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin: 0.5rem 0 1rem;
}

.inline-fields label {
  flex: 1 1 10rem;
  margin: 0;
}

.inline-fields button {
  flex: 0 0 auto;
  margin-bottom: 0.1rem;
}

.closed-banner {
  margin-bottom: 1rem;
}

.form-closed {
  opacity: 0.55;
  pointer-events: none;
}
