/* ──────────────────────────────────────────────────────────────────────
   BB CRAFTING — v2 elevation pass
   Loaded AFTER styles.css. Defines a shared "Codex-level" toolkit:
     · per-tab accent variable (.app[data-view=…])
     · .page-hero — framed eyebrow + serif title + tags + aside
     · .metric-strip — Codex-style numbers strip (page-scoped)
     · .framed-section — bracketed panel with section head
     · .grade-pill — colored Illustrious→Ayanad pills
     · .chain-flow — wisp chain flow diagram nodes
     · .heatmap — regrade success-rate matrix
     · .climate-sigil — tiny SVG climate marks
     · .bg-sigil — large faint background glyph for visual texture
   The original .wisp-* / .seeds-* / .prices-* classes still apply; this
   layer wraps and supplements rather than replaces.
   ────────────────────────────────────────────────────────────────────── */

/* ─── Per-tab accent ─────────────────────────────────────────────── */
.app                      { --view-accent: var(--gold);     --view-accent-soft: rgba(212,169,96,0.14); --view-accent-line: rgba(212,169,96,0.32); }
.app[data-view="codex"]   { --view-accent: var(--gold);     --view-accent-soft: rgba(212,169,96,0.14); --view-accent-line: rgba(212,169,96,0.32); }
.app[data-view="prices"]  { --view-accent: #e8b85e;          --view-accent-soft: rgba(232,184,94,0.14);  --view-accent-line: rgba(232,184,94,0.35); }
.app[data-view="wisps"]   { --view-accent: var(--sapphire); --view-accent-soft: rgba(91,155,213,0.14); --view-accent-line: rgba(91,155,213,0.36); }
.app[data-view="seeds"]   { --view-accent: var(--emerald);  --view-accent-soft: rgba(111,185,106,0.14);--view-accent-line: rgba(111,185,106,0.36); }
.app[data-view="regrade"] { --view-accent: var(--garnet);   --view-accent-soft: rgba(213,106,106,0.14);--view-accent-line: rgba(213,106,106,0.36); }

/* Active tab pulse — uses the accent variable */
.view-tabs .view-tab.active {
  /* Override the default gold underline with the page accent */
  position: relative;
}
.view-tabs .view-tab.active::after {
  content: '';
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: -2px;
  height: 2px;
  background: var(--view-accent);
  box-shadow: 0 0 12px var(--view-accent);
  border-radius: 2px;
  animation: tabPulse 3.2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes tabPulse {
  0%, 100% { opacity: 0.55; transform: scaleX(0.7); }
  50%      { opacity: 1.00; transform: scaleX(1);   }
}

/* Subtle ambient background tint per view */
.app[data-view="wisps"]   body,
.app[data-view="wisps"]   .detail::before,
.app[data-view="seeds"]   .detail::before,
.app[data-view="regrade"] .detail::before,
.app[data-view="prices"]  .detail::before { content: ''; }

/* ─── Page hero (elevated header) ───────────────────────────────── */
.page-hero {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 24px;
  align-items: stretch;
  padding: 4px 0 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.page-hero::after {
  /* hairline beneath the bottom border, accent-tinted */
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--view-accent-line), transparent);
  pointer-events: none;
}
.page-hero-crest {
  width: 88px; height: 88px;
  border: 1px solid var(--view-accent-line);
  border-radius: 4px;
  background:
    radial-gradient(circle at 30% 25%, var(--view-accent-soft), transparent 65%),
    linear-gradient(135deg, #1c2640, #0f1525);
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 40px;
  color: var(--view-accent);
  position: relative;
  flex-shrink: 0;
  text-shadow: 0 0 16px var(--view-accent-soft);
}
.page-hero-crest::before,
.page-hero-crest::after {
  content: '';
  position: absolute;
  width: 12px; height: 12px;
  border: 1px solid var(--view-accent);
}
.page-hero-crest::before { top: -4px; left: -4px;  border-right: none; border-bottom: none; }
.page-hero-crest::after  { bottom: -4px; right: -4px; border-left: none;  border-top: none; }

.page-hero-meta { min-width: 0; display: flex; flex-direction: column; justify-content: space-between; }
.page-hero-eyebrow {
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--view-accent);
  margin-bottom: 4px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.page-hero-eyebrow::after {
  content: '';
  display: inline-block;
  height: 1px;
  width: 36px;
  background: var(--view-accent);
  opacity: 0.6;
}
.page-hero-title {
  font-family: var(--serif);
  font-size: 38px;
  line-height: 1.02;
  color: var(--parch);
  margin: 2px 0 10px;
  letter-spacing: 0.005em;
  font-weight: 500;
}
.page-hero-title em {
  font-style: italic;
  color: var(--view-accent);
  font-weight: 400;
}
.page-hero-tags {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
  flex-wrap: wrap;
}
.page-hero-tags .dot {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--line-strong);
}
.page-hero-tags .pill {
  padding: 2px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: var(--view-accent);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.page-hero-tags .pill.muted {
  color: var(--muted);
  border-color: var(--line);
}
.page-hero-aside {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Aside card — a single accent-colored hero stat next to the title */
.hero-aside-card {
  min-width: 220px;
  padding: 16px 18px;
  border: 1px solid var(--view-accent-line);
  border-radius: 4px;
  background:
    linear-gradient(140deg, var(--view-accent-soft), transparent 70%),
    var(--bg-night);
  position: relative;
}
.hero-aside-card::before,
.hero-aside-card::after {
  content: '';
  position: absolute;
  width: 8px; height: 8px;
  border: 1px solid var(--view-accent);
}
.hero-aside-card::before { top: -3px; left: -3px;   border-right: none; border-bottom: none; }
.hero-aside-card::after  { bottom: -3px; right: -3px; border-left: none;  border-top: none; }
.hero-aside-label {
  font-size: 9px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.hero-aside-sub-label {
  font-size: 12px;
  font-family: var(--sans);
  color: var(--view-accent);
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.hero-aside-value {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  line-height: 1.05;
  color: var(--parch);
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}
.hero-aside-value > span:first-child { white-space: nowrap; }
.hero-aside-value .unit {
  font-size: 12px;
  color: var(--view-accent);
  font-family: var(--mono);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.04em;
  opacity: 0.85;
}
.hero-aside-foot {
  margin-top: 8px;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.08em;
}
.hero-aside-foot.pos { color: var(--emerald); }
.hero-aside-foot.neg { color: var(--garnet); }

/* ─── Page metric strip (mirrors Codex .numbers-strip) ──────────── */
.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  margin: 0 0 22px;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.metric-strip .metric-cell {
  background: var(--bg-night);
  padding: 16px 18px;
  position: relative;
}
.metric-strip .metric-cell .ms-label {
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--muted);
  text-transform: uppercase;
}
.metric-strip .metric-cell .ms-value {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-top: 4px;
  line-height: 1.05;
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--parch);
  min-width: 0;
}
.metric-strip .metric-cell .ms-value > span:first-child {
  white-space: nowrap;
}
.metric-strip .metric-cell .ms-value .unit {
  font-size: 13px;
  color: var(--view-accent);
  font-family: var(--mono);
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1;
  white-space: nowrap;
  opacity: 0.85;
}
.metric-strip .metric-cell.accent .ms-value { color: var(--view-accent); }
.metric-strip .metric-cell.pos    .ms-value { color: var(--emerald); }
.metric-strip .metric-cell.neg    .ms-value { color: var(--garnet); }
.metric-strip .metric-cell .ms-sub {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.10em;
  margin-top: 6px;
  text-transform: uppercase;
}
.metric-strip .metric-cell.pos .ms-sub { color: var(--emerald); opacity: 0.7; }
.metric-strip .metric-cell.neg .ms-sub { color: var(--garnet);  opacity: 0.8; }

.metric-strip .metric-cell.hero {
  background:
    linear-gradient(135deg, var(--view-accent-soft), transparent 60%),
    var(--bg-night);
}
.metric-strip .metric-cell.hero::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--view-accent);
  opacity: 0.8;
}

/* ─── Framed section (bracketed panel + section head) ───────────── */
.framed-section {
  position: relative;
  margin: 0 0 22px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(20, 28, 48, 0.5), rgba(13, 19, 34, 0.4)),
    var(--bg-card);
  overflow: hidden;
}
.framed-section::before,
.framed-section::after {
  content: '';
  position: absolute;
  width: 12px; height: 12px;
  border: 1px solid var(--view-accent);
  opacity: 0.6;
  pointer-events: none;
}
.framed-section::before { top: -1px; left: -1px;   border-right: none; border-bottom: none; }
.framed-section::after  { bottom: -1px; right: -1px; border-left: none;  border-top: none; }

.framed-section-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(20, 28, 48, 0.5);
}
.framed-section-head .fs-eyebrow {
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--view-accent);
  font-weight: 600;
  flex-shrink: 0;
}
.framed-section-head .fs-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  color: var(--parch);
  letter-spacing: 0.01em;
  white-space: nowrap;
  flex-shrink: 0;
}
.framed-section-head .fs-rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line) 0%, transparent 100%);
}
.framed-section-head .fs-aside {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
  font-family: var(--mono);
}

.framed-section-body { padding: 0; }
.framed-section-body.padded { padding: 18px; }

/* Background sigil — large faint glyph inside framed sections */
.framed-section .bg-sigil {
  position: absolute;
  right: -40px;
  top: -40px;
  width: 240px;
  height: 240px;
  color: var(--view-accent);
  opacity: 0.04;
  pointer-events: none;
  font-family: var(--serif);
  font-size: 240px;
  line-height: 1;
}

/* ─── Grade pill (Illustrious → Ayanad) ─────────────────────────── */
.gp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-family: var(--sans);
  font-weight: 600;
  border: 1px solid currentColor;
  background: transparent;
  white-space: nowrap;
}
.gp.illustrious { color: #c4c4c4; background: rgba(196, 196, 196, 0.06); }
.gp.magnificent { color: #5b9bd5; background: rgba(91, 155, 213, 0.08); }
.gp.epherium    { color: #b07cd1; background: rgba(176, 124, 209, 0.08); }
.gp.delphinad   { color: #d4a960; background: rgba(212, 169, 96, 0.08); }
.gp.ayanad      { color: #e9655c; background: rgba(233, 101, 92, 0.08); }
.gp.basic       { color: #c4c4c4; background: rgba(196, 196, 196, 0.06); }
.gp.grand       { color: #6dd4c5; background: rgba(109, 212, 197, 0.08); }
.gp.rare        { color: #5b9bd5; background: rgba(91, 155, 213, 0.08); }
.gp.arcane      { color: #b07cd1; background: rgba(176, 124, 209, 0.08); }
.gp.heroic      { color: #6fb96a; background: rgba(111, 185, 106, 0.08); }
.gp.unique      { color: #f0d864; background: rgba(240, 216, 100, 0.08); }
.gp.celestial   { color: #f29c44; background: rgba(242, 156, 68, 0.08); }
.gp.divine      { color: #ec4682; background: rgba(236, 70, 130, 0.08); }
.gp.epic        { color: #c149aa; background: rgba(193, 73, 170, 0.08); }
.gp.legendary   { color: #d4a960; background: rgba(212, 169, 96, 0.10); }
.gp.mythic      { color: #e9655c; background: rgba(233, 101, 92, 0.10); }
.gp.lg {
  padding: 5px 14px;
  font-size: 12px;
  letter-spacing: 0.22em;
}

/* ─── Wisp chain flow diagram ──────────────────────────────────── */
.chain-flow-wrap {
  border: 1px solid rgba(91, 155, 213, 0.28);
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(91, 155, 213, 0.04), transparent 60%),
    var(--bg-night);
  padding: 18px;
  margin-bottom: 18px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.chain-flow-wrap::-webkit-scrollbar { height: 6px; }
.chain-flow-wrap::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }

.chain-flow {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-width: max-content;
}
.chain-node {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
  max-width: 200px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--bg-card);
  position: relative;
  flex-shrink: 0;
}
.chain-node.kind-wisp-craft { border-color: rgba(91, 155, 213, 0.4); }
.chain-node.kind-reroll     { border-color: rgba(176, 124, 209, 0.4); background:
    linear-gradient(180deg, rgba(176, 124, 209, 0.06), transparent 70%),
    var(--bg-card); }
.chain-node.kind-upgrade    { border-color: rgba(212, 169, 96, 0.4); }
.chain-node.kind-salvage    { border-color: rgba(111, 185, 106, 0.4); background:
    linear-gradient(180deg, rgba(111, 185, 106, 0.08), transparent 70%),
    var(--bg-card); }

.chain-node-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.chain-node-num {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--muted);
}
.chain-node-glyph {
  width: 28px; height: 28px;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 18px;
  color: var(--sapphire);
  border: 1px solid currentColor;
  border-radius: 4px;
  flex-shrink: 0;
}
.chain-node.kind-reroll  .chain-node-glyph { color: var(--amethyst); }
.chain-node.kind-upgrade .chain-node-glyph { color: var(--gold); }
.chain-node.kind-salvage .chain-node-glyph { color: var(--emerald); }
.chain-node-label {
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
}
.chain-node-title {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--parch);
  line-height: 1.1;
  font-weight: 500;
}
.chain-node-cost {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--view-accent);
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
}
.chain-node-cost.muted { color: var(--muted); }
.chain-node-detail {
  font-size: 10px;
  color: var(--muted);
  font-family: var(--mono);
  margin-top: 2px;
}
.chain-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  color: var(--sapphire);
  opacity: 0.5;
  font-size: 18px;
  flex-shrink: 0;
}
.chain-arrow svg { width: 24px; height: 12px; }

/* ─── Regrade heatmap ──────────────────────────────────────────── */
.heatmap {
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  display: grid;
  background: var(--line);
  gap: 1px;
}
.heatmap-cell {
  background: var(--bg-night);
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 56px;
  position: relative;
  cursor: default;
  transition: transform 0.12s ease, z-index 0s linear 0.12s;
}
.heatmap-cell.head {
  background: rgba(20, 28, 48, 0.8);
  padding: 10px 8px;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.heatmap-cell.row-head {
  align-items: flex-start;
  padding-left: 14px;
  background: rgba(20, 28, 48, 0.6);
  text-align: left;
}
.heatmap-cell.col-head {
  background: rgba(20, 28, 48, 0.7);
  font-family: var(--sans);
}
.heatmap-cell .hm-val {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  color: var(--parch);
}
.heatmap-cell .hm-sub {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.heatmap-cell .hm-pip {
  position: absolute;
  top: 4px; right: 4px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
}
.heatmap-cell.empty .hm-val { color: var(--muted); font-style: italic; font-size: 14px; }
.heatmap-cell.active {
  outline: 2px solid var(--view-accent);
  outline-offset: -2px;
  z-index: 2;
}
.heatmap-cell:hover { transform: scale(1.03); z-index: 1; transition-delay: 0s; }

/* Heatmap legend */
.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.heatmap-legend-bar {
  height: 10px;
  width: 220px;
  background: linear-gradient(90deg, #d56a6a 0%, #e6b370 35%, #f0d864 60%, #6fb96a 100%);
  border-radius: 2px;
  border: 1px solid var(--line);
}

/* ─── Climate sigils ─────────────────────────────────────────── */
.climate-sigil {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
  flex-shrink: 0;
}
.climate-sigil.temperate { color: #6fb96a; background: rgba(111, 185, 106, 0.08); }
.climate-sigil.tropical  { color: #f29c44; background: rgba(242, 156, 68, 0.08); }
.climate-sigil.arid      { color: #e9b85e; background: rgba(233, 184, 94, 0.08); }
.climate-sigil.any       { color: #8b95a8; background: rgba(139, 149, 168, 0.08); }
.climate-sigil.none      { color: #5b9bd5; background: rgba(91, 155, 213, 0.08); }

/* ─── Mode bar v2 (richer toggle group) ─────────────────────────── */
.modebar-v2 {
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.toggle-stack {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
}
.toggle-stack-label {
  font-size: 9px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding-left: 2px;
}
.toggle-group {
  display: inline-flex;
  background: var(--bg-night);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 3px;
  gap: 2px;
}
.toggle-group button {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 8px 18px;
  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, color 0.12s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.toggle-group button:hover { color: var(--parch); }
.toggle-group button.on {
  background: var(--view-accent);
  color: #0d1322;
}
.toggle-group.subtle button.on {
  background: var(--view-accent-soft);
  color: var(--view-accent);
  border: 1px solid var(--view-accent-line);
  padding: 7px 17px;
}
.toggle-group button .gl {
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1;
}

/* ─── Number stepper (used by Seeds inputs, etc.) ──────────────── */
.stepper {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
}
.stepper-label {
  font-size: 9px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.stepper-field {
  display: inline-flex;
  align-items: center;
  background: var(--bg-night);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  height: 36px;
}
.stepper-field:focus-within { border-color: var(--view-accent); }
.stepper-field button {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--view-accent);
  width: 28px;
  height: 100%;
  font-family: var(--mono);
  font-size: 14px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.12s, background 0.12s;
}
.stepper-field button:hover { opacity: 1; background: var(--view-accent-soft); }
.stepper-field input {
  background: transparent;
  border: 0;
  color: var(--parch);
  font-family: var(--mono);
  font-size: 14px;
  text-align: right;
  width: 70px;
  outline: none;
  padding: 0 4px;
  -moz-appearance: textfield;
}
.stepper-field input::-webkit-outer-spin-button,
.stepper-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper-field .unit {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--view-accent);
  opacity: 0.7;
  padding-right: 8px;
  letter-spacing: 0.04em;
}
.stepper-hint {
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.04em;
  font-style: italic;
}

/* ─── Ledger-style data table chrome (used inside framed-section) ── */
.ledger-table {
  display: block;
}
.ledger-row {
  display: grid;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  transition: background 0.12s ease;
  position: relative;
}
.ledger-row:first-child { border-top: 0; }
.ledger-row.head {
  background: rgba(20, 28, 48, 0.6);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  border-top: 0;
}
.ledger-row.body:hover {
  background: var(--view-accent-soft);
}
.ledger-row.body.best {
  background: linear-gradient(90deg, var(--view-accent-soft) 0%, transparent 60%);
}
.ledger-row.body.best::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--view-accent);
}
.ledger-row .num     { text-align: right; font-family: var(--mono); }
.ledger-row .num.lbl { text-align: right; }
.ledger-row .head-name {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  color: var(--parch);
  line-height: 1.15;
}
.ledger-row .head-sub {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.06em;
  margin-top: 2px;
}

/* "Best/Top" little ribbon you can drop next to a row name */
.best-ribbon {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--view-accent-soft);
  color: var(--view-accent);
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 700;
  margin-left: 8px;
}
.best-ribbon::before { content: '◆'; font-size: 8px; }

/* ─── Quick chips row (filters/segmented) ──────────────────────── */
.chip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.chip-row .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-family: var(--sans);
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.12s;
  font-weight: 500;
}
.chip-row .chip:hover { color: var(--parch); border-color: var(--line-strong); }
.chip-row .chip.on {
  background: var(--view-accent-soft);
  color: var(--view-accent);
  border-color: var(--view-accent-line);
  font-weight: 600;
}
.chip-row .chip .chip-count {
  font-family: var(--mono);
  font-size: 10px;
  color: inherit;
  opacity: 0.7;
}

/* ─── Fail mode glyph (used in regrade legend) ─────────────────── */
.fail-mode {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.fail-mode.stay      { color: var(--emerald); border-color: rgba(111, 185, 106, 0.32); background: rgba(111, 185, 106, 0.06); }
.fail-mode.celestial { color: #f29c44;       border-color: rgba(242, 156, 68, 0.32);  background: rgba(242, 156, 68, 0.06); }
.fail-mode.destroy   { color: var(--garnet); border-color: rgba(213, 106, 106, 0.32); background: rgba(213, 106, 106, 0.06); }

/* ─── Inline kbd / value badges ──────────────────────────────── */
.kvb {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-family: var(--mono);
}
.kvb .k { color: var(--muted); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; }
.kvb .v { color: var(--parch); font-size: 13px; }
.kvb .u { color: var(--view-accent); font-size: 10px; }

/* ─── Notes panel (footer notes in panels) ────────────────────── */
.notes-panel {
  position: relative;
  margin-top: 24px;
  padding: 18px 22px 18px 28px;
  background:
    linear-gradient(180deg, rgba(20, 28, 48, 0.55), rgba(13, 19, 34, 0.45)),
    var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.65;
}
.notes-panel::before {
  content: '';
  position: absolute;
  left: 0; top: 12%; bottom: 12%;
  width: 2px;
  background: var(--view-accent);
  opacity: 0.6;
}
.notes-panel .notes-label {
  display: inline-block;
  color: var(--view-accent);
  letter-spacing: 0.22em;
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 6px;
}
.notes-panel strong { color: var(--parch); font-weight: 600; }

/* ─── Cleanups for the elevated pages ─────────────────────────── */
.wisp-view.v2,
.seeds-view.v2,
.prices-view.v2,
.regrade-view.v2 {
  padding: 28px 40px 80px;
}
.wisp-view.v2 .wisp-modebar  { display: none; }   /* v2 replaces this */
.seeds-view.v2 .wisp-modebar { display: none; }
.prices-view.v2 .prices-header { display: none; } /* v2 replaces */
.seeds-view.v2 .prices-header  { display: none; }
.wisp-view.v2  .prices-header  { display: none; }

/* Seeds table v2 — give the seed name cell room to breathe with TOP ribbon */
.seeds-view.v2 .wb-method {
  display: flex !important;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: nowrap;
}
.seeds-view.v2 .wb-method > span:nth-child(2) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 0 1 auto;
}
.seeds-view.v2 .wb-method-sub {
  margin-top: 4px !important;
}

/* Wisp / Seeds breakdown shouldn't sit flush against the next row */
.wisp-view.v2 .wisp-row.open,
.seeds-view.v2 .seeds-row.open {
  border-bottom: 0;
}

/* Wisp table — keep grade pills and item icons aligned cleanly */
.wisp-view.v2 .wisp-row .gp,
.regrade-view .gp {
  vertical-align: middle;
}

/* Make the active view-tab clearly use the accent color (override gold default) */
/* Removed — keep gold tab background to preserve familiarity; the ::after
   pulse already carries the per-tab accent. */

/* ─── Regrade Simulation Setup cards ────────────────────────────── */
.rg-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  padding: 16px 18px;
}
.rg-config-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  background: var(--bg-night);
  border: 1px solid var(--line);
  border-radius: 4px;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.rg-config-card:hover {
  border-color: var(--line-strong);
}
.rg-config-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--line);
}
.rg-config-card-pct {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.rg-opt-row {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 3px;
  background: rgba(20, 28, 48, 0.45);
  border: 1px solid transparent;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--muted);
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  width: 100%;
}
.rg-opt-row:hover:not(.disabled) {
  background: rgba(212, 169, 96, 0.05);
  border-color: var(--line);
  color: var(--parch);
}
.rg-opt-row.disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.rg-opt-row.on {
  background: rgba(176, 124, 209, 0.10);
  border-color: rgba(176, 124, 209, 0.4);
  color: var(--parch);
}
.rg-opt-row.resp.on {
  background: rgba(91, 155, 213, 0.10);
  border-color: rgba(91, 155, 213, 0.4);
}
.rg-opt-check {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 3px;
  border: 1.5px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: transparent;
  background: rgba(20, 28, 48, 0.6);
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.rg-opt-row.on .rg-opt-check {
  background: var(--amethyst);
  border-color: var(--amethyst);
  color: #1a1024;
}
.rg-opt-row.resp.on .rg-opt-check {
  background: var(--sapphire);
  border-color: var(--sapphire);
  color: #061427;
}
.rg-opt-row.disabled .rg-opt-check {
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}
.rg-opt-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}
.rg-opt-name {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: inherit;
}
.rg-opt-mult {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--amethyst);
  font-weight: 600;
  opacity: 0.85;
}
.rg-opt-row.resp .rg-opt-mult { color: var(--sapphire); }
.rg-opt-row.disabled .rg-opt-mult { color: var(--muted); }
.rg-opt-meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Regrade Monte Carlo controls bar ──────────────────────────── */
.rg-mc-controls {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.rg-mc-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-night);
  border: 1px solid var(--line-strong);
  color: var(--parch);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 30px 8px 12px;
  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 10px center;
  height: 36px;
  min-width: 110px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.rg-mc-select:hover { border-color: var(--view-accent); }
.rg-mc-select:focus-visible { box-shadow: 0 0 0 2px var(--view-accent-soft); }

.rg-mc-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 18px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  background: var(--bg-night);
  color: var(--parch);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, transform 0.08s ease;
}
.rg-mc-btn:hover:not(:disabled) {
  background: var(--view-accent-soft);
  border-color: var(--view-accent);
  color: var(--view-accent);
}
.rg-mc-btn:active:not(:disabled) { transform: translateY(1px); }
.rg-mc-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.rg-mc-btn.run {
  background: var(--view-accent);
  color: #1a1306;
  border-color: var(--view-accent);
}
.rg-mc-btn.run:hover:not(:disabled) {
  background: var(--parch);
  border-color: var(--parch);
  color: #1a1306;
}
.rg-mc-btn.opt {
  border-color: var(--amethyst);
  color: var(--amethyst);
}
.rg-mc-btn.opt:hover:not(:disabled) {
  background: rgba(176, 124, 209, 0.12);
  border-color: var(--amethyst);
  color: var(--amethyst);
}
.rg-mc-btn-glyph {
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1;
}
.rg-mc-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
  font-family: var(--mono);
  align-self: center;
}
.rg-mc-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 6px var(--emerald);
  animation: tabPulse 2s ease-in-out infinite;
}

/* ─── Admin view accent (amethyst / purple) ──────────────────────── */
.app[data-view="admin"] {
  --view-accent: var(--amethyst);
  --view-accent-soft: rgba(176, 124, 209, 0.14);
  --view-accent-line: rgba(176, 124, 209, 0.36);
}

/* Separator between main tabs and admin tab */
.view-tab-sep {
  width: 1px;
  height: 20px;
  background: var(--line-strong);
  align-self: center;
  margin: 0 4px;
  opacity: 0.6;
}
.view-tab-admin { opacity: 0.65; }
.view-tab-admin:hover,
.view-tab-admin.active { opacity: 1; }
.view-tab-admin.admin-authed { opacity: 1; color: var(--amethyst); }
.view-tab-admin.admin-authed:hover { color: var(--parch); }

/* ─── Admin panel outer container ─────────────────────────────────── */
.admin-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 28px 40px 80px;
}

/* ─── Admin aside buttons (logout / copy) ─────────────────────────── */
.admin-aside-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

/* ─── Admin table rows ─────────────────────────────────────────────── */
.admin-table-head {
  display: grid;
  grid-template-columns: 1fr 80px 40px;
  gap: 8px 16px;
  padding: 9px 18px;
  font-size: 9px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  background: rgba(20, 28, 48, 0.55);
}
.admin-table-head.admin-table-head-4 {
  grid-template-columns: 120px 1fr 80px 40px;
}
.admin-row {
  display: grid;
  grid-template-columns: 1fr 80px 40px;
  gap: 8px 16px;
  align-items: center;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  transition: background 0.12s ease;
}
.admin-row.admin-row-4 {
  grid-template-columns: 120px 1fr 80px 40px;
}
.admin-row:last-child { border-bottom: none; }
.admin-row:hover { background: rgba(176, 124, 209, 0.04); }
.admin-row.admin-row-xd { opacity: 0.45; }
.admin-row.admin-row-xd .admin-row-name { text-decoration: line-through; }
.admin-row.admin-row-dim { opacity: 0.7; }

.admin-row-profit {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.admin-row-profit.pos { color: var(--emerald); }
.admin-cur {
  font-size: 10px;
  opacity: 0.7;
  letter-spacing: 0.04em;
}
.admin-row-name {
  font-size: 13px;
  color: var(--parch);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-row-id {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* ─── Admin action buttons ────────────────────────────────────────── */
.admin-x-btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--garnet);
  color: var(--garnet);
  border-radius: 4px;
  width: 32px;
  height: 26px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s;
}
.admin-x-btn:hover {
  background: rgba(213, 106, 106, 0.18);
}
.admin-restore-btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--view-accent);
  color: var(--view-accent);
  border-radius: 4px;
  padding: 3px 8px;
  cursor: pointer;
  font-size: 10px;
  letter-spacing: 0.08em;
  white-space: nowrap;
  font-family: var(--sans);
  transition: background 0.12s;
}
.admin-restore-btn:hover { background: var(--view-accent-soft); }

/* ─── Admin export note ───────────────────────────────────────────── */
.admin-export-note {
  margin-top: 22px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.65;
  letter-spacing: 0.04em;
}
.admin-export-note em  { color: var(--parch); font-style: normal; font-weight: 500; }
.admin-export-note strong { color: var(--view-accent); font-weight: 600; font-style: normal; }
.admin-export-note code {
  font-family: var(--mono);
  color: var(--view-accent);
  font-size: 10px;
  background: var(--view-accent-soft);
  padding: 1px 5px;
  border-radius: 3px;
}

/* ─── Admin login modal ───────────────────────────────────────────── */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.admin-modal-box {
  background: var(--bg-card);
  border: 1px solid var(--view-accent-line);
  border-radius: 6px;
  padding: 32px 36px;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}
.admin-modal-box::before,
.admin-modal-box::after {
  content: '';
  position: absolute;
  width: 10px; height: 10px;
  border: 1px solid var(--amethyst);
}
.admin-modal-box::before { top: -2px; left: -2px;   border-right: none; border-bottom: none; }
.admin-modal-box::after  { bottom: -2px; right: -2px; border-left: none;  border-top: none; }
.admin-modal-title {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  color: var(--parch);
  letter-spacing: 0.01em;
}
.admin-modal-sub {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-top: -8px;
}
.admin-modal-input {
  background: var(--bg-night);
  border: 1px solid var(--line-strong);
  color: var(--parch);
  padding: 10px 14px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 14px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}
.admin-modal-input:focus { border-color: var(--amethyst); }
.admin-modal-err {
  font-size: 11px;
  color: var(--garnet);
  letter-spacing: 0.06em;
  margin-top: -6px;
}
.admin-modal-actions {
  display: flex;
  gap: 8px;
}
