/* Control Forge — dark, monochrome theme matching the brand mark */

:root {
  color-scheme: dark;
  --bg: #0b0a09;
  --surface: #141312;
  --surface-2: #1b1a18;
  --surface-3: #252321;
  --border: #2b2926;
  --border-strong: #3d3a36;
  --text: #f4f3f1;
  --muted: #9d9891;
  --brand: #f4f3f1;           /* the mark's "white" */
  --brand-ink: #0a0908;       /* the mark's "black" */
  --brand-soft: rgba(244, 243, 241, 0.08);
  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, 0.12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.12);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, 0.12);
  --violet: #c4b5fd;
  --violet-soft: rgba(196, 181, 253, 0.12);
  --whatsapp: #25d366;
  --viber: #7360f2;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  --tabbar-h: 0px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  overflow-x: hidden;
}

a { color: var(--text); text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
a:hover { text-decoration: underline; text-decoration-color: var(--muted); }
p a, .help a, .page-info a, .crumbs a { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.4em; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 1.8rem; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.8em; }
img { max-width: 100%; display: block; }
s { text-decoration-thickness: 1px; }
button, a, input, select, textarea, label { touch-action: manipulation; }

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

.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.page { flex: 1; padding-top: 28px; padding-bottom: 48px; }
.narrow { max-width: 460px; margin: 20px auto; }
.narrow-left { max-width: 640px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.strong { font-weight: 700; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.inline { display: inline; margin: 0; }
.text-warn { color: var(--warn); }
.text-ok { color: var(--ok); }
.pad { padding: 20px; }
.pad-x { padding-left: 20px; padding-right: 20px; }
.stack { display: grid; gap: 16px; align-content: start; }
.icon { flex: none; width: 22px; height: 22px; }
.brand-eyebrow { text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.72rem; font-weight: 700; color: var(--muted); }

/* --- Top bar ------------------------------------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(11, 10, 9, 0.86);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-inner { display: flex; align-items: center; gap: 24px; height: 68px; }
.brand { display: block; flex: none; }
.brand img { height: 32px; width: auto; }
.topbar-search { position: relative; flex: 1; max-width: 480px; }
.topbar-search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.topbar-search input { width: 100%; border-radius: 999px; padding-left: 42px; background: var(--surface); }
.topnav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.topnav a, .linklike {
  color: var(--muted);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
}
.topnav a:hover, .linklike:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.topnav a.active { color: var(--text); background: var(--surface-2); }
.linklike { background: none; border: 0; cursor: pointer; }
.cart-link { display: inline-flex; align-items: center; gap: 6px; }
.pill {
  display: inline-grid; place-items: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--brand); color: var(--brand-ink);
  font-size: 0.72rem; font-weight: 800; line-height: 1;
}

.tabbar { display: none; }

.footer { border-top: 1px solid var(--border); padding: 24px 0; font-size: 0.82rem; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer-logo { height: 22px; width: auto; opacity: 0.7; }

/* --- Cards & layout ----------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.page-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.page-head p { margin: 0; max-width: 720px; }
.section { margin-top: 40px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-top: 16px; padding-bottom: 8px; }
.section-head h2 { margin: 0; }
.section-head a { color: var(--muted); font-size: 0.9rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.two-col.wide-left { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.grid-wide { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

.empty {
  text-align: center; padding: 56px 20px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
}

.crumbs { display: flex; gap: 8px; color: var(--muted); font-size: 0.85rem; margin-bottom: 16px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }

/* --- Item cards --------------------------------------------------------- */

.item-card { display: flex; flex-direction: column; overflow: hidden; transition: border-color .15s, transform .15s; }
.item-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.thumb { display: block; text-decoration: none; aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-placeholder {
  display: grid; place-items: center; width: 100%; height: 100%;
  font-size: 1.8rem; font-weight: 800; letter-spacing: 0.08em; color: var(--border-strong);
  background:
    radial-gradient(circle at 50% 50%, transparent 31%, var(--surface-3) 31.5%, var(--surface-3) 35%, transparent 35.5%),
    linear-gradient(var(--surface-2), var(--surface-2));
}
.thumb-placeholder.large { font-size: 3.6rem; aspect-ratio: 1; }
.item-body { display: flex; flex-direction: column; gap: 8px; padding: 14px; flex: 1; }
.item-body form { margin-top: auto; }
.item-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 0.8rem; color: var(--muted); margin: 0; }
.item-meta > * + *::before { content: "·"; margin-right: 8px; }
.item-meta a { color: var(--muted); text-decoration: none; }
.item-meta a:hover { color: var(--text); }
.item-title { margin: 0; font-size: 1rem; font-weight: 600; }
.item-title a { text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.price { font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.price.large { font-size: 1.7rem; margin: 0.2em 0; }

/* --- Item detail -------------------------------------------------------- */

.detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.detail-media { overflow: hidden; }
.detail-media img { width: 100%; }
.detail-info h1 { font-size: 2rem; }
.buy-box { padding: 16px; margin: 16px 0; display: grid; gap: 8px; }
.buy-row { display: flex; gap: 8px; }
.buy-row .stepper { flex: none; }
.buy-row .btn { flex: 1; }
.prose { color: #d6d3ce; }
.prose p:last-child { margin-bottom: 0; }

/* --- Sellers ------------------------------------------------------------ */

.avatar {
  flex: none; display: grid; place-items: center; overflow: hidden;
  width: 56px; height: 56px; border-radius: 14px;
  background: var(--surface-3); color: var(--text); font-weight: 800; letter-spacing: 0.04em;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.small { width: 40px; height: 40px; border-radius: 10px; font-size: 0.8rem; }
.avatar.large { width: 96px; height: 96px; border-radius: 22px; font-size: 1.8rem; }
.seller-card { display: flex; gap: 16px; padding: 18px; text-decoration: none; transition: border-color .15s; }
.seller-card:hover { border-color: var(--border-strong); text-decoration: none; }
.seller-card h3 { margin-bottom: 2px; }
.seller-card p { margin: 0 0 6px; }
.seller-hero { display: flex; gap: 24px; padding: 24px; margin-bottom: 20px; align-items: flex-start; }

/* --- Badges & chips ----------------------------------------------------- */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 0.74rem; font-weight: 600; white-space: nowrap;
  background: var(--surface-3); color: var(--muted);
  border: 1px solid transparent; vertical-align: middle;
}
.stock-ok, .status-completed { background: var(--ok-soft); color: var(--ok); }
.stock-low, .status-pending { background: var(--warn-soft); color: var(--warn); }
.stock-out, .status-expired { background: var(--danger-soft); color: var(--danger); }
.status-quoted { background: var(--info-soft); color: var(--info); }
.status-confirmed { background: var(--violet-soft); color: var(--violet); }
.status-cancelled { background: var(--surface-3); color: var(--muted); }
.kind-reservation { border-color: var(--border-strong); color: var(--text); background: transparent; }
.kind-quotation { border-color: var(--border); background: transparent; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.chip {
  padding: 7px 14px; border-radius: 999px; font-size: 0.85rem; white-space: nowrap;
  border: 1px solid var(--border); color: var(--muted); background: var(--surface); text-decoration: none;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); text-decoration: none; }
.chip.active { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }

/* --- Forms -------------------------------------------------------------- */

input, select, textarea {
  font: inherit; color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  min-height: 42px;
}
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--muted); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; padding: 0; accent-color: var(--brand); vertical-align: middle; }
input[type="file"] { padding: 8px; }
input[type="file"]::file-selector-button {
  font: inherit; color: var(--text); background: var(--surface-3);
  border: 1px solid var(--border-strong); border-radius: 6px; padding: 4px 10px; margin-right: 10px; cursor: pointer;
}
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
textarea { resize: vertical; min-height: 84px; }
select { cursor: pointer; }

.form { display: grid; gap: 16px; }
.form-grid { grid-template-columns: 1fr 1fr; }
.form-grid .field:has(textarea), .form-grid .field-check, .form-grid .form-actions, .form-grid > .flash { grid-column: 1 / -1; }
.field { display: grid; gap: 6px; align-content: start; }
.field label { font-weight: 600; font-size: 0.9rem; }
.field input:not([type="checkbox"]), .field select, .field textarea { width: 100%; }
.field-check label { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; min-height: 32px; }
.help { color: var(--muted); font-size: 0.8rem; }
.help ul { margin: 4px 0 0; padding-left: 18px; }
.errorlist { list-style: none; margin: 0; padding: 0; color: var(--danger); font-size: 0.85rem; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); white-space: nowrap; cursor: pointer; min-height: 42px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar input[type="search"] { flex: 1 1 260px; }

.qty-form { display: flex; gap: 6px; align-items: center; margin: 0; }
.qty-form input { width: 76px; min-height: 36px; padding: 5px 8px; }
.quote-cell input { width: 120px; text-align: right; min-height: 36px; padding: 5px 8px; }

/* Quantity stepper: [-] [n] [+] */
.stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); overflow: hidden; }
.stepper input { width: 52px; min-height: 40px; border: 0; border-radius: 0; text-align: center; background: transparent; padding: 0 4px; }
.stepper input:focus { box-shadow: none; }
.stepper button { width: 40px; display: grid; place-items: center; border: 0; background: transparent; color: var(--text); cursor: pointer; }
.stepper button:hover { background: var(--surface-3); }
.stepper button .icon { width: 16px; height: 16px; }
.no-js .stepper button, html:not(.js) .stepper button { display: none; }
.js [data-autosubmit-hide] { display: none; }

/* --- Buttons ------------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 8px 16px;
  font: inherit; font-weight: 600; font-size: 0.9rem; white-space: nowrap; text-decoration: none;
  color: var(--text); background: var(--surface-3);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  cursor: pointer; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: #2f2c29; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: #ffffff; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #1a0909; }
.btn-danger:hover { background: #fb8f8f; }
.btn-danger-ghost { background: transparent; border-color: transparent; color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-whatsapp { background: var(--whatsapp); border-color: var(--whatsapp); color: #052e16; }
.btn-whatsapp:hover { background: #3ee07a; }
.btn-viber { background: var(--viber); border-color: var(--viber); color: #fff; }
.btn-viber:hover { background: #8676f5; }
.btn-sm { min-height: 34px; padding: 4px 11px; font-size: 0.8rem; }
.btn-lg { min-height: 50px; padding: 12px 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn.is-done::after { content: " ✓"; }

/* --- Tables ------------------------------------------------------------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th, .table td { padding: 12px 16px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
.table th { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); background: var(--surface-2); }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.015); }
.table tfoot td { border-bottom: 0; font-weight: 700; }
.table .num { text-align: right; white-space: nowrap; }
.table .num .qty-form { justify-content: flex-end; }
.table td a { text-decoration: none; font-weight: 500; }
.table td a:hover { text-decoration: underline; }
.row-warn { background: var(--warn-soft); }

/* --- Cart, checkout & tracking ------------------------------------------ */

.seller-group { margin-bottom: 20px; overflow: hidden; }
.seller-group > .small, .seller-group > form, .seller-group > .quote-note, .seller-group > .message-details { margin: 12px 20px; }
.group-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.group-title { display: flex; gap: 12px; align-items: center; min-width: 0; }
.group-title h2, .group-title p { margin: 0; }
.group-title h2 a { text-decoration: none; }
.seller-group.is-sent { border-color: rgba(74, 222, 128, 0.45); }

.checkout-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  padding: 18px 20px; position: sticky; bottom: 16px; box-shadow: var(--shadow); z-index: 5;
}

.checkout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.checkout-side { display: grid; gap: 16px; }
.summary-group { display: grid; gap: 10px; }
.summary-group h3 { margin: 0; }
.summary-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 0.9rem; }
.summary-lines li, .summary-total { display: flex; justify-content: space-between; gap: 12px; }
.summary-lines li span:last-child { color: var(--muted); white-space: nowrap; }
.summary-total { font-weight: 700; border-top: 1px solid var(--border); padding-top: 10px; }
.summary-total.big { font-size: 1.1rem; border: 0; padding: 0 0 14px; }

.callout {
  padding: 18px 20px; margin-bottom: 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-left: 4px solid var(--brand);
}
.callout p { margin: 0; }
.send-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.quote-note { padding: 12px 14px; border-left: 3px solid var(--info); background: var(--info-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.quote-note p:last-child { margin-bottom: 0; }
.message-details summary { cursor: pointer; color: var(--muted); font-size: 0.85rem; padding: 4px 0; }
.message-details summary:hover { color: var(--text); }
.message-preview {
  white-space: pre-wrap; word-break: break-word;
  font: 0.84rem/1.5 var(--mono);
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; margin: 8px 0 0; max-height: 360px; overflow: auto;
}

/* --- Dashboard ---------------------------------------------------------- */

.dash { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 24px; align-items: start; }
.dash-nav { position: sticky; top: 92px; padding: 12px; }
.dash-seller { display: flex; gap: 10px; align-items: center; padding: 6px 6px 14px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.dash-seller strong { display: block; line-height: 1.2; }
.dash-nav nav { display: grid; gap: 2px; }
.dash-nav nav a, .dash-nav .linklike { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--muted); text-decoration: none; }
.dash-nav nav a:hover, .dash-nav .linklike:hover { background: var(--surface-2); color: var(--text); }
.dash-nav nav a.active { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
.dash-nav form { margin: 0; }
.action-row { display: flex; gap: 8px; flex-wrap: wrap; }
.action-row form { margin: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { padding: 16px 18px; display: grid; gap: 2px; text-decoration: none; transition: border-color .15s; }
.stat:hover { border-color: var(--border-strong); text-decoration: none; }
.stat-value { font-size: 1.8rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat-value small { font-size: 1rem; color: var(--muted); font-weight: 500; }
.stat-label { color: var(--muted); font-size: 0.85rem; }

.dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 12px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; overflow-wrap: anywhere; }

/* --- Pagination & flash ------------------------------------------------- */

.pagination { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 28px; }
.pagination a, .pagination span {
  min-width: 42px; height: 42px; padding: 0 12px;
  display: inline-grid; place-items: center;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  color: var(--muted); background: var(--surface); text-decoration: none;
}
.pagination a:hover { color: var(--text); border-color: var(--border-strong); }
.pagination .current { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 800; }
.pagination .disabled { opacity: 0.35; }
.pagination .ellipsis { border-color: transparent; background: none; min-width: 20px; padding: 0; }
.page-info { text-align: center; color: var(--muted); font-size: 0.8rem; margin-top: 10px; }

.flash-stack { display: grid; gap: 8px; margin-bottom: 20px; }
.flash { padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); }
.flash ul { margin: 0; padding-left: 18px; }
.flash-success { border-color: rgba(74, 222, 128, 0.35); background: var(--ok-soft); }
.flash-warning { border-color: rgba(251, 191, 36, 0.35); background: var(--warn-soft); }
.flash-error { border-color: rgba(248, 113, 113, 0.35); background: var(--danger-soft); }
.flash-info { border-color: rgba(96, 165, 250, 0.35); background: var(--info-soft); }

/* --- Tablet ------------------------------------------------------------- */

@media (max-width: 960px) {
  .topbar-inner { gap: 16px; }
  .topbar-search { max-width: none; }
  .detail, .checkout, .two-col, .two-col.wide-left, .dash { grid-template-columns: minmax(0, 1fr); }
  .detail { gap: 20px; }
  .dash { gap: 16px; }
  .dash-nav { position: static; padding: 8px; }
  .dash-seller { display: none; }
  .dash-nav nav { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
  .dash-nav nav::-webkit-scrollbar { display: none; }
  .dash-nav nav a, .dash-nav .linklike { width: auto; white-space: nowrap; }
}

/* --- Phone -------------------------------------------------------------- */

@media (max-width: 720px) {
  :root { --tabbar-h: 64px; }
  body { font-size: 15px; padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom)); }
  .container { padding: 0 14px; }
  .page { padding-top: 18px; padding-bottom: 28px; }
  h1 { font-size: 1.45rem; }
  .detail-info h1 { font-size: 1.5rem; }

  /* Prevent iOS from zooming into focused fields */
  input, select, textarea { font-size: 16px; min-height: 46px; }

  /* Header: logo + search on one row; links move to the tab bar */
  .topbar-inner { height: 60px; gap: 12px; }
  .brand img { height: 24px; }
  .topnav { display: none; }
  .topbar-search input { min-height: 40px; padding-top: 6px; padding-bottom: 6px; }

  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--tabbar-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: rgba(11, 10, 9, 0.94);
    backdrop-filter: saturate(140%) blur(14px);
    -webkit-backdrop-filter: saturate(140%) blur(14px);
    border-top: 1px solid var(--border);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--muted); font-size: 0.68rem; font-weight: 600; text-decoration: none;
  }
  .tabbar a.active { color: var(--text); }
  .tabbar a.active .icon { stroke-width: 2.3; }
  .tab-icon { position: relative; display: inline-flex; }
  .tab-icon .pill { position: absolute; top: -6px; right: -12px; min-width: 18px; height: 18px; font-size: 0.66rem; padding: 0 5px; }

  .footer { padding: 18px 0; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 10px; }

  .page-head { margin-bottom: 14px; align-items: stretch; }
  .page-head > .btn, .page-head > .action-row { width: 100%; }
  .page-head > .btn { justify-content: center; }
  .action-row form { flex: 1; }
  .action-row .btn { width: 100%; }

  /* Filters: full-width search, two selects per row */
  .toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .toolbar > * { min-width: 0; width: 100%; }
  .toolbar input[type="search"] { grid-column: 1 / -1; }
  .toolbar .check { grid-column: 1 / -1; min-height: 0; }
  .toolbar .btn { width: 100%; }

  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -14px 16px; padding: 0 14px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }

  /* Product grid: two compact columns */
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid-wide { grid-template-columns: 1fr; }
  .item-body { padding: 10px; gap: 6px; }
  .item-meta > :not(:first-child) { display: none; }
  .item-title { font-size: 0.92rem; }
  .item-foot { flex-direction: column; align-items: flex-start; gap: 4px; }
  .item-card .btn { min-height: 38px; font-size: 0.85rem; }
  .item-card:hover { transform: none; }

  .detail-media { max-width: 420px; }
  .seller-hero { flex-direction: column; gap: 14px; padding: 18px; }
  .seller-card { padding: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .card.pad, .pad { padding: 16px; }

  /* Seller groups & sending */
  .group-head { padding: 14px 16px; }
  .group-head > .btn, .send-actions { width: 100%; }
  .send-actions .btn { flex: 1; }
  .seller-group > .small, .seller-group > form, .seller-group > .quote-note, .seller-group > .message-details { margin: 12px 16px; }
  .checkout-bar { bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 10px); padding: 14px 16px; gap: 12px; }
  .checkout-bar .btn { width: 100%; }
  .checkout-bar > div { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; width: 100%; }
  .checkout-bar > div .small:last-child { display: none; }
  .checkout-bar .price.large { font-size: 1.3rem; margin: 0; }
  .checkout-bar .btn-lg { min-height: 46px; }

  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat-value { font-size: 1.5rem; }

  /* Tables become stacked cards: each cell shows its column label */
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tfoot, .table-stack tr { display: block; }
  .table-stack tbody tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .table-stack td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 3px 0; border: 0; text-align: right; }
  .table-stack td::before { content: attr(data-label); color: var(--muted); font-size: 0.8rem; font-weight: 500; text-align: left; }
  .table-stack td:not([data-label])::before { content: none; }
  .table-stack td.cell-main { display: block; text-align: left; padding-bottom: 6px; font-size: 0.98rem; }
  .table-stack td:empty { display: none; }
  .table-stack .num { text-align: right; }
  .table-stack tfoot tr { display: flex; justify-content: space-between; padding: 12px 16px; }
  .table-stack tfoot td { padding: 0; border: 0; }
  .table-stack tfoot td:empty { display: none; }

  .pagination { gap: 4px; }
  .pagination a, .pagination span { min-width: 40px; height: 40px; padding: 0 10px; }
  .pagination .label { display: none; }
}

@media (max-width: 360px) {
  .grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
