/* Pond Soil Evaluator — Styles
   Brand: Natural Waterscapes
   Dark theme, mobile-first */

:root {
  --navy: #141b45;
  --green: #1c4220;
  --brown: #8f5a2a;
  --cream: #F2E5b3;
  --bg: #0b0f24;
  --bg-card: #141b45;
  --bg-surface: #1a2350;
  --text: #f0ede4;
  --text-muted: #9a9bb0;
  --text-dim: #6b6d82;
  --danger: #c0392b;
  --success: #27ae60;
  --warning: #e67e22;
  --header-h: 52px;
}

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

html, body {
  height: 100%;
  font-family: Tahoma, 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* Header */
.app-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--navy);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  border-bottom: 1px solid rgba(242,229,179,0.1);
}
.header-title { font-size: 17px; font-weight: 700; color: var(--cream); }
.beta-badge { font-size: 11px; font-weight: 700; color: #e74c3c; letter-spacing: 0.5px; }
.header-brand { font-size: 12px; color: var(--text-muted); }

/* Main */
#app {
  padding-top: var(--header-h);
  min-height: 100%;
}

/* Steps */
.step { display: none; padding: 16px; max-width: 640px; margin: 0 auto; }
.step.active { display: block; }

/* Wider layout on desktop/tablet */
@media (min-width: 768px) {
  .step { max-width: 900px; }
}
@media (min-width: 1200px) {
  .step { max-width: 1060px; }
}

.step-header {
  display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px;
}
.step-number {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--cream); color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; flex-shrink: 0;
}
.step h2 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.step-hint { font-size: 15px; color: var(--text-muted); line-height: 1.5; }

.step-actions {
  display: flex; gap: 12px; margin-top: 24px; padding-bottom: 32px;
}

/* Desktop: center step headers, actions, and form content */
@media (min-width: 768px) {
  .step-header {
    flex-direction: column; align-items: center; text-align: center;
  }
  .step-header .step-number { margin-bottom: 4px; }
  .step h2 { text-align: center; }
  .step-hint { text-align: center; max-width: 520px; }
  .step-actions { justify-content: center; }
}

/* Map — Step 1 also goes full-bleed on larger screens */
#map-container {
  width: 100%; height: 50vh; min-height: 300px;
  border-radius: 8px; overflow: hidden;
  border: 1px solid rgba(242,229,179,0.15);
  position: relative;
}
/* Step 1 full-bleed: flex column so map fills remaining viewport height */
.step-map-fullbleed {
  padding: 0 !important;
  max-width: none !important;
  height: calc(100vh - var(--header-h));
  overflow: hidden;
}
.step-map-fullbleed.active {
  display: flex !important;
  flex-direction: column;
}
.step-map-fullbleed .step-header {
  padding: 16px 16px 0;
  flex-shrink: 0;
}
.step-map-fullbleed #map-controls {
  padding: 0 16px;
  flex-shrink: 0;
}
.step-map-fullbleed .status-msg {
  margin: 8px 16px 0;
  flex-shrink: 0;
}
.step-map-fullbleed .step-actions {
  padding: 8px 16px 16px;
  flex-shrink: 0;
}
.step-map-fullbleed #map-container {
  flex: 1;
  min-height: 200px;
  border-radius: 0;
  margin: 0 5px;
  height: auto;
}
#map-controls {
  display: flex; gap: 8px; margin-top: 12px;
}
.status-msg {
  margin-top: 8px; padding: 10px 14px;
  background: var(--bg-surface); border-radius: 6px;
  font-size: 14px; color: var(--cream); line-height: 1.4;
}

/* Edit toolbar — floating over map */
.edit-toolbar {
  position: absolute; bottom: 12px; left: 12px; right: 12px;
  background: rgba(11,15,36,0.92); border: 1px solid rgba(242,229,179,0.2);
  border-radius: 8px; padding: 10px 14px; z-index: 10;
  backdrop-filter: blur(8px);
}
.edit-toolbar-instructions {
  font-size: 13px; color: var(--text-muted); margin-bottom: 8px; line-height: 1.5;
}
.edit-toolbar-actions {
  display: flex; gap: 8px; justify-content: flex-end;
}
.btn-small { padding: 6px 14px; font-size: 13px; }

/* Buttons */
.btn-primary, .btn-secondary {
  border: none; border-radius: 6px; cursor: pointer;
  font-family: inherit; font-size: 15px; font-weight: 600;
  padding: 12px 22px; transition: all 0.15s ease;
}
.btn-primary {
  background: var(--cream); color: var(--navy);
}
.btn-primary:hover { background: #e6d89e; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-secondary {
  background: var(--bg-surface); color: var(--text);
  border: 1px solid rgba(242,229,179,0.2);
}
.btn-secondary:hover { background: #1f2d5e; }
.btn-large { padding: 14px 28px; font-size: 16px; flex: 1; }

/* Forms — original block style */
.form-scroll {
  max-height: calc(100vh - 280px); overflow-y: auto;
  padding-right: 4px;
}
.form-group { margin-bottom: 20px; }
.form-label {
  display: block; font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); margin-bottom: 8px;
}
.form-input {
  width: 100%; padding: 10px 12px;
  background: var(--bg-surface); border: 1px solid rgba(242,229,179,0.15);
  border-radius: 6px; color: var(--text);
  font-family: inherit; font-size: 15px;
  outline: none; transition: border-color 0.15s;
}
.form-input:focus { border-color: var(--cream); }
.form-input-sm { width: 90px; text-align: center; }
.form-textarea {
  resize: vertical; min-height: 60px; font-size: 14px; line-height: 1.5;
}

/* Compact form rows — single-line yes/no questions */
.form-row-compact {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.form-row-compact:last-child { border-bottom: none; }
.form-row-label {
  font-size: 15px; color: var(--text); flex: 1; padding-right: 12px;
  line-height: 1.4;
}

/* Toggle group — compact yes/no */
.toggle-group {
  display: flex; gap: 2px; flex-shrink: 0;
  background: var(--bg-surface); border-radius: 6px;
  border: 1px solid rgba(242,229,179,0.1);
  overflow: hidden;
}
.toggle-opt {
  cursor: pointer; padding: 7px 18px;
  font-size: 14px; font-weight: 500; color: var(--text-muted);
  transition: all 0.15s;
}
.toggle-opt input { display: none; }
.toggle-opt:has(input:checked) {
  background: var(--cream); color: var(--navy); font-weight: 600;
}

.form-divider {
  height: 1px; background: rgba(242,229,179,0.08);
  margin: 8px 0;
}

/* Radio stack (leak severity) */
.radio-stack { display: flex; flex-direction: column; gap: 8px; }
.radio-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--bg-surface);
  border: 1px solid rgba(242,229,179,0.15);
  border-radius: 6px; cursor: pointer; transition: all 0.15s;
}
.radio-card:has(input:checked) {
  border-color: var(--cream); background: rgba(242,229,179,0.08);
}
.radio-card input[type="radio"] {
  accent-color: var(--cream); width: 18px; height: 18px; flex-shrink: 0;
}
.radio-card-content { font-size: 14px; line-height: 1.4; }
.radio-card-content strong { font-weight: 600; }

.inline-fields {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--text-muted);
}

/* Loading — Dramatic Analysis Animation */
.analysis-anim {
  position: relative; min-height: 80vh;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; background: var(--bg);
}
/* Background grid */
.anim-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(242,229,179,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(242,229,179,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: gridPulse 4s ease-in-out infinite;
}
@keyframes gridPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
/* Scanning line sweeps top to bottom */
.anim-scanline {
  position: absolute; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--cream), transparent);
  animation: scanDown 3s ease-in-out infinite;
  opacity: 0.6;
}
@keyframes scanDown {
  0% { top: -2px; opacity: 0; }
  10% { opacity: 0.6; }
  90% { opacity: 0.6; }
  100% { top: 100%; opacity: 0; }
}

/* Central content area */
.anim-content {
  position: relative; z-index: 2; text-align: center;
  max-width: 400px; width: 100%; padding: 0 20px;
}

/* Concentric rings */
.anim-rings {
  position: relative; width: 120px; height: 120px; margin: 0 auto 24px;
}
.anim-ring {
  position: absolute; border-radius: 50%;
  border: 2px solid var(--cream);
  animation: ringPulse 2.5s ease-out infinite;
}
.anim-ring-1 {
  inset: 0; opacity: 0.15;
  animation-delay: 0s;
}
.anim-ring-2 {
  inset: 15px; opacity: 0.25;
  animation-delay: 0.4s;
}
.anim-ring-3 {
  inset: 30px; opacity: 0.4;
  animation-delay: 0.8s;
}
.anim-pulse-core {
  position: absolute; inset: 42px; border-radius: 50%;
  background: radial-gradient(circle, var(--cream), rgba(242,229,179,0.3));
  animation: corePulse 1.5s ease-in-out infinite;
}
@keyframes ringPulse {
  0% { transform: scale(0.85); opacity: 0; }
  50% { opacity: 0.4; }
  100% { transform: scale(1.15); opacity: 0; }
}
@keyframes corePulse {
  0%, 100% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.1); opacity: 1; }
}

/* Main status text */
.anim-status {
  font-size: 17px; font-weight: 600; color: var(--cream);
  margin-bottom: 24px; min-height: 24px;
  animation: textGlow 2s ease-in-out infinite;
}
@keyframes textGlow {
  0%, 100% { text-shadow: 0 0 8px rgba(242,229,179,0.3); }
  50% { text-shadow: 0 0 20px rgba(242,229,179,0.6); }
}

/* Phase progress items */
.anim-phases {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 20px;
}
.anim-phase {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; border-radius: 8px;
  background: rgba(20,27,69,0.6);
  border: 1px solid rgba(242,229,179,0.08);
  transition: all 0.4s ease;
  opacity: 0.4;
}
.anim-phase.active {
  opacity: 1;
  border-color: rgba(242,229,179,0.25);
  background: rgba(242,229,179,0.06);
}
.anim-phase.complete {
  opacity: 0.7;
  border-color: rgba(39,174,96,0.3);
}
.anim-phase-icon {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(242,229,179,0.08);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
  transition: all 0.4s ease; flex-shrink: 0;
}
.anim-phase.active .anim-phase-icon {
  color: var(--cream);
  background: rgba(242,229,179,0.15);
  animation: iconSpin 2s linear infinite;
}
.anim-phase.complete .anim-phase-icon {
  color: var(--success);
  background: rgba(39,174,96,0.15);
  animation: none;
}
@keyframes iconSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.anim-phase-label {
  font-size: 13px; font-weight: 600; color: var(--text-muted);
  flex: 1; text-align: left;
  transition: color 0.3s;
}
.anim-phase.active .anim-phase-label { color: var(--cream); }
.anim-phase.complete .anim-phase-label { color: var(--text-muted); }
.anim-phase-status {
  font-size: 11px; font-weight: 500; color: var(--text-dim);
  white-space: nowrap;
  transition: color 0.3s;
}
.anim-phase.active .anim-phase-status { color: var(--cream); }
.anim-phase.complete .anim-phase-status { color: var(--success); }

/* Progress bar */
.anim-progress-bar {
  height: 3px; border-radius: 2px;
  background: rgba(242,229,179,0.1);
  overflow: hidden; margin-bottom: 16px;
}
.anim-progress-fill {
  height: 100%; width: 0%; border-radius: 2px;
  background: linear-gradient(90deg, var(--cream), #e6d89e);
  transition: width 0.6s ease;
  box-shadow: 0 0 8px rgba(242,229,179,0.4);
}

/* Streaming data readout */
.anim-data-stream {
  font-family: 'Courier New', monospace;
  font-size: 10px; color: var(--text-dim);
  text-align: left; line-height: 1.6;
  max-height: 80px; overflow: hidden;
  opacity: 0.5;
  mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
}
.anim-data-line {
  animation: lineAppear 0.3s ease-out;
}
@keyframes lineAppear {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Spinner fallback — still used for inline loading */
.spinner {
  width: 40px; height: 40px; border: 3px solid var(--bg-surface);
  border-top-color: var(--cream); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Result Cards */
.result-card {
  background: var(--bg-card); border-radius: 8px;
  padding: 16px; margin-bottom: 16px;
  border: 1px solid rgba(242,229,179,0.1);
}
.result-card h3 {
  font-size: 17px; font-weight: 700; margin-bottom: 12px;
  color: var(--cream);
}
.result-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 8px 0; font-size: 15px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.result-row:last-child { border-bottom: none; }
.result-label { color: var(--text-muted); flex-shrink: 0; }
.result-value {
  font-weight: 600; text-align: right;
  max-width: 60%; word-wrap: break-word; overflow-wrap: break-word;
}

/* Info tooltip — term explainers */
.info-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(242,229,179,0.15); color: var(--cream);
  font-size: 10px; font-weight: 700; cursor: pointer;
  margin-left: 4px; vertical-align: middle;
  border: 1px solid rgba(242,229,179,0.2);
  transition: background 0.15s;
  position: relative;
}
.info-icon:hover { background: rgba(242,229,179,0.3); }
.info-popover {
  display: none; position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%);
  background: var(--bg-surface); border: 1px solid rgba(242,229,179,0.2);
  border-radius: 8px; padding: 10px 14px;
  font-size: 13px; font-weight: 400; color: var(--text-muted);
  line-height: 1.5; width: 280px; max-width: 80vw;
  z-index: 50; box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  text-align: left;
}
.info-popover::after {
  content: ''; position: absolute; top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(242,229,179,0.2);
}
.info-icon.active .info-popover { display: block; }
/* Popover variant: opens below instead of above (for elements near page top) */
.info-popover-below {
  bottom: auto; top: calc(100% + 8px);
}
.info-popover-below::after {
  top: auto; bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: rgba(242,229,179,0.2);
}

/* Severity tier cards — expandable, ALWAYS single-column */
.tier-cards { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.tier-card {
  border-radius: 8px; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  transition: border-color 0.2s;
}
.tier-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; cursor: pointer;
  user-select: none;
}
.tier-card-header:hover { filter: brightness(1.1); }
.tier-card-left { display: flex; align-items: center; gap: 10px; }
.tier-card-label { font-size: 16px; font-weight: 600; }
.tier-card-rating {
  font-size: 14px; font-weight: 500;
  padding: 4px 12px; border-radius: 4px;
  background: rgba(0,0,0,0.2);
}
.tier-card-chevron {
  font-size: 14px; color: var(--cream); opacity: 0.6;
  transition: transform 0.2s, opacity 0.2s;
  flex-shrink: 0; margin-left: 6px;
}
.tier-card-header:hover .tier-card-chevron { opacity: 1; }
.tier-card-header:hover .component-expand-hint { opacity: 1; }
.tier-card.expanded .tier-card-chevron { transform: rotate(180deg); }
.tier-card.expanded .component-expand-hint { display: none; }

.tier-card-body {
  display: none; padding: 0 16px 16px;
  font-size: 14px; line-height: 1.6; color: var(--text-muted);
}
.tier-card.expanded .tier-card-body { display: block; }

.tier-card-body .detail-row {
  display: flex; justify-content: space-between;
  padding: 4px 0;
}
.tier-card-body .detail-label { color: var(--text-dim); font-size: 15px; }
.tier-card-body .detail-value {
  color: var(--text); font-weight: 500; font-size: 15px;
  max-width: 60%; word-wrap: break-word; overflow-wrap: break-word;
  text-align: right;
}
.tier-card-body .tier-description {
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.05);
  color: var(--text-muted); font-size: 15px; line-height: 1.55;
}

/* Tier color themes */
.tier-card-favorable { background: rgba(39,174,96,0.12); }
.tier-card-favorable .tier-card-label { color: #6fcf97; }
.tier-card-manageable { background: rgba(241,196,15,0.12); }
.tier-card-manageable .tier-card-label { color: #f1c40f; }
.tier-card-significant { background: rgba(230,126,34,0.12); }
.tier-card-significant .tier-card-label { color: #e67e22; }
.tier-card-needs_further_analysis { background: rgba(192,57,43,0.12); }
.tier-card-needs_further_analysis .tier-card-label { color: #e74c3c; }

/* Horizon profile table */
.horizon-card {
  background: var(--bg-card); border-radius: 8px;
  padding: 16px; margin-bottom: 16px;
  border: 1px solid rgba(242,229,179,0.1);
}
.horizon-card h3 {
  font-size: 16px; font-weight: 700; margin-bottom: 12px; color: var(--cream);
}
.horizon-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.horizon-table th {
  text-align: left; padding: 6px 8px;
  color: var(--text-muted); font-weight: 600;
  border-bottom: 1px solid rgba(242,229,179,0.15);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px;
  white-space: nowrap;
}
.horizon-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  white-space: nowrap;
}
.horizon-table tr:last-child td { border-bottom: none; }
.horizon-table .hor-depth { color: var(--text-muted); }
.horizon-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Visual Horizon Profile (dimensional bar view) */
.horizon-viz {
  display: flex; gap: 0;
  background: var(--bg-card); border-radius: 8px;
  border: 1px solid rgba(242,229,179,0.1);
  padding: 16px; margin-bottom: 16px;
  overflow: hidden; /* outer card doesn't scroll */
}
/* Horizon profile container inside cards — fits natural height */
.horizon-scroll-wrap {
  overflow: visible;
  margin-top: 12px;
  position: relative;
}
.horizon-viz h3 {
  font-size: 16px; font-weight: 700; margin-bottom: 12px; color: var(--cream);
}
.horizon-depth-axis {
  width: 40px; flex-shrink: 0; position: relative;
}
.horizon-depth-tick {
  position: absolute; right: 6px;
  font-size: 10px; color: var(--text-dim);
  white-space: nowrap;
  transform: translateY(-50%);
}
.horizon-depth-tick::after {
  content: ''; position: absolute;
  right: -8px; top: 50%;
  width: 6px; height: 1px;
  background: rgba(255,255,255,0.15);
}
.horizon-layers-col {
  width: 90px; flex-shrink: 0; position: relative;
  border-left: 1px solid rgba(255,255,255,0.1);
  border-right: 1px solid rgba(255,255,255,0.1);
}
.horizon-layer {
  position: absolute; left: 0; right: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid rgba(0,0,0,0.2);
}
.horizon-layer-label {
  font-size: 11px; font-weight: 700; color: white;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.horizon-layer-texture {
  font-size: 11px; color: rgba(255,255,255,0.85);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  margin-top: 1px;
  font-weight: 500;
}
.horizon-detail-col {
  min-width: 0; position: relative;
  padding-left: 8px;
  overflow: visible;
}
.horizon-detail-row {
  position: absolute; left: 0; right: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: visible;
}
.horizon-detail-name {
  font-size: 11px; font-weight: 600; color: var(--cream);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: none; /* hide label — shown in layer bar */
}
/* Ksat / Clay data columns within the horizon detail row */
.horizon-data-cols {
  display: flex; gap: 0; width: 100%;
}
.horizon-data-col {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  width: 60px; flex-shrink: 0;
}
.horizon-data-col-header {
  font-size: 9px; font-weight: 600; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.3px;
  position: absolute; top: -18px;
  white-space: nowrap;
}
.horizon-data-val {
  font-size: 13px; font-weight: 700; color: var(--cream);
  white-space: nowrap;
}
.horizon-data-val.ksat-primary {
  font-size: 13px; color: #f1c40f; font-weight: 700;
}
.horizon-data-val-unit {
  font-size: 9px; color: var(--text-dim); font-weight: 400;
}
.horizon-detail-props {
  font-size: 11px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.horizon-marker-line {
  position: absolute; left: 0;
  border-top: 2px dashed;
  z-index: 2;
}
.horizon-marker-line.bedrock {
  border-color: rgba(122,122,122,0.7);
  right: 0;
}
.horizon-marker-line.watertable {
  border-color: rgba(33,150,243,0.7);
  right: -80px; /* extend line further right to label */
}
.horizon-marker-label {
  position: absolute;
  font-size: 11px; font-weight: 600;
  transform: translateY(-100%); padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
}
.horizon-marker-label.bedrock {
  right: 0;
  color: #aaa; background: rgba(122,122,122,0.15);
}
.horizon-marker-label.watertable {
  right: -80px;
  color: #64b5f6; background: rgba(33,150,243,0.15);
}

/* Product recommendation cards */
.rec-card {
  background: var(--bg-card); border-radius: 8px;
  padding: 16px; margin-bottom: 12px;
  border-left: 4px solid var(--cream);
}
.rec-card.secondary { border-left-color: var(--brown); }
.rec-card h3 { font-size: 17px; font-weight: 700; margin-bottom: 4px; color: var(--cream); }
.rec-card .rec-method { font-size: 14px; color: var(--text-muted); margin-bottom: 12px; }
.rec-card .rec-detail {
  font-size: 15px; padding: 5px 0;
  display: flex; justify-content: space-between;
}
.rec-card .rec-detail .label { color: var(--text-muted); }
.rec-card .rec-detail .value { font-weight: 600; }
.rec-card .rec-notes {
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.rec-card .rec-notes li {
  font-size: 14px; color: var(--text-muted);
  margin-bottom: 5px; padding-left: 12px;
  position: relative; list-style: none;
  line-height: 1.5;
}
.rec-card .rec-notes li::before {
  content: '\2022'; position: absolute; left: 0; color: var(--cream);
}

.container-table {
  width: 100%; margin-top: 8px; font-size: 13px;
}
.container-table td { padding: 4px 0; }
.container-table td:last-child { text-align: right; font-weight: 600; }

/* Warnings */
.warning-card {
  background: rgba(230,126,34,0.1); border: 1px solid rgba(230,126,34,0.3);
  border-radius: 6px; padding: 14px 16px; margin-bottom: 8px;
  font-size: 14px; color: #f0c27a; line-height: 1.55;
}

/* Full-bleed map steps — slim side margins, fill viewport exactly */
.step-depth-fullbleed {
  padding: 0 !important;
  max-width: none !important;
  height: calc(100vh - var(--header-h));
  overflow: hidden;
}
/* Only apply flex when step is active — otherwise display:none from .step takes over */
.step-depth-fullbleed.active {
  display: flex !important;
  flex-direction: column;
}
#map-container {
  margin: 0 5px;
}
#results-map {
  margin: 0 5px;
}

.depth-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid rgba(242,229,179,0.1);
  flex-shrink: 0;
}
.depth-topbar-left {
  display: flex; align-items: center; gap: 10px;
}
.depth-topbar-left strong {
  font-size: 16px; color: var(--cream);
}
.depth-topbar-hint {
  display: block; font-size: 15px; color: var(--cream);
  margin-top: 3px;
  font-weight: 500;
  opacity: 0.85;
  line-height: 1.4;
}
/* Desktop: center depth topbar */
@media (min-width: 768px) {
  .depth-topbar {
    flex-direction: column; align-items: center; text-align: center; gap: 6px;
  }
  .depth-topbar-left {
    flex-direction: column; align-items: center; gap: 6px;
  }
}
.depth-badge {
  font-size: 13px; font-weight: 600; color: var(--cream);
  background: rgba(242,229,179,0.12);
  padding: 4px 10px; border-radius: 12px;
  white-space: nowrap;
}

/* Depth map container — fills remaining space via flex */
#depth-map-container {
  width: 100%;
  flex: 1;
  min-height: 200px;
  position: relative;
  overflow: hidden;
}

/* Depth popup — floating card that appears at click location */
.depth-popup {
  position: absolute;
  z-index: 20;
  background: rgba(11,15,36,0.95);
  border: 1px solid rgba(242,229,179,0.3);
  border-radius: 10px;
  padding: 14px 16px;
  width: 200px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  transform: translate(-50%, -100%);
  margin-top: -12px;
}
.depth-popup::after {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 12px; height: 12px;
  background: rgba(11,15,36,0.95);
  border-right: 1px solid rgba(242,229,179,0.3);
  border-bottom: 1px solid rgba(242,229,179,0.3);
}
/* When popup appears below the click point */
.depth-popup-below::after {
  bottom: auto; top: -7px;
  border-right: none; border-bottom: none;
  border-left: 1px solid rgba(242,229,179,0.3);
  border-top: 1px solid rgba(242,229,179,0.3);
}
.depth-popup-title {
  font-size: 13px; color: var(--text-muted);
  margin-bottom: 8px; text-align: center;
}
.depth-popup-input-row {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin-bottom: 10px;
}
.depth-popup-input-row input {
  width: 80px; padding: 8px 10px; text-align: center;
  background: var(--bg-surface); border: 1px solid rgba(242,229,179,0.2);
  border-radius: 6px; color: var(--cream); font-size: 18px;
  font-weight: 700; font-family: inherit; outline: none;
}
.depth-popup-input-row input:focus { border-color: var(--cream); }
.depth-popup-unit {
  font-size: 15px; color: var(--text-muted); font-weight: 600;
}
.depth-popup-actions {
  display: flex; gap: 6px;
}
.depth-popup-btn {
  flex: 1; padding: 7px 0; border: none; border-radius: 5px;
  font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.depth-popup-cancel {
  background: var(--bg-surface); color: var(--text-muted);
  border: 1px solid rgba(242,229,179,0.1);
}
.depth-popup-cancel:hover { background: #1f2d5e; }
.depth-popup-add {
  background: var(--cream); color: var(--navy);
}
.depth-popup-add:hover { background: #e6d89e; }

/* Compact point tags strip */
.depth-points-strip {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 8px 12px;
  min-height: 0;
  background: var(--bg);
  overflow-x: auto;
  flex-shrink: 0;
}
.depth-tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg-card);
  border: 1px solid rgba(242,229,179,0.12);
  border-radius: 16px;
  padding: 4px 10px 4px 8px;
  font-size: 12px; color: var(--text);
  white-space: nowrap;
  cursor: default;
}
.depth-tag-num {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--cream); color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 10px; flex-shrink: 0;
}
.depth-tag-value {
  font-weight: 600; color: var(--cream);
}
.depth-tag-remove {
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); font-size: 14px;
  padding: 0 0 0 2px; line-height: 1;
  transition: color 0.15s;
}
.depth-tag-remove:hover { color: var(--danger); }

/* Depth bottom action bar */
.depth-actions-bar {
  display: flex; gap: 8px;
  padding: 10px 16px;
  background: var(--bg-card);
  border-top: 1px solid rgba(242,229,179,0.1);
  flex-shrink: 0;
}
@media (min-width: 768px) {
  .depth-actions-bar { justify-content: center; }
  #map-controls { justify-content: center; }
}

/* Results map */
#results-map-container {
  margin-bottom: 16px;
}
#results-map {
  width: 100%; height: 35vh; min-height: 250px;
  border-radius: 8px; overflow: hidden;
  border: 1px solid rgba(242,229,179,0.15);
}

/* Bathymetry results card */
.bathy-card {
  background: var(--bg-card); border-radius: 8px;
  padding: 16px; margin-bottom: 16px;
  border: 1px solid rgba(242,229,179,0.1);
}
.bathy-card h3 {
  font-size: 16px; font-weight: 700; margin-bottom: 12px; color: var(--cream);
}

/* Multi-component soil series accordion */
.component-card {
  background: var(--bg-card); border-radius: 8px;
  margin-bottom: 8px; overflow: hidden;
  border: 1px solid rgba(242,229,179,0.1);
}
.component-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; cursor: pointer; user-select: none;
}
.component-header:hover { background: rgba(242,229,179,0.03); }
.component-name {
  font-size: 15px; font-weight: 600; color: var(--cream);
}
.component-area {
  font-size: 13px; color: var(--text-muted);
}
.component-card.expanded .component-chevron { transform: rotate(180deg); }
.component-body {
  display: none; padding: 0 14px 14px;
}
.component-card.expanded .component-body { display: block; }

/* Dominant soil label */
.component-dominant-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--cream);
  background: rgba(242,229,179,0.12);
  padding: 2px 8px; border-radius: 4px;
  margin-right: 6px;
}
/* Expand hint label — visible on desktop, hidden on mobile */
.component-expand-hint {
  font-size: 13px; font-weight: 600; color: var(--cream);
  opacity: 0.7; white-space: nowrap;
  margin-left: 8px; flex-shrink: 0;
  transition: opacity 0.2s;
}
.component-header:hover .component-expand-hint { opacity: 1; }
.component-card.expanded .component-expand-hint { display: none; }
@media (max-width: 480px) {
  .component-expand-hint { font-size: 11px; }
}
/* Expand chevron — more prominent */
.component-chevron {
  font-size: 14px; color: var(--cream); opacity: 0.6;
  transition: transform 0.2s, opacity 0.2s;
  flex-shrink: 0; margin-left: 6px;
}
.component-header:hover .component-chevron { opacity: 1; }

/* Soil map legend */
.soil-legend {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 8px; font-size: 12px;
}
.soil-legend-item {
  display: flex; align-items: center; gap: 4px;
}
.soil-legend-swatch {
  width: 14px; height: 14px; border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.2);
}

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 12px 24px; border-radius: 8px;
  font-size: 14px; font-weight: 600; z-index: 200;
  opacity: 0; transition: opacity 0.3s; pointer-events: none;
  background: var(--bg-card); color: var(--text);
  border: 1px solid rgba(242,229,179,0.2);
  max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; }
.toast.toast-error { background: var(--danger); color: white; border-color: transparent; }
.toast.toast-success { background: var(--green); color: white; border-color: transparent; }

/* Responsive */
@media (min-width: 768px) {
  .step-map-fullbleed #map-container { min-height: 300px; }
  #results-map { height: 45vh; min-height: 350px; }
  .horizon-layers-col { width: 110px; }
}

@media (max-width: 380px) {
  .form-row-label { font-size: 13px; }
  .toggle-opt { padding: 6px 12px; font-size: 12px; }
  .step { padding: 12px; }
  .horizon-table { font-size: 11px; }
  .horizon-table th, .horizon-table td { padding: 4px 6px; }
  .info-popover { width: 220px; }
  .depth-popup { width: 180px; padding: 12px 14px; }
  .depth-popup-input-row input { font-size: 16px; width: 70px; }
}

/* PDF Generate button */
#btn-generate-pdf {
  background: var(--green); border-color: var(--green);
  width: 100%; margin-bottom: 8px;
}

/* Leak summary strip (inline in Step 2) */
.leak-summary {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; margin-top: 8px;
  background: rgba(231,76,60,0.08);
  border: 1px solid rgba(231,76,60,0.2);
  border-radius: 8px; font-size: 13px; color: var(--text);
}
#leak-summary-text { flex: 1; }

/* Full-screen leak overlay */
.leak-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--bg); display: flex; flex-direction: column;
}
.leak-overlay-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--bg-card);
  border-bottom: 1px solid rgba(242,229,179,0.12);
  flex-shrink: 0;
}
.leak-overlay-title {
  font-size: 16px; font-weight: 700; color: var(--cream);
}
.leak-overlay-body {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
}

/* Sidebar: diagnostic questions */
.leak-sidebar {
  padding: 12px 16px; overflow-y: auto;
  flex-shrink: 0;
}
.leak-sidebar .form-row-compact { margin-bottom: 6px; }
.leak-sidebar-divider {
  height: 1px; background: rgba(242,229,179,0.1);
  margin: 10px 0;
}

/* Map area fills remaining space */
.leak-map-area {
  flex: 1; min-height: 0; position: relative;
}
#leak-map-container {
  width: 100%; height: 100%;
  position: absolute; inset: 0;
}
#leak-map-controls {
  display: flex; gap: 8px; margin-top: 8px;
}

/* Toggle group (3-wide for leak type/duration) */
.toggle-group-wide { gap: 1px; }
.toggle-group-wide .toggle-opt { padding: 6px 10px; font-size: 12px; }

/* Leak zone tags */
.leak-zones-list { margin-top: 8px; }
.leak-zone-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(231,76,60,0.12);
  border: 1px solid rgba(231,76,60,0.3);
  border-radius: 16px; padding: 4px 10px 4px 8px;
  font-size: 12px; color: var(--text); margin: 0 6px 6px 0;
}
.leak-zone-tag-num {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--danger); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 10px; flex-shrink: 0;
}
.leak-zone-tag-label { font-weight: 500; color: #e74c3c; }
.leak-zone-tag-remove {
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); font-size: 14px;
  padding: 0 0 0 2px; line-height: 1; transition: color 0.15s;
}
.leak-zone-tag-remove:hover { color: var(--danger); }

/* Desktop: side-by-side layout */
@media (min-width: 768px) {
  .leak-overlay-body { flex-direction: row; }
  .leak-sidebar {
    width: 340px; flex-shrink: 0;
    border-right: 1px solid rgba(242,229,179,0.1);
    border-bottom: none;
  }
}
/* Mobile: column — questions below map */
@media (max-width: 767px) {
  .leak-overlay-body { flex-direction: column-reverse; }
  .leak-sidebar {
    max-height: 45vh; min-height: 160px;
    border-top: 1px solid rgba(242,229,179,0.1);
  }
}

/* Compact radio cards for leak scenario selector */
.radio-stack-compact { gap: 6px; }
.radio-card-sm { padding: 8px 12px; }
.radio-card-sm .radio-card-content strong { font-size: 13px; }
.radio-card-hint {
  display: block; font-size: 11px; color: var(--text-dim); margin-top: 2px;
}

/* Two-prong recommendation layout */
.rec-two-prong { margin-bottom: 16px; }
.rec-two-prong-intro {
  font-size: 13px; color: var(--text-muted); margin-bottom: 16px; line-height: 1.5;
}
.rec-option-badge {
  font-size: 12px; font-weight: 700; color: var(--cream);
  padding: 4px 10px; background: rgba(242,229,179,0.1);
  border-radius: 4px; display: inline-block; margin-bottom: 8px;
}
@media (min-width: 768px) {
  .rec-two-prong-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  }
}

/* Computed treatment zone tag */
.leak-zone-tag-computed {
  background: rgba(255,165,0,0.12);
  border-color: rgba(255,165,0,0.3);
}
.leak-zone-tag-computed .leak-zone-tag-label { color: #ffa500; }
/* Pipe run tag */
.leak-zone-tag-pipe {
  background: rgba(255,165,0,0.12);
  border-color: rgba(255,165,0,0.3);
}
.leak-zone-tag-pipe .leak-zone-tag-label { color: #ffa500; }
/* Exterior zone tag */
.leak-zone-tag-exterior {
  background: rgba(155,89,182,0.12);
  border-color: rgba(155,89,182,0.3);
}
.leak-zone-tag-exterior .leak-zone-tag-label { color: #9b59b6; }

/* ── Permalink bar ─────────────────────────────────────────── */
.permalink-bar {
  background: var(--bg-surface);
  border: 1px solid rgba(242,229,179,0.15);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 16px 0;
}
.permalink-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.permalink-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.permalink-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid rgba(242,229,179,0.1);
  border-radius: 6px;
  color: var(--cream);
  font-family: monospace;
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  cursor: text;
}
.permalink-input:focus {
  border-color: var(--cream);
}
.btn-small {
  padding: 8px 16px;
  font-size: 13px;
  white-space: nowrap;
}

/* ── Staff List Page ───────────────────────────────────────── */
.staff-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 16px;
}
.staff-page h1 {
  font-size: 22px;
  color: var(--cream);
  margin-bottom: 4px;
}
.staff-page .subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
}
.staff-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.staff-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.staff-table th {
  text-align: left;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(242,229,179,0.1);
  white-space: nowrap;
}
.staff-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text);
  white-space: nowrap;
}
.staff-table tr:hover td {
  background: rgba(242,229,179,0.04);
}
.staff-table a {
  color: var(--cream);
  text-decoration: none;
}
.staff-table a:hover {
  text-decoration: underline;
}
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.status-draft { background: rgba(155,155,155,0.2); color: #999; }
.status-submitted { background: rgba(52,152,219,0.2); color: #3498db; }
.status-reviewed { background: rgba(230,126,34,0.2); color: #e67e22; }
.status-released { background: rgba(39,174,96,0.2); color: #27ae60; }
.severity-badge {
  font-size: 12px;
}
.staff-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.staff-count {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 12px;
}
