/* FactorX's shared surface styles; category colors still identify map relationships. */
.fx-map {
  --ink: var(--fx-ink, #273e3b);
  --muted: var(--fx-muted, #71807b);
  --paper: var(--fx-paper, #f8faf7);
  --surface: var(--fx-white, #fff);
  --line: var(--fx-accent, #286f65);
  --active-accent: var(--line);
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.6 var(--fx-font, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif);
  -webkit-font-smoothing: antialiased;
}

.fx-map .map-shell {
  width: 100%;
  max-width: none;
  min-height: 65vh;
  margin: 0 auto;
  padding: 36px var(--fx-gutter, 40px) 72px;
}

.fx-map .map-page-heading {
  margin-bottom: 28px;
}

.fx-map .metabolism-orbit {
  left: 0;
  right: 0;
  overflow: hidden;
}

.fx-map .map-page-heading > p:first-child {
  margin: 0 0 12px;
  color: var(--fx-muted, #71807b);
  font-size: 10px;
  font-weight: 650;
  line-height: 1.6;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

.fx-map .map-page-heading h1 {
  margin: 0;
  color: var(--ink);
  font-size: 44px;
  font-weight: 450;
  line-height: 1.22;
  letter-spacing: -1.2px;
}

.fx-map .map-page-heading > p:last-child {
  max-width: 720px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.fx-map .nutrient-map {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  gap: clamp(20px, 2.5vw, 48px);
  padding: 0;
}

.fx-map .map-actions {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--fx-line, #dce5df);
  gap: 10px;
}

.fx-map :is(.clear-button, .copy-button, .analysis-link, .organ-picker-toggle,
    .problem-settings-reset, .problem-settings-done) {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--fx-line, #dce5df);
  border-radius: 4px;
  background: var(--fx-white, #fff);
  color: var(--fx-accent, #286f65);
  font-size: 13px;
  font-weight: 550;
  line-height: 1.45;
  box-shadow: none;
}

.fx-map :is(.copy-button, .analysis-link, .problem-settings-done) {
  border-color: var(--fx-accent, #286f65);
  background: var(--fx-accent, #286f65);
  color: #fff;
}

.fx-map :is(.clear-button, .organ-picker-toggle, .problem-settings-reset):hover {
  border-color: var(--fx-accent, #286f65);
  background: var(--fx-soft, #eef3ee);
  color: var(--fx-deep, #204e46);
  box-shadow: none;
}

.fx-map :is(.copy-button, .analysis-link, .problem-settings-done):hover {
  border-color: var(--fx-deep, #204e46);
  background: var(--fx-deep, #204e46);
  color: #fff;
  box-shadow: none;
}

.fx-map :is(.map-shell, .problem-settings-modal) :is(button, a, input):focus-visible {
  outline: 2px solid #79a994;
  outline-offset: 3px;
  box-shadow: none;
}

.fx-map .group h2 {
  font-size: 18px;
  font-weight: 550;
  line-height: 1.3;
  letter-spacing: -.25px;
}

.fx-map :is(.group-systems, .group-data-layers, .group-goals, .group-restrictions, .group-problems, .group-depletion) {
  padding: 14px;
  border-top-color: var(--fx-line, #dce5df);
  border-right-color: var(--fx-line, #dce5df);
  border-bottom-color: var(--fx-line, #dce5df);
  border-left-width: 3px;
  border-radius: var(--fx-radius, 5px);
  background: var(--fx-white, #fff);
}

.fx-map .group-link-toggle {
  min-height: 30px;
  font-weight: 550;
}

.fx-map .group-link-toggle input:checked + .group-link-toggle-switch {
  box-shadow: none;
}

.fx-map :is(.node-grid, .data-layer-options, .organ-children) .node,
.fx-map .system-tab {
  min-height: 44px;
  padding: 9px 11px;
  border-radius: 4px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 550;
  line-height: 1.4;
  box-shadow: none;
}

.fx-map :is(.node-grid, .data-layer-options, .organ-children) .node:hover,
.fx-map :is(.node-grid, .data-layer-options, .organ-children) .node:focus-visible,
.fx-map :is(.node-grid, .data-layer-options, .organ-children) .node:is(.is-active, .is-related, .is-selected),
.fx-map .system-tab:is(:hover, :focus-visible, .is-active, .is-selected) {
  box-shadow: none;
}

.fx-map .node-row h3 {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 1px;
}

.fx-map .node-expand,
.fx-map .detail-chip,
.fx-map .conditional-support-card,
.fx-map .selected-organ-item {
  border-radius: 4px;
}

.fx-map :is(.human-card, .detail-panel, .deficiency-panel, .selected-organ-panel,
    .organ-picker-menu, .organ-children.is-open) {
  border-radius: var(--fx-radius, 5px);
  background: var(--fx-white, #fff);
  box-shadow: none;
  backdrop-filter: none;
}

.fx-map :is(.detail-panel, .deficiency-panel) {
  width: 100%;
  max-width: none;
  border: 1px solid var(--fx-line, #dce5df);
  border-left: 3px solid var(--active-accent);
  font-size: 13px;
}

.fx-map .human-panel .human-card {
  background: transparent;
}

.fx-map :is(.detail-panel, .deficiency-panel) h1 {
  font-size: 26px;
  font-weight: 500;
  line-height: 1.22;
  letter-spacing: -.6px;
}

.fx-map :is(.detail-panel, .deficiency-panel) :is(h2, h3) {
  font-weight: 550;
}

.fx-map .detail-kicker,
.fx-map .selected-organ-panel-title {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 1.2px;
}

.fx-map .detail-chip {
  color: var(--fx-deep, #204e46);
  background: var(--fx-soft, #eef3ee);
}

.fx-map .detail-chip-warning {
  color: #6b4a0d;
  background: rgba(210, 158, 46, .14);
}

.fx-map .selected-info {
  border-color: var(--fx-line, #dce5df);
}

.fx-map .deficiency-panel {
  height: min(540px, 72vh);
  max-height: none;
  scrollbar-gutter: stable;
}

.fx-map .symptom-profile { overflow-wrap: anywhere; }
.fx-map .symptom-profile .symptom-intro { color: var(--fx-text, #39534d); }
.fx-map .symptom-typical { margin: 18px 0; }
.fx-map .symptom-typical h3 {
  color: var(--fx-deep, #204e46);
  font-size: 12px;
  letter-spacing: .03em;
}
.fx-map .symptom-profile li { margin-bottom: 7px; }
.fx-map .symptom-additional {
  margin: 16px 0;
  padding: 12px 0;
  border-top: 1px solid var(--fx-line, #dce5df);
  border-bottom: 1px solid var(--fx-line, #dce5df);
}
.fx-map .symptom-profile summary {
  cursor: pointer;
  color: var(--fx-deep, #204e46);
  font-weight: 550;
  line-height: 1.45;
}
.fx-map .symptom-profile summary:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.fx-map .symptom-additional summary span { font-variant-numeric: tabular-nums; color: var(--muted); }
.fx-map .symptom-profile details[open] > summary { margin-bottom: 12px; }
.fx-map .symptom-profile .symptom-note {
  padding: 10px 12px;
  background: var(--fx-soft, #eef3ee);
  border-radius: 4px;
  font-size: 12px;
}
.fx-map .symptom-sources { margin-top: 14px; font-size: 12px; }
.fx-map .symptom-sources a { text-decoration: underline; text-underline-offset: 3px; }
.fx-map .symptom-sources time { white-space: nowrap; }

@media (max-width: 760px) {
  .fx-map .deficiency-panel { height: auto; max-height: none; overflow: visible; }
}

.fx-map .selected-organ-panel,
.fx-map .organ-picker-menu,
.fx-map .organ-children.is-open {
  border-color: var(--fx-line, #dce5df);
}

.fx-map .selected-organ-item {
  font-weight: 550;
}

.fx-map .organ-picker-option {
  min-height: 44px;
  border-radius: 4px;
  color: var(--ink);
  font-weight: 500;
}

.fx-map .organ-picker-option:hover {
  background: var(--fx-soft, #eef3ee);
}

.fx-map .organ-picker-option input {
  accent-color: var(--fx-accent, #286f65);
}

.fx-map .organ-nodes > .node .node-label {
  border-color: var(--fx-line, #dce5df);
  border-radius: 4px;
  box-shadow: none;
  color: var(--ink);
  font-weight: 550;
}

.fx-map .renewal-recyclable {
  color: var(--fx-accent, #286f65);
}

.fx-map .priority-score-row,
.fx-map .priority-score-group h4 {
  color: var(--ink);
  font-weight: 550;
}

.fx-map .priority-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.fx-map .priority-title h3 { margin: 0; }
.fx-map .priority-plan-badge { padding: 4px 7px; border-radius: 4px; background: #e8eee4; color: #52735b; font-size: 10px; white-space: nowrap; text-decoration: none; }
.fx-map .priority-plan-badge:hover { background: #dce8d7; }
.fx-map .priority-preview-groups { display: grid; gap: 18px; margin: 16px 0; }
.fx-map .priority-preview-group h4 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 9px; color: var(--ink); font-size: 11px; font-weight: 550; }
.fx-map .priority-preview-group h4 > span { min-width: 21px; padding: 2px 5px; border: 1px solid var(--line); border-radius: 4px; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.fx-map .priority-placeholder-list { display: grid; gap: 9px; }
.fx-map .priority-placeholder { display: grid; grid-template-columns: 1fr 1.2fr 27px; gap: 12px; align-items: center; height: 15px; filter: blur(1.5px); opacity: .5; pointer-events: none; }
.fx-map .priority-placeholder > * { display: block; height: 7px; border-radius: 4px; background: #a2b6aa; }
.fx-map .priority-placeholder > span { width: 77%; }
.fx-map .priority-placeholder > i { background: #c3d1c7; }
.fx-map .priority-placeholder:nth-child(even) > span { width: 58%; }
.fx-map .priority-placeholder > b { height: 9px; }
.fx-map .priority-unlock { margin-top: 18px; padding: 14px; border: 1px solid #dce5d8; border-radius: 6px; background: #f0f5ed; }
.fx-map .priority-unlock > strong { display: block; font-size: 12px; font-weight: 600; color: var(--ink); }
.fx-map .priority-unlock > p { margin: 7px 0 12px; font-size: 11px; line-height: 1.5; color: var(--muted); }
.fx-map .priority-unlock > a { display: flex; justify-content: space-between; gap: 8px; padding: 10px 11px; border-radius: 4px; color: #fff; background: var(--fx-accent, #286f65); font-size: 11px; font-weight: 550; text-decoration: none; }
.fx-map .priority-unlock > a:hover { background: #245d56; }
.fx-map .priority-rank { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.fx-map .node-priority-badge { position: absolute; z-index: 4; right: -6px; top: -8px; padding: 2px 5px; border: 1px solid #bfd3c5; border-radius: 5px; color: #265d50; background: #fff; box-shadow: 0 1px 4px #244e3820; font-size: 9px; line-height: 1.2; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }

.fx-map .priority-report-link { display: inline-flex; align-items: center; text-decoration: none; margin-right: auto; }
.fx-map .priority-report-link[hidden], .fx-map .priority-report[hidden] { display: none; }
.fx-map .priority-report { margin: 48px 0 20px; padding: clamp(18px, 3vw, 40px); border: 1px solid #dce5d8; border-radius: 6px; background: #f0f5ed; color: var(--ink); scroll-margin-top: 130px; }
.fx-map .priority-report-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.fx-map .priority-report-heading h2 { margin: 8px 0; font-size: 28px; letter-spacing: -.6px; font-weight: 550; }
.fx-map .priority-report a { color: #286f65; }
.fx-map .priority-report p { line-height: 1.6; font-size: 14px; }
.fx-map .priority-report-note { max-width: 900px; color: var(--muted); }
.fx-map .priority-tier { margin-top: 26px; }
.fx-map .priority-tier > h3 { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 550; }
.fx-map .priority-tier > h3 > span { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #becfc0; border-radius: 50%; font-size: 13px; }
.fx-map .priority-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; align-items: start; }
.fx-map .priority-card { min-width: 0; padding: 20px; background: #fff; border: 1px solid var(--fx-line, #dce5df); border-radius: 5px; }
.fx-map .priority-card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fx-map .priority-card-title h4 { margin: 0; font-size: 21px; font-weight: 550; }
.fx-map .priority-card-title > span { font-size: 11px; color: var(--muted); }
.fx-map .priority-card .priority-matched { color: #577560; font-size: 12px; }
.fx-map .priority-card .priority-test { padding: 12px; background: #f5f8f4; border-radius: 3px; }
.fx-map .priority-card details { border-top: 1px solid #e4ebe5; padding-top: 12px; }
.fx-map .priority-card summary { cursor: pointer; color: #286f65; font-size: 13px; }
.fx-map .priority-card ul { padding-left: 18px; font-size: 13px; line-height: 1.6; }
.fx-map .priority-card li + li { margin-top: 8px; }
.fx-map .priority-sources { display: grid; gap: 6px; font-size: 12px; overflow-wrap: anywhere; }
.fx-map .priority-sources small { color: var(--muted); margin-bottom: 6px; }
.fx-map .priority-coverage, .fx-map .priority-method { color: var(--muted); }
.fx-map .priority-report .priority-method { font-size: 12px; margin-top: 24px; }
.fx-map .priority-report .priority-preview-groups { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.fx-map .priority-preview-group h3 { display: flex; justify-content: space-between; font-size: 15px; font-weight: 550; }
.fx-map .priority-report .priority-unlock { max-width: 460px; background: #fff; }
.fx-map .priority-report .priority-unlock > a { color: #fff; font-size: 13px; }
.fx-map .priority-summary { margin: 16px 0; padding: 12px; border: 1px solid #dce5d8; border-radius: 4px; background: #f0f5ed; }
.fx-map .priority-summary p { margin: 6px 0; }
.fx-map .priority-summary a { color: #286f65; font-size: 13px; }
.fx-map .nutrient-map.has-active .node.has-priority { opacity: 1; }
.fx-map #copyResult:disabled { opacity: .6; cursor: wait; }
.fx-map .priority-percent-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); gap: 20px; align-items: start; margin: 24px 0; }
.fx-map .priority-percent-group { padding: 20px; background: #fff; border: 1px solid #dce5df; border-radius: 5px; min-width: 0; }
.fx-map .priority-percent-group > h3 { display: flex; justify-content: space-between; gap: 12px; margin: 0 0 14px; font-size: 17px; font-weight: 550; }
.fx-map .priority-percent-group > h3 > span { color: var(--muted); font-size: 13px; }
.fx-map .priority-percent-row { border-top: 1px solid #edf1ed; padding: 9px 0; }
.fx-map .priority-percent-row > summary { display: grid; grid-template-columns: 22px minmax(75px, 1fr) minmax(45px, .8fr) 42px; align-items: center; gap: 8px; cursor: pointer; list-style: none; }
.fx-map .priority-percent-row > summary::-webkit-details-marker { display: none; }
.fx-map .priority-percent-row > summary strong { color: #286f65; font-size: 14px; text-align: right; }
.fx-map .priority-percent-label { font-size: 14px; overflow-wrap: anywhere; }
.fx-map .priority-percent-row .priority-score-track span { background: #76a294; }
.fx-map .priority-breakdown { color: var(--muted); padding-top: 6px; }
.fx-map .priority-breakdown p, .fx-map .priority-breakdown li { font-size: 12px; line-height: 1.6; }
.fx-map .priority-breakdown ul { padding-left: 17px; }
.fx-map .priority-breakdown li + li { margin-top: 10px; }
.fx-map .priority-breakdown small { display: block; padding-top: 4px; }
.fx-map .priority-method > summary { cursor: pointer; color: #286f65; font-size: 14px; }
.fx-map .priority-selection { color: var(--muted); }

.fx-map .problem-settings-card {
  border-color: var(--fx-line, #dce5df);
  border-radius: var(--fx-radius, 5px);
  box-shadow: none;
}

.fx-map .problem-settings-card > header,
.fx-map .problem-settings-card > footer {
  border-color: var(--fx-line, #dce5df);
}

.fx-map .problem-settings-card h2 {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -.6px;
}

.fx-map .problem-settings-card header span {
  color: var(--fx-accent, #286f65);
  font-weight: 650;
}

.fx-map .problem-settings-search input {
  min-height: 44px;
  border: 1px solid var(--fx-line, #dce5df);
  border-radius: 4px;
  color: var(--ink);
}

.fx-map :is(.problem-settings-zone, .problem-settings-list, .problem-settings-item) {
  border-color: var(--fx-line, #dce5df);
  border-radius: 4px;
  background: var(--fx-white, #fff);
  box-shadow: none;
}

.fx-map .problem-settings-zone.is-inactive {
  background: var(--fx-soft, #eef3ee);
}

.fx-map .problem-settings-list.is-drag-over {
  border-color: var(--fx-accent, #286f65);
  background: var(--fx-soft, #eef3ee);
}

.fx-map .problem-settings-item {
  grid-template-columns: 20px minmax(0, 1fr) 44px;
  min-height: 54px;
}

.fx-map .problem-settings-item strong {
  font-size: 12px;
  font-weight: 550;
}

.fx-map :is(.problem-settings-trigger, .problem-settings-close, .problem-settings-item button) {
  width: 44px;
  height: 44px;
  border: 1px solid var(--fx-line, #dce5df);
  border-radius: 4px;
  background: var(--fx-soft, #eef3ee);
  color: var(--fx-accent, #286f65);
  box-shadow: none;
}

.fx-map .problem-settings-trigger:hover {
  transform: none;
}

@media (max-width: 1150px) {
  .fx-map .map-shell {
    padding-left: var(--fx-gutter, 28px);
    padding-right: var(--fx-gutter, 28px);
  }

  .fx-map .nutrient-map {
    gap: 18px;
    padding: 0;
  }
}

@media (max-width: 980px) {
  .fx-map :is(.detail-panel, .deficiency-panel) {
    max-width: none;
    width: 100%;
  }

  .fx-map .selected-organ-panel {
    right: auto;
    left: 0;
    width: 160px;
    transform: translateX(-30%);
  }
}

@media (max-width: 650px) {
  .fx-map .map-shell {
    padding: 28px var(--fx-gutter, 20px) 48px;
  }

  .fx-map .map-page-heading {
    margin-bottom: 24px;
  }

  .fx-map .map-page-heading h1 {
    font-size: 32px;
    letter-spacing: -.7px;
  }

  .fx-map .map-page-heading > p:last-child {
    font-size: 14px;
  }

  .fx-map .nutrient-map {
    gap: 20px;
    padding: 0;
  }

  .fx-map .map-actions {
    padding-bottom: 16px;
  }

  .fx-map :is(.clear-button, .copy-button, .analysis-link) {
    width: 100%;
    justify-content: center;
    white-space: normal;
  }

  .fx-map .group h2 {
    font-size: 17px;
  }

  .fx-map .selected-organ-panel {
    position: static;
    width: 100%;
    transform: none;
  }

  .fx-map .problem-settings-modal {
    padding: 12px;
  }

  .fx-map .problem-settings-card {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fx-map .orbit-ring {
    animation: none;
  }
}
