/* BB Crafting — fantasy crafting profit ledger */

:root {
  --bg-deep:   #0d1322;
  --bg-night:  #141c30;
  --bg-card:   #1a233a;
  --bg-edge:   #232d48;
  --parch:     #f1e4c8;
  --parch-2:   #e8d8b6;
  --parch-3:   #d9c69e;
  --parch-ink: #3c2e1c;
  --parch-mute:#7a6747;
  --gold:      #d4a960;
  --gold-soft: #b9924a;
  --gold-deep: #8a6a30;
  --emerald:   #6fb96a;
  --garnet:    #d56a6a;
  --sapphire:  #5b9bd5;
  --amethyst:  #b07cd1;
  --labor:     #e6b370;
  --muted:     #8b95a8;
  --line:      rgba(212, 169, 96, 0.18);
  --line-strong: rgba(212, 169, 96, 0.32);
  --serif: 'Cormorant Garamond', 'EB Garamond', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg-deep);
  color: #e8ecf3;
  font-family: var(--sans);
  font-size: 14px;
  min-height: 100vh;
  overflow: hidden;
  background-image:
    radial-gradient(1200px 600px at 20% -10%, rgba(212,169,96,0.06), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(91,155,213,0.05), transparent 60%);
}

/* Loading */
.boot {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  font-family: var(--serif);
  color: var(--parch);
}
.boot-inner { text-align: center; }
.boot-mark {
  font-size: 60px; color: var(--gold);
  letter-spacing: 0.04em;
  margin-bottom: 14px;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
.boot-title { font-size: 26px; letter-spacing: 0.05em; }
.boot-sub {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  margin-top: 6px;
}

/* ---------- App shell ---------- */
.app {
  display: grid;
  grid-template-columns: 380px 1fr;
  grid-template-rows: 64px auto 1fr;
  height: 100vh;
  width: 100vw;
  gap: 0;
}
.app.no-sidebar {
  grid-template-columns: 1fr;
}
.app.no-sidebar .sidebar { display: none; }

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(20,28,48,0.95), rgba(13,19,34,0.95));
  position: relative;
  z-index: 5;
}
.topbar::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212,169,96,0.45), transparent);
}

.brand {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--serif);
}
.brand-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid var(--gold-soft);
  border-radius: 4px;
  color: var(--gold);
  font-size: 20px;
  background:
    radial-gradient(circle at 30% 20%, rgba(212,169,96,0.18), transparent 60%),
    #11182a;
  position: relative;
}
.brand-mark::before,
.brand-mark::after {
  content: '';
  position: absolute;
  width: 6px; height: 6px;
  border: 1px solid var(--gold-soft);
}
.brand-mark::before { top: -3px; left: -3px; border-right: none; border-bottom: none; }
.brand-mark::after  { bottom: -3px; right: -3px; border-left: none; border-top: none; }

.brand-name {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--parch);
}
.brand-sub {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.28em;
  color: var(--gold);
  text-transform: uppercase;
  margin-top: -2px;
}

.topbar-spacer { flex: 1; }

.topbar-stat {
  display: flex; flex-direction: column; align-items: flex-end;
  padding: 0 18px;
  border-left: 1px solid var(--line);
  height: 36px;
  justify-content: center;
}
.topbar-stat-label {
  font-size: 9px;
  letter-spacing: 0.25em;
  color: var(--muted);
  text-transform: uppercase;
}
.topbar-stat-val {
  font-family: var(--serif);
  color: var(--parch);
  font-size: 18px;
  font-weight: 500;
}
.topbar-stat-val.pos { color: var(--emerald); }
.topbar-stat-val.neg { color: var(--garnet); }

button.topbar-stat.clickable {
  appearance: none;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: right;
  transition: background 0.15s ease;
}
button.topbar-stat.clickable:hover:not(:disabled) {
  background: rgba(212, 169, 96, 0.06);
}
button.topbar-stat.clickable:disabled {
  cursor: default;
  opacity: 0.5;
}
button.topbar-stat.clickable.active {
  background: rgba(212, 169, 96, 0.1);
  box-shadow: inset 0 -2px 0 var(--gold);
}

/* ─── Settings strip (Famed + threshold + feed) ─────────────────── */
.settings-strip {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 24px;
  background: linear-gradient(180deg, rgba(20, 28, 48, 0.6) 0%, rgba(13, 19, 34, 0.6) 100%);
  border-bottom: 1px solid var(--line);
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
}
.ss-spacer { flex: 1; }
.ss-feed {
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.04em;
}
.ss-feed-msg {
  color: var(--parch-mute);
  font-size: 11px;
}
.ss-famed {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.ss-famed:hover {
  background: rgba(176, 124, 209, 0.06);
  border-color: rgba(176, 124, 209, 0.18);
}
.ss-famed input {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
  pointer-events: none;
}
.ss-famed .famed-box {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1.5px solid var(--line-strong);
  display: grid;
  place-items: center;
  color: transparent;
  background: rgba(212, 169, 96, 0.04);
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.ss-famed input:checked + .famed-box {
  background: var(--amethyst);
  border-color: var(--amethyst);
  color: #1a1024;
}
.ss-famed input:focus-visible + .famed-box {
  outline: 2px solid var(--amethyst);
  outline-offset: 2px;
}
.ss-famed-label {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
}
.ss-famed input:checked ~ .ss-famed-label {
  color: var(--amethyst);
}
.ss-famed-sub {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  opacity: 0.7;
}
.ss-famed input:checked ~ .ss-famed-sub {
  color: var(--amethyst);
  opacity: 0.9;
}
.ss-threshold {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.ss-threshold-label {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 10px;
  color: var(--labor);
  opacity: 0.85;
  font-weight: 600;
}
.threshold-control.compact {
  margin-top: 0;
}
.threshold-control.compact .thr-step {
  height: 22px;
  width: 22px;
}
.threshold-control.compact .thr-input {
  font-size: 12px;
  width: 48px;
  height: 22px;
}

.ss-prof {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.ss-prof-label {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
}
.ss-prof-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  color: var(--parch);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 24px 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%23d6c89c' d='M0 0h10L5 6z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ss-prof-select:hover {
  background-color: rgba(212, 169, 96, 0.06);
}
.ss-prof-select:focus-visible {
  box-shadow: 0 0 0 2px rgba(212, 169, 96, 0.35);
}
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  cursor: pointer;
  user-select: none;
  border-right: 1px solid var(--line);
  transition: background 0.12s ease;
}
.topbar-stat.famed-toggle:hover {
  background: rgba(176, 124, 209, 0.06);
}
.topbar-stat.famed-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0; height: 0;
}
.famed-box {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1.5px solid var(--line-strong);
  display: grid;
  place-items: center;
  color: transparent;
  background: rgba(212, 169, 96, 0.04);
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.topbar-stat.famed-toggle input:checked + .famed-box {
  background: var(--amethyst);
  border-color: var(--amethyst);
  color: #1a1024;
}
.topbar-stat.famed-toggle input:focus-visible + .famed-box {
  outline: 2px solid var(--amethyst);
  outline-offset: 2px;
}
.topbar-stat.famed-toggle .topbar-stat-label {
  color: var(--muted);
  letter-spacing: 0.22em;
}
.topbar-stat.famed-toggle input:checked ~ div .topbar-stat-label {
  color: var(--amethyst);
}
.famed-sub {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
  letter-spacing: 0.04em;
}
.topbar-stat.famed-toggle input:checked ~ div .famed-sub {
  color: var(--amethyst);
  opacity: 0.85;
}

.topbar-stat.threshold {
  align-items: stretch;
  justify-content: center;
  padding: 0 18px;
  border-right: 1px solid var(--line);
}
.topbar-stat.threshold .topbar-stat-label {
  align-self: flex-end;
  color: var(--labor);
  opacity: 0.8;
}
.threshold-control {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: rgba(230, 179, 112, 0.06);
}
.threshold-control:hover {
  border-color: var(--labor);
}
.thr-step {
  appearance: none;
  background: none;
  border: 0;
  color: var(--labor);
  width: 20px;
  height: 26px;
  font-family: var(--mono);
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
  opacity: 0.7;
  transition: opacity 0.12s ease, background 0.12s ease;
}
.thr-step:hover {
  opacity: 1;
  background: rgba(230, 179, 112, 0.12);
}
.thr-step:first-child { border-radius: 3px 0 0 3px; }
.thr-step:last-child  { border-radius: 0 3px 3px 0; }
.thr-input {
  appearance: textfield;
  -moz-appearance: textfield;
  background: transparent;
  border: 0;
  color: var(--parch);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  width: 52px;
  text-align: right;
  padding: 0 2px;
  outline: none;
}
.thr-input::-webkit-inner-spin-button,
.thr-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.thr-input:focus {
  color: var(--labor);
}
.thr-unit {
  font-size: 10px;
  color: var(--labor);
  opacity: 0.6;
  font-family: var(--mono);
  letter-spacing: 0.04em;
  padding: 0 6px 0 2px;
}

.topbar-stat.feed {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.feed-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted);
}
.feed-dot.live   { background: var(--emerald); box-shadow: 0 0 8px var(--emerald); animation: livepulse 2s ease-in-out infinite; }
.feed-dot.error  { background: var(--garnet); }
.feed-dot.loading{ background: var(--gold); animation: livepulse 1s ease-in-out infinite; }
@keyframes livepulse { 0%,100%{opacity:0.5} 50%{opacity:1} }

/* ---------- Sidebar ---------- */
.sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #121a2e 0%, #0e1424 100%);
  overflow: hidden;
}

.sb-search {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
}
.sb-search-field { position: relative; }
.sb-search input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--line);
  color: var(--parch);
  font-family: var(--sans);
  font-size: 13px;
  padding: 10px 36px 10px 36px;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.sb-search input:focus {
  border-color: var(--gold-soft);
  box-shadow: 0 0 0 3px rgba(212,169,96,0.08);
}
.sb-search input::placeholder { color: var(--muted); }
.sb-search-icon {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}
.sb-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  appearance: none;
  background: rgba(212, 169, 96, 0.06);
  border: 0;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  padding: 0;
  transition: background 0.12s ease, color 0.12s ease;
}
.sb-search-clear:hover {
  background: rgba(213, 106, 106, 0.15);
  color: var(--garnet);
}
.sb-search-clear:focus-visible {
  outline: 2px solid var(--gold-soft);
  outline-offset: 2px;
}

.sb-filters {
  display: flex; gap: 6px; padding: 12px 18px 8px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  cursor: grab;
  user-select: none;
  scroll-behavior: smooth;
  /* prevent chips from wrapping or shrinking so they scroll horizontally */
}
.sb-filters.dragging {
  cursor: grabbing;
  scroll-behavior: auto;
}
.sb-filters > * { flex-shrink: 0; }
.sb-filters::-webkit-scrollbar {
  display: block;
  height: 4px;
}
.sb-filters::-webkit-scrollbar-track {
  background: transparent;
}
.sb-filters::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
}
.sb-filters::-webkit-scrollbar-thumb:hover {
  background: var(--gold-soft);
}

.cat-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--sans);
  transition: all 0.15s;
}
.cat-chip:hover { color: var(--parch); border-color: var(--line-strong); }
.cat-chip.active {
  background: var(--gold);
  color: #1a1306;
  border-color: var(--gold);
  font-weight: 600;
}

.sb-sort {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}
.sort-select {
  background: transparent;
  border: none;
  color: var(--parch);
  font-family: var(--sans);
  font-size: 12px;
  cursor: pointer;
  outline: none;
  padding: 2px 4px;
}
.sort-select option { background: var(--bg-card); color: var(--parch); }

.sb-list {
  flex: 1; overflow-y: auto;
  padding: 6px 8px 80px;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-deep) transparent;
}
.sb-list::-webkit-scrollbar { width: 6px; }
.sb-list::-webkit-scrollbar-thumb { background: var(--gold-deep); border-radius: 3px; }
.sb-list::-webkit-scrollbar-track { background: transparent; }

.recipe-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 14px;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: background 0.12s;
  border: 1px solid transparent;
  border-left: 2px solid transparent;
}
.recipe-row .r-icon-wrap {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background: rgba(212, 169, 96, 0.04);
  border: 1px solid var(--line);
  flex-shrink: 0;
  overflow: hidden;
}
.recipe-row .r-icon-wrap .item-icon {
  width: 28px;
  height: 28px;
}
.recipe-row .r-icon-wrap .item-icon-fallback {
  font-size: 10px;
}
.recipe-row:hover {
  background: rgba(212,169,96,0.05);
}
.recipe-row.selected {
  background: rgba(212,169,96,0.10);
  border-color: var(--line-strong);
  border-left-color: var(--gold);
}
.recipe-row.compare {
  background: rgba(91,155,213,0.07);
  border-color: rgba(91,155,213,0.35);
}
.recipe-row .r-name {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  color: var(--parch);
  line-height: 1.15;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recipe-row .r-sub {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-top: 2px;
  display: flex; gap: 8px;
}
.recipe-row .r-sub .dot { color: var(--line-strong); }
.recipe-row .r-right { text-align: right; }
.recipe-row .r-profit {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.recipe-row .r-profit.pos { color: var(--emerald); }
.recipe-row .r-profit.neg { color: var(--garnet); }
.recipe-row .r-profit.nomk { color: var(--muted); font-style: italic; font-size: 10px; }
.recipe-row .r-labor {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--labor);
  letter-spacing: 0.04em;
  margin-top: 2px;
}
.recipe-row .row-actions {
  position: static;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 22px;
}
.recipe-row .star-btn,
.recipe-row .hide-btn {
  position: static;
  width: 22px; height: 22px;
  border: none; background: transparent;
  color: rgba(212,169,96,0.18);
  cursor: pointer;
  font-size: 13px;
  display: grid; place-items: center;
  transition: color 0.15s, transform 0.15s, opacity 0.15s, background 0.15s;
  opacity: 0;
  padding: 0;
  border-radius: 3px;
}
.recipe-row:hover .star-btn,
.recipe-row:hover .hide-btn,
.recipe-row.selected .star-btn,
.recipe-row.selected .hide-btn,
.recipe-row .star-btn.on,
.recipe-row .hide-btn.on { opacity: 1; }
.recipe-row .star-btn:hover { color: var(--gold); background: rgba(212,169,96,0.12); transform: scale(1.05); }
.recipe-row .star-btn.on { color: var(--gold); }
.recipe-row .hide-btn { color: rgba(213,106,106,0.3); font-size: 12px; }
.recipe-row .hide-btn:hover { color: var(--garnet); background: rgba(213,106,106,0.12); transform: scale(1.05); }
.recipe-row .hide-btn.on { color: var(--garnet); font-size: 13px; }
.recipe-row.is-hidden { opacity: 0.55; }
.recipe-row.is-hidden .r-name { text-decoration: line-through; }

.sb-loadmore {
  margin: 16px 10px;
  padding: 10px;
  background: transparent;
  border: 1px dashed var(--line-strong);
  color: var(--gold);
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 4px;
  width: calc(100% - 20px);
}
.sb-loadmore:hover { background: rgba(212,169,96,0.06); }

/* ---------- Detail ---------- */
.detail {
  overflow-y: auto;
  padding: 28px 40px 80px;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-deep) transparent;
  position: relative;
}
.detail::-webkit-scrollbar { width: 8px; }
.detail::-webkit-scrollbar-thumb { background: var(--gold-deep); border-radius: 4px; }

.empty-state {
  height: 100%;
  display: grid; place-items: center;
  text-align: center;
}
.empty-state .emp-mark {
  font-size: 80px; color: var(--gold-deep);
  font-family: var(--serif);
  opacity: 0.6;
  margin-bottom: 16px;
}
.empty-state .emp-title {
  font-family: var(--serif);
  font-size: 28px;
  color: var(--parch);
  margin-bottom: 8px;
}
.empty-state .emp-sub {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.04em;
  max-width: 380px;
}

.r-header {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.r-crest {
  width: 76px; height: 76px;
  flex-shrink: 0;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background:
    radial-gradient(circle at 30% 25%, rgba(212,169,96,0.22), transparent 65%),
    linear-gradient(135deg, #1c2640, #0f1525);
  display: grid; place-items: center;
  font-size: 32px;
  color: var(--gold);
  font-family: var(--serif);
  position: relative;
  font-weight: 500;
  padding: 6px;
}
.r-crest .item-icon-lg { width: 100%; height: 100%; border: none; padding: 0; }
.r-crest::before,
.r-crest::after {
  content: '';
  position: absolute;
  width: 10px; height: 10px;
  border: 1px solid var(--gold-soft);
}
.r-crest::before { top: -4px; left: -4px; border-right: none; border-bottom: none; }
.r-crest::after  { bottom: -4px; right: -4px; border-left: none; border-top: none; }

.r-meta { flex: 1; min-width: 0; }
.r-cat {
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 6px;
}
.r-title {
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1.05;
  color: var(--parch);
  margin: 0 0 10px;
  letter-spacing: 0.005em;
  font-weight: 500;
}
.r-tags {
  display: flex; align-items: center; gap: 14px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
  flex-wrap: wrap;
}
.r-tags .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--line-strong); }
.r-tags .pill {
  padding: 2px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: var(--gold);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.r-actions { display: flex; gap: 8px; }
.btn {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 3px;
  background: transparent;
  color: var(--parch);
  border: 1px solid var(--line-strong);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--gold); color: var(--gold); }
.btn.primary { background: var(--gold); color: #1a1306; border-color: var(--gold); }
.btn.primary:hover { background: var(--parch); border-color: var(--parch); color: #1a1306; }
.btn.active {
  background: rgba(91,155,213,0.15);
  border-color: var(--sapphire);
  color: var(--sapphire);
}

/* Numbers strip */
.numbers-strip {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 1px;
  background: var(--line);
  margin: 22px 0;
  border: 1px solid var(--line);
}
.metric {
  background: var(--bg-night);
  padding: 16px 18px;
  position: relative;
}
.metric .lbl {
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--muted);
  text-transform: uppercase;
}
.metric .val {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-top: 4px;
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.metric.profit .val { color: var(--emerald); }
.metric.loss   .val { color: var(--garnet); }
.metric .currency {
  font-size: 16px;
  color: var(--gold);
  font-family: var(--mono);
  font-weight: 400;
  margin-left: 2px;
}
.metric .sub {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.10em;
  margin-top: 6px;
  text-transform: uppercase;
}
.metric.profit .sub { color: var(--emerald); opacity: 0.7; }
.metric.loss   .sub { color: var(--garnet); opacity: 0.8; }

.metric.sale .sale-controls {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.metric.sale .price-edit {
  padding: 2px 8px;
}
.metric.sale .price-edit input {
  width: 64px;
  font-size: 12px;
  padding: 4px 0;
}
.metric.sale .price-edit .cur {
  font-size: 10px;
}
.metric.sale .sale-x {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.metric.sale .sale-tag {
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.metric.sale .sale-tag.none {
  color: var(--garnet);
  font-style: italic;
}
.metric.sale .sale-delta {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.metric.sale .sale-delta.pos { color: var(--emerald); }
.metric.sale .sale-delta.neg { color: var(--garnet); }
.metric.sale .sale-delta .price-reset {
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* ─── Daily volume tag ─────────────────────────────────────────── */
.vol-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--parch-3);
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(212, 169, 96, 0.06);
  border: 1px solid rgba(212, 169, 96, 0.18);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.vol-tag.mini {
  font-size: 9px;
  padding: 0 5px;
  border-radius: 3px;
  color: var(--parch-mute);
  background: transparent;
  border-color: rgba(212, 169, 96, 0.18);
  text-transform: none;
  letter-spacing: 0;
}
.vol-tag.mini.tight {
  color: var(--garnet);
  border-color: rgba(213, 106, 106, 0.4);
  background: rgba(213, 106, 106, 0.08);
}
.vol-tag.weekly {
  color: var(--sapphire);
  border-color: rgba(91, 155, 213, 0.32);
  background: rgba(91, 155, 213, 0.06);
}
.vol-tag.mini.weekly {
  color: var(--sapphire);
  border-color: rgba(91, 155, 213, 0.25);
  background: rgba(91, 155, 213, 0.05);
  opacity: 0.85;
}

/* ──── Wisp calculator page ──────────────────────────────────────── */
.wisp-view {
  padding: 24px 32px;
}
.wisp-modebar {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
}
.wisp-mode-toggle,
.wisp-type-toggle {
  display: inline-flex;
  background: var(--bg-night);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 3px;
  gap: 2px;
}
.wisp-mode-toggle button,
.wisp-type-toggle button {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 8px 16px;
  border-radius: 3px;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.wisp-mode-toggle button:hover,
.wisp-type-toggle button:hover {
  color: var(--parch);
}
.wisp-mode-toggle button.on {
  background: var(--gold);
  color: #1a1306;
  font-weight: 600;
}
.wisp-type-toggle button.on {
  background: rgba(212, 169, 96, 0.15);
  color: var(--gold);
  border: 1px solid var(--line-strong);
  padding: 7px 15px;
}

.wisp-glowing {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 130px;
}
.wisp-input-label {
  font-size: 9px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.wisp-num-field {
  display: inline-flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px 10px;
  gap: 4px;
}
.wisp-num-field:focus-within {
  border-color: var(--gold-soft);
}
.wisp-num-field input {
  width: 56px;
  background: transparent;
  color: var(--parch);
  border: 0;
  outline: none;
  font-family: var(--mono);
  font-size: 14px;
  text-align: right;
  padding: 2px 0;
  -moz-appearance: textfield;
}
.wisp-num-field input::-webkit-outer-spin-button,
.wisp-num-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.wisp-num-field span {
  color: var(--gold);
  font-family: var(--mono);
  font-size: 11px;
}
.wisp-hint {
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.04em;
  font-style: italic;
}

/* Ranked results table */
.wisp-table {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-card);
  overflow: hidden;
}
.wisp-row {
  display: grid;
  grid-template-columns: 38px minmax(140px, 1fr) 220px 75px 75px 70px 100px 95px 95px 100px;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  transition: background 0.12s ease;
}
.wisp-row.weapons {
  grid-template-columns: 38px minmax(140px, 1fr) 220px 75px 70px 100px 95px 95px 100px;
}
/* Prevent any cell from overflowing into the next column */
.wisp-row > div {
  min-width: 0;
  overflow: hidden;
}
.chain-grade {
  flex-wrap: nowrap;
  overflow: hidden;
}
.chain-grade .gp {
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wisp-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-night);
  cursor: default;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.wisp-head:hover { background: var(--bg-night); }

/* ─── Wisp page controls + overrides panel ──────────────────────── */
.wisp-table-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding: 0 2px;
}
.wisp-filter-toggle,
.wisp-overrides-toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}
.wisp-filter-toggle:hover,
.wisp-overrides-toggle:hover {
  color: var(--parch);
  border-color: var(--line-strong);
}
.wisp-filter-toggle.on {
  background: rgba(111, 185, 106, 0.12);
  color: var(--emerald);
  border-color: rgba(111, 185, 106, 0.45);
}
.wisp-overrides-toggle.on,
.wisp-overrides-toggle.active {
  background: rgba(212, 169, 96, 0.1);
  color: var(--gold);
  border-color: var(--gold-soft);
}
.wfo-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--line-strong);
  transition: background 0.12s ease;
}
.wfo-dot.on { background: var(--emerald); }
.wfo-badge {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  padding: 0 5px;
  background: var(--gold);
  color: #1a1306;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
}
.wisp-row-count {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
  letter-spacing: 0.04em;
}

.wisp-overrides-panel {
  background: var(--bg-card);
  border: 1px solid var(--gold-soft);
  border-radius: 4px;
  padding: 14px 16px 16px;
  margin-bottom: 8px;
}
.wop-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.wop-head strong { color: var(--gold); letter-spacing: 0.05em; }
.wop-clear {
  appearance: none;
  background: transparent;
  border: 1px solid rgba(213, 106, 106, 0.3);
  color: var(--garnet);
  padding: 4px 10px;
  border-radius: 3px;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
}
.wop-clear:hover { background: rgba(213, 106, 106, 0.08); }
.wop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 6px 12px;
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  padding-right: 4px;
}
.wop-grid::-webkit-scrollbar { width: 6px; }
.wop-grid::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
.wop-row {
  display: grid;
  grid-template-columns: 24px 1fr 70px 12px 22px;
  gap: 8px;
  align-items: center;
  padding: 4px 6px;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.1s ease;
}
.wop-row:hover { background: rgba(212, 169, 96, 0.04); }
.wop-row.in-best { background: rgba(111, 185, 106, 0.04); }
.wop-row.in-best:hover { background: rgba(111, 185, 106, 0.08); }
.wop-row.overridden {
  background: rgba(91, 155, 213, 0.07);
  box-shadow: inset 2px 0 0 var(--sapphire);
}
.wop-icon { display: grid; place-items: center; width: 24px; height: 24px; }
.wop-icon .item-icon { width: 22px; height: 22px; }
.wop-name { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.wop-name-text {
  font-size: 12px;
  color: var(--parch);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wop-name-meta { font-size: 10px; color: var(--muted); font-family: var(--mono); }
.wop-best-mark { color: var(--emerald); }
.wop-input {
  background: var(--bg-deep);
  color: var(--parch);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 4px 6px;
  font-family: var(--mono);
  font-size: 11px;
  text-align: right;
  outline: none;
  width: 100%;
  -moz-appearance: textfield;
}
.wop-input::-webkit-outer-spin-button,
.wop-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.wop-input:focus {
  border-color: var(--sapphire);
  background: rgba(91, 155, 213, 0.05);
}
.wop-row.overridden .wop-input {
  border-color: var(--sapphire);
  color: var(--sapphire);
}
.wop-unit { color: var(--gold); font-size: 10px; font-family: var(--mono); }
.wop-reset {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--sapphire);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  width: 22px;
  height: 22px;
  border-radius: 3px;
}
.wop-reset:hover { background: rgba(91, 155, 213, 0.15); }

/* Table itself scrolls so the sticky head pins to the table top, not the page. */
.wisp-table {
  max-height: calc(100vh - 380px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.wisp-table::-webkit-scrollbar { width: 8px; }
.wisp-table::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }
.wisp-row:last-child { border-bottom: 0; }
.wisp-row:not(.wisp-head):hover {
  background: rgba(212, 169, 96, 0.04);
}
.wisp-row.open {
  background: rgba(212, 169, 96, 0.07);
  border-bottom-color: transparent;
}
.wisp-row.missing {
  opacity: 0.5;
}
.wisp-row.best {
  background: rgba(111, 185, 106, 0.06);
  border-left: 3px solid var(--emerald);
  padding-left: 13px;
}
/* legacy .wisp-head rules merged into the sticky-head block above */

.wisp-row .grade {
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.01em;
}
.wisp-row .grade-illustrious { color: #a3b5cf; }
.wisp-row .grade-magnificent { color: #d4a960; }
.wisp-row .grade-epherium    { color: #6fb96a; }
.wisp-row .grade-delphinad   { color: #5b9bd5; }
.wisp-row .grade-ayanad      { color: #b07cd1; }

.wisp-row .best-profit { font-weight: 600; font-size: 14px; }
.wisp-row .best-profit.pos { color: var(--emerald); }
.wisp-row .missing-tag {
  font-style: italic;
  color: var(--garnet);
  font-size: 11px;
  font-weight: 400;
}
.wisp-row .pos { color: var(--emerald); }
.wisp-row .neg { color: var(--garnet); }

/* Best-source callout */
.wisp-best-callout {
  text-align: right;
  padding: 8px 16px;
  border: 1px solid rgba(111, 185, 106, 0.3);
  background: rgba(111, 185, 106, 0.06);
  border-radius: 4px;
  min-width: 200px;
}
.wbc-label {
  font-size: 9px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--emerald);
  font-weight: 600;
  margin-bottom: 4px;
}
.wbc-method {
  font-size: 12px;
  color: var(--parch);
  margin-bottom: 4px;
}
.wbc-value {
  font-family: var(--serif);
  font-size: 24px;
  color: var(--gold);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1;
}
.wbc-unit {
  font-size: 11px;
  color: var(--gold);
  font-family: var(--mono);
  margin-left: 4px;
  font-weight: 400;
}
.wbc-vs {
  font-size: 10px;
  margin-top: 6px;
  letter-spacing: 0.04em;
}

/* Breakdown panel */
.wisp-breakdown {
  padding: 16px 20px 22px;
  background: linear-gradient(180deg, rgba(212, 169, 96, 0.05), transparent);
  border-bottom: 1px solid var(--line);
  border-top: 1px dashed var(--line-strong);
}
.wisp-breakdown.one-col { display: block; }
.wb-panel {
  background: var(--bg-night);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 16px 18px;
}
.wb-title {
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.wb-recipe-grid {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--line);
  margin-bottom: 14px;
}
.wb-recipe-head,
.wb-recipe-row {
  display: grid;
  grid-template-columns: 1fr 80px 100px 110px;
  gap: 12px;
  padding: 6px 10px;
  background: var(--bg-night);
  align-items: center;
  font-size: 12px;
}
.wb-recipe-head {
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.wb-recipe-row.missing {
  opacity: 0.6;
}
.wb-recipe-row .mono {
  font-family: var(--mono);
  color: var(--parch-3);
}

.wb-totals {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.wb-totals-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  color: var(--parch-3);
}
.wb-totals-row .mono {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--parch);
}
.wb-totals-row.total {
  border-top: 1px dashed var(--line-strong);
  padding-top: 6px;
  margin-top: 2px;
  color: var(--parch);
  font-weight: 500;
}
.wb-totals-row.total .mono { color: var(--gold); font-weight: 600; }
.wb-totals-row .mono.pos { color: var(--emerald); }
.wb-totals-row .mono.neg { color: var(--garnet); }

.wb-method {
  font-weight: 500;
  color: var(--parch);
  font-size: 13px;
}
.wb-method-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.best-mark {
  font-size: 9px;
  color: var(--emerald);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-left: 6px;
}

/* Chain rows */
.wisp-row.chain-row {
  background: rgba(176, 124, 209, 0.03);
}
.wisp-row.chain-row:not(.wisp-head):hover {
  background: rgba(176, 124, 209, 0.08);
}
.wisp-row.chain-row.best {
  background: rgba(176, 124, 209, 0.1);
  border-left: 3px solid var(--amethyst);
}
.chain-grade {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--serif);
  font-size: 13px;
}
.chain-arrow {
  color: var(--amethyst);
  font-size: 12px;
  opacity: 0.7;
}

/* Glowing input mini */
.wisp-glowing-mini {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.wisp-glowing-mini input {
  width: 38px;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  color: var(--parch);
  font-family: var(--mono);
  font-size: 11px;
  text-align: right;
  padding: 2px 4px;
  border-radius: 3px;
  outline: none;
  -moz-appearance: textfield;
}
.wisp-glowing-mini input::-webkit-outer-spin-button,
.wisp-glowing-mini input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.wisp-glowing-mini input:focus { border-color: var(--gold-soft); }

/* Chain breakdown panel */
.wb-chain-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.wcs-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  color: var(--parch-3);
}
.wcs-line .mono {
  font-family: var(--mono);
  font-size: 12px;
}
.wcs-line.wcs-total {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--line-strong);
  font-weight: 500;
}
.wcs-line .pos { color: var(--emerald); }
.wcs-line .neg { color: var(--garnet); }

.wb-chain-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}
.wcs-step {
  border-left: 2px solid var(--line-strong);
  padding: 8px 12px;
  background: rgba(13, 19, 34, 0.6);
  border-radius: 0 4px 4px 0;
}
.wcs-step.wcs-wisp-craft { border-left-color: var(--gold); }
.wcs-step.wcs-upgrade    { border-left-color: var(--sapphire); }
.wcs-step.wcs-reroll     { border-left-color: var(--amethyst); }
.wcs-step-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
.wcs-step-num {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--line);
  color: var(--parch);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
}
.wcs-step-label {
  flex: 1;
  color: var(--parch);
  font-weight: 500;
  letter-spacing: 0.04em;
}
.wcs-step-cost {
  font-family: var(--mono);
  color: var(--gold);
  font-weight: 600;
}
.wcs-step-detail {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  padding-left: 28px;
  line-height: 1.5;
}
.wcs-step-detail .mono {
  font-family: var(--mono);
  color: var(--parch-3);
}
.wb-chain-missing {
  margin-top: 12px;
  padding: 8px 12px;
  background: rgba(213, 106, 106, 0.08);
  border: 1px solid rgba(213, 106, 106, 0.25);
  border-radius: 3px;
  font-size: 11px;
  color: var(--garnet);
}
.vol-tag .vol-ico {
  font-size: 9px;
  opacity: 0.6;
}
.metric.labor .val { color: var(--labor); }
.metric.labor .lp {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--labor);
  opacity: 0.8;
}

/* Cost composition bar */
.compose { margin: 0 0 22px; }
.compose-bar {
  display: flex;
  height: 14px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--line);
}
.compose-seg {
  height: 100%;
  position: relative;
  cursor: default;
  transition: filter 0.15s, width 0.3s ease;
}
.compose-seg:hover { filter: brightness(1.25); }
.compose-legend {
  display: flex; flex-wrap: wrap; gap: 10px 18px;
  margin-top: 12px;
  font-size: 11px;
  color: var(--muted);
}
.compose-legend .sw {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 2px;
  margin-right: 6px; vertical-align: middle;
}
.compose-legend .pct {
  font-family: var(--mono); color: var(--parch);
  margin-left: 6px;
}

/* Ingredients tree */
.section-head {
  display: flex; align-items: center; gap: 12px;
  margin: 28px 0 10px;
}
.section-head .ruler {
  flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--line-strong), transparent);
}
.section-head .name {
  font-family: var(--serif);
  font-size: 20px;
  color: var(--parch);
  letter-spacing: 0.02em;
}
.section-head .num {
  font-family: var(--mono);
  color: var(--gold);
  font-size: 12px;
}

.ing-tree {
  border-top: 1px solid var(--line);
}
.ing-tree-head {
  display: grid;
  grid-template-columns: 1fr 60px 180px 110px;
  gap: 12px;
  padding: 8px 14px;
  font-size: 9px;
  letter-spacing: 0.25em;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}
.ing-tree-head > div:nth-child(2),
.ing-tree-head > div:nth-child(3),
.ing-tree-head > div:nth-child(4) { text-align: right; }

.ing-row {
  display: grid;
  grid-template-columns: 1fr 60px 180px 110px;
  gap: 12px;
  padding: 12px 14px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  transition: background 0.1s;
}
.ing-row:hover { background: rgba(212,169,96,0.03); }
.ing-row.depth-1 { background: rgba(91,155,213,0.03); }
.ing-row.depth-2 { background: rgba(91,155,213,0.05); }
.ing-row.depth-3 { background: rgba(91,155,213,0.07); }
.ing-row.depth-1:hover { background: rgba(91,155,213,0.06); }
.ing-row.depth-2:hover { background: rgba(91,155,213,0.08); }

.ing-name {
  display: flex; align-items: center; gap: 10px;
  min-width: 0;
}
.ing-indent {
  display: inline-block;
  width: 0;
  flex-shrink: 0;
}
.ing-row .ing-indent {
  /* width set inline */
}
.tree-connector {
  font-family: var(--mono);
  color: rgba(91,155,213,0.45);
  font-size: 12px;
  margin-right: 4px;
  user-select: none;
  flex-shrink: 0;
}
.expand-btn {
  width: 18px; height: 18px;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: var(--gold);
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 10px;
  padding: 0;
  flex-shrink: 0;
  transition: transform 0.2s, background 0.15s, border-color 0.15s;
}
.expand-btn:hover { background: rgba(212,169,96,0.12); border-color: var(--gold); }
.expand-btn.open { transform: rotate(90deg); background: rgba(212,169,96,0.12); border-color: var(--gold); }
.expand-btn.empty {
  visibility: hidden;
}
.ing-chip {
  width: 26px; height: 26px;
  flex-shrink: 0;
  border-radius: 3px;
  background: repeating-linear-gradient(45deg, #1f2a45, #1f2a45 3px, #1a233a 3px, #1a233a 6px);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 600;
}

/* Item icons — pixel art from game assets */
.item-icon {
  width: 32px; height: 32px;
  flex-shrink: 0;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, #1a233a, #0f1525);
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  display: block;
  object-fit: contain;
  padding: 1px;
}
.item-icon-sm { width: 24px; height: 24px; }
.item-icon-lg { width: 64px; height: 64px; border-radius: 4px; padding: 2px; }
.item-icon-fallback {
  background: repeating-linear-gradient(45deg, #1f2a45, #1f2a45 3px, #1a233a 3px, #1a233a 6px);
  display: grid;
  place-items: center;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.item-icon-lg.item-icon-fallback { font-size: 28px; }
.item-icon-sm.item-icon-fallback { font-size: 11px; }
.ing-label {
  color: var(--parch);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ing-jump {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 1px dashed rgba(91, 155, 213, 0.35);
  transition: color 0.12s ease, border-color 0.12s ease;
}
.ing-jump:hover {
  color: var(--sapphire);
  border-bottom-color: var(--sapphire);
}
.ing-jump:focus-visible {
  outline: 1px solid var(--sapphire);
  outline-offset: 2px;
}
.ing-jump-arrow {
  font-size: 10px;
  color: var(--sapphire);
  opacity: 0.55;
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.ing-jump:hover .ing-jump-arrow {
  opacity: 1;
  transform: translate(1px, -1px);
}
.craft-gpl {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.02em;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.craft-gpl.good {
  color: var(--emerald);
  background: rgba(111, 185, 106, 0.08);
  border-color: rgba(111, 185, 106, 0.25);
}
.craft-gpl.bad {
  color: var(--garnet);
  background: rgba(213, 106, 106, 0.08);
  border-color: rgba(213, 106, 106, 0.25);
}

/* ─── Shopping list modal ──────────────────────────────────────────── */
.shop-overlay {
  position: fixed; inset: 0;
  background: rgba(8, 10, 18, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: grid; place-items: center;
  padding: 24px;
  animation: shopFade 0.18s ease;
}
@keyframes shopFade { from { opacity: 0; } to { opacity: 1; } }
.shop-modal {
  width: min(880px, 100%);
  max-height: calc(100vh - 48px);
  background: linear-gradient(180deg, #161e34 0%, #101729 100%);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(212,169,96,0.08) inset;
  display: flex; flex-direction: column;
  overflow: hidden;
  font-family: var(--sans);
  color: #e8ecf3;
}
.shop-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
}
.shop-title {
  font-family: var(--serif);
  color: var(--parch);
  font-size: 24px;
  font-weight: 500;
  margin: 4px 0 0;
  letter-spacing: 0.01em;
}
.shop-title .shop-x {
  color: var(--gold);
  font-family: var(--mono);
  font-size: 18px;
  margin-left: 6px;
}
.shop-actions {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.batch-stepper {
  display: flex; align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: rgba(212, 169, 96, 0.04);
}
.batch-stepper .thr-unit {
  padding-left: 8px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.batch-stepper .thr-input {
  color: var(--gold);
  width: 44px;
}
.shop-body {
  overflow-y: auto;
  padding: 8px 8px 8px 24px;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.shop-body::-webkit-scrollbar { width: 8px; }
.shop-body::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }
.shop-row {
  display: grid;
  grid-template-columns: 1fr 100px 110px 130px;
  gap: 12px;
  align-items: center;
  padding: 8px 16px 8px 0;
  border-bottom: 1px solid rgba(212, 169, 96, 0.06);
  font-size: 13px;
}
.shop-row:last-child { border-bottom: 0; }
.shop-head-row {
  position: sticky; top: 0;
  background: linear-gradient(180deg, #161e34 0%, #161e34 80%, rgba(22,30,52,0) 100%);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding-top: 12px;
  padding-bottom: 8px;
  z-index: 1;
}
.shop-name {
  display: flex; align-items: center; gap: 10px;
  min-width: 0;
}
.shop-qty { color: var(--parch); }
.shop-row.missing .shop-name .ing-label { color: var(--garnet-fade, #d56a6a); opacity: 0.85; }
.shop-row .num { text-align: right; }
.shop-foot {
  padding: 14px 24px 18px;
  border-top: 1px solid var(--line);
  background: rgba(8, 11, 22, 0.5);
  display: flex; flex-direction: column; gap: 4px;
}
.shop-foot-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.shop-foot-row .mono { font-family: var(--mono); font-size: 13px; }
.shop-foot-row.total {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px dashed var(--line-strong);
  font-size: 13px;
  color: var(--parch);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.shop-foot-row.total .mono { font-size: 18px; font-family: var(--serif); }
.shop-close { margin-left: 4px; }
.ing-meta {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
  letter-spacing: 0.04em;
  display: flex; gap: 8px;
  align-items: center;
}
.ing-meta .nomarket {
  color: var(--garnet); opacity: 0.85;
  font-style: italic;
}
.ing-meta .craftable {
  color: var(--sapphire);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 9px;
  font-weight: 600;
}

.qty-cell {
  text-align: right;
  font-family: var(--mono);
  color: var(--parch);
  font-size: 13px;
}

.price-cell {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

.mode-toggle {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  overflow: hidden;
}
.mode-toggle button {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.14em;
  padding: 3px 7px;
  cursor: pointer;
  font-weight: 600;
  text-transform: uppercase;
  transition: all 0.12s;
}
.mode-toggle button:hover { color: var(--parch); }
.mode-toggle button.on.m { background: var(--gold); color: #1a1306; }
.mode-toggle button.on.c { background: var(--sapphire); color: #07111e; }

.price-edit {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 2px 6px;
  transition: border-color 0.15s;
}
.price-edit:focus-within { border-color: var(--gold-soft); }
.price-edit .cur { color: var(--gold); font-family: var(--mono); font-size: 10px; }
.price-edit input {
  width: 64px;
  background: transparent;
  border: none;
  color: var(--parch);
  font-family: var(--mono);
  font-size: 12px;
  text-align: right;
  padding: 3px 0;
  outline: none;
  -moz-appearance: textfield;
}
.price-edit input::-webkit-outer-spin-button,
.price-edit input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.price-edit.modified { border-color: var(--sapphire); }
.price-reset {
  display: inline-block;
  color: var(--sapphire);
  font-size: 9px;
  text-decoration: underline;
  cursor: pointer;
  letter-spacing: 0.04em;
}

.subtotal-cell {
  text-align: right;
  font-family: var(--mono);
  color: var(--parch);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.tree-totals {
  background: var(--bg-night);
  padding: 16px 14px;
  border-top: 2px solid var(--line-strong);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
}
.tree-totals .lbl {
  font-size: 10px;
  letter-spacing: 0.28em;
  color: var(--gold);
  text-transform: uppercase;
}
.tree-totals .stack {
  display: flex; gap: 24px; align-items: baseline;
  justify-content: flex-end;
}
.tree-totals .v {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 500;
}
.tree-totals .v.cost { color: var(--garnet); }
.tree-totals .v.labor { color: var(--labor); }
.tree-totals .v small {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-family: var(--sans);
  margin-left: 4px;
}

/* Sell card */
.sell-card {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 18px 22px;
  background: linear-gradient(180deg, rgba(212,169,96,0.04), transparent), var(--bg-night);
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 22px;
}
.sell-card .lbl {
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--muted);
  text-transform: uppercase;
}
.sell-card .market {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--parch);
  margin-top: 4px;
}
.sell-card .market .cur { color: var(--gold); font-family: var(--mono); font-size: 13px; }
.sell-card .market .none { color: var(--garnet); font-style: italic; font-size: 14px; }
.sell-card .price-edit input { width: 110px; font-size: 18px; padding: 8px 0; }
.sell-card .price-edit { padding: 4px 14px; }
.sell-card .price-edit .cur { font-size: 14px; }
.sell-card .delta {
  font-family: var(--mono);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 3px;
  letter-spacing: 0.02em;
}
.sell-card .delta.pos { color: var(--emerald); background: rgba(111,185,106,0.08); }
.sell-card .delta.neg { color: var(--garnet); background: rgba(213,106,106,0.08); }

/* Compare drawer */
.compare-bar {
  position: fixed;
  left: 380px; right: 0; bottom: 0;
  background: linear-gradient(180deg, rgba(20,28,48,0.96), rgba(13,19,34,0.98));
  border-top: 1px solid var(--line-strong);
  padding: 18px 40px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 32px;
  align-items: center;
  z-index: 4;
  backdrop-filter: blur(8px);
}
.compare-bar::before {
  content: '';
  position: absolute; left: 0; right: 0; top: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.cmp-slot {
  display: flex; align-items: center; gap: 16px;
  min-width: 0;
}
.cmp-slot.right { justify-content: flex-end; text-align: right; }
.cmp-name {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--parch);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cmp-profit {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
}
.cmp-profit.pos { color: var(--emerald); }
.cmp-profit.neg { color: var(--garnet); }
.cmp-vs {
  font-family: var(--serif);
  font-size: 14px;
  color: var(--gold);
  letter-spacing: 0.4em;
  padding: 4px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
}
.cmp-winner {
  font-size: 9px;
  letter-spacing: 0.28em;
  color: var(--gold);
  text-transform: uppercase;
  margin-top: 2px;
}
.cmp-close {
  position: absolute;
  top: 8px; right: 14px;
  background: transparent; border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.cmp-close:hover { color: var(--gold); }
.cmp-empty {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* Toast */
.toast {
  position: fixed;
  top: 78px; right: 24px;
  background: var(--bg-night);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 12px 18px;
  font-size: 12px;
  color: var(--parch);
  z-index: 100;
  max-width: 320px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  animation: toastIn 0.3s ease-out;
}
.toast.ok { border-color: var(--emerald); color: var(--emerald); }
.toast.err { border-color: var(--garnet); color: var(--garnet); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Animations */
.fade-in {
  animation: fadeIn calc(0.4s * var(--anim-scale, 1)) ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.tally-tick {
  display: inline-block;
  animation: tickIn calc(0.35s * var(--anim-scale, 1)) ease-out;
}
@keyframes tickIn {
  0% { opacity: 0; transform: translateY(-4px); }
  60% { opacity: 1; transform: translateY(1px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ---------- View tabs ---------- */
.view-tabs {
  display: flex;
  gap: 4px;
  margin-right: 16px;
  padding: 4px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.view-tab {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 3px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.15s;
}
.view-tab:hover { color: var(--parch); }
.view-tab.active {
  background: var(--gold);
  color: #1a1306;
}
.view-tab .badge {
  background: rgba(255,255,255,0.15);
  color: inherit;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 2px;
  font-weight: 700;
  letter-spacing: 0;
}
.view-tab.active .badge { background: rgba(0,0,0,0.18); }

/* ---------- Prices view ---------- */
.prices-view { grid-column: 1 / -1; }

.prices-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}

.prices-controls {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}
.prices-filters {
  display: flex;
  gap: 6px;
}

.prices-table {
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.prices-row {
  display: grid;
  grid-template-columns: minmax(280px, 1.6fr) 80px 90px 100px 110px 200px 100px;
  gap: 16px;
  padding: 12px 16px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  transition: background 0.1s;
  background: var(--bg-night);
}
.prices-row:last-child { border-bottom: none; }
.prices-row:hover { background: rgba(212,169,96,0.04); }
.prices-row > .num { text-align: right; }
.prices-row.prices-head {
  background: var(--bg-deep);
  padding: 10px 16px;
  font-size: 9px;
  letter-spacing: 0.25em;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 600;
}
.prices-row.prices-head:hover { background: var(--bg-deep); }
.prices-row.missing { background: rgba(213,106,106,0.04); }
.prices-row.missing:hover { background: rgba(213,106,106,0.07); }
.prices-row.overridden { background: rgba(91,155,213,0.04); }
.prices-row.overridden:hover { background: rgba(91,155,213,0.07); }

.pri-name {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

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

.tag-hard {
  color: var(--labor);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 9px;
  font-weight: 600;
}

.write-status {
  margin-left: 6px;
  display: inline-grid;
  place-items: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  cursor: help;
}
.write-status.pending {
  color: var(--gold);
  animation: spin 1s linear infinite;
}
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.write-status.ok {
  color: var(--emerald);
  background: rgba(111,185,106,0.15);
  animation: writeOkFade 2.5s ease-out forwards;
}
@keyframes writeOkFade { 0%, 60% { opacity: 1; } 100% { opacity: 0.5; } }
.write-status.err {
  color: var(--garnet);
  background: rgba(213,106,106,0.15);
}


/* ─── Seeds page (profitability calculator) ─────────────────────────── */
.seeds-view {
  padding: 24px 32px;
}

.seeds-inputs {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}
.seeds-input {
  --accent: var(--gold);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 170px;
}
.seeds-input-label {
  font-size: 9px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.seeds-input-field {
  display: inline-flex;
  align-items: stretch;
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.seeds-input-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 18%, transparent);
}
.seeds-input-step {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--accent);
  width: 28px;
  font-family: var(--mono);
  font-size: 14px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.12s ease, background 0.12s ease;
  padding: 0;
}
.seeds-input-step:hover {
  opacity: 1;
  background: color-mix(in oklab, var(--accent) 10%, transparent);
}
.seeds-input-field input {
  flex: 1;
  appearance: textfield;
  -moz-appearance: textfield;
  background: transparent;
  border: 0;
  color: var(--parch);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  text-align: right;
  padding: 6px 4px;
  outline: none;
  width: 70px;
  min-width: 0;
}
.seeds-input-field input::-webkit-inner-spin-button,
.seeds-input-field input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.seeds-input-field input:focus {
  color: var(--accent);
}
.seeds-input-unit {
  display: inline-flex;
  align-items: center;
  padding: 0 8px 0 2px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  opacity: 0.75;
}
.seeds-input-hint {
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.04em;
  font-style: italic;
}

/* Section heads (Gold Seeds / Vocation Seeds) */
.seeds-section { margin-bottom: 4px; }
.seeds-section-head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 10px;
}
.seeds-section-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}
.seeds-section-rule {
  display: inline-block;
  width: 4px;
  height: 22px;
  border-radius: 2px;
  align-self: center;
  background: var(--gold);
}
.seeds-section-name {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
  color: var(--parch);
  letter-spacing: 0.02em;
}
.seeds-section-sub {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* Sort toggle */
.seeds-sort-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  background: var(--bg-night);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.seeds-sort-label {
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding: 0 8px 0 6px;
}
.seeds-sort-btn {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 6px 12px;
  border-radius: 3px;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
  transition: background 0.12s ease, color 0.12s ease;
}
.seeds-sort-btn:hover { color: var(--parch); }
.seeds-sort-btn.on {
  background: var(--gold);
  color: #1a1306;
}
.seeds-sort-btn.voc-key {
  color: var(--amethyst);
  opacity: 0.85;
}
.seeds-sort-btn.voc-key:hover { opacity: 1; }
.seeds-sort-btn.voc-key.on {
  background: var(--amethyst);
  color: #1a1024;
  opacity: 1;
}

/* Table — reuses .wisp-table chrome but with seed-specific columns */
.seeds-table {
  max-height: none;
}
/* Gold table columns */
.seeds-row.gold {
  display: grid;
  grid-template-columns:
    32px        /* # */
    minmax(180px, 1.4fr) /* Seed */
    100px       /* Climate */
    70px        /* Grow */
    60px        /* Labor */
    80px        /* Yield */
    100px       /* Revenue */
    100px       /* Cost */
    110px       /* Profit */
    100px       /* Profit/LP */
    100px;      /* Profit/Hr */
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  transition: background 0.12s ease;
}
/* Voc table — extra column */
.seeds-row.voc {
  display: grid;
  grid-template-columns:
    32px
    minmax(180px, 1.4fr)
    100px
    70px
    60px
    80px
    100px
    100px
    110px
    100px
    100px
    115px;      /* Profit/1k Voc */
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  transition: background 0.12s ease;
}

.seeds-row.seeds-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-night);
  cursor: default;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.seeds-row.seeds-head:hover { background: var(--bg-night); }
.seeds-row.seeds-head .sort-on {
  color: var(--gold);
}
.seeds-row.seeds-head .voc-col.sort-on,
.seeds-row.seeds-head .voc-col { color: var(--amethyst); }

.seeds-row:last-child { border-bottom: 0; }
.seeds-row:not(.seeds-head):hover {
  background: rgba(212, 169, 96, 0.04);
}
.seeds-row.open {
  background: rgba(212, 169, 96, 0.07);
  border-bottom-color: transparent;
}
.seeds-row.missing { opacity: 0.55; }
.seeds-row.best.best-gold {
  background: rgba(212, 169, 96, 0.08);
  border-left: 3px solid var(--gold);
  padding-left: 13px;
}
.seeds-row.best.best-voc {
  background: rgba(176, 124, 209, 0.08);
  border-left: 3px solid var(--amethyst);
  padding-left: 13px;
}

/* Seed name cell (matches .wb-method style but adds the icon inline) */
.seeds-row .wb-method {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.seeds-row .wb-method .item-icon { flex-shrink: 0; }
.seeds-row .wb-method-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  padding-left: 32px; /* align under the name, past the icon */
  line-height: 1.3;
}

/* Highlighted Profit/1k Voc column */
.seeds-row .voc-col {
  position: relative;
  font-weight: 600;
}
.seeds-row:not(.seeds-head) .voc-col::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 26px;
  background: linear-gradient(180deg, transparent, rgba(176, 124, 209, 0.35), transparent);
}
.seeds-row:not(.seeds-head) .voc-col.pos { color: var(--amethyst); }
.seeds-row:not(.seeds-head) .voc-col.neg { color: var(--garnet); opacity: 0.75; }

/* Climate pills */
.climate-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  border: 1px solid;
  background: var(--bg-night);
}
.climate-pill.climate-temperate {
  color: var(--emerald);
  border-color: rgba(111, 185, 106, 0.4);
  background: rgba(111, 185, 106, 0.08);
}
.climate-pill.climate-tropical {
  color: #e8a05a;
  border-color: rgba(230, 160, 90, 0.4);
  background: rgba(230, 160, 90, 0.08);
}
.climate-pill.climate-arid {
  color: var(--labor);
  border-color: rgba(230, 179, 112, 0.4);
  background: rgba(230, 179, 112, 0.08);
}
.climate-pill.climate-any {
  color: var(--sapphire);
  border-color: rgba(91, 155, 213, 0.4);
  background: rgba(91, 155, 213, 0.08);
}

/* Breakdown panel — three-column layout */
.seeds-breakdown {
  background: linear-gradient(180deg, rgba(212, 169, 96, 0.04), transparent);
}
.seeds-bd-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 18px;
  margin-bottom: 4px;
}
.seeds-bd-col {
  background: var(--bg-night);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 14px 16px;
}
.seeds-bd-col-head {
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.seeds-bd-col .wb-totals { padding-top: 0; border-top: 0; }
.seeds-tone-voc .seeds-bd-col-head { color: var(--amethyst); }

/* When the seeds page is shown, allow it to scroll inside the detail area */
.seeds-view .seeds-table {
  overflow: visible;
  max-height: none;
}


/* ─── Regrade page ───────────────────────────────────────────────────── */
.regrade-row {
  display: grid;
  grid-template-columns: 28px 1fr 80px 220px 90px 80px 80px 110px;
  align-items: center;
  padding: 8px 12px;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  transition: background 0.12s ease;
}
.regrade-row:hover { background: rgba(212, 169, 96, 0.04); }

.rg-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-night);
  cursor: default;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.rg-head:hover { background: var(--bg-night); }


/* ─── Regrade page — compact controls + hero ─────────────────────────── */
.rg-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 14px;
}
.rg-ctrl {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.rg-ctrl-lbl {
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.rg-ctrl-sel {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  color: var(--parch);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 26px 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%23d6c89c' d='M0 0h10L5 6z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 9px center;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.rg-ctrl-sel:hover { background-color: rgba(212, 169, 96, 0.05); }
.rg-ctrl-sel:focus-visible { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(212,169,96,0.25); }
.rg-ctrl-sel option { background: var(--bg-deep); color: var(--parch); }
.rg-ctrl-accent .rg-ctrl-lbl { color: var(--gold); }
.rg-ctrl-accent .rg-ctrl-sel {
  border-color: var(--gold-soft);
  color: var(--gold);
  font-weight: 600;
}

.rg-toggle {
  display: inline-flex;
  align-items: center;
  align-self: flex-end;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  color: var(--parch-3);
  user-select: none;
  transition: border-color 0.12s ease;
}
.rg-toggle:hover { border-color: var(--line-strong); }
.rg-toggle input { accent-color: var(--gold); }

/* Hero card */
.rg-hero {
  background: linear-gradient(180deg, rgba(212, 169, 96, 0.05), rgba(212, 169, 96, 0.01));
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 14px 18px;
  margin-bottom: 18px;
}
.rg-hero-totals {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 12px;
}
.rg-hero-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rg-hero-lbl {
  font-size: 9px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.rg-hero-val {
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 500;
  color: var(--gold);
  line-height: 1;
  letter-spacing: -0.01em;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.rg-hero-cur {
  font-family: var(--mono);
  font-size: 16px;
  color: var(--gold);
  opacity: 0.7;
}
.rg-hero-side {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 12px;
  color: var(--parch-3);
  padding-bottom: 2px;
}
.rg-hero-side > span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
}
.rg-side-lbl {
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.rg-apply-btn {
  margin-left: auto;
  appearance: none;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 3px;
  background: var(--gold);
  color: #1a1306;
  border: 1px solid var(--gold);
  cursor: pointer;
  align-self: flex-end;
  transition: background 0.12s ease, color 0.12s ease;
}
.rg-apply-btn:hover { background: var(--parch); border-color: var(--parch); }

/* Charm chips */
.rg-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.rg-chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--muted);
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.rg-chip:hover { border-color: var(--line-strong); color: var(--parch); }
.rg-chip.on {
  background: rgba(176, 124, 209, 0.12);
  border-color: var(--amethyst);
  color: var(--amethyst);
}
.rg-chip.on.opt {
  background: rgba(176, 124, 209, 0.16);
  box-shadow: 0 0 0 1px rgba(176, 124, 209, 0.35);
}
.rg-chip-check {
  font-family: var(--mono);
  font-size: 13px;
  width: 12px;
  text-align: center;
  opacity: 0.8;
}
.rg-chip.on .rg-chip-check { color: var(--amethyst); opacity: 1; }
.rg-chip-name { font-weight: 600; }
.rg-chip-mult { font-family: var(--mono); font-size: 11px; opacity: 0.75; }
.rg-chip-price {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--gold);
  opacity: 0.85;
  padding-left: 6px;
  border-left: 1px solid var(--line);
}
.rg-chip-tag {
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--emerald);
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 2px;
  background: rgba(111, 185, 106, 0.12);
}

/* Inline totals next to section header */
.rg-totals-inline {
  margin-left: auto;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  color: var(--parch-3);
  white-space: nowrap;
}


/* Regrade — Base item cost field */
.rg-cost-field {
  display: inline-flex;
  align-items: stretch;
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  overflow: hidden;
  transition: border-color 0.12s ease;
}
.rg-cost-field:focus-within { border-color: var(--gold); }
.rg-cost-input {
  appearance: textfield;
  -moz-appearance: textfield;
  background: transparent;
  border: 0;
  color: var(--parch);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  text-align: right;
  padding: 6px 4px 6px 10px;
  outline: none;
  width: 78px;
}
.rg-cost-input::-webkit-inner-spin-button,
.rg-cost-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.rg-cost-input:focus { color: var(--gold); }
.rg-cost-cur {
  display: inline-flex;
  align-items: center;
  padding: 0 10px 0 4px;
  color: var(--gold);
  font-family: var(--mono);
  font-size: 11px;
  opacity: 0.75;
}


/* Regrade — resplendent chip variant (gold/sapphire instead of amethyst) */
.rg-chip.resp.on {
  background: rgba(91, 155, 213, 0.14);
  border-color: var(--sapphire);
  color: var(--sapphire);
}
.rg-chip.resp.on.opt {
  background: rgba(91, 155, 213, 0.20);
  box-shadow: 0 0 0 1px rgba(91, 155, 213, 0.4);
}
.rg-chip.resp.on .rg-chip-check { color: var(--sapphire); }
.rg-chip.resp .rg-chip-price { color: var(--sapphire); opacity: 0.85; }
.rg-chip.resp.disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
.rg-chip.resp.disabled:hover { border-color: var(--line); color: var(--muted); }


/* Regrade — per-grade resplendent chips row */
.rg-chips-resp {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  gap: 6px;
  align-items: center;
}
.rg-chips-label {
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--sapphire);
  font-weight: 700;
  padding-right: 6px;
  align-self: center;
  border-right: 1px solid var(--line);
  margin-right: 2px;
  cursor: help;
}
/* Compact resp chip — smaller than charm chips since they don't carry as much info */
.rg-chips-resp .rg-chip {
  padding: 5px 10px;
  font-size: 11px;
  gap: 6px;
}
.rg-chips-resp .rg-chip .rg-chip-name { font-weight: 500; }


/* ─── Regrade — restructured inline-toggle table ─────────────────────── */

/* Override the .regrade-row grid: now 7 cols including charm + resp toggles */
.rg-table .regrade-row {
  grid-template-columns: 36px minmax(110px, 1fr) 80px 170px 130px 80px 130px;
  padding: 10px 14px;
  gap: 12px;
}
.rg-table .regrade-row .num { text-align: right; }

/* Inline toggle pill (charm + resp) */
.rg-tog {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--muted);
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
  font-weight: 500;
}
.rg-tog:hover { border-color: var(--line-strong); color: var(--parch); }
.rg-tog .ck {
  font-family: var(--mono);
  font-size: 12px;
  opacity: 0.7;
}
.rg-tog .lbl { font-weight: 600; }
.rg-tog .sub {
  font-family: var(--mono);
  font-size: 10px;
  opacity: 0.7;
}
.rg-tog .opt-tag {
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #1a1306;
  background: var(--emerald);
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 2px;
}

/* Variants */
.rg-tog.charm.on {
  background: rgba(176, 124, 209, 0.14);
  border-color: var(--amethyst);
  color: var(--amethyst);
}
.rg-tog.charm.on .ck { color: var(--amethyst); opacity: 1; }
.rg-tog.charm.opt {
  box-shadow: 0 0 0 1px rgba(176, 124, 209, 0.32);
}

.rg-tog.resp.on {
  background: rgba(91, 155, 213, 0.14);
  border-color: var(--sapphire);
  color: var(--sapphire);
}
.rg-tog.resp.on .ck { color: var(--sapphire); opacity: 1; }
.rg-tog.resp.opt {
  box-shadow: 0 0 0 1px rgba(91, 155, 213, 0.32);
}

.rg-tog.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.rg-tog.disabled:hover { border-color: var(--line); color: var(--muted); }

/* Tighten hero card spacing */
.rg-hero { padding: 16px 20px; margin-bottom: 22px; }
.rg-hero-totals { gap: 28px; }
.rg-hero-side { font-size: 11.5px; gap: 8px 18px; }
