/* ── TOKENS ──────────────────────────────────────────────── */
:root {
  --ink:      #0a0a0a;
  --ink-2:    #2d2d2d;
  --ink-3:    #5a5a5a;
  --ink-4:    #9a9a9a;
  --line:     #e8e8e8;
  --line-2:   #d4d4d4;
  --surface:  #f7f7f5;
  --white:    #ffffff;
  --green:    #059669;
  --green-lt: #d1fae5;
  --green-dk: #065f46;
  --red:      #dc2626;
  --red-lt:   #fee2e2;
  --red-dk:   #991b1b;
  --amber:    #d97706;
  --amber-lt: #fef3c7;
  --ff-head:  'Syne', sans-serif;
  --ff-body:  'Inter', sans-serif;
  --r4: 4px; --r8: 8px; --r12: 12px; --r16: 16px;
}

/* ── RESET ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--ff-body);
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ── PAGE ────────────────────────────────────────────────── */
.page { max-width: 980px; margin: 0 auto; padding: 40px 20px 80px; }

/* ── HERO ─────────────────────────────────────────────────  */
.hero {
  text-align: center;
  margin-bottom: 32px;
}
.hero-eyebrow {
  font-family: var(--ff-body);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--green);
  margin-bottom: 10px;
}
.hero-title {
  font-family: var(--ff-head);
  font-size: clamp(26px, 5vw, 44px);
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: 12px;
}
.hero-sub {
  font-size: 15px;
  color: var(--ink-3);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── CARDS ──────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r16);
  padding: 28px;
  margin-bottom: 20px;
}

/* ── FORM GRID ──────────────────────────────────────────── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

.form-group { position: relative; }
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.form-input, .form-select {
  width: 100%;
  padding: 10px 13px;
  font-family: var(--ff-body);
  font-size: 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r8);
  background: var(--white);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
.form-input:focus, .form-select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(5,150,105,0.1);
}
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239a9a9a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* ── AUTOCOMPLETE ───────────────────────────────────────── */
.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0; right: 0;
  background: var(--white);
  border: 1px solid var(--line-2);
  border-radius: var(--r8);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  z-index: 100;
  overflow: hidden;
  max-height: 220px;
  overflow-y: auto;
}
.autocomplete-item {
  padding: 9px 13px;
  font-size: 13px;
  cursor: pointer;
  color: var(--ink-2);
  transition: background 0.1s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.autocomplete-item:hover { background: var(--surface); }
.autocomplete-item mark {
  background: none;
  color: var(--green);
  font-weight: 600;
}

/* ── COL TOGGLE ─────────────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
}
.toggle-label { font-size: 13px; color: var(--ink-3); }
.toggle-wrap {
  position: relative;
  width: 42px; height: 24px;
  flex-shrink: 0;
}
.toggle-wrap input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--line-2);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-wrap input:checked + .toggle-track { background: var(--green); }
.toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  pointer-events: none;
}
.toggle-wrap input:checked ~ .toggle-thumb { transform: translateX(18px); }

/* ── BUTTON ─────────────────────────────────────────────── */
.btn-primary {
  width: 100%;
  padding: 13px;
  background: var(--ink);
  color: white;
  font-family: var(--ff-head);
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: var(--r8);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  letter-spacing: 0.2px;
  margin-top: 4px;
}
.btn-primary:hover { background: var(--ink-2); }
.btn-primary:active { transform: scale(0.99); }

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 14px;
  background: var(--white);
  color: var(--ink-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r8);
  font-family: var(--ff-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}
.btn-secondary:hover { background: var(--surface); border-color: var(--line); }
.btn-secondary svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ── RESULTS ─────────────────────────────────────────────── */
#results { display: none; }
#results.visible { display: block; animation: fadeUp 0.35s ease; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.result-job {
  font-family: var(--ff-head);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1.1;
}
.result-location {
  font-size: 12px;
  color: var(--ink-4);
  margin-top: 3px;
  font-family: var(--ff-body);
}
.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.badge-ok    { background: var(--green-lt); color: var(--green-dk); }
.badge-warn  { background: var(--red-lt);   color: var(--red-dk); }
.badge-info  { background: var(--amber-lt); color: var(--amber); }

/* ── ALERT ──────────────────────────────────────────────── */
.alert-box {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r8);
  margin-bottom: 20px;
  font-size: 13px;
  font-weight: 500;
}
.alert-box.visible { display: flex; }
.alert-box svg { width: 16px; height: 16px; flex-shrink: 0; }
.alert-danger { background: var(--red-lt); color: var(--red-dk); border: 1px solid #fca5a5; }
.alert-info   { background: var(--amber-lt); color: #92400e; border: 1px solid #fcd34d; }

/* ── GAUGE ──────────────────────────────────────────────── */
.gauge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 8px 0 24px;
}
.gauge-svg { width: 260px; height: 140px; overflow: visible; }
.gauge-center-value {
  font-family: var(--ff-head);
  font-size: 13px;
  font-weight: 700;
  text-anchor: middle;
  fill: var(--ink);
}
.gauge-center-label {
  font-size: 10px;
  text-anchor: middle;
  fill: var(--ink-4);
  font-family: var(--ff-body);
}
.gauge-edge {
  font-size: 10px;
  fill: var(--ink-4);
  font-family: var(--ff-body);
  font-weight: 500;
}

/* ── STATS GRID ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r12);
  padding: 14px 16px;
}
.stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--ink-4);
  margin-bottom: 4px;
}
.stat-value {
  font-family: var(--ff-head);
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.3px;
  line-height: 1;
}
.stat-card.positive .stat-value { color: var(--green); }
.stat-card.negative .stat-value { color: var(--red); }

/* ── RANGE BAR ──────────────────────────────────────────── */
.range-bar-wrap { margin-bottom: 24px; }
.range-bar-track {
  height: 8px;
  background: linear-gradient(to right, var(--red) 0%, var(--amber) 40%, var(--green) 70%, #166534 100%);
  border-radius: 4px;
  position: relative;
  margin: 8px 0;
}
.range-bar-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 16px; height: 16px;
  background: white;
  border: 2px solid var(--ink);
  border-radius: 50%;
  transition: left 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.range-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ink-4);
  font-weight: 500;
}

/* ── ACTION BUTTONS ─────────────────────────────────────── */
.actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
@media (max-width: 480px) { .actions-grid { grid-template-columns: 1fr; } }

/* ── MODAL ──────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--white);
  border-radius: var(--r16);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.15);
  transform: translateY(10px);
  transition: transform 0.15s;
}
.modal-backdrop.open .modal { transform: translateY(0); }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 1;
}
.modal-title {
  font-family: var(--ff-head);
  font-size: 17px;
  font-weight: 700;
}
.modal-close {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--surface);
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--ink-3);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s;
  line-height: 1;
}
.modal-close:hover { background: var(--line); }
.modal-body { padding: 22px; }
.script-box {
  background: var(--surface);
  border: 1px dashed var(--line-2);
  border-radius: var(--r8);
  padding: 16px;
  font-family: 'Courier New', monospace;
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  color: var(--ink-2);
  margin: 14px 0;
}
.modal-footer {
  display: flex;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
}

/* ── GUIDE ──────────────────────────────────────────────── */
.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 20px 0 4px;
}
@media (max-width: 600px) { .guide-grid { grid-template-columns: 1fr; } }
.guide-step { text-align: center; }
.step-num {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-family: var(--ff-head);
  font-size: 15px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
}
.step-title { font-family: var(--ff-head); font-size: 14px; font-weight: 700; margin-bottom: 5px; }
.step-desc { font-size: 12px; color: var(--ink-3); line-height: 1.5; }

/* ── ARTICLE ─────────────────────────────────────────────── */
.article {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.article-eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--green);
  margin-bottom: 8px;
}
.article-h1 {
  font-family: var(--ff-head);
  font-size: clamp(22px, 3.5vw, 32px);
  font-weight: 800;
  letter-spacing: -0.3px;
  margin-bottom: 14px;
  line-height: 1.15;
}
.article-lead {
  font-size: 15px;
  color: var(--ink-2);
  line-height: 1.7;
  padding-left: 14px;
  border-left: 3px solid var(--green);
  margin-bottom: 28px;
}
.article-body { color: var(--ink-2); line-height: 1.75; }
.article-body h2 {
  font-family: var(--ff-head);
  font-size: 19px;
  font-weight: 800;
  margin: 28px 0 8px;
  color: var(--ink);
}
.article-body h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 18px 0 6px;
  color: var(--ink);
}
.article-body p { margin-bottom: 12px; font-size: 14px; }
.article-body strong { color: var(--ink); font-weight: 600; }
.article-body ul { padding-left: 18px; margin-bottom: 12px; }
.article-body li { margin-bottom: 5px; font-size: 14px; }

.state-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 12px 0 20px;
}
.state-table th {
  background: var(--surface);
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ink-4);
  border-bottom: 1px solid var(--line);
}
.state-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
}
.state-table tr:last-child td { border-bottom: none; }

.faq-item { border-top: 1px solid var(--line); padding: 14px 0; }
.faq-q { font-size: 14px; font-weight: 600; margin-bottom: 5px; color: var(--ink); }
.faq-a { font-size: 13px; color: var(--ink-3); line-height: 1.6; }

/* ── TOAST ──────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 20px; right: 20px;
  background: var(--ink);
  color: white;
  padding: 10px 16px;
  border-radius: var(--r8);
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transform: translateY(6px);
  transition: all 0.2s;
  pointer-events: none;
  max-width: 280px;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ── EXPORT STAGE ────────────────────────────────────────── */
#export-stage {
  position: fixed;
  top: -9999px; left: -9999px;
  width: 800px;
  background: white;
  padding: 40px;
  font-family: 'Inter', sans-serif;
  z-index: -1;
}