/* nefertem — evening spa, dark by default. hygieia's dark plum family
   (pink-plum primary), champagne-gold Facts panel, dusty-rose/sand warnings,
   mono INCI print. */

:root {
  color-scheme: dark;
  /* Plum family lifted from hygieia's dark plum palette (web/src/index.css). */
  --night: oklch(0.18 0.045 325);
  --card: oklch(0.23 0.055 325);
  --well: oklch(0.14 0.04 325);
  --ink: oklch(0.93 0.025 340);
  --gray: oklch(0.72 0.035 340);
  --line: oklch(0.34 0.05 330);
  --plum: oklch(0.74 0.13 345);
  --plum-deep: oklch(0.82 0.09 340);
  --plum-soft: oklch(0.36 0.08 340);
  --plum-text: oklch(0.18 0.045 325);
  --gold: #dcb883;
  --gold-text: #2a2012;
  --sand: #e5b878;
  --sand-soft: #4d3b24;
  --rose: #ef9d9d;
  --rose-strong: #c9545e;
  --rose-soft: #4f2e37;
  --display: 'Instrument Serif', georgia, serif;
  --ui: 'Archivo', system-ui, sans-serif;
  --mono: 'Spline Sans Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; }

body {
  background:
    radial-gradient(1100px 700px at 12% -8%, oklch(0.23 0.06 340 / 0.55), transparent 60%),
    radial-gradient(900px 600px at 105% 12%, oklch(0.21 0.075 305 / 0.45), transparent 55%),
    var(--night);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.45;
  padding: 2.5rem clamp(1rem, 4vw, 3rem) 4rem;
  max-width: 1280px;
  margin-inline: auto;
}

/* ——— header ——— */

header {
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.auth-area { display: flex; align-items: center; gap: 0.6rem; padding-top: 1rem; }
.auth-email { font-family: var(--mono); font-size: 0.75rem; color: var(--gray); }

dialog {
  margin: auto; /* the global margin reset kills the UA centering — restore it */
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.5rem 1.75rem;
  max-width: 340px;
  width: 90vw;
}
dialog::backdrop { background: rgba(10, 7, 14, 0.6); }
dialog h2 {
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  font-size: 1.5rem;
  color: var(--plum-deep);
  margin-bottom: 0.75rem;
}
dialog label {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gray);
  margin: 0.8rem 0 0.3rem;
}
dialog input {
  width: 100%;
  font-family: var(--mono);
  font-size: 1rem; /* <16px triggers iOS auto-zoom on focus */
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--well);
  color: var(--ink);
}
dialog input:focus-visible { outline: 2px solid var(--plum); outline-offset: 1px; }
.auth-actions { margin-top: 1.1rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.auth-error { color: var(--rose); font-size: 0.8rem; margin-top: 0.7rem; }
.small-inline { text-transform: none; letter-spacing: 0; font-weight: 400; }
header h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.6rem, 6vw, 4rem);
  letter-spacing: 0.01em;
  color: var(--plum-deep);
}
header h1 em { font-style: italic; }
.tagline {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--gray);
  margin-top: 0.25rem;
}

/* ——— compare dialog ——— */

#compare-dialog { max-width: 760px; width: 94vw; }
.compare-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.compare-pickers {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin: 0.9rem 0 1rem;
  flex-wrap: wrap;
}
.compare-pickers select {
  flex: 1;
  min-width: 200px;
  background: var(--well);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0.5rem 0.7rem;
  font-family: var(--ui);
  font-size: 1rem;
}
.cmp-meter {
  height: 6px;
  border-radius: 999px;
  background: var(--well);
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.cmp-meter-fill { height: 100%; background: var(--plum); border-radius: 999px; }
.cmp-verdict { font-size: 0.9rem; margin-bottom: 0.6rem; }
.cmp-line { font-size: 0.8rem; color: var(--gray); margin: 0.35rem 0; }
.cmp-line strong { color: var(--plum-deep); font-weight: 600; }
.cmp-conflict {
  font-size: 0.8rem;
  color: var(--rose);
  background: var(--rose-soft);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  margin: 0.5rem 0;
}
.cmp-table-wrap {
  overflow: auto;
  max-height: 45vh;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-top: 0.8rem;
}
.cmp-table { border-collapse: collapse; width: 100%; }
.cmp-table th, .cmp-table td {
  border-bottom: 1px solid var(--line);
  padding: 0.4rem 0.6rem;
  text-align: left;
  vertical-align: top;
  font-size: 0.75rem;
}
.cmp-table thead th {
  position: sticky; top: 0;
  background: var(--card);
  color: var(--plum-deep);
  border-bottom: 2px solid var(--plum);
}
.cmp-table tbody th { font-weight: 600; min-width: 110px; }

.intake-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }

/* ——— routine bar ——— */

.routine-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.routine-id { flex: 1; min-width: 220px; }
.routine-eyebrow {
  display: block;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--gray);
  margin-bottom: 0.05rem;
}
.routine-name {
  width: 100%;
  font-family: var(--display);
  font-style: italic;
  font-size: 1.9rem;
  color: var(--plum-deep);
  background: transparent;
  border: none;
  border-bottom: 1px dashed transparent;
  padding: 0 0.2rem 0.1rem 0;
  min-width: 220px;
  flex: 1;
}
.routine-name { border-bottom-color: var(--plum-soft); } /* rest state hints editability */
.routine-name:hover { border-bottom-color: var(--line); }
.routine-name:focus-visible { outline: none; border-bottom-color: var(--plum); }
.routine-controls { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.routine-controls select {
  background: var(--well);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-family: var(--ui);
  font-size: 1rem;
  max-width: min(60vw, 260px);
  overflow: hidden;
  text-overflow: ellipsis;
}
.routine-controls select:focus-visible { outline: 2px solid var(--plum); outline-offset: 1px; }

/* ——— shared routine view ——— */

.share-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--plum);
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  padding: 0.7rem 0.9rem;
  margin-bottom: 1.25rem;
}
.share-banner[hidden] { display: none; } /* the display above would outrank the UA rule */
.share-banner p { font-size: 0.85rem; }
.share-banner strong { color: var(--plum-deep); }
.share-banner-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* A snapshot is someone else's routine — every editing affordance stands down.
   The order picker keeps working: it's a view, not an edit. */
.shared-view .intake,
.shared-view .routine-controls,
.shared-view .empty button,
.shared-view .bottle .remove { display: none; }
.shared-view .bottle-name { border-bottom-color: transparent; cursor: default; }
.shared-view .bottle-name:hover { color: var(--ink); }
.shared-view .routine-name { border-bottom-color: transparent; }
.shared-view .shelf .part,
.shared-view .shelf .day { pointer-events: none; }

/* ——— intake ——— */

.intake {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  padding: 1.25rem 1.5rem 1.5rem;
  margin: 0 0 1.75rem;
}
.intake h2 {
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  font-size: 1.6rem;
  color: var(--plum-deep);
  margin-bottom: 0.5rem;
}
.intake-row { display: flex; gap: 0.5rem; align-items: stretch; flex-wrap: wrap; }
.intake-row .suggest-wrap { flex: 1; min-width: 240px; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
}
.icon-btn svg { flex-shrink: 0; }
.intake label {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gray);
  margin: 0.9rem 0 0.3rem;
}
.intake label:first-child { margin-top: 0; }
.intake input, .intake textarea {
  width: 100%;
  font-family: var(--mono);
  font-size: 1rem; /* <16px triggers iOS auto-zoom on focus */
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--well);
  color: var(--ink);
  resize: vertical;
}
.intake input:focus-visible, .intake textarea:focus-visible,
button:focus-visible {
  outline: 2px solid var(--plum);
  outline-offset: 1px;
}
.intake-actions { margin-top: 1rem; display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.new-toggle { display: flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; font-weight: 600; color: var(--gray); cursor: pointer; }
.new-toggle input { accent-color: var(--plum); width: 1rem; height: 1rem; cursor: pointer; }

.suggest-wrap { position: relative; }
.suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--card);
  border: 1px solid var(--plum);
  border-radius: 10px;
  overflow: hidden;
  z-index: 20;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}
.suggestion {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: 0;
  color: var(--ink);
  font-weight: 400;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--line);
}
.suggestion:last-child { border-bottom: none; }
.suggestion:hover { background: var(--plum-soft); }
.suggestion-note {
  padding: 0.55rem 0.8rem;
  font-size: 0.78rem;
  color: var(--gray);
}
.lookup-btn, .candidate {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: 0;
  border-top: 1px solid var(--line);
  color: var(--plum-deep);
  font-weight: 500;
  font-size: 0.82rem;
  padding: 0.55rem 0.8rem;
}
.candidate { color: var(--ink); font-weight: 400; }
.candidate-meta {
  display: block;
  font-size: 0.68rem;
  color: var(--gray);
  margin-top: 0.15rem;
  line-height: 1.35;
}
.lookup-btn:hover, .candidate:hover { background: var(--plum-soft); }

.import-photo-btn {
  font-family: var(--ui);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--gray);
  cursor: pointer;
}
.import-photo-btn:hover { color: var(--plum-deep); border-color: var(--plum); }
.url-row { display: flex; gap: 0.5rem; margin-top: 0.6rem; }
.url-row[hidden] { display: none; } /* author display beats the UA [hidden] rule */
.url-row input { flex: 1; }
.intake-status {
  margin-top: 0.7rem;
  font-size: 0.8rem;
  color: var(--plum-deep);
}
.intake-status.error { color: var(--rose); }
.suggestions button.active { background: var(--plum-soft); }

button {
  font-family: var(--ui);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.55rem 1.3rem;
  border: 1px solid var(--plum);
  border-radius: 999px;
  background: var(--plum);
  color: var(--plum-text);
  cursor: pointer;
}
button:hover { background: var(--plum-deep); border-color: var(--plum-deep); }
button.ghost {
  background: transparent;
  color: var(--gray);
  border-color: var(--line);
}
/* Neutral ghosts warm toward plum; only destructive actions glow rose. */
button.ghost:hover { color: var(--plum-deep); border-color: var(--plum); background: transparent; }
button.ghost.danger:hover { color: var(--rose); border-color: var(--rose); }

/* ——— empty state ——— */

.empty { text-align: center; padding: 2.5rem 1rem 2rem; color: var(--gray); }
.empty > p:first-child {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.5rem;
  color: var(--ink);
  margin-bottom: 0.3rem;
}
.empty button { margin: 0.9rem 0 0.6rem; }

/* ——— shelf ——— */

.shelf { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; }
.shelf-sec { margin-bottom: 1.75rem; }
.shelf-sec > details > summary h2,
#grid-wrap summary h2 {
  display: inline;
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  font-size: 1.6rem;
  color: var(--plum-deep);
}
.bottle {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--plum);
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  padding: 0.7rem 2rem 0.7rem 0.9rem;
  min-width: 180px;
}
.bottle h3 { font-size: 0.85rem; font-weight: 600; }
.bottle .new-pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--plum-soft);
  color: var(--plum-deep);
  border: 1px solid var(--plum);
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  margin-left: 0.4rem;
  vertical-align: middle;
}
.bottle-name {
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  font: inherit;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  border-bottom: 1px dashed var(--plum-soft); /* visible edit affordance */
}
.bottle-name:hover { color: var(--plum-deep); border-bottom-color: var(--plum); background: none; }
.bottle p { font-size: 0.72rem; color: var(--gray); font-family: var(--mono); margin-top: 0.2rem; }
.bottle .un-note { color: var(--sand); }
.bottle .fa-verdict { font-size: 0.72rem; font-family: var(--mono); margin-top: 0.3rem; }
.bottle .fa-verdict.fa-clean { color: var(--gray); }
.bottle .fa-verdict.fa-flagged { color: var(--sand); }
.bottle .remove {
  position: absolute; top: 0.3rem; right: 0.3rem;
  background: none; border: none; color: var(--gray);
  font-size: 1rem; line-height: 1; padding: 0.2rem 0.4rem;
}
.bottle .remove:hover { color: var(--rose); background: none; border-color: transparent; }

/* per-product schedule controls */
.sched { display: flex; gap: 0.35rem; margin-top: 0.55rem; align-items: center; flex-wrap: wrap; }
.sched .part {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: var(--well);
  color: var(--gray);
  border: 1px solid var(--line);
}
.sched .part.on { background: var(--plum); color: var(--plum-text); border-color: var(--plum); }
.sched .days { display: flex; gap: 3px; }
.sched .day {
  font-family: var(--mono);
  font-size: 0.68rem;
  width: 1.65rem;
  height: 1.65rem;
  padding: 0;
  border-radius: 50%;
  background: var(--well);
  color: var(--gray);
  border: 1px solid var(--line);
}
.sched .day.on { background: var(--plum-soft); color: var(--ink); border-color: var(--plum); }
/* application zones — same pills as AM/PM, set apart from the day dots */
.sched .zones { display: flex; gap: 0.35rem; margin-left: 0.25rem; }

.th-sched {
  display: block;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--gray);
  margin-top: 0.15rem;
}

/* ——— collapsible section headers ——— */

summary.sec-head {
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}
summary.sec-head::-webkit-details-marker { display: none; }
summary.sec-head::after {
  content: '▸';
  color: var(--gray);
  font-size: 0.9rem;
  margin-left: auto;
}
details[open] > summary.sec-head::after { content: '▾'; }
details[data-sec] > *:not(summary) { margin-top: 0.6rem; }
details[data-sec] > summary + * { margin-top: 0.75rem; }

/* ——— apply in this order ——— */

.order {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  padding: 0.9rem 1.25rem 1.1rem;
}
.panels .order { min-width: 0; }
.warnings { margin-bottom: 1.75rem; }
.order h2 {
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  font-size: 1.6rem;
  color: var(--plum-deep);
}
.order-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.order-picker { margin-top: 0; } /* borrows .sched's chips, not its stacking */
.order-steps { list-style: none; margin: 0.8rem 0 0; padding: 0; }
.order-steps li {
  display: grid;
  grid-template-columns: 1.7rem 1fr auto;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
  background: var(--card); /* opaque, so a dragged row covers the one beneath */
}
.order-steps li.dragging { opacity: 0.75; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5); }
/* Drag handle: one pointer path for mouse and touch, so the row itself stays
   selectable and a touch-drag starts only from here. */
.order-grip {
  grid-column: 3;
  grid-row: 1 / span 3;
  align-self: center;
  background: none;
  border: none;
  color: var(--gray);
  font-size: 0.95rem;
  line-height: 1;
  padding: 0.2rem 0.35rem;
  cursor: grab;
  touch-action: none; /* the browser must not claim the gesture for scrolling */
}
.order-grip:hover { color: var(--plum-deep); background: none; border-color: transparent; }
.order-steps li.dragging .order-grip { cursor: grabbing; }
.order-custom { margin-top: 0.6rem; }
.order-custom button { font-size: 0.7rem; padding: 0.25rem 0.7rem; }
.order-steps li:last-child { border-bottom: none; }
/* The step number comes from the flat order, not from the row's position: a
   hand-arranged order can move a product across a slot boundary, and the
   number it keeps is the one that says when it goes on. */
.order-steps li::before {
  content: attr(data-step);
  grid-column: 1;
  grid-row: 1 / span 3;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--plum);
}
/* ——— slots ——— */
.order-steps li.order-slot {
  display: block;
  border-bottom: none;
  padding: 0.9rem 0 0.1rem;
}
.order-steps li.order-slot:first-child { padding-top: 0.2rem; }
.order-steps li.order-slot::before { content: none; }
.order-slot-label {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--plum-deep);
}
.order-slot-hint { display: block; font-size: 0.78rem; color: var(--gray); }
.order-slot.is-invite .order-slot-hint { font-style: italic; }
.order-slot.is-unfilled .order-slot-label { color: var(--rose); }
.order-slot.is-unfilled .order-slot-hint { color: var(--rose); }
.order-subtype {
  grid-column: 2;
  justify-self: start;
  font-family: var(--mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gray);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.02rem 0.5rem;
  margin-bottom: 0.15rem;
}
/* The warning vocabulary at row scale — same rose left rule, no card. */
.order-flag {
  grid-column: 2;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-top: 0.3rem;
  padding-left: 0.5rem;
  border-left: 3px solid var(--rose);
  font-size: 0.75rem;
  color: var(--rose);
}
.order-flag-x {
  background: none;
  border: none;
  color: var(--gray);
  font-size: 0.85rem;
  line-height: 1;
  padding: 0 0.2rem;
}
.order-flag-x:hover { color: var(--rose); background: none; border-color: transparent; }
.order-name { grid-column: 2; font-size: 0.9rem; font-weight: 600; }
.order-zone { font-size: 0.78rem; font-weight: 400; color: var(--gray); }
.order-note { grid-column: 2; font-size: 0.78rem; color: var(--gray); margin-top: 0.1rem; }

/* ——— grid ——— */

.grid-scroll {
  overflow: auto;
  max-height: min(70vh, 42rem); /* makes the sticky header actually stick */
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}
.grid-scroll table { border-collapse: collapse; width: 100%; }
.grid-scroll th, .grid-scroll td {
  border-bottom: 1px solid var(--line);
  padding: 0.5rem 0.7rem;
  text-align: left;
  vertical-align: top;
  min-width: 170px;
}
.grid-scroll thead th {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--card);
  position: sticky; top: 0;
  border-bottom: 2px solid var(--plum);
  color: var(--plum-deep);
}
.role-col {
  position: sticky; left: 0;
  background: var(--card);
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 150px; max-width: 170px;
  border-right: 1px solid var(--line);
}
tr.group th.role-col {
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--plum-deep);
  background: var(--plum-soft);
  border-right: none;
}
tr.group td { background: var(--plum-soft); }
.count {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--gray);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 0.4em;
  margin-left: 0.4em;
}
.none { color: var(--line); }

/* ——— chips ——— */

.chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  margin: 0.1rem 0.15rem 0.1rem 0;
  border: 1px solid transparent;
  cursor: default;
}
.chip.key { background: var(--plum); color: var(--plum-text); font-weight: 500; }
.chip.sup { background: var(--plum-soft); color: var(--ink); }
.chip.guess { background: var(--card); border: 1px dashed var(--gray); color: var(--gray); }
.chip.un { background: var(--well); border: 1px solid var(--line); color: var(--gray); }
.chip.hl { outline: 2px solid var(--gold); outline-offset: 1px; }
.chip:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

.legend { font-size: 0.75rem; color: var(--gray); margin: 0.6rem 0 0; }
.legend .chip { pointer-events: none; }

/* ——— inline glossary ——— */

.gloss {
  position: relative;
  border-bottom: 1px dotted currentColor;
  cursor: help;
}
.gloss::after {
  content: attr(data-gloss);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  width: max-content;
  max-width: 260px;
  white-space: normal;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  font-family: var(--ui);
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.4;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}
.gloss:hover::after, .gloss:focus-visible::after { opacity: 1; }

/* ——— fungal-acne check ——— */

.fa-toggle-bar { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; margin-bottom: 1rem; }
.fa-toggle { display: flex; align-items: center; gap: 0.45rem; font-size: 0.82rem; font-weight: 600; cursor: pointer; }
.fa-toggle input { accent-color: var(--plum); width: 1rem; height: 1rem; cursor: pointer; }
.fa-toggle-bar .small { margin: 0; }

/* ——— analysis panels ——— */

.panels {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
  align-items: start;
}
@media (max-width: 800px) { .panels { grid-template-columns: 1fr; } }

/* Facts panel — Drug-Facts structure, champagne-gold dress (the one gold moment). */
.facts {
  background: var(--card);
  border: 2px solid var(--gold);
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  padding: 0.8rem 1rem 1rem;
}
.facts h2 {
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  color: var(--gold);
  border-bottom: 2px solid var(--gold);
  padding-bottom: 0.2rem;
}
.facts-sub { font-size: 0.72rem; color: var(--gray); margin: 0.25rem 0 0.5rem; }
.spf-notes {
  list-style: none;
  margin: 0.4rem 0 0.6rem;
  padding: 0.45rem 0.6rem;
  border-left: 2px solid var(--gold);
  font-size: 0.72rem;
  color: var(--gray);
}
.spf-notes li + li { margin-top: 0.25rem; }
summary.facts-bar {
  cursor: pointer;
  user-select: none;
  list-style: none; /* custom chevron below */
}
summary.facts-bar::-webkit-details-marker { display: none; }
summary.facts-bar::after { content: '▸'; float: right; }
.facts-sec[open] > summary.facts-bar::after { content: '▾'; }
.facts-bar {
  background: var(--gold);
  color: var(--gold-text);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  margin: 0.6rem -0.25rem 0.2rem;
}
.facts-list { margin: 0; }
.fact {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.82rem;
}
div.fact { display: flex; justify-content: space-between; gap: 1rem; }
.fact-row summary {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.fact-row summary::-webkit-details-marker { display: none; }
.fact-row .who::after { content: ' ▸'; color: var(--gray); font-weight: 400; }
.fact-row[open] .who::after { content: ' ▾'; }
.fact-products {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--gray);
  padding: 0.15rem 0 0.25rem 0.6rem;
}
.fact:last-child { border-bottom: none; }
.fact .fact-label { font-weight: 600; white-space: nowrap; }
.fact .fact-side { text-align: right; }
.fact .ok { color: var(--gold); font-weight: 800; }
.fact .who { font-family: var(--mono); font-size: 0.7rem; color: var(--gray); }
/* 'light' — a role only present as a trace ingredient: weaker than the gold
   ✓, stronger than the rose missing pill (FEAT-027). */
.fact .light-ok { color: var(--gray); font-weight: 800; }
.fact-row.is-light summary .fact-label { color: var(--gray); }
.fact .missing {
  background: var(--rose-soft);
  color: var(--rose);
  font-weight: 800;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--rose);
}
.fact .absent { color: var(--gray); font-size: 0.75rem; }

/* warnings */
.warnings h2 {
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  font-size: 1.6rem;
  color: var(--plum-deep);
  margin-bottom: 0.6rem;
}
.warning {
  display: flex;
  gap: 0.8rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--gray);
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.6rem;
}
.warning.conflict { border-left-color: var(--rose); }
.warning.caution { border-left-color: var(--sand); }
.warning .tag {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  height: fit-content;
  background: var(--well);
  color: var(--gray);
}
.warning.conflict .tag { background: var(--rose-soft); color: var(--rose); }
.warning.caution .tag { background: var(--sand-soft); color: var(--sand); }
.warning strong { font-size: 0.88rem; }
.warning p { font-size: 0.8rem; color: var(--gray); margin-top: 0.15rem; }

/* irritation load */
.irritation { margin-top: 1rem; }
.irritation h3 {
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  font-size: 1.1rem;
  color: var(--plum-deep);
  margin-bottom: 0.5rem;
}
.irritation-row {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--plum);
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.5rem;
}
.irritation-row.heavy { border-left-color: var(--rose); }
.irritation-row strong { font-size: 0.85rem; }
.irritation-row p { font-size: 0.78rem; color: var(--gray); margin-top: 0.15rem; }
.irritation-meter { display: flex; gap: 3px; margin-top: 0.3rem; }
.irritation-meter .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--well); border: 1px solid var(--line); }
.irritation-meter .dot.on { background: var(--plum); border-color: var(--plum); }
.irritation-row.heavy .irritation-meter .dot.on { background: var(--rose); border-color: var(--rose); }
.irritation-rest {
  font-size: 0.8rem;
  color: var(--sand);
  background: var(--sand-soft);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  margin: 0.5rem 0;
}

/* "new to me" guidance — ramp entries reuse .warning's shape, plum instead of alarm */
.intro-guidance { margin-top: 1rem; }
.intro-guidance h3 {
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  font-size: 1.1rem;
  color: var(--plum-deep);
  margin-bottom: 0.5rem;
}
.warning.ramp { border-left-color: var(--plum); }
.warning.ramp .tag { background: var(--plum-soft); color: var(--plum-deep); }
.intro-timelines { list-style: none; padding: 0; margin: 0.4rem 0 0; }
.intro-timelines li { font-size: 0.78rem; color: var(--gray); padding: 0.3rem 0; border-bottom: 1px solid var(--line); }
.intro-timelines li:last-child { border-bottom: none; }
.intro-timelines strong { color: var(--plum-deep); font-weight: 600; }

.quiet { color: var(--gray); }
.small { font-size: 0.75rem; margin-top: 0.75rem; }

footer {
  margin-top: 3rem;
  font-size: 0.75rem;
  color: var(--gray);
  border-top: 1px solid var(--line);
  padding-top: 0.75rem;
}

@media (prefers-reduced-motion: no-preference) {
  .chip { transition: outline-color 120ms ease; }
  dialog[open] { animation: dlg-in 160ms ease-out; }
  @keyframes dlg-in {
    from { opacity: 0; transform: translateY(6px) scale(0.98); }
  }
}
dialog::backdrop { backdrop-filter: blur(2px); }
