/* ═══ Focal Medical Imaging — light theme brand system ═══ */

:root {
  --focal-deep: #0B2545;
  --focal-deep-2: #13405A;
  --focal-teal: #13778A;
  --focal-sky: #45B7D1;
  --focal-warm: #F0A868;
  --focal-coral: #E8735A;
  --focal-slate: #5A6B7F;
  --focal-cloud: #F4F7FA;
  --focal-white: #FFFFFF;
  --focal-success: #2D9F6F;
  --focal-muted: #B0BAC5;

  /* Text variants of the semantic colours, darkened to >=4.5:1 on white */
  --focal-success-text: #1E7A52;
  --focal-amber-text: #8F5A20;
  --focal-coral-text: #B33F27;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', Helvetica, Arial, sans-serif;

  --radius-card: 14px;
  --radius-button: 8px;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.03);

  --gradient-brand: linear-gradient(135deg, var(--focal-teal), var(--focal-sky));
  --gradient-hero: linear-gradient(135deg, var(--focal-deep), var(--focal-deep-2));
  --gradient-warm: linear-gradient(135deg, var(--focal-warm), var(--focal-coral));
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--focal-cloud);
  color: var(--focal-deep);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ── Header (light, matching the app body) ── */
.app-header {
  background: var(--focal-white);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  padding-top: env(safe-area-inset-top);
}
.app-header-inner {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
}
.logo { flex-shrink: 0; display: block; }
.wordmark-name {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  color: var(--focal-deep);
  letter-spacing: 0.02em;
  line-height: 1.1;
}
.wordmark-descriptor {
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--focal-slate);
  margin-top: 2px;
}
.app-chip {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--focal-amber-text);
}

/* ── Layout ── */
.app-main {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 20px 40px;
}
.app-footer {
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 20px calc(20px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--focal-slate);
}
.footer-tagline { font-family: var(--font-display); font-style: italic; }

/* ── Cards & typography ── */
.card {
  background: var(--focal-white);
  border-radius: var(--radius-card);
  padding: 24px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
}
h1, .h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  color: var(--focal-deep);
  margin: 0 0 8px;
  line-height: 1.25;
}
h2, .h2 {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 600;
  color: var(--focal-deep);
  margin: 0 0 8px;
}
p, .body-text {
  font-size: 15px;
  line-height: 1.7;
  color: var(--focal-slate);
  margin: 6px 0 0;
}
.small-text { font-size: 13px; color: var(--focal-slate); line-height: 1.6; }
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--focal-teal);
  margin-bottom: 6px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  border-radius: var(--radius-button);
  cursor: pointer;
  transition: filter 0.15s, opacity 0.15s, box-shadow 0.15s;
  text-decoration: none;
  min-height: 48px;
  padding: 12px 24px;
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(19, 119, 138, 0.35);
}
.btn-primary {
  background: var(--gradient-warm);
  color: var(--focal-deep);
  border: none;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.05); }
.btn-primary:disabled {
  background: var(--focal-muted);
  color: var(--focal-deep);
  cursor: not-allowed;
}
.btn-secondary {
  background: transparent;
  color: var(--focal-teal);
  border: 2px solid var(--focal-teal);
}
.btn-secondary:hover { background: rgba(19, 119, 138, 0.06); }
.btn-ghost {
  background: transparent;
  color: var(--focal-teal);
  border: none;
  text-decoration: underline;
  font-weight: 500;
  font-size: 14px;
  min-height: 44px;
}
.btn-block { display: flex; width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.btn-row .btn { flex: 1; }

/* ── Badges ── */
.badge {
  display: inline-block;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-teal { background: rgba(19, 119, 138, 0.09); color: var(--focal-teal); }
.badge-warm { background: rgba(240, 168, 104, 0.13); color: var(--focal-amber-text); }
.badge-success { background: rgba(45, 159, 111, 0.09); color: var(--focal-success-text); }
.badge-muted { background: rgba(176, 186, 197, 0.18); color: var(--focal-slate); }
.badge-coral { background: rgba(232, 115, 90, 0.10); color: var(--focal-coral-text); }

/* ── Callout ── */
.callout {
  background: rgba(240, 168, 104, 0.08);
  border-left: 4px solid var(--focal-warm);
  border-radius: 0 12px 12px 0;
  padding: 14px 18px;
  margin-top: 14px;
}
.callout-title { font-size: 13px; color: var(--focal-deep); font-weight: 600; }
.callout-body { font-size: 12px; color: var(--focal-slate); margin-top: 4px; line-height: 1.6; }

.callout-teal {
  background: rgba(19, 119, 138, 0.06);
  border-left-color: var(--focal-teal);
}

.callout-coral {
  background: rgba(232, 115, 90, 0.08);
  border-left-color: var(--focal-coral);
}

/* ── Inputs ── */
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--focal-deep);
  margin: 14px 0 6px;
}
.text-input {
  background: var(--focal-white);
  border: 1.5px solid var(--focal-muted);
  border-radius: var(--radius-button);
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--focal-deep);
  width: 100%;
}
.text-input:focus {
  outline: none;
  border-color: var(--focal-teal);
  box-shadow: 0 0 0 3px rgba(19, 119, 138, 0.12);
}
.text-input::placeholder { color: var(--focal-slate); }

/* ── Visual analog scale ── */
.vas-readout {
  text-align: center;
  margin: 6px 0 2px;
}
.vas-value {
  font-family: var(--font-display);
  font-size: 64px;
  font-weight: 700;
  color: var(--focal-deep);
  line-height: 1;
}
.vas-value .vas-denominator {
  font-size: 22px;
  font-weight: 400;
  color: var(--focal-slate);
}
.vas-category {
  font-size: 13px;
  font-weight: 600;
  margin-top: 8px;
  min-height: 20px;
}
.vas-track-wrap { padding: 18px 4px 4px; }
.vas-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--focal-success), var(--focal-warm) 55%, var(--focal-coral));
  outline: none;
  cursor: pointer;
  margin: 0;
}
.vas-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--focal-white);
  border: 3px solid var(--focal-teal);
  box-shadow: 0 2px 6px rgba(11, 37, 69, 0.25);
  cursor: grab;
}
.vas-slider::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--focal-white);
  border: 3px solid var(--focal-teal);
  box-shadow: 0 2px 6px rgba(11, 37, 69, 0.25);
  cursor: grab;
}
.vas-slider:focus-visible {
  box-shadow: 0 0 0 3px rgba(19, 119, 138, 0.3);
}
.vas-anchors {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--focal-slate);
}
.vas-anchors span:last-child { text-align: right; }

/* ── Mode picker ── */
.mode-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--focal-white);
  border: 2px solid var(--focal-muted);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: border-color 0.15s, background 0.15s;
}
.mode-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(19, 119, 138, 0.3);
}
.mode-card.selected {
  border-color: var(--focal-teal);
  background: rgba(19, 119, 138, 0.05);
}
.mode-card-title {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--focal-deep);
}
.mode-card.selected .mode-card-title { color: var(--focal-teal); }
.mode-card-desc {
  display: block;
  font-size: 12.5px;
  color: var(--focal-slate);
  line-height: 1.55;
  margin-top: 3px;
}

/* ── Timeline section headers ── */
.timeline-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--focal-teal);
  padding: 14px 0 4px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

/* ── Step indicator ── */
.step-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.step-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  background: rgba(19, 119, 138, 0.09);
  color: var(--focal-teal);
}
.step-dot.active { background: var(--focal-teal); color: var(--focal-white); }
.step-line { flex: 1; height: 2px; background: rgba(19, 119, 138, 0.15); border-radius: 2px; }
.step-label { font-size: 12px; font-weight: 600; color: var(--focal-slate); margin-left: 4px; }

/* ── Stats row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.stat-box {
  background: var(--focal-white);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 10px;
  padding: 12px 8px;
  text-align: center;
  box-shadow: var(--shadow-card);
}
.stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--focal-teal);
}
.stat-value {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--focal-deep);
  margin-top: 4px;
  line-height: 1.1;
}
.stat-value.positive { color: var(--focal-success); }
.stat-value.negative { color: #C24A31; }
.stat-sub { font-size: 11px; color: var(--focal-slate); margin-top: 2px; }

/* ── Chart ── */
.chart-svg { width: 100%; height: auto; display: block; }

/* ── Timeline ── */
.timeline-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-marker {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-body);
}
.timeline-marker.done { background: var(--focal-teal); color: var(--focal-white); }
.timeline-marker.due { background: var(--gradient-warm); color: var(--focal-deep); }
.timeline-marker.upcoming { background: rgba(19, 119, 138, 0.08); color: var(--focal-teal); }
.timeline-marker.missed { background: rgba(176, 186, 197, 0.2); color: var(--focal-slate); }
.timeline-body { flex: 1; min-width: 0; }
.timeline-title { font-size: 14px; font-weight: 600; color: var(--focal-deep); }
.timeline-sub { font-size: 12px; color: var(--focal-slate); margin-top: 1px; }
.timeline-score {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--focal-deep);
}

/* ── Due banner ── */
.due-banner {
  background: var(--gradient-warm);
  border-radius: var(--radius-card);
  padding: 16px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  border: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-body);
}
.due-banner-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(11, 37, 69, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.due-banner-title { font-size: 15px; font-weight: 700; color: var(--focal-deep); }
.due-banner-sub { font-size: 12.5px; color: rgba(11, 37, 69, 0.75); margin-top: 2px; }

/* ── Welcome hero ── */
.welcome-hero { text-align: center; padding: 28px 24px; }
.welcome-hero .logo-large { margin: 0 auto 14px; display: block; }
.welcome-tagline {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 15px;
  color: var(--focal-slate);
  margin-top: 4px;
}

[tabindex="-1"]:focus { outline: none; }

.hidden { display: none !important; }
.mt-16 { margin-top: 16px; }
.center { text-align: center; }

@media (max-width: 380px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .vas-value { font-size: 52px; }
}
