/* ShelfRipper web service. Tokens come from tokens.css (the brand kit). One accent (signal green) for stock. */
@font-face { font-family: "Bai Jamjuree"; font-weight: 400; font-display: swap; src: url("/static/bai-jamjuree-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Bai Jamjuree"; font-weight: 500; font-display: swap; src: url("/static/bai-jamjuree-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Bai Jamjuree"; font-weight: 600; font-display: swap; src: url("/static/bai-jamjuree-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Bai Jamjuree"; font-weight: 700; font-display: swap; src: url("/static/bai-jamjuree-latin-700-normal.woff2") format("woff2"); }

:root {
  --ink: var(--sr-ink); --paper: var(--sr-paper); --signal: var(--sr-signal);
  --text: #0A1016; --muted: #55616E; --rule: #DCE2E8; --wash: #F4F6F8;
  --ok: #0B7A4B; --ok-wash: #E3F7EE; --warn-wash: #FFF4DB; --warn: #7A5300; --bad: #B42318;
  --gutter: clamp(16px, 4vw, 40px); --radius: 12px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Bai Jamjuree", system-ui, sans-serif; font-size: 16px; line-height: 1.55; color: var(--text); background: #fff; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: 3px; }
a:hover { color: var(--ink); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
.foot :focus-visible, .band :focus-visible { outline-color: var(--paper); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -64px; z-index: 10; padding: 10px 16px; background: var(--ink); color: #fff; border-radius: 8px; }
.skip:focus { top: 12px; }
.wrap { width: min(100%, 1200px + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.narrow { max-width: calc(560px + 2 * var(--gutter)); }
.section { padding-block: 40px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.ok { color: var(--ok); font-weight: 600; }
.empty { padding: 20px; border: 1px dashed var(--rule); border-radius: var(--radius); color: var(--muted); }
.error { color: var(--bad); font-weight: 500; }
.notice { padding: 12px 16px; background: var(--warn-wash); color: var(--warn); border-radius: var(--radius); margin-block: 12px; }

h1 { font-size: clamp(1.9rem, 4vw, 2.75rem); line-height: 1.08; font-weight: 700; letter-spacing: -0.03em; text-wrap: balance; }
h2 { font-size: 1.375rem; line-height: 1.2; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 14px; text-wrap: balance; }
.spaced { margin-top: 36px; }
.spaced-sm { margin-top: 12px; }
.lede { margin-top: 12px; max-width: 42em; font-size: 1.125rem; line-height: 1.5; color: var(--muted); text-wrap: pretty; }
.lede.small { font-size: 1rem; }
.count { margin: 18px 0 10px; color: var(--muted); font-size: 14px; }

/* Buttons and links */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 20px; border: 0; border-radius: 10px; background: var(--ink); color: #fff; font-weight: 600; text-decoration: none; white-space: nowrap; cursor: pointer; }
.btn:hover { background: var(--sr-slate); color: #fff; }
.btn--small { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn--quiet { background: var(--wash); color: var(--text); border: 1px solid var(--rule); }
.btn--quiet:hover { background: #fff; color: var(--text); }
.btn--go { background: var(--signal); color: var(--ink); }
.btn--go:hover { background: #3be79a; color: var(--ink); }
.btn--danger { background: var(--bad); }
.btn[disabled] { opacity: .55; cursor: default; }
.link { background: none; border: 0; padding: 0; font-weight: 600; text-decoration: underline; cursor: pointer; }

/* Status tags */
.tag { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.tag--in { background: var(--signal); color: var(--ink); }
.tag--out { background: var(--wash); color: var(--muted); border: 1px solid var(--rule); }
.tag--unknown { background: var(--warn-wash); color: var(--warn); }

/* Header */
.top { border-bottom: 1px solid var(--rule); background: #fff; position: sticky; top: 0; z-index: 5; }
.top__row { display: flex; align-items: center; gap: 20px; min-height: 64px; }
.brand { display: inline-flex; flex: none; padding-block: 4px; }
.brand svg { height: 26px; width: auto; display: block; }
.search { flex: 1; max-width: 420px; position: relative; }
.search input { width: 100%; height: 40px; padding: 0 14px; border: 1px solid var(--rule); border-radius: 10px; background: var(--wash); font: inherit; }
.search input:focus { background: #fff; border-color: var(--ink); outline: none; }
.suggest { position: absolute; left: 0; right: 0; top: 44px; background: #fff; border: 1px solid var(--rule); border-radius: 10px; box-shadow: 0 8px 24px rgba(10,16,22,.12); overflow: hidden; z-index: 6; }
.suggest a { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; text-decoration: none; }
.suggest a:hover, .suggest a[aria-selected="true"] { background: var(--wash); }
.suggest span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.nav { display: flex; align-items: center; gap: 18px; margin-left: auto; font-size: 15px; font-weight: 500; }
.nav a:not(.btn) { text-decoration: none; padding: 8px 0; white-space: nowrap; }
.nav a:not(.btn):hover { text-decoration: underline; }

/* Home */
.hero { background: var(--ink); color: #fff; padding-block: 48px 40px; }
.hero h1 { max-width: 16em; }
.hero .lede { color: #A7B1BC; }
.search--big { display: flex; gap: 10px; max-width: 640px; margin-top: 24px; }
.search--big input { height: 52px; background: #fff; border: 0; font-size: 1.05rem; }
.search--big .btn { min-height: 52px; background: var(--signal); color: var(--ink); }
.stats { margin-top: 16px; color: #A7B1BC; }
.stats b { color: var(--signal); }
.stats a { color: #fff; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.section__head h2 { margin: 0; }
.section__head a { font-weight: 600; font-size: 14px; white-space: nowrap; display: inline-block; padding-block: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips a { display: inline-flex; gap: 6px; align-items: center; min-height: 40px; padding: 0 14px; border: 1px solid var(--rule); border-radius: 999px; text-decoration: none; font-weight: 500; }
.chips a:hover { border-color: var(--ink); }
.band { background: var(--wash); padding-block: 40px; margin-top: 24px; }
.band__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.band p { color: var(--muted); max-width: 36em; }
.band p + p { margin-top: 12px; }
.steps { display: grid; gap: 12px; }
.steps li { display: grid; gap: 2px; padding: 16px 18px; background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); }
.steps span { color: var(--muted); }
.app-note p { color: var(--muted); }

/* Product cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card a { display: grid; grid-template-columns: 72px 1fr; gap: 14px; align-items: center; height: 100%; padding: 12px; border: 1px solid var(--rule); border-radius: var(--radius); text-decoration: none; background: #fff; }
.card a:hover { border-color: var(--ink); }
.card--in a { border-color: var(--signal); box-shadow: inset 4px 0 0 var(--signal); }
.card img, .card .ph { width: 72px; height: 72px; object-fit: contain; border-radius: 8px; background: var(--wash); }
.card__text { display: grid; gap: 2px; min-width: 0; }
.card__text b { font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card__text span { font-size: 14px; line-height: 1.4; }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; margin-top: 20px; padding: 14px; background: var(--wash); border-radius: var(--radius); }
.filters label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.filters select { height: 36px; min-width: 150px; padding: 0 10px; border: 1px solid var(--rule); border-radius: 8px; background: #fff; font: inherit; font-size: 14px; color: var(--text); }
.filters .check { display: flex; align-items: center; gap: 8px; height: 36px; font-size: 14px; color: var(--text); }
.check input, .alarm input { width: 20px; height: 20px; accent-color: var(--ink); flex: none; }
.check, .alarm { min-height: 24px; }

/* Tables */
.tablewrap { position: relative; overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--rule); vertical-align: middle; }
thead th { font-size: 13px; color: var(--muted); font-weight: 600; background: var(--wash); white-space: nowrap; }
tbody tr:last-child > * { border-bottom: 0; }
tbody th { font-weight: 600; white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td time { white-space: nowrap; }
.stores tr.flash { animation: flash 2s ease-out; }
@keyframes flash { from { background: var(--ok-wash); } to { background: transparent; } }

/* Product page */
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); display: inline-block; padding-block: 3px; }
.product section { margin-top: 36px; }
.product__head { display: grid; grid-template-columns: 220px 1fr; gap: 28px; align-items: start; }
.product__img { width: 220px; height: 220px; object-fit: contain; background: var(--wash); border-radius: var(--radius); padding: 12px; }
.product__state { margin-top: 10px; font-size: 1.125rem; }
.product__head .muted { margin-top: 6px; font-size: 14px; }
.track { margin-top: 18px; display: grid; gap: 8px; max-width: 520px; }
.track form { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--rule); border-radius: var(--radius); }
.track fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.track legend { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.track label { font-size: 14px; }
.track .row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.track input[type=number] { width: 140px; height: 38px; padding: 0 10px; border: 1px solid var(--rule); border-radius: 8px; font: inherit; }
.alarm { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.stats-grid div { padding: 14px; border: 1px solid var(--rule); border-radius: var(--radius); }
.stats-grid dt { font-size: 13px; color: var(--muted); }
.stats-grid dd { font-size: 1.125rem; font-weight: 600; margin-top: 2px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 24px; }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { font-weight: 500; }

/* Stores index */
.storelist { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-top: 20px; }
.storelist a { display: grid; gap: 2px; padding: 14px 16px; border: 1px solid var(--rule); border-radius: var(--radius); text-decoration: none; }
.storelist a:hover { border-color: var(--ink); }

/* Account, alerts */
.auth { display: grid; gap: 14px; margin-top: 20px; }
.auth label:not(.check) { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }
.auth input:not([type=checkbox]) { height: 44px; padding: 0 12px; border: 1px solid var(--rule); border-radius: 10px; font: inherit; }
.auth .check, .panel .check { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.panel { margin-top: 24px; padding: 18px; border: 1px solid var(--rule); border-radius: var(--radius); }
.panel h2 { font-size: 1.1rem; margin-bottom: 6px; }
.panel p + p { margin-top: 10px; }
.panel .btn + .btn { margin-left: 8px; }
.panel details { margin-top: 12px; }
.panel summary { cursor: pointer; font-weight: 600; }
.alerts-list { display: grid; gap: 12px; margin-top: 16px; }
.alert-item { padding: 16px; border: 1px solid var(--rule); border-radius: var(--radius); display: grid; gap: 10px; }
.alert-item header { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.alert-item header a { font-weight: 600; font-size: 1.05rem; }
.alert-item .mini { display: flex; flex-wrap: wrap; gap: 6px; }
.alert-item .mini span { font-size: 13px; padding: 3px 8px; border-radius: 6px; background: var(--wash); }
.alert-item .mini span.in { background: var(--signal); color: var(--ink); font-weight: 600; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin: 16px 0 28px; }
.metric-grid div { padding: 14px; border: 1px solid var(--rule); border-radius: var(--radius); }
.metric-grid dt { font-size: 13px; color: var(--muted); }
.metric-grid dd { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Prose (about, legal) */
.prose { max-width: calc(44em + 2 * var(--gutter)); }
.prose h1 { margin-bottom: 16px; }
.prose h2 { margin-top: 32px; font-size: 1.2rem; }
.prose p { margin-top: 12px; color: #2C3640; }
.prose ul { margin-top: 12px; padding-left: 1.25em; list-style: disc; color: #2C3640; }
.prose li + li { margin-top: 6px; }

/* Footer */
.foot { background: var(--ink); color: #A7B1BC; padding-block: 36px; margin-top: 48px; }
.foot__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 14px; }
.foot nav a { color: #fff; text-decoration: none; display: inline-block; padding-block: 4px; }
.foot nav a:hover { text-decoration: underline; color: #fff; }
.fine { margin-top: 20px; font-size: 13px; max-width: 70em; }

@media (max-width: 980px) {
  .nav a[href="/restocks"], .nav a[href="/products"] { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .band__grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .top__row { flex-wrap: wrap; gap: 10px 14px; padding-block: 10px; min-height: 0; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .nav { gap: 14px; }
  .nav a[href="/in-stock"] { display: none; }
  .product__head { grid-template-columns: 1fr; }
  .product__img { width: 160px; height: 160px; }
  .search--big { flex-direction: column; }
  th, td { padding: 9px 10px; }
  table { font-size: 14px; }
}
@media (max-width: 640px) {
  /* Stock by store: one stacked row per store on phones, every column kept */
  .tablewrap:has(table.stores) { border: 0; overflow: visible; }
  table.stores thead { display: none; }
  table.stores, table.stores tbody { display: block; }
  table.stores tr { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 14px; margin-bottom: 10px; border: 1px solid var(--rule); border-radius: var(--radius); }
  table.stores th, table.stores td { padding: 0; border: 0; text-align: left; }
  table.stores th { font-size: 1.05rem; align-self: center; }
  table.stores td[data-cell=state] { justify-self: end; }
  table.stores td[data-label] { grid-column: 1 / -1; display: flex; justify-content: space-between; font-size: 14px; }
  table.stores td[data-label]::before { content: attr(data-label); color: var(--muted); }
  table.stores td.go { grid-column: 1 / -1; }
  table.stores td.go .btn { width: 100%; min-height: 44px; }
}
@media (max-width: 420px) {
  .brand svg { height: 22px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .cards { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .stores tr.flash { animation: none; } }
