/* TSI Surgical Instrument Catalog — Phase 3
 *
 * Ported from prototype\index.html (approved by Joe 7/24: "I want it to look exactly like this").
 * Values come straight out of prototype\STYLE-GUIDE.md. Do not "improve" the palette, the
 * spacing or the radii — this is a signed-off design, not a starting point.
 *
 * Deliberate changes from the prototype, and only these:
 *   1. Inter is loaded from Google Fonts (prototype rendered in Segoe UI, Windows-only).
 *   2. The yellow prototype banner and "Simulate logged-in" checkbox are gone (review aids).
 *   3. Row grid is capped at 3 columns and collapses cleanly below 560px so the page body
 *      never scrolls sideways.
 *   4. Sidebar / modal / quote panel gain mobile + tablet layouts the prototype never had.
 */

:root {
  --navy:       #143B87;
  --page-bg:    #f4f5f7;
  --card:       #ffffff;
  --line:       #e2e5ea;
  --line-soft:  #eef0f3;
  --ink:        #1c2530;
  --ink-2:      #2a3442;
  --muted:      #5a6472;
  --muted-2:    #7a8494;
  --muted-3:    #98a1ae;
  --row-hover:  #f7f9fc;
  --navy-tint:  #e8ecf4;
  --gold-bg:    #faf3d7;
  --gold-ink:   #7a6a1c;
  --placeholder:#f2f4f6;
  --input-line: #ccd2db;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { max-width: 100%; overflow-x: hidden; }

body {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background: var(--page-bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- header ---------- */
header {
  background: var(--navy); color: #fff; padding: 12px 20px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
/* The white lockup sits straight on the navy bar - no chip (Joe vetoed the boxed look,
 * 2026-08-13). flex:none so the search field, not the brand, absorbs any squeeze.
 * The visible h1 is gone (logo carries the header); the element itself is .visually-hidden. */
.brand { display: flex; align-items: center; flex: none; }
.brand img { height: 36px; width: auto; display: block; }
.searchwrap { flex: 1; min-width: 260px; position: relative; }
.searchwrap input {
  width: 100%; padding: 9px 14px; border-radius: 6px; border: none;
  font-size: 14px; font-family: inherit; color: var(--ink);
}
.hdr-btn {
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.35); color: #fff;
  padding: 8px 14px; border-radius: 6px; font-size: 13px; font-family: inherit;
  cursor: pointer; white-space: nowrap;
}
.hdr-btn:hover { background: rgba(255,255,255,.24); }
.hdr-btn .badge {
  background: #fff; color: var(--navy); border-radius: 999px; padding: 0 7px;
  font-size: 11.5px; font-weight: 700; margin-left: 6px;
  display: inline-block; /* transform needs a block-ish box */
}
/* Brief pulse when an item is added, so the confirmation registers on the counter itself. */
@keyframes tsi-bump {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.5); }
  100% { transform: scale(1); }
}
.hdr-btn .badge.bump {
  animation: tsi-bump .42s ease-out;
  background: var(--gold-bg); color: var(--gold-ink);
}
@media (prefers-reduced-motion: reduce) {
  .hdr-btn .badge.bump { animation: none; }
}

/* ---------- spotlight strip ---------- */
.spot { background: var(--card); border-bottom: 1px solid var(--line); padding: 12px 20px 14px; }
.spot h2 { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.spot-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.spot-card {
  flex: 0 0 150px; border: 1px solid var(--line); border-radius: 8px; padding: 8px;
  background: var(--card); cursor: pointer; font: inherit; color: inherit; text-align: left;
}
.spot-card:hover { border-color: var(--navy); }
.spot-card img {
  width: 100%; height: 88px; object-fit: cover; border-radius: 5px; background: var(--line-soft);
  display: block;
}
.spot-card .nm {
  font-size: 12px; font-weight: 600; margin: 6px 0 2px; line-height: 1.25;
  height: 30px; overflow: hidden;
}

/* ---------- layout ---------- */
.layout { display: flex; gap: 0; width: 100%; align-items: flex-start; }
aside { flex: 0 0 220px; padding: 18px 8px 18px 20px; min-width: 0; }
aside h3 {
  font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted-2); margin-bottom: 8px;
}
.catlist { display: block; }
aside a {
  display: flex; justify-content: space-between; gap: 10px; padding: 5px 10px;
  font-size: 13.5px; color: var(--ink-2); text-decoration: none; border-radius: 5px;
}
aside a:hover { background: var(--navy-tint); }
aside a.on { background: var(--navy); color: #fff; font-weight: 600; }
aside a .n { color: var(--muted-3); font-size: 12px; flex-shrink: 0; }
aside a.on .n { color: #cdd8f0; }

main { flex: 1; padding: 18px 20px; min-width: 0; }
.rescap {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin-bottom: 8px; font-size: 13px; color: var(--muted); flex-wrap: wrap;
}
.rescap select {
  padding: 5px 8px; border-radius: 5px; border: 1px solid var(--input-line);
  font-size: 13px; font-family: inherit; background: #fff; color: var(--ink);
}
/* The caption's sign-in affordance. A button, not a label: it is the shortest path from
 * "why can't I see a price" to the sign-in dialog. */
.gate-note {
  color: var(--navy); background: none; border: none; padding: 0; font: inherit;
  font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.gate-note:hover { color: #0f2f6d; }
/* The pending-approval twin of .gate-note: same slot in the caption, but there is nothing
 * to click - the customer is waiting on TSI, not on themselves. */
.gate-note-static { color: #9a5b00; font-size: 13px; }

/* Rows: hairline grid. minmax() is clamped so a column is never narrower than the
 * viewport (no sideways body scroll on phones) and never narrower than a third of the
 * container (hard cap of 3 columns on ultra-wide screens, per the style guide). */
.rows {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(560px, 100%), 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden;
}
@media (min-width: 1700px) {
  .rows { grid-template-columns: repeat(auto-fill, minmax(max(560px, calc((100% - 2px) / 3)), 1fr)); }
}
.row { display: flex; align-items: center; gap: 12px; padding: 7px 14px; background: var(--card); cursor: pointer; }
.row:hover { background: var(--row-hover); }
.thumb {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 5px; border: 1px solid var(--line);
  background: var(--placeholder) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="%23aab3bf" stroke-width="1.5"><path d="M15 8h.01M3 6a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v12a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3z"/><path d="m3 16 5-5c.928-.893 2.072-.893 3 0l5 5"/></svg>') center no-repeat;
  object-fit: cover;
}
.rmain { flex: 1; min-width: 0; }
.rname {
  font-size: 13.5px; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rname a { color: inherit; text-decoration: none; }
.rsub { font-size: 12px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Price column. Fixed width so the numbers form a clean right-aligned rail down the page
 * and a long name can never shove the price around. Present only when there is something
 * per-product to say; absent entirely for signed-out visitors, so no row grows a column
 * of identical chrome. "Quote Upon Request" wraps to two lines at this width, which still
 * clears the 44px thumbnail - the row height does not change. */
.rprice {
  flex-shrink: 0; width: 88px; text-align: right; line-height: 1.25;
  font-size: 12.5px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums;
}
.rprice.req { font-size: 11px; font-weight: 500; font-style: italic; color: var(--muted-2); }
.addbtn {
  flex-shrink: 0; border: 1px solid var(--navy); color: var(--navy); background: #fff;
  border-radius: 6px; padding: 5px 12px; font-size: 12.5px; font-family: inherit; cursor: pointer;
  /* Sized for the wider "✓ Added" label so swapping text cannot reflow the row grid. */
  min-width: 78px; text-align: center;
  transition: background-color .12s ease, color .12s ease;
}
.addbtn:hover { background: var(--navy); color: #fff; }
.addbtn.added { background: var(--navy); color: #fff; }
@media (prefers-reduced-motion: reduce) { .addbtn { transition: none; } }

.pager { display: flex; gap: 6px; justify-content: center; align-items: center; padding: 16px; font-size: 13px; flex-wrap: wrap; }
.pager button {
  border: 1px solid var(--input-line); background: #fff; border-radius: 5px;
  padding: 5px 11px; font-size: 13px; font-family: inherit; cursor: pointer; color: var(--ink);
}
.pager button:hover { border-color: var(--navy); color: var(--navy); }
.pager button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.pager span { color: var(--muted-3); }

.empty {
  padding: 30px 16px; text-align: center; color: var(--muted-3); font-size: 13px;
  grid-column: 1 / -1; background: var(--card);
}

/* ---------- quote panel ---------- */
.qpanel {
  position: fixed; right: 0; top: 0; bottom: 0; width: min(360px, 100%);
  background: #fff; border-left: 1px solid #d8dde4; box-shadow: -4px 0 18px rgba(0,0,0,.08);
  transform: translateX(100%); transition: transform .2s; display: flex; flex-direction: column;
  z-index: 50;
}
.qpanel.open { transform: none; }
@media (prefers-reduced-motion: reduce) { .qpanel { transition: none; } }
.qpanel h2 {
  font-size: 15px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft);
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.qpanel h2 button {
  cursor: pointer; color: var(--muted-2); font-weight: 400; font-size: 13px;
  font-family: inherit; background: none; border: none; padding: 2px 4px;
}
.qpanel h2 button:hover { color: var(--ink); }
.qitems { flex: 1; overflow-y: auto; }
.qitem { padding: 9px 16px; border-bottom: 1px solid var(--placeholder); font-size: 12.5px; }
.qtop { display: flex; align-items: center; gap: 10px; }
.qitem .qn { flex: 1; min-width: 0; }
.qitem .qn .qnm { font-weight: 600; }
.qitem .qn .qsku { color: var(--muted-3); }
.qitem input {
  width: 46px; padding: 4px; border: 1px solid var(--input-line); border-radius: 4px;
  text-align: center; font-family: inherit; font-size: 12.5px;
}
.qitem .rm {
  color: #b34; cursor: pointer; padding: 2px 6px; background: none; border: none;
  font-family: inherit; font-size: 12.5px; line-height: 1;
}
/* Money row under each line: tier + nudge on the left, unit and line total on the right. */
.qmoney {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px; margin-top: 5px; flex-wrap: wrap;
}
.qtier { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.qtier .now-t { font-size: 11.5px; }
.qamt { display: flex; align-items: baseline; gap: 8px; font-variant-numeric: tabular-nums; }
.qamt .qea { font-size: 11.5px; color: var(--muted-3); }
.qamt b { font-size: 13px; color: var(--ink); font-weight: 700; }
.qamt .qreq { font-size: 11.5px; color: var(--muted-2); font-style: italic; }
.qladder { margin: 12px 16px 16px; }

.qfoot { padding: 14px 16px; border-top: 1px solid var(--line-soft); }

/* Request total. Reads as an estimate, never as a bill. */
.qtotals { margin-bottom: 10px; }
.qtrow {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  font-size: 12.5px; color: var(--muted); padding: 3px 0;
}
.qtrow b { font-variant-numeric: tabular-nums; color: var(--ink); }
.qtrow.total { font-size: 13.5px; color: var(--ink-2); }
.qtrow.total b { font-size: 17px; font-weight: 700; color: var(--navy); }
.qtrow.save b { color: #1d6b45; }
.qtrow.req b { font-size: 11.5px; font-weight: 500; color: var(--muted-2); font-style: italic; }
.qgate {
  font-size: 12.5px; color: var(--navy); background: var(--navy-tint);
  border-radius: 6px; padding: 8px 11px; text-align: center;
}
.qest {
  font-size: 11.5px; color: var(--muted-2); line-height: 1.45; margin-top: 8px;
  padding-top: 8px; border-top: 1px solid var(--line-soft);
}
.qfoot button {
  width: 100%; background: var(--navy); color: #fff; border: none; border-radius: 6px;
  padding: 11px; font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.qfoot button:hover { background: #10306e; }
.qfoot p { font-size: 11.5px; color: var(--muted-2); margin-top: 8px; text-align: center; }

/* Submission confirmation (Phase 3 stub — no backend yet, see catalog.js) */
.qconfirm { padding: 26px 20px; text-align: center; }
.qconfirm .tick {
  width: 40px; height: 40px; border-radius: 50%; background: var(--navy-tint); color: var(--navy);
  font-size: 20px; line-height: 40px; margin: 0 auto 12px;
}
.qconfirm h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.qconfirm p { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.qconfirm ul {
  list-style: none; text-align: left; margin: 14px 0 0; border-top: 1px solid var(--line-soft);
}
.qconfirm li {
  font-size: 12px; color: var(--muted); padding: 7px 0; border-bottom: 1px solid var(--line-soft);
  display: flex; justify-content: space-between; gap: 10px;
}
.qconfirm li b { color: var(--ink); font-weight: 600; white-space: nowrap; }
.qconfirm p b { color: var(--ink); font-weight: 700; }
/* The way back to an empty list. Without it the confirmation is a dead end. */
.qconfirm .qnew {
  width: 100%; margin-top: 4px; background: var(--navy); color: #fff; border: none;
  border-radius: 6px; padding: 11px; font-size: 14px; font-weight: 600;
  font-family: inherit; cursor: pointer;
}
.qconfirm .qnew:hover { background: #10306e; }

/* A submit that failed. Sits above the list, which is deliberately still there. */
.qerror {
  margin: 12px 16px; padding: 9px 11px; border-radius: 6px;
  background: #fdecec; border: 1px solid #f3c2c2; color: #8d2b2b;
  font-size: 12px; line-height: 1.45;
}

/* ---------- bulk discount ladder ----------
 * Shared by the detail modal and the quote panel. Quiet by default; the applicable band
 * and the "what the next band needs" nudge are the only things that carry emphasis. */
.ladder {
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  padding: 10px 12px; margin-bottom: 14px;
}
.ladder-h {
  font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px;
  display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
}
.ladder-h span { font-weight: 400; color: var(--muted-3); font-size: 11.5px; }
.ladder-t { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ladder-t th, .ladder-t td { padding: 4px 6px; text-align: left; font-weight: 400; color: var(--ink-2); }
.ladder-t th { width: 4.5em; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.ladder-t td.ea { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.ladder-t tr.on { background: var(--navy-tint); }
.ladder-t tr.on th, .ladder-t tr.on td { color: var(--navy); font-weight: 600; }
.ladder-now {
  margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--line-soft);
  font-size: 12.5px; color: var(--muted);
  display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline;
}
.ladder-now .ref { color: var(--muted-3); font-size: 12px; }
.now-t { font-weight: 600; color: var(--ink); }
.nudge {
  background: var(--gold-bg); color: var(--gold-ink); font-size: 11.5px; font-weight: 600;
  padding: 2px 9px; border-radius: 999px; white-space: nowrap;
}
.nudge.best { background: var(--navy-tint); color: var(--navy); }
/* The inversion case: a larger quantity that genuinely costs less in total. Tinted like
 * the savings figure rather than like the ordinary "spend more to save" nudge. */
.nudge.drop { background: #e9f5ee; color: #1d6b45; }

/* Free shipping. Sits next to the money it affects, not in a page-wide banner. */
.ship {
  font-size: 12.5px; font-weight: 600; color: #1d6b45; background: #e9f5ee;
  border-radius: 6px; padding: 7px 11px; margin-bottom: 14px;
}

/* ---------- detail modal ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(16,24,38,.45);
  display: none; align-items: center; justify-content: center; z-index: 70; padding: 24px;
}
.modal-bg.open { display: flex; }
.modal {
  background: #fff; border-radius: 10px; width: min(1020px, 96vw); max-height: 92vh;
  overflow: auto; display: flex; position: relative;
}
.m-close {
  position: absolute; top: 10px; right: 14px; font-size: 20px; color: var(--muted-2);
  cursor: pointer; background: #fff; border-radius: 50%; width: 32px; height: 32px;
  text-align: center; line-height: 30px; border: 1px solid var(--line); font-family: inherit;
  padding: 0; z-index: 1;
}
.m-img {
  flex: 0 0 46%; background: var(--placeholder); display: flex; align-items: center;
  justify-content: center; min-height: 440px; padding: 16px;
}
.m-img img { max-width: 100%; max-height: 408px; object-fit: contain; }
.m-img .noimg { color: var(--muted-3); font-size: 13px; text-align: center; padding: 20px; }
.m-img .noimg .glyph { display: block; margin: 0 auto 10px; opacity: .8; }
.m-info { flex: 1; padding: 28px 30px; min-width: 0; }
.m-crumb {
  font-size: 12.5px; color: var(--navy); margin-bottom: 8px; cursor: pointer;
  background: none; border: none; padding: 0; font-family: inherit; text-align: left;
}
.m-crumb:hover { text-decoration: underline; }
.m-info h2 { font-size: 21px; font-weight: 600; line-height: 1.25; margin-bottom: 6px; }
.m-size { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.m-sku { font-size: 12.5px; color: var(--muted-3); margin-bottom: 14px; }
.m-best {
  display: inline-block; background: var(--gold-bg); color: var(--gold-ink); font-size: 11.5px;
  font-weight: 600; padding: 3px 10px; border-radius: 999px; margin-bottom: 12px;
}
.m-price { font-size: 24px; font-weight: 700; color: var(--navy); margin: 6px 0 16px; }
.m-price .gate {
  font-size: 13px; font-weight: 500; color: var(--navy); background: var(--navy-tint);
  padding: 6px 12px; border-radius: 999px;
}
/* 2,433 of 3,053 products have no price. This is the exact string the live WordPress
 * store renders for them, so the two never disagree about the same instrument. */
.m-price .quote-req { font-size: 16px; font-weight: 600; color: var(--muted); }
.m-price .m-each { font-size: 13px; font-weight: 400; color: var(--muted-2); margin-left: 7px; }
.m-add { display: flex; gap: 10px; align-items: center; margin-bottom: 22px; flex-wrap: wrap; }
.m-add input {
  width: 64px; padding: 9px; border: 1px solid var(--input-line); border-radius: 6px;
  text-align: center; font-size: 14px; font-family: inherit;
}
.m-add button {
  background: var(--navy); color: #fff; border: none; border-radius: 6px; padding: 11px 22px;
  font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.m-add button:hover { background: #10306e; }
.m-rel h3 {
  font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px;
  border-top: 1px solid var(--line-soft); padding-top: 16px;
}
.m-rel-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.m-rel-card {
  border: 1px solid var(--line); border-radius: 7px; padding: 6px; cursor: pointer;
  background: #fff; font: inherit; color: inherit; text-align: left;
}
.m-rel-card:hover { border-color: var(--navy); }
.m-rel-card .ri {
  height: 54px; border-radius: 4px; background: var(--placeholder);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.m-rel-card .ri img { width: 100%; height: 100%; object-fit: cover; }
.m-rel-card .rn { font-size: 11px; font-weight: 600; line-height: 1.25; height: 27px; overflow: hidden; margin-top: 5px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: 13px; padding: 9px 18px; border-radius: 8px;
  opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 60; max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; }

/* ---------- quote submitter details ----------
 * Hidden until an anonymous visitor presses Submit. Signed-in customers never see it. */
.qdetails { display: none; margin: 12px 0 4px; }
.qfoot.need-details .qdetails { display: block; }
.qd-lead { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.qdetails label {
  display: block; font-size: 11.5px; font-weight: 600; color: var(--muted-2);
  text-transform: uppercase; letter-spacing: .3px; margin: 8px 0 3px;
}
.qdetails label span { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--muted-3); }
.qdetails input {
  width: 100%; padding: 8px 10px; border: 1px solid var(--input-line); border-radius: 5px;
  font-size: 13.5px; font-family: inherit; color: var(--ink); background: #fff;
}
.qd-err { font-size: 12.5px; color: #a8323d; margin-top: 8px; min-height: 1px; }
.qconfirm .qref { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.qconfirm .qref b { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--ink); }

/* ---------- sign in ----------
 * Replaces the "Preview: signed-in view" testing scaffolding, which is gone: identity is
 * real now, so there is nothing to simulate. */
.hdr-auth { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hdr-auth .who {
  font-size: 12.5px; color: #cdd8f0; max-width: 210px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Says why the prices are missing, right next to the address they are missing for. */
.pending-pill {
  background: #fff4e5; color: #9a5b00; border-radius: 999px; padding: 2px 10px;
  font-size: 11px; font-weight: 600; margin: 0 8px; white-space: nowrap;
}
.hdr-btn.ghost { background: none; padding: 6px 10px; font-size: 12.5px; }

.signin-bg {
  position: fixed; inset: 0; background: rgba(14,20,32,.55); z-index: 90;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.signin-bg.open { display: flex; }
.signin {
  position: relative; background: var(--card); border-radius: 10px; width: 100%;
  max-width: 430px; padding: 26px 26px 20px; box-shadow: 0 18px 50px rgba(0,0,0,.28);
}
.si-close {
  position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 6px;
  border: none; background: none; color: var(--muted-2); font-size: 15px; cursor: pointer;
}
.si-close:hover { background: var(--line-soft); color: var(--ink); }
.signin h2 { font-size: 17px; font-weight: 600; margin-bottom: 8px; padding-right: 26px; }
.si-lead { font-size: 13px; color: var(--muted); line-height: 1.5; margin-bottom: 16px; }
.signin label {
  display: block; font-size: 12px; font-weight: 600; color: var(--muted-2);
  text-transform: uppercase; letter-spacing: .4px; margin-bottom: 5px;
}
.signin input[type="email"] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--input-line); border-radius: 6px;
  font-size: 14px; font-family: inherit; color: var(--ink); background: #fff;
}
#siSubmit {
  width: 100%; margin-top: 12px; padding: 11px 14px; border: none; border-radius: 6px;
  background: var(--navy); color: #fff; font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer;
}
#siSubmit:hover { background: #0f2f6d; }
#siSubmit:disabled { opacity: .6; cursor: default; }
.si-msg { font-size: 13px; line-height: 1.5; margin-top: 12px; }
.si-msg.good { color: #1d6b3f; }
.si-msg.bad { color: #a8323d; }
.si-devlink { display: inline-block; margin-top: 6px; color: var(--navy); font-weight: 600; }
.si-foot {
  font-size: 12px; color: var(--muted-3); line-height: 1.5;
  margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line);
}
.si-foot a { color: var(--navy); }
/* A button that has to read as a link: the signup dialog is script-driven, so an <a> with
 * no href would be a lie to the keyboard and to assistive tech. */
.si-linkbtn {
  background: none; border: 0; padding: 0; color: var(--navy); font: inherit;
  font-weight: 600; text-decoration: underline; cursor: pointer;
}

@media (max-width: 640px) {
  .hdr-auth .who { display: none; }   /* the address is long and the header is 3 rows deep */
  .signin { padding: 22px 18px 16px; }
}

/* ---------- boot / failure states ---------- */
.boot { padding: 60px 20px; text-align: center; color: var(--muted-2); font-size: 13.5px; }
.boot.bad { color: #a8323d; }

/* ---------- responsive ---------- */

/* Tablet and below: the 220px sidebar becomes a horizontally scrolling category strip.
 * The strip scrolls inside its own container — the page body never scrolls sideways. */
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  aside { flex: 1 1 auto; width: 100%; padding: 14px 20px 0; }
  aside h3 { margin-bottom: 6px; }
  .catlist {
    display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
  }
  aside a {
    flex: 0 0 auto; white-space: nowrap; border: 1px solid var(--line); background: #fff;
    border-radius: 999px; padding: 5px 12px; font-size: 12.5px; gap: 6px;
  }
  aside a.on { border-color: var(--navy); }
  main { padding: 12px 20px 18px; width: 100%; }
  .modal { flex-direction: column; }
  .m-img { flex: 0 0 auto; min-height: 240px; }
  .m-img img { max-height: 240px; }
  .m-info { padding: 22px 22px 26px; }
}

@media (max-width: 640px) {
  header { padding: 10px 14px; gap: 10px; }
  /* Phone: the brand shrinks and carries the identity alone. */
  .brand img { height: 24px; }
  .searchwrap { min-width: 0; flex: 1 1 100%; order: 3; }
  .spot { padding: 10px 14px 12px; }
  aside { padding: 12px 14px 0; }
  main { padding: 12px 14px 18px; }
  .modal-bg { padding: 0; }
  .modal { width: 100%; max-height: 100vh; border-radius: 0; }
  .m-rel-row { grid-template-columns: repeat(2, 1fr); }
  .row { padding: 8px 12px; gap: 10px; }
  /* Phone: the name needs every pixel it can get, so the price rail narrows and the
   * "+ Add" button drops its reserve width for the "Added" label. */
  .rprice { width: 70px; font-size: 12px; }
  .rprice.req { font-size: 10.5px; }
  .addbtn { min-width: 64px; padding: 5px 8px; }
}
