/* dent-scribe — editorial-clinical aesthetic
   cream paper × ink navy × brick-oxide red × Fraunces serif + IBM Plex */

:root {
  /* palette */
  --paper: #f6f1e6;
  --paper-2: #efe9db;
  --rule: #1d2d3a;
  --rule-soft: rgba(29, 45, 58, 0.18);
  --ink: #0f2433;
  --ink-2: #1d2d3a;
  --ink-muted: #4a5a68;
  --ink-faint: #7a8692;
  --oxide: #a8412e;
  --oxide-soft: rgba(168, 65, 46, 0.12);
  --olive: #4a5e35;
  --amber: #c38b3b;

  /* type */
  --font-display: "Fraunces", "Iowan Old Style", "Georgia", serif;
  --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* metrics */
  --radius: 2px;
  --page-px: clamp(20px, 4vw, 56px);
  --max: 1280px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  padding: clamp(18px, 3.5vw, 48px) var(--page-px) 80px;
  background-image:
    /* subtle paper noise via layered radial gradients */
    radial-gradient(at 15% 10%, rgba(168, 65, 46, 0.04) 0%, transparent 40%),
    radial-gradient(at 85% 85%, rgba(15, 36, 51, 0.04) 0%, transparent 45%);
  background-attachment: fixed;
}

/* ==== masthead ==== */
.masthead {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  max-width: var(--max);
  margin: 0 auto;
}
.masthead__left { flex: 1 1 auto; }
.masthead__right { flex: 0 0 auto; }
.wordmark {
  font-family: var(--font-mono);
  font-size: clamp(34px, 5.2vw, 56px);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1;
}
.wordmark__serif {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  color: var(--oxide);
  padding: 0 0.06em;
  font-size: 1.1em;
  vertical-align: -0.02em;
}
.tagline {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(16px, 1.6vw, 19px);
  color: var(--ink-muted);
  margin: 12px 0 0;
  letter-spacing: 0.003em;
}
.stamp {
  border: 1px solid var(--oxide);
  padding: 8px 14px 9px;
  color: var(--oxide);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-transform: uppercase;
  transform: rotate(-2deg);
  transform-origin: right center;
  text-align: center;
}
.stamp__line:first-child { font-weight: 600; }

.rule {
  border: 0;
  border-top: 1px solid var(--rule);
  max-width: var(--max);
  margin: 28px auto 40px;
}

/* ==== composer ==== */
.composer {
  max-width: var(--max);
  margin: 0 auto;
}

/* ==== visit two-column layout (desktop ≥1024px) ===========================
   At <1024px the wrappers are inert — single-column flow, byte-identical to
   pre-split markup. At ≥1024px we split into editable surface (left) +
   sticky preview (right). When #results is hidden (pre-generation), we
   collapse back to single column via :has(); the JS toggle below is a
   belt-and-braces fallback. */
.visit-layout { display: block; }
.visit-layout__left { min-width: 0; }
.visit-layout__right { min-width: 0; }

@media (min-width: 1024px) {
  .visit-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(420px, 1fr);
    gap: 40px;
    align-items: start;
  }
  .visit-layout__right {
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    overflow-x: hidden;
  }
  /* Pre-generation: #results is [hidden] → right column empty → collapse. */
  .visit-layout:has(.results[hidden]) {
    display: block;
  }
  .visit-layout:has(.results[hidden]) .visit-layout__right {
    display: none;
  }
  /* JS-toggle fallback in case :has() misbehaves in the target browser. */
  .visit-layout:not(.visit-layout--has-results) {
    display: block;
  }
  .visit-layout:not(.visit-layout--has-results) .visit-layout__right {
    display: none;
  }
  /* When the results section is open, the .results block itself should not
     re-impose its own max-width / top margin — it lives inside the sticky
     column now. */
  .visit-layout__right .results {
    max-width: none;
    margin-top: 0;
  }
  /* When the visit-layout splits to two columns, the left column shrinks to
     ~620px. Stay horizontal — drop the descriptive blurb to keep widths
     reasonable — instead of stacking, which would push the structured
     panels another ~360px down the page. */
  .visit-layout--has-results .intake,
  .visit-layout:has(.results:not([hidden])) .intake {
    padding: 18px 16px 22px;
    gap: 12px;
  }
  .visit-layout--has-results .intake__title,
  .visit-layout:has(.results:not([hidden])) .intake__title {
    font-size: 20px;
    margin: 4px 0 2px;
  }
  .visit-layout--has-results .intake__body,
  .visit-layout:has(.results:not([hidden])) .intake__body {
    display: none;
  }
}
.field-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 10px;
}
.composer__template {
  margin-bottom: 36px;
  max-width: 640px;
}
.select-wrap {
  position: relative;
  border-bottom: 1px solid var(--rule);
}
.select-wrap select {
  appearance: none;
  width: 100%;
  background: transparent;
  border: 0;
  font-family: var(--font-display);
  font-size: clamp(22px, 2.3vw, 28px);
  font-weight: 400;
  color: var(--ink);
  padding: 6px 34px 14px 0;
  cursor: pointer;
  outline: none;
}
.select-wrap select option { font-family: var(--font-sans); font-size: 15px; }
.select-caret {
  position: absolute;
  right: 4px;
  top: 14px;
  width: 14px;
  color: var(--ink-muted);
  pointer-events: none;
}

.composer__inputs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--rule-soft);
  border-bottom: 1px solid var(--rule-soft);
}
.intake {
  padding: 28px 28px 32px;
  border-right: 1px solid var(--rule-soft);
  background: transparent;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.intake:last-child { border-right: 0; }
.intake__head { }
.intake__kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--oxide);
}
.intake__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.15;
  margin: 8px 0 6px;
  letter-spacing: -0.005em;
}
.intake__body {
  font-size: 13.5px;
  color: var(--ink-muted);
  margin: 0;
  max-width: 36ch;
  line-height: 1.55;
}

@media (max-width: 900px) {
  /* Stay horizontal on mobile — vertical stacking pushed the rest of the
     visit halfway down the page. Drop the descriptive blurb and tighten
     padding so three cards fit a phone width. */
  .composer__inputs { grid-template-columns: repeat(3, 1fr); }
  .intake {
    padding: 14px 10px 18px;
    gap: 10px;
  }
  .intake__title {
    font-size: 16px;
    margin: 2px 0;
    line-height: 1.1;
  }
  .intake__kicker { font-size: 9px; letter-spacing: 0.2em; }
  .intake__body { display: none; }
  .rec-btn__label { font-size: 12px; }
  .rec-meta { font-size: 11px; }
  .file-drop__label { font-size: 12px; }
}

/* ==== record ==== */
.rec-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-start;
}
.rec-btn {
  appearance: none;
  background: var(--ink);
  color: var(--paper);
  border: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 16px 24px 16px 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(.2,.8,.3,1), background 0.2s ease;
  font-feature-settings: "ss01";
}
.rec-btn:hover { transform: translateY(-1px); }
.rec-btn:active { transform: translateY(0); }
.rec-btn__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--oxide);
  box-shadow: 0 0 0 3px rgba(168, 65, 46, 0.25);
  transition: all 0.25s ease;
}
.rec-btn[data-state="idle"] .rec-btn__dot {
  animation: dot-breath 2.6s ease-in-out infinite;
}
.rec-btn[data-state="recording"] {
  background: var(--oxide);
  color: var(--paper);
}
.rec-btn[data-state="recording"] .rec-btn__dot {
  background: var(--paper);
  animation: dot-pulse 0.9s ease-in-out infinite;
}
@keyframes dot-breath {
  0%, 100% { box-shadow: 0 0 0 3px rgba(168, 65, 46, 0.18); }
  50%      { box-shadow: 0 0 0 5px rgba(168, 65, 46, 0.08); }
}
@keyframes dot-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 4px rgba(246, 241, 230, 0.25); }
  50%      { transform: scale(0.85); box-shadow: 0 0 0 8px rgba(246, 241, 230, 0); }
}
.rec-meta {
  display: flex;
  align-items: baseline;
  gap: 14px;
  color: var(--ink-muted);
  font-size: 12px;
}
.rec-timer {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.rec-hint { font-size: 12px; color: var(--ink-faint); }
#rec-preview {
  width: 100%;
  max-width: 320px;
  margin-top: 4px;
}

/* ==== upload ==== */
.file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 20px;
  border: 1px dashed var(--rule);
  cursor: pointer;
  min-height: 130px;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.file-drop:hover {
  border-color: var(--ink);
  background: rgba(15, 36, 51, 0.03);
}
.file-drop.is-filled {
  border-style: solid;
  border-color: var(--olive);
  background: rgba(74, 94, 53, 0.05);
}
.file-drop__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  color: var(--ink-muted);
}
.file-drop__icon svg { width: 18px; height: 18px; }
.file-drop__label {
  font-size: 13px;
  color: var(--ink-muted);
  text-align: center;
}
.file-drop.is-filled .file-drop__label { color: var(--olive); font-weight: 500; }

/* ==== textarea ==== */
#transcript-input {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  padding: 14px;
  background: var(--paper-2);
  border: 1px solid var(--rule-soft);
  color: var(--ink);
  resize: vertical;
  outline: none;
  transition: border-color 0.18s ease;
}
#transcript-input:focus { border-color: var(--ink); }

/* ==== submit ==== */
.anesthesia-panel {
  margin-top: 28px;
  padding: 18px 20px;
  border-top: 1px solid var(--rule-soft);
  border-bottom: 1px solid var(--rule-soft);
  background: var(--paper-2, transparent);
}
.anesthesia-panel__head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.anesthesia-panel__hint { font-size: 12px; color: var(--ink-soft, #777); }
.anesthesia-panel__row { display: flex; gap: 14px; align-items: stretch; margin-bottom: 10px; }
.anesthesia-panel__row + .anesthesia-panel__row { padding-top: 10px; border-top: 1px dashed var(--rule-soft); }
.anesthesia-panel__row-label {
  flex: 0 0 auto;
  min-width: 84px;
  padding-top: 22px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft, #777);
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.anesthesia-panel__remove {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font-size: 16px; line-height: 1; padding: 0 4px; color: var(--ink-soft, #999);
}
.anesthesia-panel__remove:hover { color: var(--ink, #222); }
.anesthesia-panel__add {
  appearance: none; border: 1px dashed var(--rule-soft); background: transparent;
  padding: 8px 12px; font: inherit; font-size: 12px; color: var(--ink-soft, #666);
  cursor: pointer; margin-top: 6px;
}
.anesthesia-panel__add:hover { color: var(--ink, #222); border-style: solid; }
.anesthesia-panel__grid {
  flex: 1 1 auto;
  display: grid;
  /* 2-col at every desktop width — at the visit page's 2-column layout,
     each panel lives in a ~640px-wide left column where a 4-col grid
     would squeeze the selects to ~140px and truncate "— select —" to
     "— sele". 2-col gives each select ~280-300px. Mobile collapses to
     1-col below. */
  grid-template-columns: 1fr 1fr;
  gap: 12px 18px;
  align-items: start;
}
@media (max-width: 720px) {
  .anesthesia-panel__grid { grid-template-columns: 1fr; }
}
.anesthesia-panel__field { display: flex; flex-direction: column; gap: 4px; }
.anesthesia-panel__field input[type=number] {
  border: 1px solid var(--rule-soft);
  background: var(--paper, white);
  padding: 9px 10px;
  font: inherit;
  font-size: 14px;
}
.anesthesia-panel__field--narrow input { max-width: 96px; }
.anesthesia-panel__check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding-bottom: 10px;
  white-space: nowrap;
}
.anesthesia-panel__status { display: inline-block; margin-top: 10px; font-size: 12px; min-height: 1em; }
.anesthesia-panel select:disabled, .anesthesia-panel input:disabled { opacity: .45; cursor: not-allowed; }

/* Chief-complaint panel ---------------------------------------------------
   Mirrors .anesthesia-panel — same paper/ink/olive palette, same rule
   borders. Pain sub-panel is the contextual variant: indented + dashed
   border so it visually nests under the category control. */
.chief-complaint-panel {
  margin-top: 28px;
  padding: 18px 20px;
  border-top: 1px solid var(--rule-soft);
  border-bottom: 1px solid var(--rule-soft);
  background: var(--paper-2, transparent);
}
.chief-complaint-panel__head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
/* CC + HPI are now <details> so they're collapsible per-procedure. */
summary.chief-complaint-panel__head,
summary.hpi-panel__head {
  cursor: pointer;
  list-style: none;
}
summary.chief-complaint-panel__head::-webkit-details-marker,
summary.hpi-panel__head::-webkit-details-marker { display: none; }
.chief-complaint-panel__head .intake__kicker::before,
.hpi-panel__head .intake__kicker::before {
  content: "▸ ";
  color: var(--ink-muted);
}
.chief-complaint-panel[open] .chief-complaint-panel__head .intake__kicker::before,
.hpi-panel[open] .hpi-panel__head .intake__kicker::before { content: "▾ "; }
.cc-pain-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: 12px;
  color: var(--ink-muted);
  cursor: pointer;
  user-select: none;
}
.cc-pain-toggle input { cursor: pointer; }
.chief-complaint-panel__hint {
  font-size: 12px;
  color: var(--ink-muted);
}
.chief-complaint-panel__grid {
  display: grid;
  /* 2-col at desktop; mobile drops to 1-col. See anesthesia comment. */
  grid-template-columns: 1fr 1fr;
  gap: 12px 18px;
  align-items: start;
}
@media (max-width: 720px) {
  .chief-complaint-panel__grid { grid-template-columns: 1fr; }
}
.chief-complaint-panel__field { display: flex; flex-direction: column; gap: 4px; }
.chief-complaint-panel__field--wide { grid-column: span 1; }
.chief-complaint-panel__field--narrow input { max-width: 96px; }
.chief-complaint-panel__field input[type=text],
.chief-complaint-panel__field input[type=number] {
  border: 1px solid var(--rule-soft);
  background: var(--paper);
  padding: 9px 10px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
}
.chief-complaint-panel__pain {
  margin-top: 16px;
  margin-left: 14px;
  padding: 14px 16px;
  border: 1px dashed var(--rule-soft);
  background: var(--paper);
}
.chief-complaint-panel__pain-label {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--olive);
  margin-bottom: 10px;
}
.chief-complaint-panel__pain-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  align-items: start;
  margin-bottom: 12px;
}
@media (max-width: 720px) {
  .chief-complaint-panel__pain-grid { grid-template-columns: 1fr; }
}
.chief-complaint-panel__chips {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.chief-complaint-panel__chip-label {
  flex: 0 0 auto;
  min-width: 90px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.chief-complaint-panel__chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1 1 auto;
}
.cc-chip {
  appearance: none;
  border: 1px solid var(--rule-soft);
  background: var(--paper);
  color: var(--ink-muted);
  padding: 4px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  border-radius: 2px;
}
.cc-chip:hover { color: var(--ink); border-color: var(--ink); }
.cc-chip--on {
  background: var(--olive);
  color: var(--paper);
  border-color: var(--olive);
}
.cc-chip--on:hover { color: var(--paper); border-color: var(--olive); }
.cc-chip--add {
  border-style: dashed;
  color: var(--ink-faint);
}
.cc-chip--add:hover { color: var(--oxide); border-color: var(--oxide); border-style: solid; }
.chief-complaint-panel__status {
  display: inline-block;
  margin-top: 10px;
  font-size: 12px;
  min-height: 1em;
}

/* Panel visibility by visit appointment_type ----------------------------
   HPI lives only on focused_exam visits AND only when the Pain checkbox
   in the CC header is on (HPI captures the pain story — irrelevant
   otherwise). LA (anesthesia) is hidden on focused_exam.
   Driven by <body data-appt-type=...> rendered server-side + a
   data-cc-pain="1" attribute the Pain checkbox toggles, so there's no
   flash of the wrong panel set during JS hydration. */
#hpi-panel { display: none; }
body[data-appt-type="focused_exam"][data-cc-pain="1"] #hpi-panel { display: block; }
body[data-appt-type="focused_exam"] #anesthesia-panel { display: none; }
/* Pain checkbox's only job is to gate HPI — pointless on non-focused
   visits where HPI doesn't apply. */
body:not([data-appt-type="focused_exam"]) .cc-pain-toggle { display: none; }

/* Reset-note footer */
.visit-reset {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px dashed var(--rule-soft);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.visit-reset__btn {
  appearance: none;
  border: 1px dashed var(--rule);
  background: var(--paper);
  color: var(--ink-muted);
  font: inherit;
  font-size: 12px;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 2px;
}
.visit-reset__btn:hover { color: var(--oxide); border-color: var(--oxide); }
.visit-reset__hint { font-size: 11.5px; color: var(--ink-faint); }

/* Exam Type dropdown -----------------------------------------------------
   Tiny panel sitting between the odontogram and the Chief Complaint panel.
   Shown only for focused_exam notes (JS toggles `hidden`). */
.exam-type-panel {
  margin-top: 22px;
  padding: 14px 20px;
  border-top: 1px solid var(--rule-soft);
  border-bottom: 1px solid var(--rule-soft);
  background: var(--paper-2, transparent);
}
.exam-type-panel[hidden] { display: none; }
.exam-type-panel__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 460px;
}
.exam-type-panel__status {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  min-height: 1em;
}

/* Diagnosis panel ---------------------------------------------------------
   Grouped multi-select dropdown; each pick becomes a removable chip. Same
   paper/ink/olive palette and rule borders as the CC + HPI panels. */
.diagnosis-panel {
  margin-top: 28px;
  padding: 18px 20px;
  border-top: 1px solid var(--rule-soft);
  border-bottom: 1px solid var(--rule-soft);
  background: var(--paper-2, transparent);
}
.diagnosis-panel__head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.diagnosis-panel__hint { font-size: 12px; color: var(--ink-muted); }
.diagnosis-panel__status {
  display: inline-block;
  margin-top: 10px;
  font-size: 12px;
  min-height: 1em;
}

/* Diagnosis accordion — one collapsible card per category. */
.dx-accordion {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.dx-cat {
  border: 1px solid var(--rule-soft);
  background: var(--paper);
}
.dx-cat__summary {
  cursor: pointer;
  padding: 9px 12px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  list-style: none;
}
.dx-cat__summary::-webkit-details-marker { display: none; }
.dx-cat__summary::before { content: "▸ "; color: var(--ink-muted); }
.dx-cat[open] .dx-cat__summary::before { content: "▾ "; }
.dx-cat__items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 12px 12px;
}
.dx-cat__item {
  appearance: none;
  border: 1px solid var(--rule-soft);
  background: var(--paper-2, transparent);
  color: var(--ink-muted);
  padding: 5px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  border-radius: 2px;
}
.dx-cat__item:hover { color: var(--ink); border-color: var(--ink); }
.dx-cat__item--on {
  background: var(--olive);
  color: var(--paper);
  border-color: var(--olive);
}
.dx-cat__item--on:hover { color: var(--paper); border-color: var(--olive); }

/* Selected-diagnosis rows. */
.dx-selected { display: flex; flex-direction: column; gap: 10px; }
.dx-selected__empty { font-size: 12px; color: var(--ink-faint); margin: 4px 0; }
.dx-row {
  border: 1px solid var(--rule-soft);
  background: var(--paper);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.dx-row__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.dx-row__name {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--ink);
}
.dx-row__remove {
  appearance: none;
  border: 0;
  background: none;
  color: var(--ink-soft, #999);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}
.dx-row__remove:hover { color: var(--oxide); }
.dx-row__options { font-size: 12.5px; color: var(--ink-muted); line-height: 1.5; }
.dx-row__teeth {
  border: 1px solid var(--rule-soft);
  background: var(--paper-2, transparent);
  padding: 7px 9px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
}

/* Assistant strip ---------------------------------------------------------
   One-line "Assisted by" input that drives the trailing line on every
   rendered narrative. Sits just above the procedure tabs at page top. */
.assistant-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0 14px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--rule-soft);
}
.assistant-strip__field {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex: 1 1 auto;
}
.assistant-strip__field .field-label { margin-bottom: 0; }
.assistant-strip__field input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  border-bottom: 1px solid var(--rule-soft);
  background: transparent;
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  padding: 4px 2px;
  outline: none;
}
.assistant-strip__field input:focus { border-bottom-color: var(--ink); }
.assistant-strip__status {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  flex: 0 0 auto;
}
.assistant-strip__status.status--err { color: var(--accent-err, #b14); }
.assistant-strip__status.status--ok { color: var(--ink-muted); }

/* "Treatment rendered today" panel ---------------------------------------
   Free-text capture of what was actually performed at this visit. Sits
   just above the phased Treatment Plan. */
.treatment-today-panel {
  margin-top: 28px;
  padding: 18px 20px;
  border-top: 1px solid var(--rule-soft);
  border-bottom: 1px solid var(--rule-soft);
  background: var(--paper-2, transparent);
}
.treatment-today-panel__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}
.treatment-today-panel__field textarea {
  width: 100%;
  resize: vertical;
  min-height: 64px;
  border: 1px solid var(--rule-soft);
  background: var(--paper);
  padding: 8px 10px;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  box-sizing: border-box;
}

/* Treatment Plan panel ----------------------------------------------------
   Phased planner: 5 individually collapsible phase cards. Each phase is a
   checklist of standard procedures + custom items. Each item: checkbox +
   tooth/area field + up/down reorder. A phase can be marked completed. */
.treatment-plan-panel {
  margin-top: 28px;
  padding: 18px 20px;
  border-top: 1px solid var(--rule-soft);
  border-bottom: 1px solid var(--rule-soft);
  background: var(--paper-2, transparent);
}
.txp-phases {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
}
.txp-phase {
  border: 1px solid var(--rule-soft);
  background: var(--paper);
}
.txp-phase__summary {
  cursor: pointer;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  list-style: none;
}
.txp-phase__summary::-webkit-details-marker { display: none; }
.txp-phase__name {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--olive);
}
.txp-phase__name::before { content: "▸ "; color: var(--ink-muted); }
.txp-phase[open] .txp-phase__name::before { content: "▾ "; }
.txp-phase__count {
  display: inline-block;
  background: var(--olive);
  color: var(--paper);
  font-size: 10px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 8px;
  letter-spacing: 0;
}
.txp-phase__body { padding: 2px 12px 12px; }
.txp-phase__complete {
  appearance: none;
  border: 1px solid var(--rule-soft);
  background: var(--paper);
  color: var(--ink-muted);
  font: inherit;
  font-size: 11px;
  padding: 3px 9px;
  cursor: pointer;
  border-radius: 2px;
  white-space: nowrap;
}
.txp-phase__complete:hover { color: var(--ink); border-color: var(--ink); }
.txp-phase__complete.is-done {
  background: var(--olive);
  color: var(--paper);
  border-color: var(--olive);
}
.txp-phase__items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.txp-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.txp-item__check { flex: 0 0 auto; width: 16px; height: 16px; cursor: pointer; }
.txp-item__label {
  flex: 1 1 auto;
  font-size: 13px;
  color: var(--ink-muted);
}
.txp-item.is-checked .txp-item__label { color: var(--ink); }
.txp-item__teeth {
  flex: 0 0 auto;
  width: 170px;
  border: 1px solid var(--rule-soft);
  background: var(--paper);
  padding: 6px 8px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
}
.txp-item__move {
  appearance: none;
  border: 1px solid var(--rule-soft);
  background: var(--paper);
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
}
.txp-item__move:hover:not(:disabled) { color: var(--ink); border-color: var(--ink); }
.txp-item__move:disabled { opacity: 0.3; cursor: default; }
.txp-item__remove {
  appearance: none;
  border: 0;
  background: none;
  color: var(--ink-soft, #999);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.txp-item__remove:hover { color: var(--oxide); }
.txp-phase__add-custom {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  max-width: 420px;
}
.txp-phase__custom-input {
  flex: 1 1 auto;
  border: 1px solid var(--rule-soft);
  background: var(--paper);
  padding: 6px 8px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
}
.txp-phase__custom-add {
  appearance: none;
  border: 1px dashed var(--rule);
  background: var(--paper);
  color: var(--ink-faint);
  font: inherit;
  font-size: 12px;
  padding: 6px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.txp-phase__custom-add:hover { color: var(--oxide); border-color: var(--oxide); }
@media (max-width: 720px) {
  .treatment-plan-panel { padding: 16px 14px; }
  .txp-item { flex-wrap: wrap; }
  .txp-item__label { flex: 1 1 60%; }
  .txp-item__teeth { flex: 1 1 100%; width: auto; order: 5; }
}

/* HPI panel ---------------------------------------------------------------
   Mirrors .chief-complaint-panel — same paper/ink/olive palette, same rule
   borders. Lives directly under the CC panel and reuses the .cc-chip
   toggle (visit.js renderHpiChipRow attaches that class). */
.hpi-panel {
  margin-top: 28px;
  padding: 18px 20px;
  border-top: 1px solid var(--rule-soft);
  border-bottom: 1px solid var(--rule-soft);
  background: var(--paper-2, transparent);
}
.hpi-panel__head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.hpi-panel__hint {
  font-size: 12px;
  color: var(--ink-muted);
}
.hpi-panel__grid {
  display: grid;
  /* 2-col at desktop. Mobile falls to 1-col. See anesthesia comment for
     why we don't go wider — the visit page's 2-column desktop layout
     leaves each panel ~640px wide. */
  grid-template-columns: 1fr 1fr;
  gap: 12px 18px;
  align-items: start;
  margin-top: 12px;
}
.hpi-panel__grid--secondary {
  grid-template-columns: 1fr 1fr;
  margin-top: 16px;
}
@media (max-width: 720px) {
  .hpi-panel__grid { grid-template-columns: 1fr; }
  .hpi-panel__grid--secondary { grid-template-columns: 1fr; }
}
.hpi-panel__field { display: flex; flex-direction: column; gap: 4px; }
.hpi-panel__field--full { width: 100%; }
.hpi-panel__field input[type=text],
.hpi-panel__field input[type=number] {
  border: 1px solid var(--rule-soft);
  background: var(--paper);
  padding: 9px 10px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
}
.hpi-panel__textarea {
  border: 1px solid var(--rule-soft);
  background: var(--paper);
  padding: 9px 10px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  width: 100%;
  resize: vertical;
  min-height: 64px;
}
.hpi-panel__chips {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.hpi-panel__chip-label {
  flex: 0 0 auto;
  min-width: 90px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.hpi-panel__chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1 1 auto;
}
.hpi-panel__status {
  display: inline-block;
  margin-top: 10px;
  font-size: 12px;
  min-height: 1em;
}

.focused-spec-panel {
  margin-top: 28px;
  padding: 18px 20px;
  border-top: 1px solid var(--rule-soft);
  border-bottom: 1px solid var(--rule-soft);
  background: var(--paper-2, transparent);
}
.focused-spec-panel[hidden] { display: none; }
.focused-spec-panel__head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 4px;
  flex-wrap: wrap;
  cursor: pointer;
  list-style: none;
}
.focused-spec-panel__head::-webkit-details-marker { display: none; }
.focused-spec-panel__head .intake__kicker::before { content: "▸ "; color: var(--ink-muted); }
.focused-spec-panel[open] .focused-spec-panel__head .intake__kicker::before { content: "▾ "; }
.focused-spec-panel__hint {
  font-size: 12px;
  color: var(--ink-muted);
}
.focused-spec-panel__body { margin-top: 14px; }
.focused-spec-panel__section { margin-top: 16px; }
.focused-spec-panel__section:first-child { margin-top: 0; }
.focused-spec-panel__section-label {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 8px;
}
.focused-spec-panel__row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.focused-spec-panel__row-label {
  flex: 0 0 auto;
  min-width: 140px;
  font-size: 13px;
  color: var(--ink);
}
.focused-spec-panel__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1 1 auto;
}
@media (max-width: 720px) {
  .focused-spec-panel__row { flex-direction: column; align-items: stretch; gap: 6px; }
  .focused-spec-panel__row-label { min-width: 0; }
}

/* --- Focused exam details sub-section --- */
.focused-spec-panel__details { border-top: 1px solid var(--rule-soft); padding-top: 16px; }
.focused-spec-panel__details-group-label {
  font-size: 11px;
  font-family: var(--font-mono, ui-monospace, monospace);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 12px 0 4px;
}
.focused-spec-panel__details-row {
  margin-top: 6px;
}
.focused-spec-panel__details-label {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
  color: var(--ink);
  flex-wrap: wrap;
}
.focused-spec-panel__details-input {
  flex: 1 1 180px;
  min-width: 120px;
  padding: 4px 8px;
  border: 1px solid var(--rule-soft);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}
.focused-spec-panel__details-input:focus {
  outline: none;
  border-color: var(--ink);
}
.focused-spec-panel__details-textarea {
  flex: 1 1 100%;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--rule-soft);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  resize: vertical;
  box-sizing: border-box;
}
.focused-spec-panel__details-textarea:focus {
  outline: none;
  border-color: var(--ink);
}
.focused-spec-panel__row-input {
  flex: 0 1 120px;
  min-width: 80px;
  padding: 3px 8px;
  border: 1px solid var(--rule-soft);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}
.focused-spec-panel__row-input:focus { outline: none; border-color: var(--ink); }

.mio-badge {
  display: inline-block;
  min-width: 0;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-family: var(--font-mono, ui-monospace, monospace);
}
.mio-badge:empty { display: none; }
.mio-badge--normal     { background: #e6f4ea; color: #137333; border: 1px solid #b7e1c1; }
.mio-badge--restricted { background: #fef7e0; color: #8a5d00; border: 1px solid #f1d97a; }
.mio-badge--severe     { background: #fce8e6; color: #b3261e; border: 1px solid #f3b3ad; }

.focused-spec-panel__tooth-pickers { margin-top: 8px; }
.focused-spec-panel__tooth-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.focused-spec-panel__tooth-input {
  width: 56px;
  padding: 4px 8px;
  border: 1px solid var(--rule-soft);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  text-align: center;
}
.focused-spec-panel__tooth-input:focus {
  outline: none;
  border-color: var(--ink);
}
.focused-spec-panel__tooth-select {
  padding: 4px 6px;
  border: 1px solid var(--rule-soft);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}
.focused-spec-panel__tooth-add-btn {
  appearance: none;
  padding: 4px 12px;
  border: 1px solid var(--ink-muted);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.focused-spec-panel__tooth-add-btn:hover { border-color: var(--ink); }
.focused-spec-panel__tooth-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  min-height: 8px;
}
/* Tooth chips use .cc-chip but are not toggleable — just removable. */
.focused-spec-panel__tooth-chip { cursor: pointer; }
.focused-spec-panel__tooth-chip:hover { border-color: var(--oxide); color: var(--oxide); }
.focused-spec-panel__details-status {
  display: inline-block;
  margin-top: 10px;
  font-size: 12px;
  min-height: 1em;
}
.focused-spec-panel__diag-matrix { margin-top: 8px; }
.focused-spec-panel__diag-matrix-table {
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 6px;
}
.focused-spec-panel__diag-matrix-table th,
.focused-spec-panel__diag-matrix-table td {
  border: 1px solid var(--rule-soft);
  padding: 2px 4px;
  text-align: center;
  min-width: 26px;
}
.focused-spec-panel__diag-matrix-table th {
  background: var(--surface-2);
  color: var(--ink-muted);
  font-weight: 600;
  font-size: 11px;
}
.focused-spec-panel__diag-matrix-fdi {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--surface-2);
  color: var(--ink-muted);
}
.focused-spec-panel__diag-matrix-btn {
  background: transparent;
  border: 0;
  width: 100%;
  min-height: 22px;
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--ink);
}
.focused-spec-panel__diag-matrix-btn:hover { background: var(--surface-3); }
.focused-spec-panel__diag-matrix-del { width: 22px; }
.focused-spec-panel__diag-matrix-del-btn {
  background: transparent;
  border: 0;
  width: 22px;
  height: 22px;
  cursor: pointer;
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 1;
}
.focused-spec-panel__diag-matrix-del-btn:hover { color: var(--oxide); }
.focused-spec-panel__diag-matrix-add {
  display: flex;
  gap: 6px;
  align-items: center;
}

.submit-row {
  margin-top: 32px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.submit {
  appearance: none;
  border: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 18px 32px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.18s cubic-bezier(.2,.8,.3,1);
}
.submit:hover { transform: translateY(-1px); }
.submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.submit__arrow {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1;
  font-weight: 300;
  transition: transform 0.2s ease;
}
.submit:hover .submit__arrow { transform: translateX(4px); }
.submit.is-loading .submit__arrow { opacity: 0; }
.submit.is-loading::after {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid rgba(246,241,230,0.2);
  border-top-color: var(--paper);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: -20px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.status {
  font-size: 13px;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
}
.status--err { color: var(--oxide); }
.status--ok { color: var(--olive); }

/* ==== results ==== */
.results {
  max-width: var(--max);
  margin: 72px auto 0;
  animation: reveal 0.55s cubic-bezier(.2,.8,.3,1);
}
@keyframes reveal {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.results__head {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.results__title-wrap {
  display: flex;
  align-items: baseline;
  gap: 18px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 18px;
}
.results__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(30px, 3.6vw, 42px);
  margin: 0;
  letter-spacing: -0.005em;
}
.results__meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.06em;
}

.tabs {
  position: relative;
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--rule-soft);
}
.tab {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 14px 24px 14px 0;
  margin-right: 24px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink-faint);
  cursor: pointer;
  transition: color 0.18s ease;
  position: relative;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); }
.tab-underline {
  position: absolute;
  bottom: -1px;
  left: 0;
  height: 1px;
  background: var(--ink);
  transition: left 0.35s cubic-bezier(.2,.8,.3,1),
              width 0.35s cubic-bezier(.2,.8,.3,1);
}

.panels { margin-top: 28px; }
.panel { display: none; }
.panel--active { display: block; }
.panel__actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}
.panel__actions--split {
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.note-mode {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.note-mode__btn {
  appearance: none;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink-muted);
  padding: 6px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.note-mode__btn + .note-mode__btn { border-left-width: 0; }
.note-mode__btn:hover { color: var(--ink); }
.note-mode__btn--active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.note-mode__revert {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 6px 4px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.note-mode__revert:hover { color: var(--ink); }
.note-mode__status {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
}
.note-mode__status.status--err { color: var(--accent-err, #b14); }
.note-mode__status.status--ok { color: var(--ink-muted); }

.galley--edit {
  width: 100%;
  display: block;
  resize: vertical;
  min-height: 320px;
  border: 0;
  border-left: 2px solid var(--ink);
  outline: none;
  box-sizing: border-box;
}
.galley--edit:focus { border-left-color: var(--ink); }
.copy-btn {
  appearance: none;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink);
  padding: 7px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.copy-btn:hover { background: var(--ink); color: var(--paper); }
.copy-btn.is-copied { background: var(--olive); border-color: var(--olive); color: var(--paper); }

.galley {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--paper-2);
  padding: 36px 44px;
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  border-left: 2px solid var(--oxide);
  min-height: 200px;
  max-width: 80ch;
}
.galley--muted {
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
  border-left-color: var(--ink-faint);
}
.galley--mono {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  border-left-color: var(--amber);
}

/* Rendered notes often use **bold** for headers (Clinic B structured). Style them. */
.galley strong { color: var(--ink); font-weight: 600; letter-spacing: 0.005em; }

/* ==== reviewer's marks ==== */
.review {
  margin-top: 44px;
  border-top: 1px solid var(--rule);
  padding-top: 32px;
  animation: reveal 0.6s cubic-bezier(.2,.8,.3,1) 0.1s both;
}
.review__head {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.review__stamp {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--oxide);
  border: 1px solid var(--oxide);
  padding: 4px 10px;
}
.review__title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 24px;
  margin: 0;
  color: var(--ink);
}
.review__body {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 36px;
}
@media (max-width: 720px) {
  .review__body { grid-template-columns: 1fr; }
}
.review__col h4 {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 500;
  margin: 0 0 12px;
}
.review__col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.review__col li {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  padding: 12px 0 12px 26px;
  border-top: 1px solid var(--rule-soft);
  position: relative;
}
.review__col li:first-child { border-top: 0; padding-top: 0; }
.review__col li:first-child::before { top: -2px; }
.review__col li::before {
  content: "⚠";
  position: absolute;
  left: 0;
  top: 14px;
  color: var(--oxide);
  font-style: normal;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
}
.review__col--missing li::before { content: "✗"; color: var(--oxide); font-weight: 600; }
.review__col--missing li { color: var(--oxide); }
.review__col--empty li::before { content: "✓"; color: var(--olive); }
.review__col--empty li { color: var(--olive); font-style: normal; font-weight: 500; font-size: 14px; font-family: var(--font-sans); }

/* ==== colophon ==== */
.colophon {
  max-width: var(--max);
  margin: 80px auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--rule-soft);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.colophon__dot { color: var(--oxide); }

/* ==== login page ==== */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px var(--page-px);
}
.login-shell {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.login-mast {
  text-align: left;
  margin-bottom: 4px;
}
.rule--login { margin: 24px 0 40px; max-width: none; }

.login-card {
  border: 1px solid var(--rule-soft);
  padding: 44px 44px 40px;
  background: var(--paper);
  position: relative;
}
.login-card::before {
  /* tiny corner tick that makes it feel like a filed document */
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  width: 24px;
  height: 24px;
  border-top: 2px solid var(--oxide);
  border-left: 2px solid var(--oxide);
}
.login-card__head { margin-bottom: 28px; }
.login-card__kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--oxide);
}
.login-card__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 34px;
  line-height: 1.12;
  margin: 12px 0 12px;
  letter-spacing: -0.01em;
}
.login-card__body {
  font-size: 14px;
  color: var(--ink-muted);
  margin: 0;
  line-height: 1.6;
  max-width: 38ch;
}

.login-error {
  border: 1px solid var(--oxide);
  background: var(--oxide-soft);
  color: var(--oxide);
  padding: 12px 16px;
  font-size: 13.5px;
  font-family: var(--font-sans);
  margin-bottom: 24px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.login-error__mark {
  font-weight: 600;
  font-family: var(--font-sans);
}

.login-form { display: flex; flex-direction: column; gap: 22px; }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field input {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 16px;
  padding: 12px 14px;
  background: var(--paper-2);
  border: 1px solid var(--rule-soft);
  border-radius: 0;
  color: var(--ink);
  outline: none;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.login-field input:focus {
  border-color: var(--ink);
  background: var(--paper);
}
.login-field input:-webkit-autofill,
.login-field input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--paper-2) inset;
  -webkit-text-fill-color: var(--ink);
}

.submit--full {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 18px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--oxide);
}
.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--rule-soft);
}

.google-signin {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  background: var(--paper-2);
  border: 1px solid var(--rule-soft);
  transition: border-color 0.18s ease, background 0.18s ease;
}
.google-signin:hover {
  border-color: var(--ink);
  background: var(--paper);
}
.google-signin__logo {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.colophon--login { margin-top: 36px; }

/* ==== signed-in greeting pill (masthead) ==== */
.greeting {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 400;
  font-style: italic;
  font-size: 18px;
  color: var(--ink);
  margin-top: 14px;
}
.greeting__hi {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--oxide);
}
.greeting__name {
  font-weight: 400;
  letter-spacing: -0.005em;
}
.logout-link {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-decoration: none;
  margin-left: 12px;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color 0.18s ease, border-color 0.18s ease;
}
.logout-link:hover {
  color: var(--oxide);
  border-bottom-color: var(--oxide);
}
/* The "What's new" trigger is a <button> but must read as a peer of the
   anchor links — reset the UA button chrome, keep the .logout-link type. */
.logout-link--btn {
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 0 0 2px;
  cursor: pointer;
  vertical-align: baseline;
}

/* ==== misc ==== */
::selection { background: var(--ink); color: var(--paper); }

/* ==== planner day view ==== */
.day-head { display:flex; justify-content:space-between; align-items:baseline; gap:18px; flex-wrap:wrap; margin-bottom:18px; border-bottom:1px solid var(--rule); padding-bottom:14px; }
.day-title { font-family: var(--font-display); font-weight:400; font-size: clamp(28px, 3.6vw, 38px); margin:0; letter-spacing:-0.005em; }
.date-nav { display:flex; gap:4px; font-family: var(--font-mono); font-size:11px; }
.date-nav__btn { padding:5px 12px; color: var(--ink-muted); text-decoration:none; border:1px solid transparent; }
.date-nav__btn:hover { color: var(--ink); border-color: var(--rule-soft); }
.date-nav__btn--today { background: var(--ink); color: var(--paper); }

.filter-row { display:flex; gap:6px; flex-wrap:wrap; margin: 14px 0 18px; }
.clinic-pill { background: transparent; border:1px solid var(--rule-soft); color: var(--ink-muted); padding:4px 10px; font-size:11px; cursor:pointer; font-family: var(--font-sans); display:inline-flex; align-items:center; gap:6px; }
.clinic-pill:hover { color: var(--ink); border-color: var(--rule); }
.clinic-pill--active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.swatch { display:inline-block; width:8px; height:8px; border-radius:999px; }

.visit-list { display:flex; flex-direction:column; gap:1px; }
.visit-row { display:grid; grid-template-columns: 110px 1fr 140px 130px 28px; gap:8px; align-items:center; padding: 6px 6px 6px 10px; background:#fff; border-bottom:1px solid rgba(29,45,58,0.10); color: var(--ink); transition: background 0.15s ease; }
.visit-row:hover { background: #fbf6e9; }
.visit-link { display:grid; grid-template-columns: 4px 1fr; gap:14px; align-items:center; padding:6px 10px; text-decoration:none; color: var(--ink); }
.visit-when { display:flex; flex-direction:column; gap:2px; }
.visit-time-edit, .visit-date-edit { background: transparent; border: 1px solid transparent; padding: 2px 4px; font-family: var(--font-mono); font-size: 12px; color: var(--ink); }
.visit-time-edit:hover, .visit-date-edit:hover, .visit-time-edit:focus, .visit-date-edit:focus { border-color: var(--rule-soft); background: var(--paper-2); outline: none; }
.visit-date-edit { font-size: 10.5px; color: var(--ink-muted); }
.visit-row.is-saving { opacity: 0.6; }
.visit-row.is-leaving { opacity: 0; transform: translateX(-12px); transition: opacity 0.25s, transform 0.25s; }
.visit-time { font-family: var(--font-mono); font-size:13px; font-weight:500; }
.visit-spine { width:3px; height:28px; }
.visit-main { display:flex; flex-direction:column; }
.visit-name { font-weight:500; font-size:14px; }
.visit-sub { font-size:11.5px; color: var(--ink-muted); margin-top:2px; }
.visit-clinic { font-family: var(--font-mono); font-size:10px; letter-spacing:0.15em; text-transform:uppercase; color: var(--ink-muted); }
.visit-status { display:inline-flex; align-items:center; justify-content:center; padding:3px 9px; border:1px solid; font-family: var(--font-mono); font-size:10px; letter-spacing:0.18em; text-transform:uppercase; }
.visit-status--planned { color: var(--ink-muted); border-color: var(--rule-soft); }
.visit-status--in_progress { color: var(--amber); border-color: var(--amber); background: rgba(195,139,59,0.08); }
.visit-status--completed { color: var(--olive); border-color: var(--olive); background: rgba(74,94,53,0.06); }
.visit-status--cancelled { color: var(--oxide); border-color: var(--oxide); text-decoration: line-through; }

/* per-row status select reuses the visit-status--<status> color rules */
.visit-status-select { font-family: var(--font-mono); font-size:10px; letter-spacing:0.18em; text-transform:uppercase; padding: 3px 6px; border: 1px solid var(--rule-soft); background: var(--paper); cursor: pointer; max-width: 130px; }

.visit-appt-select { font-family: var(--font-sans); font-size: 12px; padding: 4px 6px; border: 1px solid var(--rule-soft); background: var(--paper); color: var(--ink); cursor: pointer; max-width: 140px; }
.visit-appt-select:hover { border-color: var(--ink); }
.visit-status-select.visit-status--in_progress { color: var(--amber); border-color: var(--amber); background: rgba(195,139,59,0.08); }
.visit-status-select.visit-status--completed { color: var(--olive); border-color: var(--olive); background: rgba(74,94,53,0.06); }
.visit-status-select.visit-status--cancelled { color: var(--oxide); border-color: var(--oxide); }
.visit-status-select:hover { border-color: var(--ink); }

.visit-delete { background: transparent; border: 0; color: var(--ink-muted); font-size: 18px; cursor: pointer; padding: 0; line-height: 1; }
.visit-delete:hover { color: var(--oxide); }

.empty { padding: 30px; text-align:center; color: var(--ink-muted); border:1px dashed var(--rule-soft); }

.add-btn { display:inline-flex; align-items:center; gap:8px; background: var(--ink); color: var(--paper); border:0; padding:12px 18px; font-size:12px; font-weight:500; cursor:pointer; margin-top:22px; }
.add-btn .plus { font-size:18px; line-height:1; }

/* ==== add-visit dialog ==== */
dialog.drawer { border:0; padding:0; background: var(--paper); max-width: 520px; width: 92vw; }
dialog.drawer::backdrop { background: rgba(15,36,51,0.30); backdrop-filter: blur(2px); }
.drawer form { padding: 24px 26px; display: flex; flex-direction: column; gap: 12px; }
.drawer__kicker { color: var(--oxide); }
.drawer__title { font-family: var(--font-display); font-style:italic; font-weight:400; font-size:22px; margin: 4px 0 10px; }
.field { display:flex; flex-direction:column; gap:4px; }
.field-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-muted); }
.field input, .field select { background: var(--paper-2); border: 1px solid var(--rule-soft); padding: 8px 10px; font-family: inherit; font-size: 13px; color: var(--ink); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.drawer-actions { display:flex; gap:8px; margin-top:6px; }
.btn-primary { background: var(--ink); color: var(--paper); border:0; padding:10px 18px; font-size:12px; cursor:pointer; }
.btn-ghost { background: transparent; color: var(--ink-muted); border:0; padding:10px 14px; font-size:12px; cursor:pointer; }
.drawer-error { color: var(--oxide); font-size: 12px; }

/* ==== "What's new" changelog modal ==== */
dialog.drawer--changelog { max-width: 560px; }
.changelog {
  padding: 22px 26px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 80vh;
  overflow-y: auto;
}
.changelog__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.changelog__close {
  background: none;
  border: 0;
  font-size: 22px;
  line-height: 1;
  color: var(--ink-soft, #999);
  cursor: pointer;
  padding: 0 2px;
}
.changelog__close:hover { color: var(--ink); }
.changelog__list {
  list-style: none;
  margin: 8px 0 4px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.changelog__entry {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule-soft);
}
.changelog__entry:last-child { border-bottom: 0; padding-bottom: 0; }
.changelog__date {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--oxide);
  margin-bottom: 4px;
}
.changelog__entry-title {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--ink);
  margin-bottom: 8px;
}
.changelog__items {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.changelog__items li {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-muted);
}
.changelog__empty { font-size: 13px; color: var(--ink-muted); margin: 12px 0; }

/* ==== visit page header ==== */
.back-link { font-family: var(--font-mono); font-size:11px; color: var(--ink-muted); text-decoration:none; display:inline-block; margin-bottom: 12px; }
.back-link:hover { color: var(--ink); }
.visit-header { display:grid; grid-template-columns: 4px 1fr auto; gap:14px; align-items:center; padding: 16px 18px; background: var(--paper-2); margin-bottom: 22px; }
.vh-spine { width:4px; height:48px; }
.vh-main { display:flex; flex-direction:column; gap:2px; }
.vh-clinic { font-family: var(--font-mono); font-size:10px; letter-spacing:0.18em; text-transform:uppercase; color: var(--ink-muted); }
.vh-name { font-family: var(--font-display); font-weight:400; font-size: 22px; margin: 0; }
.vh-appt { font-size: 12px; color: var(--ink-muted); }

/* ==== flag chips (Wave 3) ==== */
.flag-card { padding: 12px 14px; border:1px solid var(--rule-soft); margin-bottom: 10px; background: var(--paper); }
.flag-card--applied { background: rgba(74,94,53,0.06); border-color: var(--olive); }
.flag-card--dismissed { background: var(--paper-2); color: var(--ink-muted); text-decoration: line-through; }
.flag-text { margin: 0 0 8px; font-size: 13px; line-height: 1.5; }
.flag-stamp { font-family: var(--font-mono); font-size:10px; letter-spacing:0.18em; text-transform:uppercase; color: var(--ink-muted); }
.chip-row { display:flex; gap:6px; flex-wrap:wrap; }
.chip { background: var(--paper-2); border: 1px solid var(--rule-soft); color: var(--ink); padding: 5px 12px; font-size: 11.5px; font-family: var(--font-sans); cursor: pointer; }
.chip:hover { border-color: var(--ink); }
.chip--rec { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip--rec:hover { background: var(--olive); border-color: var(--olive); }
.chip--dismiss { color: var(--ink-muted); }
.chip--type { color: var(--ink); font-style: italic; }
.chip-edit-input { flex: 1 1 160px; min-width: 120px; background: var(--paper); border: 1px solid var(--rule-soft); color: var(--ink); padding: 5px 10px; font-size: 12px; font-family: var(--font-sans); }
.chip-edit-input:focus { outline: none; border-color: var(--ink); }
.chip-edit-save { background: var(--ink); color: var(--paper); border: 1px solid var(--ink); padding: 5px 12px; font-size: 11.5px; font-family: var(--font-sans); cursor: pointer; }
.chip-edit-save:hover:not(:disabled) { background: var(--olive); border-color: var(--olive); }
.chip-edit-save:disabled { opacity: 0.45; cursor: not-allowed; }
.chip-edit-cancel { background: var(--paper-2); border: 1px solid var(--rule-soft); color: var(--ink-muted); padding: 5px 12px; font-size: 11.5px; font-family: var(--font-sans); cursor: pointer; }
.chip-edit-cancel:hover { border-color: var(--ink); color: var(--ink); }
.flags-empty { font-size: 12px; color: var(--ink-muted); margin: 0; }

/* ==== refine composer + diff modal (Wave 4) ==== */
.refine-composer { margin-top: 28px; padding: 18px 20px; border-top: 1px solid var(--rule-soft); }
.refine-head { margin-bottom: 8px; }
.refine-kicker { color: var(--oxide); }
.refine-title { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 18px; margin: 4px 0 10px; }
.refine-composer textarea { width: 100%; box-sizing: border-box; background: var(--paper-2); border: 1px solid var(--rule-soft); padding: 10px 12px; font-family: inherit; font-size: 13px; color: var(--ink); }
.refine-actions { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.refine-rec { background: transparent; border: 1px solid var(--rule-soft); color: var(--ink-muted); padding: 8px 14px; font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.refine-rec-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--oxide); display: inline-block; }
.refine-status { font-family: var(--font-mono); font-size: 11px; color: var(--ink-muted); }

.diff-list { list-style: none; padding: 0; margin: 8px 0 16px; max-height: 50vh; overflow-y: auto; }
.diff-row { display: grid; grid-template-columns: 1fr auto auto auto auto; gap: 8px; align-items: center; padding: 8px 6px; border-bottom: 1px solid var(--rule-soft); font-size: 12px; }
.diff-row--hard { background: rgba(195, 70, 70, 0.04); }
.diff-path { font-family: var(--font-mono); color: var(--ink); }
.diff-before { color: var(--oxide); font-family: var(--font-mono); white-space: pre; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.diff-after { color: var(--olive); font-family: var(--font-mono); white-space: pre; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.diff-arrow { color: var(--ink-muted); font-family: var(--font-mono); }
.diff-stamp { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--oxide); }

/* ==== async stage labels (Wave 5) ==== */
.status::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--olive); margin-right: 6px; vertical-align: middle; animation: pulse 1.4s ease-in-out infinite; }
.status--ok::before { background: var(--olive); animation: none; }
.status--err::before { background: var(--oxide); animation: none; }
@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1.0; } }

/* ==== voice planner modal + draft preview (Wave 8) ==== */

/* Ghost-variant of the existing add button — used for the voice planner CTA. */
.add-btn--ghost {
  background: transparent;
  border: 1px solid var(--rule-soft);
  color: var(--ink);
  margin-left: 8px;
}
.add-btn--ghost:hover { border-color: var(--ink); }

/* Voice planner modal */
.recorder { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 14px 0; }
.recorder .rec-meta { font-family: var(--font-mono); font-size: 11px; color: var(--ink-muted); display: flex; gap: 10px; align-items: center; }
.vp-stage { font-family: var(--font-mono); font-size: 12px; color: var(--ink-muted); padding: 8px 0; }
.vp-stage::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--olive); margin-right: 6px; vertical-align: middle; animation: pulse 1.4s ease-in-out infinite; }

/* Draft preview page */
.back-link { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-muted); text-decoration: none; }
.back-link:hover { color: var(--ink); }
.draft-summary { font-family: var(--font-mono); font-size: 12px; color: var(--ink-muted); margin: 8px 0 18px; letter-spacing: 0.04em; }
.draft-date-head { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 20px; color: var(--ink); margin: 22px 0 10px; }
.draft-row {
  display: grid;
  grid-template-columns: 90px 110px 1fr 28px;
  gap: 10px;
  align-items: center;
  padding: 10px 4px;
  border-bottom: 1px solid var(--rule-soft);
}
.draft-row input.draft-row__clinic { display: none; }
.draft-row input,
.draft-row select {
  background: var(--paper-2);
  border: 1px solid var(--rule-soft);
  color: var(--ink);
  padding: 6px 8px;
  font-family: inherit;
  font-size: 13px;
}
.draft-row input:focus,
.draft-row select:focus { outline: none; border-color: var(--ink); }
.draft-row select.flagged,
.draft-row input.flagged { border-bottom: 2px solid var(--oxide); }

.draft-row__delete {
  background: transparent;
  border: none;
  color: var(--ink-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
}
.draft-row__delete:hover { color: var(--oxide); }

.transcript-panel { margin: 28px 0 14px; }
.transcript-panel summary { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-muted); cursor: pointer; padding: 6px 0; }
.transcript-panel pre { background: var(--paper-2); border: 1px solid var(--rule-soft); padding: 12px 14px; font-family: var(--font-mono); font-size: 12px; color: var(--ink); white-space: pre-wrap; word-break: break-word; max-height: 240px; overflow-y: auto; }

.draft-actions { display: flex; gap: 10px; align-items: center; margin-top: 22px; flex-wrap: wrap; }
.draft-status { font-family: var(--font-mono); font-size: 11px; color: var(--ink-muted); }
.draft-status.status--err { color: var(--oxide); }
.draft-status.status--ok { color: var(--olive); }

/* ==== voice planner image tab (Wave 9) ==== */
.vp-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--rule-soft);
}
.vp-tab-btn {
  background: transparent;
  border: 0;
  color: var(--ink-muted);
  padding: 8px 14px;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font-sans);
  border-bottom: 2px solid transparent;
  letter-spacing: 0.04em;
}
.vp-tab-btn--active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}
.vp-tab { padding: 8px 0; }
.file-drop--simple {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  border: 1px dashed var(--rule-soft);
  cursor: pointer;
  gap: 6px;
  color: var(--ink-muted);
  font-size: 12px;
}
.file-drop--simple:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.file-drop__icon { font-size: 28px; }
.file-drop__label { font-family: var(--font-mono); }
.vp-image-preview {
  display: block;
  margin: 12px auto 0;
  max-width: 100%;
  max-height: 240px;
  border: 1px solid var(--rule-soft);
}

/* ==== procedure templates editor (Wave 11) ==== */
.proc-lead { font-size: 13px; color: var(--ink-muted); margin: 0 0 18px; }
.proc-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 1px; }
.proc-row { display: grid; grid-template-columns: 1fr auto; gap: 14px; padding: 12px 10px; background: #fff; border-bottom: 1px solid rgba(29,45,58,0.10); }
.proc-row__name { font-weight: 500; font-size: 14px; color: var(--ink); text-decoration: none; }
.proc-row__name:hover { color: var(--olive); }
.proc-row__meta { font-family: var(--font-mono); font-size: 11px; color: var(--ink-muted); }

.slot-legend { margin: 14px 0; }
.slot-legend summary { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-muted); cursor: pointer; }
#slot-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0 0; list-style: none; margin: 0; }
#slot-list code { background: var(--paper-2); padding: 2px 8px; border: 1px solid var(--rule-soft); font-size: 11.5px; }

.proc-edit-actions { display: flex; gap: 8px; }
.proc-section { padding: 14px 12px; border: 1px solid var(--rule-soft); margin-bottom: 12px; background: var(--paper); }
.proc-section__head { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 10px; margin-bottom: 8px; align-items: center; }
.proc-section__label, .proc-section__id { font-size: 13px; padding: 6px 8px; background: var(--paper-2); border: 1px solid var(--rule-soft); }
.proc-section__id { font-family: var(--font-mono); }
.proc-section__required { font-family: var(--font-mono); font-size: 11px; color: var(--ink-muted); display: flex; align-items: center; gap: 4px; }
.proc-section__delete { background: transparent; border: 0; color: var(--ink-muted); font-size: 18px; cursor: pointer; }
.proc-section__delete:hover { color: var(--oxide); }
.proc-section textarea { width: 100%; box-sizing: border-box; background: var(--paper-2); border: 1px solid var(--rule-soft); padding: 8px 10px; font-family: var(--font-mono); font-size: 12px; color: var(--ink); }

/* ==== odontogram (interactive tooth chart) ==== */
.odontogram { margin: 22px 0; padding: 16px 18px; background: var(--paper-2); border: 1px solid var(--rule-soft); }
.odontogram__legend { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 10px; }
.odontogram__grid { display: flex; flex-direction: column; gap: 8px; }
.odontogram__row { display: flex; align-items: stretch; gap: 0; }
.odontogram__row--lower { padding-top: 8px; border-top: 1px solid var(--rule-soft); }
/* min-track is 0 (not 28px) so cells shrink with the container instead of
   pushing the chart past its grid cell — at the visit page's two-column
   desktop width, the left column is ~480-560px and a 28px floor would
   blow the chart out the right side and overlap the sticky note panel. */
.odontogram__quadrant { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; flex: 1 1 0; min-width: 0; }
.odontogram__midline { width: 2px; background: var(--ink-muted); margin: 0 6px; opacity: 0.3; }
.odontogram__tooth { background: var(--paper); border: 1px solid var(--rule-soft); padding: 8px 0 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; transition: background 0.12s, border-color 0.12s, transform 0.08s; min-height: 56px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em; color: var(--ink-muted); }
.odontogram__tooth:hover { background: #fbf6e9; border-color: var(--ink); color: var(--ink); }
.odontogram__tooth:active { transform: scale(0.95); }
.odontogram__tooth-shape { width: 18px; height: 18px; border: 1.5px solid currentColor; border-radius: 6px 6px 4px 4px; background: transparent; }
.odontogram__tooth-num { font-weight: 500; }
.odontogram__tooth--selected { background: var(--olive); border-color: var(--olive); color: var(--paper); }
.odontogram__tooth--selected:hover { background: var(--olive); color: var(--paper); }
.odontogram__tooth--selected .odontogram__tooth-shape { background: var(--paper); border-color: var(--paper); }
.odontogram__status { margin-top: 10px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-muted); min-height: 14px; }
@media (max-width: 720px) {
  .odontogram__quadrant { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 2px; }
  .odontogram__tooth { min-height: 44px; padding: 6px 0 2px; font-size: 9.5px; }
  .odontogram__tooth-shape { width: 14px; height: 14px; }
}

/* ==== surface tray (per-tooth surface picker, below odontogram) ==== */
.surface-tray {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.surface-tray--empty {
  padding: 8px 12px;
}
.surface-tray__empty {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}
.surface-tray__row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.surface-tray__row:last-child { border-bottom: 0; }
.surface-tray__tooth {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--ink);
  min-width: 28px;
  padding: 2px 6px;
  background: var(--paper-2);
  border: 1px solid var(--rule-soft);
  text-align: center;
}
.surface-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  background: var(--paper-2);
  border: 1px solid var(--rule-soft);
  min-width: 32px;
  min-height: 32px;
  padding: 4px 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.08s;
}
.surface-chip:hover {
  border-color: var(--ink);
  color: var(--ink);
  background: #fbf6e9;
}
.surface-chip:active { transform: scale(0.94); }
.surface-chip.is-on {
  background: var(--olive);
  border-color: var(--olive);
  color: var(--paper);
}
.surface-chip.is-on:hover {
  background: var(--olive);
  color: var(--paper);
}
@media (max-width: 720px) {
  .surface-tray__row { gap: 6px; }
  .surface-chip { min-width: 32px; min-height: 32px; padding: 4px 6px; font-size: 11px; }
  .surface-tray__tooth { font-size: 11px; }
}

/* Radiographs panel ------------------------------------------------------
   Mirrors .anesthesia-panel and .chief-complaint-panel — same paper/ink
   palette, same rule borders. Counts use compact stepper controls (-/+ on
   each side of a tabular-num number input). "None taken" dims the counter
   row and hides the free-text extras. */
.radiographs-panel {
  margin-top: 28px;
  padding: 18px 20px;
  border-top: 1px solid var(--rule-soft);
  border-bottom: 1px solid var(--rule-soft);
  background: var(--paper-2, transparent);
}
.radiographs-panel__head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.radiographs-panel__hint {
  font-size: 12px;
  color: var(--ink-muted);
}
.radiographs-panel__row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  align-items: center;
  margin-bottom: 12px;
}
.radiographs-panel__row.is-disabled .rad-counter {
  opacity: .45;
  pointer-events: none;
}
.rad-counter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.rad-counter__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  min-width: 38px;
}
.rad-counter__btn {
  appearance: none;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--rule-soft);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  border-radius: 2px;
  touch-action: manipulation;
  user-select: none;
}
.rad-counter__btn:hover { border-color: var(--ink); }
.rad-counter__btn:active { background: var(--paper-2); }
.rad-counter__btn:disabled { opacity: .45; cursor: not-allowed; }
.rad-counter__value {
  width: 54px;
  padding: 6px 4px;
  border: 1px solid var(--rule-soft);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  text-align: center;
  -moz-appearance: textfield;
}
.rad-counter__value::-webkit-outer-spin-button,
.rad-counter__value::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.rad-counter__value:focus { border-color: var(--ink); outline: none; }
.rad-counter__value:disabled { opacity: .45; cursor: not-allowed; }
.radiographs-panel__none {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink);
  margin-left: auto;
  cursor: pointer;
}
.radiographs-panel__extras {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 12px 18px;
  align-items: start;
}
@media (max-width: 720px) {
  .radiographs-panel__extras { grid-template-columns: 1fr; }
}
.radiographs-panel__field { display: flex; flex-direction: column; gap: 4px; }
.radiographs-panel__field input[type=text],
.radiographs-panel__field textarea {
  border: 1px solid var(--rule-soft);
  background: var(--paper);
  padding: 9px 10px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  resize: vertical;
  font-family: inherit;
}
.radiographs-panel__field input[type=text]:focus,
.radiographs-panel__field textarea:focus { border-color: var(--ink); outline: none; }
.radiographs-panel__extras[hidden] { display: none; }
.radiographs-panel__status { display: inline-block; margin-top: 10px; font-size: 12px; min-height: 1em; }

/* ==== mobile layout fixes (≤720px) ==========================================
   Shared chrome (masthead, greeting, day-head) and planner visit-row.
   Desktop layout is unaffected. */
@media (max-width: 720px) {
  /* --- masthead / greeting line ----------------------------------------- */
  /* Two-line greeting: name on top, action links wrap to a second row with
     enlarged tap targets. */
  .greeting {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 10px;
    row-gap: 6px;
  }
  .greeting__hi,
  .greeting__name { flex: 0 0 auto; }
  .greeting__name { flex-basis: 100%; }
  /* Push action links to a new row that begins after the name */
  .greeting .logout-link {
    margin-left: 0;
    padding: 8px 10px;
    min-height: 32px;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--rule-soft);
  }
  .greeting .logout-link:first-of-type { margin-left: 0; }

  /* --- planner day-head ------------------------------------------------- */
  .day-title { font-size: 26px; line-height: 1.15; }
  .date-nav { gap: 6px; flex-wrap: wrap; }
  .date-nav__btn {
    padding: 8px 14px;
    min-height: 32px;
    min-width: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* --- planner visit-row: stack the five columns ------------------------ */
  /* Layout becomes three rows:
       row 1: time + date (visit-when)
       row 2: patient link
       row 3: appt-select | status-select | delete                      */
  .visit-row {
    grid-template-columns: 1fr auto auto;
    grid-template-areas:
      "when when when"
      "link link link"
      "appt status del";
    gap: 8px 10px;
    padding: 10px 10px 10px 12px;
  }
  .visit-row > .visit-when     { grid-area: when; flex-direction: row; align-items: center; gap: 10px; }
  .visit-row > .visit-link     { grid-area: link; padding: 4px 0; }
  .visit-row > .visit-appt-select   { grid-area: appt; max-width: none; min-height: 32px; padding: 6px 8px; }
  .visit-row > .visit-status-select { grid-area: status; max-width: none; min-height: 32px; padding: 6px 8px; }
  .visit-row > .visit-delete   { grid-area: del; min-width: 32px; min-height: 32px; font-size: 20px; }
  .visit-time-edit,
  .visit-date-edit { padding: 6px 6px; font-size: 13px; }

  /* --- add-visit / plan-with-voice buttons ------------------------------ */
  .add-btn { display: flex; width: 100%; justify-content: center; margin-top: 12px; min-height: 44px; }
}

/* ==== mobile layout fixes (≤720px) — visit-page interior ===================
   Structured panels (anesthesia / chief-complaint / radiographs) and the
   intake composer cards need full-width controls at 390px so selects don't
   truncate to "— selec" and counters don't get orphaned. Desktop is
   unchanged. */
@media (max-width: 720px) {
  /* --- anesthesia: stack row-label kicker above a single-col grid ------- */
  .anesthesia-panel { padding: 16px 14px; }
  .anesthesia-panel__row {
    display: block;
  }
  .anesthesia-panel__row-label {
    display: flex;
    width: 100%;
    min-width: 0;
    padding-top: 0;
    margin-bottom: 8px;
    font-size: 10px;
    letter-spacing: 0.18em;
    color: var(--oxide);
  }
  .anesthesia-panel__grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .anesthesia-panel__field--narrow input { max-width: none; }
  .anesthesia-panel__check {
    padding-bottom: 0;
    padding-top: 4px;
    white-space: normal;
    min-height: 32px;
  }
  .anesthesia-panel__remove { min-width: 32px; min-height: 32px; }

  /* --- chief-complaint: single-col grids; pain block follows suit ------- */
  .chief-complaint-panel { padding: 16px 14px; }
  .chief-complaint-panel__grid { grid-template-columns: 1fr; gap: 12px; }
  .chief-complaint-panel__pain { margin-left: 0; padding: 12px 14px; }
  .chief-complaint-panel__pain-grid { grid-template-columns: 1fr; gap: 10px; }
  .chief-complaint-panel__field--narrow input { max-width: none; }
  .chief-complaint-panel__chips { flex-direction: column; align-items: stretch; gap: 6px; }
  .chief-complaint-panel__chip-label { min-width: 0; }

  .diagnosis-panel { padding: 16px 14px; }

  /* --- HPI: single-col grids; chip rows stack full-width like CC --- */
  .hpi-panel { padding: 16px 14px; }
  .hpi-panel__grid { grid-template-columns: 1fr; gap: 12px; }
  .hpi-panel__grid--secondary { grid-template-columns: 1fr; gap: 12px; }
  .hpi-panel__chips { flex-direction: column; align-items: stretch; gap: 6px; }
  .hpi-panel__chip-label { min-width: 0; }

  /* --- radiographs: counter rows stack, "None taken" gets its own row -- */
  .radiographs-panel { padding: 16px 14px; }
  .radiographs-panel__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
    align-items: center;
  }
  .rad-counter {
    justify-content: flex-start;
    gap: 6px;
  }
  .rad-counter__label { min-width: 34px; }
  .rad-counter__btn { min-width: 32px; min-height: 32px; }
  .rad-counter__value { width: 44px; min-height: 32px; }
  .radiographs-panel__none {
    grid-column: 1 / -1;
    margin-left: 0;
    justify-content: flex-start;
    padding-top: 4px;
    border-top: 1px dashed var(--rule-soft);
    margin-top: 2px;
    min-height: 32px;
  }

  /* --- composer intake cards: smaller display title at 390px ------------ */
  .intake { padding: 22px 18px 26px; }
  .intake__title { font-size: 22px; margin: 6px 0 4px; }

  /* --- refine-composer: actions wrap cleanly; buttons reach min target -- */
  .refine-composer { padding: 16px 14px; }
  .refine-actions { gap: 8px 10px; }
  .refine-rec { min-height: 32px; padding: 8px 14px; }

  /* --- surface tray: tighter chip sizing at narrowest widths ------------ */
  .surface-tray { padding: 8px 10px; }
}

/* ==== procedure tabs (per-visit procedure switcher) ==================== */
.proc-tabs {
  margin: 16px 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--rule-soft);
  padding-bottom: 10px;
}
.proc-tabs__rail { display: flex; gap: 6px; flex-wrap: wrap; flex: 1 1 auto; min-width: 0; }
.proc-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 7px 14px;
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ink-muted);
  line-height: 1.2;
}
.proc-tab:hover { color: var(--ink); border-color: var(--rule); }
.proc-tab--active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.proc-tab--active:hover { color: var(--paper); border-color: var(--ink); }
.proc-tab__num { font-family: var(--font-mono); font-size: 11px; opacity: 0.7; }
.proc-tab__label { font-weight: 500; }
.proc-tab__del {
  background: transparent;
  border: none;
  color: inherit;
  opacity: 0.5;
  cursor: pointer;
  padding: 0 4px;
  font-size: 16px;
  line-height: 1;
}
.proc-tab__del:hover { opacity: 1; color: var(--oxide); }
.proc-tab--active .proc-tab__del { color: var(--paper); }
.proc-tabs__add {
  padding: 7px 12px;
  background: transparent;
  border: 1px dashed var(--rule);
  border-radius: var(--radius);
  color: var(--ink-muted);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 13px;
}
.proc-tabs__add:hover { color: var(--oxide); border-color: var(--oxide); background: var(--oxide-soft); }

/* ==== narrative choice chips (click-to-pick on '/'-separated groups) === */
.narr-choice {
  /* inline span around a "X / Y / Z" group inside the rendered note */
  display: inline;
}
.narr-choice__opt {
  display: inline;
  padding: 0 4px;
  margin: 0;
  background: var(--oxide-soft);
  border: 1px dashed var(--oxide);
  border-radius: var(--radius);
  color: var(--oxide);
  font: inherit;
  cursor: pointer;
  line-height: inherit;
}
.narr-choice__opt:hover {
  background: var(--oxide);
  color: var(--paper);
  border-style: solid;
}
.narr-choice__opt:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* =============================================================
   UI POLISH PASS — targeted overrides
   ============================================================= */

/* 1. Hide the status pulse-dot when status text is empty (the orphan dot
      that appeared between the Generate button and the addendum). */
.status:empty::before { display: none; }

/* 2. Generate clinical note → visually primary (size up + oxide accent
      so it doesn't blend into every other dark button). */
.submit {
  padding: 22px 36px;
  font-size: 17px;
  background: var(--oxide);
  box-shadow: 0 4px 0 0 rgba(15, 36, 51, 0.18);
}
.submit:hover { background: #8e3624; transform: translateY(-2px); box-shadow: 0 6px 0 0 rgba(15, 36, 51, 0.22); }
.submit:active { transform: translateY(0); box-shadow: 0 2px 0 0 rgba(15, 36, 51, 0.22); }

/* 3. Tooth chart — bigger tap targets (44px+) + quadrant labels. */
.odontogram__tooth {
  min-height: 52px;
  min-width: 44px;
  padding: 8px 4px 6px;
  font-size: 12px;
}
.odontogram__tooth-shape { width: 22px; height: 22px; }
.odontogram__row { position: relative; }
.odontogram__quadrant-label {
  position: absolute;
  top: -14px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  text-transform: uppercase;
}
.odontogram__quadrant-label--ur { left: 0; }
.odontogram__quadrant-label--ul { right: 0; }
.odontogram__quadrant-label--lr { left: 0; bottom: -14px; top: auto; }
.odontogram__quadrant-label--ll { right: 0; bottom: -14px; top: auto; }
.odontogram__grid { padding: 18px 0; }

/* 4. Radiograph stepper buttons → bigger tap targets. */
.rad-counter__btn {
  min-width: 36px;
  min-height: 36px;
  font-size: 18px;
}

/* 5. Template selector — give it room so the full name shows. Wide select,
      ellipsize on really long entries, hover tooltip via native title. */
.composer__template { max-width: 100%; }
.composer__template .select-wrap { max-width: 720px; }
.composer__template select { max-width: 100%; }

/* 6. PLANNED status pill on the visit-header card — text style (kill the
      false affordance — it's not clickable from here). */
.visit-header .visit-status {
  border: none;
  background: transparent;
  padding: 0;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--ink-faint);
}

/* Click-to-edit overlay for fully-static sections of the rendered narrative
   (currently just MHU). Hover shows a subtle outline so the dentist knows
   it's tappable. On click the JS swaps the span for a textarea. */
.narr-editable {
  display: inline-block;
  border-radius: 2px;
  padding: 0 2px;
  margin: 0 -2px;
  cursor: text;
  transition: background-color 120ms;
}
.narr-editable:hover {
  background: rgba(120, 120, 120, 0.08);
  outline: 1px dashed var(--rule-soft);
}
.narr-editable--saving { opacity: 0.55; cursor: progress; }
.narr-editable__textarea {
  width: 100%;
  min-height: 1.4em;
  font: inherit;
  color: inherit;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 2px;
  padding: 4px 6px;
  resize: vertical;
  box-sizing: border-box;
}

/* 7. Unfilled slot placeholders `[ slot not specified ]` — amber pill so
      they stand out instead of blending into the prose. Wrapping happens
      in JS (renderNarrative looks for the pattern). */
.narr-gap {
  display: inline-block;
  padding: 0 6px;
  margin: 0 1px;
  background: rgba(195, 139, 59, 0.15);
  border: 1px solid var(--amber);
  border-radius: var(--radius);
  color: #7a5320;
  font-size: 0.9em;
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* 8. Add-procedure tab + Add-second-LA buttons — drop the dashed border
      (dashed reads as "drop zone", not "action"). Soft solid pill. */
.proc-tabs__add,
.anesthesia-panel__add {
  border-style: solid;
  border-color: var(--rule-soft);
  background: var(--paper);
}
.proc-tabs__add:hover,
.anesthesia-panel__add:hover {
  border-color: var(--oxide);
  background: var(--oxide-soft);
  color: var(--oxide);
}

/* 9. Copy button — slightly bigger + icon (the icon is added via ::before
      pseudo so we don't need to touch HTML for every panel). */
.copy-btn {
  font-size: 12px;
  padding: 6px 10px;
}
.copy-btn::before {
  content: "⧉";
  margin-right: 6px;
  font-size: 13px;
}

/* 10. "AI draft" indicator on the generated note. Tag inside the results
       header, sits next to the title. */
.results__ai-tag {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 7px;
  background: rgba(168, 65, 46, 0.08);
  border: 1px solid var(--oxide-soft);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--oxide);
  text-transform: uppercase;
  vertical-align: middle;
}

/* 11. Contrast — tagline, footer, faint text bumped (was failing WCAG AA). */
.tagline { color: var(--ink-muted); }
.colophon, .colophon * { color: var(--ink-muted); }
.greeting__hi { color: var(--ink-muted); }    /* less attention-grabbing red */

/* 12. Dr-name period — JS strips it; CSS fallback removes the dot via
       letter-spacing trick isn't needed. Skip. */

/* 13. CHIEF COMPLAINT panel — wider summary tap area (whole row), and
       the patient's-words field gets 70% of the grid (it's the longer one). */
.chief-complaint-panel__head {
  padding: 6px 0;        /* easier to tap */
  cursor: pointer;
}
.chief-complaint-panel__grid {
  display: grid;
  grid-template-columns: 7fr 3fr;
  gap: 16px;
}
@media (max-width: 640px) {
  .chief-complaint-panel__grid { grid-template-columns: 1fr; }
}

/* 14. Empty state on planner — make it feel intentional. */
.empty {
  padding: 36px 24px;
  text-align: center;
  border: 1px dashed var(--rule-soft);
  color: var(--ink-muted);
  background: rgba(255, 255, 255, 0.35);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 16px;
}
.empty::before {
  content: "";
  display: block;
  width: 36px;
  height: 36px;
  margin: 0 auto 12px;
  border: 2px solid var(--rule-soft);
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 47%, var(--rule-soft) 48%, var(--rule-soft) 52%, transparent 53%),
    linear-gradient(0deg, transparent 47%, var(--rule-soft) 48%, var(--rule-soft) 52%, transparent 53%);
  background-size: 100% 100%;
}

/* 15. Diagnosis category headers — selection-count badge (JS adds the
       data-count attr; CSS renders the badge). */
.dx-cat__summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.dx-cat__count-badge {
  display: inline-block;
  margin-left: auto;
  padding: 2px 8px;
  background: var(--olive);
  color: var(--paper);
  border-radius: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
}

/* 16. Diagnosis pills — consistent height + ellipsis on long names. */
.dx-cat__item {
  min-height: 32px;
  max-width: 100%;
  white-space: normal;
  line-height: 1.3;
}

/* 17. Diagnosis filter input. */
.dx-filter {
  width: 100%;
  margin: 0 0 12px;
  padding: 8px 12px;
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 14px;
}
.dx-filter:focus { outline: none; border-color: var(--ink); }

/* 18. Severity tier classes for reviewer's marks. */
.review__col li.flag--blocking { color: var(--oxide); }
.review__col li.flag--context  { color: var(--amber); }
.review__col li.flag--blocking::before { content: "✗"; color: var(--oxide); }
.review__col li.flag--context::before  { content: "!"; color: var(--amber); }

/* 19. Mode 01/02/03 kickers — slightly de-emphasised (less devy-feeling). */
.intake__kicker { font-size: 9.5px; letter-spacing: 0.18em; opacity: 0.7; }

/* 20. drawer__kicker (the "New visit" / "Day planner" red tags on modals)
       — slightly subdued so they don't compete with the dialog title. */
.drawer__kicker { opacity: 0.6; font-size: 9.5px; }

/* Field hint (subtle parenthetical guidance inside a label). */
.field-hint {
  font-weight: 400;
  color: var(--ink-faint);
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}
/* Right-aligned drawer actions (primary on the right, ghost on the left). */
.drawer-actions--right { justify-content: flex-end; }

/* "AI draft" indicator on results title (referenced from visit.html). */
.results__head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }

/* Voice planner image tab — split take-photo vs pick-file. */
.vp-image-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 8px;
}
.vp-image-name {
  display: block;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-faint);
  min-height: 18px;
}

/* Nav separation — utility links (Procedures / What's new) grouped, with
   Sign out subdued + spaced apart so accidental sign-outs are rarer. */
.greeting {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.greeting > .logout-link:last-child {
  margin-left: auto;
  padding-left: 14px;
  border-left: 1px solid var(--rule-soft);
  color: var(--ink-faint);
}
.greeting > .logout-link:last-child:hover { color: var(--oxide); }

/* Anesthesia panel — compact override (panel was visually dominating the
   left rail). Smaller padding, tighter row gap, smaller row label,
   smaller input padding + font. */
.anesthesia-panel {
  margin-top: 16px;
  padding: 12px 14px;
}
.anesthesia-panel__head { margin-bottom: 8px; gap: 12px; }
.anesthesia-panel__row { gap: 10px; margin-bottom: 6px; }
.anesthesia-panel__row + .anesthesia-panel__row { padding-top: 6px; }
.anesthesia-panel__row-label {
  min-width: 64px;
  padding-top: 18px;
  font-size: 10px;
}
.anesthesia-panel__grid { gap: 8px 12px; }
.anesthesia-panel__field input[type=number] { padding: 6px 8px; font-size: 13px; }
.anesthesia-panel select { padding: 6px 8px; font-size: 13px; }
.anesthesia-panel__field .field-label { font-size: 10px; }
.anesthesia-panel__check { font-size: 12px; padding-bottom: 6px; }
.anesthesia-panel__add { padding: 6px 10px; font-size: 11px; margin-top: 4px; }
.anesthesia-panel__status { margin-top: 6px; font-size: 11px; }

/* ==== "Treatment options presented…" chip overlay ==================== */
.pres-block {
  /* span living inside <pre class="galley"> — preserves the surrounding
     whitespace formatting via white-space: inherit */
  display: inline;
  white-space: inherit;
}
.pres-block__header {
  display: inline;
  font-weight: 500;
}
.pres-block__dx {
  display: inline;
  color: var(--ink-muted);
}
.pres-opt {
  display: inline-block;
  padding: 1px 7px;
  margin: 0 0 0 0;
  background: transparent;
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  color: var(--ink);
  font: inherit;
  font-size: 0.92em;
  cursor: pointer;
  line-height: 1.4;
  text-align: left;
}
.pres-opt:hover {
  background: var(--olive);
  color: var(--paper);
  border-color: var(--olive);
}
.pres-opt--dropped {
  /* No text content — render via ::after so textContent (and therefore
     copy-to-clipboard) sees nothing. The chip stays visible + tappable
     to bring the option back. */
  background: transparent;
  border-color: var(--rule-soft);
  border-style: dashed;
  color: var(--ink-faint);
  opacity: 0.65;
}
.pres-opt--dropped::before {
  content: "  - ";
  color: var(--ink-faint);
}
.pres-opt--dropped::after {
  content: attr(data-text);
  text-decoration: line-through;
}
.pres-opt--dropped:hover {
  opacity: 1;
  background: var(--paper-2);
  color: var(--ink);
  border-color: var(--rule);
}

/* Focus chips — pick which tooth (or "General") the diagnosis taps
   below apply to. Exactly one chip is on at a time. Renders above
   the category accordion. */
.dx-focus-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 12px;
}
.dx-focus-chips__hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
}
.dx-focus-chip {
  appearance: none;
  border: 1px solid var(--rule-soft);
  background: var(--paper);
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 3px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  line-height: 1.2;
  min-width: 36px;
  text-align: center;
}
.dx-focus-chip:hover { color: var(--ink); border-color: var(--ink); }
.dx-focus-chip--on {
  background: var(--olive);
  color: var(--paper);
  border-color: var(--olive);
}
.dx-focus-chip--on:hover {
  background: var(--olive);
  color: var(--paper);
  border-color: var(--olive);
  opacity: 0.85;
}

/* Selected diagnoses — flat overview list. The per-Dx teeth/area
   input expands inline on row tap (Task 6); collapsed rows show
   just the name + teeth summary + remove. */
.dx-row__teeth-summary {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
}
.dx-row__teeth-summary--empty { color: var(--ink-faint); font-style: italic; }
.dx-row__teeth-edit {
  display: none;
  margin-top: 4px;
}
.dx-row--expanded .dx-row__teeth-edit { display: block; }
.dx-row--expanded .dx-row__name { font-weight: 600; }
