:root {
  --ink: #1d2838;
  --muted: #637083;
  --paper: #fbfcf8;
  --panel: #ffffff;
  --line: #d8e0df;
  --teal: #0f766e;
  --blue: #2f6fed;
  --violet: #7c3aed;
  --amber: #d97706;
  --red: #dc2626;
  --green: #16803a;
  --coral: #e4572e;
  --shadow: 0 10px 32px rgba(29, 40, 56, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(47, 111, 237, 0.08), transparent 32%),
    radial-gradient(circle at 82% 12%, rgba(228, 87, 46, 0.1), transparent 28%),
    var(--paper);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html,
body {
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.topbar {
  display: block;
  min-height: 78px;
  padding: 8px 4px 16px;
}

.brand-block {
  min-width: 0;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 0;
}

.brand-mark {
  width: clamp(54px, 6vw, 70px);
  height: clamp(54px, 6vw, 70px);
  flex: 0 0 auto;
}

.share-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid #c7d4d2;
  border-radius: 999px;
  padding: 4px 15px 4px 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 850;
  box-shadow: 0 8px 20px rgba(29, 40, 56, 0.08);
}

.share-mark {
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(15, 118, 110, 0.1);
}

.share-label {
  white-space: nowrap;
}

.share-button:hover,
.share-button:focus-visible {
  border-color: var(--teal);
  background: #f4faf8;
  outline: none;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 720px;
  margin-bottom: 0;
  font-size: clamp(2.35rem, 4vw, 3.6rem);
  line-height: 0.9;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.08rem;
  line-height: 1.2;
}

h3 {
  margin-bottom: 8px;
  font-size: 0.98rem;
  line-height: 1.25;
}

.safety-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  font-size: 0.82rem;
  line-height: 1.45;
  box-shadow: none;
  overflow: visible;
}

.bottom-note {
  grid-area: caveat;
  width: 100%;
}

.safety-note small {
  display: block;
  margin-bottom: 3px;
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.safety-note strong {
  display: block;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.2;
}

.safety-note p {
  max-width: 980px;
  margin: 0;
  padding: 0 16px 16px;
  color: #4b5563;
}

.privacy-footer {
  max-width: 980px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.footer-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.footer-links {
  display: flex;
  gap: 14px;
}

.footer-links a,
.creator-credit a {
  color: #52615a;
  font-weight: 850;
  text-decoration: none;
}

.creator-credit {
  color: #52615a;
  font-weight: 800;
  text-align: right;
}

.footer-links a:hover,
.creator-credit a:hover {
  color: var(--teal);
}

.privacy-footer details {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.privacy-footer summary {
  width: fit-content;
  cursor: pointer;
  color: #52615a;
  font-weight: 850;
}

.privacy-copy {
  display: grid;
  gap: 8px;
  max-width: 760px;
  margin-top: 10px;
}

.privacy-copy h4 {
  margin: 6px 0 0;
  color: var(--ink);
  font-size: 0.84rem;
  line-height: 1.2;
}

.privacy-copy p {
  margin: 0;
  color: #4b5563;
}

.footer-share-row {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.feedback-shell {
  min-height: 100vh;
}

.feedback-topbar {
  min-height: 70px;
}

.feedback-brand {
  color: var(--ink);
  text-decoration: none;
}

.feedback-brand h1 {
  font-size: clamp(2rem, 3vw, 2.8rem);
}

.feedback-page {
  display: grid;
  place-items: start center;
  min-height: 58vh;
  padding: 10px 0 26px;
}

.feedback-card {
  width: min(680px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.feedback-form {
  display: grid;
  gap: 14px;
}

.feedback-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 820;
}

.feedback-form label span,
.feedback-status {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 650;
}

.feedback-status {
  min-height: 1.2em;
  margin: 0;
}

.feedback-honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.feedback-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.feedback-actions .ghost-button,
.feedback-actions button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  text-decoration: none;
}

.feedback-actions .ghost-button {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  background: #fff;
  font-size: 0.87rem;
  font-weight: 750;
}

.feedback-actions button {
  background: var(--ink);
  color: #fff;
  font-weight: 850;
}

.feedback-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "intake"
    "visual"
    "analysis"
    "food"
    "plan"
    "sources"
    "caveat";
  align-items: start;
  gap: 16px;
}

.intake-panel,
.visual-panel,
.analysis-panel,
.food-panel,
.plan-panel,
.sources-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.intake-panel {
  grid-area: intake;
  align-self: start;
  padding: 12px;
}

.visual-panel {
  grid-area: visual;
  padding: 16px;
}

.analysis-panel {
  grid-area: analysis;
  padding: 16px;
}

.food-panel {
  grid-area: food;
  padding: 16px;
}

.plan-panel {
  grid-area: plan;
  padding: 16px;
}

.sources-panel {
  grid-area: sources;
  padding: 0;
  box-shadow: none;
  overflow: visible;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.section-head.compact {
  margin-bottom: 10px;
}

.ghost-button,
.search-row button,
.scan-button,
#copyPlan {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease,
    color 140ms ease;
}

.ghost-button,
#copyPlan {
  padding: 8px 11px;
  font-size: 0.87rem;
  font-weight: 700;
}

.ghost-button:hover,
#copyPlan:hover {
  border-color: #9db3b0;
  background: #f4faf8;
}

.ghost-button:disabled,
.search-row button:disabled,
.scan-button:disabled,
#copyPlan:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.control-group {
  display: grid;
  gap: 7px;
  margin-bottom: 10px;
  max-width: 680px;
}

.intake-controls-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 760;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px auto;
  gap: 8px;
  align-items: center;
}

.search-row input,
.search-row button,
.search-field {
  min-width: 0;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input {
  height: 40px;
  padding: 0 12px;
}

textarea {
  min-height: 106px;
  resize: vertical;
  padding: 12px;
  line-height: 1.45;
}

input:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.13);
}

.search-row button,
button.file-button {
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 800;
  white-space: nowrap;
}

.search-row button {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.search-row button:hover {
  background: #111827;
}

.scan-button {
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 800;
  white-space: nowrap;
}

.search-row .scan-button {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.scan-button:hover {
  border-color: #9db3b0;
  background: #f4faf8;
}

.mode-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  border: 1px solid #e3e9e8;
  border-radius: 8px;
  padding: 8px 9px;
  background: #fbfdfc;
}

.mode-toggle input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--teal);
}

.mode-toggle span {
  display: grid;
  gap: 2px;
}

.mode-toggle strong {
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 680;
  line-height: 1.2;
}

.mode-toggle small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.3;
}

.label-scan-status {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fbfdfc;
  color: #475569;
  font-size: 0.8rem;
  line-height: 1.38;
}

.label-scan-status[hidden] {
  display: none;
}

.label-scan-status strong {
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1.22;
}

.label-scan-status p {
  margin: 0;
}

.label-scan-status small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 760;
}

.label-scan-status.working {
  border-color: #c7d4d2;
  background: #f4faf8;
}

.label-scan-status.error {
  border-color: #fecaca;
  background: #fff7f7;
}

.label-scan-status.success {
  border-color: #bbf7d0;
  background: #f7fef9;
}

.scan-review summary {
  cursor: pointer;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
}

.scan-items {
  display: grid;
  gap: 5px;
  margin-top: 7px;
}

.scan-review-list {
  display: grid;
  gap: 6px;
}

.scan-check-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  border-top: 1px solid #e8eeee;
  padding-top: 6px;
}

.scan-check-row input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--teal);
}

.scan-check-row span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.scan-check-row strong {
  overflow-wrap: anywhere;
}

.scan-check-row em,
.scan-review-status {
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 800;
}

.scan-check-row.is-disabled {
  opacity: 0.62;
}

.scan-review-status {
  min-height: 1em;
  margin: 0;
}

.scan-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.scan-confirm-actions button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 850;
}

.scan-confirm-actions #scanConfirm {
  background: var(--ink);
  color: #fff;
}

.scan-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: baseline;
  border-top: 1px solid #e8eeee;
  padding-top: 5px;
}

.scan-item span {
  min-width: 0;
  color: var(--ink);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.scan-item em {
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.scan-item.added em {
  color: var(--green);
}

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

.selected-stack {
  display: grid;
  gap: 8px;
  min-width: 0;
  min-height: 46px;
  margin: 0;
}

.stack-masonry {
  display: grid;
  grid-template-columns: repeat(var(--stack-columns, 1), minmax(0, 1fr));
  gap: 8px;
  align-items: start;
}

.stack-masonry-column {
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 0;
}

.stack-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.subtle-action {
  color: #64748b;
  font-size: 0.82rem;
}

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

.stack-editor-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.8rem;
}

.stack-editor-head strong {
  color: var(--ink);
  font-size: 0.86rem;
}

.stack-group .stack-chip {
  background: #fff;
}

.stack-group-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stack-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 9px 6px 6px;
  background: #fff;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 750;
  white-space: normal;
}

.stack-chip:hover {
  border-color: #a9b8b6;
  background: #f8fbfa;
}

.chip-symbol {
  display: inline-grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 999px;
  background: var(--chip-color, var(--teal));
  color: #fff;
  font-size: 0.76rem;
  font-weight: 900;
}

.chip-name {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.2;
}

.chip-remove {
  color: #8b95a1;
  font-weight: 900;
}

.graph-wrap {
  position: relative;
  overflow: hidden;
  min-height: 420px;
  border: 1px solid #dbe5e3;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(29, 40, 56, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(29, 40, 56, 0.04) 1px, transparent 1px),
    #fbfdfc;
  background-size: 30px 30px;
  touch-action: pan-y;
}

.map-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
}

.zoom-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 32px;
  min-width: 34px;
  padding: 0;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
}

#interactionGraph {
  display: block;
  width: 100%;
  height: 420px;
  touch-action: pan-y;
}

.graph-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.35;
  overflow-wrap: anywhere;
  pointer-events: none;
  text-align: center;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 10px;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 850;
}

.map-legend {
  margin-top: 8px;
}

.map-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.35;
}

.nutrient-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.nutrient-group summary,
.stack-group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  color: #475569;
  font-size: 0.82rem;
  font-weight: 900;
}

.nutrient-group summary {
  cursor: pointer;
}

.nutrient-group summary > span:last-child,
.stack-group-head > span:last-child {
  color: var(--muted);
}

.category-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.category-help {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border: 1px solid #b8c7c5;
  border-radius: 999px;
  color: #64748b;
  background: #fff;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
  outline: none;
}

.category-help:hover,
.category-help:focus-visible {
  border-color: var(--teal);
  color: var(--teal);
  background: #f4faf8;
}

.category-tooltip {
  position: absolute;
  z-index: 20;
  left: 0;
  bottom: calc(100% + 9px);
  display: grid;
  gap: 5px;
  width: min(260px, 72vw);
  padding: 10px 11px;
  border: 1px solid #cddbd8;
  border-radius: 8px;
  color: #334155;
  background: #fff;
  box-shadow: 0 12px 28px rgba(29, 40, 56, 0.16);
  opacity: 0;
  pointer-events: none;
  transform: translate(0, 5px);
  transition:
    opacity 120ms ease,
    transform 120ms ease;
}

.category-tooltip strong {
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1.2;
}

.category-tooltip span {
  color: #475569;
  font-size: 0.73rem;
  font-weight: 700;
  line-height: 1.32;
}

.category-help:hover .category-tooltip,
.category-help:focus .category-tooltip,
.category-help:focus-within .category-tooltip,
.category-help:focus-visible .category-tooltip {
  opacity: 1;
  transform: translate(0, 0);
}

.nutrient-group div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 9px 9px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  background: #fff;
}

.legend-line {
  width: 26px;
  height: 0;
  border-top: 3px solid #64748b;
  border-radius: 999px;
}

.legend-line.conflict {
  border-color: var(--red);
}

.legend-line.caution {
  border-color: var(--amber);
  border-top-style: dashed;
}

.legend-line.helper {
  border-color: var(--green);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.food-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.food-note {
  border: 1px solid var(--line);
  border-left: 4px solid #94a3b8;
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
}

.food-note.avoid {
  border-left-color: var(--red);
}

.food-note.watch {
  border-left-color: var(--amber);
}

.food-note.help {
  border-left-color: var(--green);
}

.food-note strong {
  display: block;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.25;
}

.food-note p {
  margin: 5px 0 0;
  color: #475569;
  font-size: 0.82rem;
  line-height: 1.42;
}

.metric {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fbfdfc;
}

.metric strong {
  display: block;
  font-size: 1.1rem;
  line-height: 1;
}

.metric span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 760;
}

.findings-list {
  display: grid;
  gap: 8px;
}

.more-findings {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.more-findings > summary {
  cursor: pointer;
  padding: 11px 12px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 900;
}

.more-findings > div {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
}

.finding {
  border: 1px solid var(--line);
  border-left: 4px solid var(--finding-color, var(--blue));
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
  scroll-margin-top: 18px;
}

.finding.is-focused {
  border-color: color-mix(in srgb, var(--finding-color, var(--blue)) 55%, var(--line));
  background: color-mix(in srgb, var(--finding-color, var(--blue)) 7%, #fff);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--finding-color, var(--blue)) 18%, transparent),
    0 14px 30px rgba(29, 40, 56, 0.12);
}

.finding header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
}

.finding-title {
  font-weight: 900;
  line-height: 1.25;
}

.finding-title-block {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.severity,
.impact-pill {
  flex: 0 0 auto;
  align-self: start;
  border-radius: 999px;
  padding: 5px 8px;
  background: #f4f6f8;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.impact-pill.loss,
.impact-pill.conflict {
  background: #fff1f2;
  color: var(--red);
}

.impact-pill.gain,
.impact-pill.helper {
  background: #ecfdf5;
  color: var(--green);
}

.impact-pill.caution,
.impact-pill.unknown,
.impact-pill.medical {
  background: #fff7ed;
  color: #b45309;
}

.finding p {
  margin: 0 0 10px;
  color: #4a5568;
  font-size: 0.84rem;
  line-height: 1.45;
}

.action-line {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: var(--ink);
  font-size: 0.87rem;
  font-weight: 780;
  line-height: 1.4;
}

.action-line strong {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 2px 7px;
  color: var(--finding-color, var(--blue));
  background: color-mix(in srgb, var(--finding-color, var(--blue)) 11%, #fff);
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 1.45;
}

.action-line span {
  min-width: 0;
}

.finding-details {
  margin-top: 8px;
  border-top: 1px solid #eef2f1;
  padding-top: 7px;
}

.finding-details summary {
  cursor: pointer;
  color: var(--finding-color, var(--muted));
  font-size: 0.78rem;
  font-weight: 900;
}

.finding-details p {
  margin-top: 8px;
}

.compact-note {
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--muted);
  background: #fbfdfc;
  font-size: 0.82rem;
  line-height: 1.4;
}

.impact-card {
  display: grid;
  gap: 7px;
  border: 1px solid #dbe5e3;
  border-radius: 8px;
  padding: 9px 10px;
  margin: 8px 0 0;
  background: #fbfdfc;
}

.impact-card.loss {
  background: #fff7f7;
  border-color: #fecaca;
}

.impact-card.gain {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.impact-card.medical {
  background: #fff7ed;
  border-color: #fed7aa;
}

.impact-card.unknown {
  background: #f8fafc;
}

.impact-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.impact-top span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
}

.impact-top strong {
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1;
}

.impact-card p {
  margin: 0;
  color: #334155;
  font-size: 0.82rem;
}

.impact-card p strong {
  color: var(--ink);
}

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

.slot {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.slot-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  background: #f5f8f7;
  border-bottom: 1px solid var(--line);
}

.slot-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.slot-step {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 900;
}

.slot-head strong {
  min-width: 0;
  font-size: 0.9rem;
}

.slot-time {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.slot-body {
  display: grid;
  gap: 6px;
  padding: 10px;
}

.slot-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.slot-items-detail {
  border: 1px solid #e3e9e7;
  border-radius: 8px;
  background: #fbfdfc;
}

.slot-items-detail summary {
  cursor: pointer;
  padding: 7px 9px;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 850;
}

.slot-items-detail .slot-items {
  border-top: 1px solid #e3e9e7;
  padding: 8px;
}

.slot-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  border: 1px solid #e3e9e7;
  border-radius: 999px;
  padding: 4px 8px 4px 6px;
  background: #fbfdfc;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 760;
}

.slot-item::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--item-color, var(--blue));
}

.slot-note {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.42;
}

.sources-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 0 16px 16px;
}

.sources-meta {
  margin: -4px 16px 10px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 760;
}

.sources-panel summary,
.safety-note summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px;
  color: var(--ink);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 900;
  list-style: none;
}

.sources-panel summary::-webkit-details-marker,
.safety-note summary::-webkit-details-marker {
  display: none;
}

.sources-panel summary::after,
.safety-note summary::after {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  content: "+";
  font-size: 1.05rem;
  line-height: 1;
}

.sources-panel[open] summary::after,
.safety-note[open] summary::after {
  content: "-";
}

.sources-panel summary small,
.safety-note summary small {
  display: block;
  margin-bottom: 3px;
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.sources-panel summary em,
.safety-note summary em {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.74rem;
  font-style: normal;
  font-weight: 760;
}

.source-link {
  display: grid;
  gap: 7px;
  align-content: start;
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  color: var(--ink);
  background: #fff;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 760;
  cursor: pointer;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.source-link:hover,
.source-link:focus-visible {
  border-color: var(--teal);
  color: var(--teal);
  box-shadow: 0 10px 22px rgba(29, 40, 56, 0.1);
  outline: none;
  transform: translateY(-1px);
}

.source-title {
  color: var(--ink);
  line-height: 1.28;
}

.source-meta {
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 760;
}

.source-action {
  align-self: end;
  justify-self: start;
  border: 1px solid #c7d4d2;
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--teal);
  background: #f4faf8;
  font-size: 0.72rem;
  font-weight: 900;
}

.node-label {
  font-size: 13px;
  font-weight: 850;
  fill: var(--ink);
  pointer-events: none;
}

.graph-mode-label {
  fill: #64748b;
  font-size: 12px;
  font-weight: 900;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 4px;
}

.edge-hit {
  cursor: pointer;
  pointer-events: stroke;
}

.interactive-edge {
  cursor: pointer;
  outline: none;
  pointer-events: stroke;
}

.interactive-edge:focus-visible,
.interactive-edge:hover {
  filter: drop-shadow(0 0 5px rgba(29, 40, 56, 0.22));
  opacity: 1;
}

.edge-badge {
  pointer-events: none;
}

.edge-badge rect {
  filter: drop-shadow(0 4px 8px rgba(29, 40, 56, 0.1));
}

.edge-badge text {
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 2px;
}

.graph-node circle {
  filter: drop-shadow(0 8px 14px rgba(29, 40, 56, 0.15));
}

.node-hit {
  pointer-events: all;
  touch-action: none;
}

.interactive-node {
  cursor: grab;
  outline: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.interactive-node.dragging {
  cursor: grabbing;
}

.interactive-node:focus .node-shell,
.interactive-node:hover .node-shell,
.interactive-node.dragging .node-shell {
  stroke-width: 5;
}

.graph-node text {
  text-anchor: middle;
  user-select: none;
  pointer-events: none;
}

.empty-state {
  border: 1px dashed #b9c8c5;
  border-radius: 8px;
  padding: 14px;
  color: var(--muted);
  background: #fbfdfc;
  font-size: 0.9rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

@media (min-width: 901px) {
  .intake-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "head head"
      "controls controls"
      "stack stack"
      ". actions";
    align-items: start;
    gap: 8px 14px;
  }

  .intake-panel .section-head {
    grid-area: head;
    margin-bottom: 0;
  }

  .intake-panel .control-group {
    grid-area: controls;
    margin-bottom: 0;
    max-width: none;
  }

  .intake-panel .selected-stack {
    grid-area: stack;
    align-items: start;
  }

  .intake-panel .stack-group-list {
    display: flex;
    flex-wrap: wrap;
  }

  .intake-panel .stack-chip {
    justify-content: flex-start;
  }

  .intake-panel .chip-name {
    text-align: left;
  }

  .intake-panel .stack-actions {
    grid-area: actions;
    justify-content: flex-end;
  }

  .graph-wrap {
    min-height: 500px;
  }

  #interactionGraph {
    height: 500px;
  }
}

@media (max-width: 1180px) {
  .sources-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .app-shell {
    width: min(680px, calc(100vw - 20px));
    padding-top: 14px;
  }

  .topbar {
    min-height: 0;
    padding-bottom: 10px;
  }

  .brand-lockup {
    gap: 10px;
  }

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

  h1 {
    font-size: 2.15rem;
  }

  .share-button {
    min-height: 38px;
    padding: 4px 12px 4px 7px;
    gap: 7px;
  }

  .share-mark {
    width: 25px;
    height: 25px;
  }

  .workspace {
    grid-template-columns: 1fr;
    grid-template-areas:
      "intake"
      "visual"
      "analysis"
      "food"
      "plan"
      "sources"
      "caveat";
  }

  .section-head {
    align-items: flex-start;
  }

  .visual-panel .section-head {
    align-items: center;
  }

  .visual-panel .section-head h2 {
    white-space: nowrap;
  }

  .search-row {
    grid-template-columns: minmax(0, 1fr) 56px 88px;
    gap: 6px;
  }

  .search-row button,
  .scan-button {
    padding-left: 9px;
    padding-right: 9px;
  }

  .selected-stack {
    max-height: min(54vh, 460px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 2px;
  }

  .intake-panel .section-head {
    margin-bottom: 6px;
  }

  .stack-editor-head {
    gap: 4px 10px;
  }

  .stack-editor-head span {
    flex-basis: 100%;
  }

  .timeline,
  .food-notes,
  .sources-list {
    grid-template-columns: 1fr;
  }

  .summary-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .footer-topline,
  .feedback-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .footer-share-row .share-button {
    width: 100%;
  }

  .creator-credit {
    text-align: left;
  }

  .feedback-card {
    padding: 15px;
  }

  .graph-wrap {
    min-height: min(430px, 76vh);
  }

  #interactionGraph {
    height: min(430px, 76vh);
  }

  .map-controls {
    width: auto;
    justify-content: space-between;
  }

  #resetMap {
    white-space: nowrap;
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: min(680px, calc(100% - 32px));
  }

  .search-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .search-row button,
  .scan-button {
    padding-left: 7px;
    padding-right: 7px;
    font-size: 0.74rem;
  }

  .search-field {
    grid-column: 1;
  }

  .search-row button {
    grid-column: 1;
    width: 100%;
  }

  .search-row .scan-button {
    grid-column: 1;
    width: 100%;
  }

  .stack-actions {
    width: 100%;
    justify-content: stretch;
  }

  .stack-actions .subtle-action {
    width: 100%;
  }

  .visual-panel .section-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .plan-panel .section-head {
    flex-wrap: wrap;
  }

  .plan-panel #copyPlan {
    width: 100%;
  }

  .map-controls {
    width: 100%;
    justify-content: space-between;
  }

  #resetMap {
    flex: 1 1 auto;
  }
}
