:root {
  --bg: #18171a;
  --surface: rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.09);
  --text: #ffffff;
  --muted: #8a8790;
  --green: #3fb950;
  --red: #c0392b;
  --blue: #54acd2;
  --yellow: #e3b341;
  --accent: #2969b0;
  --radius: 16px;
  --radius-sm: 10px;
  --font-display: 'Bricolage Grotesque', 'Hanken Grotesk', system-ui, sans-serif;
  --font-body: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px rgba(84,172,210,0.7);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --glass: linear-gradient(145deg, rgba(255,255,255,0.09) 0%, rgba(255,255,255,0.03) 60%, rgba(255,255,255,0.01) 100%);
  --glass-border: rgba(255,255,255,0.1);
  --glass-shadow: 0 1px 0 rgba(255,255,255,0.1) inset, 0 -1px 0 rgba(0,0,0,0.15) inset, 0 8px 32px rgba(0,0,0,0.4);
}

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

html { scroll-behavior: smooth; }

body {
  background:
    radial-gradient(ellipse at 15% 10%, rgba(41,105,176,0.18) 0%, transparent 45%),
    radial-gradient(ellipse at 85% 85%, rgba(84,172,210,0.10) 0%, transparent 45%),
    radial-gradient(ellipse at 60% 40%, rgba(63,185,80,0.05) 0%, transparent 40%),
    #18171a;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Header ── */
header {
  background: rgba(24,23,26,0.65);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(255,255,255,0.05) inset, 0 4px 24px rgba(0,0,0,0.4);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.logo {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.5px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}
.sync-status {
  font-size: 12px;
  color: var(--muted);
}

/* ── Nav tabs ── */
.nav-tabs {
  display: flex;
  gap: 2px;
}
.nav-tab {
  padding: 6px 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s var(--ease-out);
  white-space: nowrap;
}
.nav-tab:hover { color: var(--text); background: rgba(255,255,255,0.07); }
.nav-tab:active { transform: translateY(1px); }
.nav-tab:focus-visible { outline: none; box-shadow: var(--focus-ring); color: var(--text); }
.nav-tab.active {
  background: linear-gradient(145deg, rgba(255,255,255,0.16), rgba(255,255,255,0.07));
  color: var(--text);
  border-color: rgba(255,255,255,0.15);
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 2px 8px rgba(0,0,0,0.25);
}

/* ── Main ── */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Pages ── */
.page { display: none; flex-direction: column; gap: 20px; }
.page.active { display: flex; }

/* Page-enter cascade: top-level blocks fade + rise in sequence when a tab
   becomes active. Plays only on page switch (occasional), never on re-render. */
.page.active > * {
  animation: enterUp 320ms var(--ease-out) both;
}
.page.active > *:nth-child(1) { animation-delay: 0ms; }
.page.active > *:nth-child(2) { animation-delay: 45ms; }
.page.active > *:nth-child(3) { animation-delay: 90ms; }
.page.active > *:nth-child(4) { animation-delay: 135ms; }
.page.active > *:nth-child(n+5) { animation-delay: 170ms; }
@keyframes enterUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ── Buttons ── */
.btn {
  font-family: var(--font-body);
  padding: 7px 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: opacity 0.15s, transform 0.14s var(--ease-out), box-shadow 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn-primary {
  background: rgba(41,105,176,0.75);
  color: #fff;
  border-color: rgba(84,172,210,0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 4px 16px rgba(41,105,176,0.35);
}
.btn-secondary {
  background: rgba(255,255,255,0.07);
  color: var(--text);
  border-color: rgba(255,255,255,0.12);
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 rgba(255,255,255,0.1) inset;
}
.btn-secondary:hover { background: rgba(255,255,255,0.12); opacity: 1; }

/* Sync button: spin the icon while a price refresh is in flight. Linear +
   fast (0.7s) so loading reads as quick (perceived-performance). */
#sync-btn { display: inline-flex; align-items: center; gap: 6px; }
.sync-icon { display: inline-block; line-height: 1; }
.btn.syncing { opacity: 0.85; }
.btn.syncing .sync-icon { animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Stats row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.stat-card {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(190%);
  -webkit-backdrop-filter: blur(20px) saturate(190%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--glass-shadow);
  transition: transform 200ms var(--ease-out), border-color 200ms ease, box-shadow 200ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255,255,255,0.18);
    box-shadow: 0 1px 0 rgba(255,255,255,0.1) inset, 0 -1px 0 rgba(0,0,0,0.15) inset, 0 12px 36px rgba(0,0,0,0.5);
  }
}
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin-bottom: 6px; }
.stat-value { font-family: var(--font-mono); font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.4px; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Card ── */
.card {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(190%);
  -webkit-backdrop-filter: blur(20px) saturate(190%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--glass-shadow);
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: rgba(255,255,255,0.02);
}
.card-header h2 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

/* ── Category filter tabs (inside price card) ── */
/* Same sliding-thumb language as the sushi toggle: a single pill glides
   between the 4 equal segments. Pure CSS via :has() — translateX in 25%
   steps — so it works even while the page is hidden (no measurement). */
.tabs {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  width: fit-content;
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  padding: 3px;
}
.tabs::before {
  content: '';
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(25% - 1.5px);
  border-radius: 6px;
  background: linear-gradient(145deg, rgba(255,255,255,0.16), rgba(255,255,255,0.06));
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 1px 0 rgba(255,255,255,0.16) inset, 0 2px 8px rgba(0,0,0,0.3);
  transition: transform 280ms var(--ease-out);
  pointer-events: none;
  z-index: 0;
}
.tabs:has(> .tab:nth-child(2).active)::before { transform: translateX(100%); }
.tabs:has(> .tab:nth-child(3).active)::before { transform: translateX(200%); }
.tabs:has(> .tab:nth-child(4).active)::before { transform: translateX(300%); }
.tab {
  position: relative;
  z-index: 1;
  padding: 5px 14px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  text-align: center;
  white-space: nowrap;
  transition: color 0.28s var(--ease-out), transform 0.12s var(--ease-out);
}
.tab:hover:not(.active) { color: rgba(255,255,255,0.75); }
.tab:active { transform: scale(0.97); }
.tab:focus-visible { outline: none; box-shadow: var(--focus-ring); color: var(--text); border-radius: 6px; }
.tab.active { color: #fff; }

/* ── Table controls ── */
.table-controls {
  display: flex;
  gap: 8px;
}
.table-controls input,
.table-controls select {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 5px 10px;
  font-size: 13px;
  backdrop-filter: blur(10px);
}
.table-controls input:focus,
.table-controls select:focus {
  outline: none;
  border-color: rgba(84,172,210,0.6);
  box-shadow: 0 0 0 3px rgba(84,172,210,0.12);
}

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
}
thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.35);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.05);
  transition: background 0.1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.04); }
tbody td {
  padding: 10px 14px;
  white-space: nowrap;
}

.rank { color: var(--muted); font-size: 12px; width: 32px; }
.rank-1 { color: var(--yellow); font-weight: 700; }
.rank-2 { color: #9e9e9e; font-weight: 700; }
.rank-3 { color: #cd7f32; font-weight: 700; }

.compound-name { font-weight: 600; }
.compound-emoji { margin-right: 6px; }
.badge-cat {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: 500;
}
.badge-base { background: rgba(63,185,80,0.15); color: var(--green); }
.badge-proc { background: rgba(227,179,65,0.15); color: var(--yellow); }
.badge-combo { background: rgba(88,166,255,0.15); color: var(--blue); }

.ingredients { color: var(--muted); font-size: 12px; }
.ing-unknown { color: var(--yellow); }
.ing-raw { color: var(--green); }
.ing-proc { color: var(--yellow); }

.price { font-weight: 600; font-variant-numeric: tabular-nums; }
.prev-price { color: var(--muted); font-variant-numeric: tabular-nums; }
.change-pos { color: var(--green); font-variant-numeric: tabular-nums; }
.change-neg { color: var(--red); font-variant-numeric: tabular-nums; }
.change-neu { color: var(--muted); }
.dph { color: var(--yellow); font-variant-numeric: tabular-nums; }
.dph-na { color: var(--border); }
.out-qty { color: var(--blue); font-weight: 600; }
.mc-name { display: block; font-size: 11px; color: var(--muted); font-weight: 400; margin-top: 1px; }

.loading { text-align: center; padding: 40px; color: var(--muted); }

/* ── Skeleton loaders ── shimmer placeholders that match the shape of the
   content they stand in for, so the loading moment reads as intentional. */
.skel-line, .skel-block {
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 37%, rgba(255,255,255,0.04) 63%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;   /* constant motion → linear */
  border-radius: 6px;
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}
.skel-cell { padding: 6px 18px 10px !important; }
.skel-line { display: block; height: 15px; margin: 11px 0; }
.skel-cell .skel-line:nth-child(5n+1) { width: 58%; }
.skel-cell .skel-line:nth-child(5n+2) { width: 86%; }
.skel-cell .skel-line:nth-child(5n+3) { width: 71%; }
.skel-cell .skel-line:nth-child(5n+4) { width: 92%; }
.skel-cell .skel-line:nth-child(5n+5) { width: 64%; }
.skel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; padding: 4px; }
.skel-block { height: 96px; border-radius: var(--radius-sm); }
.footnote { padding: 8px 16px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); }

/* ── Home mini tables ── */
.home-tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Planner (home page) ── */
.planner-controls {
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.planner-controls label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}
.planner-controls input {
  width: 70px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  color: var(--text);
  padding: 5px 8px;
  font-size: 13px;
}
.planner-stats {
  padding: 0 16px 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  border: 1px solid var(--border);
}
.badge-crop { color: var(--green); }
.badge-water { color: var(--blue); }
.badge-empty { color: var(--muted); }
.badge-eff { color: var(--yellow); }

.canvas-wrap {
  padding: 16px;
  overflow: auto;
}
canvas { display: block; }

.legend {
  display: flex;
  gap: 16px;
  padding: 10px 16px 14px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
}
.swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}
.swatch-crop { background: #3fb950; }
.swatch-water { background: #388bfd; }
.swatch-empty { background: #30363d; }

/* ── Calculator page ── */
.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.calc-panel {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.calc-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.calc-label select,
.calc-label input[type="range"] {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  color: var(--text);
  padding: 6px 10px;
  font-size: 13px;
  width: 100%;
}
.calc-label select:focus { outline: none; border-color: rgba(84,172,210,0.6); box-shadow: 0 0 0 3px rgba(84,172,210,0.12); }

.purity-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.purity-row input[type="range"] {
  flex: 1;
  padding: 0;
  accent-color: var(--blue);
}
#calc-purity-val {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  min-width: 38px;
  text-align: right;
}

.toggle-row { display: flex; gap: 8px; }
.toggle-btn {
  padding: 6px 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s var(--ease-out);
  backdrop-filter: blur(10px);
}
.toggle-btn:hover { background: rgba(255,255,255,0.1); color: var(--text); }
.toggle-btn.active {
  background: linear-gradient(145deg, rgba(84,172,210,0.5), rgba(41,105,176,0.4));
  color: #fff;
  border-color: rgba(84,172,210,0.4);
  box-shadow: 0 1px 0 rgba(255,255,255,0.2) inset, 0 2px 8px rgba(41,105,176,0.3);
}

.calc-results {
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  backdrop-filter: blur(10px);
}
.calc-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.calc-res-label { color: var(--muted); }
.calc-res-val { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.calc-divider { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

.calc-hint { font-size: 12px; color: var(--muted); }

.batch-inputs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
}
.batch-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.batch-input-row label {
  flex: 1;
  font-size: 13px;
  color: var(--text);
}
.batch-input-row input {
  width: 80px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  color: var(--text);
  padding: 5px 8px;
  font-size: 13px;
  text-align: right;
}
.batch-calc-btn { align-self: flex-start; }

.batch-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.batch-result-item {
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  backdrop-filter: blur(10px);
}
.batch-result-name { font-weight: 600; }
.batch-result-val { color: var(--green); font-weight: 600; }
.batch-result-detail { color: var(--muted); font-size: 12px; }

/* ── Graphs page ── */
.inline-icon {
  width: 16px;
  height: 16px;
  image-rendering: pixelated;
  vertical-align: -3px;
  flex-shrink: 0;
}

/* KPI stat values can hold an icon + name on one line */
#graph-kpis .stat-value {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spark-sort {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  color: var(--text);
  padding: 5px 10px;
  font-size: 13px;
  backdrop-filter: blur(10px);
}

/* ── Searchable compound combobox (replaces native <select>) ── */
/* The card that hosts a combobox must not clip its dropdown. */
.card-overflow { overflow: visible; }
/* Lift a combobox's container above later glass cards while its list is open —
   sibling cards use backdrop-filter (own stacking context) and would otherwise
   paint over the absolutely-positioned dropdown despite card-overflow. */
.card-overflow:has(.cbx-open),
.dash-add-bar:has(.cbx-open) { position: relative; z-index: 40; }
.cbx { position: relative; display: inline-block; min-width: 220px; }
.dash-add-bar .cbx { flex: 1; min-width: 0; }
.cbx-field {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  backdrop-filter: blur(10px);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.cbx.cbx-open .cbx-field,
.cbx-field:focus-within {
  border-color: rgba(84,172,210,0.6);
  box-shadow: 0 0 0 3px rgba(84,172,210,0.12);
}
.cbx-field-icon { width: 18px; height: 18px; image-rendering: pixelated; flex-shrink: 0; }
.cbx-input {
  flex: 1; min-width: 0;
  background: none; border: none; outline: none;
  color: var(--text); font-family: var(--font-body); font-size: 13px;
}
.cbx-input::placeholder { color: var(--muted); }
.cbx-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  z-index: 60; margin: 0; padding: 5px; list-style: none;
  max-height: 320px; overflow-y: auto;
  background: rgba(28,27,30,0.86);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--glass-shadow);
  transform-origin: top center;
  animation: cbxPop 160ms var(--ease-out);
}
@keyframes cbxPop {
  from { opacity: 0; transform: translateY(-4px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}
.cbx-group {
  padding: 8px 10px 4px; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted);
}
.cbx-opt {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: 8px; cursor: pointer;
  transition: background 0.12s ease;
}
.cbx-opt-icon { width: 20px; height: 20px; image-rendering: pixelated; flex-shrink: 0; text-align: center; }
.cbx-opt-emoji { font-size: 15px; line-height: 20px; }
.cbx-opt-name { flex: 1; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cbx-opt-price { font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }
.cbx-opt-delta { font-family: var(--font-mono); font-size: 11px; font-variant-numeric: tabular-nums; min-width: 42px; text-align: right; }
.cbx-opt-delta.up { color: var(--green); }
.cbx-opt-delta.down { color: var(--red); }
.cbx-opt.cbx-active { background: linear-gradient(90deg, rgba(41,105,176,0.30), rgba(41,105,176,0.14)); }
.cbx-empty { padding: 14px 12px; text-align: center; color: var(--muted); font-size: 13px; }
@media (hover: hover) and (pointer: fine) {
  .cbx-opt:hover { background: rgba(255,255,255,0.07); }
  .cbx-opt.cbx-active:hover { background: linear-gradient(90deg, rgba(41,105,176,0.34), rgba(41,105,176,0.16)); }
}

/* Live readout strip above the main chart */
.chart-readout {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 12px 16px 0;
}
.readout-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.readout-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
.readout-val {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
}

.main-chart-wrap {
  padding: 16px;
  height: 300px;
  position: relative;
}
.main-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ── Movers (gainers / losers) ── */
.movers-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.mover-card { padding-bottom: 8px; }
.mover-title { font-size: 15px; font-weight: 700; }
.mover-title.up { color: var(--green); }
.mover-title.down { color: var(--red); }
.mover-list {
  display: flex;
  flex-direction: column;
  padding: 4px 8px 8px;
}
.mover-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  cursor: pointer;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  transition: background 0.15s;
}
.mover-item:hover { background: rgba(255,255,255,0.06); }
.mover-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mover-price { color: var(--muted); font-variant-numeric: tabular-nums; }
.mover-change { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 56px; text-align: right; }
.mover-empty { padding: 16px 10px; color: var(--muted); font-size: 13px; }

/* ── All compounds toolbar ── */
.grid-toolbar { display: flex; gap: 8px; align-items: center; }
.spark-search {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  color: var(--text);
  padding: 5px 12px;
  font-size: 13px;
  width: 140px;
  backdrop-filter: blur(10px);
}
.spark-search::placeholder { color: var(--muted); }
.all-compounds-card .sparkline-grid { padding: 4px 16px 16px; }

.sparkline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.sparkline-card {
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(190%);
  -webkit-backdrop-filter: blur(16px) saturate(190%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  box-shadow: var(--glass-shadow);
  will-change: transform;
}
.sparkline-card:hover {
  border-color: rgba(84,172,210,0.4);
  box-shadow: 0 1px 0 rgba(255,255,255,0.12) inset, 0 8px 32px rgba(84,172,210,0.12), 0 2px 8px rgba(0,0,0,0.3);
  transform: translateY(-1px);
}
.sparkline-name {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 5px;
}
.spark-icon {
  width: 16px;
  height: 16px;
  image-rendering: pixelated;
  flex-shrink: 0;
}
.sparkline-price {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}
.sparkline-canvas-wrap {
  height: 50px;
  position: relative;
}
.sparkline-canvas-wrap canvas {
  width: 100% !important;
  height: 100% !important;
  pointer-events: none;
}
.sparkline-range {
  margin-top: 6px;
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Graphs page responsive */
@media (max-width: 720px) {
  .movers-row { grid-template-columns: 1fr; }
  .chart-readout { grid-template-columns: repeat(2, 1fr); }
}

/* ── Prestige page ── */
.prestige-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.prestige-header h2 { font-family: var(--font-display); font-size: 24px; font-weight: 700; letter-spacing: -0.6px; }
.prestige-intro { font-size: 13px; color: var(--muted); }

.prestige-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.prestige-card {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(190%);
  -webkit-backdrop-filter: blur(20px) saturate(190%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--glass-shadow);
  transition: box-shadow 0.2s, transform 0.2s;
  will-change: transform;
}
.prestige-card:hover {
  box-shadow: 0 1px 0 rgba(255,255,255,0.13) inset, 0 12px 40px rgba(0,0,0,0.45);
  transform: translateY(-1px);
}
.prestige-card.clickable { cursor: pointer; }
.prestige-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.prestige-emoji { font-size: 22px; }
.prestige-title { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.prestige-name { font-weight: 700; font-size: 15px; }
.prestige-mcname { font-size: 11px; color: var(--muted); }
.prestige-req { font-size: 12px; color: var(--muted); }
.prestige-req span { color: var(--yellow); font-weight: 600; }

.prestige-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.prestige-input-row label { font-size: 12px; color: var(--muted); flex: 1; }
.prestige-input-row input {
  width: 100px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  color: var(--text);
  padding: 5px 8px;
  font-size: 13px;
  text-align: right;
}
.prestige-input-row input:focus { outline: none; border-color: rgba(84,172,210,0.6); box-shadow: 0 0 0 3px rgba(84,172,210,0.12); }

.progress-bar-wrap {
  background: rgba(0,0,0,0.35);
  border-radius: 100px;
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.07);
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #4f9fe0);
  border-radius: 100px;
  transition: width 0.3s ease;
}
/* Done = solid green (universal "complete"); in-progress stays blue. */
.progress-bar-fill.complete { background: linear-gradient(90deg, #2ea043, var(--green)); }

/* ── Progress tracker page ── */
.prog-emoji { font-size: 18px; }

.prog-upload-card { display: flex; flex-direction: column; gap: 12px; }
.prog-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 28px 16px;
  border: 1.5px dashed rgba(255,255,255,0.18);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
}
.prog-drop:hover, .prog-drop.dragging {
  border-color: rgba(84,172,210,0.6);
  background: rgba(84,172,210,0.08);
}
.prog-drop-icon { font-size: 26px; }
.prog-drop-title { font-weight: 600; font-size: 14px; }
.prog-drop-sub { font-size: 12px; color: var(--muted); }
.prog-or { text-align: center; font-size: 12px; color: var(--muted); }
.prog-paste {
  width: 100%;
  min-height: 90px;
  resize: vertical;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}
.prog-paste:focus { outline: none; border-color: rgba(84,172,210,0.5); }
.prog-upload-actions { display: flex; align-items: center; gap: 12px; }
.prog-upload-status { font-size: 13px; color: var(--muted); }
.prog-upload-status.ok { color: var(--green); }
.prog-upload-status.err { color: var(--red); }

#prog-kpis .stat-value img.inline-icon { width: 18px; height: 18px; flex-shrink: 0; }
#prog-kpis .stat-value {
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.prog-cat { margin-top: 22px; }
.prog-cat-title {
  font-size: 15px; font-weight: 700; margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.prog-cat-count {
  font-size: 12px; font-weight: 600; color: var(--muted);
  background: rgba(255,255,255,0.08); border-radius: 100px; padding: 1px 9px;
}
.prog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.prog-card {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(190%);
  -webkit-backdrop-filter: blur(20px) saturate(190%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--glass-shadow);
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s;
}
.prog-card:hover {
  box-shadow: 0 1px 0 rgba(255,255,255,0.13) inset, 0 12px 40px rgba(0,0,0,0.45);
  transform: translateY(-1px);
}
.prog-card-head { display: flex; align-items: center; gap: 10px; }
.prog-card-icon { width: 28px; height: 28px; image-rendering: pixelated; flex-shrink: 0; }
.prog-card-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.prog-card-name { font-weight: 700; font-size: 14px; }
.prog-card-goal {
  font-size: 11px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.prog-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 3px 8px; border-radius: 100px; flex-shrink: 0;
}
.prog-badge.done   { background: rgba(63,185,80,0.16);   color: var(--green); }
.prog-badge.active { background: rgba(41,105,176,0.20);  color: #6ea8e0; }
.prog-badge.idle   { background: rgba(255,255,255,0.08); color: var(--muted); }
.prog-card-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px;
}
.prog-stat { display: flex; flex-direction: column; gap: 2px; }
.prog-stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.prog-stat-val { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

.prog-snaps { display: flex; flex-direction: column; padding: 4px 8px 8px; }
.prog-snap-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: var(--radius-sm);
}
.prog-snap-row:hover { background: rgba(255,255,255,0.05); }
.prog-snap-when { font-size: 13px; font-variant-numeric: tabular-nums; }
.prog-snap-latest {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--green); background: rgba(63,185,80,0.16);
  border-radius: 100px; padding: 1px 7px; margin-left: 6px;
}
.prog-snap-del {
  background: transparent; border: none; color: var(--muted);
  cursor: pointer; font-size: 13px; padding: 4px 8px; border-radius: 6px;
}
.prog-snap-del:hover { color: var(--red); background: rgba(192,57,43,0.12); }

/* ── Prestige live-data banner ── */
.prestige-live-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius);
  font-size: 13px; margin-bottom: 16px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
}
.prestige-live-banner.on  { border-color: rgba(63,185,80,0.35);  background: rgba(63,185,80,0.08); }
.prestige-live-banner.off { border-color: rgba(255,255,255,0.12); }
.prestige-live-banner.empty { color: var(--muted); }
.prestige-live-banner .plb-text { flex: 1; }
.prestige-live-banner a { color: var(--accent); font-weight: 600; }
.plb-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  background: var(--green); box-shadow: 0 0 0 3px rgba(63,185,80,0.20);
}
.prestige-live-banner.off .plb-dot {
  background: var(--muted); box-shadow: 0 0 0 3px rgba(255,255,255,0.08);
}
.plb-icon { font-size: 15px; flex-shrink: 0; }
.plb-toggle {
  flex-shrink: 0;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  color: var(--text);
  border-radius: 100px; padding: 5px 12px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background 0.15s;
}
.plb-toggle:hover { background: rgba(255,255,255,0.16); }

.prestige-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}
.prestige-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.prestige-stat .label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
}
.prestige-stat .val {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prestige-pct {
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  color: var(--green);
}
.prestige-pct.complete { color: var(--green); }
/* A completed card drops Rate/ETA for a single full-width completion date. */
.prestige-stat.wide { grid-column: 1 / -1; }

@media (max-width: 900px) {
  .calc-grid { grid-template-columns: 1fr; }
  .home-tables { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .card-header { flex-direction: column; align-items: flex-start; }
  .table-controls { flex-direction: column; }
  .nav-tabs { gap: 0; }
  .nav-tab { padding: 6px 10px; font-size: 12px; }
  .header-inner { flex-wrap: wrap; }
}

/* ── Icons ─────────────────────────────────────────────────────────────── */
.table-icon {
  width: 20px;
  height: 20px;
  image-rendering: pixelated;
  vertical-align: middle;
  margin-right: 6px;
  border-radius: 2px;
}
.prestige-icon {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
  border-radius: 4px;
  flex-shrink: 0;
}

/* ── Purity axes ────────────────────────────────────────────────────────── */
.calc-label-text { display: block; margin-bottom: 8px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.purity-code { font-family: monospace; color: var(--blue); font-weight: 700; margin-left: 8px; font-size: 14px; }
.purity-axes { display: flex; gap: 8px; }
.purity-axis { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.axis-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.purity-axis select {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  color: var(--text);
  padding: 5px 6px;
  font-size: 12px;
  width: 100%;
}
.purity-axis select:disabled { opacity: 0.4; }
.purity-hint { margin-top: 6px; font-size: 11px; color: var(--muted); font-style: italic; margin-bottom: 0; }

/* ── Prestige tracker ───────────────────────────────────────────────────── */
.prestige-tracker { padding: 0 16px 16px; }

.tracker-section { margin-bottom: 24px; }
.tracker-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.35);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.tracker-table { width: 100%; border-collapse: collapse; }
.tracker-table thead th {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.35);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  text-align: left;
}
.tracker-table tbody tr { border-bottom: 1px solid rgba(255,255,255,0.05); }
.tracker-table tbody tr:last-child { border-bottom: none; }
.tracker-table tbody tr:hover { background: rgba(255,255,255,0.04); }
.tracker-table td { padding: 8px 12px; vertical-align: middle; }

.tracker-compound { white-space: nowrap; }
.tracker-crops { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.tracker-crop-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  cursor: default;
  transition: border-color 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
  box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset;
}
.tracker-crop-badge:hover { border-color: rgba(84,172,210,0.5); box-shadow: 0 0 0 3px rgba(84,172,210,0.1); }

.tracker-crop-icon {
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
}
.tracker-crop-badge-emoji {
  font-size: 22px;
  line-height: 1;
}

.tracker-qty {
  position: absolute;
  bottom: 3px;
  right: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.9), -1px 1px 0 rgba(0,0,0,0.9),
               1px -1px 0 rgba(0,0,0,0.9), -1px -1px 0 rgba(0,0,0,0.9);
}

.tracker-input-cell { width: 110px; }
.tracker-input {
  width: 100px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  color: var(--text);
  padding: 6px 8px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.tracker-input:focus { outline: none; border-color: rgba(84,172,210,0.6); box-shadow: 0 0 0 3px rgba(84,172,210,0.12); }

/* ── Prestige card compound table ──────────────────────────────────────── */
.pc-table-wrap {
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-top: 8px;
  overflow-x: auto;
}
.pc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.pc-table thead th {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: 10px;
  font-weight: 600;
  padding: 0 4px 5px;
  text-align: left;
  white-space: nowrap;
}
.pc-table thead th:not(:first-child) { text-align: right; }
.pc-table tbody tr { border-top: 1px solid rgba(255,255,255,0.06); }
.pc-table tbody tr:first-child { border-top: none; }
.pc-table td { padding: 4px 4px; vertical-align: middle; }

.pc-name {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  font-weight: 500;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pc-per  { text-align: right; color: var(--green);  font-variant-numeric: tabular-nums; white-space: nowrap; }
.pc-sells { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pc-dc   { text-align: right; color: var(--muted);  font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Widen grid a bit to fit the 4-column compound table */
.prestige-grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

/* ── Revenue dashboard calculator ───────────────────────────────────────── */

.dash-booster-card { padding: 0; }
.dash-booster-row {
  display: flex; gap: 0; flex-wrap: wrap;
  border-radius: var(--radius); overflow: hidden;
}
.dash-booster-btn {
  flex: 1; min-width: 220px;
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px;
  background: none; border: none; cursor: pointer;
  color: var(--text); text-align: left; font-family: inherit;
  border-right: 1px solid rgba(255,255,255,0.07);
  transition: background 0.2s;
}
.dash-booster-btn:last-of-type { border-right: none; }
.dash-booster-btn:hover { background: rgba(255,255,255,0.04); }
.dash-booster-btn.active { background: rgba(41,105,176,0.15); }
.dash-booster-btn.active .dash-booster-icon { filter: none; }
.dash-booster-icon { font-size: 24px; filter: grayscale(1) opacity(0.4); transition: filter 0.2s; }
.dash-booster-btn.active .dash-booster-icon { filter: none; }
.dash-booster-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.dash-booster-name { font-weight: 700; font-size: 14px; }
.dash-booster-desc { font-size: 11px; color: var(--muted); }
.dash-booster-pill {
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700;
  background: rgba(255,255,255,0.08); color: var(--muted);
  transition: background 0.2s, color 0.2s;
}
.dash-booster-btn.active .dash-booster-pill { background: rgba(63,185,80,0.2); color: var(--green); }
.dash-mult-display {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 16px 24px; gap: 4px; min-width: 110px;
}
.dash-mult-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.dash-mult-val { font-family: var(--font-mono); font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -1px; color: var(--yellow); line-height: 1; }

.dash-add-bar { display: flex; gap: 10px; align-items: center; }
.dash-select {
  flex: 1; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius); color: var(--text); padding: 8px 12px;
  font-size: 13px; font-family: inherit;
}
.dash-select:focus { outline: none; border-color: rgba(84,172,210,0.6); }

#dash-items { display: flex; flex-direction: column; gap: 12px; }

.dash-item-card { padding: 0; overflow: hidden; }

.dash-item-top {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
}
.dash-item-left  { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.dash-item-icon  { width: 36px; height: 36px; image-rendering: pixelated; flex-shrink: 0; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }
.dash-item-info  { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dash-item-name  { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.dash-item-mid {
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap; flex-shrink: 0;
}
.dash-base-price { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dash-arrow      { color: rgba(255,255,255,0.2); }
.dash-eff-price  { font-size: 14px; font-weight: 700; color: var(--yellow); font-variant-numeric: tabular-nums; }

.dash-dc-wrap  { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.dash-dc-unit  { font-size: 12px; color: var(--muted); }

.dash-remove-btn {
  width: 28px; height: 28px; flex-shrink: 0;
  background: none; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 50%; color: var(--muted); cursor: pointer;
  font-size: 16px; line-height: 1; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.dash-remove-btn:hover { background: rgba(184,58,47,0.2); color: var(--red); border-color: rgba(184,58,47,0.4); }

/* Per-chemical purity (Value/Progress/Score, level 0–3) */
.dash-purity-wrap {
  display: flex; align-items: center; gap: 5px; flex-shrink: 0;
}
.dash-purity-code {
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--blue); letter-spacing: 0.5px; min-width: 34px; text-align: center;
}
/* Per-row purity pickers reuse the .ui-select base — just keep them compact. */
.dash-purity-select { padding: 5px 7px; min-width: 44px; }
.dash-purity-na {
  font-size: 11px; color: var(--muted); font-style: italic;
  white-space: nowrap; padding: 0 4px;
}

.dash-demand-row {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 20px;
  border-top: 1px solid rgba(255,255,255,0.07);
  background: rgba(0,0,0,0.1);
}
.dash-demand-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: rgba(255,255,255,0.35);
  white-space: nowrap;
}
.dash-demand-field { display: flex; align-items: center; gap: 7px; }
.dash-demand-name  { font-size: 12px; color: var(--muted); }
.dash-demand-input {
  width: 68px; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12); border-radius: 8px;
  color: var(--text); padding: 5px 8px; font-size: 13px; font-weight: 700;
  font-variant-numeric: tabular-nums; font-family: inherit;
  text-align: center; transition: border-color 0.15s, box-shadow 0.15s;
}
.dash-demand-input:focus {
  outline: none; border-color: rgba(84,172,210,0.6);
  box-shadow: 0 0 0 3px rgba(84,172,210,0.12);
}
.dash-demand-x    { font-size: 12px; color: rgba(255,255,255,0.3); }
.dash-demand-hint { font-size: 11px; color: rgba(255,255,255,0.25); margin-left: 4px; }
/* Dealer picker reuses the .ui-select base — just give it a bit more room. */
.dash-dealer-select { font-size: 13px; min-width: 168px; }

/* ── Custom select (.ui-select) + portaled menu (.ui-menu) — see dropdown.js ── */
.ui-select {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 6px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px; color: var(--text); cursor: pointer;
  padding: 5px 8px; font-family: inherit; font-size: 12px; font-weight: 600;
  line-height: 1; white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.ui-select:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.18); }
.ui-select:active { transform: scale(0.97); }
.ui-select:focus-visible {
  outline: none; border-color: rgba(84,172,210,0.6);
  box-shadow: 0 0 0 3px rgba(84,172,210,0.12);
}
.ui-select[aria-expanded="true"] {
  border-color: rgba(84,172,210,0.6); background: rgba(84,172,210,0.12);
}
.ui-select-text { overflow: hidden; text-overflow: ellipsis; }
.ui-select-caret {
  width: 10px; height: 6px; flex-shrink: 0; opacity: 0.55;
  transition: transform 0.18s cubic-bezier(0.23,1,0.32,1);
}
.ui-select[aria-expanded="true"] .ui-select-caret { transform: rotate(180deg); }

.ui-menu {
  position: fixed; z-index: 1200; min-width: 80px; padding: 4px;
  background: rgba(26,26,30,0.98); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px; box-shadow: 0 14px 36px rgba(0,0,0,0.5);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  opacity: 0; visibility: hidden; transform: scale(0.96); transform-origin: top left;
  /* exit: quick */
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0s linear 0.12s;
}
.ui-menu[data-open="true"] {
  opacity: 1; visibility: visible; transform: scale(1);
  /* enter: a touch slower with a strong ease-out curve */
  transition: opacity 0.18s cubic-bezier(0.23,1,0.32,1),
              transform 0.18s cubic-bezier(0.23,1,0.32,1), visibility 0s;
}
.ui-menu-item {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  width: 100%; padding: 7px 10px; border: none; background: none; cursor: pointer;
  color: var(--text); font-family: inherit; font-size: 13px; font-weight: 600;
  text-align: left; border-radius: 6px; transition: background 0.12s ease;
}
.ui-menu-item:hover, .ui-menu-item.is-active { background: rgba(255,255,255,0.09); }
.ui-menu-item:active { background: rgba(84,172,210,0.2); }
.ui-menu-item.is-selected { color: var(--blue); }
.ui-menu-check { width: 12px; height: 12px; flex-shrink: 0; }

/* ── Custom number stepper (.ui-stepper) ── */
.ui-stepper {
  display: inline-flex; align-items: center;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px; overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ui-stepper:focus-within {
  border-color: rgba(84,172,210,0.6); box-shadow: 0 0 0 3px rgba(84,172,210,0.12);
}
.ui-step {
  width: 26px; height: 30px; border: none; background: none; cursor: pointer;
  color: var(--muted); font-size: 16px; font-weight: 600; line-height: 1;
  display: flex; align-items: center; justify-content: center; user-select: none;
  transition: background 0.12s ease, color 0.12s ease, transform 0.1s ease;
}
.ui-step:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.ui-step:active { background: rgba(84,172,210,0.2); color: var(--blue); transform: scale(0.92); }
.ui-step-input {
  width: 46px; border: none; background: none; color: var(--text);
  padding: 0; text-align: center; font-family: inherit; font-size: 14px; font-weight: 700;
  font-variant-numeric: tabular-nums; -moz-appearance: textfield;
  border-left: 1px solid rgba(255,255,255,0.08);
  border-right: 1px solid rgba(255,255,255,0.08);
}
.ui-step-input::-webkit-inner-spin-button,
.ui-step-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.ui-step-input:focus { outline: none; background: rgba(84,172,210,0.08); }

@media (prefers-reduced-motion: reduce) {
  .ui-menu, .ui-menu[data-open="true"] {
    transform: none;
    transition: opacity 0.12s ease, visibility 0s;
  }
  .ui-select:active, .ui-step:active { transform: none; }
  .ui-select-caret { transition: none; }
}

.dash-revenue-section {
  border-top: 1px solid rgba(255,255,255,0.07);
  background: rgba(0,0,0,0.15);
  padding: 10px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.dash-rev-main {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.dash-rev-items { font-size: 12px; color: var(--muted); }
.dash-rev-val   { font-size: 20px; font-weight: 800; color: #4ade80; font-variant-numeric: tabular-nums; }
.dash-rev-base  { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.dash-prestige-row   { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dash-prestige-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: rgba(255,255,255,0.3); white-space: nowrap; }
.dash-prestige-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.dash-prestige-chip  {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px; padding: 3px 8px; font-size: 11px; font-weight: 600;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.dash-prestige-icon { width: 16px; height: 16px; image-rendering: pixelated; vertical-align: middle; }

.dash-score-row    { display: flex; align-items: center; gap: 10px; }
.dash-score-label  { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: rgba(255,255,255,0.3); white-space: nowrap; }
.dash-score-approx { font-weight: 600; text-transform: none; letter-spacing: 0; color: rgba(255,255,255,0.22); }
.dash-score-val    { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--blue); }

.dash-total-panel { padding: 0; }
.dash-total-row   { display: flex; gap: 0; }
.dash-total-block {
  flex: 1; display: flex; flex-direction: column; gap: 4px;
  padding: 20px 24px;
  border-right: 1px solid rgba(255,255,255,0.07);
}
.dash-total-block:last-child { border-right: none; }
.dash-total-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.dash-total-val   { font-family: var(--font-mono); font-size: 32px; font-weight: 700; color: #4ade80; font-variant-numeric: tabular-nums; letter-spacing: -1.2px; line-height: 1.1; }
.dash-total-muted { color: var(--muted); font-size: 24px; }

/* ── Price table tooltip ─────────────────────────────────────────────────── */

.price-tooltip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  min-width: 260px;
  max-width: 320px;
  background: linear-gradient(145deg, rgba(32,30,38,0.97) 0%, rgba(22,21,26,0.97) 100%);
  backdrop-filter: blur(28px) saturate(200%);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.12) inset,
    0 24px 64px rgba(0,0,0,0.7),
    0 4px 16px rgba(0,0,0,0.4);
  font-size: 13px;
  opacity: 0;
  transform: translateY(4px) scale(0.98);
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.price-tooltip.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.pt-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 2px;
}
.pt-icon { width: 28px; height: 28px; image-rendering: pixelated; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6)); }
.pt-emoji { font-size: 22px; }
.pt-name { font-weight: 700; font-size: 14px; }
.pt-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }

.pt-divider {
  height: 1px; background: rgba(255,255,255,0.08);
  margin: 10px 0;
}

.pt-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; padding: 2px 0;
}
.pt-profit-row { margin-top: 2px; }
.pt-label { color: rgba(255,255,255,0.45); }
.pt-val { font-weight: 600; font-variant-numeric: tabular-nums; }
.pt-green { color: #4ade80; }
.pt-red   { color: #f87171; }
.pt-yellow { color: var(--yellow); }
.pt-muted { font-size: 12px; color: var(--muted); }

.pt-ing-head {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.3);
  padding: 0 0 4px;
  margin-left: 28px;
}
.pt-ing-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 0 8px;
  align-items: center;
  font-size: 12px;
  padding: 3px 0;
}
.pt-ing-qty  { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; min-width: 20px; }
.pt-ing-name { color: var(--text); }
.pt-ing-unit { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; min-width: 52px; font-size: 11px; }
.pt-ing-total{ color: var(--text); font-variant-numeric: tabular-nums; text-align: right; min-width: 52px; font-weight: 600; }

/* Purity-axis info tooltip — same chrome as .price-tooltip, tinted per axis. */
.info-tip {
  min-width: 0;
  max-width: 280px;
  border-color: color-mix(in srgb, var(--tip-accent, #fff) 50%, transparent);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.12) inset,
    0 0 0 1px color-mix(in srgb, var(--tip-accent, #fff) 28%, transparent),
    0 0 24px color-mix(in srgb, var(--tip-accent, #fff) 18%, transparent),
    0 24px 64px rgba(0,0,0,0.7);
}
.info-tip-title {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.3px;
  color: var(--tip-accent, #fff);
  margin-bottom: 4px;
  text-shadow: 0 0 14px color-mix(in srgb, var(--tip-accent, #fff) 45%, transparent);
}
.info-tip-body {
  font-size: 12.5px;
  line-height: 1.45;
  color: rgba(255,255,255,0.78);
}

/* ── Sushi calculator — Liquid Glass ─────────────────────────────────────── */

.sushi-controls {
  padding: 20px 24px;
  background: linear-gradient(145deg, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0.02) 100%);
  backdrop-filter: blur(24px) saturate(190%);
  -webkit-backdrop-filter: blur(24px) saturate(190%);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.1) inset, 0 8px 32px rgba(0,0,0,0.3);
}
.sushi-controls-inner { display: flex; gap: 36px; flex-wrap: wrap; align-items: flex-start; }
.sushi-control-block { display: flex; flex-direction: column; gap: 10px; }

.sushi-ctrl-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.7px; color: rgba(255,255,255,0.4);
}
.sushi-ctrl-sub { font-size: 10px; text-transform: none; letter-spacing: 0; opacity: 0.6; font-weight: 400; }
.sushi-hint { font-size: 11px; color: rgba(255,255,255,0.3); }

.sushi-toggle {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;        /* equal-width segments regardless of label length */
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 3px;
  width: fit-content;
}
/* Sliding thumb — physically moves between the two options instead of each
   button swapping its own background (the AI-slop default). */
.sushi-toggle::before {
  content: '';
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  border-radius: 7px;
  background: linear-gradient(145deg, rgba(255,255,255,0.18), rgba(255,255,255,0.08));
  box-shadow: 0 1px 0 rgba(255,255,255,0.2) inset, 0 2px 8px rgba(0,0,0,0.3);
  transition: transform 280ms var(--ease-out);
  pointer-events: none;
  z-index: 0;
}
.sushi-toggle:has(> *:nth-child(2).active)::before { transform: translateX(100%); }
.sushi-rice-btn, .sushi-nori-btn {
  position: relative;
  z-index: 1;
  background: none; border: none; color: rgba(255,255,255,0.45);
  padding: 5px 16px; font-size: 13px; cursor: pointer; border-radius: 7px;
  transition: color 0.28s var(--ease-out); font-family: inherit; white-space: nowrap;
}
.sushi-rice-btn em, .sushi-nori-btn em {
  font-style: normal; font-size: 11px; margin-left: 5px; color: var(--yellow);
  transition: color 0.28s var(--ease-out);
}
.sushi-rice-btn.active, .sushi-nori-btn.active { color: #fff; }
.sushi-rice-btn.active em, .sushi-nori-btn.active em { color: rgba(255,255,255,0.7); }
.sushi-rice-btn:hover:not(.active), .sushi-nori-btn:hover:not(.active) {
  color: rgba(255,255,255,0.7);
}

.sushi-qty-row { display: flex; gap: 12px; flex-wrap: wrap; }
.sushi-qty-label { display: flex; flex-direction: column; gap: 6px; }
.sushi-qty-fish {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; color: rgba(255,255,255,0.5);
  text-transform: uppercase; letter-spacing: 0.4px;
}
.sushi-qty-icon { width: 18px; height: 18px; image-rendering: pixelated; }
.sushi-qty-input {
  width: 88px;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px; color: var(--text); padding: 6px 10px;
  font-size: 13px; font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.sushi-qty-input:focus {
  outline: none;
  border-color: rgba(84,172,210,0.6);
  box-shadow: 0 0 0 3px rgba(84,172,210,0.12);
}

.sushi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 4px;
}
@media (max-width: 800px) {
  .sushi-grid { grid-template-columns: 1fr; }
}

.sushi-card {
  padding: 0; overflow: hidden;
  background: linear-gradient(145deg, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0.025) 60%, rgba(255,255,255,0.01) 100%);
  backdrop-filter: blur(24px) saturate(190%);
  -webkit-backdrop-filter: blur(24px) saturate(190%);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.12) inset,
    0 -1px 0 rgba(0,0,0,0.15) inset,
    0 8px 32px rgba(0,0,0,0.35),
    0 2px 6px rgba(0,0,0,0.2);
  transition: box-shadow 0.2s, transform 0.2s;
}
.sushi-card:hover {
  box-shadow:
    0 1px 0 rgba(255,255,255,0.15) inset,
    0 -1px 0 rgba(0,0,0,0.15) inset,
    0 12px 40px rgba(0,0,0,0.4),
    0 4px 12px rgba(0,0,0,0.25);
  transform: translateY(-1px);
}

.sushi-card-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.03);
}
.sushi-fish-icon { width: 32px; height: 32px; image-rendering: pixelated; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }
.sushi-fish-name { font-weight: 700; font-size: 16px; flex: 1; letter-spacing: -0.2px; }
.sushi-best-tag {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; padding: 4px 10px; border-radius: 20px;
  background: rgba(84,172,210,0.15);
  border: 1px solid rgba(84,172,210,0.25);
  color: var(--blue);
}

.sushi-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sushi-table thead th {
  padding: 7px 18px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.6px; color: rgba(255,255,255,0.3);
  border-bottom: 1px solid rgba(255,255,255,0.06); text-align: right;
}
.sushi-table thead th:first-child { text-align: left; }
.sushi-best-row {
  background: linear-gradient(90deg, rgba(41,105,176,0.18) 0%, rgba(41,105,176,0.08) 100%);
}
.sushi-table tbody tr + tr { border-top: 1px solid rgba(255,255,255,0.04); }
.sushi-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.sushi-best-row:hover { background: linear-gradient(90deg, rgba(41,105,176,0.22) 0%, rgba(41,105,176,0.1) 100%); }
.sushi-table td { padding: 10px 18px; vertical-align: middle; }

.sushi-route-label { color: rgba(255,255,255,0.4); white-space: nowrap; cursor: default; }
.sushi-best-row .sushi-route-label { color: var(--text); font-weight: 600; }

.sushi-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sushi-cost-col { color: rgba(184,58,47,0.9); }
.sushi-net-best { color: #4ade80; font-weight: 700; }
.sushi-net-dim  { color: rgba(255,255,255,0.3); }
.sushi-pct-diff { font-size: 10px; color: rgba(255,255,255,0.25); margin-left: 5px; }
.sushi-total-val { color: var(--yellow); font-weight: 700; }

.sushi-card-footer {
  padding: 12px 18px 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.12);
  display: flex; flex-direction: column; gap: 10px;
}
.sushi-card-footer strong { color: #4ade80; }
.sushi-footer-result { font-size: 13px; color: rgba(255,255,255,0.6); }

.sushi-footer-mats { display: flex; flex-direction: column; gap: 8px; }
.sushi-mats-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px; color: rgba(255,255,255,0.3);
}
.sushi-materials {
  display: flex; align-items: stretch; gap: 1px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px; overflow: hidden;
}
.sushi-mat-stat {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 3px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.02);
}
.sushi-mat-stat:hover { background: rgba(255,255,255,0.05); }
.sushi-mat-div { width: 1px; background: rgba(255,255,255,0.08); flex-shrink: 0; }
.sushi-mat-n {
  font-size: 20px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums; line-height: 1;
}
.sushi-mat-l {
  font-size: 10px; color: rgba(255,255,255,0.4);
  text-transform: uppercase; letter-spacing: 0.4px; text-align: center;
}
.sushi-mat-sub { display: block; }
.sushi-mat-farmed { color: #4ade80; font-size: 9px; }

/* ── Vote tracker ─────────────────────────────────────────────────────────── */

/* Notification bar */
.vote-notif-prompt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: linear-gradient(145deg, rgba(84,172,210,0.12), rgba(41,105,176,0.08));
  border: 1px solid rgba(84,172,210,0.25);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  flex-wrap: wrap;
}
.vote-notif-icon { font-size: 18px; }
.vote-notif-text { flex: 1; font-size: 13px; color: var(--text); min-width: 160px; }

.vote-notif-on {
  font-size: 12px;
  color: var(--muted);
  padding: 8px 4px;
}

/* Summary card */
.vote-summary-card { padding: 0; position: relative; }
.vote-sum-inner {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0;
  position: relative;
  flex-wrap: wrap;
}
.vote-sum-stat {
  flex: 1;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 18px 20px;
}
.vote-sum-n {
  font-size: 32px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1;
}
.vote-sum-n.vote-sum-all-ready { color: #4ade80; }
.vote-sum-n.vote-sum-timer {
  font-size: 18px;
  color: var(--yellow);
}
.vote-sum-l {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
.vote-sum-div {
  width: 1px;
  height: 40px;
  background: rgba(255,255,255,0.07);
  flex-shrink: 0;
  align-self: center;
}
.vote-sum-bar-wrap {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255,255,255,0.06);
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}
.vote-sum-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4ade80, var(--blue));
  border-radius: 0 0 var(--radius) var(--radius);
  transition: width 0.6s ease;
}

/* ntfy phone-notification card */
.vote-ntfy-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.ntfy-head { display: flex; align-items: flex-start; gap: 12px; }
.ntfy-icon { font-size: 22px; line-height: 1.2; }
.ntfy-head-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.ntfy-title { font-weight: 700; font-size: 15px; }
.ntfy-sub { font-size: 12px; color: var(--muted); }
.ntfy-toggle {
  display: flex; align-items: center; gap: 7px; flex-shrink: 0;
  font-size: 12px; color: var(--muted); cursor: pointer;
  padding: 6px 12px; border-radius: 20px;
  background: rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.1);
}
.ntfy-toggle input { accent-color: var(--blue); cursor: pointer; }

.ntfy-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ntfy-input {
  flex: 1; min-width: 200px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius); color: var(--text);
  padding: 8px 12px; font-size: 13px; font-family: inherit;
}
.ntfy-input:focus { outline: none; border-color: rgba(84,172,210,0.6); box-shadow: 0 0 0 3px rgba(84,172,210,0.12); }

.ntfy-status { font-size: 12px; color: var(--blue); min-height: 16px; }

.ntfy-steps {
  margin: 0; padding-left: 20px;
  display: flex; flex-direction: column; gap: 5px;
  font-size: 12px; color: var(--muted); line-height: 1.5;
}
.ntfy-steps strong { color: var(--text); font-weight: 600; }
.ntfy-steps code {
  background: rgba(0,0,0,0.35); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px; padding: 1px 5px; font-size: 11px; color: var(--blue);
}
.ntfy-link { font-size: 12px; color: var(--blue); text-decoration: none; word-break: break-all; }
.ntfy-link:hover { text-decoration: underline; }

/* Vote grid */
.vote-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

/* Vote card */
.vote-card {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(190%);
  -webkit-backdrop-filter: blur(20px) saturate(190%);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 24px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: var(--glass-shadow);
  transition: box-shadow 0.2s, transform 0.2s, opacity 0.3s;
  text-align: center;
}
.vote-card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.14) inset,
    0 12px 40px rgba(0,0,0,0.45),
    0 4px 12px rgba(0,0,0,0.25);
}
.vote-card.vote-card-voted {
  opacity: 0.65;
}
.vote-card.vote-card-voted:hover {
  opacity: 0.8;
}

/* Site icon badge — neutral glass disc so transparent favicons read clearly */
.vote-badge {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: radial-gradient(circle at 50% 35%, rgba(255,255,255,0.12), rgba(255,255,255,0.04));
  border: 1px solid rgba(255,255,255,0.12);
}
.vote-badge-icon {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}
.vote-badge-text {
  font-size: 15px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.3px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  align-items: center;
  justify-content: center;
}

/* Site name */
.vote-site-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.vote-reset-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: rgba(255,255,255,0.32);
  margin-top: -4px;
}

/* Vote button */
.vote-btn {
  width: 100%;
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  background: linear-gradient(145deg, rgba(63,185,80,0.85), rgba(41,105,176,0.75));
  color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,0.2) inset, 0 4px 16px rgba(41,105,176,0.25);
  transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
}
.vote-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 1px 0 rgba(255,255,255,0.2) inset, 0 6px 20px rgba(41,105,176,0.35);
}
.vote-btn.vote-btn-voted,
.vote-btn:disabled {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.3);
  cursor: default;
  box-shadow: none;
  transform: none;
}

/* Countdown timer below button */
.vote-timer {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-height: 16px;
  line-height: 1;
}

@media (max-width: 700px) {
  .vote-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .vote-grid { grid-template-columns: 1fr; }
}

/* ── Ranks page ── */
.ranks-input-card { padding: 20px; }
.ranks-input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
}
.ranks-input-col { display: flex; flex-direction: column; min-width: 0; }
.ranks-col-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.ranks-col-opt { font-weight: 500; color: var(--muted); }
.ranks-field-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin: 10px 0 5px;
}
.ranks-field-label:first-of-type { margin-top: 0; }
.ranks-input-card .cbx { display: block; width: 100%; min-width: 0; }

.ranks-balance-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}
.ranks-balance-wrap:focus-within {
  border-color: rgba(84,172,210,0.6);
  box-shadow: 0 0 0 3px rgba(84,172,210,0.12);
}
.ranks-balance-prefix { color: var(--muted); font-family: var(--font-mono); font-size: 14px; }
.ranks-balance-input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  padding: 11px 0;
}
.ranks-balance-input::placeholder { color: var(--muted); }

.ranks-msg {
  background: rgba(227,179,65,0.10);
  border: 1px solid rgba(227,179,65,0.35);
  color: var(--yellow);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
}

/* The headline figure leads — accent it and bump the scale. */
#ranks-kpis .stat-value { font-size: 22px; }
#ranks-kpi-needed { color: var(--blue); }

.ranks-progress-card { padding: 18px 20px; }
.ranks-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.ranks-progress-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.ranks-progress-pct { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 15px; font-weight: 600; color: var(--text); }
.ranks-progress {
  height: 12px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  overflow: hidden;
}
.ranks-progress-fill {
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, var(--accent), var(--blue));
  transition: transform 0.32s var(--ease-out);
}

.ranks-rewards-card { padding: 18px 20px; }
.ranks-rewards-rank {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
}
.ranks-rewards-note { font-size: 13px; line-height: 1.5; color: var(--muted); }

/* Cumulative path: a per-tier timeline of every rankup to the goal. */
.ranks-path { display: flex; flex-direction: column; gap: 20px; }
.ranks-path-group { display: flex; flex-direction: column; }
.ranks-path-group-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-bottom: 8px; margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.ranks-path-tier { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); font-weight: 600; }
.ranks-path-tier-sum { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 600; color: var(--text); }
.ranks-path-note { font-size: 12px; color: var(--muted); padding: 6px 0 2px; }

.ranks-path-steps { list-style: none; margin: 0; padding: 0; }
.ranks-path-step {
  position: relative;
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 12px;
  padding: 9px 0;
  opacity: 0;
  transform: translateY(8px);
  animation: ranksStepIn 300ms var(--ease-out) forwards;
  animation-delay: var(--d, 0ms);
}
/* Continuous connector line running through the dot column. */
.ranks-path-step::before {
  content: '';
  position: absolute;
  left: 7px; top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
}
.ranks-path-step:first-child::before { top: 9px; }
.ranks-path-step.is-last::before { bottom: auto; height: 9px; }
.ranks-path-dot {
  position: relative; z-index: 1;
  width: 10px; height: 10px; margin-top: 4px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border);
  transition: background 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}
.ranks-path-step.is-target .ranks-path-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(41,105,176,0.18);
}
.ranks-path-body { min-width: 0; }
.ranks-path-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.ranks-path-rank { font-family: var(--font-display); font-size: 15px; font-weight: 600; color: var(--text); }
.ranks-path-step.is-target .ranks-path-rank { color: var(--blue); }
.ranks-path-cost { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); flex-shrink: 0; }
.ranks-path-perk { font-size: 13px; line-height: 1.5; color: var(--muted); margin-top: 3px; }

@keyframes ranksStepIn { to { opacity: 1; transform: none; } }

@media (max-width: 760px) {
  .ranks-input-grid { grid-template-columns: 1fr; gap: 20px; }
}

/* ── Respect reduced-motion preference ── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Auth UI ─────────────────────────────────────────────────────────────── */

/* Locked tabs stay visible — just carry a subtle superscript lock for guests */
body:not(.authenticated) .nav-tab[data-gated]::after {
  content: '🔒';
  font-size: 8px;
  margin-left: 3px;
  opacity: 0.55;
  vertical-align: super;
  line-height: 1;
}

/* First-visit pulse: fired once via JS, draws the eye to the locked tabs */
@keyframes locked-tab-pulse {
  0%   { border-color: transparent;              box-shadow: none;                                color: var(--muted); }
  40%  { border-color: rgba(84,172,210,0.45);    box-shadow: 0 0 14px rgba(84,172,210,0.28);     color: var(--text); }
  100% { border-color: transparent;              box-shadow: none;                                color: var(--muted); }
}
.nav-tab.first-visit-pulse {
  animation: locked-tab-pulse 1.1s ease-in-out 2;
}

.auth-btn {
  background: #5865F2;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.auth-btn:hover { background: #4752c4; }
.auth-btn.hidden { display: none; }

.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-menu.hidden { display: none; }
.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}
.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.logout-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.logout-btn:hover { border-color: var(--text); color: var(--text); }

/* ── Unlock panel — replaces gated page content for guests ── */
.unlock-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 55vh;
}
.unlock-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius);
  padding: 40px 48px;
  text-align: center;
  max-width: 400px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.unlock-lock {
  font-size: 28px;
  margin-bottom: 16px;
  opacity: 0.7;
}
.unlock-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 28px;
  letter-spacing: -0.3px;
}
.unlock-benefits {
  list-style: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-bottom: 32px;
  text-align: left;
}
.unlock-benefit {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}
.unlock-benefit-icon {
  font-size: 15px;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}
.unlock-discord-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #5865F2;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s var(--ease-out);
  width: 100%;
  justify-content: center;
  margin-bottom: 14px;
}
.unlock-discord-btn:hover { background: #4752c4; transform: translateY(-1px); }
.unlock-discord-btn:active { transform: translateY(0); }
.unlock-guest-link {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
}
.unlock-guest-link:hover { color: var(--text); }

