:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #0f1722;
  --muted: #5b6676;
  --faint: #8a94a3;
  --line: #e3e7ee;
  --accent: #0b6bcb;
  --in: #0f8a4f;
  --in-bg: #e3f6ec;
  --out: #5b6676;
  --out-bg: #eef1f5;
  --warn: #9a5b00;
  --warn-bg: #fdf1dc;
  --row-hover: #f7f9fc;
  --shadow: 0 1px 2px rgba(15, 23, 34, .05), 0 4px 16px rgba(15, 23, 34, .04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1118;
    --card: #141b25;
    --ink: #e8edf4;
    --muted: #9aa6b6;
    --faint: #6f7b8c;
    --line: #243042;
    --accent: #4ea3ff;
    --in: #3ddc8a;
    --in-bg: #0f2e20;
    --out: #9aa6b6;
    --out-bg: #1c2532;
    --warn: #f0b350;
    --warn-bg: #33260f;
    --row-hover: #18212d;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.bar { background: var(--card); border-bottom: 1px solid var(--line); }
.bar-in { display: flex; align-items: center; gap: 10px; height: 52px; }
.mark { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); position: relative; }
.mark::after { content: ""; position: absolute; left: 7px; top: 4px; width: 6px; height: 11px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg); }
.brand { font-weight: 700; letter-spacing: -.01em; }
.crumb { color: var(--faint); font-size: 13px; margin-left: auto; }

.hero {
  display: grid; grid-template-columns: 1fr 260px; gap: 20px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 24px; margin: 20px 0 16px; box-shadow: var(--shadow);
}
.eyebrow { margin: 0 0 4px; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
h1 { margin: 0 0 10px; font-size: 28px; line-height: 1.15; letter-spacing: -.02em; }
.facts { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 14px; }
.facts strong { color: var(--ink); }
.lede { margin: 0; color: var(--muted); font-size: 14px; max-width: 62ch; }
.hero-side {
  border-left: 1px solid var(--line); padding-left: 20px;
  display: flex; flex-direction: column; justify-content: center;
}
.big { font-size: 44px; font-weight: 750; line-height: 1; letter-spacing: -.03em; }
.big .of { font-size: 18px; font-weight: 600; color: var(--faint); margin-left: 8px; letter-spacing: 0; }
.hero-side.live .big { color: var(--in); }
.big-label { color: var(--muted); font-size: 14px; margin-top: 6px; }
.last { color: var(--faint); font-size: 13px; margin-top: 10px; }

.toolbar { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; flex-wrap: wrap; }
.search { flex: 1 1 260px; }
.search input {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit;
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.seg { display: inline-flex; background: var(--out-bg); border-radius: 9px; padding: 3px; }
.seg button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 14px;
  padding: 5px 12px; border-radius: 7px; cursor: pointer;
}
.seg button.on { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.refresh { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; margin-left: auto; }
.refresh svg { width: 18px; height: 18px; transform: rotate(-90deg); }
.ring-bg, .ring { fill: none; stroke-width: 2.5; }
.ring-bg { stroke: var(--line); }
.ring { stroke: var(--accent); stroke-dasharray: 50.27; stroke-linecap: round; transition: stroke-dashoffset 1s linear; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; margin-bottom: 16px; }
.grid { width: 100%; border-collapse: collapse; }
.grid th {
  text-align: left; font-size: 12px; font-weight: 650; color: var(--faint); text-transform: uppercase; letter-spacing: .05em;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.grid td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid tbody tr.row:hover { background: var(--row-hover); }
.grid tbody tr:last-child td { border-bottom: 0; }
.r { text-align: right; }
.name a { color: var(--ink); font-weight: 600; }
.name small { display: block; color: var(--faint); font-size: 12px; font-weight: 400; }
.store { color: var(--muted); }
.price { font-weight: 650; }
.when { color: var(--muted); font-size: 14px; }
.empty { text-align: center; color: var(--faint); padding: 32px; }
.grid tr.in td { background: var(--in-bg); }
.grid tr.in td:first-child { box-shadow: inset 3px 0 0 var(--in); }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 650; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.in_stock { color: var(--in); background: var(--in-bg); }
.pill.out_of_stock { color: var(--out); background: var(--out-bg); }
.pill.unknown, .pill.pending { color: var(--warn); background: var(--warn-bg); }
.pill.in_stock::before { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.hist-btn {
  font: inherit; font-size: 13px; color: var(--accent); background: transparent; border: 1px solid var(--line);
  border-radius: 8px; padding: 4px 10px; cursor: pointer;
}
.hist-btn[aria-expanded="true"] { background: var(--out-bg); }
.buy {
  display: inline-block; font-size: 13px; font-weight: 650; color: #fff; background: var(--in);
  border-radius: 8px; padding: 4px 10px; margin-right: 6px;
}
.buy:hover { text-decoration: none; filter: brightness(1.08); }
tr.hist td { background: var(--row-hover); padding: 4px 16px 16px 16px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.timeline li { display: grid; grid-template-columns: 170px 130px 1fr; gap: 12px; align-items: center; font-size: 13px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline .t { color: var(--muted); }
.timeline .d { color: var(--faint); }
.hist-meta { color: var(--faint); font-size: 12px; margin: 10px 0 4px; }

.restocks h2 { font-size: 15px; margin: 0; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.events { list-style: none; margin: 0; padding: 0; }
.events li { display: flex; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.events li:last-child { border-bottom: 0; }
.events .t { color: var(--muted); min-width: 150px; }
.events .none { color: var(--faint); }

.foot { color: var(--faint); font-size: 13px; padding: 4px 0 40px; }

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding: 18px; }
  .hero-side { border-left: 0; border-top: 1px solid var(--line); padding: 16px 0 0; }
  h1 { font-size: 23px; }
  .crumb { display: none; }
  .refresh { margin-left: 0; }
  .grid thead { display: none; }
  .grid, .grid tbody, .grid tr, .grid td { display: block; width: 100%; }
  .grid tr.row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .grid tr.row td { padding: 0; border: 0; }
  .grid tr.row td.name { grid-column: 1 / 3; }
  .grid tr.row td.store { grid-column: 1; }
  .grid tr.row td.status { grid-column: 2; grid-row: 2; justify-self: end; }
  .grid tr.row td.price { grid-column: 1; text-align: left; }
  .grid tr.row td.when { grid-column: 2; grid-row: 3; text-align: right; }
  .grid tr.row td.act { grid-column: 1 / 3; text-align: left; }
  .grid tr.in td { background: transparent; box-shadow: none; }
  .grid tr.row.in { background: var(--in-bg); box-shadow: inset 3px 0 0 var(--in); }
  tr.hist td { padding: 4px 14px 12px; }
  .timeline li { grid-template-columns: 1fr auto; }
  .timeline .d { grid-column: 1 / 3; }
  .events li { flex-direction: column; gap: 0; }
}
