:root {
  color-scheme: light;
  --bg: oklch(97.4% 0.012 184);
  --surface: oklch(100% 0 0);
  --surface-soft: oklch(98.4% 0.008 184);
  --surface-2: oklch(94.6% 0.025 178);
  --ink: oklch(22% 0.034 178);
  --muted: oklch(47% 0.034 178);
  --line: oklch(88.7% 0.026 180);
  --primary: oklch(49% 0.105 180);
  --primary-hover: oklch(43% 0.11 180);
  --primary-ink: oklch(31% 0.073 180);
  --on-primary: oklch(100% 0 0);
  --hero-bg: oklch(27% 0.065 178);
  --hero-ink: oklch(97.2% 0.018 176);
  --hero-muted: oklch(82% 0.04 176);
  --hero-line: oklch(96% 0.02 176 / .18);
  --hero-wash: oklch(96% 0.02 176 / .08);
  --accent: oklch(45% 0.082 226);
  --low: oklch(48% 0.14 148);
  --low-soft: oklch(97% 0.035 148);
  --low-line: oklch(84% 0.075 148);
  --medium: oklch(55% 0.14 68);
  --medium-soft: oklch(97.5% 0.045 80);
  --medium-line: oklch(84% 0.105 74);
  --high: oklch(48% 0.18 28);
  --high-soft: oklch(97% 0.035 24);
  --high-line: oklch(84% 0.08 24);
  --info: oklch(52% 0.16 255);
  --info-soft: oklch(97% 0.025 255);
  --info-line: oklch(84% 0.065 255);
  --track: oklch(91.8% 0.018 184);
  --shadow: 0 18px 48px oklch(24% 0.035 178 / .12);
  --panel-shadow: 0 12px 34px oklch(24% 0.035 178 / .08);
  --primary-shadow: 0 12px 24px oklch(49% 0.105 180 / .24);
  --focus-ring: 0 0 0 3px oklch(72% 0.1 180 / .28);
  --radius: 8px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: oklch(15% 0.025 180);
  --surface: oklch(19% 0.028 180);
  --surface-soft: oklch(16.8% 0.025 180);
  --surface-2: oklch(24% 0.042 178);
  --ink: oklch(94.5% 0.018 176);
  --muted: oklch(75% 0.036 176);
  --line: oklch(32% 0.04 178);
  --primary: oklch(73% 0.105 180);
  --primary-hover: oklch(79% 0.105 180);
  --primary-ink: oklch(91% 0.045 178);
  --on-primary: oklch(15% 0.025 180);
  --hero-bg: oklch(22% 0.07 178);
  --hero-ink: oklch(96.5% 0.018 176);
  --hero-muted: oklch(78% 0.04 176);
  --hero-line: oklch(92% 0.02 176 / .16);
  --hero-wash: oklch(92% 0.02 176 / .07);
  --accent: oklch(75% 0.075 226);
  --low: oklch(74% 0.13 148);
  --low-soft: oklch(24% 0.04 148);
  --low-line: oklch(45% 0.075 148);
  --medium: oklch(78% 0.13 74);
  --medium-soft: oklch(25% 0.045 74);
  --medium-line: oklch(48% 0.09 74);
  --high: oklch(72% 0.145 25);
  --high-soft: oklch(24% 0.045 25);
  --high-line: oklch(46% 0.09 25);
  --info: oklch(76% 0.105 255);
  --info-soft: oklch(24% 0.04 255);
  --info-line: oklch(46% 0.075 255);
  --track: oklch(28% 0.035 180);
  --shadow: 0 18px 48px oklch(5% 0.02 180 / .42);
  --panel-shadow: 0 0 0 1px oklch(32% 0.04 178 / .55);
  --primary-shadow: 0 12px 24px oklch(12% 0.04 180 / .34);
  --focus-ring: 0 0 0 3px oklch(73% 0.105 180 / .28);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body,
.gradio-container {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.gradio-container {
  max-width: 1320px;
  min-width: 0;
  width: 100%;
  margin: auto;
  padding: 20px 18px 36px;
}

.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 2px 20px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--on-primary);
  background: var(--primary);
  font-weight: 800;
  box-shadow: var(--primary-shadow);
}

.brand-lockup strong {
  display: block;
  font-size: 1rem;
  color: var(--ink);
}

.brand-lockup span,
.nav-meta {
  color: var(--muted);
  font-size: .9rem;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.theme-toggle {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--primary-ink);
  padding: 7px 11px;
  font-size: .86rem;
  font-weight: 760;
  box-shadow: var(--panel-shadow);
  transition: background-color .18s ease-out, border-color .18s ease-out, color .18s ease-out, transform .18s ease-out;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
  background: var(--surface-2);
}

.theme-toggle-icon {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 35%, var(--surface) 0 28%, var(--primary) 30% 100%);
  box-shadow: inset 0 0 0 1px var(--line);
}

:root[data-theme="dark"] .theme-toggle-icon {
  background: radial-gradient(circle at 68% 34%, var(--surface) 0 28%, var(--primary) 30% 100%);
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr);
  gap: 22px;
  align-items: stretch;
  margin-bottom: 18px;
}

.hero-copy {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
  animation: panelIn .32s ease-out both;
}

.hero-copy h1 {
  margin: 0;
  color: var(--ink);
  font-size: 2.25rem;
  line-height: 1.12;
  letter-spacing: 0;
  text-wrap: balance;
}

.hero-copy p {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.75;
  max-width: 66ch;
  margin: 14px 0 0;
  text-wrap: pretty;
}

.hero-status {
  display: grid;
  gap: 10px;
  align-content: center;
  background: var(--hero-bg);
  color: var(--hero-ink);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  animation: panelIn .36s ease-out both;
}

.hero-status,
.hero-status * {
  color: var(--hero-ink);
}

.hero-status h2 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--hero-ink);
}

.hero-status p {
  color: var(--hero-muted);
  margin: 6px 0 0;
  line-height: 1.55;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 6px;
}

.status-grid div {
  border: 1px solid var(--hero-line);
  border-radius: 8px;
  padding: 12px;
  background: var(--hero-wash);
}

.status-grid strong {
  display: block;
  font-size: 1.25rem;
  color: var(--hero-ink);
}

.status-grid span {
  font-size: .8rem;
  color: var(--hero-muted);
}

.assessment-grid {
  display: grid;
  grid-template-columns: minmax(340px, 1fr) minmax(0, 2fr);
  gap: 18px;
  align-items: start;
}

.intake-panel,
.output-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--panel-shadow);
  overflow: visible;
}

.section-title {
  margin: 4px 0 12px;
}

.section-title span {
  display: block;
  color: var(--primary);
  font-weight: 700;
  font-size: .78rem;
}

.section-title h2 {
  margin: 3px 0 0;
  color: var(--ink);
  font-size: 1.1rem;
}

.section-title p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.55;
}

.section-gap {
  margin-top: 18px;
}

.helper-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0 16px;
}

.helper-strip span {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--primary-ink);
  font-size: .82rem;
  font-weight: 650;
}

.image-input-box {
  position: relative;
  display: grid;
  min-height: 280px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  cursor: pointer;
}

.image-input-box input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.image-input-box img {
  width: 100%;
  height: 280px;
  object-fit: contain;
}

.image-placeholder {
  display: grid;
  justify-items: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.image-placeholder b {
  color: var(--ink);
  font-size: .95rem;
}

.image-placeholder small {
  color: var(--muted);
}

.image-input-box.is-dragging,
.image-input-box:hover {
  border-color: var(--primary);
  background: var(--surface-2);
}

.accordion {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  overflow: hidden;
}

.accordion summary {
  padding: 13px 14px;
  color: var(--ink);
  font-weight: 720;
  cursor: pointer;
}

.accordion-body {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 14px;
}

.field,
.multi-field {
  display: grid;
  gap: 6px;
}

.field span,
.multi-field > span {
  color: var(--ink);
  font-size: .9rem;
  font-weight: 700;
}

.field small,
.multi-field small {
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.45;
}

.field input,
.field select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 8px 10px;
}

.field input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-grid label {
  display: inline-flex;
}

.choice-grid input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.choice-grid span {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  padding: 5px 10px;
  font-size: .82rem;
  font-weight: 650;
}

.choice-grid input:checked + span {
  border-color: var(--primary);
  background: var(--surface-2);
  color: var(--primary-ink);
}

.analyze-btn,
.download-button {
  width: 100%;
  min-height: 48px;
  border-radius: 8px;
  background: var(--primary);
  border: 1px solid var(--primary);
  color: var(--on-primary);
  font-weight: 760;
  box-shadow: var(--primary-shadow);
  transition: transform .18s ease-out, box-shadow .18s ease-out, background-color .18s ease-out;
}

.analyze-btn {
  margin-top: 16px;
}

.analyze-btn:hover,
.download-button:hover {
  transform: translateY(-1px);
  background: var(--primary-hover);
  box-shadow: var(--primary-shadow);
}

.analyze-btn:disabled {
  cursor: not-allowed;
  opacity: .7;
}

.download-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  box-shadow: none;
  text-decoration: none;
}

.annotated-box {
  display: grid;
  min-height: 380px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  overflow: hidden;
}

.annotated-box img {
  width: 100%;
  height: 380px;
  object-fit: contain;
  background: var(--surface-soft);
}

.tabs {
  display: grid;
  gap: 14px;
}

.tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.tab-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 8px 12px;
  font-weight: 720;
}

.tab-button.is-active {
  border-color: var(--primary);
  background: var(--surface);
  color: var(--primary-ink);
}

.tab-panel {
  min-width: 0;
}

.reveal-panel {
  animation: panelIn .28s ease-out both;
}

.panel-kicker {
  color: var(--primary);
  font-size: .78rem;
  font-weight: 760;
  margin-bottom: 6px;
}

.result-panel h2,
.risk-panel h2,
.dimension-panel h2 {
  color: var(--ink);
  margin: 0 0 8px;
  font-size: 1.35rem;
  line-height: 1.25;
}

.result-summary {
  color: var(--muted);
  line-height: 1.72;
  margin: 0 0 16px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.metric-card,
.soft-card,
.visual-card,
.dimension-card,
.empty-panel {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
}

.metric-card {
  padding: 14px;
}

.metric-card span {
  color: var(--muted);
  font-size: .82rem;
}

.metric-card strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 1.35rem;
}

.metric-card p {
  color: var(--muted);
  margin: 4px 0 0;
  font-size: .86rem;
}

.metric-low { border-color: var(--low-line); background: var(--low-soft); }
.metric-medium { border-color: var(--medium-line); background: var(--medium-soft); }
.metric-high { border-color: var(--high-line); background: var(--high-soft); }

.quick-verdict {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 14px;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.risk-columns,
.dimension-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.soft-card,
.visual-card {
  padding: 16px;
}

.soft-card h3,
.visual-card h3 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 1rem;
}

.visual-card {
  background: linear-gradient(180deg, var(--surface), var(--surface-soft));
}

.chart-bar {
  margin: 10px 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  transition: transform .18s ease-out, border-color .18s ease-out, box-shadow .18s ease-out;
}

.chart-bar:hover {
  transform: translateY(-1px);
  box-shadow: var(--panel-shadow);
}

.chart-bar-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--ink);
  font-size: .9rem;
  font-weight: 760;
}

.chart-bar-label strong {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.chart-bar-label b {
  color: var(--ink);
}

.chart-bar-label em {
  font-style: normal;
  font-size: .74rem;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid currentColor;
}

.chart-bar small {
  color: var(--muted);
  display: block;
  margin-top: 5px;
  font-size: .78rem;
}

.chart-track {
  height: 12px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
  margin-top: 8px;
  box-shadow: inset 0 1px 2px oklch(10% 0.02 180 / .12);
}

.chart-fill {
  width: var(--bar);
  min-width: 5px;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  animation: barGrow .55s cubic-bezier(.22, 1, .36, 1) both;
}

.chart-low .chart-fill { background: linear-gradient(90deg, oklch(72% 0.14 148), var(--low)); }
.chart-medium .chart-fill { background: linear-gradient(90deg, oklch(79% 0.14 82), var(--medium)); }
.chart-high .chart-fill { background: linear-gradient(90deg, oklch(72% 0.16 20), var(--high)); }
.chart-info .chart-fill { background: linear-gradient(90deg, oklch(76% 0.11 255), var(--info)); }
.chart-low { border-color: var(--low-line); background: var(--low-soft); }
.chart-medium { border-color: var(--medium-line); background: var(--medium-soft); }
.chart-high { border-color: var(--high-line); background: var(--high-soft); }
.chart-info { border-color: var(--info-line); background: var(--info-soft); }
.chart-low em { color: var(--low); background: var(--low-soft); }
.chart-medium em { color: var(--medium); background: var(--medium-soft); }
.chart-high em { color: var(--high); background: var(--high-soft); }
.chart-info em { color: var(--info); background: var(--info-soft); }

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin: -2px 0 10px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chart-legend i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}

.dot-low { background: var(--low); }
.dot-medium { background: var(--medium); }
.dot-high { background: var(--high); }

.patient-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.patient-strip div {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.patient-strip span {
  display: block;
  color: var(--muted);
  font-size: .78rem;
}

.patient-strip strong {
  color: var(--ink);
  font-size: .9rem;
}

.notice-line,
.verdict-strip {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin-top: 14px;
  padding: 14px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.notice-line strong,
.verdict-strip strong { color: var(--primary-ink); }
.notice-line span,
.verdict-strip span { color: var(--muted); line-height: 1.45; }

.risk-hero {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}

.score-ring {
  width: 132px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--primary) var(--score), var(--track) 0);
  position: relative;
}

.score-ring::after {
  content: "";
  position: absolute;
  inset: 12px;
  background: var(--surface);
  border-radius: 50%;
}

.score-ring div {
  position: relative;
  z-index: 1;
  text-align: center;
}

.score-ring strong {
  display: block;
  font-size: 1.8rem;
  color: var(--ink);
}

.score-ring span {
  color: var(--muted);
  font-size: .8rem;
}

.ring-low { background: conic-gradient(var(--low) var(--score), var(--track) 0); }
.ring-medium { background: conic-gradient(var(--medium) var(--score), var(--track) 0); }
.ring-high { background: conic-gradient(var(--high) var(--score), var(--track) 0); }

.risk-tags,
.pill-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tag,
.mini-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
}

.tag-low { color: var(--low); background: var(--low-soft); border-color: var(--low-line); }
.tag-medium { color: var(--medium); background: var(--medium-soft); border-color: var(--medium-line); }
.tag-high { color: var(--high); background: var(--high-soft); border-color: var(--high-line); }
.tag-info { color: var(--info); background: var(--info-soft); border-color: var(--info-line); }

.driver-chart {
  display: grid;
  gap: 4px;
}

.action-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.action-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
  min-height: 124px;
  animation: panelIn .28s ease-out both;
}

.action-card span {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: var(--on-primary);
  font-size: .82rem;
  font-weight: 760;
  margin-bottom: 10px;
}

.action-card h4 {
  margin: 0;
  font-size: .94rem;
  color: var(--ink);
}

.action-card p {
  color: var(--muted);
  margin: 5px 0 0;
  font-size: .84rem;
  line-height: 1.45;
}

.dimension-grid {
  display: grid;
  gap: 10px;
}

.dimension-card {
  padding: 14px;
}

.dimension-top {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.dimension-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: .98rem;
}

.empty-panel {
  text-align: center;
  padding: 32px 20px;
  color: var(--muted);
  background: var(--surface-soft);
}

.empty-panel.compact {
  align-self: stretch;
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 100%;
}

.empty-panel h3 {
  margin: 12px 0 6px;
  color: var(--ink);
}

.empty-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.empty-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  margin: auto;
}

.markdown-panel {
  color: var(--ink);
  line-height: 1.72;
}

.report-dashboard {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.report-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 16px;
}

.report-hero h2 {
  color: var(--ink);
  font-size: 1.32rem;
  line-height: 1.28;
  margin: 0;
}

.report-hero p {
  color: var(--muted);
  margin: 8px 0 0;
  max-width: 72ch;
  line-height: 1.65;
}

.report-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 360px;
}

.report-metric-grid,
.report-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.report-score-card {
  display: grid;
  justify-items: start;
  align-content: start;
  gap: 10px;
}

.report-score-card p {
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}

.report-range-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.report-card-head,
.range-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.report-card-head span,
.range-labels span {
  color: var(--muted);
  font-size: .82rem;
}

.report-card-head strong,
.range-labels strong {
  color: var(--ink);
}

.range-track {
  position: relative;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--low-soft), var(--medium-soft), var(--high-soft));
  border: 1px solid var(--line);
}

.range-band {
  position: absolute;
  inset: 4px 18%;
  border-radius: 999px;
  background: var(--low);
}

.range-track i {
  position: absolute;
  top: 50%;
  left: var(--mark);
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--surface);
  border: 4px solid var(--primary);
  transform: translate(-50%, -50%);
  box-shadow: var(--panel-shadow);
}

.report-markdown {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.markdown-panel h1,
.markdown-panel h2,
.markdown-panel h3 {
  color: var(--ink);
}

.markdown-panel h2 {
  margin: 18px 0 2px;
  font-size: 1.22rem;
}

.markdown-panel h3 {
  margin: 12px 0 0;
  font-size: 1.04rem;
}

.markdown-panel p,
.markdown-panel li {
  color: var(--muted);
}

.markdown-panel p {
  margin: 0;
}

.markdown-panel ul,
.markdown-panel ol {
  margin: 0;
  padding-left: 1.25rem;
}

.markdown-panel strong {
  color: var(--ink);
}

.markdown-panel code {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--primary-ink);
  padding: 1px 5px;
}

.report-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.report-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  min-width: 460px;
}

.report-table-wrap th,
.report-table-wrap td {
  border-bottom: 1px solid var(--line);
  padding: 9px 11px;
  text-align: left;
  vertical-align: top;
}

.report-table-wrap th {
  color: var(--ink);
  background: var(--surface-2);
  font-size: .86rem;
}

.report-table-wrap td {
  color: var(--muted);
  font-size: .88rem;
}

.report-table-wrap tr:last-child td {
  border-bottom: 0;
}

.markdown-panel pre {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
  white-space: pre-wrap;
}

.disclaimer {
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.65;
  text-align: center;
  padding: 20px 12px 0;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  border: 1px solid var(--high-line);
  border-radius: 8px;
  background: var(--high-soft);
  color: var(--high);
  padding: 12px 14px;
  font-weight: 720;
  box-shadow: var(--shadow);
  z-index: 10;
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes barGrow {
  from { width: 0; filter: saturate(.8); }
  to { width: var(--bar); filter: saturate(1); }
}

@media (min-width: 1080px) {
  .metric-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .patient-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .gradio-container {
    padding: 12px;
  }

  .app-nav {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-actions {
    width: 100%;
    justify-content: space-between;
  }

  .hero-copy,
  .hero-status,
  .intake-panel,
  .output-panel {
    padding: 16px;
  }

  .hero-copy h1 {
    font-size: 1.65rem;
  }

  .hero,
  .assessment-grid,
  .risk-hero {
    grid-template-columns: 1fr;
  }

  .status-grid,
  .helper-strip {
    grid-template-columns: 1fr;
  }

  .notice-line,
  .verdict-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .insight-grid,
  .risk-columns,
  .dimension-layout,
  .report-hero,
  .report-metric-grid,
  .report-chart-grid {
    grid-template-columns: 1fr;
  }

  .report-badges {
    justify-content: flex-start;
    max-width: none;
  }
}

@media (max-width: 560px) {
  .metric-grid,
  .action-list,
  .download-row,
  .field-row {
    grid-template-columns: 1fr;
  }

  .patient-strip {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
