:root {
  --ink: #09090d;
  --ink-2: #0f0f15;
  --surface: #14141c;
  --surface-2: #1a1a24;
  --surface-3: #22222e;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --text: #eeedf6;
  --text-2: #a9a8bb;
  --text-3: #6f6e82;
  --good: #3ee08f;
  --good-bg: rgba(62, 224, 143, 0.1);
  --warn: #ffb547;
  --bad: #ff5d6c;
  --game: #ffd23f;
  --game-ink: #1a1400;
  --game-glow: rgba(255, 210, 63, 0.18);
  --foil: conic-gradient(from 200deg at 50% 50%, #7cf7ff, #9a7bff, #ff7ad9, #ffcf6b, #8affc1, #7cf7ff);
  --foil-lin: linear-gradient(100deg, #7cf7ff 0%, #9a7bff 28%, #ff7ad9 52%, #ffcf6b 76%, #8affc1 100%);
  --r: 14px;
  --r-sm: 9px;
  --display: 'Bricolage Grotesque', 'Geist', system-ui, sans-serif;
  --ui: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;
  color-scheme: dark;
}
body[data-game='mtg'] {
  --game: #ff8a4c;
  --game-ink: #1f0b00;
  --game-glow: rgba(255, 138, 76, 0.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--ink);
  color: var(--text);
  font: 14px/1.45 var(--ui);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }

.bg-foil {
  position: fixed; inset: -20% -10% auto auto; width: 70vw; height: 70vw; max-width: 900px; max-height: 900px;
  background: radial-gradient(closest-side, var(--game-glow), transparent 70%);
  filter: blur(40px); pointer-events: none; z-index: 0; transition: background .6s;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 20px;
  padding: 12px clamp(16px, 3vw, 32px);
  background: rgba(9, 9, 13, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark {
  width: 26px; height: 34px; border-radius: 5px; background: var(--foil);
  box-shadow: 0 0 0 1px rgba(255,255,255,.25) inset, 0 6px 20px -6px #9a7bff;
  transform: rotate(-8deg); position: relative; overflow: hidden;
}
.brand-mark::after { content: ''; position: absolute; inset: 4px; border-radius: 3px; border: 1px solid rgba(0,0,0,.35); }
.brand-name { font: 800 21px/1 var(--display); letter-spacing: -0.02em; }
.brand-name span { color: var(--game); transition: color .4s; }
.topbar-actions { margin-left: auto; display: flex; gap: 6px; }

.icon-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px;
  border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text-2);
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--line); }

/* Segmented */
.seg { display: inline-flex; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--text-2); padding: 7px 14px; border-radius: 8px; font-weight: 500;
  transition: background .2s, color .2s; white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button[aria-selected='true'] { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 2px 8px rgba(0,0,0,.35); }
.game-switch button[aria-selected='true'] { background: var(--game); color: var(--game-ink); font-weight: 600; }
.seg.small button { padding: 5px 10px; font-size: 13px; }

/* ---------- Shell ---------- */
.shell { position: relative; z-index: 1; padding: 28px clamp(16px, 3vw, 32px) 80px; max-width: 1680px; margin: 0 auto; }

.search-hero { margin-bottom: 24px; }
.searchbar {
  display: flex; align-items: center; gap: 10px; padding: 8px;
  background: linear-gradient(var(--surface), var(--surface)) padding-box, linear-gradient(120deg, var(--line-2), transparent 40%, var(--line-2)) border-box;
  border: 1px solid transparent; border-radius: 18px;
  box-shadow: 0 30px 60px -30px rgba(0,0,0,.8);
}
.searchbar:focus-within {
  background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--foil-lin) border-box;
}
.query { flex: 1; display: flex; align-items: center; gap: 10px; padding: 0 10px; color: var(--text-3); min-width: 0; }
.query input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 17px; padding: 12px 0; color: var(--text); }
.query input::placeholder { color: var(--text-3); }

.btn-run {
  position: relative; display: inline-flex; align-items: center; gap: 10px;
  height: 48px; padding: 0 26px; border: 0; border-radius: 13px;
  background: var(--game); color: var(--game-ink); font: 700 15px/1 var(--display); letter-spacing: .01em;
  transition: transform .15s, box-shadow .2s, background .3s;
  box-shadow: 0 10px 30px -10px var(--game);
}
.btn-run:hover { transform: translateY(-1px); }
.btn-run:active { transform: translateY(0); }
.run-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .35; }
body.running .btn-run { background: var(--surface-3); color: var(--text); box-shadow: none; }
body.running .run-dot { background: var(--bad); opacity: 1; animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.6); opacity: .4; } }

.saved-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; min-height: 28px; flex-wrap: wrap; }
.saved-list { display: flex; gap: 6px; flex-wrap: wrap; }
.saved-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 11px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font-size: 12.5px;
}
.saved-chip button { border: 0; background: none; color: inherit; padding: 0; }
.saved-chip .x { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; color: var(--text-3); }
.saved-chip .x:hover { background: var(--surface-3); color: var(--text); }
.saved-chip:hover { border-color: var(--line-2); color: var(--text); }
.saved-chip i { font-style: normal; color: var(--game); font-size: 10px; }
.link-btn { border: 0; background: none; color: var(--text-3); padding: 4px 0; font-size: 13px; }
.link-btn:hover { color: var(--text); }

.layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 24px; align-items: start; }

/* ---------- Filters ---------- */
.filters {
  position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto;
  background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 18px 6px;
  scrollbar-width: thin;
}
.filter-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.filter-head h2 { font: 700 16px var(--display); margin: 0; }
fieldset { border: 0; padding: 14px 0; margin: 0; border-top: 1px solid var(--line); display: grid; gap: 9px; }
fieldset:first-of-type { border-top: 0; }
legend { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 600; padding: 0; margin-bottom: 9px; float: left; width: 100%; }
fieldset.hl legend { color: var(--game); }
.range { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; color: var(--text-3); }
input[type='number'], input[type='text'], textarea, select {
  width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 8px 10px; outline: 0; transition: border-color .15s, background .15s;
  font-family: var(--mono); font-size: 13px;
}
textarea { resize: vertical; font-family: var(--ui); }
input:focus, textarea:focus, select:focus { border-color: var(--game); background: var(--surface-2); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
.hint { margin: 0; color: var(--text-3); font-size: 12px; line-height: 1.5; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { border: 1px solid var(--line); background: var(--surface); color: var(--text-2); padding: 4px 10px; border-radius: 99px; font: 500 12px var(--mono); }
.chips button:hover, .chips button.on { border-color: var(--game); color: var(--game); }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text-2); }
.check input { accent-color: var(--game); }
.inline { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.inline input { width: 80px; }
.stack { display: grid; gap: 6px; font-size: 13px; color: var(--text-2); }
.stack small { color: var(--text-3); }

.switch { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--text-2); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { width: 32px; height: 19px; border-radius: 99px; background: var(--surface-3); position: relative; flex: none; transition: background .2s; border: 1px solid var(--line); }
.switch span::after { content: ''; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: var(--text-2); transition: transform .2s, background .2s; }
.switch input:checked + span { background: var(--game); border-color: transparent; }
.switch input:checked + span::after { transform: translateX(13px); background: var(--game-ink); }
.switch input:focus-visible + span { outline: 2px solid var(--game); outline-offset: 2px; }
.switch:hover { color: var(--text); }
.switch.compact { font-size: 13px; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat {
  position: relative; padding: 14px 16px 13px; background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden;
}
.stat .k { font-size: 11.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .07em; font-weight: 600; display: flex; gap: 6px; align-items: center; }
.stat .v { font: 600 24px/1.15 var(--mono); letter-spacing: -0.03em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 12px; color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.accent { background: linear-gradient(160deg, var(--game-glow), transparent 60%), var(--ink-2); border-color: color-mix(in srgb, var(--game) 30%, transparent); }
.stat.accent .v { color: var(--game); }
.stat.sell .v { color: #9fd0ff; }
.stat.buy .v { color: var(--good); }
.stat .tip { cursor: help; width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--text-3); font-size: 9px; display: inline-grid; place-items: center; text-transform: none; }
.stat.flash { animation: flash .5s; }
@keyframes flash { 0% { border-color: var(--game); } 100% { border-color: var(--line); } }

.sources { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.src-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 10px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; color: var(--text-2); max-width: 100%;
  transition: opacity .2s, border-color .2s;
}
.src-pill b { color: var(--text); font-weight: 600; }
.src-pill .msg { color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 340px; }
.src-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none; }
.src-pill[data-state='running'] .dot { background: var(--game); animation: pulse 1s infinite; }
.src-pill[data-state='done'] .dot { background: var(--good); }
.src-pill[data-state='error'] .dot { background: var(--bad); }
.src-pill[data-state='error'] { border-color: rgba(255,93,108,.35); }
.src-pill[data-state='skipped'] { opacity: .55; }
.src-pill.off { opacity: .4; text-decoration: line-through; }
.src-pill button { all: unset; cursor: pointer; display: contents; }

.deeplinks { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: -4px 0 16px; }
.deeplinks:empty { display: none; }
.dl-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 600; margin-right: 4px; }
.dl {
  display: inline-flex; align-items: center; height: 28px; padding: 0 11px; border-radius: 8px; font-size: 12.5px; text-decoration: none;
  color: var(--text-2); border: 1px dashed var(--line-2); transition: color .15s, border-color .15s, background .15s;
}
.dl:hover { color: var(--text); border-style: solid; border-color: var(--game); background: var(--game-glow); }
.chips.bulk-types button { font-family: var(--ui); font-size: 12.5px; }
.link-list { display: grid; gap: 8px; }
.link-list small { color: var(--text-3); }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.quick { flex: 1 1 220px; display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 38px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; color: var(--text-3); }
.quick input { flex: 1; border: 0; outline: 0; background: none; color: var(--text); min-width: 0; }
.toolbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.select { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 13px; }
.select select { width: auto; font-family: var(--ui); height: 38px; padding: 0 10px; }
.ghost-btn { height: 38px; padding: 0 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font: 500 13px var(--mono); }
.ghost-btn:hover { color: var(--text); border-color: var(--line-2); }

/* ---------- Empty ---------- */
.empty { text-align: center; padding: 70px 20px; color: var(--text-2); }
.empty h3 { font: 700 26px var(--display); color: var(--text); margin: 26px 0 8px; letter-spacing: -0.02em; }
.empty p { max-width: 440px; margin: 0 auto; color: var(--text-3); }
.empty-card { position: relative; width: 120px; height: 120px; margin: 0 auto; }
.empty-card span { position: absolute; left: 34px; top: 4px; width: 62px; height: 86px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--surface); transform-origin: 50% 120%; }
.empty-card span:nth-child(1) { transform: rotate(-14deg); }
.empty-card span:nth-child(2) { transform: rotate(0deg); background: var(--surface-2); }
.empty-card span:nth-child(3) { transform: rotate(14deg); background: var(--foil); opacity: .9; border-color: transparent; animation: fan 4s ease-in-out infinite; }
@keyframes fan { 50% { transform: rotate(18deg) translateY(-4px); } }
body.running .empty-card span { animation: shuffle 1.2s ease-in-out infinite; }
body.running .empty-card span:nth-child(2) { animation-delay: .15s; }
body.running .empty-card span:nth-child(3) { animation-delay: .3s; }
@keyframes shuffle { 50% { transform: translateY(-10px) rotate(0); } }

/* ---------- Grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 14px; }
.card {
  position: relative; display: flex; flex-direction: column; background: var(--ink-2); border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden; transition: border-color .2s, transform .2s, box-shadow .2s;
  animation: enter .45s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes enter { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.card:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: 0 24px 40px -24px rgba(0,0,0,.9); }
.card.is-deal { border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.card.is-flip::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; background: var(--foil-lin);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none; z-index: 3;
}
.thumb { position: relative; aspect-ratio: 4 / 3; background: var(--surface); overflow: hidden; display: block; }
.card[data-kind='market'] .thumb { aspect-ratio: 4 / 3.4; background: radial-gradient(circle at 50% 40%, var(--surface-3), var(--surface)); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s; }
.card[data-kind='market'] .thumb img { object-fit: contain; padding: 12px; filter: drop-shadow(0 10px 18px rgba(0,0,0,.6)); }
.card:hover .thumb img { transform: scale(1.04); }
.thumb .noimg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); font-size: 12px; }
.tags { position: absolute; left: 8px; top: 8px; right: 8px; display: flex; gap: 5px; flex-wrap: wrap; z-index: 2; }
.tag { padding: 3px 7px; border-radius: 6px; font: 600 10.5px/1.3 var(--ui); letter-spacing: .02em; background: rgba(9,9,13,.78); backdrop-filter: blur(6px); color: var(--text); border: 1px solid rgba(255,255,255,.08); }
.tag.direct { color: var(--good); }
.tag.auction { color: var(--warn); }
.tag.offer { color: #9fd0ff; }
.tag.new { background: var(--game); color: var(--game-ink); border-color: transparent; }
.tag.flip { background: var(--foil-lin); color: #111; border-color: transparent; }
.tag.deal { background: var(--good); color: #04220f; border-color: transparent; }

.body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.src { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--text-3); }
.src .s-name { font-weight: 600; color: var(--text-2); }
.title { font-weight: 500; font-size: 13.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; text-decoration: none; }
.title:hover { color: var(--game); }
.sub { font-size: 12px; color: var(--text-3); margin-top: -4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prices { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: auto; }
.pc { font: 600 21px/1 var(--mono); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.pc small { font: 500 11px var(--ui); color: var(--text-3); letter-spacing: 0; margin-left: 3px; }
.tot { text-align: right; font: 500 12px/1.35 var(--mono); color: var(--text-2); font-variant-numeric: tabular-nums; }
.tot span { display: block; color: var(--text-3); font-size: 11px; }

.meter { position: relative; height: 5px; border-radius: 99px; background: var(--surface-3); margin-top: 2px; }
.meter i { position: absolute; top: -3px; width: 2px; height: 11px; border-radius: 2px; }
.meter i.buy { background: var(--good); }
.meter i.sell { background: #9fd0ff; }
.meter b { position: absolute; top: -4px; width: 13px; height: 13px; margin-left: -6.5px; border-radius: 50%; background: var(--text); border: 3px solid var(--ink-2); box-shadow: 0 0 0 1px var(--line-2); }
.meter-legend { display: flex; justify-content: space-between; font: 500 11px var(--mono); color: var(--text-3); }
.meter-legend .d { color: var(--good); font-weight: 600; }
.meter-legend .d.neg { color: var(--bad); }

.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.buy-btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; border-radius: 9px;
  background: var(--surface-3); border: 1px solid var(--line-2); text-decoration: none; font-weight: 600; font-size: 13px;
  transition: background .15s, color .15s;
}
.buy-btn:hover { background: var(--game); color: var(--game-ink); border-color: transparent; }
.buy-btn svg { width: 14px; height: 14px; }
.alt-link { display: inline-flex; align-items: center; height: 34px; padding: 0 9px; border-radius: 9px; border: 1px solid var(--line); text-decoration: none; font-size: 11.5px; color: var(--text-2); white-space: nowrap; }
.alt-link:hover { color: var(--text); border-color: var(--line-2); }
.alt-link em { font-style: normal; font-family: var(--mono); color: var(--text-3); margin-left: 5px; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--ink-2); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--ink-2); white-space: nowrap; }
td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:hover td { background: var(--surface); }
td.r, th.r { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
td img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; display: block; background: var(--surface); }
td .t { max-width: 460px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
td .t:hover { color: var(--game); }
td .good { color: var(--good); } td .badv { color: var(--bad); }
td a.go { color: var(--text-2); text-decoration: none; font-weight: 600; }
td a.go:hover { color: var(--game); }

/* ---------- Drawer ---------- */
.drawer { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.5); opacity: 0; transition: opacity .25s; backdrop-filter: blur(2px); }
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); background: var(--ink-2); border-left: 1px solid var(--line);
  transform: translateX(100%); transition: transform .3s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column;
}
.drawer.open { pointer-events: auto; }
.drawer.open .drawer-backdrop { opacity: 1; }
.drawer.open .drawer-panel { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font: 700 20px var(--display); letter-spacing: -0.02em; }
.drawer-body { padding: 8px 22px 40px; overflow: auto; }
.drawer-body section { padding: 16px 0; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.drawer-body h3 { margin: 0 0 2px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 14px; font-size: 13.5px; color: var(--text-2); }
.row input, .row select { width: 130px; flex: none; }

.market-list { display: grid; gap: 8px; }
.market { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; padding: 12px; border-radius: 11px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; }
.market:hover { border-color: var(--line-2); }
.market .switch { grid-row: span 2; }
.market .name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.market .note { font-size: 12px; color: var(--text-3); }
.badge { font: 600 10px var(--ui); padding: 2px 6px; border-radius: 5px; text-transform: uppercase; letter-spacing: .05em; }
.badge.ok { background: var(--good-bg); color: var(--good); }
.badge.no { background: rgba(255,93,108,.12); color: var(--bad); }
.badge.load { background: rgba(255,181,71,.12); color: var(--warn); }
.sys-status { font: 12px/1.7 var(--mono); color: var(--text-3); }

/* Planner */
.planner-form { display: grid; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.plan-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; }
.plan-sum div { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.plan-sum span { display: block; font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.plan-sum b { font: 600 18px var(--mono); }
.plan-sum .accent b { color: var(--game); }
.plan-list { display: grid; gap: 6px; }
.plan-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 9px 11px; border-radius: 9px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; font-size: 13px; }
.plan-item:hover { border-color: var(--game); }
.plan-item .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-item .m { font: 12px var(--mono); color: var(--text-3); }
.plan-item .r { text-align: right; font-family: var(--mono); }

/* Toasts */
.toast-stack { position: fixed; bottom: 20px; right: 20px; z-index: 60; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 40px)); }
.toast { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); box-shadow: 0 20px 40px -20px #000; font-size: 13px; animation: enter .3s both; }
.toast.deal { border-color: var(--good); }
.toast a { color: var(--game); }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .filters { position: static; max-height: none; }
  .filters:not(.open) fieldset:not(.hl):not(:first-of-type) { display: none; }
  .icon-btn span { display: none; }
}
@media (max-width: 640px) {
  .topbar { gap: 10px; }
  .brand-name { display: none; }
  .searchbar { flex-wrap: wrap; }
  .mode-switch { width: 100%; }
  .mode-switch button { flex: 1; }
  .btn-run { flex: 1; justify-content: center; }
  .query { flex-basis: 100%; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat .v { font-size: 19px; }
  .row input, .row select { width: 110px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
