:root {
  --bg: #eef4fb;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #475569;
  --line: #dbe3ef;
  --blue: #2563eb;
  --teal: #0d9488;
  --dark: #0f172a;
  --max: 1120px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: min(calc(100% - 40px), var(--max));
  margin: 0 auto;
}

.header {
  background: var(--dark);
  color: #f8fafc;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.nav {
  min-height: 72px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
}

.brand-title {
  color: #2CCEDC;
  font-size: 1.35rem;
  font-weight: 850;
  line-height: 1;
}

.brand-sub {
  color: #8bb5ff;
  font-size: 0.75rem;
  font-weight: 750;
}

.main {
  padding: 48px 0 64px;
}

.stepper-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 24px;
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 800;
}

.step-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(255,255,255,0.65);
}

.step-pill.active {
  color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  border-color: transparent;
}

.step-chevron {
  color: #94a3b8;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px 32px;
  box-shadow: 0 18px 34px rgba(15,23,42,0.08);
}

.panel + .panel {
  margin-top: 24px;
}

.panel-section {
  margin-top: 30px;
}

.about-you-panel .panel-section {
  margin-top: 40px;
}

.spaced-panel-form {
  padding-top: 24px;
}

.eyebrow {
  color: var(--teal);
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.12;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  max-width: 14ch;
}

h2 {
  font-size: clamp(1.55rem, 3vw, 2.2rem);
}

h3 {
  font-size: 1.12rem;
}

.lead {
  margin: 18px 0 0;
  max-width: 680px;
  color: #334155;
  font-size: 1.14rem;
  font-weight: 650;
}

.body-copy {
  margin: 12px 0 0;
  max-width: 720px;
  color: var(--muted);
  font-size: 1rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 850;
}

.btn-primary {
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: #fff;
}

.btn-secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.btn[aria-disabled="true"],
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

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

.option-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #f8fafc;
}

.option-card label {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
}

.option-card input {
  margin-top: 4px;
  width: 18px;
  height: 18px;
}

.option-card p,
.note-list {
  color: var(--muted);
}

.option-card p {
  margin: 8px 0 0 30px;
}

.guidance-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 0 30px;
}

.guidance-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #1d4ed8;
  font-size: 0.9rem;
  font-weight: 800;
}

.note-list {
  margin: 16px 0 0;
  padding-left: 20px;
}

.note-list li + li {
  margin-top: 8px;
}

.acknowledgment {
  margin-top: 22px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.acknowledgment label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.acknowledgment input {
  margin-top: 4px;
  width: 18px;
  height: 18px;
}

.field-group {
  margin-top: 16px;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 850;
}

.field-help {
  color: var(--muted);
  font-size: 0.95rem;
  margin: -2px 0 10px;
}

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

.form-grid > .field-group {
  margin-top: 0;
}

.compact-form-grid {
  margin-top: 0;
}

.select-input,
.text-input,
.file-input,
.text-area {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.select-input,
.text-input {
  min-height: 48px;
  padding: 10px 12px;
}

.file-input {
  padding: 14px;
}

.helper-card {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.helper-card p {
  margin: 8px 0 0;
  color: var(--muted);
}

.file-hints {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--muted);
}

.file-hints li + li {
  margin-top: 6px;
}

.file-search-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.mobile-file-help {
  margin-top: 12px;
}

.selected-files {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  color: var(--muted);
}

.selected-files[hidden] {
  display: none;
}

.selected-files li {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-height: 44px;
  padding: 8px 10px 8px 14px;
}

.selected-files span {
  overflow-wrap: anywhere;
}

.selected-file-remove {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  font: inherit;
  font-weight: 900;
  height: 30px;
  justify-content: center;
  line-height: 1;
  width: 30px;
}

.selected-file-remove:hover,
.selected-file-remove:focus-visible {
  border-color: #94a3b8;
  color: var(--ink);
}

.text-area {
  min-height: 140px;
  padding: 14px;
  resize: vertical;
}

.compact-text-area {
  min-height: 90px;
}

.dose-label {
  margin-top: 14px;
}

.therapy-dosing-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 18px;
}

.therapy-dosing-group[hidden],
.dosing-value-field[hidden],
.other-med-detail-list[hidden] {
  display: none;
}

.dosing-value-field {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 850;
}

.dosing-value-field span {
  display: block;
}

.rapid-insulin-field {
  margin-top: 28px;
}

.checkbox-inline {
  align-items: center;
  color: var(--ink);
  display: flex;
  font-weight: 800;
  gap: 10px;
}

.checkbox-inline input {
  height: 18px;
  width: 18px;
}

.chart-capture-group,
.instruction-capture-group,
.instruction-list {
  display: grid;
  gap: 12px;
}

.chart-capture-group {
  margin: 18px 0 22px;
}

.chart-inputs,
.instruction-inputs {
  display: none;
  gap: 12px;
}

.chart-capture-group:has([data-chart-toggle]:checked) .chart-inputs {
  display: grid;
}

.instruction-capture-group:has([data-instruction-toggle]:checked) .instruction-inputs {
  display: grid;
}

.chart-entry-list {
  display: grid;
  gap: 10px;
}

.chart-row-grid {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(170px, 220px) minmax(170px, 240px) minmax(110px, 130px) auto;
  justify-content: start;
  max-width: 100%;
  width: fit-content;
}

.instruction-row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr) auto;
}

.other-med-detail-list,
.other-med-inline-details {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.other-med-field,
.other-med-entry-list {
  display: grid;
  gap: 12px;
}

.other-med-status-list {
  margin-bottom: 2px;
}

.other-med-detail-list:empty,
.other-med-inline-details:empty {
  display: none;
}

.other-med-choice {
  align-items: start;
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 660px);
  gap: 18px;
}

.other-med-choice > label {
  margin-top: 8px;
}

.other-med-inline-details {
  margin-top: 0;
}

.other-med-detail-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 14px;
}

.other-med-entry {
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(190px, 240px) minmax(0, 1fr) auto;
  padding: 12px;
}

.other-med-entry > .other-med-detail-list {
  margin-top: 0;
}

.other-med-entry .selected-file-remove {
  margin-top: 2px;
}

.other-med-inline-details .other-med-detail-row {
  padding: 0;
  border: 0;
  background: transparent;
}

.other-med-select-grid {
  display: grid;
  grid-template-columns: minmax(190px, 240px) minmax(150px, 190px) minmax(150px, 190px);
  gap: 12px;
  justify-content: start;
  margin-top: 0;
  max-width: 100%;
  width: fit-content;
}

.other-med-select-grid select {
  min-width: 0;
  width: 100%;
}

.pill-select-row {
  grid-template-columns: minmax(190px, 240px) minmax(150px, 190px) minmax(150px, 190px) auto;
}

.change-dosing-values,
.change-details .other-med-detail-list {
  grid-column: 1 / -1;
}

.status-text {
  margin-top: 14px;
  color: #0f766e;
  font-weight: 800;
}

.error-text {
  margin-top: 14px;
  color: #b91c1c;
  font-weight: 800;
}

.checkbox-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

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

.medication-grid label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-weight: 750;
  padding: 10px;
}

.checkbox-list label,
.radio-list label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--muted);
  font-weight: 700;
}

.checkbox-list input,
.medication-grid input,
.radio-list input {
  margin-top: 4px;
  width: 18px;
  height: 18px;
}

.radio-list {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
}

.review-band {
  margin-top: 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.review-band p {
  margin: 8px 0 0;
  color: var(--muted);
}

.data-range-list,
.range-question-list {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.data-range-card {
  display: grid;
  grid-template-columns: minmax(220px, 0.65fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 18px;
}

.data-range-card h3 {
  margin-top: 0;
}

.data-range-card p,
.range-caption {
  color: var(--muted);
  margin: 8px 0 0;
}

.range-question-card {
  background: #ffffff;
}

.file-context h2 {
  max-width: 840px;
}

.question-stack {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.range-change-shell {
  display: grid;
  gap: 16px;
}

.change-question-list {
  display: grid;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.change-question-list[hidden] {
  display: none;
}

.question-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.question-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.question-row > *,
.change-details,
.change-entry,
.other-med-entry,
.other-med-detail-row {
  min-width: 0;
}

.change-details {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.change-details[hidden] {
  display: none;
}

.change-entry-list {
  display: grid;
  gap: 12px;
}

.change-entry {
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(130px, 0.8fr) auto;
  padding: 12px;
}

.change-entry .change-dosing-values,
.change-entry .other-med-detail-list {
  grid-column: 1 / -1;
}

.change-entry .other-med-select-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr) minmax(0, 0.9fr);
  width: 100%;
}

.change-entry .other-med-field {
  grid-column: 1 / -1;
}

.med-select-list {
  display: grid;
  gap: 10px;
}

.med-intake-stack {
  display: grid;
  gap: 22px;
}

.compact-actions {
  margin-top: 12px;
}

.conflict-notice {
  border: 2px solid #f59e0b;
  border-radius: 8px;
  background: #fffbeb;
  color: #78350f;
  margin: 12px 0;
  padding: 14px;
}

.conflict-notice p {
  margin: 6px 0 0;
}

.conflict-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.conflict-notice .btn-secondary {
  border-color: #f59e0b;
}

.attention-pop {
  animation: attention-pop 0.7s ease;
}

@keyframes attention-pop {
  0% { transform: scale(1); }
  35% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.compact-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
}

.compact-list li {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
  color: var(--muted);
  font-weight: 750;
}

.footer {
  padding: 32px 0;
  color: #64748b;
}

@media (max-width: 900px) {
  .change-entry {
    grid-template-columns: 1fr;
  }

  .change-entry .selected-file-remove {
    justify-self: end;
  }
}

@media (max-width: 760px) {
  .nav,
  .grid,
  .form-grid,
  .medication-grid,
  .data-range-card,
  .other-med-choice,
  .other-med-entry,
  .other-med-select-grid,
  .question-row,
  .change-details,
  .change-entry,
  .compact-list {
    grid-template-columns: 1fr;
  }

  .nav {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px 0;
  }

  .panel {
    padding: 20px;
  }

  .panel-section {
    margin-top: 24px;
  }

  .about-you-panel .panel-section {
    margin-top: 32px;
  }

  .file-search-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .file-search-actions .btn {
    justify-content: center;
    width: 100%;
  }

  .radio-list {
    flex-direction: column;
  }

  .other-med-choice {
    gap: 10px;
  }

  .other-med-choice > label {
    margin-top: 0;
  }

  .other-med-inline-details {
    margin-left: 28px;
  }

  .other-med-entry .selected-file-remove {
    justify-self: end;
  }

  .other-med-select-grid {
    width: 100%;
  }

  .instruction-row {
    grid-template-columns: 1fr;
  }

  .chart-row-grid {
    grid-template-columns: 1fr;
    width: 100%;
  }
}
