/* Lowball app styles: copied from mockups/styles.css (SPEC 7.1). Change the mockup first, then copy. Neo-brutalism on Sentry's brand tokens (sentry.io/_astro/Layout.css) */
@font-face { font-family: Rubik; src: url("/public/fonts/Rubik-wght.ttf") format("truetype"); font-weight: 300 900; font-display: swap; }

:root {
  /* Sentry tokens */
  --ink: #1f1633;        /* --color-rich-black */
  --violet: #362d59;     /* --color-dk-violet, Sentry text + border */
  --muted: #584674;      /* --color-md-violet */
  --canvas: #ececf1;     /* --color-gray-2 */
  --rule: #cfcfdb;       /* --color-gray-3 */
  --paper: #ffffff;
  --deep: #36166b;       /* --color-dk-violet-alt */
  --purple: #4e2a9a;     /* --color-dk-blurple */
  --blurple: #6a5fc1;
  --lime: #c2ef4e;       /* price below target, primary action */
  --pink: #fd44b0;       /* alerts, destructive */
  --yellow: #ffdb4a;     /* needs your attention */
  --orange: #ffb287;     /* couldn't check */
  --lilac: #e2abe0;
  --red: #c73852;

  --line: 2px solid var(--ink);
  --shadow: 4px 4px 0 var(--ink);
  --shadow-lg: 6px 6px 0 var(--ink);
  --r: 8px;               /* Sentry .5rem */
  --gutter: 24px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 400 16px/1.5 Rubik, system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--purple); font-weight: 500; text-underline-offset: 3px; }
a:hover { color: var(--blurple); }
:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; }
h1, h2, h3 { margin: 0; line-height: 1.1; letter-spacing: -0.01em; }
h1 { font-size: 40px; font-weight: 800; }
h2 { font-size: 24px; font-weight: 700; }
h3 { font-size: 18px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 var(--gutter); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- top bar (Sentry purple descent gradient) ---------- */
.topbar {
  background: linear-gradient(149deg, #36166b 18%, #422082 57%, #4e2a9a 96%);
  border-bottom: var(--line);
  color: #fff;
}
.topbar .wrap { display: flex; align-items: center; gap: 28px; height: 68px; }
.logo { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 800; font-size: 22px; }
.logo:hover { color: #fff; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--lime); border: var(--line); box-shadow: 2px 2px 0 var(--ink);
  display: grid; place-items: center;
}
.nav { display: flex; gap: 4px; }
.nav a { color: #fff; text-decoration: none; padding: 8px 14px; border-radius: var(--r); font-weight: 500; border: 2px solid transparent; }
.nav a:hover { border-color: #fff; color: #fff; }
.nav a[aria-current="page"] { background: #fff; color: var(--ink); border-color: var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.who { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 14px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--yellow); color: var(--ink); border: var(--line); display: grid; place-items: center; font-weight: 700; }
.admin-badge { background: var(--pink); color: var(--ink); border: var(--line); border-radius: 999px; padding: 2px 10px; font-weight: 700; font-size: 13px; }

/* ---------- page head ---------- */
.page-head { padding: 40px 0 28px; display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head .lede { margin-top: 8px; color: var(--muted); max-width: 60ch; }
.crumbs { font-size: 14px; margin-bottom: 10px; color: var(--muted); }
.crumbs a { color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: 700 15px/1 Rubik, sans-serif; color: var(--ink); text-decoration: none;
  padding: 12px 18px; border: var(--line); border-radius: var(--r);
  background: var(--paper); box-shadow: var(--shadow); cursor: pointer;
  transition: transform .06s, box-shadow .06s;
}
.btn:hover { color: var(--ink); background: #f7f6fb; }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn-primary { background: var(--lime); }
.btn-primary:hover { background: #d3f57a; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: var(--violet); color: #fff; }
.btn-danger { background: var(--pink); }
.btn-danger:hover { background: #ff6cc2; }
.btn-sm { padding: 8px 12px; font-size: 14px; box-shadow: 3px 3px 0 var(--ink); }
.btn-link { background: none; border: 0; box-shadow: none; padding: 0; color: var(--purple); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.btn-link:active { transform: none; box-shadow: none; }

/* ---------- surfaces ---------- */
.card { background: var(--paper); border: var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card-pad { padding: 24px; }
.card-head { padding: 16px 24px; border-bottom: var(--line); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-body { padding: 24px; }
.callout { border: var(--line); border-radius: var(--r); padding: 16px 20px; display: flex; gap: 14px; align-items: flex-start; }
.callout-yellow { background: var(--yellow); }
.callout-orange { background: var(--orange); }
.callout-lime { background: var(--lime); }
.callout-pink { background: var(--pink); }
.callout .icon { flex: none; width: 28px; height: 28px; border: var(--line); border-radius: 50%; background: #fff; display: grid; place-items: center; font-weight: 800; }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; }
.field label, .label { font-weight: 700; font-size: 15px; }
.field .hint { font-size: 14px; color: var(--muted); }
.input {
  font: 400 16px Rubik, sans-serif; color: var(--ink);
  padding: 12px 14px; border: var(--line); border-radius: var(--r); background: #fff; width: 100%;
  box-shadow: inset 3px 3px 0 #ececf1;
}
.input:focus { outline: none; box-shadow: 4px 4px 0 var(--purple); }
.input-money { position: relative; }
.input-money .input { padding-left: 30px; font-weight: 700; }
.input-money::before { content: "$"; position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-weight: 700; }
.choice { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border: var(--line); border-radius: var(--r); background: #fff; cursor: pointer; }
.choice input { accent-color: var(--purple); width: 20px; height: 20px; margin: 2px 0 0; }
.choice.is-on { background: #f3eeff; box-shadow: 4px 4px 0 var(--purple); }
.field-error { color: var(--red); font-weight: 500; font-size: 14px; }

/* ---------- status chips (icon + words, never colour alone) ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: var(--line); border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; background: #fff; color: var(--ink); }
.chip::before { font-weight: 800; }
.chip-good { background: var(--lime); }
.chip-good::before { content: "↓"; }
.chip-stock::before { content: "●"; color: #2f7d32; }
.chip-oos { background: var(--canvas); }
.chip-oos::before { content: "○"; }
.chip-fail { background: var(--orange); }
.chip-fail::before { content: "!"; }
.chip-confirm { background: var(--yellow); }
.chip-confirm::before { content: "?"; }
.chip-alert { background: var(--pink); }
.chip-alert::before { content: "✉"; }
.chip-up::before { content: "↑"; }
.chip-new { background: var(--lilac); }
.chip-new::before { content: "+"; }
.chip-manual { background: #fff; border-style: dashed; }
.chip-manual::before { content: "✎"; }

/* ---------- the memorable thing: price tag stickers ---------- */
.tag {
  position: relative; display: inline-flex; align-items: baseline; gap: 2px;
  background: var(--lime); border: var(--line); box-shadow: var(--shadow);
  padding: 8px 14px 8px 26px; border-radius: 6px 14px 14px 6px;
  font-weight: 800; font-size: 26px; line-height: 1; transform: rotate(-2deg);
}
.tag::before { content: ""; position: absolute; left: 9px; top: 50%; width: 9px; height: 9px; margin-top: -4.5px; border: var(--line); border-radius: 50%; background: var(--canvas); }
.tag .c { font-size: 15px; }
.tag-above { background: #fff; }
.tag-big { font-size: 56px; padding: 14px 22px 14px 44px; box-shadow: var(--shadow-lg); }
.tag-big::before { width: 14px; height: 14px; margin-top: -7px; left: 15px; }
.tag-big .c { font-size: 26px; }
.tag-sm { font-size: 18px; padding: 5px 10px 5px 20px; box-shadow: 3px 3px 0 var(--ink); }
.tag-sm::before { width: 7px; height: 7px; margin-top: -3.5px; left: 7px; }
.tag-sm .c { font-size: 12px; }

/* ---------- product + store media ---------- */
.thumb { flex: none; width: 76px; height: 76px; border: var(--line); border-radius: var(--r); background: #f3eeff; display: grid; place-items: center; overflow: hidden; }
.thumb-lg { width: 100%; height: auto; aspect-ratio: 1; }
.thumb svg { width: 70%; height: 70%; }
.store { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; }
.logo-sq { flex: none; width: 32px; height: 32px; border: var(--line); border-radius: 6px; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; }
.logo-sq.none { background: #fff; color: var(--muted); border-style: dashed; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 15px; }
table.grid th { text-align: left; font-weight: 700; font-size: 14px; padding: 12px 16px; background: var(--canvas); border-bottom: var(--line); white-space: nowrap; }
table.grid td { padding: 14px 16px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid td.num, table.grid th.num { text-align: right; }
table.grid tr.is-best td { background: #f4fcdf; }
table.grid tr.is-fail td { background: #fff5ee; }
/* phones: each table row becomes a small card, each cell a "label: value" line (labels from data-label) */
@media (max-width: 640px) {
  table.grid thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  table.grid, table.grid tbody, table.grid tr, table.grid td { display: block; width: 100%; }
  table.grid tr { padding: 10px 16px; border-bottom: 1px solid var(--rule); }
  table.grid tr:last-child { border-bottom: 0; }
  table.grid tr.is-best { background: #f4fcdf; }
  table.grid tr.is-fail { background: #fff5ee; }
  table.grid td, table.grid td.num { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 4px 12px; padding: 5px 0; border: 0; text-align: right; background: none; }
  table.grid td[data-label]::before { content: attr(data-label); font-weight: 700; font-size: 14px; text-align: left; }
  table.grid td:not([data-label]) { justify-content: flex-start; text-align: left; }
  table.grid td:first-child { font-weight: 700; padding-bottom: 8px; }
}

.price { font-weight: 700; font-size: 17px; }
.strike { text-decoration: line-through; color: var(--muted); font-weight: 400; }

/* ---------- list rows (product list) ---------- */
.item { display: grid; grid-template-columns: 76px 1fr auto; gap: 20px; align-items: center; padding: 20px 24px; border-bottom: var(--line); text-decoration: none; color: inherit; }
.item:last-child { border-bottom: 0; }
.item:hover { background: #faf9fd; color: inherit; }
.item-title { font-weight: 700; font-size: 18px; color: var(--ink); }
.item-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; font-size: 14px; color: var(--muted); align-items: center; }
.item-price { text-align: right; display: grid; gap: 8px; justify-items: end; }

/* ---------- tabs / segmented ---------- */
.tabs { display: flex; gap: 0; border: var(--line); border-radius: var(--r); overflow: hidden; width: max-content; box-shadow: 3px 3px 0 var(--ink); }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--ink); font-weight: 500; font-size: 14px; background: #fff; }
.tabs a + a { border-left: var(--line); }
.tabs a[aria-current="true"] { background: var(--ink); color: #fff; }

/* ---------- auth layout ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { background: linear-gradient(149deg, #36166b 18%, #422082 57%, #4e2a9a 96%); border-right: var(--line); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.auth-form { display: grid; place-items: center; padding: 48px var(--gutter); }
.auth-form .card { width: 100%; max-width: 420px; }

/* ---------- misc ---------- */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.grid-side { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 32px; align-items: start; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.footer-note { padding: 48px 0; font-size: 14px; color: var(--muted); }
.mock-note { position: fixed; right: 16px; bottom: 16px; background: var(--ink); color: #fff; font-size: 13px; padding: 8px 12px; border-radius: var(--r); z-index: 10; }
.mock-note a { color: var(--lime); }

/* chart */
.chart { width: 100%; height: auto; display: block; }
.chart .grid-line { stroke: var(--rule); stroke-width: 1; }
.chart .axis { fill: var(--muted); font: 400 12px Rubik, sans-serif; }
.chart .series { fill: none; stroke: var(--purple); stroke-width: 2; }
.chart .target { stroke: var(--ink); stroke-width: 2; stroke-dasharray: 6 5; }
.chart .dot { fill: var(--purple); stroke: #fff; stroke-width: 2; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hit:hover + .dot, .chart .dot.is-hot { r: 7; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; padding: 6px 10px; border-radius: 6px; font-size: 13px; white-space: nowrap; transform: translate(-50%, -130%); display: none; }

@media (max-width: 860px) {
  h1 { font-size: 30px; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .grid-2, .grid-side { grid-template-columns: 1fr; }
  .item { grid-template-columns: 56px 1fr; }
  .item .thumb { width: 56px; height: 56px; }
  .item-price { grid-column: 1 / -1; justify-items: start; grid-auto-flow: column; justify-content: start; align-items: center; }
  .nav a { padding: 8px 10px; }
  .who span.name { display: none; }
  .topbar .wrap { gap: 12px; }
  .tag-big { font-size: 40px; }
}
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }

/* desired-price box with $ / Email prefix (price watch form) */
.money-box { display: flex; border: var(--line); border-radius: var(--r); overflow: hidden; background: #fff; }
.money-box > span { display: grid; place-items: center; padding: 0 16px; background: var(--canvas); border-right: var(--line); font-weight: 700; }
.money-box .input { border: 0; border-radius: 0; box-shadow: none; font-size: 22px; font-weight: 700; }
.money-box .input[readonly] { font-size: 16px; font-weight: 400; color: var(--muted); }
.drop { font-weight: 700; }
.drop-good { background: var(--lime); border: var(--line); border-radius: 4px; padding: 0 6px; }

/* relative time with full date on hover / focus */
time.ago { position: relative; border-bottom: 2px dotted var(--muted); cursor: help; white-space: nowrap; }
time.ago:hover::after, time.ago:focus-visible::after {
  content: attr(data-full); position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 5;
  background: var(--ink); color: #fff; font-size: 13px; padding: 6px 10px; border-radius: 6px; white-space: nowrap;
  box-shadow: 3px 3px 0 var(--purple);
}

/* best price + target pair on product rows */
.pair { display: flex; gap: 28px; margin: 0; align-items: flex-start; }
.pair dt { font-size: 13px; color: var(--muted); margin-bottom: 8px; white-space: nowrap; }
.pair dd { margin: 0; white-space: nowrap; }
.pair dd.price { font-size: 20px; font-weight: 800; padding-top: 4px; }
@media (max-width: 860px) { .pair { grid-column: 1 / -1; } }
/* fixed column widths so best price + target line up on every row */
.pair { display: grid; grid-template-columns: 200px 140px; gap: 16px; }
.pair dd.price { white-space: normal; line-height: 1.15; }
@media (max-width: 860px) { .pair { grid-template-columns: 200px 1fr; } }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }

/* danger zone: last section on a page, full width */
.danger { margin: 56px 0 48px; border: 2px solid var(--red); border-radius: var(--r); background: #fff5f8; box-shadow: 4px 4px 0 var(--red); }
.danger > h2 { padding: 14px 24px; border-bottom: 2px solid var(--red); color: var(--red); }
.danger-row { display: flex; gap: 24px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; padding: 20px 24px; }

/* Edit alert panel on the product page (native <dialog>) */
dialog.sheet { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); background: var(--canvas); color: var(--ink); }
dialog.sheet::backdrop { background: rgba(31, 22, 51, .55); }

/* row actions stay on one line, same gap on every row */
.btn-pair { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: nowrap; }
.btn-pair .btn { white-space: nowrap; }

/* ---------- classes that replace the mockups' inline styles (SPEC R3: no style="" in the app) ---------- */
.auth-headline { font-size: 56px; font-weight: 800; line-height: 1; max-width: 11ch; }
.auth-sub { margin-top: 20px; font-size: 18px; max-width: 40ch; color: var(--lilac); }
.auth-tags { gap: 18px; align-items: flex-end; }
.auth-tags .tag { color: var(--ink); }
.auth-tags .tag-tilt-r { transform: rotate(3deg); }
.auth-tags .tag-tilt-l { transform: rotate(-4deg); }
.auth-tags .strike { color: var(--muted); }
.auth-form h1 { font-size: 32px; }
.error-page { max-width: 640px; margin: 64px auto; }
.auth-stack { width: 100%; max-width: 420px; }

/* top bar on phones: wrap to two rows so nothing overlaps */
@media (max-width: 860px) {
  .topbar .wrap { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; row-gap: 8px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .who { margin-left: auto; }
}
.row.nowrap { flex-wrap: nowrap; }
.danger-text { margin-top: 6px; max-width: 65ch; }
.danger-field { min-width: 240px; }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pw-picks { gap: 12px 24px; }
.pw-picks .label { margin-bottom: 8px; }
.btn-wide { width: 100%; justify-content: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.lists-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 28px; }
.list-card { display: block; text-decoration: none; color: inherit; }
.list-card:hover { color: inherit; background: #faf9fd; }
.new-list-card { border-style: dashed; box-shadow: none; background: transparent; }
.thumbs-row { gap: 0; }
.thumbs-row .thumb { width: 56px; height: 56px; }
.thumbs-row .thumb + .thumb { margin-left: -14px; }
.item-wide { grid-template-columns: 110px 1fr auto; }
.item-wide > .thumb { width: 110px; height: 110px; }
.item-edit { grid-template-columns: 76px 1fr auto; }
.item-link { color: var(--purple); }
.item-meta-ink { color: var(--ink); }
.drop-line { margin-top: 8px; }
.callout-gap { margin-bottom: 28px; }
.link-ink { color: var(--ink); }
@media (max-width: 860px) { .item-wide { grid-template-columns: 56px 1fr; } .item-wide > .thumb { width: 56px; height: 56px; } }
.page-head-center { align-items: center; }
.grid-lowest { grid-template-columns: minmax(0, 300px) minmax(0, 1fr); align-items: start; }
.lowest-card { background: #f4fcdf; }
.card-gap { margin-top: 28px; }
.section-gap { margin-top: 36px; }
.card-flat { box-shadow: none; }
.cand-row { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; }
.cand-title { margin-top: 8px; }
.text-measure { max-width: 70ch; }
.sheet-head { padding: 16px 24px; border-bottom: var(--line); }
.sheet-body { padding: 24px; }
@media (max-width: 860px) { .grid-lowest { grid-template-columns: minmax(0, 1fr); } .cand-row { grid-template-columns: 1fr; } }
.narrow { max-width: 760px; }
.input-lg { font-size: 18px; }
.fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.span-2 { grid-column: 1 / -1; }
.break { overflow-wrap: anywhere; }
@media (max-width: 860px) { .fields-2 { grid-template-columns: 1fr; } }

/* price history chart (built by public/app.js) */
.chart-periods { margin-bottom: 14px; }
.chart-periods .tabs button { font: 500 14px Rubik, sans-serif; padding: 8px 14px; border: 0; background: #fff; color: var(--ink); cursor: pointer; }
.chart-periods .tabs button + button { border-left: var(--line); }
.chart-periods .tabs button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.chart-legend { border: 0; padding: 0; margin: 0 0 10px; gap: 6px 16px; }
.chart-legend legend { float: left; margin-right: 8px; }
.chart-store { gap: 6px; cursor: pointer; }
.chart-store input { width: 16px; height: 16px; margin: 0; }
.swatch { display: inline-block; width: 16px; height: 3px; }
.chart-wrap { position: relative; }
.chart-tip { transform: translate(12px, -50%); white-space: normal; min-width: 190px; }
.tip-row { display: flex; gap: 8px; align-items: center; }
.tip-name { flex: 1; }
.dot-sw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.chart .chart-label { font: 700 12px Rubik, sans-serif; fill: var(--ink); }
.logo-sq { background: var(--purple); }   /* the mockups set a colour per store inline; the app uses one */
.chart-tip.tip-left { transform: translate(calc(-100% - 12px), -50%); }
/* summary dots: same colours and order as the chart lines in public/app.js */
.sw-0 { background: #2a78d6; } .sw-1 { background: #eb6834; } .sw-2 { background: #1baf7a; } .sw-3 { background: #eda100; }
.sw-4 { background: #e87ba4; } .sw-5 { background: #008300; } .sw-6 { background: #6250d6; } .sw-x { background: #898781; }
.dot-sw { border: 2px solid var(--ink); flex: none; }

/* ---------- phones (Phase 4 mobile review) ---------- */
.bottom-bar { display: none; }
.lists-grid { grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.store { min-width: 0; overflow-wrap: anywhere; }
.item > div { min-width: 0; }
.chart-periods .tabs .short { display: none; }
.summary-details > summary { cursor: pointer; font-weight: 700; padding: 12px 24px; list-style-position: inside; }
@media (max-width: 860px) {
  .pair { grid-template-columns: minmax(0, 1fr) auto; }
  .item-wide { grid-template-columns: 56px minmax(0, 1fr); }
  .grid-2, .grid-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  :root { --gutter: 16px; }
  .card-pad, .card-body, .item, .danger-row, .sheet-body { padding-left: 16px; padding-right: 16px; }
  .card-head, .sheet-head { padding-left: 16px; padding-right: 16px; }
  .page-head { padding: 20px 0 16px; }
  .item-edit { grid-template-columns: 56px minmax(0, 1fr); }
  .item-edit > .row { grid-column: 1 / -1; }
  .item-edit > .thumb { width: 56px; height: 56px; }
  .phone-hide { display: none !important; }
  .chip { white-space: normal; }
  .bottom-bar { display: flex; gap: 12px; position: sticky; bottom: 0; z-index: 4; margin: 16px calc(-1 * var(--gutter)) 0;
    padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom)); background: var(--canvas); border-top: var(--line); }
  .sticky-action { position: sticky; bottom: 0; z-index: 3; background: inherit; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); margin-bottom: -12px; }
  .card .sticky-action, dialog .sticky-action { background: #fff; }
  .chart-periods .tabs { width: 100%; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
  .chart-periods .tabs .long { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .chart-periods .tabs .short { display: inline; }
  .chart-tip, .chart-tip.tip-left { position: static; transform: none; min-width: 0; margin-top: 8px; pointer-events: auto; white-space: normal; }
  dialog.sheet { margin: auto 0 0; width: 100%; max-width: 100%; max-height: 92dvh; border-radius: 16px 16px 0 0; border-bottom: 0; overscroll-behavior: contain; }
  time.ago:hover::after, time.ago:focus-visible::after, time.ago.show-full::after { right: auto; left: 0; white-space: normal; width: max-content; max-width: calc(100vw - 32px); }
}
.auth { min-height: 100dvh; }
@media (min-width: 641px) { dialog.sheet { max-height: calc(100dvh - 48px); } }
body:has(dialog[open]) { overflow: hidden; }
time.ago.show-full::after {
  content: attr(data-full); position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 5;
  background: var(--ink); color: #fff; font-size: 13px; padding: 6px 10px; border-radius: 6px; box-shadow: 3px 3px 0 var(--purple);
}
/* touch screens: every control is at least 44 px (Apple HIG, Material) */
@media (pointer: coarse) {
  .btn, .btn-sm, .input, select.input { min-height: 44px; }
  .btn-sm { padding: 10px 14px; }
  .logo { min-height: 44px; }
  .crumbs a, .link-action, a.small, .nav a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }
  .pick { display: block; width: 100%; min-height: 44px; padding: 12px 0; text-align: left; }
  .chart-store { min-height: 44px; }
  .chart-store input { width: 24px; height: 24px; }
  .chart-periods .tabs button { min-height: 44px; }
  .summary-details > summary { min-height: 44px; display: flex; align-items: center; }
}

/* ---------- Home Screen app (Phase 4 Task 7) ---------- */
.who-link { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; min-height: 44px; min-width: 44px; justify-content: center; border-radius: var(--r); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.who-link[aria-current="page"] .avatar { outline: 3px solid var(--lime); }
.tabbar { display: none; }
.device { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--rule); }
.btn, .tabs button, .tabbar a, .nav a, .who-link { -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.topbar .wrap { padding-left: max(var(--gutter), env(safe-area-inset-left)); padding-right: max(var(--gutter), env(safe-area-inset-right)); }
.topbar { padding-top: env(safe-area-inset-top); }
@media (max-width: 640px) {
  .topbar .wrap { flex-wrap: nowrap; height: 56px; padding-top: 0; padding-bottom: 0; }
  .topbar .nav { display: none; }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--ink); border-top: 2px solid var(--ink); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: flex; align-items: center; justify-content: center; min-height: 52px; color: #fff; text-decoration: none; font-weight: 700; font-size: 14px; }
  .tabbar a[aria-current="page"] { color: var(--lime); box-shadow: inset 0 3px 0 var(--lime); }
  body { padding-bottom: calc(52px + env(safe-area-inset-bottom)); }
  .bottom-bar, .sticky-action { bottom: calc(52px + env(safe-area-inset-bottom)); }
}
@media (display-mode: standalone) {
  body { overscroll-behavior-y: none; }
}

/* ---------- Find more stores (2026-11-22) ---------- */
.store-link { color: inherit; text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; border-radius: var(--r); }
.store-link:hover .store, .store-link:focus-visible .store { text-decoration: underline; }
.lowest-actions { gap: 10px; flex-wrap: wrap; }
/* the big price tag grows with its box and never leaves it (owner report: it sat outside when below target) */
.lowest-card { container-type: inline-size; }
.lowest-card .tag-big { font-size: 34px; font-size: min(56px, 17cqi); padding: 12px 18px 12px 38px; box-shadow: 5px 5px 0 var(--ink); max-width: calc(100% - 10px); }
.lowest-card .tag-big.tag-long { font-size: 26px; font-size: min(56px, 12.5cqi); }
.lowest-card .tag-big .c { font-size: 0.46em; }
.search-sheet .search-body { align-items: center; text-align: center; }
.search-spin { display: grid; place-items: center; height: 80px; }
.search-spin .tag { font-size: 30px; }
.search-phrase { font-weight: 700; font-size: 18px; min-height: 2.6em; margin: 0; }
@media (prefers-reduced-motion: no-preference) {
  .search-spin .tag { animation: lb-wobble 1.4s ease-in-out infinite; }
}
@keyframes lb-wobble { 0%, 100% { transform: rotate(-10deg) scale(1); } 50% { transform: rotate(10deg) scale(1.15); } }
td.num .btn-sm { white-space: nowrap; }
/* admin users: table first, forms in a side column */
.grid-side-r { grid-template-columns: minmax(0, 1fr) 340px; }
@media (max-width: 860px) { .grid-side-r { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { table.grid a.row-link { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; } }
