/* CardFlow — dark glass interface */
:root {
  --bg: #05070d;
  --bg-2: #0a0f1c;
  --panel: rgba(17, 24, 42, 0.62);
  --panel-solid: #0f1627;
  --panel-hi: rgba(255, 255, 255, 0.035);
  --line: rgba(140, 170, 255, 0.11);
  --line-hi: rgba(140, 170, 255, 0.22);
  --text: #e7ecff;
  --muted: #8791b5;
  --faint: #5a6385;
  --cyan: #3ee6ff;
  --violet: #8b5cf6;
  --mint: #34f5a4;
  --gold: #ffc857;
  --rose: #ff5c7a;
  --blue: #5b9dff;
  --pink: #f472b6;
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Segoe UI Variable Display", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
input, textarea { user-select: text; }
button { font: inherit; color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(140, 170, 255, 0.16); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(140, 170, 255, 0.3); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- backdrop ---------- */
.backdrop { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  background: radial-gradient(1200px 700px at 85% -10%, #10183a 0%, transparent 60%),
              radial-gradient(900px 600px at -10% 110%, #0d1430 0%, transparent 60%), var(--bg); }
.grid { position: absolute; inset: -2px;
  background-image: linear-gradient(rgba(120, 150, 255, 0.045) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(120, 150, 255, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 60% 30%, black 0%, transparent 75%); }
.glow { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.35; }
.g1 { width: 520px; height: 520px; background: #1fb6ff; top: -220px; right: 8%; opacity: 0.16; animation: drift 18s ease-in-out infinite alternate; }
.g2 { width: 460px; height: 460px; background: #7c3aed; bottom: -240px; left: 18%; opacity: 0.14; animation: drift 22s ease-in-out infinite alternate-reverse; }
@keyframes drift { to { transform: translate(60px, 40px) scale(1.1); } }

/* ---------- shell ---------- */
.shell { position: relative; z-index: 1; display: flex; height: 100vh; }
.glass { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(18px) saturate(140%); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04); }

.rail { width: 84px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 0;
  border-right: 1px solid var(--line); background: rgba(6, 9, 18, 0.55); backdrop-filter: blur(14px); }
.logo { width: 46px; height: 46px; margin-bottom: 18px; filter: drop-shadow(0 0 12px rgba(62, 230, 255, 0.35)); }
.logo svg { width: 100%; height: 100%; }
.nav { position: relative; width: 66px; padding: 10px 0 8px; border: 0; border-radius: 14px; background: transparent;
  color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer;
  transition: color .18s, background .18s; }
.nav svg { width: 23px; height: 23px; }
.nav span { font-size: 11px; letter-spacing: .02em; }
.nav:hover { color: var(--text); background: var(--panel-hi); }
.nav.active { color: var(--cyan); background: rgba(62, 230, 255, 0.08); }
.nav.active::before { content: ""; position: absolute; left: -9px; top: 14px; bottom: 14px; width: 3px; border-radius: 3px;
  background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }
.nav .badge { position: absolute; top: 4px; right: 10px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--gold); color: #1a1200; font: 700 11px/18px var(--font); font-style: normal; box-shadow: 0 0 10px rgba(255, 200, 87, .6); }
.rail-spacer { flex: 1; }

main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 18px 22px 20px; gap: 16px; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 18px; min-height: 56px; }
.eyebrow { font: 600 11px/1 var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--cyan); opacity: .85; }
h1 { margin: 6px 0 0; font-size: 26px; font-weight: 600; letter-spacing: -.01em; }
h2 { margin: 4px 0 0; font-size: 20px; font-weight: 600; }
h3 { margin: 0; font-size: 15px; font-weight: 600; }
.topbar-spacer { flex: 1; }
.status-pill { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(10, 16, 30, .7); color: var(--muted); font-size: 13px; white-space: nowrap; max-width: 520px; overflow: hidden; text-overflow: ellipsis; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 0 rgba(52, 245, 164, .6); animation: pulse 2s infinite; flex: none; }
.status-pill.busy .pulse { background: var(--cyan); animation-duration: .9s; }
.status-pill.loading .pulse { background: var(--gold); }
.status-pill.error .pulse { background: var(--rose); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(62, 230, 255, .55); } 70% { box-shadow: 0 0 0 9px rgba(62, 230, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(62, 230, 255, 0); } }
.quota { font: 12px var(--mono); color: var(--faint); white-space: nowrap; }

/* batch picker */
.batch-picker { position: relative; margin-left: 8px; }
.picker-button { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: 12px; border: 1px solid var(--line-hi);
  background: rgba(14, 20, 38, .8); cursor: pointer; font-weight: 600; min-width: 220px; transition: border-color .15s, box-shadow .15s; }
.picker-button:hover { border-color: rgba(62, 230, 255, .45); box-shadow: 0 0 0 3px rgba(62, 230, 255, .08); }
.picker-button .chev { width: 16px; height: 16px; margin-left: auto; color: var(--muted); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--rose); box-shadow: 0 0 10px var(--rose); animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: .35; } }
.picker-menu { position: absolute; top: calc(100% + 8px); left: 0; width: 380px; z-index: 30; padding: 8px; background: rgba(12, 18, 34, .96); }
.picker-list { max-height: 380px; overflow: auto; }
.picker-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.picker-item:hover, .picker-item.current { background: rgba(62, 230, 255, .07); }
.picker-item .pi-name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.picker-item .pi-sub { color: var(--muted); font-size: 12px; }
.picker-item .pi-value { grid-row: span 2; align-self: center; font: 600 14px var(--mono); color: var(--mint); }
.picker-item .rename { opacity: 0; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 4px; }
.picker-item:hover .rename { opacity: 1; }
.picker-actions { display: flex; gap: 8px; padding: 8px 4px 2px; border-top: 1px solid var(--line); margin-top: 6px; }
.tag { font: 700 10px/1 var(--mono); letter-spacing: .12em; padding: 4px 6px; border-radius: 6px; }
.tag.live { color: var(--rose); background: rgba(255, 92, 122, .12); }

/* ---------- buttons ---------- */
.btn { border: 1px solid var(--line-hi); background: rgba(255, 255, 255, .04); padding: 10px 16px; border-radius: 12px; cursor: pointer;
  font-weight: 600; display: inline-flex; align-items: center; gap: 8px; transition: transform .08s, background .15s, border-color .15s, box-shadow .15s; white-space: nowrap; }
.btn:hover { background: rgba(255, 255, 255, .08); border-color: rgba(140, 170, 255, .35); }
.btn:active { transform: translateY(1px); }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn.icon { padding: 7px 9px; }
.btn.icon svg { width: 17px; height: 17px; }
.btn.primary { border: 0; color: #031018; background: linear-gradient(135deg, var(--cyan), #6aa8ff 60%, var(--violet));
  box-shadow: 0 6px 24px rgba(62, 230, 255, .25); }
.btn.primary:hover { box-shadow: 0 8px 30px rgba(62, 230, 255, .4); filter: brightness(1.06); }
.btn.danger { color: var(--rose); border-color: rgba(255, 92, 122, .35); }
.btn.danger:hover { background: rgba(255, 92, 122, .1); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .4; cursor: default; }
kbd { font: 600 10px/1 var(--mono), "Segoe UI Symbol"; padding: 3px 5px; border-radius: 5px; border: 1px solid currentColor; opacity: .6; }

/* ---------- pages ---------- */
.page { display: none; flex: 1; min-height: 0; flex-direction: column; gap: 16px; animation: rise .35s ease; }
.page.active { display: flex; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { padding: 16px 18px; text-align: left; position: relative; overflow: hidden; }
.stat::after { content: ""; position: absolute; inset: auto -40% -60% auto; width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(62, 230, 255, .10), transparent 70%); }
.stat.accent::after { background: radial-gradient(circle, rgba(52, 245, 164, .14), transparent 70%); }
.stat.warn::after { background: radial-gradient(circle, rgba(255, 200, 87, .14), transparent 70%); }
.stat-label { font: 600 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.stat-value { font-size: 30px; font-weight: 650; margin-top: 10px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat.accent .stat-value { color: var(--mint); text-shadow: 0 0 24px rgba(52, 245, 164, .25); }
.stat.warn.hot .stat-value { color: var(--gold); text-shadow: 0 0 24px rgba(255, 200, 87, .35); }
.stat-sub { color: var(--faint); font-size: 12px; margin-top: 2px; }
.clickable { cursor: pointer; transition: border-color .15s, transform .1s; }
.clickable:hover { border-color: rgba(255, 200, 87, .4); }

/* callout */
.callout { display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 16px; border-color: rgba(255, 200, 87, .28);
  background: linear-gradient(90deg, rgba(255, 200, 87, .09), rgba(17, 24, 42, .6) 45%); }
.callout.subtle { border-color: var(--line); background: var(--panel); }
.callout-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800;
  color: #1a1200; background: var(--gold); box-shadow: 0 0 16px rgba(255, 200, 87, .5); flex: none; }
.callout.subtle .callout-icon { background: rgba(91, 157, 255, .2); color: var(--blue); box-shadow: none; }
.callout-text { flex: 1; display: flex; flex-direction: column; }
.callout-text span { color: var(--muted); font-size: 13px; }

/* workspace */
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 16px; }
.list-panel { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.list-panel.grow { flex: 1; }
.toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-title { padding-left: 4px; }
.segmented { display: flex; padding: 3px; border-radius: 11px; background: rgba(0, 0, 0, .25); border: 1px solid var(--line); }
.segmented button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 600; }
.segmented button:hover { color: var(--text); }
.segmented button.active { color: var(--text); background: rgba(62, 230, 255, .12); box-shadow: inset 0 0 0 1px rgba(62, 230, 255, .3); }
.segmented button .n { color: var(--faint); margin-left: 4px; font-weight: 500; }
.search { flex: 1; min-width: 180px; display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: rgba(0, 0, 0, .22); }
.search:focus-within { border-color: rgba(62, 230, 255, .45); box-shadow: 0 0 0 3px rgba(62, 230, 255, .08); }
.search svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.search input, .field input, .field textarea { flex: 1; border: 0; outline: 0; background: none; color: var(--text); font: inherit; min-width: 0; }

/* tables */
.table-head, .row { display: grid; grid-template-columns: 52px 150px 92px minmax(180px, 1fr) 70px 150px 90px; align-items: center; gap: 10px; padding: 0 16px; }
.table-head.inv, .row.inv { grid-template-columns: 96px minmax(200px, 1fr) 72px 150px 170px 90px; }
.table-head { height: 38px; font: 600 10.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--faint);
  border-bottom: 1px solid var(--line); flex: none; }
.r { text-align: right; justify-self: end; }
.table-body { flex: 1; overflow: auto; min-height: 0; }
.row { height: 50px; border-bottom: 1px solid rgba(140, 170, 255, .055); cursor: pointer; transition: background .12s; }
.row:hover { background: rgba(255, 255, 255, .025); }
.row.selected { background: rgba(62, 230, 255, .07); box-shadow: inset 3px 0 0 var(--cyan); }
.row.flash { animation: flash 1.2s ease; }
@keyframes flash { from { background: rgba(62, 230, 255, .16); } }
.seq { font: 12px var(--mono); color: var(--faint); }
.cardname { min-width: 0; }
.cardname b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cardname small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.num { font: 13px var(--mono); color: var(--muted); }
.price { font: 600 14px var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
.dim { color: var(--faint); }
.table-foot { padding: 10px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

/* status chips */
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid currentColor; background: rgba(0, 0, 0, .2); white-space: nowrap; width: max-content; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.chip.priced { color: var(--mint); border-color: rgba(52, 245, 164, .3); }
.chip.printing, .chip.noprice { color: var(--gold); border-color: rgba(255, 200, 87, .35); }
.chip.review, .chip.error { color: var(--rose); border-color: rgba(255, 92, 122, .35); }
.chip.pending { color: var(--blue); border-color: rgba(91, 157, 255, .35); }
.chip.japan { color: #b69cff; border-color: rgba(182, 156, 255, .35); }
.chip.queued { color: var(--cyan); border-color: rgba(62, 230, 255, .3); }
.chip.queued::before { animation: blink 1s infinite; }
.chip.skipped { color: var(--faint); border-color: rgba(90, 99, 133, .5); }

/* box badges */
.box { display: inline-grid; place-items: center; min-width: 46px; height: 26px; padding: 0 8px; border-radius: 8px; font: 700 12.5px/1 var(--mono);
  color: var(--tc); background: color-mix(in srgb, var(--tc) 13%, transparent); border: 1px solid color-mix(in srgb, var(--tc) 40%, transparent);
  text-shadow: 0 0 12px color-mix(in srgb, var(--tc) 60%, transparent); width: max-content; }
.t-0\.5 { --tc: #94a3b8; } .t-1 { --tc: #34f5a4; } .t-2 { --tc: #3ee6ff; } .t-3 { --tc: #5b9dff; }
.t-4 { --tc: #a78bfa; } .t-5 { --tc: #f472b6; } .t-BW { --tc: #ffc857; }

/* empty state */
.empty { flex: 1; display: grid; place-content: center; text-align: center; color: var(--muted); padding: 40px; }
.empty h3 { color: var(--text); margin: 18px 0 4px; font-size: 17px; }
.empty p { margin: 0; max-width: 320px; }
.empty-orb { width: 88px; height: 88px; margin: 0 auto; border-radius: 50%; border: 1px solid rgba(62, 230, 255, .35);
  box-shadow: 0 0 40px rgba(62, 230, 255, .18), inset 0 0 30px rgba(62, 230, 255, .12); position: relative; animation: breathe 3s ease-in-out infinite; }
.empty-orb::after { content: ""; position: absolute; inset: 26px; border-radius: 50%; background: var(--cyan); filter: blur(10px); opacity: .45; }
@keyframes breathe { 50% { transform: scale(1.06); box-shadow: 0 0 60px rgba(62, 230, 255, .28), inset 0 0 30px rgba(62, 230, 255, .2); } }

/* ---------- inspector ---------- */
.inspector { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.inspector-empty { flex: 1; display: grid; place-content: center; justify-items: center; color: var(--faint); gap: 10px; }
.inspector-empty svg { width: 46px; height: 46px; opacity: .5; }
.inspector-body { flex: 1; overflow: auto; padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.ins-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ins-title { font-size: 20px; font-weight: 650; line-height: 1.2; }
.ins-sub { color: var(--muted); margin-top: 3px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.frame { position: relative; border-radius: 12px; overflow: hidden; background: #070b16; border: 1px solid var(--line);
  aspect-ratio: 63 / 88; display: grid; place-items: center; }
.frame img { width: 100%; height: 100%; object-fit: contain; }
.frame .cap { position: absolute; left: 8px; top: 8px; font: 600 9.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase;
  color: var(--text); background: rgba(5, 7, 13, .7); padding: 5px 7px; border-radius: 6px; backdrop-filter: blur(6px); }
.frame .none { color: var(--faint); font-size: 12px; }
.frame.scan::after { content: ""; position: absolute; left: 0; right: 0; height: 40%; top: -40%;
  background: linear-gradient(180deg, transparent, rgba(62, 230, 255, .10), transparent); animation: scanline 3.5s ease-in-out infinite; }
@keyframes scanline { 60%, 100% { top: 100%; } }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.fact { padding: 11px 13px; border-radius: 12px; background: rgba(0, 0, 0, .22); border: 1px solid var(--line); }
.fact .k { font: 600 10px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.fact .v { margin-top: 7px; font-weight: 600; }
.fact .v.big { font: 650 22px var(--mono); color: var(--mint); }
.note { color: var(--muted); font-size: 13px; padding: 10px 12px; border-radius: 10px; background: rgba(0, 0, 0, .18); border: 1px dashed var(--line); }
.section-title { font: 600 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--cyan); margin-bottom: 10px; }
.options { display: grid; gap: 8px; }
.option { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-hi);
  background: rgba(255, 255, 255, .03); cursor: pointer; text-align: left; transition: all .15s; }
.option:hover { border-color: rgba(62, 230, 255, .55); background: rgba(62, 230, 255, .07); box-shadow: 0 0 0 3px rgba(62, 230, 255, .06); }
.option.current { border-color: rgba(52, 245, 164, .5); background: rgba(52, 245, 164, .06); }
.option .opt-key { font: 700 11px var(--mono); width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center;
  border: 1px solid var(--line-hi); color: var(--muted); flex: none; }
.option .opt-label { flex: 1; font-weight: 600; }
.option .opt-price { font: 650 15px var(--mono); color: var(--mint); }
.cands { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cand { border: 1px solid var(--line-hi); background: rgba(255, 255, 255, .025); border-radius: 12px; padding: 7px; cursor: pointer; text-align: left;
  transition: all .15s; display: flex; flex-direction: column; gap: 6px; position: relative; }
.cand:hover { border-color: rgba(62, 230, 255, .6); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(62, 230, 255, .12); }
.cand img, .cand .noimg { width: 100%; aspect-ratio: 63/88; object-fit: contain; border-radius: 8px; background: #070b16; }
.cand .cn { font-size: 12px; font-weight: 600; line-height: 1.25; }
.cand .cs { font-size: 11px; color: var(--muted); line-height: 1.25; }
.cand .ck { position: absolute; top: 12px; left: 12px; }
.found { display: grid; gap: 6px; max-height: 280px; overflow: auto; margin-top: 8px; }
.found-item { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 10px; border: 1px solid transparent; cursor: pointer; text-align: left; background: none; }
.found-item:hover { border-color: rgba(62, 230, 255, .4); background: rgba(62, 230, 255, .05); }
.found-item img, .found-item .noimg { width: 38px; height: 53px; object-fit: contain; border-radius: 4px; background: #070b16; flex: none; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.link { color: var(--cyan); cursor: pointer; text-decoration: none; border-bottom: 1px dotted rgba(62, 230, 255, .5); }

/* ---------- inventory ---------- */
.inv-head { display: grid; grid-template-columns: 260px 1fr; gap: 14px; }
.inv-total { padding: 20px; display: flex; flex-direction: column; justify-content: center;
  background: linear-gradient(145deg, rgba(62, 230, 255, .10), rgba(139, 92, 246, .10)), var(--panel); }
.inv-total-value { font: 700 34px var(--mono); margin: 10px 0 2px; letter-spacing: -.03em;
  background: linear-gradient(90deg, #fff, var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tier-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.tier { padding: 14px 12px 12px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--tc) 28%, transparent); cursor: pointer;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tc) 9%, transparent), rgba(17, 24, 42, .6)); text-align: left; position: relative; overflow: hidden;
  transition: transform .12s, box-shadow .15s, border-color .15s; }
.tier::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--tc); box-shadow: 0 0 14px var(--tc); }
.tier:hover { transform: translateY(-2px); box-shadow: 0 10px 30px color-mix(in srgb, var(--tc) 16%, transparent); }
.tier.active { border-color: var(--tc); box-shadow: 0 0 0 1px var(--tc), 0 10px 30px color-mix(in srgb, var(--tc) 22%, transparent); }
.tier .tl { font: 700 15px var(--mono); color: var(--tc); text-shadow: 0 0 14px color-mix(in srgb, var(--tc) 60%, transparent); }
.tier .tc { font: 650 26px var(--font); margin-top: 8px; font-variant-numeric: tabular-nums; }
.tier .tv { font: 12px var(--mono); color: var(--muted); }
.tier .tc small { font-size: 12px; color: var(--faint); font-weight: 500; margin-left: 3px; }

/* ---------- streams ---------- */
.streams-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; }
.table-head.streams, .row.stream { gap: 8px; }
.row.stream .n { font: 13px var(--mono); text-align: right; color: var(--text); }
.row.stream .n.zero { color: var(--faint); }
.slot { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; width: max-content; }
.slot.Early { color: var(--cyan); background: rgba(62, 230, 255, .1); border: 1px solid rgba(62, 230, 255, .3); }
.slot.Late { color: #b69cff; background: rgba(139, 92, 246, .12); border: 1px solid rgba(139, 92, 246, .35); }
.select { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, .22); }
.select label { font: 600 10px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.select select, select.plain { background: transparent; color: var(--text); border: 0; outline: 0; font: 600 13px var(--font); padding: 4px 2px; cursor: pointer; }
.select option, select.plain option { background: #0f1627; }
.leader { display: grid; gap: 6px; }
.leader-row .lc { white-space: nowrap; }
.bw-line { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.modal .stepper-row { padding: 6px 10px; }
.modal .stepper button { width: 30px; height: 30px; }
.modal .stepper input { padding: 5px; }
.modal .slot-toggle button { padding: 9px; }
.leader-row { display: grid; grid-template-columns: 1fr 90px 96px; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; background: rgba(0, 0, 0, .2); border: 1px solid var(--line); }
.leader-row b { font-weight: 600; }
.leader-row .lc { font: 13px var(--mono); color: var(--muted); text-align: right; }
.leader-row .lv { font: 600 14px var(--mono); color: var(--mint); text-align: right; }
.slot-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.slot-toggle button { padding: 12px; border-radius: 12px; border: 1px solid var(--line-hi); background: rgba(255, 255, 255, .03); cursor: pointer; font-weight: 650; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.slot-toggle button small { color: var(--faint); font-weight: 500; font-size: 11px; }
.slot-toggle button.active[data-slot="Early"] { border-color: var(--cyan); background: rgba(62, 230, 255, .1); color: var(--cyan); box-shadow: 0 0 0 3px rgba(62, 230, 255, .08); }
.slot-toggle button.active[data-slot="Late"] { border-color: var(--violet); background: rgba(139, 92, 246, .14); color: #c4b1ff; box-shadow: 0 0 0 3px rgba(139, 92, 246, .1); }
.summary-bar .sub { display: block; font: 12px var(--font); color: var(--faint); margin-top: 2px; }
.stream-list { flex: 1; overflow: auto; padding: 8px; }
.stream-item { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; padding: 12px; border-radius: 12px; cursor: pointer; border: 1px solid transparent; }
.stream-item:hover { background: rgba(255, 255, 255, .03); }
.stream-item.selected { border-color: rgba(62, 230, 255, .35); background: rgba(62, 230, 255, .06); }
.date-tile { text-align: center; padding: 8px 0; border-radius: 10px; background: rgba(139, 92, 246, .12); border: 1px solid rgba(139, 92, 246, .3); }
.date-tile .m { font: 700 10px/1 var(--mono); letter-spacing: .14em; color: #b69cff; text-transform: uppercase; }
.date-tile .d { font: 700 22px/1.1 var(--font); }
.stream-item .sv { font: 650 16px var(--mono); color: var(--mint); text-align: right; }
.stream-item .sc { color: var(--muted); font-size: 12px; }
.stream-detail { padding: 20px; display: flex; flex-direction: column; gap: 14px; overflow: auto; }
.bars { display: grid; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 84px 1fr 54px 86px; gap: 12px; align-items: center; }
.bar-track { height: 8px; border-radius: 8px; background: rgba(255, 255, 255, .05); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 8px; background: var(--tc); box-shadow: 0 0 12px var(--tc); }
.bar-row .bc { font: 13px var(--mono); text-align: right; }
.bar-row .bv { font: 600 13px var(--mono); text-align: right; color: var(--muted); }
.big-total { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 16px; border-radius: 12px; background: rgba(0, 0, 0, .25); border: 1px solid var(--line); }
.big-total b { font: 700 24px var(--mono); color: var(--mint); }

/* ---------- settings ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.setting { padding: 22px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.setting p { margin: 0; color: var(--muted); }
.setting-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: var(--cyan);
  background: rgba(62, 230, 255, .08); border: 1px solid rgba(62, 230, 255, .25); }
.setting-icon svg { width: 22px; height: 22px; }
code { font: 12.5px var(--mono); padding: 8px 10px; border-radius: 8px; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); color: var(--cyan); word-break: break-all; align-self: stretch; }
.key-state { font-weight: 600; }
.key-state.ok { color: var(--mint); } .key-state.missing { color: var(--gold); }
.price-groups { padding: 22px; }
.price-groups p { color: var(--muted); margin: 6px 0 16px; }
.group-legend { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.legend { padding: 12px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--tc) 30%, transparent); background: color-mix(in srgb, var(--tc) 6%, transparent); }
.legend .box { margin-bottom: 8px; }
.legend div { font: 12px var(--mono); color: var(--muted); }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 28px; background: rgba(2, 4, 10, .72); backdrop-filter: blur(6px); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.overlay-panel { width: min(1180px, 100%); height: min(820px, 100%); display: flex; flex-direction: column; background: rgba(12, 18, 34, .94); animation: pop .25s ease; }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(10px); } }
.overlay-head { display: flex; align-items: center; gap: 20px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.progress { flex: 1; height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.progress-bar { height: 100%; width: 0; border-radius: 6px; background: linear-gradient(90deg, var(--cyan), var(--violet)); box-shadow: 0 0 14px var(--cyan); transition: width .35s ease; }
.muted { color: var(--muted); }
.review-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 380px 1fr; gap: 26px; padding: 24px; }
.review-left { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.review-left .frame { max-height: 100%; }
.review-right { display: flex; flex-direction: column; gap: 18px; overflow: auto; min-height: 0; padding-right: 4px; }
.question { font-size: 24px; font-weight: 650; line-height: 1.25; }
.question small { display: block; font-size: 14px; color: var(--muted); font-weight: 400; margin-top: 6px; }
.review-done { flex: 1; display: grid; place-content: center; justify-items: center; text-align: center; gap: 12px; }
.check-orb { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; color: var(--mint);
  border: 1px solid rgba(52, 245, 164, .45); box-shadow: 0 0 50px rgba(52, 245, 164, .25), inset 0 0 30px rgba(52, 245, 164, .15); }
.check-orb svg { width: 44px; height: 44px; stroke-width: 2.4; }

/* sort mode */
.sort-tally { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 22px 0; }
.sort-tally .box { height: 30px; }
.sort-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 64px 360px 1fr 64px; align-items: center; gap: 28px; padding: 22px; }
.sort-nav { height: 64px; border-radius: 50%; border: 1px solid var(--line-hi); background: rgba(255, 255, 255, .03); cursor: pointer; display: grid; place-items: center; color: var(--muted); }
.sort-nav:hover { color: var(--cyan); border-color: rgba(62, 230, 255, .5); box-shadow: 0 0 20px rgba(62, 230, 255, .2); }
.sort-nav svg { width: 26px; height: 26px; }
.sort-card { aspect-ratio: 63/88; border-radius: 16px; overflow: hidden; background: #070b16; border: 1px solid var(--line); display: grid; place-items: center; }
.sort-card img { width: 100%; height: 100%; object-fit: contain; }
.sort-noimg { color: var(--faint); }
.sort-info { display: flex; flex-direction: column; gap: 8px; }
.sort-seq { font: 600 13px var(--mono); color: var(--muted); letter-spacing: .1em; }
.sort-box { font: 800 120px/1 var(--font); letter-spacing: -.04em; color: var(--tc, var(--text)); text-shadow: 0 0 40px color-mix(in srgb, var(--tc, #fff) 55%, transparent), 0 0 90px color-mix(in srgb, var(--tc, #fff) 25%, transparent); animation: boxin .22s ease; }
.sort-box.small { font-size: 64px; }
@keyframes boxin { from { opacity: 0; transform: scale(.9); } }
.sort-name { font-size: 22px; font-weight: 650; }
.sort-meta { color: var(--muted); font-size: 15px; }
.sort-foot { padding: 0 22px 18px; text-align: center; font-size: 12px; }

/* modal */
.modal { width: min(620px, 100%); max-height: 100%; overflow: auto; padding: 24px; background: rgba(12, 18, 34, .97); animation: pop .22s ease; display: flex; flex-direction: column; gap: 16px; }
.modal.wide { width: min(860px, 100%); }
.modal p { margin: 0; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 6px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font: 600 10.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.field .input { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-hi); background: rgba(0, 0, 0, .25); }
.field .input:focus-within { border-color: rgba(62, 230, 255, .5); box-shadow: 0 0 0 3px rgba(62, 230, 255, .08); }
.field-row { display: grid; grid-template-columns: 1fr 180px; gap: 12px; }
.steppers { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.steppers .stepper-row { grid-template-columns: 64px 1fr auto; gap: 10px; }
.stepper-row { display: grid; grid-template-columns: 90px 1fr 150px; align-items: center; gap: 14px; padding: 8px 12px; border-radius: 12px; background: rgba(0, 0, 0, .2); border: 1px solid var(--line); }
.stepper-row .avail { color: var(--faint); font-size: 12px; text-align: right; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line-hi); background: rgba(255, 255, 255, .04); cursor: pointer; font-size: 17px; line-height: 1; }
.stepper button:hover { border-color: rgba(62, 230, 255, .5); color: var(--cyan); }
.stepper input { width: 80px; text-align: center; padding: 7px; border-radius: 9px; border: 1px solid var(--line-hi); background: rgba(0, 0, 0, .3); color: var(--text); font: 600 15px var(--mono); outline: 0; }
.stepper input:focus { border-color: rgba(62, 230, 255, .5); }
.stepper input.bad { border-color: var(--rose); color: var(--rose); }
.bw-box { padding: 14px; border-radius: 12px; border: 1px solid rgba(255, 200, 87, .3); background: rgba(255, 200, 87, .05); display: grid; gap: 10px; }
.summary-bar { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-radius: 12px;
  background: linear-gradient(90deg, rgba(62, 230, 255, .09), rgba(139, 92, 246, .09)); border: 1px solid rgba(62, 230, 255, .22); }
.summary-bar b { font: 700 20px var(--mono); }
.error-text { color: var(--rose); font-size: 13px; }
.warn-text { color: var(--gold); font-size: 13px; }
.warn-text:empty, .error-text:empty { display: none; }
.stepper input.over { border-color: rgba(255, 200, 87, .6); color: var(--gold); }
.picklist { max-height: 380px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.pick { display: grid; grid-template-columns: 28px 1fr 80px; gap: 10px; align-items: center; padding: 9px 12px; border-bottom: 1px solid rgba(140, 170, 255, .06); cursor: pointer; }
.pick:hover { background: rgba(255, 255, 255, .03); }
.pick input { accent-color: var(--cyan); width: 16px; height: 16px; }

/* toasts */
.toasts { position: fixed; right: 22px; bottom: 22px; z-index: 80; display: flex; flex-direction: column; gap: 10px; }
.toast { padding: 12px 16px; border-radius: 12px; background: rgba(14, 20, 38, .96); border: 1px solid var(--line-hi); box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  animation: toastin .25s ease; max-width: 380px; display: flex; gap: 10px; align-items: center; }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); flex: none; }
.toast.good::before { background: var(--mint); box-shadow: 0 0 10px var(--mint); }
.toast.bad::before { background: var(--rose); box-shadow: 0 0 10px var(--rose); }
.toast.out { opacity: 0; transform: translateY(6px); transition: all .3s; }
@keyframes toastin { from { opacity: 0; transform: translateY(10px); } }

@media (max-width: 1360px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 360px; }
  .table-head, .row { grid-template-columns: 44px 136px 76px minmax(160px, 1fr) 62px 120px 80px; gap: 8px; }
  .tier-grid { grid-template-columns: repeat(4, 1fr); }
  .inv-head { grid-template-columns: 220px 1fr; }
}

/* ---- Payout & profit ---- */
.stat.good .stat-value { color: var(--mint); text-shadow: 0 0 24px rgba(52, 245, 164, .25); }
.stat.good.loss .stat-value { color: var(--rose); text-shadow: 0 0 24px rgba(255, 92, 138, .25); }
.price.gain, b.gain { color: var(--mint); }
.price.loss, b.loss, .leader-row .lv.loss { color: var(--rose); }
.add-payout { font-weight: 600; font-size: 11px; font-family: inherit; color: var(--cyan); background: rgba(62, 230, 255, .08); border: 1px dashed rgba(62, 230, 255, .45);
  border-radius: 999px; padding: 3px 9px; cursor: pointer; white-space: nowrap; }
.add-payout:hover { background: rgba(62, 230, 255, .16); }
.profit-card { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 14px; border: 1px solid var(--line-hi);
  background: linear-gradient(160deg, rgba(62, 230, 255, .06), rgba(139, 92, 246, .05)); }
.profit-card .field .input input { flex: 1; min-width: 0; font: 600 16px var(--mono); }
.profit-math { display: flex; flex-direction: column; gap: 6px; font: 14px var(--mono); }
.profit-math > div { display: flex; justify-content: space-between; }
.profit-math .k { color: var(--muted); font-family: inherit; }
.profit-math .total { border-top: 1px solid var(--line); padding-top: 8px; font-size: 17px; }
/* ---- Packs (flat cost, not scanned inventory) ---- */
.box.pack, .pack-bar { --tc: #fb923c; }
.steppers .pack-row { grid-column: 1 / -1; grid-template-columns: 64px auto 1fr; }
.steppers .pack-row .avail { text-align: right; }.modal:has(#rsPacks) { gap: 12px; padding: 20px 24px; }
.modal:has(#rsPacks) .bw-box { padding-top: 10px; padding-bottom: 10px; }
/* ---- Cloud upload state ---- */
.cloud-state { padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); }
.cloud-state.synced { color: var(--mint); border-color: rgba(52, 245, 164, .3); }
.cloud-state.uploading, .cloud-state.starting { color: var(--cyan); border-color: rgba(62, 230, 255, .3); }
.cloud-state.offline, .cloud-state.error { color: var(--gold); border-color: rgba(255, 200, 87, .35); }
