/*
 * PostOp Ready styles. DMC Blue Clinical: Inter 400 to 800, clinical blue
 * #1e40af, hairline structure, 10px cards, 6px inputs and chips, subtle
 * elevation used rarely. Mirrors PreOp Ready’s components and layout.
 * No external requests: the font is self-hosted (SIL OFL, see fonts/).
 */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('fonts/inter-latin-wght-normal.woff2') format('woff2');
}

:root {
  /* DMC Blue Clinical tokens. */
  --ink: #0f172a;
  --body: #334155;
  --muted: #64748b;
  --paper: #f8fafc;
  --surface: #ffffff;
  --line: #e2e8f0;
  --brand: #1e40af;
  --brand-deep: #0a48a9;
  --brand-vivid: #0c51bc;
  --brand-bright: #0063c9;
  --brand-light: #5c9cf9;
  --brand-soft: #eff4ff;
  --radius: 10px;
  --radius-input: 6px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06);

  /* Derived, same as PreOp Ready. */
  --brand-press: #12307c;
  --ink-soft: #dbe7ff;
  --kicker-dark: #c9d9f7;

  /* Semantic only: review flags, danger, done. */
  --flag-bg: #fff3cc;
  --flag-line: #cfa02e;
  --flag-ink: #5a4000;
  --danger: #b91c1c;
  --danger-ink: #7f1d1d;
  --danger-soft: #fef2f2;
  --danger-line: #fecaca;
  --done: #166534;
  --tint: #f1f5f9;
  --input-line: #94a3b8;

  /* Type scale (DMC tokens). */
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --fs-display: 40px;
  --fs-heading: 24px;
  --fs-subheading: 18px;
  --fs-body: 16px;
  --fs-caption: 13px;

  /* Motion, named by job. */
  --ease-emphasized: cubic-bezier(0.05, 0.7, 0.1, 1);
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --motion-view-enter: 280ms var(--ease-emphasized);
  --motion-state: 160ms var(--ease-standard);
  --motion-press: 120ms var(--ease-standard);
  --tabbar-h: 64px;
  --callbar-h: 60px;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Keeps a focused field clear of the fixed call bar and tab bar. */
  scroll-padding-bottom: calc(var(--tabbar-h) + var(--callbar-h) + 16px + env(safe-area-inset-bottom, 0px));
}

html:has(body.has-alert) {
  scroll-padding-bottom: calc(var(--tabbar-h) + 186px + env(safe-area-inset-bottom, 0px));
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--body);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  font-weight: 400;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tabbar-h) + var(--callbar-h) + env(safe-area-inset-bottom, 0px));
}

body.no-tabs {
  padding-bottom: calc(var(--callbar-h) + env(safe-area-inset-bottom, 0px));
}

h1,
h2,
h3,
h4 {
  color: var(--ink);
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 0.5rem;
  letter-spacing: 0;
  text-wrap: balance;
}

/* Display: page hero titles. */
h2 {
  font-size: var(--fs-display);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

/* Heading: section headings. */
h3 {
  font-size: var(--fs-heading);
  font-weight: 700;
  line-height: 1.25;
}

/* Subheading: card titles, subsection labels. */
h4 {
  font-size: var(--fs-subheading);
  font-weight: 600;
  line-height: 1.35;
}

p,
li {
  max-width: 68ch;
  text-wrap: pretty;
}

p {
  margin: 0 0 0.75rem;
}

strong {
  font-weight: 600;
  color: var(--ink);
}

a {
  color: var(--brand);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--brand-deep);
}

:focus-visible {
  outline: 2px solid var(--brand-bright);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.wrap {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 16px;
}

/* Micro label: announces a section’s job in one or two words. */
.kicker {
  margin: 0 0 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius-input);
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

/* ---------------- Header ---------------- */

.site-header {
  padding: 20px 0 12px;
}

.site-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  min-height: 44px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  flex: none;
}

.mark-bg {
  fill: var(--brand);
}

.mark-v {
  fill: #ffffff;
}

.mark-v-accent {
  fill: var(--brand-light);
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-tag {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* ---------------- Review flags ---------------- */

.review-banner {
  background: var(--flag-bg);
  border-bottom: 1px solid var(--flag-line);
  color: var(--flag-ink);
  padding: 12px 0 6px;
  font-size: 0.9375rem;
}

.review-banner p {
  margin: 0 0 6px;
}

.flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--flag-bg);
  color: var(--flag-ink);
  border: 1px solid var(--flag-line);
  border-radius: var(--radius-input);
  padding: 3px 10px 3px 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.3;
  white-space: nowrap;
}

.flag .icon {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.flag-strong {
  background: var(--flag-ink);
  color: var(--flag-bg);
  border-color: var(--flag-ink);
}

.draft-tag {
  display: inline-block;
  vertical-align: 1px;
  margin-left: 6px;
  background: var(--flag-bg);
  color: var(--flag-ink);
  border: 1px solid var(--flag-line);
  border-radius: var(--radius-input);
  padding: 0 6px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}

.show-ids [data-review-ids]::after {
  content: ' ' attr(data-review-ids);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0;
  white-space: normal;
}

/* Section heading: kicker, title, and review flag in one row. */
.sec-head {
  margin-bottom: 16px;
}

.sec-head .kicker {
  margin-bottom: 6px;
}

.sec-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 12px;
}

.sec-head-row h3 {
  margin: 0;
  flex: 1 1 auto;
  min-width: 12rem;
}

/* ---------------- Tabs ---------------- */

.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.tabs-inner {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  max-width: 44rem;
  margin: 0 auto;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: var(--tabbar-h);
  padding: 8px 2px 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-top: 3px solid transparent;
}

.tab .icon {
  width: 24px;
  height: 24px;
}

.tab[aria-current='page'] {
  color: var(--brand);
  border-top-color: var(--brand);
}

.tab:hover {
  color: var(--ink);
}

/* ---------------- Call panel (always on screen) ---------------- */

.callbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  z-index: 19;
  background: var(--ink);
  color: #fff;
}

body.no-tabs .callbar {
  bottom: env(safe-area-inset-bottom, 0px);
}

.callbar:empty {
  display: none;
}

.callbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  max-width: 44rem;
  margin: 0 auto;
  min-height: var(--callbar-h);
  padding: 8px 16px;
}

.callbar-text {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.callbar-link {
  color: #fff;
  white-space: nowrap;
}

.callbar-link:hover {
  color: #fff;
}

.callbar-actions {
  display: flex;
  gap: 8px;
  flex: none;
}

.callbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.callbar-btn:hover {
  color: var(--ink);
  background: var(--brand-soft);
}

.callbar-btn .icon {
  width: 18px;
  height: 18px;
}

.callbar-btn.is-911 {
  background: var(--danger);
  color: #fff;
}

.callbar-btn.is-911:hover {
  background: var(--danger-ink);
  color: #fff;
}

.callbar :focus-visible {
  outline-color: #fff;
}

.callbar.is-alert {
  background: var(--danger-ink);
}

.callbar.is-alert .callbar-inner {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.callbar.is-alert .callbar-actions .callbar-btn {
  flex: 1;
  justify-content: center;
}

.callbar.is-alert .callbar-btn.is-911 {
  background: #fff;
  color: var(--danger-ink);
}

.callbar-msg {
  min-width: 0;
}

.callbar-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 2px;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
}

.callbar-head .icon {
  width: 20px;
  height: 20px;
}

.callbar-why {
  margin: 0;
  font-size: 0.8125rem;
  color: #fde2e2;
}

body.has-alert {
  padding-bottom: calc(var(--tabbar-h) + 170px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 22rem) {
  .callbar-text {
    font-size: 0.8125rem;
  }

  .callbar-btn {
    padding: 8px 10px;
  }
}

@media (min-width: 60rem) {
  body,
  body.no-tabs {
    padding-bottom: var(--callbar-h);
  }

  body.has-alert {
    padding-bottom: 170px;
  }

  html {
    scroll-padding-top: calc(var(--tabbar-h) + 16px);
    scroll-padding-bottom: calc(var(--callbar-h) + 16px);
  }

  html:has(body.has-alert) {
    scroll-padding-bottom: 186px;
  }

  .tabs {
    position: sticky;
    top: 0;
    bottom: auto;
    border-top: 0;
    border-bottom: 1px solid var(--line);
    background: var(--paper);
  }

  .tab {
    flex-direction: row;
    gap: 8px;
    min-height: 52px;
    font-size: 0.9375rem;
    border-top: 0;
    border-bottom: 3px solid transparent;
  }

  .tab[aria-current='page'] {
    border-bottom-color: var(--brand);
  }

  .callbar,
  body.no-tabs .callbar {
    bottom: 0;
  }
}

/* ---------------- Main ---------------- */

main {
  outline: none;
  padding: 8px 0 40px;
}

.view-head {
  margin: 24px 0 20px;
}

.view-head .kicker {
  margin-bottom: 8px;
}

.view-head h2 {
  margin-bottom: 8px;
}

.view-head h2:focus {
  outline: none;
}

.lede {
  color: var(--muted);
  font-size: 1.0625rem;
  margin-bottom: 0;
}

.fine {
  color: var(--muted);
  font-size: var(--fs-caption);
}

/* Cards group one actionable unit. Everything else is hairline sections. */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin: 0 0 16px;
  scroll-margin-top: 16px;
}

.card > :last-child {
  margin-bottom: 0;
}

/* Hairline section: the default rhythm of the app. */
.section {
  padding: 24px 0 8px;
  border-top: 1px solid var(--line);
  margin-top: 24px;
  scroll-margin-top: 16px;
}

.section > :last-child {
  margin-bottom: 0;
}

ul.plain,
ol.plain {
  list-style: none;
  padding: 0;
  margin: 0;
}

ul.bullets {
  margin: 0 0 0.75rem;
  padding-left: 1.2rem;
}

ul.bullets li + li {
  margin-top: 6px;
}

ol.steps {
  margin: 0 0 0.75rem;
  padding-left: 1.4rem;
}

ol.steps li + li {
  margin-top: 6px;
}

.cond {
  font-weight: 600;
  color: var(--ink);
}

/* ---------------- Buttons and inputs ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand-deep);
  color: #fff;
}

.btn-primary:active {
  background: var(--brand-press);
  color: #fff;
}

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

.btn-secondary:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.btn-quiet {
  background: transparent;
  color: var(--brand);
  border-color: var(--line);
}

.btn-quiet:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: var(--danger-ink);
  color: #fff;
}

.btn .icon {
  width: 20px;
  height: 20px;
}

.btn-link {
  background: none;
  border: 0;
  padding: 10px 0;
  min-height: 44px;
  font: inherit;
  color: var(--brand);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.field {
  margin: 0 0 20px;
}

.field > label,
.legend {
  display: block;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.hint {
  display: block;
  color: var(--muted);
  font-size: 0.9375rem;
  margin: 0 0 8px;
}

.error {
  display: block;
  color: var(--danger);
  font-weight: 600;
  font-size: 0.9375rem;
  margin: 6px 0 0;
}

input[type='text'],
input[type='tel'],
input[type='date'],
input[type='number'] {
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--input-line);
  border-radius: var(--radius-input);
  min-height: 48px;
  padding: 10px 12px;
  width: 100%;
  max-width: 24rem;
  -webkit-appearance: none;
  appearance: none;
}

input[aria-invalid='true'] {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px var(--danger);
}

input:focus {
  border-color: var(--brand);
}

fieldset {
  border: 0;
  margin: 0 0 20px;
  padding: 0;
  min-width: 0;
}

legend {
  padding: 0;
}

.choices {
  display: grid;
  gap: 8px;
}

.choice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 48px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  line-height: 1.4;
  color: var(--ink);
}

.choice:hover {
  border-color: var(--input-line);
}

.choice input {
  margin: 2px 0 0;
  width: 20px;
  height: 20px;
  flex: none;
  accent-color: var(--brand);
}

.choice:has(input:checked) {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
  background: var(--brand-soft);
}

.choices-inline {
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
}

.two-up {
  display: grid;
  gap: 0 16px;
}

@media (min-width: 36rem) {
  .two-up {
    grid-template-columns: 1fr 1fr;
  }
}

.handoff-note {
  background: var(--brand-soft);
  border: 1px solid #d7e3fa;
  border-radius: var(--radius);
  padding: 14px 16px 4px;
  margin: 0 0 16px;
}

.handoff-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.handoff-title .icon {
  width: 20px;
  height: 20px;
  color: var(--brand);
  stroke-width: 2.5;
}

/* ---------------- Hero: days since surgery ---------------- */

.hero {
  background: var(--brand-deep);
  color: #fff;
  border-radius: var(--radius);
  padding: 30px 24px 24px;
  margin: 0 0 8px;
  overflow: hidden;
}

.hero .kicker {
  color: var(--kicker-dark);
}

.hero p {
  color: var(--ink-soft);
}

.countdown-big {
  margin: 0 0 4px;
  color: #fff;
  font-size: var(--fs-display);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.count-num {
  font-size: clamp(4.5rem, 20vw, 7rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.count-unit {
  font-size: clamp(1.25rem, 6vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* The unit moves as one piece: beside the number when it fits, else on the
   line below it, never with "surgery." stranded on a line of its own. */
.countdown-big.is-count {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.35em;
}

.hero .overview-sub {
  font-size: 1.0625rem;
  margin: 10px 0 6px;
  color: #fff;
  font-weight: 500;
}

.hero .phase-line {
  margin: 0 0 4px;
}

.hero .fine {
  color: var(--kicker-dark);
}

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

.hero .btn-secondary:hover {
  background: var(--brand-soft);
  border-color: #fff;
}

.hero .btn-quiet {
  color: #fff;
  border-color: rgb(255 255 255 / 45%);
}

.hero .btn-quiet:hover {
  border-color: #fff;
  background: rgb(255 255 255 / 12%);
  color: #fff;
}

.hero :focus-visible {
  outline-color: #fff;
}

.edu-note {
  margin-top: 10px;
  margin-bottom: 0;
}

/* Journey strip: PreOp’s today-to-surgery rail, flipped to surgery-day-to-today. */
.journey {
  margin: 22px 0 6px;
}

.journey-rail {
  position: relative;
  height: 2px;
  background: rgb(255 255 255 / 28%);
  border-radius: 2px;
  margin: 0 7px;
}

.journey-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  border-radius: 2px;
  background: var(--brand-light);
}

.journey-dot {
  position: absolute;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgb(255 255 255 / 55%);
  transform: translate(-50%, -50%);
}

.journey-dot.is-passed {
  background: #fff;
}

.journey-dot.is-now {
  width: 11px;
  height: 11px;
  background: #fff;
}

.journey-dot.is-day {
  width: 13px;
  height: 13px;
  background: var(--brand-deep);
  border: 2.5px solid #fff;
}

.journey-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--kicker-dark);
}

/* Checklist progress inside the hero. */
.progress {
  margin: 18px 0 2px;
  padding-top: 16px;
  border-top: 1px solid rgb(255 255 255 / 22%);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}

.progress-meta span:last-child {
  color: var(--kicker-dark);
  font-weight: 500;
}

.progress-track {
  height: 6px;
  border-radius: 3px;
  background: rgb(255 255 255 / 22%);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--brand-light);
  width: 0;
}

/* ---------------- Custom accessible checkboxes ---------------- */

.check {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  padding: 6px 0;
  min-height: 44px;
}

.check + .check {
  border-top: 1px solid var(--line);
}

.check-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  margin: 0;
}

.check-label {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 4px 12px;
  flex: 1;
  min-height: 44px;
  padding: 6px 4px 6px 0;
  cursor: pointer;
  border-radius: var(--radius-input);
}

.check-box {
  flex: none;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border-radius: var(--radius-input);
  border: 1.5px solid var(--input-line);
  background: #fff;
  display: grid;
  place-items: center;
}

.check-box .icon {
  width: 14px;
  height: 14px;
  stroke-width: 3;
  color: #fff;
  opacity: 0;
  transform: scale(0.25);
}

.check-input:checked + .check-label .check-box {
  background: var(--brand);
  border-color: var(--brand);
}

.check-input:checked + .check-label .check-box .icon {
  opacity: 1;
  transform: scale(1);
}

.check-input:focus-visible + .check-label .check-box {
  outline: 2px solid var(--brand-bright);
  outline-offset: 2px;
}

.check-label .item-text {
  flex: 1;
  min-width: 10rem;
  color: var(--ink);
  padding-top: 1px;
}

.check .jump {
  display: inline-block;
  font-size: 0.875rem;
  margin-left: 4px;
  padding: 10px 0;
}

.check.is-done .check-label .item-text {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: rgb(100 116 139 / 55%);
}

.check.is-med .item-text {
  font-weight: 600;
}

.note-box {
  background: var(--tint);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 0 0 12px;
  color: var(--body);
}

.visit-gate .check {
  margin-top: 6px;
}

.visit-gate-item + .visit-gate-item {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.limit-held {
  margin: 4px 0 0;
  font-weight: 600;
}

.note-box > p:last-child {
  margin-bottom: 0;
}

details.more {
  margin: 0 0 12px;
}

details.more summary {
  cursor: pointer;
  color: var(--brand);
  min-height: 44px;
  display: flex;
  align-items: center;
  font-weight: 600;
}

/* ---------------- Limits ---------------- */

.limit-list {
  display: grid;
  gap: 0;
}

.limit,
.locked {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.limit:first-child,
.locked:first-child {
  border-top: 0;
}

.limit-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--brand);
}

.limit-icon .icon {
  width: 22px;
  height: 22px;
}

.limit-topic {
  margin: 0 0 2px;
  font-weight: 600;
  color: var(--ink);
}

.limit-text {
  margin: 0;
}

.limit-range {
  font-weight: 500;
  font-size: var(--fs-caption);
  color: var(--muted);
}

.preview-head {
  margin: 12px 0 0;
}

/* ---------------- Recovery timeline rail (vertical, phase gated) ---------------- */

.phase-rail {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  position: relative;
}

.phase {
  position: relative;
  display: flex;
  gap: 14px;
  padding: 0 0 18px;
}

.phase::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 26px;
  bottom: 0;
  width: 2px;
  background: var(--line);
}

.phase:last-child::before {
  display: none;
}

.phase.is-done::before {
  background: var(--brand);
}

.phase-dot {
  flex: none;
  position: relative;
  z-index: 1;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--input-line);
  background: var(--surface);
  display: grid;
  place-items: center;
  margin-top: 2px;
}

.phase-dot .icon {
  width: 14px;
  height: 14px;
  stroke-width: 3;
  color: #fff;
}

.phase.is-done .phase-dot {
  background: var(--brand);
  border-color: var(--brand);
}

.phase.is-current .phase-dot {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}

.phase.is-current .phase-dot::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
}

.phase-body {
  flex: 1;
  min-width: 0;
}

.phase-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  margin-bottom: 4px;
}

.phase-head h4 {
  margin: 0;
}

.phase.is-ahead .phase-head h4 {
  color: var(--body);
}

.phase-when {
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.here {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  border-radius: var(--radius-input);
  padding: 0 8px;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.6;
}

.phase-focus {
  margin-bottom: 6px;
}

.phase.is-current .phase-body {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 6px;
  margin-top: -6px;
}

.visit-line {
  font-weight: 600;
  color: var(--ink);
}

/* ---------------- Medicines ---------------- */

.med-add {
  position: relative;
}

.med-add-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.med-add-row input {
  max-width: none;
  flex: 1;
  min-width: 0;
}

.suggest {
  position: absolute;
  z-index: 10;
  left: 0;
  right: 0;
  margin: 4px 0 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 22rem;
  overflow: auto;
}

.suggest li {
  padding: 11px 12px;
  min-height: 44px;
  border-radius: var(--radius-input);
  cursor: pointer;
}

.suggest li[aria-selected='true'],
.suggest li:hover {
  background: var(--brand-soft);
}

.med-list {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.med-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 20px 14px;
}

.med-card.is-due {
  border-color: var(--danger-line);
}

.med-card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.med-card h3 {
  font-size: var(--fs-subheading);
  font-weight: 600;
  margin: 0;
}

.med-cat {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 2px 0 12px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -8px -8px 0 0;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  flex: none;
}

.icon-btn:hover {
  background: var(--tint);
  color: var(--ink);
}

/* Stop, surgery, restart: the hold calculator reflected. */
.mirror {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 12px 0 4px;
  padding: 0;
  position: relative;
}

.mirror::before {
  content: '';
  position: absolute;
  left: 16.66%;
  right: 16.66%;
  top: 6px;
  height: 2px;
  background: var(--line);
}

.mirror li {
  position: relative;
  text-align: center;
  padding-top: 20px;
  min-width: 0;
}

.mirror li::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 2px solid var(--input-line);
}

.mirror .mirror-day::before {
  background: var(--brand);
  border-color: var(--brand);
}

.mirror .mirror-go::before {
  border-color: var(--brand);
}

.mirror .mirror-go.is-due::before {
  border-color: var(--danger);
  background: var(--danger);
}

.mirror .mirror-go.is-now::before {
  background: var(--brand-light);
  border-color: var(--brand);
}

.mirror-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.mirror-value {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.med-plan {
  background: var(--brand-soft);
  border: 1px solid #d7e3fa;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 12px 0;
}

.med-plan.is-final {
  background: var(--surface);
  border-color: var(--line);
}

.med-plan > :last-child {
  margin-bottom: 0;
}

.med-headline {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 2px;
  letter-spacing: -0.01em;
}

.med-detail {
  margin: 0 0 4px;
}

.med-status {
  margin: 6px 0 0;
  font-weight: 600;
  color: var(--ink);
}

.med-status.is-urgent {
  color: var(--danger-ink);
}

.hold-line {
  margin-bottom: 10px;
}

.restart-check {
  border-top: 1px solid var(--line);
  margin-top: 6px;
}

.surgeon-date {
  margin: 14px 0 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.surgeon-date input {
  max-width: 14rem;
}

.urgent,
.alert,
.result.is-high {
  background: var(--danger-soft);
  border: 1px solid var(--danger-line);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 0 0 12px;
  color: var(--danger-ink);
}

.alert > p:last-of-type {
  margin-bottom: 8px;
}

.warning {
  background: var(--tint);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 0 0 10px;
}

.med-q {
  margin: 4px 0 12px;
}

.med-q .legend {
  margin-bottom: 8px;
}

/* ---------------- Symptoms ---------------- */

.log-form h3 {
  margin-bottom: 16px;
}

.pain-scale {
  display: grid;
  grid-template-columns: repeat(11, minmax(0, 1fr));
  gap: 4px;
}

.pain-chip {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  background: var(--surface);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  cursor: pointer;
}

.pain-chip input {
  position: absolute;
  top: 50%;
  left: 50%;
  margin: 0;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.pain-chip:has(input:checked) {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.pain-chip:has(input:focus-visible) {
  outline: 2px solid var(--brand-bright);
  outline-offset: 2px;
}

@media (max-width: 26rem) {
  .pain-scale {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.sx-group {
  margin: 14px 0 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.result {
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0 0 16px;
  background: var(--tint);
  border: 1px solid var(--line);
}

.result:focus {
  outline: none;
}

.result.is-ok {
  background: var(--brand-soft);
  border-color: #d7e3fa;
}

.result.level-911,
.result.level-office {
  background: var(--danger-soft);
  border-color: var(--danger-line);
  color: var(--danger-ink);
}

.result.level-911 strong,
.result.level-office strong {
  color: var(--danger-ink);
}

.result-head {
  font-size: 1.0625rem;
}

.log-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 4px 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

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

.log-row p {
  margin: 0;
}

.log-date {
  font-weight: 600;
  color: var(--ink);
}

.level-badge {
  display: inline-block;
  border-radius: var(--radius-input);
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  background: var(--tint);
  color: var(--body);
  border: 1px solid var(--line);
}

.level-badge.level-watch {
  background: var(--flag-bg);
  color: var(--flag-ink);
  border-color: var(--flag-line);
}

.level-badge.level-office,
.level-badge.level-911 {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.emergency {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.emergency .kicker {
  color: var(--kicker-dark);
}

.emergency h3 {
  color: #fff;
}

.emergency p {
  color: var(--ink-soft);
}

.emergency ul li {
  padding: 10px 0;
  border-top: 1px solid rgb(255 255 255 / 18%);
  color: var(--ink-soft);
}

.emergency ul li:first-child {
  border-top: 0;
}

.emergency .cond {
  color: #fff;
}

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

.emergency .btn-secondary:hover {
  background: var(--brand-soft);
}

.emergency :focus-visible {
  outline-color: #fff;
}

.flag-list li {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.flag-list li:first-child {
  border-top: 0;
}

/* ---------------- Exercises ---------------- */

.ex-list {
  display: grid;
  gap: 14px;
}

.ex-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px 8px;
}

.ex-top {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.ex-top h4 {
  margin: 0;
}

.ex-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--brand);
}

.ex-dose {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.ex-card .check {
  border-top: 1px solid var(--line);
}

.ex-card.is-done {
  border-color: #d7e3fa;
}

.locked .limit-icon {
  background: var(--tint);
  color: var(--muted);
}

.locked p {
  margin: 0;
}

/* ---------------- Summary ---------------- */

.q-form {
  margin-top: 8px;
}

.q-list {
  margin: 10px 0 0;
}

.q-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 4px 0 4px 12px;
  border-left: 2px solid var(--brand);
  margin-bottom: 6px;
}

.q-suggest {
  margin-top: 12px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: var(--radius-input);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--brand);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.chip:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.summary-doc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

.summary-doc h3 {
  font-size: 1.0625rem;
  margin: 18px 0 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.summary-doc .doc-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

.summary-doc .doc-banner {
  border: 1px solid var(--flag-line);
  background: var(--flag-bg);
  color: var(--flag-ink);
  border-radius: var(--radius-input);
  padding: 8px 12px;
  margin: 10px 0;
  font-weight: 600;
}

.summary-doc table {
  width: 100%;
  border-collapse: collapse;
}

.summary-doc th,
.summary-doc td {
  text-align: left;
  vertical-align: top;
  padding: 6px 8px 6px 0;
  border-bottom: 1px solid var(--line);
}

.summary-doc th {
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--muted);
}

.summary-doc dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 2px 12px;
  margin: 0;
}

.summary-doc dt {
  font-weight: 600;
}

.summary-doc dd {
  margin: 0;
}

.doc-cols {
  display: grid;
  gap: 0 20px;
}

@media (min-width: 36rem) {
  .doc-cols {
    grid-template-columns: 1fr 1fr;
  }
}

.doc-limits {
  columns: 2 18rem;
  column-gap: 20px;
}

.doc-limits li {
  break-inside: avoid;
}

.summary-doc .blank {
  display: inline-block;
  min-width: 11rem;
  border-bottom: 1px solid var(--ink);
}

.summary-doc .lines .blank {
  display: block;
  min-width: 0;
  height: 1.6em;
}

.summary-doc .d {
  color: var(--flag-ink);
  font-size: 0.8125rem;
  font-weight: 700;
}

.doc-foot {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.8125rem;
}

.print-root {
  display: none;
}

/* ---------------- Footer ---------------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px 0 28px;
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer p {
  margin: 0 0 6px;
}

.attribution {
  font-weight: 600;
  color: var(--body);
}

.noscript {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

/* ---------------- Icons ---------------- */

.icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.btn .icon.icon,
.btn > .icon:last-child {
  width: 18px;
  height: 18px;
}

/* ---------------- Motion (only when welcome) ---------------- */

@media (prefers-reduced-motion: no-preference) {
  .view-enter {
    animation: view-in var(--motion-view-enter) both;
  }

  .med-card.is-new {
    animation: view-in var(--motion-view-enter) both;
  }

  .suggest {
    animation: fade-in 160ms var(--ease-standard) both;
  }

  .btn,
  .choice,
  .tab,
  .icon-btn,
  .chip,
  .pain-chip,
  .callbar-btn {
    transition: background-color var(--motion-state), border-color var(--motion-state), color var(--motion-state);
  }

  .btn:active,
  .callbar-btn:active {
    transform: scale(0.97);
    transition: background-color var(--motion-press), border-color var(--motion-press), color var(--motion-press), transform var(--motion-press);
  }

  .check-box {
    transition: background-color var(--motion-state), border-color var(--motion-state);
  }

  .check-box .icon {
    transition: opacity var(--motion-state), transform var(--motion-state);
  }

  .check-label .item-text {
    transition: color var(--motion-state);
  }

  .progress-fill {
    transition: width 320ms var(--ease-emphasized);
  }

  .callbar {
    transition: background-color var(--motion-state);
  }

  .phase.is-current .phase-dot {
    animation: breathe-ring 2.4s ease-in-out infinite;
  }

  @keyframes view-in {
    from {
      opacity: 0;
      transform: translateY(6px);
    }

    to {
      opacity: 1;
      transform: none;
    }
  }

  @keyframes fade-in {
    from {
      opacity: 0;
    }

    to {
      opacity: 1;
    }
  }

  @keyframes breathe-ring {
    0%,
    100% {
      box-shadow: 0 0 0 4px var(--brand-soft);
    }

    50% {
      box-shadow: 0 0 0 7px var(--brand-soft);
    }
  }
}

/* ---------------- Print: the one-page summary only ---------------- */

/* The print sheet is styled outside the print media query so the app can
   lay it out off screen, measure it, and scale it to fit one page. */

.print-root.is-measuring {
  display: block;
  position: absolute;
  top: 0;
  left: -10000px;
  width: 7.6in;
  visibility: hidden;
}

.print-root .summary-doc {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  background: #fff;
  color: #000;
  font-size: 8.5pt;
  line-height: 1.3;
}

.print-root .summary-doc .doc-cols {
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
}

.print-root .summary-doc p,
.print-root .summary-doc ul.bullets,
.print-root .summary-doc ol.steps {
  margin-top: 0;
  margin-bottom: 3px;
}

.print-root .summary-doc ul.bullets li + li,
.print-root .summary-doc ol.steps li + li {
  margin-top: 1px;
}

.print-root .summary-doc .fine {
  font-size: 7.5pt;
}

.print-root .summary-doc p,
.print-root .summary-doc li {
  max-width: none;
}

.print-root .summary-doc h3 {
  font-size: 10pt;
  margin: 8px 0 3px;
  padding-bottom: 3px;
  break-after: avoid;
}

.print-root .summary-doc .doc-title {
  font-size: 14pt;
  color: #000;
}

.print-root .summary-doc th,
.print-root .summary-doc td {
  padding: 2px 6px 2px 0;
}

.print-root .summary-doc th {
  font-size: 7.5pt;
  color: #000;
}

.print-root .summary-doc .doc-banner {
  background: #fff;
  color: #000;
  border-color: #000;
  padding: 4px 8px;
  margin: 6px 0;
}

.print-root .summary-doc .d {
  color: #000;
  font-size: 7pt;
}

.print-root .summary-doc .doc-limits {
  columns: 2;
  column-gap: 18px;
  font-size: 8pt;
}

.print-root .summary-doc .doc-foot {
  margin-top: 8px;
  font-size: 7.5pt;
  color: #000;
}

.print-root .summary-doc tr,
.print-root .summary-doc li {
  break-inside: avoid;
}

@media print {
  @page {
    size: letter;
    margin: 0.45in;
  }

  body {
    background: #fff;
    color: #000;
    padding: 0;
  }

  .app {
    display: none !important;
  }

  .print-root {
    display: block !important;
  }

  a {
    color: #000;
    text-decoration: none;
  }
}


/* DMC Hub footer */
.hub-footer{background:#102b45;color:#d7e4f0;margin:36px 0 0;font-family:Inter,system-ui,-apple-system,"Segoe UI",sans-serif}.hub-footer-inner{max-width:1184px;margin:auto;padding:28px 26px 24px}.hub-home{display:inline-flex;align-items:center;gap:12px;text-decoration:none;color:#fff}.hub-home-mark{width:40px;height:40px;border-radius:12px;background:#225dbe;display:grid;place-items:center;flex:none}.hub-home-text{font-size:19px;font-weight:750;letter-spacing:-.4px;line-height:1.1;display:flex;flex-direction:column;color:#fff}.hub-home-text small{font-size:12px;font-weight:500;color:#a9c2dc;letter-spacing:0;margin-top:2px}.hub-home-arrow{font-size:20px;color:#a9c2dc;margin-left:2px}.hub-home:hover .hub-home-text{text-decoration:underline}.hub-foot-cols{display:grid;grid-template-columns:repeat(3,1fr);gap:26px;margin-top:26px}.hub-col h3{color:#fff;font-size:15px;margin:0 0 3px;letter-spacing:-.2px}.hub-col-sub{color:#8fb0d4;font-size:12px;margin:0 0 10px}.hub-col ul{list-style:none;margin:0;padding:0;display:grid;gap:2px}.hub-col a{color:#c3d6ec;text-decoration:none;font-size:13.5px;display:inline-flex;align-items:center;min-height:32px;padding:2px 0}.hub-col a:hover{color:#fff;text-decoration:underline}.hub-col a.hub-current{color:#fff;font-weight:700}.hub-col a.hub-current::after{content:"You are here";font-size:10px;font-weight:600;letter-spacing:.6px;text-transform:uppercase;color:#0f2c49;background:#9db9da;border-radius:999px;padding:2px 7px;margin-left:8px}.hub-foot-base{border-top:1px solid #2a4763;margin-top:24px;padding-top:15px;font-size:12px;color:#8fb0d4}@media(max-width:700px){.hub-foot-cols{grid-template-columns:1fr;gap:20px}.hub-footer-inner{padding:24px 18px 20px}}
