/* ==========================================================================
   Pharmaline portal — design system
   Tokens → base → layout → components → utilities.
   Brand colours (--brand, --accent) are overridden from Site settings in base.html.
   Page-specific styles belong in static/<app>/<app>.css, not here.
   ========================================================================== */

:root {
  --brand: #0b5e8e;
  --brand-600: color-mix(in srgb, var(--brand) 88%, black);
  --brand-700: color-mix(in srgb, var(--brand) 75%, black);
  --brand-50: color-mix(in srgb, var(--brand) 7%, white);
  --brand-100: color-mix(in srgb, var(--brand) 14%, white);
  --accent: #12a37f;
  --accent-50: color-mix(in srgb, var(--accent) 9%, white);

  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f6;
  --border: #dde3ea;
  --border-strong: #c5ced9;
  --text: #17202b;
  --text-2: #3d4a5a;
  --muted: #677487;
  --faint: #95a1b2;

  --success: #13804f;
  --success-bg: #e6f5ed;
  --warning: #9a5b00;
  --warning-bg: #fdf3e1;
  --danger: #c0352b;
  --danger-bg: #fbeceb;
  --info: #1f6fb2;
  --info-bg: #e8f1fa;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.14);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --container: 1240px;
  --header-h: 64px;
  --sidebar-w: 248px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img, svg, video { max-width: 100%; height: auto; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-700); text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; color: var(--text); font-weight: 650; }
h1 { font-size: 1.65rem; letter-spacing: -0.01em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
h4 { font-size: .95rem; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }
code, kbd { font-family: var(--mono); font-size: .88em; background: var(--surface-3); padding: .1em .35em; border-radius: 4px; }
small { font-size: .85em; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.icon { display: inline-block; vertical-align: -0.2em; flex-shrink: 0; stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[x-cloak] { display: none !important; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 16px; }
.page { padding: 24px 0 48px; }
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-header h1 { margin: 0; }
.page-header .subtitle { color: var(--muted); margin: 4px 0 0; }
.breadcrumbs { font-size: .85rem; color: var(--muted); margin-bottom: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs span.sep { color: var(--faint); }

.stack > * + * { margin-top: var(--gap, 16px); }
.stack-sm { --gap: 8px; }
.stack-lg { --gap: 28px; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, 10px); }
.split { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grid { display: grid; gap: var(--gap, 16px); }
.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)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(var(--min, 220px), 1fr)); }
.with-sidebar { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; align-items: start; }
.with-aside { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.sticky { position: sticky; top: calc(var(--header-h) + 16px); }
@media (max-width: 960px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .with-sidebar, .with-aside { grid-template-columns: minmax(0, 1fr); }
  .sticky { position: static; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 1.4rem; }
}

/* ---------- Storefront header ---------- */
.notice-bar { background: var(--brand-700); color: #fff; font-size: .88rem; text-align: center; padding: 8px 16px; }
.notice-bar a { color: #fff; text-decoration: underline; }
.impersonation-bar { background: #fff4d6; border-bottom: 1px solid #f0d58c; color: #6b4a00; font-size: .9rem; padding: 8px 0; }
.impersonation-bar .container { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 40; }
.site-header .bar { display: flex; align-items: center; gap: 20px; min-height: var(--header-h); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; color: var(--text); }
.brand img { max-height: 40px; width: auto; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; }
.header-search { flex: 1; max-width: 620px; display: flex; align-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 6px 0 14px; }
.header-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); background: #fff; }
.header-search input, .header-search input[type=search] { flex: 1; border: 0; background: transparent; padding: 10px 6px; font: inherit; min-width: 0; min-height: 0; outline: none; box-shadow: none; }
.header-search .btn-icon { border-radius: 999px; }
.header-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.lang-switch { margin: 0; }
.header-link { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; font-size: .92rem; position: relative; white-space: nowrap; }
.header-link:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.cart-count { position: absolute; top: 0; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #fff; font-size: .7rem; font-weight: 700; display: grid; place-items: center; }
.category-nav { border-top: 1px solid var(--border); background: var(--surface); }
.category-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.category-nav ul::-webkit-scrollbar { display: none; }
.category-nav a { display: block; padding: 10px 12px; color: var(--text-2); font-size: .9rem; font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent; }
.category-nav a:hover, .category-nav a.is-active { color: var(--brand); border-bottom-color: var(--brand); text-decoration: none; }
.mobile-only { display: none; }
@media (max-width: 860px) {
  .site-header .bar { flex-wrap: wrap; gap: 10px; padding: 10px 0; }
  .header-search { order: 3; flex-basis: 100%; max-width: none; }
  .header-link .label { display: none; }
  .mobile-only { display: inline-flex; }
  .desktop-only { display: none !important; }
}

/* Dropdown (Alpine) */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; }
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text-2); font: inherit; font-size: .92rem; background: none; border: 0; cursor: pointer; text-align: left; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.dropdown-menu .divider { height: 1px; background: var(--border); margin: 6px 0; }
.dropdown-menu .menu-label { padding: 6px 10px 2px; font-size: .75rem; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Footer ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); color: var(--muted); font-size: .9rem; padding: 32px 0; margin-top: 40px; }
.site-footer a { color: var(--text-2); }
.site-footer .cols { display: flex; flex-wrap: wrap; gap: 32px; justify-content: space-between; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li + li { margin-top: 6px; }

/* ---------- App shell (staff, rep, supplier) ---------- */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.app-sidebar { background: #101b29; color: #c9d3df; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.app-sidebar .brand { color: #fff; padding: 18px 18px 14px; }
.app-sidebar .brand:hover { color: #fff; }
.app-sidebar nav { padding: 6px 10px 20px; flex: 1; }
.app-sidebar .nav-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: #7d8ba0; padding: 16px 10px 6px; }
.app-sidebar a.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: #c9d3df; font-size: .92rem; }
.app-sidebar a.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.app-sidebar a.nav-link.is-active { background: var(--brand); color: #fff; }
.app-sidebar .sidebar-footer { padding: 12px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: .85rem; }
.app-sidebar .sidebar-footer a { color: #c9d3df; }
.app-main { min-width: 0; display: flex; flex-direction: column; }
.app-topbar { height: 56px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 0 24px; position: sticky; top: 0; z-index: 30; }
.app-topbar .topbar-search { flex: 1; max-width: 420px; }
.app-content { padding: 24px; flex: 1; }
.app-content.narrow { max-width: 1100px; }
.btn.sidebar-toggle { display: none; }
@media (max-width: 960px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .app-sidebar { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  .app-sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .btn.sidebar-toggle { display: inline-flex; }
  .app-content { padding: 16px; }
  .app-topbar { padding: 0 16px; }
}

/* Rep layout: bottom tab bar on phones */
.rep-tabs { display: none; }
@media (max-width: 960px) {
  .rep-shell .app-content { padding-bottom: 84px; }
  .rep-tabs { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--border); z-index: 45; padding-bottom: env(safe-area-inset-bottom); }
  .rep-tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; font-size: .72rem; color: var(--muted); }
  .rep-tabs a.is-active { color: var(--brand); }
  .rep-tabs a:hover { text-decoration: none; }
}

/* Auth layout */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; background: linear-gradient(160deg, var(--brand-50), var(--bg) 55%); }
.auth-card { width: 100%; max-width: 440px; }
.auth-card.wide { max-width: 720px; }
.auth-card .brand { justify-content: center; margin-bottom: 20px; font-size: 1.2rem; }

/* ---------- Buttons ---------- */
.btn { --btn-bg: var(--surface); --btn-fg: var(--text); --btn-border: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; min-height: 40px;
  border-radius: var(--radius-sm); border: 1px solid var(--btn-border); background: var(--btn-bg); color: var(--btn-fg);
  font: inherit; font-weight: 600; font-size: .92rem; line-height: 1.2; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:hover { text-decoration: none; color: var(--btn-fg); background: color-mix(in srgb, var(--btn-bg) 92%, black); }
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-primary { --btn-bg: var(--brand); --btn-fg: #fff; --btn-border: var(--brand); }
.btn-primary:hover { background: var(--brand-600); }
.btn-accent { --btn-bg: var(--accent); --btn-fg: #fff; --btn-border: var(--accent); }
.btn-secondary { --btn-bg: var(--brand-50); --btn-fg: var(--brand-700); --btn-border: var(--brand-100); }
.btn-ghost { --btn-bg: transparent; --btn-border: transparent; --btn-fg: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-border: var(--danger); }
.btn-danger-ghost { --btn-bg: transparent; --btn-border: transparent; --btn-fg: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-bg); }
.btn-sm { padding: 5px 10px; min-height: 32px; font-size: .85rem; }
.btn-lg { padding: 12px 22px; min-height: 48px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; min-height: 36px; min-width: 36px; }
.btn-link { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; }
.btn-link:hover { text-decoration: underline; }

/* ---------- Forms ---------- */
label, .label { display: block; font-weight: 600; font-size: .88rem; color: var(--text-2); margin-bottom: 5px; }
.required-mark { color: var(--danger); margin-left: 2px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], input[type=url],
input[type=search], input[type=date], input[type=datetime-local], input[type=time], input[type=file], select, textarea {
  width: 100%; padding: 9px 12px; min-height: 40px; font: inherit; font-size: .95rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .12s, box-shadow .12s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
input[type=file] { padding: 7px; }
textarea { min-height: 90px; resize: vertical; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23677487' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
select[multiple] { background-image: none; padding-right: 12px; min-height: 120px; }
input[type=checkbox], input[type=radio] { width: 17px; height: 17px; accent-color: var(--brand); vertical-align: -3px; margin: 0 6px 0 0; }
.checkbox { display: flex; align-items: flex-start; gap: 4px; font-weight: 500; color: var(--text); }
.form-field { margin-bottom: 16px; }
.form-field .help { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.form-field.has-error input, .form-field.has-error select, .form-field.has-error textarea { border-color: var(--danger); }
.errorlist { list-style: none; padding: 0; margin: 4px 0 0; color: var(--danger); font-size: .84rem; }
.errorlist.nonfield { background: var(--danger-bg); padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } .form-grid .span-2 { grid-column: auto; } }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }
.input-group { display: flex; }
.input-group > input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group > .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; }

/* Quantity stepper */
.qty { display: inline-flex; align-items: stretch; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.qty button { width: 34px; border: 0; background: var(--surface-2); color: var(--text-2); cursor: pointer; font-size: 1.1rem; }
.qty button:hover { background: var(--surface-3); }
.qty input { width: 64px; min-height: 36px; border: 0; border-radius: 0; text-align: center; padding: 6px 4px; box-shadow: none !important; -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-header { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card-header h2, .card-header h3 { margin: 0; font-size: 1rem; }
.card-body { padding: 18px; }
.card-footer { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.card-flush .card-body { padding: 0; }
.panel { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }

/* Stat tiles */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat .stat-label { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .stat-value { font-size: 1.6rem; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .stat-delta { font-size: .85rem; margin-top: 2px; }
.stat .stat-delta.up { color: var(--success); }
.stat .stat-delta.down { color: var(--danger); }

/* Progress */
.progress { height: 10px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; background: var(--surface); }
.table th { text-align: left; font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num, .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.table-compact td, .table-compact th { padding: 7px 10px; }
.table tfoot td { font-weight: 600; background: var(--surface-2); }
.card > .table-wrap .table, .card > .table { border-radius: 0 0 var(--radius) var(--radius); }
.sortable a { color: inherit; }

/* Definition list */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: .93rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }

/* Totals box */
.totals { width: 100%; font-size: .95rem; }
.totals td { padding: 5px 0; }
.totals td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.totals tr.grand td { font-size: 1.15rem; font-weight: 700; border-top: 1px solid var(--border); padding-top: 10px; }

/* ---------- Badges & alerts ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 600; border: 1px solid transparent; white-space: nowrap; line-height: 1.6; }
.badge-success { background: var(--success-bg); color: var(--success); border-color: #bfe3cf; }
.badge-warning { background: var(--warning-bg); color: var(--warning); border-color: #f1d9a8; }
.badge-danger { background: var(--danger-bg); color: var(--danger); border-color: #f2c4c0; }
.badge-info { background: var(--info-bg); color: var(--info); border-color: #c6dcf0; }
.badge-neutral { background: var(--surface-3); color: var(--text-2); border-color: var(--border); }
.badge-brand { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.badge-deal { background: #fff1e6; color: #b4480a; border-color: #f7cfae; }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid; margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start; font-size: .93rem; }
.alert-success { background: var(--success-bg); color: #0d5c39; border-color: #bfe3cf; }
.alert-warning { background: var(--warning-bg); color: #6f4200; border-color: #f1d9a8; }
.alert-error, .alert-danger { background: var(--danger-bg); color: #8f241c; border-color: #f2c4c0; }
.alert-info { background: var(--info-bg); color: #164f80; border-color: #c6dcf0; }
.messages { margin: 16px 0 0; }

/* ---------- Product cards ---------- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.product-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .15s, border-color .15s; }
.product-card:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.product-card .thumb { aspect-ratio: 4 / 3; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; position: relative; }
.product-card .thumb img { width: 100%; height: 100%; object-fit: contain; padding: 10px; }
.product-card .thumb .badges { position: absolute; top: 8px; left: 8px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.product-card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card .sku { font-size: .76rem; color: var(--muted); font-family: var(--mono); }
.product-card .name { font-weight: 600; color: var(--text); line-height: 1.3; }
.product-card .name:hover { color: var(--brand); }
.product-card .foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.placeholder-img { color: var(--faint); }
.product-list .row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.product-list .row img { width: 64px; height: 64px; object-fit: contain; background: var(--surface-2); border-radius: var(--radius-sm); }

/* Prices */
.price { font-weight: 700; font-size: 1.1rem; color: var(--text); font-variant-numeric: tabular-nums; }
.price-lg { font-size: 1.6rem; }
.price-old { color: var(--faint); text-decoration: line-through; font-size: .88rem; margin-left: 6px; font-weight: 500; }
.price-unit { color: var(--muted); font-size: .82rem; font-weight: 500; }
.price-hidden { color: var(--muted); font-size: .88rem; }
.breaks { font-size: .82rem; color: var(--text-2); }
.breaks table td { padding: 2px 10px 2px 0; }

/* ---------- Tabs, pagination, empty states ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs a, .tabs button { padding: 10px 14px; color: var(--muted); font-weight: 600; font-size: .92rem; border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--text); text-decoration: none; }
.tabs .is-active { color: var(--brand); border-bottom-color: var(--brand); }
.pagination { display: flex; gap: 4px; justify-content: center; align-items: center; margin: 24px 0 0; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 36px; height: 36px; padding: 0 10px; display: inline-grid; place-items: center; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: .9rem; }
.pagination a:hover { border-color: var(--brand); text-decoration: none; }
.pagination .current { background: var(--brand); color: #fff; border-color: var(--brand); }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty .icon { color: var(--faint); margin-bottom: 8px; }
.empty h3 { color: var(--text-2); }

/* Filters sidebar */
.filters { font-size: .92rem; }
.filters h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 8px; }
.filters ul { list-style: none; margin: 0; padding: 0; }
.filters li a { display: block; padding: 5px 8px; border-radius: var(--radius-sm); color: var(--text-2); }
.filters li a:hover { background: var(--surface-3); text-decoration: none; }
.filters li a.is-active { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar select, .toolbar input { width: auto; min-height: 36px; padding-top: 6px; padding-bottom: 6px; }

/* Hero / banners */
.hero { border-radius: var(--radius-lg); overflow: hidden; position: relative; background: linear-gradient(120deg, var(--brand-700), var(--brand)); color: #fff; min-height: 220px; display: flex; align-items: center; }
.hero img.bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .35; }
.hero .hero-body { position: relative; padding: 36px; max-width: 640px; }
.hero h1, .hero h2 { color: #fff; font-size: 2rem; }
.hero p { font-size: 1.05rem; opacity: .92; }
.tile { border-radius: var(--radius); padding: 20px; background: var(--brand-50); border: 1px solid var(--brand-100); }

/* Modal (Alpine) */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 35, .5); z-index: 80; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { margin: 0; }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* Barcode scanner */
.scanner-video { width: 100%; border-radius: var(--radius); background: #000; aspect-ratio: 4 / 3; object-fit: cover; }
.scanner-hint { color: var(--muted); font-size: .88rem; margin-top: 8px; text-align: center; }

/* Toasts */
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 90; }
.toast { background: #17202b; color: #fff; padding: 12px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-size: .92rem; max-width: 360px; }
@media (max-width: 640px) { .toasts { left: 16px; right: 16px; bottom: 90px; } }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 16px 12px; }
.timeline li::before { content: ""; position: absolute; left: -25px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.timeline .when { font-size: .8rem; color: var(--muted); }

/* Signature pad */
.signature-pad { border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: #fff; width: 100%; height: 180px; touch-action: none; }

/* ---------- Utilities ---------- */
.text-muted { color: var(--muted) !important; }
.text-faint { color: var(--faint); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-sm { font-size: .87rem; }
.text-xs { font-size: .78rem; }
.text-lg { font-size: 1.1rem; }
.font-mono { font-family: var(--mono); }
.fw-600 { font-weight: 600; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-0 { margin: 0 !important; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 16px; } .mt-4 { margin-top: 24px; } .mt-5 { margin-top: 40px; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 16px; } .mb-4 { margin-bottom: 24px; }
.ml-auto { margin-left: auto; }
.p-0 { padding: 0 !important; }
.w-full { width: 100%; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; } .flex-wrap { flex-wrap: wrap; } .flex-1 { flex: 1; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 16px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
@media (max-width: 640px) { .hide-sm { display: none !important; } }

/* Print */
@media print {
  .site-header, .site-footer, .app-sidebar, .app-topbar, .rep-tabs, .notice-bar, .impersonation-bar, .no-print, .btn { display: none !important; }
  body { background: #fff; }
  .app-shell { display: block; }
  .card { box-shadow: none; }
}
