/* Wuoshi Broker — self-contained dark theme, no external assets. */
:root {
  --bg: #0f1014;
  --bg-raise: #171922;
  --bg-raise-2: #1e212d;
  --bg-inset: #0b0c10;
  --line: #2a2e3c;
  --line-soft: #222534;
  --text: #e7e9ef;
  --text-dim: #9aa0b4;
  --text-faint: #6b7187;
  --accent: #f2c14e;      /* broker gold */
  --accent-dim: #c79a2f;
  --accent-soft: rgba(242, 193, 78, 0.12);
  --link: #7fb4ff;
  --band: rgba(242, 193, 78, 0.14);
  --avg-line: #f2c14e;
  --lo-line: #63d6a0;
  --hi-line: #e8795a;
  --danger: #e8795a;

  /* coin colors */
  --coin-plat: #dfe3ea;
  --coin-gold: #f2c14e;
  --coin-silver: #b9c0cf;
  --coin-copper: #cf8b5a;

  --radius: 10px;
  --maxw: 1180px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  padding: 12px 20px;
  background: linear-gradient(180deg, #14161e, #101118);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-coin {
  color: var(--accent); font-size: 22px; line-height: 1;
  text-shadow: 0 0 12px rgba(242,193,78,.5);
}
.brand-name { font-size: 18px; letter-spacing: .3px; }
.brand-sub { color: var(--accent); margin-left: 2px; }
.quicksearch { flex: 1; max-width: 520px; }
.quicksearch input {
  width: 100%; padding: 9px 14px; border-radius: 999px;
  background: var(--bg-inset); border: 1px solid var(--line);
  color: var(--text); font-size: 14px;
}
.quicksearch input:focus { outline: none; border-color: var(--accent-dim); box-shadow: 0 0 0 3px var(--accent-soft); }
.topbar-meta { color: var(--text-faint); font-size: 12px; text-align: right; white-space: nowrap; }

/* ---------- layout ---------- */
.view { flex: 1; width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 22px 20px 40px; }
.loading { color: var(--text-dim); padding: 60px 0; text-align: center; }
.footer {
  border-top: 1px solid var(--line); color: var(--text-faint); font-size: 12px;
  padding: 16px 20px; display: flex; flex-direction: column; gap: 4px;
  max-width: var(--maxw); margin: 0 auto; width: 100%;
}

/* ---------- filters ---------- */
.filters {
  display: grid; gap: 14px; align-items: end;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  background: var(--bg-raise); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 18px;
}
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-faint); }
.field .pair { display: flex; gap: 6px; align-items: center; }
.field .pair span { color: var(--text-faint); }
.filters input {
  width: 100%; padding: 8px 10px; border-radius: 8px;
  background: var(--bg-inset); border: 1px solid var(--line); color: var(--text); font-size: 14px;
}
.filters input:focus { outline: none; border-color: var(--accent-dim); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn {
  padding: 9px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg-raise-2); color: var(--text-dim); font-size: 13px; cursor: pointer;
}
.btn:hover { color: var(--text); border-color: var(--accent-dim); }

/* ---------- results ---------- */
.results-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 10px; gap: 12px; flex-wrap: wrap;
}
.results-count { color: var(--text-dim); font-size: 13px; }
.results-count b { color: var(--text); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table.items { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
table.items thead th {
  position: sticky; top: 0; background: var(--bg-raise-2); color: var(--text-dim);
  text-align: left; font-weight: 600; font-size: 12px; letter-spacing: .4px;
  padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none;
}
table.items thead th.num { text-align: right; }
table.items thead th .arrow { color: var(--accent); margin-left: 4px; font-size: 10px; }
table.items tbody td { padding: 9px 14px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
table.items tbody tr { cursor: pointer; }
table.items tbody tr:hover { background: var(--accent-soft); }
table.items tbody tr:last-child td { border-bottom: none; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.name a { color: var(--text); font-weight: 600; }
td.name a:hover { color: var(--accent); text-decoration: none; }
.lvl-chip {
  display: inline-block; min-width: 26px; text-align: center; padding: 1px 7px; border-radius: 999px;
  background: var(--bg-raise-2); border: 1px solid var(--line); color: var(--text-dim); font-size: 12px;
}

/* ---------- coins ---------- */
.coins { font-variant-numeric: tabular-nums; white-space: nowrap; }
.coin { margin-left: 1px; }
.coin b { font-weight: 700; }
.coin.p b { color: var(--coin-plat); } .coin.p i { color: var(--coin-plat); }
.coin.g b { color: var(--coin-gold); } .coin.g i { color: var(--coin-gold); }
.coin.s b { color: var(--coin-silver); } .coin.s i { color: var(--coin-silver); }
.coin.c b { color: var(--coin-copper); } .coin.c i { color: var(--coin-copper); }
.coin i { font-style: normal; font-size: .82em; margin-left: 1px; opacity: .8; }
.coins .muted { color: var(--text-faint); }

/* ---------- pager ---------- */
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 16px; color: var(--text-dim); font-size: 13px; }
.pager button { min-width: 34px; }
.pager button[disabled] { opacity: .4; cursor: default; }

/* ---------- empty / error ---------- */
.notice { text-align: center; color: var(--text-dim); padding: 50px 20px; }
.notice .big { font-size: 17px; color: var(--text); margin-bottom: 6px; }

/* ---------- detail page ---------- */
.backlink { display: inline-block; color: var(--text-dim); margin-bottom: 14px; font-size: 13px; }
.detail-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; margin-bottom: 4px; }
.detail-head h1 { font-size: 26px; margin: 0; }
.detail-sub { color: var(--text-dim); font-size: 13px; margin-bottom: 20px; }

.stat-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 22px; }
.stat {
  background: var(--bg-raise); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; min-width: 130px; flex: 1;
}
.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-faint); margin-bottom: 6px; }
.stat .v { font-size: 17px; }
.stat.accent { border-color: var(--accent-dim); }

.card {
  background: var(--bg-raise); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 22px;
}
.card h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-dim); margin: 0 0 14px; }

/* chart */
.chart-wrap { width: 100%; position: relative; }
svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid line { stroke: var(--line-soft); stroke-width: 1; }
.chart .axis text { fill: var(--text-faint); font-size: 11px; }
.chart .band { fill: var(--band); stroke: none; }
.chart .line-avg { fill: none; stroke: var(--avg-line); stroke-width: 2.25; }
.chart .line-lo { fill: none; stroke: var(--lo-line); stroke-width: 1.25; stroke-dasharray: 4 3; opacity: .8; }
.chart .line-hi { fill: none; stroke: var(--hi-line); stroke-width: 1.25; stroke-dasharray: 4 3; opacity: .8; }
.chart .dot { fill: var(--avg-line); stroke: var(--bg-raise); stroke-width: 1.5; }
.chart .hoverline { stroke: var(--accent); stroke-width: 1; opacity: .5; }
.chart .hoverdot { fill: var(--accent); stroke: var(--bg); stroke-width: 2; }
.chart-legend { display: flex; gap: 18px; margin-top: 10px; font-size: 12px; color: var(--text-dim); flex-wrap: wrap; }
.chart-legend .swatch { display: inline-block; width: 18px; height: 0; border-top-width: 3px; border-top-style: solid; vertical-align: middle; margin-right: 6px; }
.sw-avg { border-color: var(--avg-line); }
.sw-lo { border-color: var(--lo-line); border-top-style: dashed; }
.sw-hi { border-color: var(--hi-line); border-top-style: dashed; }
.sw-band { border: none; background: var(--band); width: 18px; height: 12px; display: inline-block; vertical-align: middle; margin-right: 6px; border-radius: 2px; }

.chart-tip {
  position: absolute; pointer-events: none; z-index: 5; transform: translate(-50%, -100%);
  background: var(--bg-inset); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font-size: 12px; white-space: nowrap; box-shadow: 0 6px 20px rgba(0,0,0,.45);
  display: none;
}
.chart-tip .tip-date { color: var(--text-dim); margin-bottom: 5px; }
.chart-tip .tip-row { display: flex; justify-content: space-between; gap: 14px; }
.chart-tip .tip-row span:first-child { color: var(--text-faint); }

/* listings table */
table.listings { width: 100%; border-collapse: collapse; font-size: 14px; }
table.listings th { text-align: left; color: var(--text-faint); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; padding: 0 12px 8px; }
table.listings th.num { text-align: right; }
table.listings td { padding: 8px 12px; border-top: 1px solid var(--line-soft); }
table.listings td.num { text-align: right; font-variant-numeric: tabular-nums; }
.seller-type { color: var(--text-faint); font-size: 12px; margin-left: 6px; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .field.wide { grid-column: 1 / -1; }
  .topbar-meta { display: none; }
}
@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .quicksearch { order: 3; flex-basis: 100%; max-width: none; }
  .view { padding: 16px 14px 32px; }
  .filters { grid-template-columns: 1fr; }
  .detail-head h1 { font-size: 21px; }
}
