/**
 * pinta.css — Pinta Platform Design System
 * =========================================
 *
 * Hybrid approach: custom CSS for layout + components, Tailwind utilities
 * for one-off spacing/flex/color needs.
 *
 * Design tokens (CSS custom properties) drive all colors, radii, shadows.
 * Self-hosted Geist + Geist Mono fonts (WOFF2 variable).
 *
 * Sections:
 *   1. Self-hosted fonts     — Geist Sans + Geist Mono variable font faces
 *   2. Design tokens         — brand colors, ink scale, semantic colors, radii, shadows
 *   3. Reset + base          — box-sizing, body typography, input/button resets
 *   4. Layout shell          — .shell grid (sidebar + main), sticky sidebar
 *   5. Sidebar components    — logo, location pill, nav links, user row
 *   6. Auth pages            — split-screen brand + form panels, login/register styling
 *   7. Page header           — title + subtitle, flex space-between
 *   8. Flash messages        — fixed top-right toast stack, color variants
 *   9. Component primitives  — card, badge, button, input, table
 *  10. Tailwind replacements  — utility classes for common patterns
 *  11. Form validation        — error text + red input states
 *  12. Mobile responsive     — hamburger, drawer, stacked grids, hidden sidebar
 *
 * Brand red: #e74431 (used sparingly — CTAs and emphasis only).
 * Font: Geist (sans) + Geist Mono (tabular numerals for prices).
 */

/* ----- Self-hosted fonts --------------------------------------------------- */
@font-face {
  font-family: 'Geist';
  src: url('../fonts/GeistVariableVF.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('../fonts/GeistMonoVariableVF.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ----- Design tokens ------------------------------------------------------- */
:root {
  --brand-red: #e74431;
  --brand-red-hover: #d13a28;
  --brand-red-light: #fef1ef;
  --brand-red-dark: #b82e1d;

  --ink-900: #0a0a0a;
  --ink-700: #262626;
  --ink-500: #525252;
  --ink-400: #737373;
  --ink-300: #a3a3a3;
  --ink-200: #d4d4d4;
  --ink-150: #e5e5e5;
  --ink-100: #f5f5f5;
  --ink-50:  #fafafa;
  --ink-0:   #ffffff;

  --green-600: #0d7a4f;
  --green-100: #d1fae5;
  --amber-600: #b45309;
  --amber-100: #fef3c7;
  --blue-600:  #2563eb;
  --blue-100:  #dbeafe;
  --indigo-600:#4f46e5;
  --indigo-100:#e0e7ff;
  --red-600:   #b91c1c;
  --red-500:   #ef4444;
  --red-400:   #f87171;
  --red-100:   #fee2e2;

  --r-sm: 4px;
  --r: 6px;
  --r-lg: 10px;
  --r-xl: 16px;

  --shadow-sm: 0 1px 2px rgba(10, 10, 10, 0.04);
  --shadow: 0 1px 3px rgba(10, 10, 10, 0.06), 0 4px 12px rgba(10, 10, 10, 0.04);
  --shadow-lg: 0 8px 24px rgba(10, 10, 10, 0.08), 0 2px 6px rgba(10, 10, 10, 0.04);

  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;

  --content-max: 1280px;
}

/* ----- Reset + base -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--ink-50);
  color: var(--ink-900);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; background: none; border: none; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ----- Layout shell -------------------------------------------------------- */
.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--ink-900);
  color: var(--ink-0);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.main {
  padding: 24px 32px 40px;
  overflow-x: hidden;
}

/* ----- Sidebar components -------------------------------------------------- */
.sidebar-logo {
  padding: 0 20px 20px;
}

.sidebar-logo-mark {
  width: 28px;
  height: 28px;
  color: var(--brand-red);
}

.location-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  margin: 0 12px 16px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: background 150ms;
}
.location-pill:hover { background: rgba(255,255,255,0.1); }
.location-pill-label { font-size: 10px; color: var(--ink-400); text-transform: uppercase; letter-spacing: 0.07em; font-weight: 500; }
.location-pill-name { font-size: 13px; font-weight: 500; color: white; margin-top: 2px; }
.location-pill-arrow { color: var(--ink-400); }

.sidebar-section {
  padding: 12px 20px 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-400);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  margin: 0 8px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.65);
  border-radius: var(--r);
  transition: all 120ms;
  text-decoration: none;
}
.sidebar-link:hover { background: rgba(255,255,255,0.06); color: white; }
.sidebar-link.active { background: rgba(255,255,255,0.1); color: white; }
.sidebar-link svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-bottom {
  margin-top: auto;
  padding: 16px 12px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px;
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  color: white;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 500; color: white; }
.user-role { font-size: 11px; color: var(--ink-400); }

/* ----- Auth pages ---------------------------------------------------------- */
.auth-page {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  width: 100%;
}

/* Dark brand panel */
.auth-brand {
  background: var(--ink-900);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 48px;
}
.auth-brand::before {
  content: '';
  position: absolute;
  top: -10%; left: -10%;
  width: 80%; height: 60%;
  background: radial-gradient(circle, rgba(231,68,49,0.35) 0%, transparent 70%);
  filter: blur(80px);
  pointer-events: none;
}
.auth-brand::after {
  content: '';
  position: absolute;
  bottom: 10%; right: -10%;
  width: 60%; height: 60%;
  background: radial-gradient(circle, rgba(231,68,49,0.15) 0%, transparent 70%);
  filter: blur(100px);
  pointer-events: none;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1;
}
.brand-logo-mark {
  width: 36px; height: 36px;
  background: var(--brand-red);
  border-radius: 8px;
  display: grid; place-items: center;
  padding: 6px;
}
.brand-logo-mark svg { width: 100%; fill: white; }
.brand-logo-name {
  font-size: 20px;
  font-weight: 700;
  color: white;
  letter-spacing: -0.02em;
}

.brand-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  z-index: 1;
}

.brand-tagline {
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: white;
  margin-bottom: 20px;
}
.brand-tagline span { color: var(--brand-red); }

.brand-desc {
  font-size: 15px;
  line-height: 1.6;
  color: rgba(255,255,255,0.5);
  max-width: 360px;
}

.brand-stats {
  display: flex;
  gap: 32px;
  z-index: 1;
  padding-top: 32px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.brand-stat-num {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: white;
  font-variant-numeric: tabular-nums;
}
.brand-stat-label {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-top: 4px;
}

/* Type cards on signup brand panel */
.type-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 40px;
  z-index: 1;
}
.type-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 20px;
  transition: all 200ms;
}
.type-card.highlighted {
  background: rgba(231,68,49,0.15);
  border-color: rgba(231,68,49,0.3);
}
.type-card-title { font-size: 14px; font-weight: 600; color: white; margin-bottom: 4px; }
.type-card-desc { font-size: 12px; color: rgba(255,255,255,0.45); line-height: 1.5; }

/* White form panel */
.auth-form-panel {
  background: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  overflow-y: auto;
}

.auth-form-inner {
  width: 100%;
  max-width: 420px;
  animation: fadeUp 0.4s ease both;
  position: relative;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-form-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ink-900);
  margin-bottom: 6px;
}
.auth-form-subtitle {
  font-size: 14px;
  color: var(--ink-500);
  margin-bottom: 36px;
}

.form-group { margin-bottom: 16px; }

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-700);
  margin-bottom: 6px;
  display: block;
}

.form-row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.input-lg {
  height: 48px;
  font-size: 15px;
  padding: 0 16px;
  background: var(--ink-50);
  border: 1.5px solid var(--ink-200);
  border-radius: 8px;
  width: 100%;
  outline: none;
  transition: border-color 150ms, box-shadow 150ms, background 150ms;
}
.input-lg:hover { border-color: var(--ink-300); background: white; }
.input-lg:focus {
  border-color: var(--ink-900);
  background: white;
  box-shadow: 0 0 0 3px rgba(10,10,10,0.06);
}
.input-lg::placeholder { color: var(--ink-400); }

.select-lg {
  height: 48px;
  font-size: 15px;
  padding: 0 16px;
  background: var(--ink-50);
  border: 1.5px solid var(--ink-200);
  border-radius: 8px;
  width: 100%; outline: none; cursor: pointer;
  transition: border-color 150ms;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
.select-lg:hover { border-color: var(--ink-300); }
.select-lg:focus { border-color: var(--ink-900); box-shadow: 0 0 0 3px rgba(10,10,10,0.06); }

.link-sm {
  font-size: 13px;
  color: var(--brand-red);
  transition: opacity 150ms;
}
.link-sm:hover { opacity: 0.75; }

.btn-submit {
  width: 100%;
  height: 48px;
  font-size: 15px;
  font-weight: 600;
  background: var(--ink-900);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 150ms, transform 100ms;
  margin-top: 8px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-submit:hover { background: var(--ink-700); }
.btn-submit:active { transform: scale(0.99); }

.btn-submit-red {
  background: var(--brand-red);
}
.btn-submit-red:hover { background: var(--brand-red-hover); }

.divider-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: var(--ink-400);
  font-size: 12px;
  font-weight: 500;
}
.divider-or::before, .divider-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--ink-150);
}

.account-type-select {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 28px;
}
.type-option {
  border: 2px solid var(--ink-200);
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: all 150ms;
  background: var(--ink-50);
  text-align: left;
}
.type-option:hover { border-color: var(--ink-400); background: white; }
.type-option.selected {
  border-color: var(--brand-red);
  background: var(--brand-red-light);
}
.type-option-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--ink-100);
  display: grid; place-items: center;
  margin-bottom: 10px;
  transition: background 150ms;
}
.type-option.selected .type-option-icon { background: var(--brand-red); }
.type-option.selected .type-option-icon svg { stroke: white; }
.type-option-label { font-size: 13px; font-weight: 600; color: var(--ink-900); }
.type-option-sub { font-size: 11px; color: var(--ink-500); margin-top: 2px; line-height: 1.4; }
.type-option.selected .type-option-sub { color: var(--brand-red-dark); }

.section-label {
  font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-400); margin: 20px 0 14px;
  display: flex; align-items: center; gap: 8px;
}
.section-label::after { content: ''; flex: 1; height: 1px; background: var(--ink-150); }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.terms-note {
  font-size: 11px;
  color: var(--ink-400);
  text-align: center;
  margin-top: 12px;
  line-height: 1.5;
}
.terms-note a { color: var(--ink-500); text-decoration: underline; }

.auth-footer {
  margin-top: 28px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-500);
}
.auth-footer a { color: var(--brand-red); font-weight: 500; }
.auth-footer a:hover { opacity: 0.8; }

.password-wrap { position: relative; }
.password-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-400);
  padding: 0;
  display: flex;
  transition: color 150ms;
}
.password-toggle:hover { color: var(--ink-700); }

/* Keep old auth styles for backwards compat */
.brand-headline { font-size: 32px; font-weight: 700; letter-spacing: -0.03em; color: var(--ink-900); text-align: center; max-width: 400px; margin-bottom: 12px; }
.brand-sub { font-size: 15px; color: var(--ink-500); text-align: center; max-width: 360px; line-height: 1.5; }

/* Old role-tab (register) kept for compatibility */
.role-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: white;
  color: var(--ink-500);
  border-color: var(--ink-200);
  cursor: pointer;
}
.role-tab:hover { border-color: var(--ink-300); color: var(--ink-900); }
.role-tab.active {
  background: var(--brand-red-light);
  border-color: var(--brand-red);
  color: var(--brand-red);
}

/* ----- Page header --------------------------------------------------------- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding-right: 110px;
  position: relative;
  flex-wrap: wrap;
}
.page-header-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink-900); }
.page-subtitle { font-size: 14px; color: var(--ink-500); margin-top: 4px; }

/* ----- Flash messages ------------------------------------------------------ */
.flash-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  max-width: 400px;
}
.flash {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transition: opacity 300ms;
}
.flash-error   { background: var(--red-100);   color: var(--red-600); }
.flash-success { background: var(--green-100); color: var(--green-600); }
.flash-warning { background: var(--amber-100); color: var(--amber-600); }
.flash-info    { background: var(--ink-100);    color: var(--ink-700); }
.flash-close {
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  opacity: 0.5;
}
.flash-close:hover { opacity: 1; }

/* ─── Backend unavailable banner ─────────────────────────────────────────────
   Fixed to the top of the viewport, visually distinct from flash messages.
   High-contrast, no auto-dismiss, spans the full width above all page content.
   ───────────────────────────────────────────────────────────────────────── */
.backend-unavailable-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  background: #7c2d12;          /* high-contrast amber-red */
  color: #fff7ed;
  border-bottom: 1px solid #9a3412;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}
.backend-unavailable-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.backend-unavailable-icon {
  font-size: 16px;
  flex-shrink: 0;
}
.backend-unavailable-text {
  flex: 1;
}
/* Push page content down so the fixed banner doesn't overlap the shell. */
body:has(.backend-unavailable-banner) .shell,
body:has(.backend-unavailable-banner) .auth-page {
  padding-top: 44px;
}

/* ----- Component primitives (Tailwind edge cases) ------------------------- */
.card {
  background: var(--ink-0);
  border: 1px solid var(--ink-150);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.card-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--ink-150);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title { font-size: 14px; font-weight: 600; color: var(--ink-900); }
.card-link { font-size: 12px; color: var(--brand-red); font-weight: 500; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.005em;
  background: var(--ink-100);
  color: var(--ink-700);
}
.badge-green { background: var(--green-100); color: var(--green-600); }
.badge-amber { background: var(--amber-100); color: var(--amber-600); }
.badge-red   { background: var(--red-100);   color: var(--red-600); }
.badge-blue  { background: var(--blue-100);  color: var(--blue-600); }
.badge-indigo{ background: var(--indigo-100);color: var(--indigo-600); }
.badge-grey  { background: var(--ink-100);   color: var(--ink-500); }
.badge-dark  { background: var(--ink-900);   color: white; }

/* Dashboard status / stock badges */
.badge-pending   { background: var(--ink-100);   color: var(--ink-500); }
.badge-confirmed { background: var(--blue-100);  color: var(--blue-600); }
.badge-processing{ background: var(--amber-100);  color: var(--amber-600); }
.badge-shipped   { background: var(--indigo-100);color: var(--indigo-600); }
.badge-delivered { background: var(--green-100);  color: var(--green-600); }
.badge-cancelled { background: var(--red-100);    color: var(--red-600); }

.badge-in_stock     { background: var(--green-100); color: var(--green-600); }
.badge-low_stock    { background: var(--amber-100); color: var(--amber-600); }
.badge-out_of_stock { background: var(--red-100);   color: var(--red-600); }

/* ----- Table --------------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-500);
  padding: 10px 16px;
  border-bottom: 1px solid var(--ink-150);
  background: var(--ink-50);
}
tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--ink-150);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--ink-50); }

/* ----- Logo mark base ------------------------------------------------------ */
.logo-mark {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ----- Tabular numerals ---------------------------------------------------- */
.tabular, table, .price, .num { font-variant-numeric: tabular-nums; }

/* ----- Button primitives --------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: all 120ms ease;
  white-space: nowrap;
  border: 1px solid transparent;
}
.btn-primary { background: var(--brand-red); color: white; }
.btn-primary:hover { background: var(--brand-red-hover); }
.btn-secondary { background: var(--ink-0); color: var(--ink-900); border-color: var(--ink-200); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { border-color: var(--ink-300); background: var(--ink-50); }
.btn-dark { background: var(--ink-900); color: white; }
.btn-dark:hover { background: var(--ink-700); }

/* ----- Input --------------------------------------------------------------- */
.input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  background: var(--ink-0);
  border: 1px solid var(--ink-200);
  border-radius: var(--r);
  font-size: 14px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  outline: none;
}
.input:hover { border-color: var(--ink-300); }
.input:focus {
  border-color: var(--ink-900);
  box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.06);
}
.input::placeholder { color: var(--ink-400); }

textarea.input {
  height: auto;
  min-height: 64px;
  padding: 10px 12px;
  line-height: 1.5;
  resize: vertical;
}

/* ----- Misc helpers -------------------------------------------------------- */
.hstack { display: flex; align-items: center; }
.vstack { display: flex; flex-direction: column; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.gap-4 { gap: 16px; } .gap-5 { gap: 20px; } .gap-6 { gap: 24px; }
.divider { height: 1px; background: var(--ink-150); }
.spacer { flex: 1; }
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 24px; }

/* Subtle price highlight */
.price-now { color: var(--ink-900); font-weight: 600; font-variant-numeric: tabular-nums; }
.price-was { color: var(--ink-400); text-decoration: line-through; font-variant-numeric: tabular-nums; }
.price-discount { color: var(--brand-red); }

/* ----- Tailwind-replacement utilities -------------------------------------- */
.text-center   { text-align: center; }
.text-sm       { font-size: 13px; }
.text-xs       { font-size: 11px; }
.text-2xl      { font-size: 24px; }
.text-gray-500 { color: var(--ink-500); }
.text-gray-700 { color: var(--ink-700); }
.font-bold     { font-weight: 700; }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.mb-2          { margin-bottom: 8px; }
.mb-6          { margin-bottom: 24px; }
.mt-6          { margin-top: 24px; }
.mt-8          { margin-top: 32px; }
.w-full        { width: 100%; }
.p-4           { padding: 16px; }
.rounded-md    { border-radius: var(--r); }
.rounded-lg    { border-radius: var(--r-lg); }
.border        { border: 1px solid var(--ink-150); }
.uppercase     { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.05em; }
.transition-colors { transition: color 150ms, background-color 150ms, border-color 150ms; }

/* Flex helpers */
.flex          { display: flex; }
.flex-1        { flex: 1 1 0%; }
.py-2          { padding-top: 8px; padding-bottom: 8px; }
.px-4          { padding-left: 16px; padding-right: 16px; }

/* Role tabs */
.role-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: white;
  color: var(--ink-500);
  border-color: var(--ink-200);
  cursor: pointer;
}
.role-tab:hover { border-color: var(--ink-300); color: var(--ink-900); }
.role-tab.active {
  background: var(--brand-red-light);
  border-color: var(--brand-red);
  color: var(--brand-red);
}

/* ----- Buyer dashboard ----------------------------------------------------- */
.dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  max-width: 100%;
}

.dashboard-grid .card-body {
  padding: 16px 20px;
}

.cart-list,
.order-list,
.location-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.cart-item,
.order-item,
.location-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--ink-150);
}

.cart-item:last-child,
.order-item:last-child,
.location-item:last-child {
  border-bottom: none;
}

.cart-item-name,
.order-number,
.location-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-900);
}

.cart-item-sku,
.order-date,
.location-address {
  margin-top: 2px;
}

.more-items {
  margin-top: 8px;
}

.cart-actions {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--ink-150);
}

.empty-state {
  text-align: center;
  padding: 32px 20px;
  color: var(--ink-500);
}

.empty-state p {
  margin-bottom: 16px;
}

.card-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--ink-150);
}

/* Mobile breakpoints for buyer dashboard */
@media (max-width: 900px) {
  .dashboard-grid {
    gap: 16px;
  }
  .dashboard-grid .card-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .dashboard-grid .card-body {
    padding: 12px 16px;
  }
  .cart-item,
  .order-item,
  .location-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 0;
  }
  .cart-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .cart-actions .btn,
  .card-head .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ----- Cart page ----------------------------------------------------------- */
.cart-container {
  max-width: var(--content-max);
  margin: 0 auto;
  width: 100%;
}

.cart-table-wrap {
  overflow-x: auto;
}

.cart-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.cart-table thead th {
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-500);
  padding: 14px 16px;
  border-bottom: 1px solid var(--ink-150);
  background: var(--ink-50);
  white-space: nowrap;
}

.cart-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--ink-150);
  vertical-align: middle;
}

.cart-table tbody tr:last-child td {
  border-bottom: none;
}

.cart-table tbody tr:hover {
  background: var(--ink-50);
}

.cart-col-product {
  width: auto;
}

.cart-col-sku {
  width: 100px;
}

.cart-col-stock {
  width: 120px;
}

.cart-col-qty {
  width: 120px;
}

.cart-col-actions {
  width: 80px;
  text-align: right;
}

.cart-col-actions .btn {
  margin-left: auto;
}

.cart-product-name {
  font-weight: 500;
  color: var(--ink-900);
}

.cart-sku {
  font-family: var(--font-mono);
  color: var(--ink-400);
}

.cart-qty-form {
  display: inline-block;
}

.cart-qty-input {
  width: 72px;
  text-align: center;
}

.cart-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 4px 4px;
  border-top: 1px solid var(--ink-150);
}

.cart-total-items {
  font-size: 13px;
  color: var(--ink-500);
  font-weight: 500;
}

.cart-clear-link {
  font-size: 13px;
  color: var(--ink-400);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color 120ms ease;
}

.cart-clear-link:hover {
  color: var(--red-600);
}

/* Small button variant */
.btn-sm {
  height: 28px;
  padding: 0 12px;
  font-size: 12px;
}

.cart-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.cart-main {
  flex: 2;
  min-width: 0;
}

.cart-table-card .card-body {
  padding: 0;
}

.cart-sidebar {
  flex: 1;
  max-width: 320px;
  min-width: 260px;
  position: sticky;
  top: 24px;
  align-self: flex-start;
}

.cart-summary-card .card-body {
  padding: 24px;
}

.cart-summary-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink-900);
  margin-bottom: 20px;
  letter-spacing: -0.01em;
}

.cart-summary-card .form-group {
  margin-bottom: 16px;
}

.cart-summary-card .form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-700);
  margin-bottom: 6px;
  display: block;
}

.cart-place-order-btn {
  width: 100%;
  height: 44px;
  margin-top: 8px;
}

.cart-empty-state {
  padding: 48px 24px;
}

.cart-empty-icon {
  color: var(--ink-300);
  margin-bottom: 16px;
}

.cart-empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-900);
  margin-bottom: 6px;
}

.cart-empty-sub {
  font-size: 14px;
  color: var(--ink-500);
  margin-bottom: 20px;
}

/* ----- Orders page --------------------------------------------------------- */
.order-filter-tabs {
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  border-radius: var(--r-lg);
  background: var(--ink-0);
  border: 1px solid var(--ink-150);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-500);
  transition: all 120ms ease;
}

.filter-tab:hover {
  border-color: var(--ink-300);
  color: var(--ink-900);
}

.filter-tab.active {
  background: var(--ink-900);
  border-color: var(--ink-900);
  color: white;
}

@media (max-width: 900px) {
  .order-filter-tabs {
    gap: 8px;
  }
  .filter-tab {
    height: 40px;
    padding: 0 12px;
    font-size: 12px;
  }
}

.table-wrap {
  overflow-x: auto;
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.orders-table thead th {
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-500);
  padding: 10px 16px;
  border-bottom: 1px solid var(--ink-150);
  background: var(--ink-50);
  white-space: nowrap;
}

.orders-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--ink-150);
  vertical-align: middle;
}

.orders-table tbody tr:last-child td {
  border-bottom: none;
}

.order-number {
  font-weight: 500;
  color: var(--ink-900);
}

.orders-empty-state {
  padding: 48px 24px;
}

.orders-empty-icon {
  color: var(--ink-300);
  margin-bottom: 16px;
}

.orders-empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-900);
  margin-bottom: 20px;
}

.text-mono {
  font-family: var(--font-mono);
}

/* ----- Order detail page --------------------------------------------------- */
.order-detail-section {
  margin-bottom: 20px;
}

.page-header + .order-detail-section {
  margin-top: 20px;
}

.order-detail-section .card-body {
  padding: 24px;
}

.order-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-500);
  font-weight: 500;
}

.info-value {
  font-size: 15px;
  color: var(--ink-900);
  font-weight: 500;
}

.info-sub {
  font-size: 12px;
  color: var(--ink-400);
  font-family: var(--font-mono);
}

/* ----- Locations page ------------------------------------------------------ */
.locations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
  align-items: start;
  margin-bottom: 32px;
}

.location-card {
  overflow: hidden;
}

.location-card-body {
  padding: 20px;
  min-height: 80px;
}

.location-info {
  min-width: 0;
}

.location-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-900);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.location-address {
  font-size: 13px;
  color: var(--ink-500);
  line-height: 1.5;
}

.location-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--ink-150);
  background: var(--ink-50);
}

.location-edit-form {
  padding: 16px 20px;
  border-top: 1px solid var(--ink-150);
  background: var(--ink-50);
}

.location-edit-form[hidden] {
  display: none !important;
}

.add-location-card {
  max-width: 680px;
}

.add-location-card .card-head {
  background: var(--ink-50);
  padding: 18px 24px;
}

.add-location-card .card-body {
  padding: 24px;
}

.add-location-inline-form {
  width: 100%;
  max-width: 400px;
}

.section-divider {
  height: 1px;
  background: var(--ink-150);
  margin-bottom: 32px;
}

.locations-empty-state {
  padding: 48px 24px;
}

.locations-empty-icon {
  color: var(--ink-300);
  margin-bottom: 16px;
}

.locations-empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-900);
  margin-bottom: 6px;
}

.locations-empty-sub {
  font-size: 14px;
  color: var(--ink-500);
  margin-bottom: 20px;
}

.inline-form {
  display: inline-block;
}

/* Danger button variant */
.btn-danger {
  background: transparent;
  color: var(--red-600);
  border-color: var(--red-200);
}
.btn-danger:hover {
  background: var(--red-100);
  border-color: var(--red-400);
  color: var(--red-600);
}

/* Ensure the HTML hidden attribute actually hides elements.
   Tailwind and some resets override it otherwise. */
[hidden] {
  display: none !important;
}

/* ----- Admin buyers page --------------------------------------------------- */
.admin-filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--ink-150);
}
.admin-filter-tab {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-500);
  position: relative;
  text-decoration: none;
}
.admin-filter-tab:hover {
  color: var(--ink-700);
}
.admin-filter-tab.active {
  color: var(--ink-900);
}
.admin-filter-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--ink-900);
}
.admin-buyers-table .actions-col {
  white-space: nowrap;
  width: 1%;
}
.reject-form {
  display: flex;
  align-items: center;
  gap: 6px;
}
.reject-form .input {
  max-width: 220px;
}

/* ── Supplier submissions ── */
.submission-info-box {
  background: var(--ink-50);
  border: 1px solid var(--ink-150);
  border-radius: var(--r);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--ink-700);
  margin-bottom: 20px;
}

/* ── Admin link-to-SKU inline form ── */
.link-sku-form {
  display: flex;
  gap: 8px;
  align-items: center;
}
.link-sku-form .input {
  width: 140px;
}

.admin-submissions-table .actions-col {
  white-space: nowrap;
  width: 1%;
}

.categories-cell {
  max-width: 180px;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

@media (max-width: 900px) {
  .admin-filter-tabs {
    flex-wrap: wrap;
    gap: 8px;
  }
  .admin-filter-tab {
    padding: 10px 12px;
    font-size: 12px;
  }
  .admin-filter-tabs + form.hstack,
  .page-header + .admin-filter-tabs + form.hstack {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .admin-filter-tabs + form.hstack .input,
  .page-header + .admin-filter-tabs + form.hstack .input,
  .admin-filter-tabs + form.hstack .btn,
  .page-header + .admin-filter-tabs + form.hstack .btn {
    width: 100%;
    max-width: none;
  }
  .admin-buyers-table .btn-sm,
  .catalog-pagination .btn-sm {
    height: 36px;
    padding: 0 12px;
    font-size: 13px;
  }
  .add-group-inline {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .add-group-inline .input {
    max-width: none;
    width: 100%;
  }
  .add-group-inline .btn {
    width: 100%;
    justify-content: center;
  }
  .admin-groups-table .btn-sm {
    height: 36px;
    padding: 0 12px;
    font-size: 13px;
  }
}

/* ----- Admin catalog page -------------------------------------------------- */
.admin-product-card {
  position: relative;
  padding: 16px;
  justify-content: space-between;
}
.admin-product-card .product-card-image {
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  margin: -16px -16px 12px;
  width: calc(100% + 32px);
}
.admin-product-card .product-card-body {
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.admin-product-card .product-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  min-height: auto;
}
.admin-product-card .product-sku {
  margin-top: 0;
  margin-bottom: 8px;
}
.admin-product-card .product-category {
  font-size: 11px;
  color: var(--ink-500);
  margin-bottom: 10px;
}
.admin-product-card .stock-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.admin-product-card .stock-row .text-sm {
  color: var(--ink-500);
}
.admin-product-card .price-row {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
}
.admin-product-card .supplier-row {
  font-size: 12px;
  margin-bottom: 4px;
}
.admin-product-card .alt-group-row {
  font-size: 12px;
  color: var(--ink-500);
  margin-bottom: 12px;
}
.admin-product-card .admin-card-actions {
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--ink-150);
  padding-top: 12px;
  margin-top: auto;
}
.admin-product-edit-form {
  padding: 12px;
  background: var(--ink-50);
  border-top: 1px solid var(--ink-150);
}
.admin-product-edit-form .form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}
.admin-product-edit-form .input {
  width: 100%;
}
.supplier-unassigned {
  color: var(--ink-400);
  font-style: italic;
}
.image-upload-trigger {
  font-size: 12px;
  color: var(--brand-red);
  cursor: pointer;
}
.admin-image-form {
  margin-top: 8px;
}

/* Mobile locations */
@media (max-width: 900px) {
  .locations-grid {
    grid-template-columns: 1fr;
  }
  .location-card-footer {
    gap: 8px;
  }
  .location-card-footer .btn {
    flex: 1;
    justify-content: center;
  }
}

/* Mobile cart */
@media (max-width: 900px) {
  .cart-layout {
    flex-direction: column;
  }
  .cart-sidebar {
    position: static;
    max-width: 100%;
    min-width: auto;
    width: 100%;
    order: -1;
  }
  .cart-table thead th,
  .cart-table tbody td {
    padding: 10px 12px;
    font-size: 13px;
  }
  .cart-qty-input {
    width: 64px;
  }
  .cart-summary {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

/* ----- Profile page -------------------------------------------------------- */
.page-header-profile {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}
.profile-avatar-large {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--brand-red, #e74431);
  color: white;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 700;
  flex-shrink: 0;
}
.profile-layout {
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.profile-card .card-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--ink-150);
}
.profile-card .card-body {
  padding: 20px;
}
.profile-card .form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* ----- Confirm modal ------------------------------------------------------- */
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.confirm-modal[hidden] {
  display: none !important;
}

.confirm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.45);
  backdrop-filter: blur(2px);
}

.confirm-modal-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--ink-0);
  border: 1px solid var(--ink-150);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-in 0.18s ease-out both;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.confirm-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--ink-150);
}

.confirm-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-900);
  letter-spacing: -0.01em;
}

.confirm-modal-close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r);
  color: var(--ink-500);
  cursor: pointer;
  transition: all 120ms ease;
}
.confirm-modal-close:hover {
  background: var(--ink-100);
  color: var(--ink-900);
}

.confirm-modal-body {
  padding: 20px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-500);
}

.confirm-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  background: var(--ink-50);
  border-top: 1px solid var(--ink-150);
}

/* ----- Help & support modal ------------------------------------------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: grid;
  place-items: center;
  z-index: 200;
  padding: 16px;
}

.modal-overlay[hidden] {
  display: none !important;
}

.modal-box {
  background: var(--ink-0);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 440px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink-900);
  letter-spacing: -0.01em;
}

.modal-close {
  color: var(--ink-500);
  font-size: 18px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.modal-body p {
  color: var(--ink-700);
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.5;
}

.help-email {
  font-weight: 500;
  margin-bottom: 0;
}

.help-email a {
  color: var(--brand-red);
}

/* Sidebar help button at the bottom of the nav */
.sidebar-help {
  margin-top: auto;
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar-help .sidebar-link {
  width: 100%;
  justify-content: flex-start;
}

/* ----- Form validation errors ---------------------------------------------- */
.field-error {
  font-size: 12px;
  color: var(--brand-red);
  margin-top: 6px;
  font-weight: 500;
}
.input-error {
  border-color: var(--brand-red) !important;
  background: #fef1ef !important;
}
.input-error:focus {
  outline-color: var(--brand-red);
  box-shadow: 0 0 0 3px rgba(231, 68, 49, 0.12);
}

/* ----- Catalog page -------------------------------------------------------- */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.product-card {
  display: flex;
  flex-direction: column;
  transition: box-shadow 150ms ease, transform 150ms ease;
}

.product-card:hover {
  box-shadow: var(--shadow-lg);
}

.product-card-image {
  aspect-ratio: 4 / 3;
  background: var(--ink-100);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.product-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.placeholder-img-wrap {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: var(--ink-50);
}

.product-placeholder-img {
  width: 60%;
  height: 60%;
  opacity: 0.7;
  padding: 20px;
  object-fit: contain;
}

.product-card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-900);
  line-height: 1.35;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 40px;
}

.product-sku {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-400);
  margin-top: 6px;
}

.product-price {
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink-900);
}

.product-price-na {
  color: var(--ink-400);
  font-weight: 500;
  font-size: 13px;
}

.product-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
}

/* Out-of-stock add-to-cart button: muted grey so it clearly looks disabled. */
.product-actions .btn-primary:disabled,
.product-actions .btn-primary[disabled] {
  background: var(--ink-100);
  border-color: var(--ink-200);
  color: var(--ink-400);
  cursor: not-allowed;
}

.product-qty {
  width: 64px;
  text-align: center;
}

.catalog-search {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.catalog-search .input {
  max-width: 420px;
}

.catalog-filters {
  margin-bottom: 20px;
}

.catalog-category-select {
  max-width: 420px;
  height: 36px;
  padding: 0 12px;
}

.catalog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--ink-150);
}

.catalog-showing {
  font-size: 14px;
  color: var(--ink-500);
}

.catalog-pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.pagination-ellipsis {
  padding: 0 4px;
  color: var(--ink-500);
}

.inventory-section {
  margin-bottom: 24px;
}

.inventory-stock-body .inventory-stats {
  margin-bottom: 16px;
}

.inventory-attention-body {
  padding: 20px;
}

.inventory-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}

.inventory-tab {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  line-height: 1;
}

.last-sync-badge {
  font-size: 12px;
  color: var(--ink-500);
  font-weight: 500;
}

.stock-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.stock-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 16px;
  border-radius: var(--r-lg);
  background: var(--ink-50);
}

.stock-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.stock-stat-value {
  font-size: 32px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  margin-bottom: 4px;
}

.stock-stat-label {
  font-size: 13px;
  color: var(--ink-500);
  font-weight: 500;
}

.stock-stat-in .stock-stat-icon { background: var(--green-100); color: var(--green-600); }
.stock-stat-in .stock-stat-value { color: var(--green-600); }

.stock-stat-low .stock-stat-icon { background: var(--amber-100); color: var(--amber-600); }
.stock-stat-low .stock-stat-value { color: var(--amber-600); }

.stock-stat-out .stock-stat-icon { background: var(--red-100); color: var(--red-600); }
.stock-stat-out .stock-stat-value { color: var(--red-600); }

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

@media (max-width: 900px) {
  .inventory-tabs {
    flex-wrap: wrap;
    gap: 8px;
  }
  .inventory-tab {
    flex: 1 1 auto;
    justify-content: center;
  }
  .inventory-products-table .btn-sm,
  .catalog-pagination .btn-sm {
    height: 36px;
    padding: 0 12px;
    font-size: 13px;
  }
}

.inventory-products-table th,
.inventory-products-table td {
  padding: 14px 16px;
}

.inventory-products-table .numeric-col {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Sync history table */
.sync-history-table .numeric-col {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.sync-error-cell {
  color: var(--red-600);
  font-size: 12px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.badge-running { background: var(--amber-100); color: var(--amber-600); }

.date-range-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.date-range-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid var(--ink-200);
  color: var(--ink-700);
  text-decoration: none;
  line-height: 1;
}

.date-range-pill.active {
  background: var(--ink-900);
  color: white;
  border-color: var(--ink-900);
}

@media (max-width: 900px) {
  .date-range-pills {
    justify-content: flex-start;
    gap: 8px;
  }
  .date-range-pill {
    padding: 10px 14px;
    font-size: 12px;
  }
  .page-header-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ─── Supplier dashboard sections ─── */
.dashboard-section {
  margin-top: 24px;
}

/* Minimal base styling for supplier/shared data tables.
   Required for the mobile table-wrap fix to render correctly. */
.table-card .card-body {
  padding: 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.dashboard-section .section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.dashboard-section .section-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink-900);
}

@media (max-width: 900px) {
  .dashboard-section .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .dashboard-section .section-header .btn-sm,
  .product-card .btn-sm,
  .catalog-pagination .btn-sm {
    height: 36px;
    padding: 0 12px;
    font-size: 13px;
  }
}

.product-quantity-inline {
  font-size: 12px;
  color: var(--ink-500);
  margin-left: 6px;
}

.chart-container {
  min-height: 220px;
  padding: 16px 0;
  overflow-x: auto;
}

.chart-bar {
  fill: var(--brand-red, #e74431);
}

.export-link {
  font-size: 12px;
  color: var(--ink-500);
  text-decoration: none;
}

.export-link:hover {
  color: var(--brand-red);
}

.reports-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

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

.btn.disabled {
  opacity: 0.4;
  pointer-events: none;
  cursor: default;
}

/* Mobile catalog */
@media (max-width: 900px) {
  .catalog-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }
  .product-card-image {
    aspect-ratio: 1 / 1;
  }
  .catalog-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .catalog-search {
    flex-wrap: wrap;
    gap: 12px;
  }
  .catalog-search .input,
  .catalog-search select,
  .catalog-search .btn {
    flex: 1 1 100%;
    max-width: none;
    min-width: 0;
  }
  .catalog-category-select {
    max-width: none;
  }
  .product-actions {
    gap: 12px;
  }
  .product-card .btn-sm,
  .catalog-pagination .btn-sm {
    height: 36px;
    padding: 0 12px;
    font-size: 13px;
  }
}

/* ─── Mobile admin catalog ────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .admin-catalog-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .admin-product-card .admin-card-actions {
    flex-direction: column;
    gap: 8px;
  }
  .admin-product-card .admin-card-actions .btn-sm,
  .admin-product-edit-form .btn-sm {
    height: 36px;
    padding: 0 12px;
    font-size: 13px;
    justify-content: center;
  }
  .admin-product-edit-form {
    padding: 16px;
  }
  .admin-product-edit-form .form-row {
    margin-bottom: 14px;
  }
}

/* ----- Sidebar bottom static links ----------------------------------------- */
.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 4px;
}
.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,0.07);
  margin: 8px 0;
}
.sidebar-link-danger {
  color: var(--red-400, #f87171) !important;
}
.sidebar-link-danger:hover {
  background: rgba(239,68,68,0.12) !important;
}

/* ─── Profile identity header ─────────────────────────────────────────────── */
.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 28px;
  background: var(--ink-0);
  border: 1px solid var(--ink-150);
  border-radius: var(--r-xl);
  margin-bottom: 24px;
}

.profile-avatar-large {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--brand-red);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 600;
  flex-shrink: 0;
}

.profile-header-info { flex: 1; min-width: 0; }

.profile-header-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}

.profile-header-email {
  font-size: 14px;
  color: var(--ink-500);
  margin-bottom: 10px;
}

.profile-role-badge {
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.05em;
  font-weight: 600;
  padding: 4px 10px;
}

.badge-buyer { background: var(--ink-100); color: var(--ink-700); }
.badge-supplier { background: #ede9fe; color: #7c3aed; }
.badge-pinta_admin { background: var(--amber-100); color: var(--amber-600); }
.badge-super_admin { background: var(--ink-900); color: white; }

/* ----- Profile page -------------------------------------------------------- */
.profile-layout {
  max-width: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  align-items: start;
}
.profile-card { max-width: none; margin-bottom: 0; }
.profile-card .card-head { padding: 18px 24px; }
.profile-card .card-body { padding: 8px 24px 20px; }

@media (max-width: 900px) {
  .profile-layout {
    grid-template-columns: 1fr;
  }
  .profile-header {
    padding: 20px;
    gap: 16px;
  }
  .profile-avatar-large {
    width: 56px;
    height: 56px;
    font-size: 22px;
  }
  .profile-header-name {
    font-size: 18px;
  }
  .profile-header-email {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .profile-card .card-head {
    padding: 16px 20px;
  }
  .profile-card .card-body {
    padding: 8px 20px 16px;
  }
  .profile-edit-toggle {
    height: 36px;
    padding: 0 12px;
  }
}

.profile-edit-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.profile-field {
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  border-bottom: 1px solid var(--ink-150);
}
.profile-field:last-child { border-bottom: none; }

.profile-label {
  font-size: 12px;
  color: var(--ink-500);
  font-weight: 500;
  margin-bottom: 6px;
}

.profile-value {
  font-size: 15px;
  color: var(--ink-900);
  font-weight: 500;
}
.profile-value.profile-value-empty {
  color: var(--ink-400);
  font-weight: 400;
  font-style: italic;
}

.profile-hint {
  font-size: 12px;
  color: var(--ink-400);
  margin-top: 4px;
}
.profile-form .form-group {
  margin-bottom: 16px;
}
.profile-form .form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-700);
  margin-bottom: 6px;
}

/* Form input / select variants used in profile edit mode.
   Aligned with .input / .select-lg primitives but sized for dense cards. */
.form-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background: var(--ink-0);
  border: 1px solid var(--ink-200);
  border-radius: var(--r);
  font-size: 14px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  outline: none;
}
.form-input:hover { border-color: var(--ink-300); }
.form-input:focus {
  border-color: var(--ink-900);
  box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.06);
}
.form-select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background: var(--ink-0);
  border: 1px solid var(--ink-200);
  border-radius: var(--r);
  font-size: 14px;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.form-select:hover { border-color: var(--ink-300); }
.form-select:focus {
  border-color: var(--ink-900);
  box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.06);
}

/* ─── Mobile buyer setup page overrides ─────────────────────────────────────
   setup.html carries inline style attributes on .setup-page and .setup-nav,
   so those two declarations need !important to win from CSS without editing
   the template. Form-card padding is overridden by the body prefix selector
   because it lives in the page's <style> block. */
@media (max-width: 900px) {
  body .setup-page {
    padding: 32px 16px 60px !important;
  }
  body .setup-nav {
    padding: 0 16px !important;
    height: 56px !important;
  }
  body .setup-title {
    font-size: 24px;
  }
  body .form-card-header,
  body .form-card-body,
  body .form-card-footer {
    padding-left: 20px;
    padding-right: 20px;
  }
  body .form-card-header {
    padding-top: 20px;
    padding-bottom: 20px;
  }
  body .form-card-body {
    padding-top: 20px;
    padding-bottom: 20px;
  }
  body .form-card-footer {
    padding-top: 16px;
    padding-bottom: 16px;
  }
}

/* ----- Help & Support page ----------------------------------------------- */
.help-page {
  width: 100%;
  max-width: none;
}
.faq-section {
  margin-bottom: 32px;
}
.faq-section-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 16px;
}
.faq-list {
  width: 100%;
  border: 1px solid var(--ink-150);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.faq-item {
  width: 100%;
  border-bottom: 1px solid var(--ink-150);
}
.faq-item:last-child {
  border-bottom: none;
}
.faq-question {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: none;
  border: none;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-900);
  cursor: pointer;
  text-align: left;
  transition: background 120ms;
}
.faq-question:hover {
  background: var(--ink-50);
}
.faq-chevron {
  flex-shrink: 0;
  transition: transform 200ms ease;
  color: var(--ink-400);
}
.faq-answer {
  width: 100%;
  padding: 0 20px 16px;
}
.faq-answer p {
  font-size: 14px;
  color: var(--ink-600, var(--ink-500));
  line-height: 1.6;
}
.help-contact-card {
  width: 100%;
  margin-top: 8px;
}
.help-contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.help-contact-item {
  padding: 20px 24px;
}
.help-contact-item + .help-contact-item {
  border-left: 1px solid var(--ink-150);
}
.help-contact-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-900);
  margin-bottom: 6px;
}
.help-contact-desc {
  font-size: 13px;
  color: var(--ink-500);
  margin-top: 4px;
  line-height: 1.5;
}
.help-contact-email a {
  color: var(--brand-red);
  font-weight: 500;
  font-size: 14px;
}
.help-contact-email a:hover {
  text-decoration: underline;
}
@media (max-width: 600px) {
  .help-contact-grid {
    grid-template-columns: 1fr;
  }
  .help-contact-item + .help-contact-item {
    border-left: none;
    border-top: 1px solid var(--ink-150);
  }
}

/* ----- Admin dashboard ------------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--ink-0);
  border: 1px solid var(--ink-150);
  border-radius: var(--r-lg);
  padding: 20px;
}
.stat-card-green {
  border-left: 4px solid var(--green-500, #22c55e);
}
.stat-card-amber {
  border-left: 4px solid var(--amber-500, #f59e0b);
}
.stat-card-red {
  border-left: 4px solid var(--red-500, #ef4444);
}
.stat-label {
  font-size: 12px;
  color: var(--ink-500);
  font-weight: 500;
  margin-bottom: 8px;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
}
.stat-card-skeleton {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dashboard-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.application-list,
.alert-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.application-item,
.alert-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--ink-150);
}
.application-item:last-child,
.alert-item:last-child {
  border-bottom: none;
}
.application-name,
.alert-product {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-900);
  margin-bottom: 4px;
}
.application-meta,
.alert-message,
.alert-meta {
  line-height: 1.4;
}
@media (max-width: 900px) {
  .dashboard-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .application-item,
  .alert-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .application-item .btn-sm,
  .alert-item .btn-sm {
    height: 36px;
    padding: 0 12px;
    font-size: 13px;
  }
}

/* ─── Mobile main-content safeguard (non-!important; pinta.js owns the drawer) ─ */
@media (max-width: 900px) {
  .main {
    padding: 72px 16px 40px;
  }
}

/* ─── Mobile page-header safeguard ──────────────────────────────────────────
   Remove the desktop right padding that avoids the language toggle; on mobile
   the toggle is still top-right but the hamburger is top-left, so the full
   width can be used for the title. */
@media (max-width: 900px) {
  .page-header {
    padding-right: 0;
  }
  .page-title {
    font-size: 20px;
  }
}

/* ─── Mobile input font-size safeguard ────────────────────────────────────
   iOS Safari auto-zooms inputs with font-size < 16px. Keep desktop size
   unchanged while ensuring touch devices don't zoom on focus. */
@media (max-width: 900px) {
  .input-lg,
  .select-lg,
  .form-input,
  .form-select,
  .input {
    font-size: 16px;
  }
}

/* ─── Super Admin ─────────────────────────────────────────────────────────── */
.health-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.health-card { padding: 20px; }
.health-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.health-service-name { font-size: 14px; font-weight: 600; }
.health-detail { font-size: 12px; color: var(--ink-500); margin-top: 4px; }
.quick-links-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.quick-link-card { display: block; padding: 16px; background: var(--ink-0); border: 1px solid var(--ink-150); border-radius: var(--r-lg); text-align: center; font-weight: 500; font-size: 13px; color: var(--ink-900); transition: border-color 120ms; }
.quick-link-card:hover { border-color: var(--brand-red); }
.protected-account-text { font-size: 12px; color: var(--ink-400); font-style: italic; }

@media (max-width: 900px) {
  .health-refresh-btn {
    height: 36px;
    padding: 0 12px;
    font-size: 13px;
  }
  .sync-filter-form {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .sync-filter-form .input,
  .sync-filter-form .btn {
    width: 100%;
    max-width: none;
  }
  .sync-filter-form label {
    margin-bottom: 4px;
  }
  .btn-sm {
    height: 36px;
    padding: 0 12px;
    font-size: 13px;
  }
}

/* Health card skeleton loading state */
.health-card-skeleton { display: flex; flex-direction: column; gap: 8px; }
.skeleton-line {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--ink-100) 25%, var(--ink-150) 50%, var(--ink-100) 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}
.skeleton-line-short { width: 60%; }
.skeleton-line-tiny { width: 40%; height: 10px; }
@keyframes skeleton-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* HTMX indicator visibility */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }
.htmx-request.htmx-indicator { display: inline-block; }

/* ─── Mobile error pages ────────────────────────────────────────────────────
   Error pages extend base_auth.html and inherit its mobile styles.
   These overrides ensure the centered illustration + code stay readable on
   very narrow screens without touching each template's inline styles. */
@media (max-width: 900px) {
  .error-illustration {
    width: 200px;
    max-width: 100%;
  }
  .error-code {
    font-size: 56px;
  }
  .error-title {
    font-size: 18px;
  }
}
