/* --- High-Visibility Alert Banner --- */
.alert-banner:not(:empty) {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: #fef2f2; /* Soft red background */
  color: #991b1b;            /* High-contrast dark red text */
  border: 1px solid #fca5a5; /* Distinct red border */
  padding: 12px 16px;
  border-radius: 6px;
  margin-top: 12px;
  margin-bottom: 24px;
  font-weight: 500;
  font-size: 0.95rem;
}

/* Optional: Adds a warning icon using pure CSS */
.alert-banner:not(:empty)::before {
  content: "⚠️"; 
  font-size: 1.1rem;
}

:root {
  --ink: #182620;
  --ink-soft: #3d4a44;
  --paper: #eef1ea;
  --panel: #ffffff;
  --line: #d7ddd2;
  --muted: #6d786f;
  --teal: #1f7a6c;
  --teal-soft: #e3f0ec;
  --amber: #c97a2b;
  --amber-soft: #f7e9d8;
  --rose: #a8503f;
  --rose-soft: #f3e2dd;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "URW Palladio L", P052, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  background-image: linear-gradient(var(--line) 1px, transparent 1px);
  background-size: 100% 32px;
  background-attachment: local;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; }
::selection { background: var(--teal); color: #fff; }

/* ---------- Modern 3-Section Masthead ---------- */
.masthead {
  border-bottom: 2px solid var(--ink);
  padding: 18px clamp(16px, 4vw, 48px);
  background:
    radial-gradient(ellipse 500px 300px at 5% -40%, rgba(31,122,108,0.08), transparent 60%),
    radial-gradient(ellipse 450px 320px at 95% 140%, rgba(201,122,43,0.09), transparent 60%),
    var(--paper);
}

.masthead-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 40px;                     /* breathing room */
}

/* Logo */
.brand-logo {
  line-height: 0;
}
.brand-mark {
  height: 48px;
  width: auto;
  display: block;
}

/* 2. Caption – larger + more letter spacing */
.brand-caption {
  font-family: var(--serif);
  font-size: 30px;                 /* significantly larger */
  font-weight: 400;
  font-style: italic;
  color: var(--ink);
  letter-spacing: 0.04em;          /* more open character spacing */
  text-align: center;
  line-height: 1.25;
  justify-self: center;
}

/* 3. Progress Map – much more compact */
.map-route {
  display: flex;
  align-items: center;
  gap: 2px;
  justify-content: flex-end;
}

.map-stop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 38px;          /* significantly tighter */
}

.map-pin {
  width: 24px;              /* smaller pins */
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--ink);
  background: var(--panel);
}

.map-stop .label {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}

.map-line {
  width: 8px;               /* shorter connecting lines */
  height: 1.5px;
  background: var(--line);
  margin-bottom: 10px;
  flex-shrink: 0;
}

/* States */
.map-stop.active .map-pin {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}
.map-stop.active .label {
  color: var(--ink);
  font-weight: 600;
}
.map-stop.done .map-pin {
  border-color: var(--teal);
  color: var(--teal);
  background: var(--teal-soft);
}
.map-stop.done .label {
  color: var(--teal);
}
.map-stop.dest.active .map-pin {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
  .masthead {
    padding: 14px 16px 16px;
  }

  .masthead-inner {
    grid-template-columns: 1fr;
    gap: 12px;
    justify-items: center;
  }

  .brand-logo { order: 1; }
  .brand-caption {
    order: 2;
    font-size: 20px;
  }
  .map-route {
    order: 3;
    width: 100%;
    justify-content: space-between;
  }

  .brand-mark {
    height: 42px;
  }

  .map-stop {
    min-width: 46px;
  }
  .map-pin {
    width: 28px;
    height: 28px;
  }
  .map-line {
    width: 10px;
  }
}
/* ============================================================
   Core Layout
   ============================================================ */
main {
  flex: 1;
  max-width: 920px;
  margin: 0 auto;
  padding: 36px clamp(16px, 4vw, 48px) 60px;
  width: 100%;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}
.section-head h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 26px;
  margin: 0;
}
.section-sub {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
}

.lede {
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--ink-soft);
  max-width: 640px;
}

footer {
  border-top: 2px solid var(--ink);
  padding: 18px clamp(16px, 4vw, 48px);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.empty-state {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  border: 1px dashed var(--line);
  padding: 28px;
  text-align: center;
}

/* ============================================================
   Forms
   ============================================================ */
.field { margin-bottom: 0; }

.intake-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}

.field select,
.field input[type=number],
.field input[type=text] {
  width: 100%;
  font-family: var(--mono);
  font-size: 14px;
  padding: 9px 8px;
  border: 1px solid var(--ink);
  background: var(--panel);
  color: var(--ink);
  border-radius: 0;
  appearance: none;
  -webkit-appearance: none;
}

.field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%),
                    linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 16px) 15px, calc(100% - 11px) 15px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.field select:focus,
.field input:focus {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px 18px;
  align-items: end;
}

.unit-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.unit-toggle {
  display: inline-flex;
  border: 1px solid var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  overflow: hidden;
}
.unit-toggle button {
  background: var(--panel);
  border: none;
  padding: 7px 12px;
  cursor: pointer;
  color: var(--muted);
}
.unit-toggle button.active {
  background: var(--ink);
  color: var(--paper);
}
.unit-toggle.small { font-size: 9.5px; }
.unit-toggle.small button { padding: 4px 9px; }

.check-field {
  display: flex;
  align-items: center;
  gap: 8px;
}
.check-field input {
  width: 16px;
  height: 16px;
  accent-color: var(--teal);
  flex-shrink: 0;
}
.check-field label {
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.3;
}

.btn {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  padding: 12px 22px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
  text-decoration: none;
  display: inline-block;
}
.btn:hover {
  background: var(--teal);
  border-color: var(--teal);
}
.btn.secondary {
  background: transparent;
  color: var(--ink);
}
.btn.secondary:hover {
  background: var(--ink);
  color: var(--paper);
}
.btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.page-footer-nav {
  margin-top: 34px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.validation-msg {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--rose);
  min-height: 1em;
}

/* ============================================================
   Stats / Badges / Gauges
   ============================================================ */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--ink);
  margin-bottom: 26px;
}
.stat-card {
  background: var(--panel);
  padding: 16px 14px;
}
.stat-card .k {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat-card .v {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 600;
  margin-top: 4px;
}
.stat-card .u {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.stat-card.hero {
  background: var(--ink);
  color: var(--paper);
}
.stat-card.hero .k { color: #9fb0a8; }
.stat-card.hero .v { font-size: 30px; color: #fff; }
.stat-card.flag .v { color: var(--rose); }
.stat-card.good .v { color: var(--teal); }

.badge-row {
  display: flex;
  gap: 16px;
  margin: 6px 0 26px;
  flex-wrap: wrap;
}
.badge {
  display: flex;
  align-items: center;
  gap: 13px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 8px 20px 8px 8px;
}
.badge-ring {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3.5px solid var(--teal);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--teal);
}
.badge-ring.amber { border-color: var(--amber); color: var(--amber); }
.badge-ring.rose { border-color: var(--rose); color: var(--rose); }
.badge-text {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.35;
}
.badge-text b {
  display: block;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  font-weight: 400;
  margin-bottom: 2px;
}

.gauge-block { margin-bottom: 16px; }
.gauge-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.gauge-label .range-val {
  color: var(--teal);
  font-weight: 600;
  white-space: nowrap;
}
.gauge-track {
  position: relative;
  height: 16px;
  background: repeating-linear-gradient(90deg, var(--line), var(--line) 1px, transparent 1px, transparent calc(100%/10));
  border: 1px solid var(--ink);
}
.gauge-band {
  position: absolute;
  top: 0; bottom: 0;
  background: var(--teal-soft);
  border-left: 2px solid var(--teal);
  border-right: 2px solid var(--teal);
}
.gauge-marker {
  position: absolute;
  top: -6px;
  width: 0; height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 9px solid var(--amber);
  transform: translateX(-50%);
}
.gauge-marker.bad { border-top-color: var(--rose); }
.gauge-scale {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted);
  margin-top: 3px;
}

/* ============================================================
   Cards, Tags, Notes
   ============================================================ */
.cat-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--teal);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 26px 0 12px;
}
.cat-title:first-child { margin-top: 0; }
.cat-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.test-card {
  border: 1px solid var(--line);
  border-left: 3px solid var(--teal);
  background: var(--panel);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: border-left-color .2s, background .2s;
}

/* Soft-gate: visual nudge for unanswered cards */
@keyframes card-nudge-pulse {
  0%   { background: var(--panel); border-left-color: var(--teal); }
  15%  { background: var(--amber-soft); border-left-color: var(--amber); }
  70%  { background: var(--amber-soft); border-left-color: var(--amber); }
  100% { background: var(--panel); border-left-color: var(--teal); }
}
.card-needs-answer {
  animation: card-nudge-pulse 2.2s ease forwards;
  outline: 2px solid var(--amber);
  outline-offset: -2px;
}
.test-card .head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  flex-wrap: wrap;
}
.test-card .name { font-weight: 600; font-size: 14.5px; }
.test-card .test-desc { font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; }
.test-card .symptom { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.test-card .symptom b { color: var(--ink-soft); font-weight: 600; }
.test-card .answers {
  display: flex;
  gap: 14px;
  margin-top: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.tag {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 3px 7px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.tag.due { border-color: var(--rose); color: var(--rose); }
.tag.ok { border-color: var(--teal); color: var(--teal); }

.note-block {
  margin-top: 22px;
  border-left: 3px solid var(--amber);
  background: var(--amber-soft);
  padding: 14px 16px;
  font-size: 13.5px;
  color: #5a3d1c;
}
.note-block .k {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--amber);
  display: block;
  margin-bottom: 4px;
}
.note-block.teal {
  border-left-color: var(--teal);
  background: var(--teal-soft);
  color: #123f37;
}
.note-block.teal .k { color: var(--teal); }

.radio-pair {
  display: flex;
  gap: 4px;
  font-family: var(--mono);
  font-size: 11px;
}
.radio-pair label {
  border: 1px solid var(--line);
  padding: 6px 11px;
  cursor: pointer;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.radio-pair input { display: none; }
.radio-pair input:checked + label {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* ============================================================
   Symptoms
   ============================================================ */
.symptom-search-full {
  width: 100%;
  margin-bottom: 24px;
}
.symptom-search-full input {
  width: 100%;
  padding: 14px 16px;
  font-size: 15px;
}

.symptom-split-layout {
  display: grid;
  gap: 24px;
  align-items: start;
  grid-template-columns: 1fr;
}

.cat-sidebar {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
}

.cat-side-btn {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-soft);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}
.cat-side-btn:hover { border-color: var(--teal); }
.cat-side-btn.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
  font-weight: 600;
}

.browse-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 30px;
  min-height: 40px;
}

.browse-chip {
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  transition: border-color .15s ease;
  text-align: left;
}
.browse-chip:hover { border-color: var(--teal); }
.browse-chip.selected {
  background: var(--teal-soft);
  border-color: var(--teal);
  color: #123f37;
}
.browse-chip.selected::before {
  content: "✓ ";
  color: var(--teal);
}

.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 6px 6px 6px 12px;
  border: 1px solid var(--ink);
}
.chip .chip-x {
  background: transparent;
  border: none;
  color: var(--paper);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 2px 6px;
  opacity: .75;
}
.chip .chip-x:hover { opacity: 1; }

.symptom-empty-hint {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-top: 8px;
}

@media (min-width: 720px) {
  .symptom-split-layout {
    grid-template-columns: 240px 1fr;
  }
  .cat-sidebar {
    flex-direction: column;
    flex-wrap: nowrap;
    position: sticky;
    top: 16px;
  }
}

/* ============================================================
   Routine Ledger
   ============================================================ */
.ledger-container {
  border: 1px solid var(--ink);
  margin-bottom: 24px;
}

.ledger-top-bar {
  position: sticky;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
}
.ledger-top-bar h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 18px;
  margin: 0;
}
.hour-counter {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .05em;
}

.ledger-group-head {
  background: var(--paper);
  padding: 8px 16px;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--teal);
  border-bottom: 1px solid var(--line);
}

.ledger-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 70px;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  align-items: center;
}
.ledger-row:last-child { border-bottom: none; }
.ledger-row.total-row { background: var(--teal-soft); }

.ledger-label {
  font-size: 14.5px;
  font-weight: 600;
}
.ledger-sub {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 400;
  margin-top: 2px;
}

.hour-input {
  width: 100%;
  padding: 10px;
  font-family: var(--mono);
  font-size: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  text-align: right;
  border-radius: 0;
}
.hour-input:focus {
  outline: 2px solid var(--teal);
  outline-offset: -1px;
}
.hour-input[readonly] {
  background: transparent;
  border-color: transparent;
  font-weight: 600;
}

.stock-ticker {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

.routine-section-title {
  font-family: var(--serif);
  font-size: 20px;
  margin: 36px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--ink);
}

.habit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.habit-card {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.habit-card .k {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}
.habit-card .sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 12px;
  line-height: 1.4;
}
.habit-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.habit-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.habit-input-wrap input[type="number"] {
  width: 95px;
  padding: 8px;
  font-family: var(--mono);
  font-size: 13.5px;
  border: 1px solid var(--ink);
  text-align: center;
}
.habit-input-wrap .unit {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.habit-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.habit-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}

.weekly-thumb {
  font-size: 18px;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  transform: scale(0.8);
}
.weekly-thumb.active {
  opacity: 1;
  transform: scale(1);
}

@media (max-width: 600px) {
  .ledger-row {
    grid-template-columns: 1fr 1fr 60px;
    grid-template-areas:
      "label label label"
      "actual ideal diff";
    gap: 8px 16px;
  }
  .ledger-label { grid-area: label; margin-bottom: 4px; }
  .col-actual { grid-area: actual; }
  .col-ideal { grid-area: ideal; }
  .col-diff { grid-area: diff; align-self: end; padding-bottom: 10px; }

  .col-actual::before,
  .col-ideal::before {
    display: block;
    font-family: var(--mono);
    font-size: 9px;
    color: var(--muted);
    margin-bottom: 4px;
  }
  .col-actual::before { content: "ACTUAL (h)"; }
  .col-ideal::before { content: "IDEAL (h)"; }
}

/* ============================================================
   Diet / Food Quality Matrix
   ============================================================ */
.fq-matrix-wrapper {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 36px;
}

.fq-matrix {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}

.fq-matrix th,
.fq-matrix td {
  border: 1px solid var(--line);
  padding: 12px 8px;
  text-align: center;
  vertical-align: middle;
}

.fq-matrix thead th {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  background: var(--paper);
  color: var(--ink-soft);
  line-height: 1.3;
}

.fq-matrix thead th:first-child {
  width: 110px;
  text-align: left;
  padding-left: 14px;
  background: var(--panel);
}

.fq-matrix tbody th {
  font-family: var(--mono);
  font-size: 12px;
  text-align: left;
  padding-left: 14px;
  background: var(--panel);
  white-space: nowrap;
}

.fq-matrix input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--muted);
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  background: var(--panel);
  display: inline-block;
}
.fq-matrix input[type="radio"]:checked {
  border-color: var(--teal);
  background: var(--teal);
}
.fq-matrix input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: white;
}
.fq-matrix td:has(input:checked) {
  background: var(--teal-soft);
}

/* ============================================================
   Videos / Next Steps
   ============================================================ */
.video-source-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 20px 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.video-source-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}

.video-card {
  border: 1px solid var(--line);
  background: var(--panel);
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color .15s ease;
}
.video-card:hover { border-color: var(--teal); }
.video-card:hover .video-title { color: var(--teal); }

.video-thumb-wrap {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--ink);
}
.video-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.video-duration {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(20,25,22,.82);
  color: #fff;
  font-family: var(--mono);
  font-size: 9.5px;
  padding: 2px 5px;
}
.video-title {
  font-size: 12.5px;
  font-weight: 600;
  padding: 10px 12px 6px;
  line-height: 1.35;
}
.video-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 0 12px 12px;
}

/* ============================================================
   Home / Hero
   ============================================================ */
.hero-section h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(38px, 6vw, 64px);
  line-height: 1.05;
  margin: 0 0 20px;
  letter-spacing: -0.01em;
}
.hero-section h1 em {
  font-style: italic;
  color: var(--teal);
}
.hero-lede {
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink-soft);
  max-width: 620px;
  margin-bottom: 36px;
}

.start-cta {
  text-align: center;
  padding: 20px 0 10px;
}
.start-cta .btn {
  font-size: 14px;
  padding: 18px 40px;
}
.start-cta p {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-top: 14px;
}

/* ============================================================
   Print
   ============================================================ */
.print-only { display: none; }
@media print {
  body > *:not(.print-only) { display: none !important; }
  .print-only { display: block !important; padding: 24px; }
  body { background: #fff; }
}
/* ===== Home Hero – tighter & more refined ===== */
.hero-section {
  padding: 48px clamp(16px, 4vw, 48px) 40px;
  text-align: center;
}

.hero-question {
  text-align: center;
  margin: 0 0 12px;
}

.hero-question h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(42px, 7vw, 62px);
  line-height: 1.05;
  margin: 0 0 8px;
  letter-spacing: -0.025em;
}

.hero-question .sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(18px, 2.8vw, 22px);
  color: var(--ink-soft);
  margin: 0;
}

.hero-summary {
  text-align: center;
  max-width: 540px;
  margin: 0 auto 40px;
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--ink-soft);
}

/* ===== Start Button – more premium ===== */
.start-wrap {
  text-align: center;
  margin-top: 8px;
}

.start-wrap .btn {
  font-size: 14px;
  padding: 16px 52px;
  letter-spacing: 0.12em;
}

.start-wrap p {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin-top: 14px;
}

.outcome-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 48px;
}

.outcome-card {
  background: var(--panel);
  border: 1px solid var(--ink);
  padding: 22px 20px 24px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s ease, transform 0.2s ease;
  /* Remove the fixed min-height from here */
}

.outcome-card:hover {
  border-color: var(--teal);
  transform: translateY(-2px);
}

.outcome-card .verb {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.outcome-card h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 18px;
  margin: 0 0 10px;
  line-height: 1.3;
}

.outcome-card p {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0;
  flex-grow: 1;
}

/* Responsive */
@media (max-width: 900px) {
  .outcome-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 520px) {
  .outcome-grid {
    grid-template-columns: 1fr;
  }
}
/* ============================================================
   Diagnostics – improve Recency / Result Status / Notes only
   ============================================================ */

.recency-select,
.result-row select {
  font-family: var(--mono) !important;
  font-size: 13px !important;
  background-color: var(--paper) !important;
  border: 1px solid var(--line) !important;
  color: var(--ink) !important;
  padding: 8px 28px 8px 10px !important;
  min-width: 180px;
}

.result-note-input {
  font-family: var(--mono) !important;
  font-size: 13px !important;
  background-color: var(--paper) !important;
  border: 1px solid var(--line) !important;
  color: var(--ink) !important;
  padding: 8px 10px !important;
}

/* ---- Food Quality: mobile stack ---- */
.fq-mobile-only { display: none; }
.fq-desktop-only { display: block; }

.fq-mobile-list {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 4px;
  overflow: hidden;
}

.fq-mobile-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.fq-mobile-row:last-child { border-bottom: none; }

.fq-mobile-label {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
}

.fq-mobile-select {
  width: 100%;
  font-family: var(--mono);
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--ink);
  background: var(--panel);
  color: var(--ink);
  border-radius: 0;
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink) 50%),
    linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 16px) 16px, calc(100% - 11px) 16px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.fq-mobile-select:focus {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
}

@media (max-width: 720px) {
  .fq-desktop-only { display: none !important; }
  .fq-mobile-only  { display: block !important; }
}


/* Tooltip Container */
.info-tooltip-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    color: var(--muted);
    cursor: help;
    margin-left: 6px;
    vertical-align: middle;
}
.info-tooltip-wrap:hover,
.info-tooltip-wrap:focus {
    color: var(--teal);
    outline: none;
}
  
/* Tooltip Content Box */
.info-tooltip-content {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 130%; /* Position above the icon */
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 240px;
    background: var(--ink);
    color: var(--paper);
    padding: 10px 14px;
    border-radius: 4px;
    font-family: var(--sans);
    font-size: 12.5px;
    line-height: 1.45;
    font-weight: 400;
    z-index: 100;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    white-space: normal;
    text-transform: none;
    letter-spacing: normal;
}
  
/* Tooltip Arrow */
.info-tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: var(--ink) transparent transparent transparent;
}
  
/* Show on Hover (Desktop) or Focus/Tap (Mobile) */
.info-tooltip-wrap:hover .info-tooltip-content,
.info-tooltip-wrap:focus .info-tooltip-content {
    visibility: visible;
    opacity: 1;
}
