/* Monograph wireframe system — ported from claude.ai/design handoff. */

:root {
  --ink: #182030;
  /* near-black with a slight blue cast */
  --ink-2: #3a4658;
  /* slate body text */
  --ink-3: #6a7587;
  /* slate muted */
  --line: #c5cdd9;
  /* slate divider */
  --line-2: #d8dee8;
  /* lighter slate divider */
  --paper: #ffffff;
  --paper-2: #f3f6fa;
  /* cool off-white panels */
  --fill: #e3e9f2;
  /* cool fill (active nav, chips) */
  --fill-2: #ecf0f6;
  /* lighter cool fill (hover) */
  --accent: oklch(58% 0.09 250);
  --accent-soft: oklch(92% 0.03 250);
  --hand: 'Caveat', cursive;
  --ui: 'Inter', -apple-system, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

html,
body {
  margin: 0;
  padding: 0;
  background: #eaeff5;
  /* cool page background behind the app shell */
  font-family: var(--ui);
  color: var(--ink);
  height: 100vh;
  overflow: hidden;
}

a {
  color: inherit;
}

/* The HTML `hidden` attribute must always win over later `display` rules
   (e.g. `.btn { display: inline-flex }` would otherwise keep a hidden button visible). */
[hidden] {
  display: none !important;
}

/* App shell — pinned to viewport height so any internal scroll
   (PDF viewer, long library list) happens inside .wf, not on the page. */
.wf,
.wf * {
  box-sizing: border-box;
}

.wf {
  height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Top bar */
.wf-topbar {
  height: 48px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 14px;
  background: var(--paper);
  flex: 0 0 auto;
}

.wf-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
}

.wf-logo img {
  height: 26px;
  width: auto;
  display: block;
}

.wf-breadcrumb {
  color: var(--ink-3);
  font-size: 12px;
  display: flex;
  gap: 6px;
  align-items: center;
}

.wf-breadcrumb a {
  text-decoration: none;
}

.wf-breadcrumb .sep {
  opacity: .5;
}

.wf-breadcrumb .current {
  color: var(--ink);
}

.wf-spacer {
  flex: 1;
}

.wf-avatar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wf-avatar img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line);
}

.wf-avatar-email {
  color: var(--ink-2);
  font-size: 12px;
}

.wf-avatar-logout {
  margin: 0;
}

.wf-avatar-logout button {
  background: none;
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
}

.wf-avatar-logout button:hover {
  background: var(--fill-2);
  color: var(--ink);
}

.topbar-link {
  color: var(--ink-2);
  font-size: 12px;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 4px;
}

.topbar-link:hover {
  background: var(--fill-2);
  color: var(--ink);
}

/* Settings → Prompts viewer */
.prompt-body {
  margin: 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-2);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink);
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 70vh;
  overflow: auto;
}

/* Body + side panel */
.wf-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

.wf-side {
  width: 232px;
  border-right: 1px solid var(--line);
  background: var(--paper-2);
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  /* Scroll internally when the nav grows past the available height
     (Settings + multiple section sub-groups + Meta + Data + the
     Special Populations expansion can run past the viewport). The
     parent .wf-body has flex:1 + min-height:0 so this scoped scroll
     bar sits cleanly inside the page chrome. */
  min-height: 0;
  overflow-y: auto;
}

.wf-side h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-3);
  margin: 14px 16px 8px;
  font-weight: 600;
}

.wf-nav {
  display: flex;
  flex-direction: column;
  padding: 4px 8px;
  gap: 1px;
}

.wf-nav .item {
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  text-decoration: none;
}

.wf-nav .item:hover {
  background: var(--fill-2);
}

.wf-nav .item.active {
  background: var(--fill);
  color: var(--ink);
  font-weight: 500;
}

.wf-nav .item .ico {
  width: 14px;
  height: 14px;
  border: 1.4px solid currentColor;
  border-radius: 3px;
  opacity: .7;
  flex: 0 0 auto;
}

/* Sub-heading inside .wf-nav — used to group sections (Pharmacology,
   Dosing, Safety, Special Populations) inside the Sections list.
   Visually distinct from .wf-side h4 (which is a top-level nav heading)
   by being smaller, lighter, and indented to match the nav items it
   labels. */
.wf-nav .wf-subheading {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-3);
  font-weight: 600;
  padding: 10px 10px 4px;
  margin-top: 4px;
  border-top: 1px solid var(--line-2);
}

/* The first sub-heading sits directly under the "Sections" h4, so the
   separator border would double up with the heading's own visual
   weight. Drop it on the first one only. */
.wf-nav .wf-subheading:first-child,
.wf-nav .wf-subgroup:first-child .wf-subheading {
  border-top: 0;
  margin-top: 0;
  padding-top: 6px;
}

/* Items rendered under a sub-heading sit slightly indented so the
   hierarchy reads at a glance. */
.wf-nav .item.wf-nav-sub {
  padding-left: 22px;
}

/* Collapsible sub-group: button-styled sub-heading + caret + the items
   container that shows/hides. The toggle is a real <button> so it gets
   keyboard focus and screen readers announce the aria-expanded state. */
.wf-nav .wf-subgroup {
  display: flex;
  flex-direction: column;
}

.wf-nav .wf-subheading-toggle {
  /* Reset native button chrome, inherit the .wf-subheading look, add
     row layout for the caret + label. */
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
  font: inherit;
  /* These mirror .wf-subheading typography exactly. */
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-3);
  font-weight: 600;
}

.wf-nav .wf-subheading-toggle:hover {
  color: var(--ink-2);
}

.wf-nav .wf-caret {
  display: inline-block;
  width: 10px;
  font-size: 9px;
  line-height: 1;
  color: var(--ink-3);
  transition: transform 0.12s ease;
}

.wf-nav .wf-subgroup.collapsed .wf-caret {
  transform: rotate(-90deg);
}

.wf-nav .wf-subgroup.collapsed .wf-subgroup-items {
  display: none;
}

.wf-nav .item .num {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  opacity: .55;
}

.wf-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 14px;
  border-radius: 6px;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font: 500 13px var(--ui);
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  background: var(--fill-2);
}

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

.btn.primary:hover {
  background: #000;
}

.btn.ghost {
  border-color: var(--line);
  color: var(--ink-2);
}

.btn.ghost:hover {
  background: var(--fill-2);
}

.btn.sm {
  height: 26px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 5px;
}

.btn.disabled,
.btn:disabled {
  pointer-events: none;
  opacity: 0.45;
  cursor: not-allowed;
}

.btn .plus {
  width: 10px;
  height: 10px;
  position: relative;
}

.btn .plus::before,
.btn .plus::after {
  content: '';
  position: absolute;
  background: currentColor;
}

.btn .plus::before {
  left: 0;
  right: 0;
  top: 4px;
  height: 2px;
}

.btn .plus::after {
  top: 0;
  bottom: 0;
  left: 4px;
  width: 2px;
}

.btn .ai::before {
  content: '✦';
}

/* Fields */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  font-weight: 600;
}

.field .input {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  padding: 0 12px;
  display: flex;
  align-items: center;
  color: var(--ink-2);
  font-size: 13px;
  font-family: inherit;
  width: 100%;
  outline: none;
}

.field input.input {
  padding: 0 12px;
}

.field input.input::placeholder {
  color: var(--ink-3);
}

.field input.input.mono {
  font-family: var(--mono);
}

.field .input.ph {
  color: var(--ink-3);
}

.field .help {
  font-size: 11px;
  color: var(--ink-3);
}

/* Fieldset wrapper — groups related .field rows under a legend. */
.field-group {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px 16px 16px;
  margin: 0;
}

.field-group legend {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  font-weight: 600;
  padding: 0 6px;
}

/* Free-form chip input — type, Enter to add. Reuses .chips for the
   container so existing chip styles cover the per-tag visual. */
.chip-input .chips {
  cursor: text;
}

.chip-input-field {
  flex: 1 1 120px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  padding: 2px 4px;
  min-width: 120px;
}

.chip-input-field::placeholder {
  color: var(--ink-3);
}

/* Chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  background: var(--paper);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px 0 10px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--ink);
  font-size: 12px;
  white-space: nowrap;
}

.chip .x {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .18);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  border: none;
  padding: 0;
}

.chip.outline {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-2);
  cursor: pointer;
}

.chip.outline:hover {
  background: var(--fill-2);
}

.chip.accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.chip.mono {
  font-family: var(--mono);
  font-size: 11px;
}

/* Multi-select */
.multiselect {
  position: relative;
}

.multiselect .chips {
  cursor: text;
}

.ms-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  padding: 6px;
  background: var(--paper);
  z-index: 20;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
  overflow-y: scroll;
  max-height: 250px;
}

.ms-row {
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

.ms-row:hover {
  background: var(--fill-2);
}

.ms-row.checked {
  background: var(--fill);
}

.ms-row .ms-box {
  width: 14px;
  height: 14px;
  border: 1.4px solid var(--ink-3);
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  line-height: 1;
  color: var(--ink);
  flex: 0 0 auto;
}

.ms-row.checked .ms-box {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.ms-row .ms-label {
  flex: 1;
}

.ms-row .ms-key {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}

/* Boxes */
.box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.box.dashed {
  border-style: dashed;
}

.box.fill {
  background: var(--paper-2);
}

.stripe {
  background-image: repeating-linear-gradient(135deg, var(--line-2) 0 1px, transparent 1px 9px);
}

.ph-text {
  display: inline-block;
  height: 9px;
  background: var(--fill);
  border-radius: 2px;
}

/* Annotations (hidden by default — purely decorative) */
.anno {
  font-family: var(--hand);
  font-size: 18px;
  color: var(--accent);
  line-height: 1;
}

.anno.note {
  color: var(--ink-3);
}

.anno-arrow {
  stroke: var(--accent);
  fill: none;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Page header */
.page-head {
  padding: 22px 28px 14px;
  display: flex;
  align-items: flex-end;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.page-head h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.page-head .sub {
  color: var(--ink-3);
  font-size: 12px;
  margin-top: 4px;
}

.steps {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  color: var(--ink-3);
}

.steps .s {
  display: flex;
  align-items: center;
  gap: 6px;
}

.steps .n {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.4px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
}

.steps .s.done .n {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.steps .s.active .n {
  border-color: var(--ink);
  color: var(--ink);
  font-weight: 600;
}

.steps .bar {
  width: 28px;
  height: 1px;
  background: var(--line);
}

/* Utility */
.row {
  display: flex;
  gap: 14px;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.grow {
  flex: 1;
}

.mute {
  color: var(--ink-3);
}

.h2 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}

.h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-3);
  font-weight: 600;
  margin: 0;
}

/* Modal — centered confirmation dialog */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 22, 35, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.modal-backdrop[hidden] {
  display: none;
}

/* Modals use a fixed three-row flex layout: head + body + foot. The body
   is the only scroll region, so the title and action buttons stay
   visible even when the form is long. Markup pattern:

       <div class="modal">
         [<form>]
           <div class="modal-head"><h3>...</h3></div>
           <div class="modal-body">...content...</div>
           <div class="modal-foot">...buttons...</div>
         [</form>]
       </div>

   `<form>` (when present) sits between .modal and the wrappers and is
   itself made a flex column so the chain reaches modal-body. */
.modal {
  background: var(--paper);
  border-radius: 8px;
  max-width: 440px;
  width: 100%;
  max-height: 92vh;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.modal-head {
  flex: 0 0 auto;
  padding: 18px 24px 12px;
  border-bottom: 1px solid var(--line);
}

.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 16px 24px;
}

.modal-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--paper-2);
}

.modal-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

/* Legacy: any <h3> still rendered directly inside .modal (not yet
   migrated to use .modal-head) keeps its old vertical spacing. */
.modal > h3,
.modal > form > h3 {
  margin: 18px 24px 10px;
  font-size: 16px;
  font-weight: 600;
}

.modal p {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.5;
}

.modal-body > :last-child,
.modal p:last-child {
  margin-bottom: 0;
}

.modal p code {
  font-family: var(--mono);
  background: var(--fill);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}

.modal .text-input {
  height: 36px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  padding: 0 12px;
  color: var(--ink);
  font-size: 13px;
  font-family: var(--mono);
  outline: none;
  box-sizing: border-box;
}

.modal .text-input:focus {
  border-color: var(--accent);
}

.modal .error-text {
  margin-top: 8px;
  font-size: 12px;
  color: #b3261e;
}

/* Wide variant — for forms with many grouped fields (e.g. dose rule editor).
   max-height + overflow are inherited from .modal; we only widen here. */
.modal.modal-wide {
  max-width: 760px;
}

.modal-wide fieldset.field-group {
  margin-bottom: 0;
}

.modal-wide fieldset.field-group legend {
  padding: 0 6px;
}

/* Slice n Dice — full-bleed modal: pages list (left) + page preview (center). */
.modal.slice-modal {
  max-width: none;
  width: 96vw;
  height: 92vh;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.slice-modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
}

.slice-modal-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.slice-modal-head .mute {
  color: var(--ink-3);
  font-weight: 400;
  margin-left: 6px;
  font-size: 12px;
}

.slice-modal-body {
  flex: 1;
  min-height: 0;
  display: flex;
}

.slice-pages {
  width: 200px;
  flex: 0 0 auto;
  border-right: 1px solid var(--line);
  background: var(--paper-2);
  overflow: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slice-page-thumb {
  border: 2px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font: inherit;
  text-align: left;
}

.slice-page-thumb:hover {
  border-color: var(--ink-3);
}

.slice-page-thumb.active {
  border-color: var(--ink);
}

.slice-page-thumb.selected {
  border-color: var(--accent);
}

.slice-page-thumb canvas,
.slice-page-thumb .placeholder {
  width: 100%;
  display: block;
  background: var(--fill);
  border-radius: 2px;
}

.slice-page-thumb .placeholder {
  aspect-ratio: 1 / 1.414;
}

.slice-page-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 2px 0;
}

.slice-page-thumb .num {
  font-size: 11px;
  color: var(--ink-2);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slice-page-thumb.selected .num {
  color: var(--ink);
  font-weight: 600;
}

.slice-page-check {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  border: 1.6px solid var(--line);
  border-radius: 4px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  cursor: pointer;
  transition: background-color .08s, border-color .08s, color .08s;
}

.slice-page-check svg {
  width: 14px;
  height: 14px;
  display: block;
}

.slice-page-check:hover {
  border-color: var(--ink-3);
}

.slice-page-check:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.slice-page-thumb.selected .slice-page-check {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.slice-preview {
  flex: 1;
  min-width: 0;
  background: var(--fill-2);
  overflow: auto;
  padding: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.slice-preview-canvas-wrap {
  background: #fff;
  box-shadow: 0 1px 0 var(--line-2), 0 4px 12px rgba(0, 0, 0, .04);
}

.slice-preview-canvas-wrap canvas {
  display: block;
}

.slice-selected {
  width: 220px;
  flex: 0 0 auto;
  border-left: 1px solid var(--line);
  background: var(--paper-2);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.slice-selected-head {
  padding: 10px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-3);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 6px;
}

.slice-selected-count {
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 10px;
  letter-spacing: 0;
  text-transform: none;
}

.slice-selected-list {
  flex: 1;
  overflow: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slice-selected-empty {
  color: var(--ink-3);
  font-size: 12px;
  padding: 8px;
}

.slice-selected-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}

.slice-selected-item:hover {
  border-color: var(--ink-3);
}

.slice-selected-item.active {
  border-color: var(--ink);
}

.slice-selected-item.dragging {
  opacity: .4;
}

.slice-selected-item.drop-above::before,
.slice-selected-item.drop-below::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.slice-selected-item.drop-above::before {
  top: -4px;
}

.slice-selected-item.drop-below::after {
  bottom: -4px;
}

.slice-selected-handle {
  width: 14px;
  height: 20px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
  cursor: grab;
}

.slice-selected-handle:hover {
  color: var(--ink);
}

.slice-selected-handle:active {
  cursor: grabbing;
}

.slice-selected-handle svg {
  width: 12px;
  height: 16px;
  fill: currentColor;
  display: block;
}

.slice-selected-item .label {
  flex: 1;
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 500;
}

.slice-selected-item.active .label {
  color: var(--ink);
}

.slice-selected-item .remove {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.slice-selected-item .remove:hover {
  background: var(--fill);
  color: var(--ink);
}

.slice-modal-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--paper-2);
}

/* Regions modal — drawn red boxes on top of a PDF.js page. Shares the
   slice-modal shell (full-bleed body with left page-strip and right side
   panel) and adds the overlay + chip strip in the header. */
.regions-canvas-wrap {
  position: relative;
  background: #fff;
  box-shadow: 0 1px 0 var(--line-2), 0 4px 12px rgba(0, 0, 0, .04);
}

.regions-canvas-wrap canvas {
  display: block;
}

.regions-overlay {
  position: absolute;
  inset: 0;
  cursor: crosshair;
  user-select: none;
}

.regions-box {
  position: absolute;
  border: 2px solid #d93636;
  background: rgba(217, 54, 54, .08);
  box-sizing: border-box;
  cursor: default;
}

.regions-box.drawing {
  border-style: dashed;
  pointer-events: none;
}

.regions-box-x {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 0;
  background: #d93636;
  color: #fff;
  font-size: 14px;
  line-height: 18px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  display: none;
}

.regions-box:hover .regions-box-x {
  display: block;
}

.regions-section-strip {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.regions-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.regions-chip:hover {
  border-color: var(--ink-3);
}

.regions-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.regions-chip-count {
  background: rgba(255, 255, 255, .22);
  color: inherit;
  border-radius: 999px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 600;
}

.regions-chip:not(.active) .regions-chip-count {
  background: var(--fill);
  color: var(--ink-2);
}

.regions-page-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  flex: 0 0 auto;
}

.slice-page-thumb.has-region .regions-page-dot {
  background: #d93636;
}

/* AI Wizard progress page */
@keyframes wf-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes wf-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .4;
  }
}

.wizard-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 36px 0 28px;
}

.wizard-spinner {
  width: 56px;
  height: 56px;
  border: 3px solid var(--fill);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: wf-spin 0.9s linear infinite;
}

.wizard-hero .title {
  font-size: 16px;
  font-weight: 600;
}

.wizard-hero .sub {
  color: var(--ink-3);
  font-size: 12px;
}

.section-progress {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 auto;
  max-width: 520px;
}

.section-progress .row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}

.section-progress .row .ico {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--ink-3);
}

.section-progress .row.done .ico {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.section-progress .row.active .ico {
  border-color: var(--accent);
  border-top-color: transparent;
  animation: wf-spin 0.9s linear infinite;
}

.section-progress .row.active .label {
  font-weight: 600;
}

.section-progress .row.pending .label {
  color: var(--ink-3);
}

.section-progress .row .label {
  flex: 1;
  font-size: 13px;
}

.section-progress .row .meta {
  color: var(--ink-3);
  font-size: 11px;
  font-family: var(--mono);
}

/* State pill — colored badge for monograph workflow state */
.state-pill {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: var(--ui);
  border: 1px solid transparent;
  white-space: nowrap;
}

.state-pill--draft {
  background: var(--fill);
  color: var(--ink-2);
  border-color: var(--line-2);
}

.state-pill--review {
  background: oklch(94% 0.07 80);
  color: oklch(40% 0.13 80);
}

.state-pill--published {
  background: oklch(94% 0.06 145);
  color: oklch(38% 0.12 145);
}

.state-pill--archived {
  background: transparent;
  color: var(--ink-3);
  border-color: var(--line);
}

/* Library list rows */
.lib-row {
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  gap: 14px;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

.lib-row:hover {
  background: var(--fill-2);
}

.lib-row .name {
  font-weight: 500;
  font-size: 13px;
  min-width: 200px;
}

.lib-row .meta {
  color: var(--ink-3);
  font-size: 12px;
}

/* Source PDF upload */
.drop-zone {
  height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 120ms ease, border-color 120ms ease;
}

.drop-zone.drag-over {
  background-color: var(--accent-soft);
  border-color: var(--accent);
  border-style: solid;
}

.drop-zone.drag-over .arrow {
  border-color: var(--accent);
  color: var(--accent);
}

.drop-zone.drag-over .label {
  color: var(--accent);
}

.drop-zone .arrow {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1.6px dashed var(--ink-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--ink-3);
}

.drop-zone .label {
  font-size: 14px;
  font-weight: 500;
}

.drop-zone .help {
  font-size: 12px;
  color: var(--ink-3);
}

.drop-zone .browse {
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

.file-row {
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-row .name {
  font-size: 13px;
  font-weight: 500;
}

.file-row .meta {
  font-size: 11px;
  color: var(--ink-3);
}

.file-row .progress {
  width: 120px;
  height: 4px;
  background: var(--fill);
  border-radius: 2px;
  overflow: hidden;
}

.file-row .progress>div {
  height: 100%;
  background: var(--accent);
}

.file-row .remove {
  color: var(--ink-3);
  cursor: pointer;
  padding: 4px 6px;
  background: none;
  border: none;
  font-size: 14px;
}

/* Per-PDF section assignment selector */
.file-row {
  position: relative;
}

.section-picker-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink-2);
  font: 500 11px var(--ui);
  cursor: pointer;
  white-space: nowrap;
}

.section-picker-trigger:hover {
  background: var(--fill-2);
}

.section-picker-trigger .ssel-caret {
  font-size: 9px;
  opacity: 0.6;
}

.section-picker-popover {
  position: absolute;
  right: 60px;
  /* anchored under the trigger (rough — flex layout handles fine details) */
  top: 100%;
  margin-top: 4px;
  width: 240px;
  z-index: 30;
  background: var(--paper);
  padding: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
}

.section-picker-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}

.section-picker-head>span:first-child {
  flex: 1;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--ink-2);
  font-size: 12px;
}

.ssel-quick {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  font: 500 10px var(--ui);
  color: var(--ink-2);
  cursor: pointer;
  text-transform: uppercase;
}

.ssel-quick:hover {
  background: var(--fill-2);
}

.section-picker-options {
  padding-top: 4px;
  max-height: 240px;
  overflow: auto;
}

.section-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

.section-picker-row:hover {
  background: var(--fill-2);
}

.section-picker-row input {
  margin: 0;
  cursor: pointer;
}

.pdf-icon {
  width: 19px;
  height: 24px;
  border: 1.4px solid var(--ink-3);
  border-radius: 2px;
  background: var(--paper);
  position: relative;
  flex: 0 0 auto;
}

.pdf-icon::before,
.pdf-icon::after,
.pdf-icon span {
  content: '';
  position: absolute;
  background: var(--line);
  left: 3px;
  height: 2px;
}

.pdf-icon::before {
  top: 4px;
  right: 3px;
}

.pdf-icon::after {
  top: 9px;
  right: 5px;
}

.pdf-icon span {
  top: 14px;
  right: 4px;
  background: var(--line);
}

.pdf-icon .tag {
  position: absolute;
  bottom: 1px;
  left: 0;
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 700;
  color: var(--accent);
  background: none;
  height: auto;
  padding-left: 1px;
}

/* Editor — section list state dots */
.wf-nav .item .ico.state-done {
  background: var(--ink-3);
  border-color: var(--ink-3);
  opacity: 1;
}

/* Sections that haven't been generated yet: faded but still clickable. */
.wf-nav .item.is-empty:not(.active) { color: var(--ink-3); }
.wf-nav .item.is-empty .ico { opacity: .55; }

.wf-nav .item .ico.state-editing {
  background: var(--ink);
  border-color: var(--ink);
}

.wf-nav .item .ico.state-warn {
  background: var(--accent);
  border-color: var(--accent);
}

.wf-nav .item .anno-inline {
  font-family: var(--hand);
  font-size: 14px;
  color: var(--accent);
}

/* Editor — PDF pane */
.pdf-pane {
  display: flex;
  flex: 1.15 1 0;
  min-width: 0;
  min-height: 0;
}

/* PDF pane toggle — hides the right pane and drops the editor's right
   divider so no stray line sits at the page edge. */
.wf-body.pdf-pane-hidden .pdf-pane { display: none; }
.wf-body.pdf-pane-hidden .editor-pane { border-right: 0; }

.pdf-thumbs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-right: 1px solid var(--line);
  background: var(--paper-2);
  overflow: auto;
  flex: 0 0 auto;
}

.pdf-thumb {
  width: 64px;
  height: 84px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  position: relative;
  flex: 0 0 auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.pdf-thumb.active {
  border: 1.6px solid var(--ink);
}

.pdf-thumb .canvas {
  flex: 1;
  border-radius: 2px;
  margin-bottom: 4px;
}

.pdf-thumb .name {
  font-size: 9px;
  font-family: var(--mono);
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pdf-thumb.active .name {
  color: var(--ink);
}

.pdf-thumb .dot-active {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pdf-viewer {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--fill-2);
}

.pdf-toolbar {
  height: 38px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 10px;
  background: var(--paper-2);
}

.pdf-toolbar .divider {
  width: 1px;
  height: 18px;
  background: var(--line);
  margin: 0 4px;
}

.pdf-scroller {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

/* Wrapper around the canvas + text layer so the two stack precisely.
   Width/height set inline in JS each render to match the current viewport. */
.pdf-canvas-wrap {
  position: relative;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 1px 0 var(--line-2), 0 4px 12px rgba(0, 0, 0, .04);
}

.pdf-canvas-wrap canvas {
  display: block;
}

/* PDF.js text layer — transparent spans positioned over the canvas so the
   user can select and copy the rendered text. Class name + structure follow
   PDF.js conventions so the library's TextLayer applies font sizes correctly. */
.textLayer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0.25;
  line-height: 1;
  text-size-adjust: none;
  forced-color-adjust: none;
  transform-origin: 0 0;
  z-index: 2;
  user-select: text;
  cursor: text;
}

.textLayer span,
.textLayer br {
  color: transparent;
  position: absolute;
  white-space: pre;
  cursor: text;
  transform-origin: 0% 0%;
}

.textLayer ::selection {
  background: rgba(0, 100, 255, 0.35);
}

/* PDF.js inserts these end-of-line markers; keep them out of selection visuals. */
.textLayer .endOfContent {
  display: block;
  position: absolute;
  inset: 100% 0 0;
  z-index: -1;
  cursor: default;
  user-select: none;
}

.textLayer.selecting .endOfContent {
  top: 0;
}

/* Horizontal strip of page thumbnails under the PDF toolbar */
.pdf-pages-strip {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
  overflow-x: auto;
  overflow-y: hidden;
  flex: 0 0 auto;
  scroll-behavior: smooth;
}

.pdf-page-thumb {
  flex: 0 0 auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px 4px 2px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font: inherit;
}

.pdf-page-thumb canvas {
  display: block;
  width: 70px;
  height: auto;
  background: #fff;
}

.pdf-page-thumb .pdf-page-thumb-num {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
}

.pdf-page-thumb:hover {
  background: var(--fill-2);
}

.pdf-page-thumb.active {
  border-color: var(--ink);
  border-width: 1.5px;
  padding: 3.5px 3.5px 1.5px;
  /* compensate for thicker border so layout doesn't jump */
}

.pdf-page-thumb.active .pdf-page-thumb-num {
  color: var(--ink);
  font-weight: 600;
}

/* Placeholder shape while the thumb canvas is still rendering */
.pdf-page-thumb .pdf-page-thumb-placeholder {
  width: 70px;
  aspect-ratio: 1 / 1.3;
  background: var(--fill-2);
}

.pdf-page {
  width: 100%;
  max-width: 520px;
  aspect-ratio: 1 / 1.3;
  margin: auto;
  position: relative;
  padding: 36px 40px;
  background: #fff;
  box-shadow: 0 1px 0 var(--line-2), 0 4px 12px rgba(0, 0, 0, .04);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.pdf-page .doc-id {
  font-size: 11px;
  color: var(--ink-3);
  font-family: var(--mono);
}

.pdf-page .heading {
  font-size: 14px;
  font-weight: 600;
  margin: 8px 0 14px;
}

.pdf-page .sub-heading {
  font-size: 13px;
  font-weight: 600;
  margin: 6px 0 8px;
}

.pdf-page .footer {
  position: absolute;
  bottom: 12px;
  left: 40px;
  right: 40px;
  display: flex;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
}

.pdf-page .highlight {
  background: oklch(92% 0.08 80);
}

.pdf-page .cited-flag {
  position: absolute;
  right: -8px;
  top: -2px;
  transform: translateX(100%);
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 600;
  white-space: nowrap;
}

.pdf-page .para {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* Editor pane */
.editor-pane {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-width: 0;
  background: var(--paper);
  border-right: 1px solid var(--line);
}

.editor-head {
  padding: 16px 22px 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}

.editor-head h2 {
  margin: 4px 0 0;
  font-size: 18px;
  font-weight: 600;
}

.editor-body {
  padding: 18px 22px 0px 18px;
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ──────────────────────────────────────────────────────────────────────
   Global table styling for AI-generated section HTML.

   Applies inside the rendered view (.ai-html) AND while editing
   (#quill-editor .ql-editor) so the table looks the same in both
   modes. Targets only tables emitted by the wizard prompts — the
   selectors are scoped to those containers, so the Pricing / Dose Rules
   tables elsewhere in the editor aren't affected.

   The wizard prompts emit a fixed shape:
       <table border="1" cellpadding="1" cellspacing="1" style="width: 100%;">
         <tbody>
           <tr><td class="text-align-center"><strong>{header}</strong></td>…</tr>
           <tr><td class="text-align-center">{cell}</td>…</tr>
         </tbody>
       </table>
   The `border="1"` HTML attribute gives a thin outline; we override
   with a unified box-shadow and per-cell borders for a cleaner look.
   Quill strips the `class="text-align-center"` on edit; alignment via
   Quill's toolbar instead produces `.ql-align-center`, which is honoured
   alongside the original class further down. */

.ai-html table,
#quill-editor .ql-editor table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
  margin: 14px 0;
  font-size: 13px;
  color: var(--ink-2);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 0 var(--line-2);
}

.ai-html table td,
.ai-html table th,
#quill-editor .ql-editor table td,
#quill-editor .ql-editor table th {
  border: 1px solid var(--line-2);
  padding: 8px 10px;
  vertical-align: middle;
  line-height: 1.4;
}

/* Header rows: the prompts mark headers with <strong> inside the first
   one or two <tr>s. Style any <td> whose only content is a <strong> as
   a header, plus any explicit <th>. */
.ai-html table tr:first-child td,
.ai-html table thead td,
.ai-html table thead th,
.ai-html table th,
#quill-editor .ql-editor table tr:first-child td,
#quill-editor .ql-editor table thead td,
#quill-editor .ql-editor table thead th,
#quill-editor .ql-editor table th {
  background: var(--paper-2);
  color: var(--ink);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}

/* Zebra-striping for body rows. Header row is :first-child so the
   striping starts on the second row down. */
.ai-html table tr:nth-child(even):not(:first-child),
#quill-editor .ql-editor table tr:nth-child(even):not(:first-child) {
  background: var(--fill-2);
}

/* Honour the .text-align-center class the prompts attach to every
   <td> (kept here so it isn't lost if a future style overrides it). */
.ai-html table td.text-align-center,
.ai-html table th.text-align-center,
.ai-html .ql-align-center,
#quill-editor .ql-editor table td.text-align-center,
#quill-editor .ql-editor table th.text-align-center,
#quill-editor .ql-editor .ql-align-center {
  text-align: center;
}

/* Hover affordance on body rows — subtle, doesn't fight the stripes. */
.ai-html table tr:not(:first-child):hover,
#quill-editor .ql-editor table tr:not(:first-child):hover {
  background: var(--accent-soft);
}

/* Captions / intro paragraphs immediately above a table read better
   with no bottom margin (the table's top margin handles the gap). */
.ai-html p + table,
#quill-editor .ql-editor p + table {
  margin-top: 6px;
}

.editor-body .ai-meta {
  display: flex;
  gap: 6px;
  align-items: center;
}

.editor-body .ai-meta .when {
  font-size: 11px;
  color: var(--ink-3);
}

.editor-body .cites-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.editor-body .cites-row .label {
  font-size: 11px;
  color: var(--ink-3);
  margin-right: 4px;
}

.editor-body .cite {
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  border: none;
}

.editor-foot {
  padding: 10px 22px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Section HTML editor — Quill 2.0 (snow theme) mounted when "Edit" is pressed.
   A custom Reference blot keeps <reference>N</reference> tags alive across
   Delta round-trips; inline styles and arbitrary classes are normalized
   away. The snow theme injects its own `.ql-toolbar` and `.ql-container`
   markup right after #quill-editor; we override layout, colours, and the
   sticky-toolbar behaviour to match the rest of the editor. */
#section-edit-pane {
  display: block;
}

/* Quill places .ql-toolbar and .ql-container as siblings of #quill-editor.
   Wrap both with one rounded outline so it reads as a single editor pane. */
#section-edit-pane .ql-toolbar.ql-snow {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 6px 6px 0 0;
  padding: 4px 6px;
}

#section-edit-pane .ql-container.ql-snow {
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 6px 6px;
  background: var(--paper);
  font-family: var(--ui);
  font-size: 13px;
  color: var(--ink);
}

#section-edit-pane .ql-editor {
  /* Grow with content but start tall enough to feel like a real editing
     surface. .editor-body handles overflow and the sticky toolbar pins. */
  min-height: calc(100vh - 240px);
  padding: 14px 16px;
  line-height: 1.55;
  color: var(--ink);
}

#section-edit-pane .ql-editor:focus {
  outline: none;
}

/* Custom toolbar button for "Insert table" — Quill creates a .ql-insert-table
   from our handler key. Match the size of the built-in icon buttons. */
#section-edit-pane .ql-snow .ql-insert-table {
  width: 28px;
  font-size: 14px;
  line-height: 24px;
  color: var(--ink-2);
}

#section-edit-pane .ql-snow .ql-insert-table:hover {
  color: var(--accent);
}

/* Make <reference> tags visible in the editor (Quill leaves their content
   in-flow, so without styling they look identical to surrounding text). */
#section-edit-pane .ql-editor reference,
.ai-html reference {
  color: var(--accent);
  font-size: 0.85em;
  vertical-align: super;
}

#section-edit-error {
  color: var(--accent);
  font-size: 12px;
}

/* Pricing tab — summary card + table of SKUs */
.pricing-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-2);
  margin-bottom: 14px;
}

.pricing-summary-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-3);
  font-weight: 600;
}

.pricing-summary-value {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

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

.pricing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.pricing-table thead th {
  position: sticky;
  top: 0;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 8px 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  font-weight: 600;
  white-space: nowrap;
}

.pricing-table thead th.num {
  text-align: right;
}

.pricing-table tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: top;
}

.pricing-table tbody tr:last-child td {
  border-bottom: 0;
}

.pricing-table tbody tr:hover {
  background: var(--fill-2);
}

.pricing-table td.num {
  text-align: right;
  white-space: nowrap;
}

.pricing-table td.mono {
  font-family: var(--mono);
}

.pricing-table .title {
  font-weight: 500;
  color: var(--ink);
}

.pricing-table .sub {
  font-size: 11px;
  margin-top: 2px;
}

.pricing-table tr.is-discontinued {
  opacity: .55;
}

/* Hide annotation overlay (mid-fi prototype handwriting) by default — can be toggled */
.anno-overlay {
  display: none;
}

reference {
  font-size: 8pt;
  vertical-align: super;
}

reference::before {
  background-size: 10px 10px;
  display: inline-block;
  width: 10px;
  height: 10px;
  content: "";
  background-image: url('https://emguidance.s3.eu-central-1.amazonaws.com/static/emg-logo-small.png');
}

/* ---------- Welcome / sign-in page ---------- */

.welcome-body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  font-family: var(--ui);
  color: var(--ink);
  background: radial-gradient(
      ellipse at top left,
      oklch(96% 0.04 250) 0%,
      oklch(94% 0.02 250) 35%,
      #eaeff5 100%
    );
}

.welcome-stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.welcome-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
}
.welcome-orb-a {
  width: 520px;
  height: 520px;
  background: oklch(78% 0.13 250);
  top: -160px;
  left: -120px;
}
.welcome-orb-b {
  width: 440px;
  height: 440px;
  background: oklch(82% 0.10 190);
  bottom: -140px;
  right: -100px;
}
.welcome-orb-c {
  width: 320px;
  height: 320px;
  background: oklch(86% 0.09 320);
  top: 40%;
  right: 18%;
  opacity: 0.35;
}

.welcome-card {
  position: relative;
  z-index: 1;
  width: min(560px, 92vw);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 22px;
  padding: 40px 44px 36px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 20px 60px -20px rgba(24, 32, 48, 0.25),
    0 6px 18px -8px rgba(24, 32, 48, 0.15);
  text-align: center;
}

.welcome-logo {
  height: 32px;
  width: auto;
  margin: 0 auto 18px;
  display: block;
  opacity: 0.9;
}

.welcome-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 14px;
}

.welcome-title {
  font-size: clamp(28px, 4.6vw, 40px);
  line-height: 1.1;
  margin: 0 0 14px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.welcome-title-strong {
  background: linear-gradient(
    100deg,
    oklch(48% 0.16 260) 0%,
    oklch(58% 0.14 220) 50%,
    oklch(60% 0.12 190) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.welcome-title-soft {
  display: block;
  font-weight: 600;
  color: var(--ink-2);
  font-size: 0.78em;
  margin-top: 2px;
}

.welcome-tagline {
  margin: 0 auto 6px;
  max-width: 42ch;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.5;
}

.welcome-flourish {
  margin: 0 0 26px;
  font-family: var(--hand);
  font-size: 22px;
  color: oklch(55% 0.14 250);
  transform: rotate(-2deg);
}

.welcome-cta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  background: #ffffff;
  color: var(--ink);
  font-family: var(--ui);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid rgba(24, 32, 48, 0.12);
  border-radius: 999px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 6px 16px -6px rgba(24, 32, 48, 0.25);
  transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.12s ease;
}
.welcome-cta:hover {
  background: #f8fafc;
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 10px 24px -8px rgba(24, 32, 48, 0.3);
}
.welcome-cta:active {
  transform: translateY(0);
}
.welcome-cta-g {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.welcome-restriction {
  margin: 22px 0 0;
  font-size: 12.5px;
  color: var(--ink-3);
}
.welcome-restriction strong {
  color: var(--ink-2);
  font-weight: 600;
}

.welcome-foot {
  position: absolute;
  bottom: 18px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  z-index: 1;
}