/* ============================================================
   LungCare AI Agent — Professional UI v2
   ============================================================ */

/* ── Google Font via @font-face fallback (system fonts) ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ── CSS Variables ── */
:root {
  --bg:            #0d1117;
  --bg2:           #161b22;
  --bg3:           #1c2333;
  --surface:       #21262d;
  --surface2:      #2d333b;
  --border:        #30363d;
  --border2:       #444c56;
  --text:          #e6edf3;
  --text2:         #c9d1d9;
  --muted:         #8b949e;
  --accent:        #58a6ff;
  --accent2:       #1f6feb;
  --accent-glow:   rgba(88,166,255,.25);
  --low:           #3fb950;
  --low-bg:        rgba(63,185,80,.12);
  --low-border:    rgba(63,185,80,.35);
  --med:           #e3b341;
  --med-bg:        rgba(227,179,65,.12);
  --med-border:    rgba(227,179,65,.35);
  --high:          #f85149;
  --high-bg:       rgba(248,81,73,.12);
  --high-border:   rgba(248,81,73,.35);
  --radius:        12px;
  --radius-lg:     16px;
  --shadow:        0 4px 24px rgba(0,0,0,.4);
  --shadow-lg:     0 8px 40px rgba(0,0,0,.55);
  --transition:    .22s cubic-bezier(.4,0,.2,1);
}

/* ── Reset ── */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: #79b8ff; text-decoration: none; }
img { max-width: 100%; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
  background: rgba(13,17,23,.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
}
.nav-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -.02em;
}
.brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent2) 0%, var(--accent) 100%);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 0 14px var(--accent-glow);
}
.brand-ai {
  background: linear-gradient(90deg, var(--accent) 0%, #a5d6ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.nav-links { display: flex; gap: .35rem; align-items: center; }
.nav-link {
  font-size: .875rem;
  font-weight: 500;
  color: var(--muted);
  padding: .45rem .85rem;
  border-radius: 8px;
  transition: background var(--transition), color var(--transition);
}
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.active { color: var(--accent); background: rgba(88,166,255,.1); }
.nav-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
  border-radius: 4px;
  padding: .1rem .4rem;
  margin-left: .3rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* ============================================================
   SDG BANNER
   ============================================================ */
.sdg-banner {
  background: linear-gradient(90deg, rgba(31,111,235,.18) 0%, rgba(88,166,255,.08) 100%);
  border-bottom: 1px solid rgba(88,166,255,.18);
  text-align: center;
  padding: .5rem 1rem;
  font-size: .78rem;
  color: #79b8ff;
  letter-spacing: .01em;
}
.sdg-badge {
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  color: #fff;
  border-radius: 5px;
  padding: .12rem .5rem;
  font-size: .68rem;
  font-weight: 700;
  margin-right: .45rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ============================================================
   LAYOUT
   ============================================================ */
.main-content {
  flex: 1;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3rem;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.75rem 2rem;
  margin-bottom: 1.25rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.card:hover { border-color: var(--border2); }
.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
  margin-bottom: .25rem;
}
.card-subtitle {
  font-size: .83rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

/* ── Step indicator on card titles ── */
.step-tag {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: rgba(88,166,255,.12);
  color: var(--accent);
  border: 1px solid rgba(88,166,255,.2);
  border-radius: 20px;
  padding: .1rem .6rem;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .6rem;
}

/* ============================================================
   PAGE HERO HEADER
   ============================================================ */
.page-hero {
  text-align: center;
  padding: 2.5rem 1rem 2rem;
  position: relative;
}
.page-hero .hero-eyebrow {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--accent);
  margin-bottom: .6rem;
}
.page-hero h1 {
  font-size: 2.25rem;
  font-weight: 900;
  letter-spacing: -.03em;
  line-height: 1.2;
  background: linear-gradient(135deg, var(--text) 0%, #79b8ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: .6rem;
}
.page-hero p {
  font-size: .95rem;
  color: var(--muted);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ============================================================
   AI AGENT PIPELINE
   ============================================================ */
.pipeline-card {
  background: linear-gradient(135deg, var(--bg2) 0%, var(--bg3) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  margin-bottom: 1.25rem;
  position: relative;
  overflow: hidden;
}
.pipeline-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(88,166,255,.06) 0%, transparent 70%);
  pointer-events: none;
}
.pipeline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-wrap: wrap;
  margin-bottom: .75rem;
}
.pipeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1.25rem;
  animation: fadeInUp .5s ease both;
}
.pipeline-step:nth-child(1) { animation-delay: .05s; }
.pipeline-step:nth-child(3) { animation-delay: .15s; }
.pipeline-step:nth-child(5) { animation-delay: .25s; }
.pipeline-step:nth-child(7) { animation-delay: .35s; }

.ps-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent2) 0%, var(--accent) 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem;
  box-shadow: 0 0 16px var(--accent-glow);
  transition: transform var(--transition), box-shadow var(--transition);
}
.pipeline-step:hover .ps-icon {
  transform: translateY(-3px);
  box-shadow: 0 6px 24px var(--accent-glow);
}
.ps-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}
.pipeline-arrow {
  color: var(--border2);
  font-size: 1.2rem;
  padding: 0 .15rem;
}
.pipeline-desc {
  text-align: center;
  font-size: .8rem;
  color: var(--muted);
  line-height: 1.6;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
}
.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-group.full { grid-column: 1 / -1; }

.form-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.form-label .req { color: var(--high); margin-left: .2rem; }
.form-hint { font-size: .73rem; color: var(--muted); margin-top: .15rem; }

.form-control {
  border: 1.5px solid var(--border);
  border-radius: 9px;
  padding: .65rem .9rem;
  font-size: .925rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg2);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  width: 100%;
  appearance: none;
}
.form-control::placeholder { color: var(--muted); opacity: .7; }
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg3);
  box-shadow: 0 0 0 3px rgba(88,166,255,.18);
}
select.form-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='8' fill='none'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%238b949e' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .85rem center;
  padding-right: 2.4rem;
}
select.form-control option { background: var(--surface2); color: var(--text); }

/* ── Family history radio toggle ── */
.radio-group { display: flex; gap: .6rem; margin-top: .3rem; }
.radio-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  padding: .6rem .9rem;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 500;
  color: var(--muted);
  transition: all var(--transition);
  user-select: none;
  background: var(--bg2);
}
.radio-btn:hover { border-color: var(--accent); color: var(--text); }
.radio-btn input[type="radio"] { display: none; }
.radio-btn.selected {
  border-color: var(--accent);
  background: rgba(88,166,255,.1);
  color: var(--accent);
  font-weight: 600;
}

/* ── Symptom Checkboxes ── */
.symptom-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: .75rem;
}
.checkbox-card {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  border: 1.5px solid var(--border);
  border-radius: 11px;
  padding: .9rem 1rem;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition), box-shadow var(--transition);
  background: var(--bg2);
  position: relative;
  overflow: hidden;
}
.checkbox-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(88,166,255,.07) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
}
.checkbox-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 18px rgba(88,166,255,.15);
}
.checkbox-card:hover::before { opacity: 1; }
.checkbox-card.checked {
  border-color: var(--accent);
  background: rgba(88,166,255,.08);
  box-shadow: 0 0 0 3px rgba(88,166,255,.12);
}
.checkbox-card.checked::before { opacity: 1; }

.custom-checkbox {
  width: 20px; height: 20px;
  border: 2px solid var(--border2);
  border-radius: 5px;
  background: var(--bg3);
  flex-shrink: 0;
  margin-top: .1rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.checkbox-card.checked .custom-checkbox {
  background: var(--accent);
  border-color: var(--accent);
}
.custom-checkbox svg { opacity: 0; transition: opacity var(--transition); }
.checkbox-card.checked .custom-checkbox svg { opacity: 1; }

.checkbox-card input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; }
.cb-content { flex: 1; }
.cb-title { font-size: .875rem; font-weight: 600; color: var(--text2); line-height: 1.3; }
.cb-sub { font-size: .75rem; color: var(--muted); margin-top: .2rem; }
.checkbox-card.checked .cb-title { color: var(--accent); }

/* ── Symptom severity icon ── */
.cb-icon { font-size: 1.2rem; flex-shrink: 0; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  border: none;
  border-radius: 9px;
  padding: .7rem 1.5rem;
  font-size: .9rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background .12s;
}
.btn:hover::after { background: rgba(255,255,255,.06); }
.btn:active { transform: scale(.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent2) 0%, var(--accent) 100%);
  color: #fff;
  box-shadow: 0 2px 14px rgba(88,166,255,.3);
}
.btn-primary:hover {
  box-shadow: 0 4px 22px rgba(88,166,255,.45);
  transform: translateY(-1px);
  color: #fff;
}
.btn-secondary {
  background: var(--surface2);
  color: var(--text2);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg3); border-color: var(--border2); color: var(--text); }
.btn-danger {
  background: rgba(248,81,73,.15);
  color: var(--high);
  border: 1px solid rgba(248,81,73,.3);
}
.btn-lg { padding: .9rem 2.2rem; font-size: 1rem; border-radius: 11px; }
.btn-full { width: 100%; justify-content: center; }

/* ── Analyze button pulse ── */
.btn-analyze {
  background: linear-gradient(135deg, var(--accent2) 0%, var(--accent) 100%);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 1rem 2.8rem;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(88,166,255,.35);
  letter-spacing: -.01em;
}
.btn-analyze:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(88,166,255,.5);
  color: #fff;
}
.btn-analyze:active { transform: scale(.98); }

/* ============================================================
   RISK BADGES
   ============================================================ */
.risk-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border-radius: 20px;
  padding: .3rem 1rem;
  font-weight: 700;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  border: 1px solid;
}
.risk-Low    { background: var(--low-bg);  color: var(--low);  border-color: var(--low-border); }
.risk-Medium { background: var(--med-bg);  color: var(--med);  border-color: var(--med-border); }
.risk-High   { background: var(--high-bg); color: var(--high); border-color: var(--high-border); }

/* ── Dot indicator ── */
.risk-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
  animation: pulse-dot 2s infinite;
}
.risk-Low .risk-dot { background: var(--low); }
.risk-Medium .risk-dot { background: var(--med); animation-delay: .3s; }
.risk-High .risk-dot { background: var(--high); animation-delay: .6s; }

@keyframes pulse-dot {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(.75); }
}

/* ============================================================
   RESULT HERO  (SVG arc gauge + big level text)
   ============================================================ */
.result-hero {
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  text-align: center;
  margin-bottom: 1.25rem;
  border: 1px solid;
  position: relative;
  overflow: hidden;
}
.result-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% -20%, rgba(255,255,255,.04) 0%, transparent 65%);
  pointer-events: none;
}
.result-hero.Low    { background: linear-gradient(135deg, var(--low-bg) 0%, rgba(63,185,80,.04) 100%);  border-color: var(--low-border); }
.result-hero.Medium { background: linear-gradient(135deg, var(--med-bg) 0%, rgba(227,179,65,.04) 100%); border-color: var(--med-border); }
.result-hero.High   { background: linear-gradient(135deg, var(--high-bg) 0%, rgba(248,81,73,.04) 100%); border-color: var(--high-border); }

.hero-patient-name {
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: .5rem;
}
.result-level {
  font-size: 3.2rem;
  font-weight: 900;
  letter-spacing: -.04em;
  line-height: 1.1;
  margin: .4rem 0;
}
.result-level.Low    { color: var(--low); }
.result-level.Medium { color: var(--med); }
.result-level.High   { color: var(--high); }

/* SVG Arc Gauge */
.arc-gauge { margin: 1rem auto; display: block; }
.arc-bg { fill: none; stroke: var(--surface2); stroke-width: 10; }
.arc-fill {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 220;
  stroke-dashoffset: 220;
  transition: stroke-dashoffset 1.2s cubic-bezier(.4,0,.2,1) .3s;
}
.arc-fill.Low    { stroke: var(--low); }
.arc-fill.Medium { stroke: var(--med); }
.arc-fill.High   { stroke: var(--high); }
.arc-text-score { font-size: 1.6rem; font-weight: 900; fill: var(--text); font-family: 'Inter', sans-serif; }
.arc-text-max   { font-size: .7rem;  font-weight: 500; fill: var(--muted); font-family: 'Inter', sans-serif; }

.result-score-note {
  font-size: .8rem;
  color: var(--muted);
  margin-top: .3rem;
}

/* Risk range legend */
.risk-legend {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

/* ── Score bar (fallback / history) ── */
.score-meter {
  background: var(--surface2);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
  margin: .75rem 0 .3rem;
}
.score-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 1s cubic-bezier(.4,0,.2,1) .2s;
}
.fill-Low    { background: var(--low); }
.fill-Medium { background: var(--med); }
.fill-High   { background: var(--high); }

/* ============================================================
   SECTION TITLES
   ============================================================ */
.section-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .55rem;
  margin-bottom: 1rem;
  letter-spacing: -.01em;
}
.section-title::before {
  content: '';
  width: 3px;
  height: 1.1em;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent2) 100%);
  border-radius: 2px;
  flex-shrink: 0;
}

/* ============================================================
   LLM TAG
   ============================================================ */
.llm-tag {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: rgba(88,166,255,.1);
  color: var(--accent);
  border: 1px solid rgba(88,166,255,.2);
  border-radius: 20px;
  padding: .22rem .75rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.llm-tag.rule-engine {
  background: rgba(63,185,80,.1);
  color: var(--low);
  border-color: rgba(63,185,80,.2);
}
.llm-dot {
  width: 6px; height: 6px;
  background: currentColor;
  border-radius: 50%;
  animation: pulse-dot 1.5s infinite;
}

/* ============================================================
   ADVICE LIST
   ============================================================ */
.advice-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.advice-list li {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .85rem 1rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: .875rem;
  line-height: 1.6;
  transition: border-color var(--transition), transform var(--transition);
  animation: fadeInUp .4s ease both;
}
.advice-list li:nth-child(1){ animation-delay: .05s }
.advice-list li:nth-child(2){ animation-delay: .1s }
.advice-list li:nth-child(3){ animation-delay: .15s }
.advice-list li:nth-child(4){ animation-delay: .2s }
.advice-list li:nth-child(5){ animation-delay: .25s }
.advice-list li:hover { border-color: var(--accent); transform: translateX(3px); }

.advice-num {
  min-width: 26px; height: 26px;
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  color: #fff;
  border-radius: 7px;
  font-size: .72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(88,166,255,.3);
}

/* ============================================================
   PROFILE GRID
   ============================================================ */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .65rem;
}
.profile-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .75rem 1rem;
  transition: border-color var(--transition);
}
.profile-item:hover { border-color: var(--border2); }
.pi-label {
  font-size: .68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .25rem;
}
.pi-value {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.pi-value.positive { color: var(--high); }
.pi-value.negative { color: var(--muted); }

/* ============================================================
   HISTORY TABLE
   ============================================================ */
.history-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.history-table th {
  background: var(--bg2);
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: .75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.history-table td {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text2);
}
.history-table tbody tr {
  transition: background var(--transition);
  animation: fadeInUp .35s ease both;
}
.history-table tbody tr:hover td { background: var(--bg3); }
.history-table tbody tr:last-child td { border-bottom: none; }
.history-table .name-cell { font-weight: 600; color: var(--text); }
.history-table .id-cell { color: var(--muted); font-size: .78rem; font-family: monospace; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 3.5rem 2rem;
}
.empty-state .empty-icon {
  width: 64px; height: 64px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  margin: 0 auto 1.25rem;
}
.empty-state h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: .4rem; }
.empty-state p { color: var(--muted); font-size: .875rem; margin-bottom: 1.5rem; }

/* ============================================================
   MEMORY / AUTO-SAVE CARD
   ============================================================ */
.memory-card {
  background: linear-gradient(135deg, rgba(88,166,255,.06) 0%, var(--surface) 100%);
  border: 1px solid rgba(88,166,255,.2);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}
.memory-icon {
  width: 40px; height: 40px;
  background: rgba(88,166,255,.12);
  border: 1px solid rgba(88,166,255,.2);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.memory-body strong { font-size: .9rem; color: var(--text); display: block; margin-bottom: .2rem; }
.memory-body p { font-size: .82rem; color: var(--muted); line-height: 1.6; }

/* ============================================================
   DISCLAIMER
   ============================================================ */
.disclaimer {
  background: rgba(227,179,65,.07);
  border: 1px solid rgba(227,179,65,.2);
  border-radius: 10px;
  padding: .95rem 1.2rem;
  font-size: .82rem;
  color: #c9a227;
  display: flex;
  gap: .65rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  line-height: 1.6;
}
.disclaimer-icon { font-size: 1rem; flex-shrink: 0; margin-top: .1rem; }

/* ── Alert error ── */
.alert-error {
  background: var(--high-bg);
  border: 1px solid var(--high-border);
  border-radius: 10px;
  padding: .9rem 1.1rem;
  color: #fca5a5;
  font-size: .875rem;
  margin-bottom: 1.25rem;
  display: flex;
  gap: .5rem;
  align-items: center;
}

/* ============================================================
   STEP PROGRESS BAR (top of form)
   ============================================================ */
.step-progress {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 2rem;
}
.step-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex: 1;
}
.step-circle {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--bg2);
  flex-shrink: 0;
  transition: all var(--transition);
}
.step-circle.active {
  border-color: var(--accent);
  background: rgba(88,166,255,.15);
  color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88,166,255,.12);
}
.step-circle.done {
  border-color: var(--low);
  background: rgba(63,185,80,.15);
  color: var(--low);
}
.step-name {
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
}
.step-name.active { color: var(--accent); }
.step-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 .5rem;
  border-radius: 1px;
}
.step-connector.done { background: linear-gradient(90deg, var(--low), var(--accent)); }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  text-align: center;
  padding: 1.75rem 1rem;
  border-top: 1px solid var(--border);
  font-size: .78rem;
  color: var(--muted);
  line-height: 2;
  background: var(--bg2);
}
.footer-links { display: flex; justify-content: center; gap: 1.25rem; margin-bottom: .4rem; flex-wrap: wrap; }
.footer-disclaimer { color: #8b6914; font-size: .73rem; }

/* ============================================================
   LOADING OVERLAY
   ============================================================ */
#loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13,17,23,.92);
  backdrop-filter: blur(8px);
  z-index: 999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
}
#loading-overlay.active { display: flex; }

.loader-ring {
  width: 64px; height: 64px;
  position: relative;
}
.loader-ring::before,
.loader-ring::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
}
.loader-ring::before {
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
.loader-ring::after {
  border-bottom-color: var(--accent2);
  animation: spin 1.2s linear infinite reverse;
  inset: 8px;
}

.loader-steps {
  display: flex;
  gap: 1.5rem;
}
.loader-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  opacity: .3;
  transition: opacity .5s;
}
.loader-step.active { opacity: 1; }
.loader-step-icon {
  width: 32px; height: 32px;
  background: var(--surface2);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
  border: 1px solid var(--border);
}
.loader-step.active .loader-step-icon {
  border-color: var(--accent);
  background: rgba(88,166,255,.1);
  box-shadow: 0 0 12px var(--accent-glow);
}
.loader-step-label { font-size: .65rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.loading-title { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.loading-sub { font-size: .8rem; color: var(--muted); }

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

/* ============================================================
   ENTRANCE ANIMATIONS
   ============================================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.94); }
  to   { opacity: 1; transform: scale(1); }
}

.animate-fade-up  { animation: fadeInUp .5s ease both; }
.animate-fade     { animation: fadeIn .5s ease both; }
.animate-scale    { animation: scaleIn .45s cubic-bezier(.34,1.56,.64,1) both; }
.delay-1 { animation-delay: .08s }
.delay-2 { animation-delay: .16s }
.delay-3 { animation-delay: .24s }
.delay-4 { animation-delay: .32s }
.delay-5 { animation-delay: .40s }
.delay-6 { animation-delay: .48s }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .nav-links { gap: .15rem; }
  .nav-link { padding: .4rem .6rem; font-size: .8rem; }
  .page-hero h1 { font-size: 1.7rem; }
  .result-level { font-size: 2.4rem; }
  .pipeline { gap: 0; }
  .pipeline-step { padding: .4rem .75rem; }
  .profile-grid { grid-template-columns: repeat(2, 1fr); }
  .history-table { font-size: .8rem; }
  .history-table th, .history-table td { padding: .6rem .65rem; }
  .loader-steps { gap: .85rem; }
}
@media (max-width: 440px) {
  .symptom-grid { grid-template-columns: 1fr; }
  .radio-group { flex-direction: column; }
}
