/* Goflow wholesale portal. Brand color comes from settings via --brand. Based on the Plant Trading Post portal styles. */

:root {
  --brand: #1f4e8c;
  --brand-ink: #ffffff;
  --brand-soft: color-mix(in srgb, var(--brand) 10%, #ffffff);
  --brand-line: color-mix(in srgb, var(--brand) 28%, #ffffff);
  --brand-dark: color-mix(in srgb, var(--brand) 80%, #000000);

  --bg: #f5f6f2;
  --surface: #ffffff;
  --surface-2: #fafbf8;
  --border: #e2e5dd;
  --border-strong: #cfd4c8;
  --text: #1c231e;
  --muted: #646d66;
  --faint: #8b938c;

  --success: #2f7d4a;
  --success-bg: #e8f4ec;
  --warn: #9a6500;
  --warn-bg: #fdf3dc;
  --danger: #b4302a;
  --danger-bg: #fbeae8;
  --info: #2d5f9a;
  --info-bg: #e8f0fa;
  --progress: #6a46b0;
  --progress-bg: #f0eafa;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(20, 30, 20, 0.05), 0 1px 3px rgba(20, 30, 20, 0.06);
  --shadow-lg: 0 8px 24px rgba(20, 30, 20, 0.12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5rem; font-weight: 650; }
h1 { font-size: 1.55rem; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.75rem; }
small, .small { font-size: 0.85em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); font-size: 0.9em; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.hidden { display: none !important; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
code { font-family: var(--mono); font-size: 0.88em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0.05em 0.35em; overflow-wrap: anywhere; }
pre { font-family: var(--mono); font-size: 0.82rem; background: #1d2420; color: #e9efe6; padding: 1rem; border-radius: var(--radius-sm); overflow-x: auto; line-height: 1.55; }
pre code { background: none; border: 0; padding: 0; color: inherit; }

.icon { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.icon-sm { width: 15px; height: 15px; vertical-align: -2px; }
.icon-lg { width: 28px; height: 28px; }

/* ---- App shell ------------------------------------------------------------------------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex: none; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
}
.brand { display: flex; align-items: center; padding: 1.25rem 1.25rem 1rem; }
.brand img { display: block; width: auto; max-width: 180px; max-height: 64px; object-fit: contain; }
.nav { padding: 0.25rem 0.6rem 1rem; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); padding: 0.9rem 0.6rem 0.3rem; }
.nav a {
  display: flex; align-items: center; gap: 0.65rem; padding: 0.5rem 0.65rem; border-radius: 8px;
  color: #3a433d; font-weight: 500;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--brand-soft); color: var(--brand-dark); }
.nav a.active .icon { color: var(--brand); }
.nav .icon { color: var(--faint); }
.nav .count {
  margin-left: auto; background: var(--brand); color: var(--brand-ink); font-size: 0.72rem; font-weight: 700;
  border-radius: 999px; padding: 0.05rem 0.45rem; min-width: 1.4rem; text-align: center;
}
.nav .count.alert { background: var(--danger); }
.sidebar-foot { border-top: 1px solid var(--border); padding: 0.75rem 0.9rem; display: flex; align-items: center; gap: 0.6rem; }
.avatar {
  width: 32px; height: 32px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark);
  display: grid; place-items: center; font-weight: 700; font-size: 0.78rem; flex: none;
}
.me { display: flex; align-items: center; gap: 0.55rem; color: var(--text); min-width: 0; flex: 1; }
.me:hover { text-decoration: none; }
.me-text { min-width: 0; }
.me-name { font-weight: 600; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-sub { font-size: 0.75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.content { padding: 1.75rem 2rem 4rem; max-width: 1240px; width: 100%; container-type: inline-size; }
.demo-banner {
  background: #fff8e1; border-bottom: 1px solid #f0dfa6; color: #6d5300; font-size: 0.85rem;
  padding: 0.45rem 2rem; display: flex; gap: 0.5rem; align-items: center;
}

@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; transform: translateX(-100%); transition: transform 0.2s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  body:has(.sidebar.open) { overflow: hidden; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.6rem 1rem;
    background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 40;
  }
  .topbar .brand { padding: 0; }
  .topbar .brand img { max-height: 38px; max-width: 150px; }
  .content { padding: 1.25rem 1rem 4rem; }
  .demo-banner { padding: 0.45rem 1rem; }
}
.scrim { display: none; }
.sidebar.open + .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.25); z-index: 45; }

/* ---- Page header -------------------------------------------------------------------------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin-top: 0.2rem; }
.page-head .actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
@container (max-width: 480px) { .page-head .actions .btn-primary { order: -1; } }
.breadcrumb { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.35rem; }
.breadcrumb a { color: var(--muted); }

/* ---- Cards & layout ------------------------------------------------------------------------ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 1.15rem 1.25rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { margin: 0; }
.card + .card, .card + .grid, .grid + .card, .stack > * + * { margin-top: 1rem; }
.grid > *, .split > *, .products > * { margin-top: 0 !important; }
.section-title { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 650; margin: 0 0 0.6rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start; }
/* Breakpoints follow the content column (not the viewport), so the sidebar is accounted for.
   Tracks are minmax(0, 1fr): a plain 1fr grows to its widest table instead of letting it scroll. */
@container (max-width: 960px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (max-width: 860px) { .split { grid-template-columns: minmax(0, 1fr); } .sticky { position: static; } }
@container (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
@container (max-width: 300px) { .grid-4 { grid-template-columns: minmax(0, 1fr); } }
.row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 0.75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.spacer { flex: 1; }
dl.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.4rem 1rem; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@container (max-width: 480px) { dl.facts { grid-template-columns: minmax(0, 1fr); gap: 0; } dl.facts dt { margin-top: 0.55rem; font-size: 0.82rem; } dl.facts dt:first-child { margin-top: 0; } }

/* ---- Stats -------------------------------------------------------------------------------- */
.stat { padding: 1rem 1.15rem; }
@container (max-width: 440px) { .stat { padding: 0.8rem 0.9rem; } .stat .value { font-size: 1.45rem; } }
.stat .label { color: var(--muted); font-size: 0.82rem; display: flex; align-items: center; gap: 0.4rem; }
.stat .value { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; margin-top: 0.15rem; }
.stat .hint { font-size: 0.8rem; color: var(--muted); }
a.stat { display: block; color: inherit; }
a.stat:hover { text-decoration: none; border-color: var(--brand-line); }

/* ---- Buttons ------------------------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; font: inherit; font-weight: 600;
  font-size: 0.9rem; line-height: 1.2; padding: 0.55rem 0.95rem; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; border-color: #b9c0b2; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-danger { color: var(--danger); border-color: #e7c2bf; }
.btn-danger:hover { background: var(--danger-bg); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border); }
.btn-sm { padding: 0.32rem 0.6rem; font-size: 0.82rem; border-radius: 6px; }
.btn-lg { padding: 0.75rem 1.25rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--brand-dark); cursor: pointer; }
button.link:hover { text-decoration: underline; }
form.inline { display: inline; }

/* ---- Forms -------------------------------------------------------------------------------- */
label { display: block; font-weight: 600; font-size: 0.86rem; margin-bottom: 0.3rem; }
.field { margin-bottom: 0.95rem; }
.field .help { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; font-weight: 400; }
input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"],
input[type="url"], input[type="tel"], input[type="date"], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: #fff; border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 0.52rem 0.7rem; min-height: 2.4rem;
}
textarea { min-height: 6rem; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); width: 1rem; height: 1rem; }
input[type="color"] { width: 3rem; height: 2.4rem; padding: 0.15rem; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; }
.check { display: flex; gap: 0.55rem; align-items: flex-start; font-weight: 500; margin-bottom: 0.75rem; }
.check input { margin-top: 0.2rem; flex: none; }
.check .help { display: block; }
.form-row { display: grid; gap: 0 0.85rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-row.three { grid-template-columns: 2fr 1fr 1fr; }
.form-row.four { grid-template-columns: 2fr 1fr 1fr 1fr; }
@container (max-width: 640px) { .form-row.four { grid-template-columns: 1fr 1fr; } }
@container (max-width: 480px) { .form-row, .form-row.three, .form-row.four { grid-template-columns: minmax(0, 1fr); } }
.form-actions { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin-top: 0.5rem; }
.filters { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.filters input[type="search"] { max-width: 280px; }
.filters select { width: auto; min-width: 160px; }
@container (max-width: 520px) {
  .filters .input-icon { flex: 1 1 12rem; }
  .filters input[type="search"] { max-width: none; }
  .filters .btn { order: 1; }
  .filters select { order: 2; flex: 1 1 9rem; min-width: 0; }
}
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 0.65rem; top: 50%; transform: translateY(-50%); color: var(--faint); }
.input-icon input { padding-left: 2.1rem; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
input[type="file"] { max-width: 100%; font: inherit; font-size: 0.88rem; }
input[type="file"]::file-selector-button { font: inherit; font-weight: 600; padding: 0.5rem 0.85rem; margin-right: 0.75rem; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; }
input[type="file"]::file-selector-button:hover { background: var(--surface-2); }

.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 2rem 1rem; text-align: center;
  background: var(--surface-2); cursor: pointer; transition: border-color 0.15s, background 0.15s; display: block;
}
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-soft); }
.dropzone input[type="file"] { display: none; }
.dropzone .title { font-weight: 650; font-size: 1rem; margin-top: 0.4rem; }
.dropzone .filename { margin-top: 0.4rem; font-weight: 600; color: var(--brand-dark); }

/* ---- Alerts ------------------------------------------------------------------------------- */
.alert { border-radius: var(--radius-sm); padding: 0.75rem 1rem; margin-bottom: 1rem; border: 1px solid; display: flex; gap: 0.6rem; align-items: flex-start; }
.alert-success { background: var(--success-bg); border-color: #bfdcc8; color: #1f5a34; }
.alert-error { background: var(--danger-bg); border-color: #efc5c1; color: #8c231e; }
.alert-info { background: var(--info-bg); border-color: #c7d8ee; color: #234b7a; }
.alert-warn { background: var(--warn-bg); border-color: #efd9a1; color: #6f4900; }
.alert ul { margin: 0.25rem 0 0; padding-left: 1.1rem; }
.alert .close { margin-left: auto; background: none; border: 0; cursor: pointer; color: inherit; opacity: 0.6; font-size: 1.1rem; line-height: 1; }

/* ---- Badges ------------------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.76rem; font-weight: 650; padding: 0.16rem 0.55rem;
  border-radius: 999px; white-space: nowrap; background: #eef0eb; color: #4a524c;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; opacity: 0.8; }
.badge.plain::before { display: none; }
.tone-success { background: var(--success-bg); color: var(--success); }
.tone-warn { background: var(--warn-bg); color: var(--warn); }
.tone-danger { background: var(--danger-bg); color: var(--danger); }
.tone-info { background: var(--info-bg); color: var(--info); }
.tone-progress { background: var(--progress-bg); color: var(--progress); }
.tone-muted { background: #f0f1ee; color: #7a827c; }
.tone-brand { background: var(--brand-soft); color: var(--brand-dark); }
.pill-new { background: var(--brand); color: var(--brand-ink); font-size: 0.68rem; font-weight: 700; border-radius: 999px; padding: 0.08rem 0.45rem; text-transform: uppercase; letter-spacing: 0.04em; }

/* ---- Tables ------------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 650; padding: 0.65rem 0.85rem; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 0.7rem 0.85rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fbfcfa; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.wrap { min-width: 180px; }
.table .primary { font-weight: 600; }
.card > .table-wrap > .table th:first-child, .card > .table-wrap > .table td:first-child { padding-left: 1.25rem; }
.card > .table-wrap > .table th:last-child, .card > .table-wrap > .table td:last-child { padding-right: 1.25rem; }
.table-compact td, .table-compact th { padding: 0.45rem 0.7rem; }
/* Phones: short cells stay on one line and the table scrolls sideways instead of every name
   wrapping word by word; long text (td.wrap: subjects, notes, errors) still wraps. */
@container (max-width: 640px) {
  .table th, .table td { white-space: nowrap; }
  .table td.wrap, .table td[colspan] { white-space: normal; min-width: 14rem; }
}

/* ---- Data tables ---------------------------------------------------------------------------- */
.dt-toolbar { display: flex; align-items: center; gap: 0.6rem; padding: 0.7rem 1rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.dt-search { flex: 1 1 240px; max-width: 420px; }
.dt-search input { min-height: 2.15rem; padding-top: 0.35rem; padding-bottom: 0.35rem; }
.dt-tools { display: flex; gap: 0.4rem; margin-left: auto; }
/* Phones: icon-only tools so search, columns and export share one row (labels stay for screen readers). */
@container (max-width: 480px) {
  .dt-search { flex-basis: 8rem; }
  .dt-tools .btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
.dt-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; padding: 0.5rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.15rem 0.3rem 0.15rem 0.65rem; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); border: 1px solid var(--brand-line); font-size: 0.8rem; font-weight: 600; }
.chip span { display: inline-grid; place-items: center; width: 1.15rem; height: 1.15rem; border-radius: 999px; font-size: 0.9rem; line-height: 1; }
.chip:hover { text-decoration: none; }
.chip:hover span { background: var(--brand); color: var(--brand-ink); }
.chip-clear { font-size: 0.8rem; margin-left: 0.2rem; }
.dt-table th { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.dt-table th, .dt-table td { padding-left: 0.7rem; padding-right: 0.7rem; }
/* Rows scroll inside the card (both ways) under a sticky header, so column names, the toolbar
   and the pagination stay in view. The header line is a shadow: collapsed borders don't stick. */
.dt-scroll { overflow: auto; max-height: max(22rem, calc(100vh - 15rem)); max-height: max(22rem, calc(100dvh - 15rem)); }
.dt-table thead th { position: sticky; top: 0; z-index: 2; border-bottom: 0; box-shadow: inset 0 -1px 0 var(--border); }
@media print { .dt-scroll { max-height: none; overflow: visible; } }
.th { display: inline-flex; align-items: center; gap: 0.2rem; }
.th-sort { display: inline-flex; align-items: center; gap: 0.25rem; color: inherit; }
.th-sort:hover { color: var(--text); text-decoration: none; }
.sort-idle { opacity: 0.35; }
.th-sort:hover .sort-idle { opacity: 0.85; }
.th-filter { border: 0; background: none; padding: 0.22rem; border-radius: 5px; color: var(--muted); cursor: pointer; display: inline-grid; place-items: center; opacity: 0.5; }
.th-filter:hover, .th-filter:focus-visible { background: var(--border); opacity: 1; color: var(--text); }
.th-filter.active { opacity: 1; color: var(--brand-ink); background: var(--brand); }
.table th.th-active { color: var(--brand-dark); }
.icon-xs { width: 13px; height: 13px; }
.dt-foot { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 0.55rem 1rem; border-top: 1px solid var(--border); }
.dt-per a { padding: 0.1rem 0.35rem; border-radius: 5px; color: var(--muted); margin-left: 0.1rem; }
.dt-per a:hover { text-decoration: none; background: var(--surface-2); }
.dt-per a.current { background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; }
.dt-pages { margin-left: auto; display: flex; gap: 0.2rem; align-items: center; }
.dt-pages .page { min-width: 2rem; height: 2rem; padding: 0 0.4rem; display: inline-grid; place-items: center; border-radius: 6px; color: var(--text); font-size: 0.85rem; border: 1px solid transparent; }
.dt-pages .page:hover { background: var(--surface-2); border-color: var(--border); text-decoration: none; }
.dt-pages .page.current { background: var(--brand); color: var(--brand-ink); font-weight: 700; }
.dt-pages .gap { color: var(--faint); padding: 0 0.2rem; }
.table .dt-actions { width: 1%; white-space: nowrap; text-align: right; }
.items-cell > div { white-space: nowrap; }
.items-cell > div + div { margin-top: 0.1rem; }
.row-actions { display: inline-flex; gap: 0.1rem; }
.row-actions .btn { padding: 0.3rem 0.4rem; }
.btn-danger-ghost:hover { color: var(--danger); background: var(--danger-bg); border-color: transparent; }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #962620; border-color: #962620; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Dialogs ---------------------------------------------------------------------------------- */
dialog.dt-dialog { border: 1px solid var(--border); border-radius: 14px; padding: 0; width: min(440px, calc(100vw - 2rem)); background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(20, 30, 20, 0.22); }
dialog.dt-dialog::backdrop { background: rgba(28, 35, 30, 0.35); backdrop-filter: blur(2px); }
.dt-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.75rem 0.85rem 0.75rem 1.15rem; border-bottom: 1px solid var(--border); }
.dt-dialog-head strong { display: inline-flex; gap: 0.45rem; align-items: center; }
.dt-dialog-body { padding: 1rem 1.15rem; max-height: 65vh; max-height: 65dvh; overflow-y: auto; }
.dt-dialog-body > .field:last-child { margin-bottom: 0; }
.dt-dialog-foot { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; padding: 0.75rem 1.15rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 14px 14px; }
.dt-dialog-actions { display: flex; gap: 0.5rem; margin-left: auto; }
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem; }
.preset { display: flex; align-items: center; gap: 0.5rem; margin: 0; padding: 0.45rem 0.6rem; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-weight: 500; font-size: 0.88rem; }
.preset:hover { border-color: var(--brand-line); background: var(--brand-soft); }
.preset:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); font-weight: 650; }
.preset-custom { margin: 0.35rem 0 0.6rem; }
.dt-number { display: grid; grid-template-columns: 84px 1fr; gap: 0.5rem; }
.dt-col-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.dt-col-list .check { margin: 0.3rem 0; }

/* ---- Empty states ------------------------------------------------------------------------- */
.empty { text-align: center; padding: 2.75rem 1rem; color: var(--muted); }
.empty .icon-lg { color: var(--brand-line); margin-bottom: 0.5rem; }
.empty h3 { color: var(--text); }

/* ---- Catalog ------------------------------------------------------------------------------ */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.product { display: flex; flex-direction: column; overflow: hidden; }
.product .media { aspect-ratio: 4 / 3; background: var(--brand-soft); display: grid; place-items: center; overflow: hidden; }
.product .media img { width: 100%; height: 100%; object-fit: cover; }
.product .media .icon-lg { width: 46px; height: 46px; color: var(--brand-line); }
.product .body { padding: 0.85rem 0.95rem 0.95rem; display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.product .name { font-weight: 650; line-height: 1.3; }
.product .meta { font-size: 0.8rem; color: var(--muted); }
.product .price { font-size: 1.15rem; font-weight: 700; }
.product .price s { font-size: 0.8rem; color: var(--faint); font-weight: 500; margin-left: 0.35rem; }
.product .foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: auto; padding-top: 0.5rem; }
.product details { font-size: 0.82rem; color: var(--muted); }
.product details summary { cursor: pointer; color: var(--brand-dark); font-weight: 600; }
.product.out { opacity: 0.72; }
/* Phones: a compact list (thumbnail beside the details) instead of full-width tiles. */
@container (max-width: 520px) {
  .products { grid-template-columns: minmax(0, 1fr); gap: 0.6rem; }
  .product { flex-direction: row; }
  .product .media { width: 96px; flex: none; aspect-ratio: 1; }
  .product .body { padding: 0.7rem 0.85rem; gap: 0.25rem; min-width: 0; }
  .product .desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}
.stock-in { color: var(--success); }
.stock-low { color: var(--warn); }
.stock-out, .stock-backorder { color: var(--danger); }
.stock { font-size: 0.8rem; font-weight: 650; display: inline-flex; align-items: center; gap: 0.3rem; }
.stock::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: currentColor; }
.live-note { font-size: 0.8rem; color: var(--muted); display: inline-flex; align-items: center; gap: 0.35rem; }
.live-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--success); box-shadow: 0 0 0 0 rgba(47, 125, 74, 0.5); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(47, 125, 74, 0.45); } 70% { box-shadow: 0 0 0 7px rgba(47, 125, 74, 0); } 100% { box-shadow: 0 0 0 0 rgba(47, 125, 74, 0); } }

/* ---- Order form ---------------------------------------------------------------------------- */
.lines { display: flex; flex-direction: column; gap: 0.6rem; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) 92px 96px 36px; gap: 0.6rem; align-items: center; }
.line .total { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.line-head { display: grid; grid-template-columns: minmax(0, 1fr) 92px 96px 36px; gap: 0.6rem; font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 650; }
.line .warn { grid-column: 1 / -1; font-size: 0.8rem; color: var(--warn); margin-top: -0.3rem; }
@container (max-width: 520px) { .line, .line-head { grid-template-columns: minmax(0, 1fr) 70px 36px; } .line .total, .line-head .total { display: none; } }
.summary-row { display: flex; justify-content: space-between; padding: 0.35rem 0; }
.summary-row.total { font-size: 1.15rem; font-weight: 700; border-top: 1px solid var(--border); margin-top: 0.4rem; padding-top: 0.7rem; }
.sticky { position: sticky; top: 1rem; }

/* ---- Order detail ------------------------------------------------------------------------- */
.steps { display: flex; gap: 0; margin: 0.25rem 0 0.5rem; }
.step { flex: 1; text-align: center; position: relative; font-size: 0.78rem; color: var(--faint); font-weight: 600; }
.step .dot { width: 26px; height: 26px; border-radius: 999px; margin: 0 auto 0.35rem; background: #eef0eb; border: 2px solid #e0e3dc; display: grid; place-items: center; position: relative; z-index: 1; }
.step::before { content: ""; position: absolute; top: 12px; left: -50%; width: 100%; height: 2px; background: #e0e3dc; }
.step:first-child::before { display: none; }
.step.done .dot, .step.current .dot { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.step.done, .step.current { color: var(--text); }
.step.done::before, .step.current::before { background: var(--brand); }
.step.current .dot { box-shadow: 0 0 0 4px var(--brand-soft); }
.step .dot .icon { width: 14px; height: 14px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 0.9rem 1.4rem; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 0.45rem; width: 8px; height: 8px; border-radius: 999px; background: var(--brand-line); }
.timeline li::after { content: ""; position: absolute; left: 7px; top: 1.1rem; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline li.error::before { background: var(--danger); }
.timeline .when { font-size: 0.78rem; color: var(--muted); }
.address { font-style: normal; line-height: 1.55; }
.tracking-list { display: flex; flex-direction: column; gap: 0.4rem; }
.tracking { display: flex; align-items: center; gap: 0.5rem; padding: 0.55rem 0.7rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; flex-wrap: wrap; }
.tracking .mono { min-width: 0; overflow-wrap: anywhere; }

/* ---- Labels ------------------------------------------------------------------------------- */
.label-card { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 1.1rem; padding: 1rem 1.15rem; border-bottom: 1px solid var(--border); }
.label-card:last-child { border-bottom: 0; }
.label-card.skipped { opacity: 0.55; }
.label-card.needs { background: #fffdf6; }
.label-card.done { background: #f7fbf8; }
.label-thumb { border: 1px solid var(--border); border-radius: 6px; background: #fff; display: block; overflow: hidden; }
.label-thumb img { width: 100%; display: block; aspect-ratio: 2 / 3; object-fit: contain; }
.label-thumb .noimg { aspect-ratio: 2 / 3; display: grid; place-items: center; color: var(--faint); font-size: 0.8rem; }
.label-fields .form-row { gap: 0 0.6rem; }
.label-fields .field { margin-bottom: 0.55rem; }
.label-fields label { font-size: 0.75rem; color: var(--muted); font-weight: 600; margin-bottom: 0.15rem; }
.label-fields input, .label-fields select { min-height: 2.1rem; padding: 0.35rem 0.55rem; font-size: 0.88rem; }
.issues { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.5rem; }
@container (max-width: 680px) { .label-card { grid-template-columns: 1fr; } .label-thumb { max-width: 160px; } }
.sticky-bar {
  position: sticky; bottom: 0; z-index: 20; background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(6px);
  border-top: 1px solid var(--border); padding: 0.8rem 1.15rem; display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap;
  border-radius: 0 0 var(--radius) var(--radius);
}
@container (max-width: 480px) { .sticky-bar { padding: 0.6rem 0.75rem; gap: 0.5rem; flex-wrap: nowrap; } .sticky-bar .wide-only { display: none; } }
.spinner { width: 34px; height: 34px; border-radius: 999px; border: 3px solid var(--brand-soft); border-top-color: var(--brand); animation: spin 0.9s linear infinite; margin: 0 auto 0.75rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Claims thread ------------------------------------------------------------------------ */
.thread { display: flex; flex-direction: column; gap: 0.85rem; }
.msg { border: 1px solid var(--border); border-radius: var(--radius); padding: 0.8rem 1rem; background: var(--surface); max-width: 760px; }
.msg.team { background: var(--brand-soft); border-color: var(--brand-line); margin-left: auto; }
.msg .who { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.3rem; display: flex; gap: 0.5rem; }
.msg .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.attachments { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.6rem; }
.attachments a { display: block; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: #fff; }
.attachments img { width: 96px; height: 96px; object-fit: cover; display: block; }
.attachments .file { padding: 0.45rem 0.65rem; font-size: 0.82rem; }

/* ---- Announcements ------------------------------------------------------------------------- */
.announcement { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.announcement:last-child { border-bottom: 0; }
.announcement h3 { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.prose p:last-child { margin-bottom: 0; }
.prose ul, .prose ol { padding-left: 1.2rem; margin: 0.25rem 0 0.75rem; }
.prose img { max-width: 100%; }

/* ---- Packing station ----------------------------------------------------------------------- */
.scan-box { display: flex; gap: 0.6rem; }
.scan-box input { font-size: 1.15rem; min-height: 3rem; font-family: var(--mono); }
.job { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.75rem; align-items: center; padding: 0.85rem 1.15rem; border-bottom: 1px solid var(--border); }
.job:last-child { border-bottom: 0; }
.job .title { font-weight: 650; }
.job .actions { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }
.print-frame { position: fixed; right: 0; bottom: 0; width: 1px; height: 1px; border: 0; opacity: 0; pointer-events: none; }
.toggle { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; cursor: pointer; margin: 0; }

/* ---- Auth pages ---------------------------------------------------------------------------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; background: radial-gradient(1200px 500px at 50% -10%, var(--brand-soft), var(--bg)); }
.auth-card { width: 100%; max-width: 410px; }
.auth-card .card-body { padding: 1.75rem; }
.auth-brand { text-align: center; margin-bottom: 1.5rem; }
.auth-brand img { display: block; margin: 0 auto; max-height: 104px; max-width: min(280px, 100%); object-fit: contain; }
.auth-brand .tagline { color: var(--muted); font-size: 0.9rem; margin-top: 0.6rem; }
.auth-foot { text-align: center; margin-top: 1rem; font-size: 0.88rem; }
/* Built-in white logo: deep brand-green backdrop, the form card stays light. */
.auth-dark {
  background:
    radial-gradient(1000px 520px at 50% -12%, color-mix(in srgb, var(--brand) 78%, #ffffff 4%), transparent 70%),
    color-mix(in srgb, var(--brand) 45%, #0b120d);
}
.auth-dark .auth-card > .card { border-color: transparent; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28); }
.auth-dark .auth-brand .tagline, .auth-dark .auth-foot { color: rgba(255, 255, 255, 0.72); }
.auth-dark .auth-foot a { color: #ffffff; text-decoration: underline; text-underline-offset: 2px; }

.error-page { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.error-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; max-width: 460px; text-align: center; box-shadow: var(--shadow); }

/* ---- Misc --------------------------------------------------------------------------------- */
.pagination { display: flex; gap: 0.5rem; justify-content: flex-end; padding: 0.8rem 1.25rem; border-top: 1px solid var(--border); }
.copy-box { display: flex; gap: 0.5rem; align-items: center; }
.copy-box input { font-family: var(--mono); font-size: 0.85rem; }
.kv { display: flex; justify-content: space-between; gap: 1rem; padding: 0.45rem 0; border-bottom: 1px dashed var(--border); }
.kv > * { min-width: 0; overflow-wrap: anywhere; }
.kv:last-child { border-bottom: 0; }
.health { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 600; font-size: 0.85rem; }
.health::before { content: ""; width: 8px; height: 8px; border-radius: 999px; background: var(--faint); }
.health.ok::before { background: var(--success); }
.health.bad::before { background: var(--danger); }
.health.idle::before { background: var(--border-strong); }
.color-row { display: flex; gap: 0.5rem; align-items: center; }
.color-row input:not([type]), .color-row input[type="text"] { max-width: 120px; font-family: var(--mono); }
.thumb-sm { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--brand-soft); display: inline-grid; place-items: center; vertical-align: middle; }
.thumb-sm .icon { color: var(--brand-line); }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.list-plain li:last-child { border-bottom: 0; }
.attention a { display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 1.25rem; border-bottom: 1px solid var(--border); color: var(--text); }
.attention a:last-child { border-bottom: 0; }
.attention a:hover { background: var(--surface-2); text-decoration: none; }
.qa { display: flex; gap: 0.6rem; flex-wrap: wrap; }

/* ---- Seller portal adjustments: documents, notes, pickers, batches, analytics, billing ---- */
[hidden] { display: none !important; }
.seller-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0 1rem; max-height: 220px; overflow-y: auto; padding: 0.6rem 0.75rem 0; margin: 0.25rem 0 0.75rem 1.6rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.seller-picks .check { margin-bottom: 0.55rem; font-weight: 450; }
.doc-list { list-style: none; margin: 0; padding: 0 1.25rem; }
.doc-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; padding: 0.55rem 0; border-bottom: 1px solid var(--border); }
.doc-list li a { display: inline-flex; gap: 0.35rem; align-items: center; font-weight: 600; }
.doc-list li .inline { margin-left: auto; }
.doc-links { list-style: none; margin: 0.35rem 0 0; padding: 0; }
.doc-links li { padding: 0.15rem 0; }
.doc-links a { display: inline-flex; gap: 0.3rem; align-items: center; }
.seller-note { display: flex; gap: 0.4rem; align-items: flex-start; font-size: 0.82rem; background: var(--info-bg); color: var(--info); border-radius: var(--radius-sm); padding: 0.45rem 0.55rem; white-space: pre-line; }
.seller-note .icon { flex: none; margin-top: 0.1rem; }
.image-picks { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 0.6rem; }
.image-pick { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 450; }
.image-pick img { width: 110px; height: 82px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.image-pick .check { margin: 0; font-size: 0.82rem; }
.announcement-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.6rem; margin-top: 0.75rem; }
.announcement-images img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); display: block; }
.announcement-images.small-images { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
.combo { position: relative; }
.combo-list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); max-height: 300px; overflow-y: auto; }
.combo-item { display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--border); background: none; padding: 0.5rem 0.75rem; font: inherit; color: var(--text); cursor: pointer; }
.combo-item:last-child { border-bottom: 0; }
.combo-item:hover, .combo-item:focus { background: var(--brand-soft); outline: none; }
.combo-empty { padding: 0.6rem 0.75rem; color: var(--muted); font-size: 0.88rem; }
.batch-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; padding: 0.65rem 1.25rem; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.sku-key { color: var(--text); font-weight: 650; }
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.segmented a { padding: 0.45rem 0.75rem; font-size: 0.88rem; color: var(--muted); border-right: 1px solid var(--border); }
.segmented a:last-child { border-right: 0; }
.segmented a:hover { text-decoration: none; background: var(--surface-2); }
.segmented a.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 650; }
.chart-wrap { padding: 0.75rem 1.25rem 1rem; }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 180px; border-bottom: 1px solid var(--border-strong); }
.bars .bar { flex: 1 1 0; min-width: 2px; background: var(--brand); border-radius: 3px 3px 0 0; position: relative; }
.bars .bar.zero { background: var(--border); min-height: 1px; }
.bars .bar:hover { background: var(--brand-dark); }
.bars-axis { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--faint); margin-top: 0.35rem; }
.meter { height: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; overflow: hidden; min-width: 80px; }
.meter > span { display: block; height: 100%; background: var(--brand); }
.table td .meter { margin-top: 0.3rem; }
.ledger td.num.credit { color: var(--success); }
.ledger tr.opening td { background: var(--surface-2); font-weight: 600; }
.balance { font-size: 1.9rem; font-weight: 750; letter-spacing: -0.02em; }
.balance.owed { color: var(--warn); }
.balance.clear { color: var(--success); }
.balance.positive, .credit-text { color: var(--success); }
.balance.negative, .ledger td.num.negative { color: var(--danger); }
.change-kind { display: inline-flex; gap: 0.3rem; align-items: center; font-weight: 650; font-size: 0.82rem; }
.change-kind.restocked, .change-kind.back_in_stock { color: var(--success); }
.change-kind.low { color: var(--warn); }
.change-kind.out { color: var(--danger); }

/* ---- Cold hold, heat packs ------------------------------------------------------------------ */
:root { --cold: #1f6f9f; --cold-bg: #e6f3fa; --review: #d9670b; --review-dark: #b8560a; }
.tone-cold { background: var(--cold-bg); color: var(--cold); }
.alert-cold { background: var(--cold-bg); border-color: #bcdcef; color: #1a5679; }
.alert-cold form { flex-shrink: 0; }
.stat-cold { border-color: #bcdcef; background: linear-gradient(180deg, var(--cold-bg), var(--surface) 70%); }
.stat-cold .value, .stat-cold .label .icon { color: var(--cold); }
.temp { color: var(--cold); font-variant-numeric: tabular-nums; }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@container (max-width: 1100px) { .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@container (max-width: 640px) { .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (max-width: 300px) { .grid-5 { grid-template-columns: minmax(0, 1fr); } }

/* ---- Review flow: "Next review", label preview beside the products ------------------------- */
.btn-review { background: var(--review); border-color: var(--review); color: #fff; }
.btn-review:hover { background: var(--review-dark); border-color: var(--review-dark); }
.btn .count { background: rgba(255, 255, 255, 0.25); border-radius: 999px; padding: 0 0.45rem; font-size: 0.78rem; }
.sticky.has-preview { max-height: calc(100vh - 2rem); overflow-y: auto; overscroll-behavior: contain; }
@container (max-width: 860px) { .sticky.has-preview { max-height: none; overflow: visible; } }
.label-preview-img { display: block; padding: 0.75rem; background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.label-preview-img img { display: block; width: 100%; max-height: 45vh; object-fit: contain; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); }
@container (max-width: 860px) { .label-preview-img img { max-height: 70vh; } }

/* ---- Product picker: type a name or SKU to narrow the list ---------------------------------- */
.product-combo { min-width: 0; }
.product-combo > select { display: none; }
.product-combo > input { width: 100%; }
.product-combo .combo-list { z-index: 30; max-height: 320px; }
.product-combo .combo-item { flex-direction: row; align-items: baseline; gap: 0.5rem; padding: 0.45rem 0.7rem; }
.product-combo .combo-item .name { flex: 1 1 auto; min-width: 0; }
.product-combo .combo-item .sku { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.product-combo .combo-item .meta { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.product-combo .combo-item.active { background: var(--brand-soft); }
.product-combo .combo-item[aria-disabled="true"] { color: var(--faint); cursor: not-allowed; }
.product-combo .combo-item[aria-disabled="true"]:hover { background: none; }
.product-combo .combo-item mark { background: #fff1b8; color: inherit; border-radius: 2px; padding: 0; }
.combo-more { padding: 0.45rem 0.7rem; font-size: 0.8rem; color: var(--muted); background: var(--surface-2); }
@container (max-width: 520px) { .product-combo .combo-item { flex-wrap: wrap; } .product-combo .combo-item .meta { width: 100%; } }

/* ---- Phones and touch screens -------------------------------------------------------------- */
/* Phones zoom into any field whose text is under 16px when it's tapped, and fingers need bigger
   targets than a mouse: small buttons, header icons and pager links grow to ~36-40px. */
@media (max-width: 900px), (pointer: coarse) {
  input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="number"],
  input[type="search"], input[type="url"], input[type="tel"], input[type="date"], select, textarea,
  .label-fields input, .label-fields select, .dt-search input, .copy-box input { font-size: 16px; }
  .scan-box input { font-size: 1.15rem; }
  input[type="checkbox"], input[type="radio"] { width: 1.2rem; height: 1.2rem; }
  .btn-sm { padding: 0.5rem 0.75rem; }
  .row-actions .btn { padding: 0.5rem; }
  .topbar .btn { min-width: 2.5rem; min-height: 2.5rem; }
  .th-sort { padding: 0.45rem 0; margin: -0.45rem 0; }
  .th-filter { min-width: 2rem; min-height: 2rem; margin: -0.4rem 0; }
  .dt-per a { display: inline-block; padding: 0.45rem 0.55rem; }
  .dt-pages .page { min-width: 2.5rem; height: 2.5rem; }
  .chip { padding: 0.35rem 0.4rem 0.35rem 0.75rem; }
  .alert .close { padding: 0.35rem 0.5rem; margin: -0.35rem -0.5rem -0.35rem auto; }
}

/* ==== Wholesale portal additions ============================================================ */
.wordmark { font-weight: 750; font-size: 1.05rem; letter-spacing: -0.01em; color: var(--brand-dark); }
.wordmark-lg { font-size: 1.6rem; color: #fff; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.auth-card-wide { max-width: 720px; }
.big-check { width: 56px; height: 56px; margin: 0 auto 0.75rem; border-radius: 999px; background: var(--success-bg); color: var(--success); display: grid; place-items: center; }
.landing h1 { font-size: 1.6rem; margin-bottom: 0.4rem; }
.landing .lead { font-size: 1.05rem; color: var(--muted); }
.landing-points { list-style: none; padding: 0; margin: 1rem 0 1.25rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem 1rem; }
.landing-points li { display: flex; gap: 0.45rem; align-items: center; font-weight: 550; }
.landing-points .icon { color: var(--brand); }
.landing-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
@media (max-width: 520px) { .landing-points { grid-template-columns: 1fr; } .landing-actions .btn { width: 100%; justify-content: center; } }

/* ---- Storefront shell ---------------------------------------------------------------------- */
body.shop { background: var(--bg); }
.shop-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 40; }
.shop-bar { display: flex; align-items: center; gap: 1rem; padding: 0.7rem 1.5rem; max-width: 1400px; margin: 0 auto; }
.shop-brand img { display: block; max-height: 44px; max-width: 170px; object-fit: contain; }
.shop-brand:hover { text-decoration: none; }
.shop-search { flex: 1; max-width: 620px; }
.shop-search input { width: 100%; }
.shop-cart { position: relative; display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 999px; color: var(--text); margin-left: auto; }
.shop-cart:hover { background: var(--surface-2); text-decoration: none; }
.shop-cart .icon { width: 22px; height: 22px; }
.cart-count { position: absolute; top: 0; right: -2px; background: var(--brand); color: var(--brand-ink); border-radius: 999px; font-size: 0.7rem; font-weight: 700; min-width: 1.25rem; height: 1.25rem; padding: 0 0.3rem; display: grid; place-items: center; }
.cart-count[hidden] { display: none; }
.shop-nav { display: flex; align-items: center; gap: 0.25rem; padding: 0 1.5rem; max-width: 1400px; margin: 0 auto; overflow-x: auto; }
.shop-nav a { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.6rem 0.75rem; color: #3a433d; font-weight: 550; border-bottom: 2px solid transparent; white-space: nowrap; }
.shop-nav a:hover { text-decoration: none; color: var(--text); }
.shop-nav a.active { color: var(--brand-dark); border-bottom-color: var(--brand); }
.shop-nav .count { background: var(--brand); color: var(--brand-ink); border-radius: 999px; font-size: 0.68rem; font-weight: 700; padding: 0.02rem 0.4rem; }
.shop-nav-spacer { flex: 1; }
.shop-who { white-space: nowrap; }
.shop-menu-btn { display: none; }
.shop-content { max-width: 1400px; margin: 0 auto; }
.shop-foot { max-width: 1400px; margin: 0 auto; padding: 1.25rem 1.5rem 2rem; display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; border-top: 1px solid var(--border); }
@media (max-width: 760px) {
  .shop-bar { flex-wrap: wrap; gap: 0.5rem 0.6rem; padding: 0.55rem 0.8rem; }
  .shop-menu-btn { display: inline-flex; }
  .shop-search { order: 3; flex-basis: 100%; max-width: none; }
  .shop-brand img { max-height: 34px; max-width: 140px; }
  .shop-nav { display: none; flex-direction: column; align-items: stretch; padding: 0 0.8rem 0.6rem; }
  .shop-nav.open { display: flex; }
  .shop-nav a { border-bottom: 0; border-left: 3px solid transparent; }
  .shop-nav a.active { border-left-color: var(--brand); background: var(--brand-soft); }
  .shop-nav-spacer { display: none; }
  .shop-who { padding: 0.4rem 0.75rem; }
  .shop-foot { padding: 1rem; }
}

/* ---- Catalog ------------------------------------------------------------------------------ */
.catalog { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.filters-panel { position: sticky; top: 7.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.filters-panel .field { margin-bottom: 0.5rem; }
.filters-panel select { width: 100%; }
.filters-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.export-box { border-top: 1px solid var(--border); padding-top: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }
.catalog-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin: 0.25rem 0 0.9rem; }
.catalog-head h1 { margin: 0; font-size: 1.35rem; }
.filters-toggle { display: none; }
.catalog-pages { justify-content: center; margin-top: 1.25rem; gap: 1rem; align-items: center; }
.catalog-pages .page { width: auto; padding: 0 0.9rem; }
@media (max-width: 900px) {
  .catalog { grid-template-columns: minmax(0, 1fr); }
  .filters-panel { display: none; position: static; }
  .filters-panel.open { display: flex; }
  .filters-toggle { display: inline-flex; }
  .catalog-main { order: 2; }
}

.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; }
.pcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.pcard-media { position: relative; aspect-ratio: 1; background: #fff; display: grid; place-items: center; border-bottom: 1px solid var(--border); }
.pcard-media img { width: 100%; height: 100%; object-fit: contain; }
.pcard-media .icon-lg { width: 40px; height: 40px; color: var(--border-strong); }
.pcard-flag { position: absolute; top: 0.5rem; left: 0.5rem; background: var(--brand); color: var(--brand-ink); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 0.15rem 0.5rem; border-radius: 999px; }
.pcard-body { padding: 0.75rem 0.85rem 0.85rem; display: flex; flex-direction: column; gap: 0.3rem; flex: 1; }
.pcard-brand { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 650; }
.pcard-name { font-weight: 650; color: var(--text); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.pcard-ids { font-size: 0.75rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0 0.6rem; }
.pcard-ids b { font-weight: 600; color: #3a433d; }
.pcard-price { margin-top: 0.15rem; }
.pcard-price strong { font-size: 1.2rem; }
.pcard-price .per { font-size: 0.78rem; color: var(--muted); margin-left: 0.2rem; }
.pcard-price .case { font-size: 0.75rem; color: var(--muted); }
.pcard-price .on-request { font-weight: 650; color: var(--muted); }
.pcard-add { display: flex; gap: 0.4rem; margin-top: auto; padding-top: 0.4rem; }
.pcard-add .btn-add { flex: 1; justify-content: center; }
.pcard-note { min-height: 1.2em; }
.pcard.is-out .pcard-media img { opacity: 0.55; filter: grayscale(0.5); }
.qty { display: inline-flex; align-items: stretch; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.qty input { width: 3.6rem; min-width: 0; border: 0; text-align: center; padding: 0.35rem 0.1rem; border-radius: 0; -moz-appearance: textfield; appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-btn { border: 0; background: var(--surface-2); width: 2rem; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.qty-btn:hover { background: var(--brand-soft); color: var(--brand-dark); }
@media (max-width: 520px) {
  .pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
  .pcard-body { padding: 0.6rem; }
  .pcard-add { flex-direction: column; }
  .qty { display: flex; width: 100%; }
  .qty input { flex: 1 1 0; width: 0; }
  .pcard-ids span:nth-child(2) { display: none; }
}

.new-strip { background: linear-gradient(180deg, var(--brand-soft), transparent); border: 1px solid var(--brand-line); border-radius: var(--radius); padding: 0.9rem 1rem 1rem; margin-bottom: 1.25rem; }
.new-strip h2 { margin: 0; display: flex; align-items: center; gap: 0.4rem; }
.new-strip h2 .icon { color: var(--brand); }
.new-strip-scroll { display: grid; grid-auto-flow: column; grid-auto-columns: 210px; gap: 0.8rem; overflow-x: auto; padding: 0.75rem 0.1rem 0.3rem; scroll-snap-type: x mandatory; }
.new-strip-scroll .pcard { scroll-snap-align: start; }
@media (max-width: 520px) { .new-strip-scroll { grid-auto-columns: 46%; } }

/* ---- Product page -------------------------------------------------------------------------- */
.product-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; align-items: start; }
.pd-media { position: relative; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; }
.pd-media img { width: 100%; height: 100%; object-fit: contain; }
.pd-noimg { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; color: var(--border-strong); }
.pd-info h1 { margin: 0.2rem 0 0.75rem; }
.pd-facts { margin-bottom: 1.25rem; }
.pd-buy { margin-top: 0.5rem; }
.pd-price strong { font-size: 1.6rem; }
.pd-buy .stock { margin: 0.4rem 0 0.8rem; }
.pd-add { margin-bottom: 0.5rem; }
.pd-desc { margin-top: 1.25rem; color: #3a433d; }
@media (max-width: 760px) { .product-detail { grid-template-columns: 1fr; gap: 1rem; } .pd-media { max-height: 60vh; } }

/* ---- Cart and checkout ---------------------------------------------------------------------- */
.cart-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.25rem; align-items: start; }
@media (max-width: 900px) { .cart-layout { grid-template-columns: 1fr; } .cart-summary.sticky { position: static; } }
.cart-line { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto 100px; gap: 0.9rem; align-items: center; padding: 0.9rem 1rem; border-bottom: 1px solid var(--border); }
.cart-line.has-problem { background: #fffaf0; }
.cart-thumb { width: 72px; height: 72px; border: 1px solid var(--border); border-radius: var(--radius-sm); display: grid; place-items: center; background: #fff; overflow: hidden; color: var(--border-strong); }
.cart-thumb img { width: 100%; height: 100%; object-fit: contain; }
.cart-name { font-weight: 650; color: var(--text); }
.cart-qty { display: flex; align-items: center; gap: 0.3rem; }
.cart-total { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.cart-line .warn { color: var(--warn); margin-top: 0.2rem; }
@media (max-width: 620px) {
  .cart-line { grid-template-columns: 56px minmax(0, 1fr); }
  .cart-thumb { width: 56px; height: 56px; }
  .cart-qty { grid-column: 2; }
  .cart-total { grid-column: 2; text-align: left; }
}
.address-picks { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.75rem; }
.address-pick { display: flex; gap: 0.65rem; align-items: flex-start; padding: 0.7rem 0.8rem; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; margin-bottom: 0.5rem; font-weight: 400; }
.address-pick:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.address-pick input { margin-top: 0.2rem; }
.new-address[hidden] { display: none; }
.address-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.75rem; }
.address-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.75rem 0.85rem; }
.address-card details { margin-top: 0.5rem; }
.add-box { margin-top: 0.75rem; }
.add-box > summary { list-style: none; display: inline-flex; }
.add-box > summary::-webkit-details-marker { display: none; }
.form-inline-grid { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: flex-end; }
.form-inline-grid .field { margin: 0; flex: 1 1 180px; }
.form-inline-grid .check { margin: 0 0 0.45rem; }
.mock-pay { max-width: 520px; margin: 2rem auto; }
.order-grid { align-items: start; }
.stats .stat .value { font-size: 1.35rem; }

/* ---- Admin bits ------------------------------------------------------------------------------ */
.approval { border-color: var(--brand-line); box-shadow: 0 0 0 3px var(--brand-soft); }
.admin-photo { max-width: 100%; max-height: 320px; display: block; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.thumb-sm { width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 6px; display: grid; place-items: center; overflow: hidden; background: #fff; color: var(--border-strong); flex: none; }
.thumb-sm img { width: 100%; height: 100%; object-fit: contain; }
.pick-list { max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.4rem 0.6rem; margin-top: 0.3rem; }
.pick-products { display: flex; flex-direction: column; gap: 0.4rem; max-height: 70vh; overflow-y: auto; }
.pick-product { display: flex; gap: 0.6rem; align-items: center; padding: 0.4rem 0.5rem; border-radius: var(--radius-sm); font-weight: 400; cursor: pointer; }
.pick-product:hover { background: var(--surface-2); }
.toast { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); background: #1f2933; color: #fff; padding: 0.65rem 1rem; border-radius: 999px; font-size: 0.9rem; box-shadow: var(--shadow-lg); z-index: 100; max-width: calc(100% - 2rem); }
.toast.error { background: var(--danger); }
.toast[hidden] { display: none; }
