/* Gringo Cats — mobile-first base styles. Phones are the primary target;
   the layout scales up to desktop. No external fonts or CDNs.

   Design intent: this is a field tool, used one-handed on a phone, often
   outdoors in bright sun. So: high contrast, large tap targets, calm flat
   surfaces, one accent colour (the brand green), and numbers that line up.
   Depth is declared once — a hairline border OR a shadow, never both. */

:root {
  /* Surfaces and ink */
  --bg: #f2f4f7;
  --card: #ffffff;
  --ink: #131822;
  --ink-soft: #3c4658;
  --muted: #5b6678;
  --line: #d9dee7;
  --line-strong: #c2cad6;

  /* Brand and state */
  --brand: #10683f;
  --brand-ink: #ffffff;
  --brand-soft: #e6f3ec;
  --accent: #1f56c8;
  --alert: #a5231c;
  --warn: #8a5a00;

  /* Spacing scale (4px base) — use these instead of one-off values */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px;

  /* Radii: cards get the large step, controls the medium, pills for chips */
  --r-sm: 8px; --r-md: 10px; --r-lg: 14px; --r-pill: 999px;

  /* Type steps */
  --t-xs: .75rem; --t-sm: .8125rem; --t-md: .875rem; --t-base: 1rem;
  --t-lg: 1.125rem; --t-xl: 1.375rem; --t-2xl: 1.75rem;

  --tap: 46px;             /* minimum comfortable touch target */
  --ease: cubic-bezier(.2, .7, .3, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* hidden must win over display rules (lightbox, buttons) */

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

/* Money, weights and counts line up column-wise wherever they appear. */
.num, .val-num, .bt-total, .hist-paid, .alert-count, .pl-total strong { font-variant-numeric: tabular-nums; }

/* Every interactive element gets a visible keyboard focus ring. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  background: var(--brand); color: var(--brand-ink);
  padding: var(--s3) var(--s4); position: sticky; top: 0; z-index: 10;
}
.brand { color: var(--brand-ink); text-decoration: none; font-weight: 700; font-size: var(--t-lg); letter-spacing: -.01em; }
.topnav { display: flex; align-items: center; gap: var(--s3); font-size: var(--t-md); }
.topnav a { color: var(--brand-ink); text-decoration: underline; text-underline-offset: 3px; }
.who { display: flex; align-items: center; gap: var(--s2); }
.role-badge {
  font-size: var(--t-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px var(--s2); border-radius: var(--r-pill); background: rgba(255,255,255,.2);
}

/* Layout — more space above a heading than below it */
.wrap { max-width: 960px; margin: 0 auto; padding: var(--s4) var(--s4) var(--s7); }
h1 { font-size: var(--t-2xl); line-height: 1.2; letter-spacing: -.02em; margin: var(--s5) 0 var(--s2); }
h2 { font-size: var(--t-lg); line-height: 1.3; letter-spacing: -.01em; margin: var(--s5) 0 var(--s2); }
h3 { font-size: var(--t-base); margin: var(--s4) 0 var(--s2); }
.wrap > h1:first-child, .crumb + h1, .deal-head h1 { margin-top: var(--s2); }
.sub, .hint { color: var(--muted); }
.hint { font-size: var(--t-md); }
.foot { text-align: center; color: var(--muted); font-size: var(--t-xs); padding: var(--s6) var(--s4); }

/* Cards — flat, bounded by a hairline. No shadow: depth is declared once. */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: var(--s4); margin-bottom: var(--s3);
}

/* Dashboard grid: single column on phones, multi-column when there is room */
.grid { display: grid; grid-template-columns: 1fr; gap: var(--s3); margin-top: var(--s4); }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.section { margin: 0; }
.section h2 { font-size: var(--t-lg); margin: 0 0 var(--s1); }
.section p { margin: 0 0 var(--s3); color: var(--muted); font-size: var(--t-md); line-height: 1.45; }
.soon {
  display: inline-block; font-size: var(--t-xs); font-weight: 700; color: var(--muted);
  border: 1px dashed var(--line-strong); border-radius: var(--r-pill); padding: 2px var(--s3);
}

/* Login */
.login-card { max-width: 380px; margin: 8vh auto 0; }
.login-card h1 { margin-top: 0; }
form label { display: block; margin: var(--s3) 0; font-weight: 600; font-size: var(--t-md); }
form input, form textarea, form select {
  display: block; width: 100%; margin-top: var(--s1); padding: 13px var(--s3);
  border: 1px solid var(--line-strong); border-radius: var(--r-md); font-size: var(--t-base);
  background: var(--card); color: var(--ink);
}
form input:focus, form textarea:focus, form select:focus { border-color: var(--accent); }
.btn-primary {
  width: 100%; min-height: var(--tap); margin-top: var(--s2); padding: 13px var(--s4);
  border: 0; border-radius: var(--r-md); background: var(--brand); color: var(--brand-ink);
  font-size: var(--t-base); font-weight: 700; cursor: pointer; transition: background .15s var(--ease);
}
.btn-primary:hover { background: #0c5433; }
.btn-primary:disabled { background: var(--line-strong); color: var(--muted); cursor: not-allowed; }
.alert {
  background: #fdecea; color: var(--alert); border: 1px solid #f2c4bf;
  padding: var(--s3) var(--s3); border-radius: var(--r-md); font-size: var(--t-md);
}
code { background: #e9edf3; padding: 1px 5px; border-radius: 4px; font-size: .95em; }

/* Dashboard section links */
a.section.live { text-decoration: none; color: inherit; display: block; transition: border-color .15s var(--ease); }
a.section.live:hover { border-color: var(--brand); }
.open { display: inline-block; font-size: var(--t-sm); font-weight: 700; color: var(--brand); }

/* Search */
.searchbar { display: flex; gap: var(--s2); margin: var(--s3) 0 var(--s1); }
.searchbar input { flex: 1; min-width: 0; padding: 13px var(--s3); border: 1px solid var(--line-strong); border-radius: var(--r-md); font-size: var(--t-base); background: var(--card); color: var(--ink); }
.searchbar .btn-primary { width: auto; margin: 0; padding: 13px var(--s5); }
.crumb, .crumb a { color: var(--muted); text-decoration: none; font-size: var(--t-md); }
.crumb a:hover { color: var(--brand); }
.alert-inline { color: var(--alert); font-weight: 600; }

/* Search results */
.results { display: grid; grid-template-columns: 1fr; gap: var(--s3); margin-top: var(--s3); }
@media (min-width: 560px) { .results { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 860px) { .results { grid-template-columns: repeat(3, 1fr); } }
.result { display: flex; gap: var(--s3); align-items: center; text-decoration: none; color: inherit; padding: var(--s3); }
.result:hover { border-color: var(--brand); }
.result .thumb { flex: 0 0 64px; width: 64px; height: 64px; border-radius: var(--r-md); overflow: hidden; background: var(--bg); display: grid; place-items: center; }
.result .thumb img { width: 100%; height: 100%; object-fit: cover; }
.result .noimg { font-size: var(--t-xs); color: var(--muted); }
.result .code { display: block; font-weight: 700; font-size: var(--t-base); word-break: break-all; }
.result .facts { display: block; color: var(--muted); font-size: var(--t-sm); margin-top: 2px; }

/* Converter detail */
.detail { display: grid; gap: var(--s3); margin-top: var(--s2); }
@media (min-width: 800px) { .detail { grid-template-columns: 320px 1fr; align-items: start; } }
.facts-list { display: grid; grid-template-columns: max-content 1fr; gap: var(--s2) var(--s4); margin: 0; }
.facts-list dt { color: var(--muted); font-size: var(--t-md); }
.facts-list dd { margin: 0; font-weight: 600; }
.muted { color: var(--muted); font-weight: 400; }
.badge-est { display: inline-block; font-size: var(--t-xs); font-weight: 700; color: var(--warn); background: #fff4da; border: 1px solid #ecd7a4; border-radius: var(--r-pill); padding: 2px var(--s2); }
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s2); }
@media (min-width: 560px) { .gallery { grid-template-columns: repeat(3, 1fr); } }
.gallery img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--r-md); border: 1px solid var(--line); cursor: pointer; }

/* Photo lightbox (click a thumbnail; click / Esc to close and return) */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; padding: var(--s4); }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--r-sm); }
.lightbox-close { position: absolute; top: var(--s2); right: var(--s4); background: none; border: 0; color: #fff; font-size: 2.4rem; line-height: 1; cursor: pointer; }

/* Forms */
.form-stack label { font-weight: 600; font-size: var(--t-md); }
.row2 { display: grid; grid-template-columns: 1fr; gap: 0 var(--s3); }
@media (min-width: 520px) { .row2 { grid-template-columns: 2fr 1fr; } }
.req { color: var(--alert); }
.btn-secondary {
  display: inline-block; min-height: var(--tap); padding: 12px var(--s4);
  border: 1.5px solid var(--brand); background: transparent; color: var(--brand);
  border-radius: var(--r-md); font-weight: 700; font-size: var(--t-md); cursor: pointer;
  transition: background .15s var(--ease);
}
.btn-secondary:hover { background: var(--brand-soft); }
.btn-inline { width: auto; margin: 0; min-height: 0; padding: 10px var(--s3); font-size: var(--t-md); text-decoration: none; display: inline-block; }
.btn-confirm { margin-top: var(--s3); }
details.card > summary { cursor: pointer; font-weight: 700; min-height: var(--tap); display: flex; align-items: center; }
details.card[open] > summary { margin-bottom: var(--s3); }


/* Deal / quote detail */
.deal-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.deal-head h1 { margin-right: auto; }
.status-badge { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 3px 10px; border-radius: 999px; }
.status-quote { background: #e6efff; color: #1c4fb0; }
.status-purchase_confirmed { background: #e2f5e9; color: #1f7a4d; }
.status-closed, .status-cancelled { background: #eee; color: #666; }
.po { font-weight: 700; font-family: ui-monospace, monospace; background: var(--brand); color: #fff; padding: 3px 10px; border-radius: 8px; }
.flash-ok { background: #e2f5e9; color: #1f7a4d; border: 1px solid #b7e2c8; padding: 10px 12px; border-radius: 10px; font-size: .92rem; }

.lines { display: grid; gap: 10px; }
.line { border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.line:last-child { border-bottom: 0; padding-bottom: 0; }
.line-code { font-weight: 700; word-break: break-word; }
.line-code .qty { color: var(--brand); }
.line-code .linked { font-size: .78rem; font-weight: 400; }
.line-facts { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: .84rem; margin-top: 3px; }
.line-edit { margin-top: 6px; }
.line-edit > summary { cursor: pointer; font-size: .82rem; color: var(--accent); font-weight: 600; }
.line-edit[open] > summary { margin-bottom: 8px; }
.wa-copy { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 14px; }
.wa-copy .btn-secondary { width: auto; margin: 0; }
.wa-text { width: 100%; min-height: 90px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); font: inherit; }

.units { display: grid; grid-template-columns: 1fr; gap: 6px; }
@media (min-width: 560px) { .units { grid-template-columns: repeat(2, 1fr); } }
.unit { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); }
.unit-po { font-family: ui-monospace, monospace; font-weight: 700; }
.unit-code { color: var(--muted); font-size: .85rem; margin-right: auto; word-break: break-all; }
.unit-status { font-size: .72rem; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); }

/* Recent quotes list */
.result-quote { display: block; text-decoration: none; color: inherit; padding: 12px; }
.result-quote:hover { border-color: var(--brand); }
.rq-top { display: flex; justify-content: space-between; gap: 8px; }
.rq-cust { font-weight: 700; }
.rq-date { color: var(--muted); font-size: .82rem; }
.rq-codes { color: var(--ink); font-size: .92rem; margin: 4px 0 2px; word-break: break-word; }
.rq-facts { color: var(--muted); font-size: .82rem; }

/* Deal history rows */
.dealhist { display: grid; gap: 8px; }
.dh-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px 10px; border-bottom: 1px solid var(--line); padding-bottom: 7px; }
.dh-row:last-child { border-bottom: 0; padding-bottom: 0; }
.dh-main { font-weight: 600; font-size: .92rem; }
.dh-nums { grid-column: 2 / 4; color: var(--muted); font-size: .84rem; }
.dh-date { grid-row: 1; grid-column: 3; color: var(--muted); font-size: .8rem; white-space: nowrap; }

/* Customers */
.cust-row { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding: 8px 0; }
.cust-row:last-child { border-bottom: 0; }
.cust-rename { display: flex; align-items: center; gap: 6px; margin: 0; flex: 1; min-width: 200px; }
.cust-rename input { flex: 1; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); }
.cust-facts { color: var(--muted); font-size: .85rem; }

/* Dashboard alerts */
/* Action alerts: the count carries the emphasis — no side stripe. */
.alerts { display: grid; gap: var(--s2); margin: var(--s4) 0; }
.alert-row { display: flex; align-items: center; gap: var(--s3); min-height: var(--tap);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: var(--s3) var(--s4); text-decoration: none; color: inherit; transition: border-color .15s var(--ease); }
.alert-row:hover { border-color: var(--brand); }
.alert-count { font-size: var(--t-xl); font-weight: 800; min-width: 2ch; text-align: right; color: var(--brand); }
.alert-text { font-size: var(--t-md); line-height: 1.35; }
.alert-go { margin-left: auto; color: var(--muted); }

/* Valuation & confidence */
.valuation .val-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.valuation .val-head h2 { margin: 0; }
.conf-badge { font-size: .74rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.conf-high { background: #e2f5e9; color: #1f7a4d; }
.conf-medium { background: #fff3d6; color: #8a5a00; }
.conf-low { background: #fdecea; color: #b3261e; }
.conf-none { background: #eee; color: #666; }
.val-figures { display: flex; flex-wrap: wrap; gap: 18px; margin: 12px 0 4px; }
.val-fig { display: flex; flex-direction: column; }
.val-num { font-size: 1.5rem; font-weight: 800; }
.val-lbl { font-size: .8rem; color: var(--muted); }
.val-reasons { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: .85rem; }
.hist { width: 100%; border-collapse: collapse; font-size: .9rem; }
.hist th, .hist td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line); }
.hist th { color: var(--muted); font-weight: 600; }
.suggest-box { background: #eef4ff; border: 1px solid #cfe0ff; border-radius: 10px; padding: 10px 12px; font-size: .9rem; }
.offer-suggest { margin: 2px 0 8px; font-size: .95rem; color: var(--accent); }

/* Quote type-ahead */
.typeahead { position: relative; }
.ta-results { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; margin-top: 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  box-shadow: 0 8px 24px rgba(20,30,50,.14); max-height: 300px; overflow-y: auto; }
.ta-item { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; width: 100%;
  text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line);
  padding: 11px 12px; cursor: pointer; color: var(--ink); font: inherit; }
.ta-item:last-child { border-bottom: 0; }
.ta-item:hover { background: rgba(47,111,237,.10); }
.ta-code { font-weight: 700; word-break: break-all; }
.ta-tag { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.conv-info { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: .9rem; }
.metal-est { display: inline-block; margin-top: 4px; color: var(--brand); }

/* 'All info' overlay on the quote screen (iframe of the converter page) */
.info-overlay { position: fixed; inset: 0; z-index: 90; background: var(--bg); display: flex; flex-direction: column; }
.info-bar { flex: 0 0 auto; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--card); }
.info-bar .btn-secondary { width: auto; margin: 0; }
#infoFrame { flex: 1 1 auto; width: 100%; border: 0; }

/* Recent-quotes list with inline confirm */
.result-quote-row { padding: 0; overflow: hidden; }
.rq-link { display: block; padding: 12px; text-decoration: none; color: inherit; }
.rq-link:hover { background: rgba(47,111,237,.06); }
.rq-confirm { margin: 0; border-top: 1px solid var(--line); }
.rq-confirm button { width: 100%; border-radius: 0; padding: 12px; border: 0; background: var(--brand); color: #fff; font-weight: 700; font-size: .95rem; cursor: pointer; }
.rq-confirm button:hover { filter: brightness(1.05); }

/* Quote history dropdown */
.hist-wrap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: -2px 0 6px; }
.hist-panel { flex-basis: 100%; }
a.btn-history { text-decoration: none; display: inline-block; }
.btn-history { background: none; border: 1px solid var(--line); border-radius: 8px; color: var(--accent);
  font-weight: 700; font-size: .85rem; padding: 7px 12px; cursor: pointer; }
.hist-panel { margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  max-height: 280px; overflow-y: auto; }
.hist-head { padding: 8px 12px; font-size: .82rem; font-weight: 700; color: var(--muted);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); }
.hist-row { display: flex; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--line); font-size: .86rem; }
.hist-row:last-child { border-bottom: 0; }
.hist-date { flex: 0 0 84px; color: var(--muted); white-space: nowrap; }
.hist-info { flex: 1; }
.hist-badge { display: inline-block; font-size: .68rem; font-weight: 700; text-transform: uppercase;
  background: #e2f5e9; color: #1f7a4d; border-radius: 999px; padding: 1px 7px; margin-right: 6px; }
.hist-empty { padding: 12px; color: var(--muted); font-size: .88rem; margin: 0; }
@media (prefers-color-scheme: dark) { .hist-badge { background: #163a28; color: #8fe0b0; } }
.ta-item.ta-new { background: rgba(31,122,77,.10); }
.ta-item.ta-new .ta-code { color: var(--brand); font-weight: 700; }
.cust-note { margin: 2px 0 4px; font-size: .85rem; }
.cust-note.ok { color: var(--brand); }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
.offer-note { margin: 2px 0 6px; font-size: .92rem; color: var(--accent); }
.sug-offer { font-size: 1rem; }
.sug-offer strong { color: var(--accent); }

/* Processing / boxes */
.tablinks { font-size: .9rem; }
.tablinks a { color: var(--brand); font-weight: 700; text-decoration: none; }
.proc-unit .pline-head { gap: 10px; margin-bottom: 10px; }
.proc-form { margin-bottom: 6px; }
.ref-note { align-self: end; padding: 8px 0; font-size: .9rem; }

/* Pickup */
.pline { border-bottom: 1px solid var(--line); padding: 10px 0; }
.pline:last-of-type { border-bottom: 0; }
.pline-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin-bottom: 6px; }
.unit-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.chk { display: flex; align-items: center; gap: 10px; flex: 1; font-weight: 600; cursor: pointer; }
.chk input { width: 22px; height: 22px; }
.pct-in { width: 72px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); }
.nla-list { display: flex; flex-direction: column; gap: 4px; }
.nla-form { margin: 0; }
.btn-linkish { background: none; border: 0; color: var(--alert); text-decoration: underline; padding: 4px 0; font-size: .9rem; cursor: pointer; }
.status-pay-unpaid { background: #fdecea; color: #b3261e; }
.status-pay-partial { background: #fff3d6; color: #8a5a00; }
.status-pay-paid { background: #e2f5e9; color: #1f7a4d; }
.pay-history { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.pay-row { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: .9rem; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1319; --card: #191e27; --ink: #eef2f8; --ink-soft: #c3ccdb;
    --muted: #a7b2c5; --line: #2c333f; --line-strong: #3d4552;
    --brand: #34a76c; --brand-ink: #04150c; --brand-soft: #16301f;
    --accent: #7aa7ff; --alert: #ff8f86; --warn: #f0c66a;
  }
  .btn-primary:hover { background: #3fbb7c; }
  .alert { background: #3a1e1c; border-color: #5c2b27; color: #ff9b93; }
  code { background: #262c37; }
  .badge-est { color: #f0c66a; background: #3a2f14; border-color: #5c4a1e; }
  .status-quote { background: #16305c; color: #a9c8ff; }
  .status-purchase_confirmed { background: #163a28; color: #8fe0b0; }
  .status-closed, .status-cancelled { background: #2b313d; color: #9aa6bd; }
  .flash-ok { background: #163a28; border-color: #245c3c; color: #8fe0b0; }
  .status-pay-unpaid { background: #3a1e1c; color: #ff9b93; }
  .status-pay-partial { background: #3a2f14; color: #f0c66a; }
  .status-pay-paid { background: #163a28; color: #8fe0b0; }
  .conf-high { background: #163a28; color: #8fe0b0; }
  .conf-medium { background: #3a2f14; color: #f0c66a; }
  .conf-low { background: #3a1e1c; color: #ff9b93; }
  .conf-none { background: #2b313d; color: #9aa6bd; }
  .suggest-box { background: #16233a; border-color: #274465; }
}

/* Purchase history ledger (history.php) */
.hist-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 16px; }
.hist-tile { text-decoration: none; color: inherit; display: block; }
.hist-tile:hover { border-color: var(--brand); }
.hist-tile .big { display: block; font-size: 1.7rem; font-weight: 800; line-height: 1.1; }
.hist-tile .small { display: block; color: var(--muted); font-size: .82rem; margin-top: 6px; }
.hist-sum { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 12px 0; }
.hist-list { margin-top: 10px; }
.hist-row { display: block; text-decoration: none; color: inherit; padding: 9px 2px; border-bottom: 1px solid var(--line); }
a.hist-row:hover .hist-code { color: var(--brand); }
.hist-main { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.hist-code { font-weight: 700; word-break: break-all; }
.hist-paid { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hist-meta { display: block; font-size: .8rem; margin-top: 2px; }

/* Streamlined pickups + balances actions */
.bulk-all { margin: 12px 0 4px; }
.pickup-row, .balance-row { display: grid; gap: 10px; }
.pickup-open { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; text-decoration: none; color: inherit; }
.pickup-open:hover .rq-cust { color: var(--brand); }
.pickup-do { margin: 0; }
.pickup-do .btn-primary { width: 100%; }
.pickup-adjust { font-size: .82rem; color: var(--muted); text-decoration: none; }
.pickup-adjust:hover { color: var(--brand); }
.balance-actions { display: grid; gap: 6px; }
.balance-actions .btn-primary { width: 100%; }
details.partial > summary { cursor: pointer; font-size: .84rem; color: var(--muted); padding: 4px 0; }
.partial-form { display: flex; gap: 8px; margin-top: 6px; }
.partial-form input[type="text"] { flex: 1; min-width: 0; }
.partial-form .btn-secondary { width: auto; margin: 0; white-space: nowrap; }
.chk.selectall { display: flex; align-items: center; gap: 8px; font-weight: 700;
  padding-bottom: 10px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }

/* Pickup checklist — one clear row per converter, always visible */
/* Each control on its own full-width row so nothing can be pushed off-screen. */
.pu-toolbar { display: block; padding-bottom: 10px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.pu-toolbar .chk.selectall,
.pu-toolbar .opt-toggle { display: flex; align-items: center; gap: 10px; width: 100%; margin: 0; padding: 0; border: 0; }
.pu-toolbar .chk.selectall { font-weight: 700; margin-bottom: 14px; }
.pu-toolbar .opt-toggle { color: var(--muted); font-size: .9rem; cursor: pointer; }
.pu-toolbar .chk.selectall input[type="checkbox"],
.pu-toolbar .opt-toggle input[type="checkbox"] { width: 20px; height: 20px; flex: 0 0 auto; }
.pu-list { margin: 4px 0 14px; }
.pu-item { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--line); }
.pu-check { display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 700; font-size: 1.02rem; min-width: 0; }
.pu-check input[type="checkbox"] { width: 22px; height: 22px; flex: 0 0 auto; accent-color: var(--brand); }
.pu-name { word-break: break-all; }
.pu-item .pct-in { width: 60px; text-align: center; display: none; }
.pu-list.show-pct .pct-in { display: inline-block; }
.pu-sub { grid-column: 1 / -1; margin: 3px 0 0 34px; font-size: .8rem; }

/* Quote: "Eric pays same as app" toggle */
.same-app { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; margin: 2px 0 10px; cursor: pointer; }
.same-app input { width: 20px; height: 20px; }
input.is-mirrored { opacity: .55; background: var(--bg); }

/* Quote type-ahead: custom (no-code) converter option */
.ta-item.ta-custom { border-top: 1px dashed var(--line); }
.ta-item.ta-custom .ta-code { color: var(--accent); }
.conv-hint { margin-top: 4px; font-size: .82rem; }

.nopics { color: var(--alert); }

.mia-actions { display: flex; gap: 12px; align-items: center; }

/* Quote: Eric-price suggestion and the manual-price override */
.eric-suggest { margin: 2px 0 10px; font-size: var(--t-md); }
.eric-suggest .btn-history { margin-left: var(--s2); }
.manual-wrap { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s3); margin: 0 0 var(--s3); }
.manual-wrap > summary { cursor: pointer; font-weight: 600; font-size: var(--t-md); color: var(--muted); }
.manual-wrap[open] > summary { margin-bottom: var(--s2); color: var(--ink); }

/* Quote: Eco Cat re-price notice */
.reprice-note { margin: 6px 0 10px; padding: var(--s3); font-size: var(--t-md); line-height: 1.45;
  background: var(--brand-soft); border: 1px solid var(--brand); border-radius: var(--r-md); }

/* Quote totals + volume bonus */
.quote-total { margin-top: var(--s3); }
.qt-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); padding: var(--s2) 0; }
.qt-row .num { font-variant-numeric: tabular-nums; font-weight: 600; }
.qt-grand { border-top: 1px solid var(--line); margin-top: var(--s1); padding-top: var(--s3); font-size: var(--t-lg); }
.qt-grand .num { font-weight: 800; }
.bonus-form { margin-top: var(--s3); border-top: 1px solid var(--line); padding-top: var(--s3); }
.bonus-form label { font-size: var(--t-md); font-weight: 600; }
.bonus-row { display: flex; gap: var(--s2); align-items: center; }
.bonus-row input { flex: 1; min-width: 0; margin-top: 0; }
.bonus-row .btn-inline { white-space: nowrap; }

/* Quote: the always-open "add a converter" panel */
.add-conv { border: 2px solid var(--brand); }
.add-conv h2 { margin-top: 0; }
.add-conv .typeahead { position: relative; }
.add-conv .btn-primary { margin-top: var(--s3); }

/* New quote: converters collected on the page before registering */
.quote-basket { border: 2px solid var(--brand); }
.quote-basket h2 { margin-top: 0; }
.basket-lines { margin-bottom: var(--s2); }
.bk-line { display: flex; align-items: baseline; gap: var(--s3); padding: var(--s2) 0; border-bottom: 1px solid var(--line); }
.bk-code { font-weight: 700; word-break: break-all; margin-right: auto; }
.bk-amt { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.bk-del { flex: 0 0 auto; }
.basket-bonus { display: block; margin-top: var(--s3); font-size: var(--t-md); font-weight: 600; }
#registerBtn { margin-top: var(--s3); }
.bk-bonus .bk-code { font-weight: 600; color: var(--muted); }

/* Boxing: split one converter code across several boxes */
.split-panel { margin-top: var(--s2); padding: var(--s3); background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--r-md); }
.split-panel .hint { margin: 0 0 var(--s2); }
.split-boxes { display: flex; flex-wrap: wrap; gap: var(--s3); }
.split-box { display: flex; align-items: center; gap: var(--s2); font-weight: 700; margin: 0; }
.split-box input { width: 68px; margin: 0; text-align: center; }
.split-left { margin: var(--s2) 0 0; font-size: var(--t-md); color: var(--muted); }
.split-left.over { color: var(--alert); font-weight: 600; }
.split-left.done { color: var(--brand); font-weight: 600; }
