/* Poké Ops — dark, phone-first. Display numbers in Barlow Condensed, everything else Inter. */
:root {
  --bg: #0b0d12;
  --panel: #141824;
  --panel-2: #1b2030;
  --line: #262c3d;
  --text: #e8ecf5;
  --muted: #8b93a7;
  --accent: #ffcb05;
  --accent-ink: #1a1400;
  --blue: #4d8dff;
  --green: #3ddc84;
  --green-ink: #06301a;
  --red: #ff5d5d;
  --red-ink: #3a0a0a;
  --orange: #ffa53d;
  --radius: 12px;
  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --body: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--body);
  padding-bottom: env(safe-area-inset-bottom);
}
body.modal-open { overflow: hidden; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--display); letter-spacing: .01em; margin: 0; line-height: 1.1; }
h1 { font-size: 30px; font-weight: 800; }
h2 { font-size: 20px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
h3 { font-size: 22px; font-weight: 700; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.error { color: var(--red); }
.neg { color: var(--red); }
.pos .stat-n { color: var(--green); }
.boot { padding: 40px; text-align: center; color: var(--muted); }
small { font-size: 12px; }

/* ---- shell ---- */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: rgba(11, 13, 18, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.wordmark { font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: .04em; color: var(--text); }
.wordmark span { color: var(--accent); }
.wordmark.big { font-size: 44px; }
.wordmark:hover { text-decoration: none; }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 8px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; white-space: nowrap; font-size: 14px;
}
.nav a:hover { color: var(--text); text-decoration: none; background: var(--panel); }
.nav a.active { color: var(--accent-ink); background: var(--accent); }
#view { max-width: 1100px; margin: 0 auto; padding: 18px 16px 80px; }
body.runner-mode .top { display: none; }
body.runner-mode #view { max-width: none; padding: 0; }

/* ---- login ---- */
.login { max-width: 360px; margin: 14vh auto 0; padding: 0 20px; text-align: center; }
.login form { display: grid; gap: 10px; margin-top: 24px; }

/* ---- buttons & inputs ---- */
.btn, button.btn {
  appearance: none; border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  font: 600 14px/1 var(--body); padding: 11px 14px; border-radius: 10px; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; text-decoration: none;
}
.btn:hover { background: #222840; text-decoration: none; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: #ffd83d; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: rgba(255, 93, 93, .35); }
.btn.danger:not(.ghost) { background: var(--red); color: #fff; }
.btn.small { padding: 7px 10px; min-height: 32px; font-size: 13px; }
.btn.big { min-height: 60px; font-family: var(--display); font-size: 24px; font-weight: 800; letter-spacing: .04em; border-radius: 14px; }
.btn.sold { background: var(--green); color: var(--green-ink); border-color: var(--green); }
.btn.pass { background: var(--red); color: #fff; border-color: var(--red); }
.btn.nav-btn { background: var(--panel); min-width: 54px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
button.icon {
  appearance: none; background: transparent; border: 0; color: var(--muted); font-size: 16px; cursor: pointer;
  width: 36px; height: 36px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
}
button.icon:hover { background: var(--panel-2); color: var(--text); }
button.link { appearance: none; background: none; border: 0; color: var(--blue); cursor: pointer; font: inherit; padding: 0; }
button.link:hover { text-decoration: underline; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; min-height: 42px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
input.short { width: 80px; }
textarea { resize: vertical; }
select.inline-select { width: auto; }
label.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
label.field > input, label.field > select, label.field > textarea { color: var(--text); }
label.check { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.form { display: grid; }
.actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.actions .muted { margin-right: auto; }
.search-form { display: grid; grid-template-columns: 1fr 80px auto; gap: 8px; margin-bottom: 12px; }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1fr; gap: 8px; margin: 12px 0; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 14px 0; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; margin: 10px 0 14px; }
.seg button { appearance: none; border: 0; background: transparent; color: var(--muted); font: 600 13px var(--body); padding: 7px 12px; border-radius: 8px; cursor: pointer; }
.seg button.active { background: var(--panel-2); color: var(--text); }
pre.help { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; color: var(--muted); overflow-x: auto; margin: 0 0 10px; }
.drop { display: block; border: 2px dashed var(--line); border-radius: var(--radius); padding: 26px; text-align: center; color: var(--muted); cursor: pointer; margin: 14px 0; }
.drop:hover { border-color: var(--accent); color: var(--text); }

/* ---- blocks & stats ---- */
.block { margin: 22px 0; }
.block-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 6px 0 18px; }
.stat {
  display: grid; gap: 2px; padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--text); text-decoration: none;
}
.stat:hover { text-decoration: none; border-color: #354064; }
.stat-n { font-family: var(--display); font-size: 30px; font-weight: 800; line-height: 1; }
.stat-l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.notice { background: rgba(255, 203, 5, .1); border: 1px solid rgba(255, 203, 5, .35); border-radius: 10px; padding: 10px 12px; }
.empty { color: var(--muted); padding: 22px 12px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }
.totals { margin: 4px 0 10px; }

/* ---- lists & rows ---- */
.list { display: grid; gap: 6px; }
.list.compact { max-height: 55vh; overflow: auto; padding-right: 2px; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--text); text-align: left; width: 100%; font: inherit; cursor: pointer;
}
.row:hover { border-color: #354064; text-decoration: none; }
.row-main { display: grid; gap: 2px; flex: 1; min-width: 0; color: var(--text); text-decoration: none; }
.row-main > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-side { display: grid; gap: 0; text-align: right; font-size: 12px; }
.row-price { font-family: var(--display); font-size: 22px; font-weight: 700; }
.pills { display: flex; gap: 4px; flex-wrap: wrap; }
.stream-row .bar { display: block; height: 4px; background: var(--panel-2); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); }
.pick-row { cursor: pointer; }
.thumb { width: 44px; height: 61px; object-fit: contain; border-radius: 4px; background: var(--panel-2); flex: none; }
.thumb.xs { width: 30px; height: 42px; }
.thumb.lg { width: 180px; height: 251px; }
.thumb.ph { display: flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 700; }
.thumb.xl { width: 100%; height: 100%; font-size: 60px; }

/* ---- pills ---- */
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: 999px; background: var(--panel-2); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; line-height: 1.2; }
.pill.cond-NM { background: rgba(61, 220, 132, .18); color: var(--green); }
.pill.cond-LP { background: rgba(77, 141, 255, .18); color: var(--blue); }
.pill.cond-MP { background: rgba(255, 203, 5, .18); color: var(--accent); }
.pill.cond-HP { background: rgba(255, 165, 61, .18); color: var(--orange); }
.pill.cond-DMG { background: rgba(255, 93, 93, .18); color: var(--red); }
.pill.st-sold, .pill.st-shipped, .pill.st-done { background: rgba(61, 220, 132, .18); color: var(--green); }
.pill.st-queued, .pill.st-live, .pill.st-packed { background: rgba(255, 203, 5, .18); color: var(--accent); }
.pill.st-passed, .pill.st-removed { background: rgba(255, 93, 93, .18); color: var(--red); }
.pill.st-skipped, .pill.st-pending, .pill.st-planned, .pill.st-in_stock { background: var(--panel-2); color: var(--muted); }
.pill.stale { background: rgba(255, 165, 61, .18); color: var(--orange); }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td { font-weight: 700; border-top: 2px solid var(--line); }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table.small { font-size: 12px; }
.table.small td, .table.small th { padding: 5px 8px; white-space: nowrap; }
.table td.empty { border: 0; }
.run-table input.pos { width: 64px; padding: 6px 8px; min-height: 36px; text-align: center; font-weight: 700; }
.run-table tr.st-sold td { background: rgba(61, 220, 132, .05); }
.run-table tr.st-passed td { opacity: .7; }
.bulk-table td.pos { font-family: var(--display); font-size: 20px; font-weight: 700; }
.bulk-table tr.unmatched td { background: rgba(255, 93, 93, .06); }
.bulk-table select { max-width: 420px; margin-top: 4px; }
.bk-q { display: flex; gap: 6px; }
.bk-q input { max-width: 300px; min-height: 34px; padding: 6px 10px; }

/* ---- orders ---- */
.order { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; }
.order.st-shipped { opacity: .75; }
.order-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.order-items { list-style: none; margin: 0; padding: 4px 14px; }
.order-items li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.order-items li:last-child { border-bottom: 0; }
.order-items .pos { font-family: var(--display); font-weight: 700; font-size: 18px; min-width: 36px; color: var(--accent); }
.order-items .row-price { font-size: 18px; }
.order-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; font-size: 13px; }

/* ---- modals ---- */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .6); display: flex; align-items: flex-end; justify-content: center; padding: 0; }
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px 16px 0 0; width: 100%; max-width: 560px;
  max-height: 92vh; overflow: auto; padding: 16px; box-shadow: 0 -10px 40px rgba(0, 0, 0, .5);
}
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.confirm-msg { font-size: 16px; padding: 8px 0; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.result {
  appearance: none; display: grid; gap: 2px; padding: 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); text-align: left; cursor: pointer; font: inherit;
}
.result:hover { border-color: var(--accent); }
.result img { width: 100%; aspect-ratio: 63/88; object-fit: contain; border-radius: 6px; background: var(--bg); }
.result .r-name { font-weight: 700; font-size: 14px; }
.result .r-set, .result .r-meta { color: var(--muted); font-size: 12px; }
.result .r-price { font-family: var(--display); font-size: 20px; font-weight: 700; }
.result .r-price small { font-family: var(--body); font-weight: 500; color: var(--muted); font-size: 11px; }
.confirm-card { display: grid; grid-template-columns: 200px 1fr; gap: 16px; align-items: start; }
.confirm-card img { width: 100%; border-radius: 10px; background: var(--bg); }
.price-line { margin: 4px 0 12px; }

/* ---- toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; box-shadow: 0 8px 30px rgba(0, 0, 0, .5); max-width: 90vw;
}
.toast.error { background: var(--red); color: #fff; }

/* ---- runner ---- */
.runner { display: flex; flex-direction: column; min-height: 100dvh; background: var(--bg); }
.r-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
  padding-top: calc(10px + env(safe-area-inset-top));
}
.r-title { font-family: var(--display); font-size: 20px; font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-title strong { font-size: 26px; color: var(--accent); }
.r-counts { display: flex; gap: 10px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.c-sold { color: var(--green); } .c-pass { color: var(--red); } .c-left { color: var(--muted); } .c-gross { color: var(--accent); }
.r-jump { display: flex; gap: 4px; }
.r-jump input { width: 64px; min-height: 34px; padding: 6px 8px; text-align: center; }
.r-stage { flex: 1; display: grid; grid-template-columns: minmax(280px, 420px) 1fr; gap: 20px; padding: 18px; align-items: start; }
.r-img { aspect-ratio: 63/88; display: flex; align-items: center; justify-content: center; }
.r-img img { width: 100%; height: 100%; object-fit: contain; border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.r-info { display: grid; gap: 8px; align-content: start; }
.r-head-row { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.r-num { font-family: var(--display); font-size: 56px; font-weight: 800; color: var(--accent); line-height: 1; }
.r-name { font-size: 40px; }
.r-set { color: var(--muted); font-size: 15px; }
.r-pills { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.r-price { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; gap: 10px; margin-top: 6px; }
.r-price .l { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.r-price-main .n { font-family: var(--display); font-size: 58px; font-weight: 800; line-height: 1; color: var(--green); }
.r-price-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.r-price-grid > div span:last-child { font-family: var(--display); font-size: 22px; font-weight: 700; }
.r-price-meta { color: var(--muted); font-size: 12px; margin: 0; }
.r-sale { background: rgba(61, 220, 132, .12); border: 1px solid rgba(61, 220, 132, .35); border-radius: 10px; padding: 10px 12px; margin: 0; }
.r-next { margin: 0; }
.r-sold-form {
  position: sticky; bottom: 0; display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 8px; align-items: end; padding: 12px;
  background: var(--panel); border-top: 1px solid var(--line);
}
.r-sold-form label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.r-sold-form input { font-size: 20px; font-weight: 700; min-height: 52px; }
.r-sold-form .btn { min-height: 52px; }
.r-actions {
  position: sticky; bottom: 0; display: grid; grid-template-columns: auto 1fr 1fr 1fr auto; gap: 8px; padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom)); background: rgba(11, 13, 18, .95); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
}
.r-actions:has(#r-reopen2) { grid-template-columns: auto 1fr auto; }

/* ---- responsive ---- */
@media (max-width: 860px) {
  .r-stage { grid-template-columns: 1fr; gap: 10px; padding: 10px 12px; }
  .r-img { max-height: 30vh; margin: 0 auto; }
  .r-num { font-size: 34px; }
  .r-name { font-size: 28px; }
  .r-set { font-size: 13px; }
  .r-price { padding: 10px 12px; gap: 6px; }
  .r-price-main .n { font-size: 44px; }
  .r-price-grid > div span:last-child { font-size: 18px; }
  .confirm-card { grid-template-columns: 1fr; }
  .confirm-card img { max-width: 220px; margin: 0 auto; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters input { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  /* backdrop-filter would turn .top into the containing block for the fixed nav, so drop it here */
  .top { padding: 8px 10px; backdrop-filter: none; background: var(--bg); justify-content: space-between; }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: rgba(11, 13, 18, .96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); gap: 0; }
  .nav a { flex: 1; text-align: center; padding: 8px 4px; font-size: 12px; border-radius: 8px; min-width: 52px; }
  body.runner-mode .nav { display: none; }
  #view { padding: 14px 12px 90px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat-n { font-size: 26px; }
  h1 { font-size: 26px; }
  .search-form { grid-template-columns: 1fr 70px; }
  .search-form .btn { grid-column: 1 / -1; }
  .row-side { display: none; }
  .row .row-price { font-size: 18px; }
  .r-head { gap: 6px; }
  .r-counts { width: 100%; justify-content: space-between; order: 3; }
  .r-sold-form { grid-template-columns: 1fr 1fr; }
  .r-sold-form .btn { grid-column: span 1; }
  .r-actions { grid-template-columns: 54px 1fr 1fr 1fr 54px; gap: 6px; }
  .btn.big { font-size: 20px; min-height: 58px; padding: 8px; }
  .modal { padding: 14px; max-height: 94vh; }
  .order-head, .order-foot { padding: 10px; }
  .order-items { padding: 4px 10px; }
  .order-items .row-main > * { white-space: normal; }
}
@media (min-width: 721px) {
  .modal-backdrop { align-items: center; padding: 20px; }
  .modal { border-radius: 16px; }
}
