/* ==========================================================================
   FLOWER MARKETPLACE — DESIGN SYSTEM
   Soft, subtle, modern. Matches the brand reference screenshots.
   ========================================================================== */

/* ---------- Design Tokens ---------- */
:root {
  /* Brand */
  --teal-900: #134e48;
  --teal-800: #18605a;
  --teal-700: #1f7a73;
  --purple-700: #5b3d8a;
  --purple-600: #6d4aa1;
  --purple-500: #8765b8;
  --purple-100: #e9def6;
  --purple-50:  #f3edf9;

  /* Neutrals */
  --cream-50:  #faf8f7;
  --cream-100: #f4f1f4;
  --white:     #ffffff;
  --gray-900:  #1f1d2b;
  --gray-800:  #2e2b3c;
  --gray-700:  #4a4856;
  --gray-600:  #65626f;
  --gray-500:  #8c8997;
  --gray-400:  #b6b3bf;
  --gray-300:  #d8d4dd;
  --gray-200:  #ece9ef;
  --gray-100:  #f5f3f7;

  /* Accents */
  --pink-100:  #fbd6dc;
  --pink-50:   #fce8eb;
  --orange-500:#f08a3e;
  --orange-100:#fce0ca;
  --orange-50: #fef0e4;
  --red-600:   #d04256;
  --red-500:   #e34c5d;
  --red-50:    #fde8eb;
  --green-600: #2f8c63;
  --green-500: #45a87a;
  --green-50:  #e3f5ec;
  --gold-500:  #d4a83a;
  --gold-50:   #fbf3dd;
  --blue-500:  #4a89dc;
  --blue-50:   #e7f0fb;

  /* Layout */
  --sidebar-w: 232px;
  --header-h: 60px;
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(31, 29, 43, 0.04);
  --shadow:    0 2px 8px rgba(31, 29, 43, 0.06);
  --shadow-lg: 0 8px 24px rgba(31, 29, 43, 0.08);

  /* Type */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  background: var(--cream-50);
  color: var(--gray-900);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--purple-600); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; cursor: pointer; }

/* ---------- App Layout ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  padding: 14px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px 18px;
  border-bottom: 1px solid var(--gray-100);
  margin-bottom: 12px;
}
.sidebar-brand .logo {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--purple-50);
  display: grid; place-items: center;
  color: var(--purple-600);
}
.sidebar-brand .brand-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--purple-700);
  letter-spacing: 0.2px;
}
.sidebar-brand .brand-sub {
  font-size: 10px;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--gray-700);
  font-weight: 500;
  font-size: 13.5px;
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: var(--cream-100); color: var(--gray-900); text-decoration: none; }
.nav a.active {
  background: var(--purple-50);
  color: var(--purple-700);
  font-weight: 600;
}
.nav a.active svg { color: var(--purple-600); }
.nav a svg { width: 18px; height: 18px; color: var(--gray-500); flex-shrink: 0; }
.nav .group-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray-400);
  margin: 14px 12px 4px;
  font-weight: 600;
}

/* Collapsible sidebar nav groups (e.g. Inventory → Stock + Products) */
.nav .group { display: flex; flex-direction: column; }
.nav .group-toggle {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--gray-700);
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.nav .group-toggle:hover { background: var(--cream-100); color: var(--gray-900); }
.nav .group-toggle svg:first-child { width: 18px; height: 18px; color: var(--gray-500); flex-shrink: 0; }
.nav .group-toggle .chev {
  margin-left: auto;
  width: 14px; height: 14px;
  opacity: 0.6;
  transition: transform 0.2s;
}
.nav .group.expanded .group-toggle { color: var(--gray-900); }
.nav .group.expanded .group-toggle .chev { transform: rotate(180deg); opacity: 1; }
.nav .group.expanded .group-toggle svg:first-child { color: var(--purple-600); }
.nav .group-children {
  display: none;
  flex-direction: column;
  gap: 2px;
  margin: 2px 0 4px 16px;
  padding-left: 10px;
  border-left: 1px solid var(--gray-200);
}
.nav .group.expanded .group-children { display: flex; }
.nav .group-children a {
  font-size: 12.5px;
  padding: 8px 12px;
  font-weight: 500;
}
.nav .group-children a.active {
  background: var(--purple-50);
  color: var(--purple-700);
  font-weight: 600;
}

/* ---------- Top Header ---------- */
.topbar {
  position: sticky;
  top: 0;
  height: var(--header-h);
  background: var(--teal-900);
  color: var(--white);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 10;
}
.topbar .page-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.3px;
  margin: 0 auto 0 8px;
}
.topbar .menu-btn {
  background: transparent; border: 0;
  color: var(--white);
  padding: 6px; border-radius: 6px;
  display: grid; place-items: center;
}
.topbar .menu-btn:hover { background: rgba(255,255,255,0.1); }
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-right: 10px;
}
.topbar-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: transparent;
  border: 0;
  color: rgba(255,255,255,0.82);
  cursor: pointer;
  position: relative;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}
.topbar-icon:hover { background: rgba(255,255,255,0.1); color: var(--white); }
.topbar-icon svg { width: 18px; height: 18px; }
.topbar-icon .dot-indicator {
  position: absolute;
  top: 7px; right: 7px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--red-500);
  border: 2px solid var(--teal-900);
}
.topbar-icon .badge-count {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--red-500);
  color: var(--white);
  font-size: 9.5px;
  font-weight: 700;
  display: grid; place-items: center;
  padding: 0 4px;
  border: 2px solid var(--teal-900);
  line-height: 1;
}
.topbar-divider {
  width: 1px; height: 22px;
  background: rgba(255,255,255,0.14);
  margin: 0 6px;
}

.topbar .user {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
}
.topbar .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--purple-600);
  display: grid; place-items: center;
  font-weight: 700; font-size: 12px; color: var(--white);
}
.topbar .user-name { font-size: 13px; }
.topbar .caret { opacity: 0.7; }

/* ---------- Main Content ---------- */
.main {
  display: flex; flex-direction: column;
  min-width: 0;
}
.content {
  padding: 22px 28px 40px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
}
.card-tight { padding: 14px 16px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.card-title {
  font-size: 14px; font-weight: 600; color: var(--gray-800);
  margin: 0;
}
.card-subtitle { font-size: 12px; color: var(--gray-500); }

/* ---------- KPI Tiles ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}
.kpi {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
}
.kpi .label {
  font-size: 12.5px; color: var(--gray-500);
  font-weight: 500;
  margin-bottom: 6px;
}
.kpi .value {
  font-size: 20px; font-weight: 700; color: var(--gray-900);
}
.kpi .sub {
  font-size: 12px; color: var(--gray-500);
  margin-top: 2px;
}

/* ---------- Mini-stat row (icon + text) ---------- */
.stat-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  margin-bottom: 18px;
}
.stat-tile {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  display: flex; align-items: center; gap: 14px;
}
.stat-tile .icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--purple-50);
  display: grid; place-items: center;
  color: var(--purple-600);
}
.stat-tile .label { font-size: 12.5px; color: var(--gray-500); }
.stat-tile .value { font-size: 18px; font-weight: 700; color: var(--gray-900); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--gray-300);
  background: var(--white);
  color: var(--gray-800);
  font-size: 13px; font-weight: 500;
  transition: all 0.15s;
}
.btn:hover { background: var(--cream-100); }
.btn svg { width: 16px; height: 16px; }
.btn-primary {
  background: var(--purple-600);
  border-color: var(--purple-600);
  color: var(--white);
}
.btn-primary:hover { background: var(--purple-700); border-color: var(--purple-700); }
.btn-ghost {
  background: transparent;
  border: 0;
  color: var(--gray-700);
  padding: 6px 10px;
}
.btn-ghost:hover { background: var(--gray-100); }
.btn-pill {
  border-radius: 999px;
  padding: 9px 16px;
  background: var(--purple-50);
  color: var(--purple-700);
  border: 0;
  font-weight: 600;
  width: 100%;
  justify-content: flex-start;
  font-family: inherit;
  font-size: inherit;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
  text-align: left;
}
.btn-pill:hover { background: var(--purple-100); }
button.btn-pill { font: inherit; font-weight: 600; }

/* ---------- Inline editable unit price in the Add Product modal ---------- */
.price-edit {
  width: 72px;
  padding: 3px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  background: transparent;
  color: var(--gray-900);
  text-align: right;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.price-edit:hover {
  background: var(--cream-50);
  border-color: var(--gray-200);
}
.price-edit:focus {
  background: var(--white);
  border-color: var(--purple-500);
  box-shadow: 0 0 0 3px rgba(109, 74, 161, 0.10);
  outline: none;
}
.price-edit.custom {
  color: var(--purple-700);
  background: var(--purple-50);
  border-color: var(--purple-100);
}
.row-price .dollar { color: var(--gray-700); margin-right: 1px; }

/* ---------- Form section title (used in Add/Edit Farm modal) ---------- */
.form-section-title {
  grid-column: span 12;
  margin-top: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--gray-200);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--purple-700);
}
.form-section-title:first-child { margin-top: 0; }

/* ---------- Inventory-connection method picker (Farm modal) ---------- */
.conn-method-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 4px;
}
.conn-card {
  border: 1.5px solid var(--gray-200);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  background: var(--white);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.conn-card:hover { border-color: var(--purple-300, #c5b1de); background: var(--cream-50); }
.conn-card input[type="radio"] { display: none; }
.conn-card.selected {
  border-color: var(--purple-600);
  background: var(--purple-50);
  box-shadow: 0 0 0 3px rgba(109, 74, 161, 0.10);
}
.conn-card .ico {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: var(--cream-50);
  margin-bottom: 2px;
}
.conn-card.selected .ico { background: var(--white); color: var(--purple-700); }
.conn-card .ttl {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--gray-900);
}
.conn-card .desc {
  font-size: 10.5px;
  color: var(--gray-600);
  line-height: 1.4;
}
.conn-details {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--cream-50);
  border: 1px solid var(--gray-100);
  border-radius: 10px;
  font-size: 12px;
  color: var(--gray-700);
}
.conn-details input,
.conn-details select {
  margin-top: 4px;
}
.conn-details .conn-empty {
  font-size: 11.5px;
  color: var(--gray-500);
  text-align: center;
  padding: 4px;
}
.portal-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 600;
}
.portal-status-pill .dot { width: 6px; height: 6px; border-radius: 50%; }
.portal-status-pill.none      { background: var(--gray-100); color: var(--gray-600); }
.portal-status-pill.none .dot { background: var(--gray-400); }
.portal-status-pill.invited   { background: #fef9e6; color: #a17409; }
.portal-status-pill.invited .dot { background: #d4a83a; }
.portal-status-pill.active    { background: #e6f4ea; color: #047857; }
.portal-status-pill.active .dot { background: #10b981; }
.portal-status-pill.suspended { background: #fef2f2; color: #b91c1c; }
.portal-status-pill.suspended .dot { background: #ef4444; }

/* Connection method badge in the farm row */
.conn-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--cream-50);
  border: 1px solid var(--gray-200);
  color: var(--gray-700);
}
.conn-badge.gsheets { background: #e6f4ea; border-color: #b5e0c3; color: #047857; }
.conn-badge.api     { background: var(--purple-50); border-color: var(--purple-100); color: var(--purple-700); }
.conn-badge.email   { background: #fef3e6; border-color: #f3cda3; color: #b87431; }
.conn-badge.portal  { background: #e6f0fe; border-color: #b8cdf3; color: #3955a8; }
.conn-badge.csv     { background: var(--gray-100); border-color: var(--gray-300); color: var(--gray-700); }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }

/* ---------- Inputs ---------- */
.input, .select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 13.5px;
  background: var(--white);
  color: var(--gray-900);
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus, textarea:focus {
  outline: 0;
  border-color: var(--purple-500);
  box-shadow: 0 0 0 3px var(--purple-50);
}
.input-search {
  /* No magnifier icon — placeholder text alone carries the search affordance.
     Daniel asked for this site-wide so the field reads cleanly. */
  background: var(--white);
  padding-left: 12px;
}
.field-label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.5px;
}

/* ---------- Tables ---------- */
.table-wrap {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
/* When an open status-pick menu exists inside the table, lift the clip so the
   dropdown can render outside the rounded boundary. */
.table-wrap:has(.status-pick-menu.open) { overflow: visible; }
table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
table.data thead th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gray-500);
  padding: 12px 14px;
  background: var(--cream-50);
  border-bottom: 1px solid var(--gray-200);
  font-weight: 600;
  white-space: nowrap;
}
table.data tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-800);
  vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--cream-50); }
table.data tbody tr.row-pink { background: var(--pink-50); }
table.data tbody tr.row-pink:hover { background: var(--pink-100); }
table.data tfoot td {
  padding: 12px 14px;
  background: var(--cream-100);
  font-weight: 600;
  color: var(--gray-800);
  border-top: 1px solid var(--gray-200);
}
.cell-strong { font-weight: 600; color: var(--gray-900); }
.cell-muted { color: var(--gray-500); }
.cell-mono { font-variant-numeric: tabular-nums; }

/* ---------- Status badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-orange { background: var(--orange-50); color: var(--orange-500); }
.badge-green  { background: var(--green-50);  color: var(--green-600); }
.badge-red    { background: var(--red-50);    color: var(--red-600); }
.badge-gold   { background: var(--gold-50);   color: var(--gold-500); }
.badge-blue   { background: var(--blue-50);   color: var(--blue-500); }
.badge-gray   { background: var(--gray-100);  color: var(--gray-600); }
.badge-purple { background: var(--purple-50); color: var(--purple-700); }

/* ---------- Dot chip (color swatch + label) ---------- */
.chip-color {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--gray-700);
}
.chip-color .sw {
  width: 12px; height: 12px; border-radius: 50%;
  border: 1px solid var(--gray-200);
}

/* ---------- Product cell (icon + name + sub) ---------- */
.prod {
  display: flex; align-items: center; gap: 10px;
}
.prod-icon {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--pink-50);
  display: grid; place-items: center;
  color: var(--red-500);
  flex-shrink: 0;
}
.prod-icon.green { background: var(--green-50); color: var(--green-600); }
.prod-icon.gold  { background: var(--gold-50);  color: var(--gold-500); }
.prod-icon.purple{ background: var(--purple-50);color: var(--purple-600); }
.prod-name { font-weight: 600; color: var(--gray-900); font-size: 13px; line-height: 1.2; }
.prod-sub  { font-size: 11.5px; color: var(--gray-500); }

/* ---------- Layout helpers ---------- */
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.row { display: flex; gap: 10px; align-items: center; }
.row-between { display: flex; justify-content: space-between; align-items: center; }
.row-wrap { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }
.mt-4 { margin-top: 20px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 14px; }
.mb-4 { margin-bottom: 20px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.muted { color: var(--gray-500); }
.tag-purple {
  background: var(--purple-50); color: var(--purple-700);
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}

/* ---------- Filter bar ---------- */
.toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  background: var(--white);
}
.toolbar .search { flex: 1; max-width: 360px; }
.toolbar .icon-btn {
  width: 32px; height: 32px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  border-radius: 8px;
  display: grid; place-items: center;
  color: var(--gray-600);
}
.toolbar .icon-btn:hover { background: var(--cream-50); color: var(--gray-900); }

/* ---------- Pagination ---------- */
.pagination {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--gray-100);
  font-size: 12.5px;
  color: var(--gray-600);
}
.page-num {
  width: 28px; height: 28px; border-radius: 6px;
  display: grid; place-items: center;
  background: var(--white);
  border: 1px solid var(--gray-200);
  color: var(--gray-700);
}
.page-num.active { background: var(--green-500); color: white; border-color: var(--green-500); }

/* ---------- Donut (CSS) ---------- */
.donut {
  --p: 35; --c: var(--red-500); --bg: var(--gray-200);
  width: 110px; height: 110px; border-radius: 50%;
  background:
    conic-gradient(var(--c) calc(var(--p) * 1%), var(--bg) 0);
  display: grid; place-items: center;
  position: relative;
}
.donut::before {
  content: ""; position: absolute; inset: 12px;
  background: var(--white); border-radius: 50%;
}
.donut .center {
  position: relative; z-index: 1;
  text-align: center;
}
.donut .center .pct { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.donut .center .lbl { font-size: 9.5px; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.6px; }

/* ---------- Order Summary list ---------- */
.summary-list { list-style: none; padding: 0; margin: 0; }
.summary-list li {
  display: flex; justify-content: space-between;
  padding: 8px 0;
  font-size: 13px;
  border-bottom: 1px dashed var(--gray-200);
}
.summary-list li:last-child { border-bottom: 0; }
.summary-list .k { color: var(--gray-600); }
.summary-list .v { font-weight: 600; color: var(--gray-900); }

/* ---------- Alert panel ---------- */
.alert {
  background: var(--red-50);
  border: 1px solid var(--pink-100);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.alert-title {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; color: var(--red-600);
  font-size: 12.5px;
  margin-bottom: 8px;
}
.alert-list { list-style: none; padding: 0; margin: 0; font-size: 12.5px; }
.alert-list li {
  display: flex; justify-content: space-between; padding: 4px 0;
  color: var(--gray-700);
}
.alert-list .v { color: var(--red-500); font-weight: 600; }

/* ---------- Order header card ---------- */
.order-header {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: grid;
  grid-template-columns: auto 1fr auto auto auto auto auto auto;
  gap: 22px;
  align-items: center;
  margin-bottom: 18px;
}
.order-header .ord-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--purple-50); color: var(--purple-600);
  display: grid; place-items: center;
}
.order-header .ord-id { font-weight: 700; color: var(--gray-900); font-size: 16px; }
.order-header .ord-cust { color: var(--purple-700); font-size: 12.5px; }
.order-header .meta-label { font-size: 10px; text-transform: uppercase; color: var(--gray-500); letter-spacing: 0.6px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.order-header .meta-value { font-size: 13.5px; color: var(--gray-900); font-weight: 600; margin-top: 4px; }
.order-header .search { width: 220px; }

/* ---------- Chart placeholders ---------- */
.chart {
  width: 100%; height: 200px;
  background:
    linear-gradient(to top, rgba(109, 74, 161, 0.04), transparent 60%);
  border-radius: var(--radius);
  position: relative;
}

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--cream-50);
}
.login-hero {
  background: linear-gradient(135deg, var(--teal-900), var(--purple-700));
  color: var(--white);
  display: flex; flex-direction: column; justify-content: center;
  padding: 48px 56px;
}
.login-hero h1 { font-size: 32px; font-weight: 700; margin: 14px 0 12px; line-height: 1.2; }
.login-hero p { font-size: 15px; opacity: 0.85; max-width: 420px; line-height: 1.6; }
.login-hero .brand-mark {
  width: 56px; height: 56px;
  border-radius: 16px;
  background: rgba(255,255,255,0.12);
  display: grid; place-items: center;
}
.login-form-wrap {
  display: grid; place-items: center; padding: 40px;
}
.login-form {
  width: 100%; max-width: 380px;
}
.login-form h2 { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.login-form .sub { color: var(--gray-500); margin-bottom: 26px; font-size: 13.5px; }
.login-form .field { margin-bottom: 16px; }
.login-form .row-between { font-size: 12.5px; margin-bottom: 18px; }

/* ---------- Sparkline mini ---------- */
.spark {
  display: inline-block;
  width: 70px; height: 22px;
  vertical-align: middle;
}

/* ==========================================================================
   ORDER ENTRY — customer bar, autocomplete, cart, product thumbs
   ========================================================================== */

/* Product thumbnail (rounded photo tile used in line item tables) */
.prod-thumb {
  width: 44px; height: 44px;
  border-radius: 10px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--cream-50), var(--cream-100));
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06), 0 1px 2px rgba(31,29,43,0.05);
  overflow: hidden;
}
.prod-thumb.sm { width: 36px; height: 36px; border-radius: 8px; }

/* Customer bar at top of Order Entry */
.cust-bar {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.cust-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
}
.cust-search {
  position: relative;
}
.cust-search .input { padding-left: 38px; }
.cust-search > svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--gray-500); pointer-events: none;
}
.cust-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 30;
  max-height: 280px; overflow-y: auto;
  display: none;
}
.cust-results.open { display: block; }
.cust-results .item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  align-items: center;
}
.cust-results .item:last-child { border-bottom: 0; }
.cust-results .item:hover { background: var(--cream-50); }
.cust-results .item .acct {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11.5px;
  color: var(--purple-700);
  background: var(--purple-50);
  padding: 3px 9px;
  border-radius: 6px;
  text-align: center;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.cust-results .item .name {
  font-weight: 600;
  color: var(--gray-900);
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cust-results .item .loc {
  font-size: 11.5px;
  color: var(--gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.cust-results .item .tier {
  font-size: 10.5px !important;
  white-space: nowrap;
}
/* Narrower dropdowns: hide tier first, then drop to two lines if needed */
@media (max-width: 720px) {
  .cust-results .item .tier { display: none; }
}
@media (max-width: 420px) {
  .cust-results .item { grid-template-columns: auto 1fr; }
  .cust-results .item .acct { font-size: 10.5px; padding: 2px 6px; }
}

/* Customer details panel (collapsed read view + expanded edit form) */
.cust-details {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--gray-100);
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 16px;
  align-items: start;
}
.cust-avatar {
  width: 56px; height: 56px; border-radius: 14px;
  background: var(--purple-50); color: var(--purple-700);
  display: grid; place-items: center;
  font-weight: 700; font-size: 18px;
}
.cust-meta .name { font-size: 16px; font-weight: 700; color: var(--gray-900); display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.cust-meta .name .acct-pill {
  font-family: ui-monospace, monospace;
  font-size: 11.5px; font-weight: 600;
  color: var(--purple-700); background: var(--purple-50);
  padding: 3px 9px; border-radius: 999px;
}
.cust-meta .contact { color: var(--gray-600); font-size: 12.5px; margin-top: 4px; }
.cust-meta .addrs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
  margin-top: 10px; font-size: 12.5px;
}
.cust-meta .addrs .h {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--gray-500); font-weight: 600; margin-bottom: 3px;
}
.cust-meta .addrs .v { color: var(--gray-800); line-height: 1.5; }
.cust-meta .ar-link {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 10px;
  font-size: 12.5px; font-weight: 600;
  color: var(--purple-700);
}
.cust-meta .ar-link:hover { text-decoration: underline; }

/* Edit form fields (shown when editing customer) */
.cust-edit { display: none; }
.cust-edit.open { display: block; }
.cust-edit .grid-fields {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.cust-edit .grid-fields .span-2 { grid-column: span 2; }

/* Order-level Ship Date pill (sits next to the cart in the customer bar) */
.ship-date-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  border-radius: 10px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  transition: border-color 0.15s, background 0.15s;
}
.ship-date-pill:hover { border-color: var(--purple-500); background: var(--cream-50); }
.ship-date-pill .ico {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--purple-50);
  color: var(--purple-700);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.ship-date-pill .ico svg { width: 14px; height: 14px; }
.ship-date-pill .lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--gray-500);
  font-weight: 600;
  line-height: 1;
}
.ship-date-pill input[type="date"] {
  border: 0;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-900);
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  padding: 0;
  margin-top: 2px;
  cursor: pointer;
  width: 130px;
}
.ship-date-pill input[type="date"]:focus { outline: 0; }
.ship-date-pill.unset .ico { background: var(--gray-100); color: var(--gray-500); }
.ship-date-pill.unset input[type="date"] { color: var(--gray-500); font-weight: 500; }

/* Shopping cart button at top-right */
.cart-wrap { position: relative; }
.cart-btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-900);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.cart-btn:hover { background: var(--cream-50); border-color: var(--gray-300); }
.cart-btn .ico {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--purple-50); color: var(--purple-700);
  display: grid; place-items: center;
}
.cart-btn .count {
  font-size: 10px; font-weight: 700;
  background: var(--purple-600); color: var(--white);
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: -2px;
}
.cart-btn .total { font-size: 15px; }
/* ============================================================================
   CART PANEL — Daniel 2026-06-02 round 4: full redesign.
   Goals:
   - Beautiful overlay: 80vw centered, gradient header, soft dim backdrop
   - Card-style line rows (not flat list), with breathing room
   - Source chip per line (ON HAND / MIAMI MARKET / PRE-ORDER) with color coding
   - Reserved slots for future fields: farm code + AWB last-4 (hidden today)
   - Labeled, prominent price input that is genuinely comfortable to edit
   - Clear right-side line total + Remove
   - Footer totals with strong hierarchy, generous primary CTA
   - Shared --cart-gutter keeps every section on the same alignment rails
   - Responsive: tighter spacing at ≤1024 / phone-feel at ≤720
   ========================================================================= */
.cart-panel {
  --cart-gutter: 56px;
  --cart-radius: 22px;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80vw;
  max-width: 1400px;
  min-width: 560px;
  max-height: 88vh;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--cart-radius);
  box-shadow: 0 40px 100px rgba(15, 23, 42, 0.42);
  z-index: 50;
  display: none;
  overflow: hidden;
  flex-direction: column;
}
.cart-panel.open { display: flex; }

/* ---- HEADER (compact) ---- */
.cart-panel__header {
  padding: 18px var(--cart-gutter) 16px;
  background: linear-gradient(180deg, #faf7f3 0%, #f6efe7 100%);
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
  flex-shrink: 0;
}
.cart-panel__title-block { display: flex; flex-direction: column; gap: 1px; }
.cart-panel__eyebrow {
  font-size: 10px; font-weight: 700; letter-spacing: 1.4px;
  color: var(--purple-700, #6d28d9);
  margin-bottom: 2px;
}
.cart-panel__title {
  margin: 0;
  font-size: 19px; font-weight: 700; color: var(--gray-900);
  letter-spacing: -0.3px;
  line-height: 1.1;
}
.cart-panel__subtitle {
  font-size: 12px; color: var(--gray-600);
  margin-top: 3px;
}
.cart-panel__close {
  width: 40px; height: 40px;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  background: white;
  color: var(--gray-600);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.cart-panel__close:hover { background: var(--gray-100); color: var(--gray-900); border-color: var(--gray-300); }

/* ---- ITEMS WRAPPER ----
   Sticky column header sits flush against the items list so a 20-40 line
   cart reads like a table without giving up the card aesthetic. */
.cart-panel__items {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px var(--cart-gutter) 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #fafaf8;
}

/* ---- LINE CARD (DENSE) ----
   Flat 5-column row optimised for 20-40 items per panel. Each row is
   ~56-64px tall (one meta line) or ~72px (two meta lines with farm+AWB),
   so a 720px items area shows 11-12 dense rows without scroll. Total
   panel can comfortably surface ~14 rows before scrolling on a 900px
   viewport.  Cards keep their border + hover lift, just much tighter. */
.cart-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 10px 16px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
  align-items: center;
}
/* Tail = price-cell + total + remove, flowed inline on desktop, wraps under
   the body on mobile. Lets us keep one DOM structure and just toggle the
   tail's grid placement per breakpoint. */
.cart-row__tail {
  display: grid;
  grid-template-columns: 160px 110px 32px;
  gap: 14px;
  align-items: center;
}
.cart-row:hover { box-shadow: 0 3px 10px rgba(15, 23, 42, 0.08); border-color: var(--gray-300); }
.cart-row__thumb {
  width: 52px; height: 52px;
  border-radius: 8px;
  background-color: var(--cream-50);
  background-size: cover; background-position: center;
  background-repeat: no-repeat;
  border: 1px solid var(--gray-100);
}

/* Body — name+chip on row 1, meta on row 2 */
.cart-row__body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cart-row__heading {
  display: flex; align-items: center; gap: 8px;
  min-width: 0;
}
.cart-row__name {
  margin: 0;
  font-size: 13.5px; font-weight: 600; color: var(--gray-900);
  line-height: 1.3;
  letter-spacing: -0.1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
}

/* Source chip — smaller, color-coded per inventory source */
.cart-row__chip {
  display: inline-block;
  flex-shrink: 0;
  font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.6px;
  padding: 2px 7px;
  border-radius: 99px;
  text-transform: uppercase;
  line-height: 1.4;
}
.cart-row__chip--onhand   { background: #ede9fe; color: #5b21b6; }
.cart-row__chip--miami    { background: #dbeafe; color: #1e40af; }
.cart-row__chip--preorder { background: #fef3c7; color: #92400e; }

/* Meta row — origin/color, UOM, future farm + AWB slots */
.cart-row__meta {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 2px 10px;
  font-size: 11.5px;
  color: var(--gray-500);
  line-height: 1.4;
}
.cart-row__meta-item { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.cart-row__meta-item b { color: var(--gray-700); font-weight: 600; }
.cart-row__meta-sep { color: var(--gray-300); }
.cart-row__meta-item--farm,
.cart-row__meta-item--awb {
  padding: 1px 6px;
  background: var(--cream-50);
  border: 1px solid var(--gray-200);
  border-radius: 5px;
  font-size: 10.5px;
  letter-spacing: 0.2px;
}

/* Price cell — input + "/ stem" hint inline */
.cart-row__price-cell {
  display: flex; align-items: center; gap: 6px;
  justify-content: flex-end;
}
.cart-row__price-field {
  display: inline-flex; align-items: center;
  background: white;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  padding: 0 8px;
  height: 32px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.cart-row__price-field:focus-within {
  border-color: var(--purple-500, #8b5cf6);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}
.cart-row__price-prefix {
  font-size: 11.5px; color: var(--gray-500); font-weight: 600;
}
.cart-row__price-input {
  width: 56px;
  border: 0;
  background: transparent;
  font-size: 13px; font-weight: 700;
  color: var(--gray-900);
  text-align: right;
  padding: 0 4px;
  font-variant-numeric: tabular-nums;
}
.cart-row__price-input:focus { outline: 0; }
.cart-row__price-unit {
  font-size: 10.5px; color: var(--gray-500); font-weight: 500;
  white-space: nowrap;
}

/* Total — straight number, no separate label (column self-explains) */
.cart-row__total-value {
  font-size: 15px; font-weight: 700;
  color: var(--gray-900);
  font-variant-numeric: tabular-nums;
  text-align: right;
  letter-spacing: -0.2px;
}

/* Icon-only remove button */
.cart-row__remove {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent;
  background: transparent;
  color: var(--gray-400);
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}
.cart-row__remove:hover { background: #fef2f2; border-color: #fecaca; color: var(--red-600); }

/* Empty placeholder */
.cart-row--empty {
  display: block;
  text-align: center;
  background: transparent;
  border: 1px dashed var(--gray-300);
  color: var(--gray-500);
  font-size: 13px;
  padding: 20px;
  box-shadow: none;
  grid-template-columns: none;
}
.cart-row--empty:hover { border-color: var(--gray-300); box-shadow: none; }

/* ---- FOOTER (compact) ---- */
.cart-panel__footer {
  padding: 16px var(--cart-gutter) 18px;
  border-top: 1px solid var(--gray-200);
  background: white;
  flex-shrink: 0;
}
.cart-panel__totals {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 12px;
  font-size: 13px;
}
.cart-panel__total-row {
  display: flex; justify-content: space-between;
  color: var(--gray-600);
  font-variant-numeric: tabular-nums;
}
.cart-panel__total-row span:last-child { color: var(--gray-900); font-weight: 600; }
.cart-panel__discount { color: var(--green-600, #047857) !important; }
.cart-panel__total-row--grand {
  border-top: 1px solid var(--gray-200);
  padding-top: 10px;
  margin-top: 4px;
  font-size: 14.5px;
}
.cart-panel__total-row--grand span { color: var(--gray-900) !important; font-weight: 700 !important; }
.cart-panel__total-row--grand span:last-child { color: var(--purple-700, #6d28d9) !important; font-size: 18px; letter-spacing: -0.3px; }
.cart-panel__cta {
  width: 100%;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  background: var(--purple-600, #7c3aed);
  color: white;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  letter-spacing: 0.2px;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.3);
  transition: all 0.15s ease;
}
.cart-panel__cta:hover {
  background: var(--purple-700, #6d28d9);
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.45);
  transform: translateY(-1px);
}

/* Dim backdrop behind the centered overlay. */
body:has(.cart-panel.open)::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  z-index: 40;
  pointer-events: none;
}

/* Tablet — keep dense grid, tighten gutter. */
@media (max-width: 1024px) {
  .cart-panel { --cart-gutter: 28px; width: 92vw; }
  .cart-row { grid-template-columns: 44px minmax(0,1fr) auto; gap: 10px; padding: 8px 12px; }
  .cart-row__thumb { width: 44px; height: 44px; }
  .cart-row__tail { grid-template-columns: 130px 90px 28px; gap: 10px; }
  .cart-row__price-input { width: 48px; }
}

/* Phone — tail wraps under the body. Single DOM, no JS, clean grid swap. */
@media (max-width: 720px) {
  .cart-panel {
    --cart-gutter: 16px;
    width: 96vw;
    min-width: 0;
    max-height: 92vh;
    border-radius: 14px;
  }
  .cart-panel__header { padding: 18px 16px; gap: 12px; }
  .cart-panel__title { font-size: 20px; }
  .cart-panel__items { padding: 10px 16px 6px; gap: 8px; }
  .cart-row {
    grid-template-columns: 44px minmax(0, 1fr);
    grid-template-areas:
      "thumb body"
      "tail  tail";
    row-gap: 8px;
    column-gap: 10px;
    padding: 10px 12px;
  }
  .cart-row__thumb { grid-area: thumb; width: 44px; height: 44px; }
  .cart-row__body  { grid-area: body; }
  .cart-row__tail  {
    grid-area: tail;
    grid-template-columns: 1fr auto 32px;
    gap: 10px;
    padding-top: 8px;
    border-top: 1px dashed var(--gray-200);
  }
  .cart-row__total-value { font-size: 15.5px; }
  .cart-panel__footer { padding: 16px 16px 20px; }
  .cart-panel__total-row--grand span:last-child { font-size: 19px; }
  .cart-panel__cta { padding: 13px 20px; font-size: 14px; }
}

/* ==========================================================================
   CHECKOUT — payment method tabs, credit card preview, action stack
   ========================================================================== */
.pay-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: var(--cream-50);
  border-radius: 10px;
  border: 1px solid var(--gray-200);
  margin-bottom: 18px;
}
.pay-tab {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 12px;
  border: 0;
  background: transparent;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  font-family: inherit;
}
.pay-tab:hover { color: var(--gray-900); }
.pay-tab.active {
  background: var(--white);
  color: var(--purple-700);
  box-shadow: var(--shadow-sm);
}
.pay-tab svg { width: 16px; height: 16px; }

.cc-preview {
  background: linear-gradient(135deg, #1f7a73, #5b3d8a);
  color: var(--white);
  border-radius: 14px;
  padding: 20px 22px;
  height: 168px;
  display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: 0 10px 24px rgba(91, 61, 138, 0.18);
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}
.cc-preview::before {
  content: ""; position: absolute;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  right: -60px; top: -80px;
}
.cc-preview::after {
  content: ""; position: absolute;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  left: -30px; bottom: -50px;
}
.cc-preview .top { display:flex; justify-content:space-between; align-items:flex-start; position: relative; z-index:1; }
.cc-preview .chip {
  width: 36px; height: 26px; border-radius: 5px;
  background: linear-gradient(135deg, #e7c873, #b18f3a);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.15);
}
.cc-preview .brand {
  font-size: 16px; font-weight: 800; letter-spacing: 2px;
  font-style: italic;
}
.cc-preview .number {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 19px; letter-spacing: 2.5px;
  position: relative; z-index:1;
}
.cc-preview .row {
  display: flex; justify-content: space-between; align-items: flex-end;
  position: relative; z-index:1;
}
.cc-preview .label-sm {
  font-size: 9px; text-transform: uppercase; letter-spacing: 1px;
  opacity: 0.7; margin-bottom: 3px;
}
.cc-preview .value-sm { font-size: 13px; font-weight: 600; letter-spacing: 1px; }

/* Saved card chooser — shown above the manual card form when customer has a card on file */
.saved-card-card {
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  background: var(--white);
  margin-bottom: 18px;
  overflow: hidden;
}
.saved-card-card .choice {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  cursor: pointer;
}
.saved-card-card .choice + .choice {
  border-top: 1px solid var(--gray-100);
}
.saved-card-card .choice.selected {
  background: var(--purple-50);
}
.saved-card-card .choice input[type="radio"] {
  width: 16px; height: 16px; cursor: pointer; flex-shrink: 0;
}
.saved-card-visual { flex: 1; min-width: 0; }
.saved-card-visual .brand {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--white);
  background: linear-gradient(135deg, #1f7a73, #5b3d8a);
  padding: 3px 8px;
  border-radius: 4px;
  margin-right: 8px;
}
.saved-card-visual .num {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 13.5px;
  letter-spacing: 1px;
  color: var(--gray-800);
  font-weight: 600;
}
.saved-card-visual .meta {
  font-size: 11.5px;
  color: var(--gray-500);
  margin-top: 4px;
}
.lock-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--green-700, var(--green-600));
  background: var(--green-50);
  padding: 5px 10px;
  border-radius: 999px;
  flex-shrink: 0;
}
.lock-badge svg { width: 12px; height: 12px; }

/* Multi-card row (Edit Customer card list) */
.ec-card-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--cream-50);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  transition: border-color 0.15s, background 0.15s;
}
.ec-card-row.default {
  background: var(--purple-50);
  border-color: var(--purple-300);
}
.ec-card-row .visual {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 3px;
}
.ec-card-row .visual .num {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 13px; letter-spacing: 1px;
  color: var(--gray-800); font-weight: 600;
}
.ec-card-row .visual .meta {
  font-size: 11.5px; color: var(--gray-500);
  display: flex; align-items: center; gap: 6px;
}
.ec-card-row .visual .meta .brand {
  font-size: 10px; font-weight: 800; letter-spacing: 1.2px;
  color: white;
  background: linear-gradient(135deg, #1f7a73, #5b3d8a);
  padding: 2px 7px; border-radius: 4px;
}
.default-badge {
  font-size: 9.5px; font-weight: 700;
  background: var(--purple-600); color: white;
  padding: 3px 8px; border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  white-space: nowrap;
}

.action-stack { display: flex; flex-direction: column; gap: 10px; }
.action-stack .btn,
.action-stack button {
  width: 100%;
  justify-content: center;
  padding: 12px 16px;
  font-size: 13.5px;
}
.btn-pay {
  background: var(--purple-600);
  border-color: var(--purple-600);
  color: var(--white);
  font-weight: 700;
}
.btn-pay:hover { background: var(--purple-700); border-color: var(--purple-700); }
.btn-paylater {
  background: var(--white);
  border-color: var(--gray-300);
  color: var(--gray-800);
}
.btn-paylater:hover { background: var(--cream-50); }

.trust-row {
  display: flex; gap: 14px; justify-content: center; align-items: center;
  margin-top: 14px;
  color: var(--gray-500);
  font-size: 11px;
}
.trust-row svg { width: 14px; height: 14px; }

.cko-step {
  display:flex; align-items:center; gap:10px;
  background: var(--white);
  padding: 10px 18px;
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  font-size: 12.5px;
  width: fit-content;
  margin-bottom: 16px;
  color: var(--gray-600);
}
.cko-step .step {
  display:inline-flex; align-items:center; gap:6px;
}
.cko-step .step .num {
  width: 20px; height: 20px; border-radius: 50%;
  display:grid; place-items:center;
  font-size: 11px; font-weight: 700;
  background: var(--gray-200); color: var(--gray-600);
}
.cko-step .step.done .num   { background: var(--green-500); color: var(--white); }
.cko-step .step.active .num { background: var(--purple-600); color: var(--white); }
.cko-step .step.active { color: var(--gray-900); font-weight: 600; }
.cko-step .sep { color: var(--gray-300); }

/* ==========================================================================
   KPI STRIP — horizontal cluster of metric cells with dividers
   Used in dashboard sales-trend header and order-details footer.
   ========================================================================== */
.kpi-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0;
}
.kpi-strip .kpi-cell {
  padding: 0 22px;
  border-left: 1px solid var(--gray-200);
}
.kpi-strip .kpi-cell:first-child {
  padding-left: 0;
  border-left: 0;
}
.kpi-cell .lbl {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--gray-500);
  font-weight: 600;
}
.kpi-cell .val {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
  margin-top: 4px;
  line-height: 1.1;
}
.kpi-cell .sub {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 4px;
}
.kpi-cell.hero .val { font-size: 26px; }

/* ==========================================================================
   BULK ACTION BAR — appears above the line-items toolbar when rows are checked
   ========================================================================== */
.bulk-bar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--purple-50);
  border-bottom: 1px solid var(--purple-100);
  animation: bulk-in 0.2s ease;
}
.bulk-bar.active { display: flex; }
@keyframes bulk-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.bulk-bar .ico {
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--purple-600); color: var(--white);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.bulk-bar .ico svg { width: 14px; height: 14px; }
.bulk-bar .count {
  font-size: 13px;
  color: var(--gray-800);
}
.bulk-bar .count strong { color: var(--purple-700); font-weight: 700; }
.bulk-bar .hint { color: var(--gray-500); font-size: 11.5px; }

/* ==========================================================================
   PRODUCT BROWSER MODAL — date-gated catalog for adding products to an order
   ========================================================================== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(31, 29, 43, 0.55);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--white);
  border-radius: 18px;
  width: 100%;
  max-width: 1320px;
  height: 92vh;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 32px 72px rgba(0,0,0,0.3);
  overflow: hidden;
}
.modal-head {
  padding: 14px 22px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-900);
}
.modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--cream-50);
  border: 1px solid var(--gray-200);
  color: var(--gray-600);
  cursor: pointer;
  display: grid; place-items: center;
}
.modal-close:hover { background: var(--gray-100); color: var(--gray-900); }
.modal-step.hidden { display: none; }

/* Date step */
.date-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
}
.date-step .icon {
  width: 72px; height: 72px;
  border-radius: 18px;
  background: var(--purple-50);
  color: var(--purple-600);
  display: grid; place-items: center;
  margin-bottom: 20px;
}
.date-step h4 {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 8px;
}
.date-step .sub {
  font-size: 13.5px;
  color: var(--gray-600);
  margin: 0 0 24px;
  max-width: 380px;
  line-height: 1.5;
}
.date-step .date-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 340px;
}
.quick-dates {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
}
.quick-date {
  padding: 6px 12px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  color: var(--gray-700);
  font-weight: 500;
}
.quick-date:hover { background: var(--cream-50); }
.quick-date.active {
  background: var(--purple-50);
  border-color: var(--purple-600);
  color: var(--purple-700);
  font-weight: 600;
}

/* Product browser */
.prod-browser {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.prod-toolbar {
  padding: 12px 22px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--cream-50);
  flex-wrap: wrap;
}
.prod-toolbar .cust-search { flex: 1; min-width: 220px; max-width: 360px; }
.date-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 6px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--gray-700);
}
.date-chip .ico {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--purple-50);
  color: var(--purple-700);
  display: grid; place-items: center;
}
.date-chip strong { color: var(--gray-900); margin: 0 2px; }
.date-chip button {
  background: transparent;
  border: 0;
  color: var(--purple-700);
  font-size: 11.5px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  padding-left: 8px;
  border-left: 1px solid var(--gray-200);
  margin-left: 4px;
}

/* Category chip strip */
.prod-chips {
  padding: 10px 22px;
  background: var(--cream-50);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cat-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
  font-family: inherit;
}
.cat-chip:hover { background: var(--cream-100); }
.cat-chip.active {
  background: var(--purple-600);
  border-color: var(--purple-600);
  color: var(--white);
}
.cat-chip .num { opacity: 0.7; font-weight: 500; }
.cat-chip.active .num { opacity: 0.9; }

/* Product grid */
.prod-grid-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
}
.prod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.prod-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
}
.prod-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--purple-500);
}
.prod-card.in-cart {
  border-color: var(--purple-600);
  box-shadow: 0 0 0 1px var(--purple-600);
}
.prod-card .img {
  aspect-ratio: 4 / 3;
  background-color: var(--cream-100);
  background-size: cover;
  background-position: center;
  position: relative;
}
.prod-card .img .stock-pill {
  position: absolute;
  top: 8px; left: 8px;
  background: rgba(255,255,255,0.94);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--green-600);
}
.prod-card .img .margin-pill {
  position: absolute;
  top: 8px; right: 8px;
}
.prod-card .body {
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}
.prod-card .name {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--gray-900);
  line-height: 1.25;
  letter-spacing: -0.1px;
}
.prod-card .meta {
  font-size: 11.5px;
  color: var(--gray-500);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.prod-card .price-row {
  margin-top: auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-top: 4px;
}
.prod-card .price-row .big {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
  font-variant-numeric: tabular-nums;
}
.prod-card .price-row .small {
  font-size: 11px;
  color: var(--gray-500);
  font-weight: 500;
}
.prod-card .cost {
  font-size: 11px;
  color: var(--gray-500);
}
.prod-card .add-row {
  border-top: 1px solid var(--gray-100);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--cream-50);
}
.qty-stepper {
  display: flex;
  align-items: center;
}
.qty-btn {
  width: 26px; height: 26px;
  border: 1px solid var(--gray-300);
  background: var(--white);
  cursor: pointer;
  font-size: 13px; line-height: 1;
  color: var(--gray-700);
  font-family: inherit;
  display: grid; place-items: center;
}
.qty-btn:first-child { border-radius: 6px 0 0 6px; }
.qty-btn:last-child  { border-radius: 0 6px 6px 0; }
.qty-input {
  width: 48px; height: 26px;
  border: 1px solid var(--gray-300);
  border-left: 0;
  border-right: 0;
  text-align: center;
  font-size: 12.5px;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
}
.qty-input:focus { outline: 0; }
.add-btn {
  background: var(--purple-600);
  color: var(--white);
  border: 0;
  border-radius: 7px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  flex: 1;
  white-space: nowrap;
}
.add-btn:hover { background: var(--purple-700); }
.add-btn.in-cart { background: var(--green-500); }
.add-btn.in-cart:hover { background: var(--green-600); }

.modal-foot {
  padding: 12px 22px;
  border-top: 1px solid var(--gray-200);
  background: var(--cream-50);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-foot .selected-summary {
  font-size: 13px;
  color: var(--gray-700);
}
.modal-foot .selected-summary strong {
  color: var(--purple-700);
  font-size: 14px;
}
.modal-foot .actions { display: flex; gap: 10px; }
.modal-foot .btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.prod-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-500);
  font-size: 13.5px;
}

/* Grid / List view toggle */
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  overflow: hidden;
  background: var(--white);
}
.view-toggle button {
  background: var(--white);
  border: 0;
  padding: 7px 9px;
  cursor: pointer;
  color: var(--gray-600);
  font-family: inherit;
  display: grid;
  place-items: center;
  transition: background 0.15s, color 0.15s;
}
.view-toggle button:hover { background: var(--cream-50); }
.view-toggle button.active {
  background: var(--purple-50);
  color: var(--purple-700);
}
.view-toggle button + button { border-left: 1px solid var(--gray-200); }
.view-toggle svg { width: 16px; height: 16px; }

/* List view rows */
.prod-list-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.prod-row {
  display: grid;
  grid-template-columns: 44px minmax(180px, 1fr) auto auto auto auto auto auto auto auto;
  gap: 14px;
  align-items: center;
  padding: 10px 14px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  transition: background 0.12s, border-color 0.12s;
}
.prod-row .row-pack {
  text-align: center;
  font-size: 11px;
  white-space: nowrap;
  line-height: 1.3;
  min-width: 86px;
}
.prod-row .row-pack .pack-total {
  font-weight: 700;
  color: var(--purple-700);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
.prod-row .row-pack .pack-config {
  font-size: 10px;
  color: var(--gray-500);
  margin-top: 1px;
}
.prod-row .row-pack .pack-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--gray-500);
  font-weight: 600;
  margin-bottom: 1px;
}
.prod-row:hover {
  background: var(--cream-50);
  border-color: var(--purple-300);
}
.prod-row.in-cart {
  border-color: var(--purple-600);
  background: var(--purple-50);
}
.prod-row .row-thumb {
  width: 44px; height: 44px;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  background-color: var(--cream-100);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}
.prod-row .row-info { min-width: 0; }
.prod-row .row-name {
  font-weight: 700;
  color: var(--gray-900);
  font-size: 13px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prod-row .row-meta {
  font-size: 11.5px;
  color: var(--gray-500);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.prod-row .row-stock {
  text-align: right;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--green-600);
  white-space: nowrap;
}
.prod-row .row-stock.low { color: var(--red-600); }
.prod-row .row-price {
  font-weight: 700;
  color: var(--gray-900);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 13px;
  min-width: 78px;
  text-align: right;
}
.prod-row .row-price .per {
  font-size: 10.5px;
  color: var(--gray-500);
  font-weight: 500;
}
.prod-row .row-total {
  font-weight: 700;
  color: var(--purple-700);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 13px;
  min-width: 70px;
  text-align: right;
}
.prod-row .row-total.zero { color: var(--gray-400); }

/* UOM inline tabs (stem / bunch / box) */
.uom-tabs {
  display: inline-flex;
  background: var(--cream-50);
  border: 1px solid var(--gray-200);
  border-radius: 7px;
  padding: 2px;
  gap: 2px;
}
.uom-tab {
  padding: 4px 9px;
  border: 0;
  background: transparent;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.3px;
}
.uom-tab:hover { color: var(--gray-900); }
.uom-tab.active {
  background: var(--white);
  color: var(--purple-700);
  box-shadow: var(--shadow-sm);
}
.uom-tab[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Responsive: stack the list row when too narrow */
@media (max-width: 1100px) {
  .prod-row {
    grid-template-columns: 44px 1fr auto;
    grid-template-rows: auto auto;
    row-gap: 8px;
  }
  .prod-row .row-stock,
  .prod-row .row-pack,
  .prod-row .row-price,
  .prod-row .row-total,
  .prod-row .uom-tabs,
  .prod-row .qty-stepper,
  .prod-row .add-btn {
    grid-column: 2 / -1;
  }
}

/* ==========================================================================
   NEW CUSTOMER MODAL — form layout
   ========================================================================== */
.nc-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 18px;
}
.nc-section {
  grid-column: 1 / -1;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gray-500);
  font-weight: 700;
  padding-top: 12px;
  padding-bottom: 2px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.nc-section:first-child { border-top: 0; padding-top: 0; }
.nc-section .hint { font-size: 11px; color: var(--gray-400); text-transform: none; letter-spacing: 0; font-weight: 500; }
.nc-span-2 { grid-column: 1 / -1; }
.nc-acct-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--purple-50);
  border: 1px solid var(--purple-100);
  border-radius: 10px;
  margin-bottom: 18px;
}
.nc-acct-banner .ico {
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--purple-600);
  color: white;
  display: grid; place-items: center;
}
.nc-acct-banner .ico svg { width: 18px; height: 18px; }
.nc-acct-banner .lbl {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--purple-700); font-weight: 700;
}
.nc-acct-banner .val {
  font-size: 17px; font-weight: 700; color: var(--gray-900);
  font-family: ui-monospace, monospace;
  letter-spacing: 0.5px;
}
.nc-acct-banner .sub {
  font-size: 11.5px; color: var(--gray-500); margin-left: auto;
}
.discount-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  background: var(--cream-50);
  border: 1px solid var(--gray-200);
  border-radius: 9px;
}
.discount-row label {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--gray-800); font-weight: 600;
  cursor: pointer;
}
.discount-row label .small {
  font-size: 11px; color: var(--gray-500); font-weight: 500;
  margin-left: 4px;
}
.discount-row input[type="radio"] { margin: 0; width: 16px; height: 16px; cursor: pointer; }
.discount-row .pct-wrap {
  display: inline-flex; align-items: center;
  border: 1px solid var(--gray-300);
  border-radius: 7px;
  background: white;
  overflow: hidden;
}
.discount-row .pct-wrap input {
  border: 0; padding: 6px 8px; width: 60px;
  text-align: right; font-size: 13px;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
}
.discount-row .pct-wrap input:focus { outline: 0; }
.discount-row .pct-wrap .sign {
  padding: 6px 10px 6px 4px;
  font-size: 13px; font-weight: 600;
  color: var(--gray-500);
  background: var(--cream-50);
}

/* ==========================================================================
   DATE RANGE FILTER — from → to inputs inside a single pill
   ========================================================================== */
.date-range-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
  height: 36px;
}
.date-range-filter .rng-lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--gray-500);
  font-weight: 600;
  padding-right: 2px;
}
.date-range-filter input[type="date"] {
  border: 0;
  padding: 0;
  font-size: 12.5px;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  color: var(--gray-900);
  background: transparent;
  width: 110px;
  cursor: pointer;
}
.date-range-filter input[type="date"]:focus { outline: 0; }
.date-range-filter .rng-sep {
  color: var(--gray-400);
  font-weight: 500;
  padding: 0 2px;
}

/* ==========================================================================
   STATUS FILTER PILLS — top-row filters above the orders table
   ========================================================================== */
.status-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.status-filter {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  font-size: 13px; font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}
.status-filter:hover { background: var(--cream-50); border-color: var(--gray-300); }
.status-filter .pip {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.status-filter .count {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--gray-100);
  color: var(--gray-600);
  margin-left: 2px;
}
.status-filter.active {
  border-color: var(--purple-600);
  background: var(--purple-50);
  color: var(--purple-700);
}
.status-filter.active .count {
  background: var(--purple-600);
  color: var(--white);
}

/* ==========================================================================
   STATUS PICKER — pill-shaped dropdown to change order status inline
   ========================================================================== */
.status-pick { position: relative; display: inline-block; z-index: 1; }
.status-pick:has(.status-pick-menu.open) { z-index: 100; }
/* Promote the row that has the open menu so the dropdown floats above siblings */
tr:has(.status-pick-menu.open) { position: relative; z-index: 100; }
tr:has(.status-pick-menu.open) td { overflow: visible !important; }
.status-pick-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px 3px 10px;
  border-radius: 999px;
  border: 0;
  font-size: 11.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.15s;
}
.status-pick-btn:hover { filter: brightness(0.96); }
.status-pick-btn .dot {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}
.status-pick-btn .caret {
  width: 11px; height: 11px; margin-left: 2px; opacity: 0.7;
}
.status-pick-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 160px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  z-index: 30;
  padding: 4px;
  display: none;
}
.status-pick-menu.open { display: block; }
.status-pick-menu .opt {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--gray-800);
}
.status-pick-menu .opt:hover { background: var(--cream-50); }
.status-pick-menu .opt.selected { background: var(--purple-50); color: var(--purple-700); font-weight: 600; }
.status-pick-menu .opt .swatch { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.status-pick-menu .opt .swatch.s-draft        { background: var(--gray-400); }
.status-pick-menu .opt .swatch.s-processing   { background: var(--orange-500); }
.status-pick-menu .opt .swatch.s-purchased    { background: var(--purple-600); }
.status-pick-menu .opt .swatch.s-partial-recv { background: #d4a83a; }
.status-pick-menu .opt .swatch.s-received     { background: #3955a8; }
.status-pick-menu .opt .swatch.s-picking      { background: #0891b2; }
.status-pick-menu .opt .swatch.s-partial-ship { background: #d4a83a; }
.status-pick-menu .opt .swatch.s-shipped      { background: var(--green-500); }
/* Daniel 2026-06-05 — s-finalized + s-packed swatches removed with workflow collapse. */
.status-pick-menu .opt .swatch.s-onhold       { background: var(--red-500); }
.status-pick-menu .opt .swatch.s-canceled     { background: var(--gray-500); }

/* New badge color variants for the FMI workflow statuses */
.badge-amber  { background: #fef3c7; color: #92400e; }
.badge-cyan   { background: #cffafe; color: #0e7490; }

/* ==========================================================================
   PURCHASING CONTROL CENTER — operational command center for buyers
   ========================================================================== */

/* Page header with title + actions cluster */
.pcc-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.pcc-header .titlebox { flex: 1; min-width: 240px; }
.pcc-header h2 { margin: 0; font-size: 19px; font-weight: 700; color: var(--gray-900); }
.pcc-header .sub { font-size: 12.5px; color: var(--gray-500); margin-top: 2px; }
.pcc-header .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Automation toggle — Manual / Auto buying mode */
.auto-toggle {
  display: inline-flex;
  align-items: center;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  padding: 3px;
  box-shadow: var(--shadow-sm);
  font-family: inherit;
}
.auto-toggle button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border: 0; background: transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.auto-toggle button .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--gray-400);
}
.auto-toggle button.active {
  background: var(--purple-600);
  color: var(--white);
}
.auto-toggle button.active .dot {
  background: var(--white);
  animation: pulse-live 2s ease-out infinite;
}
.auto-toggle button:not(.active):hover { color: var(--gray-900); }

/* Compact KPI tiles for the metrics strip (6 across) */
.pcc-metrics {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.pcc-metric {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}
.pcc-metric .lbl {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--gray-500);
  font-weight: 600;
}
.pcc-metric .val {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.1;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.pcc-metric .sub {
  font-size: 10.5px;
  color: var(--gray-500);
  margin-top: 4px;
}

/* Grouping bar */
.pcc-group-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--cream-50);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  margin-bottom: 12px;
}
.pcc-group-bar .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
  color: var(--gray-500);
  margin-right: 6px;
}
.pcc-group-chip {
  padding: 6px 12px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-700);
  cursor: pointer;
  font-family: inherit;
}
.pcc-group-chip:hover { background: var(--cream-100); }
.pcc-group-chip.active {
  background: var(--purple-600);
  color: var(--white);
  border-color: var(--purple-600);
  font-weight: 600;
}

/* Purchasing grid — compact, sticky header, status stripe per row */
.pcc-grid {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.pcc-grid .grid-toolbar {
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--cream-50);
}
.pcc-grid table { font-size: 12px; }
.pcc-grid thead th {
  position: sticky;
  top: 0;
  background: var(--cream-50);
  z-index: 2;
  font-size: 10px;
  letter-spacing: 0.6px;
  padding: 10px 10px;
}
.pcc-grid tbody td {
  padding: 10px 10px;
  vertical-align: top;
}
.pcc-grid tbody tr {
  position: relative;
  border-left: 3px solid transparent;
}
.pcc-grid tbody tr.s-green   { border-left-color: var(--green-500); }
.pcc-grid tbody tr.s-yellow  { border-left-color: var(--gold-500); }
.pcc-grid tbody tr.s-red     { border-left-color: var(--red-500); }
.pcc-grid tbody tr.s-blue    { border-left-color: var(--blue-500); }
.pcc-grid tbody tr.s-purple  { border-left-color: var(--purple-600); }
.pcc-grid tbody tr.selected  { background: var(--purple-50); }
.pcc-grid tbody tr.group-head {
  background: var(--cream-100);
  font-weight: 700;
  color: var(--gray-800);
}
.pcc-grid tbody tr.group-head td {
  padding: 8px 14px;
  font-size: 11.5px;
  border-top: 1px solid var(--gray-200);
}

/* Compact qty-trio: need / reserved / short */
.qty-trio {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.qty-trio .need     { font-weight: 700; color: var(--gray-900); }
.qty-trio .res      { color: var(--gray-500); font-size: 11px; }
.qty-trio .short    { color: var(--red-600); font-weight: 700; }
.qty-trio .ok       { color: var(--green-600); font-weight: 700; }
.qty-trio .sep      { color: var(--gray-300); font-size: 11px; }

/* Sticky bulk-action footer when items are selected */
.pcc-action-footer {
  position: sticky;
  bottom: 0;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  padding: 12px 16px;
  display: none;
  align-items: center;
  gap: 12px;
  box-shadow: 0 -4px 12px rgba(31, 29, 43, 0.05);
  z-index: 3;
}
.pcc-action-footer.active { display: flex; }
.pcc-action-footer .count {
  font-weight: 700;
  color: var(--purple-700);
}

/* Mini status pills for PO + Email cells */
.mini-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.mini-pill.gray   { background: var(--gray-100);  color: var(--gray-600); }
.mini-pill.blue   { background: var(--blue-50);   color: var(--blue-500); }
.mini-pill.purple { background: var(--purple-50); color: var(--purple-700); }
.mini-pill.green  { background: var(--green-50);  color: var(--green-600); }
.mini-pill.gold   { background: var(--gold-50);   color: var(--gold-500); }
.mini-pill.red    { background: var(--red-50);    color: var(--red-600); }

/* Responsive: collapse metrics to 3-col on narrow screens */
@media (max-width: 1200px) {
  .pcc-metrics { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
  .pcc-metrics { grid-template-columns: repeat(2, 1fr); }
}

/* ==========================================================================
   TOAST — small confirmation pill that fades in/out (bottom-right)
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--gray-900);
  color: var(--white);
  padding: 11px 16px 11px 12px;
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(31,29,43,0.28);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 200;
  transition: opacity 0.4s, transform 0.4s;
  animation: toast-in 0.3s ease;
  max-width: 360px;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.toast .tick {
  width: 22px; height: 22px;
  background: var(--green-500);
  color: var(--white);
  border-radius: 50%;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.toast .tick svg { width: 13px; height: 13px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .order-header { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  /* NOTE: was '.sidebar { display: none }' — removed because it was hiding the
     hamburger drawer entirely. The off-canvas drawer is defined in the 1024px
     mobile layer below, which transforms the sidebar off-screen and slides it
     in when `.open` is added by mobile-nav.js. */
  .content { padding: 16px; }
}

/* ---------- Inline editable cells (Purchasing Control Center) ---------- */
.edit-input,
.edit-select {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 3px 6px;
  font: inherit;
  font-size: 12px;
  color: inherit;
  width: 100%;
  box-sizing: border-box;
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.edit-input:hover,
.edit-select:hover {
  background: var(--cream-50);
  border-color: var(--gray-200);
}
.edit-input:focus,
.edit-select:focus {
  background: var(--white);
  border-color: var(--purple-300, #c5b1de);
  outline: none;
  box-shadow: 0 0 0 3px rgba(109, 74, 161, 0.10);
}
.edit-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  width: 78px;
}
.edit-input.product-name {
  font-weight: 600;
  color: var(--gray-900);
}
.edit-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 20px;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238c8997' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 4px center;
  background-size: 12px;
  font-weight: 600;
  color: var(--gray-900);
  cursor: pointer;
}
.edit-cell-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
  justify-content: flex-end;
}
.edit-cell-wrap .pre {
  color: var(--gray-500);
  font-size: 12px;
}
.cell-edit-meta {
  color: var(--gray-500);
  font-size: 10.5px;
  margin-top: 2px;
  padding-left: 6px;
}
.edited-flag {
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--purple-600);
  margin-left: 4px;
  vertical-align: middle;
  opacity: 0;
  transition: opacity 0.15s;
}
.edited-flag.show { opacity: 1; }

/* ---------- Wider Product column + autocomplete (PCC) ---------- */
.pcc-grid table th.col-product,
.pcc-grid table td.col-product { min-width: 300px; width: 300px; }
.pcc-grid table th.col-vendor,
.pcc-grid table td.col-vendor   { min-width: 140px; }
.pcc-grid table th.col-qty,
.pcc-grid table td.col-qty       { min-width: 170px; }

.prod-ac-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}
.prod-ac-wrap .edit-input.product-name {
  width: 100%;
  font-size: 12.5px;
}
.prod-ac {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 380px;
  max-width: 90vw;
  z-index: 60;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  box-shadow: 0 14px 36px rgba(31, 29, 43, 0.14);
  max-height: 300px;
  overflow-y: auto;
  display: none;
}
.prod-ac.show { display: block; }
.prod-ac-hint {
  padding: 8px 12px 6px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-100);
}
.prod-ac-item {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  cursor: pointer;
  transition: background 0.1s ease;
  border-bottom: 1px solid var(--gray-100);
}
.prod-ac-item:last-child { border-bottom: none; }
.prod-ac-item:hover,
.prod-ac-item.active {
  background: var(--cream-50);
}
.prod-ac-thumb {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  border: 1px solid var(--gray-100);
}
.prod-ac-info { min-width: 0; }
.prod-ac-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prod-ac-name mark {
  background: rgba(109, 74, 161, 0.15);
  color: var(--purple-700);
  border-radius: 3px;
  padding: 0 1px;
}
.prod-ac-sub {
  font-size: 10.5px;
  color: var(--gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.prod-ac-cost {
  font-size: 11.5px;
  color: var(--purple-700);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}
.prod-ac-empty {
  padding: 18px 14px;
  text-align: center;
  font-size: 12px;
  color: var(--gray-500);
}

/* ---------- Split Across Farms (PCC) ---------- */
.split-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  color: var(--purple-700);
  background: var(--purple-50);
  border: 1px dashed var(--purple-200, #d8c5ec);
  border-radius: 6px;
  padding: 2px 7px;
  cursor: pointer;
  margin-top: 5px;
  transition: background 0.12s, border-color 0.12s;
  font-weight: 500;
}
.split-trigger:hover {
  background: var(--purple-100);
  border-style: solid;
  border-color: var(--purple-500);
}
.split-trigger svg { width: 11px; height: 11px; flex-shrink: 0; }

.split-summary {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 8px;
  background: linear-gradient(135deg, #f3edf9 0%, #faf8f7 100%);
  border: 1px solid var(--purple-100);
  border-radius: 8px;
}
.split-summary-head {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--purple-700);
}
.split-summary-head svg { width: 12px; height: 12px; }
.split-summary-list {
  font-size: 10.5px;
  color: var(--gray-600);
  line-height: 1.45;
}
.split-summary-list .farm-chip {
  display: inline-block;
  margin-right: 4px;
  margin-top: 2px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 4px;
  padding: 1px 5px;
  font-weight: 500;
  color: var(--gray-800);
}
.split-summary-list .farm-chip .q {
  color: var(--purple-700);
  font-variant-numeric: tabular-nums;
}
.split-summary-edit {
  font-size: 10px;
  color: var(--purple-600);
  cursor: pointer;
  text-decoration: none;
  margin-top: 1px;
  align-self: flex-start;
}
.split-summary-edit:hover {
  text-decoration: underline;
}

/* Child split sub-rows inside the table */
.pcc-grid tr.split-child td { background: var(--cream-50) !important; }
.pcc-grid tr.split-child .child-indent {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-left: 20px;
  font-size: 11px;
  color: var(--gray-600);
}
.pcc-grid tr.split-child .child-indent::before {
  content: '';
  display: inline-block;
  width: 10px; height: 10px;
  border-left: 1.5px solid var(--purple-200, #d8c5ec);
  border-bottom: 1.5px solid var(--purple-200, #d8c5ec);
  border-bottom-left-radius: 4px;
  margin-left: 6px;
}

/* ===== Split modal ===== */
.split-context {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--cream-50);
  border-radius: 12px;
  margin-bottom: 18px;
  border: 1px solid var(--gray-100);
}
.split-context .ctx-thumb {
  width: 52px; height: 52px; border-radius: 10px;
  background-size: cover; background-position: center;
  flex-shrink: 0;
}
.split-context .ctx-name { font-size: 14px; font-weight: 700; color: var(--gray-900); }
.split-context .ctx-meta { font-size: 11.5px; color: var(--gray-500); margin-top: 2px; }
.split-context .ctx-need {
  margin-left: auto;
  text-align: right;
}
.split-context .ctx-need .lbl { font-size: 10.5px; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.5px; }
.split-context .ctx-need .val { font-size: 19px; font-weight: 700; color: var(--purple-700); font-variant-numeric: tabular-nums; }

.split-alloc-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}
.split-alloc-row {
  display: grid;
  grid-template-columns: 32px 1fr 110px 110px 32px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  background: var(--white);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.split-alloc-row:focus-within {
  border-color: var(--purple-500);
  box-shadow: 0 0 0 4px rgba(109, 74, 161, 0.08);
}
.split-alloc-row .num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--purple-50);
  color: var(--purple-700);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.split-alloc-row .farm-select,
.split-alloc-row .qty-input,
.split-alloc-row .cost-input {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font: inherit;
  font-size: 12.5px;
  background: var(--white);
  color: var(--gray-900);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.split-alloc-row .farm-select { font-weight: 600; }
.split-alloc-row .qty-input,
.split-alloc-row .cost-input {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.split-alloc-row .farm-select:focus,
.split-alloc-row .qty-input:focus,
.split-alloc-row .cost-input:focus {
  outline: none;
  border-color: var(--purple-500);
  box-shadow: 0 0 0 3px rgba(109, 74, 161, 0.10);
}
.split-alloc-row .farm-origin {
  font-size: 10px;
  color: var(--gray-500);
  margin-top: 3px;
  text-align: left;
  grid-column: 2;
  margin-left: 2px;
}
.split-alloc-row .remove-btn {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--gray-500);
  cursor: pointer;
  display: grid; place-items: center;
  transition: background 0.12s, color 0.12s;
}
.split-alloc-row .remove-btn:hover {
  background: #fef2f2;
  color: #b91c1c;
}
.split-alloc-row .remove-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.split-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--white);
  border: 1.5px dashed var(--purple-200, #d8c5ec);
  border-radius: 10px;
  color: var(--purple-700);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.split-add-btn:hover {
  background: var(--purple-50);
  border-style: solid;
  border-color: var(--purple-500);
}
.split-progress-wrap {
  margin: 16px 0 8px;
}
.split-progress-track {
  height: 10px;
  background: var(--gray-100);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.split-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple-500), var(--purple-700));
  border-radius: 999px;
  transition: width 0.25s ease, background 0.2s ease;
}
.split-progress-fill.over { background: linear-gradient(90deg, #dc8a3a, #b95910); }
.split-progress-fill.exact { background: linear-gradient(90deg, #10b981, #047857); }
.split-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 12px;
  color: var(--gray-600);
}
.split-progress-meta .meta-val {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--gray-900);
}
.split-progress-meta .meta-val.ok    { color: #047857; }
.split-progress-meta .meta-val.short { color: #b95910; }
.split-progress-meta .meta-val.over  { color: #b91c1c; }

.split-tip {
  background: var(--cream-50);
  border-left: 3px solid var(--purple-500);
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 11.5px;
  color: var(--gray-600);
  line-height: 1.5;
  margin-top: 6px;
}
.split-tip strong { color: var(--gray-800); }

/* ---------- PO modal vendor cards (per-vendor send) ---------- */
.po-card {
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--white);
  transition: border-color 0.15s, opacity 0.15s, background 0.15s;
}
.po-card.is-excluded {
  opacity: 0.45;
  background: var(--cream-50);
}
.po-card.is-sent {
  background: linear-gradient(135deg, #f0fbf4 0%, #faf8f7 100%);
  border-color: #c8e8d4;
}
.po-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.po-include {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.po-include input { width: 16px; height: 16px; accent-color: var(--purple-600); cursor: pointer; }
.po-card-title { flex: 1; min-width: 0; }
.po-vendor {
  font-weight: 700;
  font-size: 14px;
  color: var(--gray-900);
}
.po-vendor-meta {
  font-size: 11.5px;
  color: var(--gray-500);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.po-card-id {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  color: var(--purple-700);
  background: var(--purple-50);
  border-radius: 6px;
  padding: 3px 8px;
  font-weight: 600;
}
.po-card-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--gray-200);
}
.po-card-foot > .cell-muted { flex: 1; }
.po-card-foot .btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* ---------- Add Product form ---------- */
.product-form {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}
.product-form .field { display: flex; flex-direction: column; gap: 5px; }
.product-form .field.col-12 { grid-column: span 12; }
.product-form .field.col-8  { grid-column: span 8; }
.product-form .field.col-6  { grid-column: span 6; }
.product-form .field.col-4  { grid-column: span 4; }
.product-form .field.col-3  { grid-column: span 3; }
.product-form .field.col-2  { grid-column: span 2; }
.product-form .lbl {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--gray-600);
}
.product-form .lbl .req { color: #b91c1c; margin-left: 2px; }
.product-form input,
.product-form select,
.product-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 11px;
  border: 1px solid var(--gray-200);
  border-radius: 9px;
  font: inherit;
  font-size: 13px;
  background: var(--white);
  color: var(--gray-900);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.product-form input:focus,
.product-form select:focus,
.product-form textarea:focus {
  outline: none;
  border-color: var(--purple-500);
  box-shadow: 0 0 0 3px rgba(109, 74, 161, 0.10);
}
.product-form .hint {
  font-size: 10.5px;
  color: var(--gray-500);
}
.product-form .margin-live {
  margin-top: 6px;
  padding: 6px 10px;
  background: var(--cream-50);
  border-radius: 8px;
  font-size: 11.5px;
  color: var(--gray-700);
  border: 1px solid var(--gray-100);
}
.product-form .margin-live strong { color: var(--purple-700); }
.color-swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.color-swatch {
  width: 22px; height: 22px;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.12s, transform 0.1s;
}
.color-swatch:hover { transform: scale(1.08); }
.color-swatch.active { border-color: var(--purple-700); }
.color-swatch.white { border: 1px solid var(--gray-300); }

.image-picker {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
  flex-wrap: wrap;
}
.image-preview {
  width: 56px; height: 56px;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  border: 1px solid var(--gray-200);
  background-color: var(--cream-50);
}
.image-presets {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.image-preset {
  width: 28px; height: 28px;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.1s, border-color 0.12s;
}
.image-preset:hover { transform: scale(1.08); }
.image-preset.active { border-color: var(--purple-700); }

/* ---------- Import Center modal ---------- */
.import-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.import-card {
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  padding: 18px;
  background: var(--white);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.import-card:hover {
  border-color: var(--purple-500);
  box-shadow: 0 8px 20px rgba(109, 74, 161, 0.08);
  transform: translateY(-2px);
}
.import-card .ico-wrap {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid; place-items: center;
  margin-bottom: 4px;
}
.import-card.gsheets .ico-wrap { background: #e6f4ea; color: #0f9d58; }
.import-card.csv     .ico-wrap { background: #e6f0fe; color: #3955a8; }
.import-card.email   .ico-wrap { background: #fef3e6; color: #b87431; }
.import-card.api     .ico-wrap { background: var(--purple-50); color: var(--purple-700); }
.import-card .ico-wrap svg { width: 22px; height: 22px; }
.import-card .ttl { font-size: 14px; font-weight: 700; color: var(--gray-900); }
.import-card .desc { font-size: 11.5px; color: var(--gray-600); line-height: 1.5; }
.import-card .ftr {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  color: var(--purple-700);
  font-weight: 600;
}

/* Drop zone for CSV / XLSX */
.drop-zone {
  border: 2px dashed var(--gray-300);
  border-radius: 14px;
  padding: 38px 20px;
  text-align: center;
  background: var(--cream-50);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--purple-500);
  background: var(--purple-50);
}
.drop-zone .icon-big {
  width: 48px; height: 48px;
  margin: 0 auto 10px;
  color: var(--purple-600);
}
.drop-zone .head { font-size: 14px; font-weight: 700; color: var(--gray-900); }
.drop-zone .sub  { font-size: 12px; color: var(--gray-600); margin-top: 4px; }
.drop-zone .file-types {
  display: inline-flex; gap: 6px; margin-top: 10px;
}
.drop-zone .file-types .pill {
  font-size: 10px; padding: 3px 8px;
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: 99px; color: var(--gray-600);
}

/* Sheet preview table for mapping columns */
.sheet-preview {
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 12px;
}
.sheet-preview table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.sheet-preview th {
  background: var(--cream-50);
  padding: 8px 10px;
  text-align: left;
  font-weight: 700;
  border-bottom: 1px solid var(--gray-200);
  color: var(--gray-800);
}
.sheet-preview td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}
.sheet-preview tr:last-child td { border-bottom: none; }

.field-mapping {
  display: grid;
  grid-template-columns: 1fr 12px 1fr;
  gap: 8px 12px;
  align-items: center;
  margin-top: 14px;
}
.field-mapping .target {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-800);
}
.field-mapping .target .req { color: #b91c1c; margin-left: 2px; }
.field-mapping .arrow { color: var(--gray-400); }
.field-mapping select {
  padding: 6px 9px;
  border: 1px solid var(--gray-200);
  border-radius: 7px;
  font-size: 12px;
  background: var(--white);
}

.email-sync-box {
  background: var(--cream-50);
  border: 1px solid var(--gray-100);
  border-radius: 12px;
  padding: 18px;
  margin-top: 12px;
}
.email-sync-box .mailbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--white);
  border-radius: 10px;
  border: 1px solid var(--gray-200);
  margin: 10px 0;
}
.email-sync-box .mailbox .addr {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--purple-700);
  flex: 1;
}
.email-sync-box .copy-btn {
  font-size: 11px; padding: 5px 10px;
  background: var(--purple-50); color: var(--purple-700);
  border: none; border-radius: 6px; cursor: pointer;
  font-weight: 600;
}
.email-sync-box .copy-btn:hover { background: var(--purple-100); }

.api-codeblock {
  background: #1f1d2b;
  color: #e6e1f1;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11.5px;
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 10px;
  line-height: 1.6;
  overflow-x: auto;
}
.api-codeblock .k { color: #c5b1de; }
.api-codeblock .s { color: #a5d6a7; }
.api-codeblock .c { color: #8c8997; }

/* Header action cluster on Products page */
.products-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}
.import-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(31, 29, 43, 0.14);
  padding: 6px;
  min-width: 240px;
  z-index: 80;
  display: none;
}
.import-menu.show { display: block; }
.import-menu-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  transition: background 0.1s;
}
.import-menu-item:hover { background: var(--cream-50); }
.import-menu-item .mini-ico {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: grid; place-items: center;
}
.import-menu-item .mini-ico svg { width: 14px; height: 14px; }
.import-menu-item .mt { font-size: 12.5px; font-weight: 600; color: var(--gray-900); }
.import-menu-item .ms { font-size: 10.5px; color: var(--gray-500); margin-top: 1px; }

/* ---------- Products bulk action bar ---------- */
.products-bulk-bar {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translate(-50%, 16px);
  z-index: 70;
  background: var(--gray-900);
  color: var(--white);
  border-radius: 14px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  box-shadow: 0 18px 42px rgba(31, 29, 43, 0.28), 0 4px 12px rgba(31, 29, 43, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  max-width: calc(100vw - 40px);
}
.products-bulk-bar.active {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}
.products-bulk-bar .count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.10);
}
.products-bulk-bar .count strong { color: #c5b1de; font-size: 14px; }
.products-bulk-bar .divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 2px;
}
.products-bulk-bar .b-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--white);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.products-bulk-bar .b-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
}
.products-bulk-bar .b-btn svg { width: 12px; height: 12px; }
.products-bulk-bar .b-btn.green { color: #9be0b3; }
.products-bulk-bar .b-btn.green:hover { background: rgba(120, 220, 160, 0.10); border-color: rgba(120, 220, 160, 0.35); }
.products-bulk-bar .b-btn.amber { color: #f0c477; }
.products-bulk-bar .b-btn.amber:hover { background: rgba(240, 196, 119, 0.10); border-color: rgba(240, 196, 119, 0.35); }
.products-bulk-bar .b-btn.purple { color: #c5b1de; }
.products-bulk-bar .b-btn.purple:hover { background: rgba(197, 177, 222, 0.12); border-color: rgba(197, 177, 222, 0.35); }
.products-bulk-bar .b-btn.danger { color: #ff8a8a; }
.products-bulk-bar .b-btn.danger:hover { background: rgba(255, 120, 120, 0.12); border-color: rgba(255, 120, 120, 0.45); }
.products-bulk-bar .b-btn.deselect { background: rgba(255,255,255,0.04); margin-left: 4px; }

.products-bulk-bar .b-select {
  position: relative;
}
.products-bulk-bar .b-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  background: var(--gray-900);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 6px;
  min-width: 200px;
  display: none;
  box-shadow: 0 12px 28px rgba(31, 29, 43, 0.35);
}
.products-bulk-bar .b-select.open .b-menu { display: block; }
.products-bulk-bar .b-menu-hdr {
  padding: 6px 10px 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: rgba(255,255,255,0.5);
}
.products-bulk-bar .b-menu-item {
  padding: 7px 10px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--white);
}
.products-bulk-bar .b-menu-item:hover { background: rgba(255,255,255,0.08); }
.products-bulk-bar .b-menu-item .sw {
  width: 9px; height: 9px; border-radius: 50%;
}

/* Row selected state */
.pcc-grid tr.selected-row td,
.table-wrap tr.selected-row td {
  background: var(--purple-50) !important;
}

/* Delete confirmation modal styling */
.delete-warn {
  background: #fef2f2;
  border-left: 3px solid #b91c1c;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--gray-800);
  line-height: 1.55;
}
.delete-warn strong { color: #991b1b; }
.delete-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  margin-top: 12px;
  background: var(--cream-50);
}
.delete-list-item {
  padding: 7px 12px;
  font-size: 12px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  justify-content: space-between;
}
.delete-list-item:last-child { border-bottom: none; }
.delete-list-item .name { color: var(--gray-900); }
.delete-list-item .sku  { color: var(--gray-500); font-family: 'JetBrains Mono', monospace; font-size: 10.5px; }

/* ---------- iOS-style toggle switch (Active Sync etc.) ---------- */
.toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .track {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--gray-300);
  border-radius: 999px;
  transition: background 0.18s ease;
}
.toggle .track::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  background: white;
  border-radius: 50%;
  transition: transform 0.18s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle input:checked + .track { background: var(--purple-600); }
.toggle input:checked + .track::before { transform: translateX(16px); }
.toggle input:disabled + .track { opacity: 0.4; cursor: not-allowed; }

.toggle-with-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--gray-700);
}

/* ---------- Sheet / Tab ID styling (Google Sheets page) ---------- */
.id-mono {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px;
  color: var(--gray-500);
  background: var(--cream-50);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--gray-100);
  display: inline-block;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
.id-mono.tab { color: var(--purple-700); background: var(--purple-50); border-color: var(--purple-100); }
.id-mono.copy { cursor: pointer; transition: background 0.12s; }
.id-mono.copy:hover { background: var(--cream-100); }
.id-mono.copy.tab:hover { background: var(--purple-100); }

.cell-stack { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cell-stack .top { font-size: 12.5px; font-weight: 600; color: var(--gray-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.cell-stack .bot { display: inline-flex; gap: 5px; align-items: center; }

/* ============================================================
   STAGING — operational layer between Purchasing and Inventory
   ============================================================ */

/* Status pipeline visualization */
.staging-flow {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 14px;
  overflow-x: auto;
}
.staging-flow-step {
  flex: 1;
  min-width: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  position: relative;
  padding: 0 8px;
  cursor: pointer;
  transition: opacity 0.12s;
}
.staging-flow-step.active .dot { background: var(--purple-600); color: white; }
.staging-flow-step.active .lbl  { color: var(--purple-700); font-weight: 700; }
.staging-flow-step .dot {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--cream-50);
  border: 1.5px solid var(--gray-200);
  color: var(--gray-500);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  position: relative;
  z-index: 2;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.staging-flow-step .lbl {
  font-size: 10.5px;
  color: var(--gray-600);
  font-weight: 500;
  text-align: center;
  line-height: 1.3;
}
.staging-flow-step .ct {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-900);
  font-variant-numeric: tabular-nums;
}
.staging-flow-step.purchased .dot   { color: #8c8997; }
.staging-flow-step.in-transit .dot  { background: #e6f0fe; border-color: #b8cdf3; color: #3955a8; }
.staging-flow-step.arrived .dot     { background: #fef3e6; border-color: #f3cda3; color: #b87431; }
.staging-flow-step.staging .dot     { background: var(--cream-100); border-color: var(--gray-300); color: var(--gray-700); }
.staging-flow-step.qc .dot          { background: #fef9e6; border-color: #f0d987; color: #a17409; }
.staging-flow-step.ready .dot       { background: var(--purple-50); border-color: var(--purple-200, #d8c5ec); color: var(--purple-700); }
.staging-flow-step.transferred .dot { background: #e6f4ea; border-color: #b5e0c3; color: #047857; }
.staging-flow-step + .staging-flow-step::before {
  content: '';
  position: absolute;
  left: -50%;
  top: 14px;
  width: 100%;
  height: 2px;
  background: var(--gray-200);
  z-index: 1;
}

/* Filter pills already defined elsewhere — staging just reuses them */

/* AWB card */
.awb-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.awb-card:hover { border-color: var(--gray-300); }
.awb-card.s-in_transit       { border-left: 4px solid #3955a8; }
.awb-card.s-arrived          { border-left: 4px solid #b87431; }
.awb-card.s-staging          { border-left: 4px solid var(--gray-500); }
.awb-card.s-qc_review        { border-left: 4px solid #a17409; }
.awb-card.s-ready_for_transfer { border-left: 4px solid var(--purple-600); }
.awb-card.s-transferred      { border-left: 4px solid #047857; background: #fafefa; }

.awb-head {
  display: grid;
  /* Daniel 2026-06-03 v3 — first column is the bulk-select checkbox (or
     equal-width spacer for TRANSFERRED rows so chevron stays aligned). */
  grid-template-columns: 24px auto 1.4fr 1fr 0.9fr 0.9fr 0.9fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
}
/* Bulk-select checkbox column on AWB head */
.awb-bulk-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: 6px;
  cursor: pointer;
}
.awb-bulk-check input[type="checkbox"] {
  width: 16px; height: 16px;
  cursor: pointer;
  accent-color: var(--purple-600, #6d28d9);
  margin: 0;
}
.awb-bulk-spacer {
  display: inline-block;
  width: 24px;
  height: 24px;
}
/* Sticky bulk-actions bar above the AWB list */
.awb-bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  margin: 0 0 12px;
  background: linear-gradient(180deg, #ffffff 0%, #faf7ff 100%);
  border: 1px solid var(--purple-200, #ddd6fe);
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(109, 40, 217, 0.05);
  position: sticky;
  top: 0;
  z-index: 5;
}
.awb-bulk-bar__left,
.awb-bulk-bar__right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.awb-bulk-bar__left strong {
  font-size: 13px;
  color: var(--gray-900);
  font-weight: 700;
}
.awb-head .chev {
  width: 20px; height: 20px;
  color: var(--gray-500);
  transition: transform 0.15s ease;
}
.awb-card.expanded .awb-head .chev { transform: rotate(90deg); }
.awb-head .ident {
  display: flex; flex-direction: column; gap: 2px;
}
.awb-head .ident .num {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--gray-900);
}
/* Daniel 2026-06-03 — inline-editable staging fields (AWB#, arrival, qty).
   Visual cue: dashed underline so users see it's editable; focus state
   matches PCC's inline input styling for consistency. */
.staging-edit-awb {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--gray-900);
  border: 0;
  border-bottom: 1px dashed var(--gray-300);
  background: transparent;
  padding: 1px 2px;
  width: 100%;
  max-width: 200px;
  outline: none;
}
.staging-edit-awb:hover  { border-bottom-color: var(--purple-400, #a78bfa); }
.staging-edit-awb:focus  { border-bottom: 1.5px solid var(--purple-600, #7c3aed); background: var(--cream-50, #fdfaf6); }
.staging-edit-arrival {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gray-900);
  border: 0;
  border-bottom: 1px dashed var(--gray-300);
  background: transparent;
  padding: 1px 2px;
  font-family: inherit;
  outline: none;
}
.staging-edit-arrival:hover { border-bottom-color: var(--purple-400, #a78bfa); }
.staging-edit-arrival:focus { border-bottom: 1.5px solid var(--purple-600, #7c3aed); background: var(--cream-50, #fdfaf6); }
.staging-edit-qty {
  width: 64px;
  text-align: right;
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: white;
  padding: 4px 6px;
  color: inherit;        /* inherit the col's red/orange/green from inline style */
  outline: none;
  -moz-appearance: textfield;
}
.staging-edit-qty::-webkit-outer-spin-button,
.staging-edit-qty::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.staging-edit-qty:hover { border-color: var(--gray-300); }
.staging-edit-qty:focus { border-color: var(--purple-500, #8b5cf6); box-shadow: 0 0 0 3px rgba(139,92,246,0.15); }

/* Daniel 2026-06-03 — "+ Add Product" button on each AWB head.
   Branded purple-outline pill so it reads as "this is the action you
   want to take to grow the AWB" without competing with the primary
   Transfer CTA. */
.staging-add-line-btn {
  background: white !important;
  color: var(--purple-700, #6d28d9) !important;
  border: 1.5px solid var(--purple-300, #c4b5fd) !important;
  font-weight: 600 !important;
  padding: 6px 12px !important;
  border-radius: 8px !important;
  display: inline-flex !important;
  align-items: center;
  transition: all 0.15s ease;
}
.staging-add-line-btn:hover {
  background: var(--purple-50, #f5f3ff) !important;
  border-color: var(--purple-500, #8b5cf6) !important;
  color: var(--purple-800, #5b21b6) !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(124, 58, 237, 0.18);
}
/* Brief outline pulse when the Product Entry panel is scrolled-to from
   the "+ Add Product" button. Visual cue so the user sees their click
   was received and where the form they're now editing lives. */
.pe-flash {
  box-shadow: 0 0 0 3px var(--purple-300, #c4b5fd), 0 8px 24px rgba(124, 58, 237, 0.18) !important;
  transition: box-shadow 0.3s ease;
}

/* Daniel 2026-06-03 — keyboard-driven product autocomplete on the inline
   Product Entry form (#peProduct). Suggestions float under the input,
   highlighted item flips purple on hover or arrow-key navigation. */
.pe-prod-suggest {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  z-index: 30;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
}
.pe-prod-opt {
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
  line-height: 1.3;
}
.pe-prod-opt:hover,
.pe-prod-opt.active {
  background: var(--purple-50, #f5f3ff);
  color: var(--purple-800, #5b21b6);
}
.pe-prod-opt__name { font-weight: 600; color: var(--gray-900); }
.pe-prod-opt.active .pe-prod-opt__name { color: var(--purple-800, #5b21b6); }
.pe-prod-opt__sub  { font-size: 11px; color: var(--gray-500); margin-top: 2px; font-family: 'JetBrains Mono', ui-monospace, monospace; }
.awb-head .ident .vendor {
  font-size: 11.5px;
  color: var(--gray-600);
}
.awb-head .col-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--gray-500);
  margin-bottom: 2px;
}
.awb-head .col-val {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gray-900);
}
.awb-head .col-val.dim { color: var(--gray-600); font-weight: 500; }
.awb-head .actions {
  display: flex;
  gap: 6px;
}
.awb-head .actions .btn-sm {
  padding: 5px 10px;
  font-size: 11.5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.awb-head .actions .btn-sm svg { width: 11px; height: 11px; }

/* AWB body (expanded) */
.awb-body {
  display: none;
  padding: 0 18px 18px;
  border-top: 1px solid var(--gray-100);
  background: var(--cream-50);
}
.awb-card.expanded .awb-body { display: block; }

.awb-body .body-section { padding: 14px 0; }
.awb-body .body-section:not(:last-child) { border-bottom: 1px solid var(--gray-200); }

.awb-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px 18px;
  margin-bottom: 4px;
}
.awb-meta-grid .meta-item {
  display: flex; flex-direction: column; gap: 2px;
}
.awb-meta-grid .meta-item .ml { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--gray-500); }
.awb-meta-grid .meta-item .mv { font-size: 12.5px; font-weight: 600; color: var(--gray-900); }
.awb-meta-grid .meta-item .mv a { color: var(--purple-700); text-decoration: none; }

/* AWB lines table inside expanded body */
.awb-lines-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  background: var(--white);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--gray-200);
}
.awb-lines-table th {
  background: var(--cream-100);
  padding: 9px 10px;
  text-align: left;
  font-weight: 700;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--gray-600);
  border-bottom: 1px solid var(--gray-200);
}
.awb-lines-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-800);
  vertical-align: middle;
}
.awb-lines-table tr:last-child td { border-bottom: none; }
.awb-lines-table .qty-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.awb-lines-table .line-prod {
  display: flex; align-items: center; gap: 8px;
}
.awb-lines-table .line-prod .thumb {
  width: 32px; height: 32px; border-radius: 8px;
  background-size: cover; background-position: center;
  flex-shrink: 0;
}
.awb-lines-table .line-prod .info { min-width: 0; }
.awb-lines-table .line-prod .nm { font-weight: 600; color: var(--gray-900); font-size: 12px; }
.awb-lines-table .line-prod .sub { font-size: 10.5px; color: var(--gray-500); }
.awb-lines-table .for-orders {
  font-size: 10.5px;
  color: var(--purple-700);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.awb-lines-table .line-status-pill { white-space: nowrap; }

/* Qty breakdown bar */
.qty-breakdown {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.qty-breakdown .q-tot { font-weight: 700; color: var(--gray-900); }
.qty-breakdown .q-rec { color: #047857; }
.qty-breakdown .q-dmg { color: #b91c1c; }
.qty-breakdown .q-mis { color: #b87431; }
.qty-breakdown .q-tfr { color: var(--purple-700); font-weight: 600; }
.qty-breakdown .sep { color: var(--gray-300); }

/* Allocation preview inside Transfer modal */
.alloc-preview {
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 12px;
}
.alloc-preview-head {
  background: var(--purple-50);
  color: var(--purple-700);
  padding: 10px 14px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--purple-100);
  display: flex;
  align-items: center;
  gap: 8px;
}
.alloc-preview-head svg { width: 14px; height: 14px; }
.alloc-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto auto;
  gap: 12px;
  padding: 10px 14px;
  font-size: 12px;
  border-bottom: 1px solid var(--gray-100);
  align-items: center;
}
.alloc-row:last-child { border-bottom: none; }
.alloc-row .cust { font-weight: 600; color: var(--gray-900); }
.alloc-row .sub { font-size: 10.5px; color: var(--gray-500); }
.alloc-row .ship-pill {
  font-size: 10.5px;
  background: var(--cream-50);
  border: 1px solid var(--gray-200);
  border-radius: 99px;
  padding: 2px 8px;
  color: var(--gray-700);
}
.alloc-row .qty-fulfill {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  color: #047857;
  font-weight: 700;
}
.alloc-row .qty-still-short {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  color: #b87431;
}
.alloc-summary {
  background: var(--cream-50);
  padding: 10px 14px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.alloc-summary .left { color: var(--gray-700); }
.alloc-summary .left strong { color: var(--gray-900); }
.alloc-summary .right { font-family: 'JetBrains Mono', monospace; color: var(--purple-700); font-weight: 700; }

/* QC modal qty grid */
.qc-grid {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px 14px;
  align-items: center;
}
.qc-grid label { font-size: 12px; color: var(--gray-700); font-weight: 600; }
.qc-grid input {
  padding: 8px 11px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: 'JetBrains Mono', monospace;
}
.qc-grid input:focus { outline: none; border-color: var(--purple-500); box-shadow: 0 0 0 3px rgba(109, 74, 161, 0.10); }
.qc-summary-bar {
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--cream-50);
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}
.qc-summary-bar .ok { color: #047857; font-weight: 700; }
.qc-summary-bar .bad { color: #b91c1c; font-weight: 700; }

/* Tracking sub-card */
.tracking-step {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 12px;
}
.tracking-step:last-child { border-bottom: none; }
.tracking-step .dot {
  width: 10px; height: 10px; border-radius: 50%;
  margin-top: 4px;
  background: var(--gray-300);
}
.tracking-step.done .dot { background: #10b981; }
.tracking-step.current .dot { background: var(--purple-600); box-shadow: 0 0 0 4px rgba(109, 74, 161, 0.20); }
.tracking-step .head { font-weight: 600; color: var(--gray-900); }
.tracking-step .sub  { font-size: 11px; color: var(--gray-600); margin-top: 1px; }

/* =============================================================
   MOBILE LAYER (added 2026-05-24 — see CHANGELOG)
   Scope per Daniel: Farm Portal (all), Customer Portal (all),
   Admin: dashboard / order-entry / order-view. Other admin pages
   remain desktop-prioritized. The hamburger trigger + off-canvas
   sidebar drawer is universal because the markup is shared across
   every page.
   ============================================================= */

/* ----- Hamburger button (visible only on mobile) ----- */
.mobile-menu-trigger {
  display: none;
  background: transparent; border: 0;
  color: var(--white);
  width: 38px; height: 38px;
  padding: 0; border-radius: 8px;
  align-items: center; justify-content: center;
  cursor: pointer;
}
.mobile-menu-trigger:hover { background: rgba(255,255,255,0.1); }
.mobile-menu-trigger svg { width: 22px; height: 22px; }

/* ----- Backdrop when drawer is open ----- */
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 99;
  backdrop-filter: blur(2px);
}
.sidebar-backdrop.open { display: block; }

/* =============================================================
   MODERN SaaS SIDEBAR — desktop permanent + collapse/expand
   ============================================================= */
:root {
  --sidebar-w: 240px;
  --sidebar-w-collapsed: 64px;
}

/* Desktop layout — permanent sidebar with smooth width transition */
@media (min-width: 1025px) {
  /* Hide hamburger on desktop completely */
  .menu-btn { display: none !important; }

  .app {
    grid-template-columns: var(--sidebar-w) 1fr !important;
    transition: grid-template-columns 0.22s ease;
  }
  .app.sidebar-collapsed {
    grid-template-columns: var(--sidebar-w-collapsed) 1fr !important;
  }
  .sidebar {
    transition: width 0.22s ease;
    box-shadow: 1px 0 2px rgba(15,23,42,0.04), 0 0 0 1px var(--gray-100);
    overflow-x: hidden;
    /* Sit above the green topbar (z-index: 10) so the collapse-toggle
       chevron — which sticks out past the sidebar's right edge — is never
       clipped or covered by the topbar. */
    z-index: 50;
  }
  .app.sidebar-collapsed .sidebar {
    width: var(--sidebar-w-collapsed) !important;
  }

  /* When collapsed — icons only, labels hidden. Customer/farm portals
     write link text as direct text nodes (no <span> wrapper), so
     `display: none` on <span> alone isn't enough — we ALSO zero out
     font-size on every nav-link container, then restore size on the SVG
     icon underneath. The text collapses to width:0 while the icon stays. */
  .app.sidebar-collapsed .sidebar .nav a,
  .app.sidebar-collapsed .sidebar .group-toggle {
    font-size: 0 !important;
    color: transparent !important;
    text-indent: -9999px !important;
    overflow: hidden !important;
    white-space: nowrap !important;
  }
  .app.sidebar-collapsed .sidebar .nav a svg,
  .app.sidebar-collapsed .sidebar .group-toggle svg {
    font-size: 0 !important;
    text-indent: 0 !important;
    flex-shrink: 0 !important;
    width: 18px !important; height: 18px !important;
    color: var(--gray-700) !important;
  }
  .app.sidebar-collapsed .sidebar .nav a.active svg,
  .app.sidebar-collapsed .sidebar .nav a:hover svg {
    color: var(--purple-700) !important;
  }
  .app.sidebar-collapsed .sidebar .nav a span,
  .app.sidebar-collapsed .sidebar .group-toggle span,
  .app.sidebar-collapsed .sidebar .group-toggle .chev,
  .app.sidebar-collapsed .sidebar .group-children,
  .app.sidebar-collapsed .sidebar .group-label,
  .app.sidebar-collapsed .sidebar .farm-banner .lbl,
  .app.sidebar-collapsed .sidebar .farm-banner .sub,
  .app.sidebar-collapsed .sidebar .farm-banner .nm,
  .app.sidebar-collapsed .sidebar .customer-banner .lbl,
  .app.sidebar-collapsed .sidebar .customer-banner .sub,
  .app.sidebar-collapsed .sidebar .customer-banner .nm,
  .app.sidebar-collapsed .sidebar .sidebar-brand .brand-name,
  .app.sidebar-collapsed .sidebar .sidebar-brand .brand-sub,
  .app.sidebar-collapsed .sidebar .nav a .nav-count {
    display: none !important;
  }
  .app.sidebar-collapsed .sidebar .nav a {
    justify-content: center !important;
    padding: 10px !important;
    gap: 0 !important;
  }
  .app.sidebar-collapsed .sidebar .group-toggle {
    justify-content: center !important;
    padding: 10px !important;
  }
  .app.sidebar-collapsed .sidebar .farm-banner,
  .app.sidebar-collapsed .sidebar .customer-banner {
    padding: 8px 6px;
    text-align: center;
  }

  /* Collapse toggle button — child of .sidebar, pinned to its right edge
     so it follows the sidebar's actual rendered width regardless of which
     portal we're in (admin 240px, customer/farm portal can differ).
     Rotates 180° in the collapsed state so the chevron points outward
     (an "expand" arrow). */
  .sidebar { overflow: visible !important; }
  .sidebar-collapse-toggle {
    position: absolute;
    top: 14px;
    right: -12px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--white);
    border: 1px solid var(--gray-200);
    box-shadow: 0 2px 6px rgba(15,23,42,0.08);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    /* Sit ABOVE every sidebar element (brand banner, nav items, account
       block, etc.) so the chevron is never clipped or hidden by them.
       The customer / farm portal banners use z-index ranges around 1–10,
       so 9999 gives us a clear top layer with headroom for future chrome. */
    z-index: 9999;
    transition: transform 0.22s ease, background 0.15s;
    color: var(--gray-700);
    padding: 0;
  }
  .sidebar-collapse-toggle:hover {
    background: var(--purple-50);
    border-color: var(--purple-300, #c9b4e3);
    color: var(--purple-700);
  }
  .app.sidebar-collapsed .sidebar-collapse-toggle {
    transform: rotate(180deg);
  }
  .sidebar-collapse-toggle svg { width: 12px; height: 12px; }
}

/* Hide collapse toggle on mobile — drawer doesn't need it */
@media (max-width: 1024px) {
  .sidebar-collapse-toggle { display: none !important; }
}

/* ===== Tablet breakpoint — collapse sidebar to drawer ===== */
@media (max-width: 1024px) {
  .mobile-menu-trigger { display: inline-flex; }
  .app { grid-template-columns: 1fr; }
  .sidebar {
    display: block !important;
    position: fixed !important; inset: 0 auto 0 0 !important;
    width: 280px !important;
    max-width: 85vw !important;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 100 !important;
    box-shadow: 4px 0 20px rgba(15,23,42,0.12);
    visibility: visible !important;
    opacity: 1 !important;
  }
  .sidebar.open { transform: translateX(0) !important; }
  .topbar { padding: 0 16px; gap: 10px; }
  .topbar .page-title { font-size: 15px; margin: 0; }
  .main { padding: 16px; }
}

/* ===== Phone breakpoint — stack everything ===== */
@media (max-width: 720px) {
  /* Topbar gets dense */
  .topbar { padding: 0 12px; gap: 8px; height: 52px; }
  .topbar .page-title { font-size: 14px; }
  .topbar .user-name { display: none; }
  .topbar .actions-cluster { gap: 4px; }
  .main { padding: 12px; }

  /* KPI strips — single column on phone, 2-col on small tablet.
     Use !important + attribute selectors to beat the inline
     style="grid-template-columns: ..." many pages use. */
  .pcc-metrics,
  .dash-metrics,
  .metrics-row,
  .farm-metrics,
  .kpi-strip,
  .grid-2,
  .grid-3,
  [style*="grid-template-columns: 2fr 1fr"],
  [style*="grid-template-columns:2fr 1fr"],
  [style*="grid-template-columns: repeat(2"],
  [style*="grid-template-columns:repeat(2"],
  [style*="grid-template-columns: repeat(3"],
  [style*="grid-template-columns:repeat(3"],
  [style*="grid-template-columns: repeat(4"],
  [style*="grid-template-columns:repeat(4"],
  [style*="grid-template-columns: repeat(5"],
  [style*="grid-template-columns:repeat(5"],
  [style*="grid-template-columns: repeat(6"],
  [style*="grid-template-columns:repeat(6"],
  [style*="grid-template-columns: repeat(12"],
  [style*="grid-template-columns:repeat(12"] {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }
  .pcc-metric, .dash-metric, .farm-metric, .kpi-cell {
    padding: 10px 12px !important;
  }
  .pcc-metric .val, .dash-metric .val, .farm-metric .val, .kpi-cell .val {
    font-size: 20px !important;
  }
  /* Hero KPI cards (big primary metric) take full width */
  .kpi-cell.hero { grid-column: 1 / -1 !important; }

  /* Card padding shrinks */
  .card { padding: 14px; border-radius: 10px; }
  .card-head { padding-bottom: 10px; }
  .card-head h3, .card-head h2 { font-size: 15px; }

  /* Tables → horizontal scroll with visual hint */
  .table-wrap, .pcc-grid {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    background: linear-gradient(to right, transparent 30%, rgba(0,0,0,0.04)),
                linear-gradient(to right, rgba(0,0,0,0.04), transparent 70%) 100% 0;
    background-size: 24px 100%, 24px 100%;
    background-repeat: no-repeat;
    background-attachment: local, local;
  }
  .data { min-width: 540px; font-size: 12px; }
  .data th, .data td { padding: 8px 10px; }

  /* Modals fill the screen */
  .modal-backdrop.open .modal,
  .modal-backdrop .modal {
    max-width: 100vw !important;
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
  }
  .modal-head { padding: 14px 16px; }
  .modal-foot { padding: 12px 16px; flex-direction: column-reverse; gap: 8px; }
  .modal-foot .btn { width: 100%; }

  /* Touch-friendly tap targets */
  .btn, .btn-sm, .btn-ghost, .btn-pill {
    min-height: 40px;
    padding: 8px 14px;
  }
  .btn-sm, .btn-ghost.btn-sm { min-height: 36px; }
  .fpo-chip { min-height: 36px; padding: 8px 14px; }

  /* Inputs taller for tap */
  .input, .select, textarea { padding: 11px 12px; font-size: 14px; }
  .field-label { font-size: 11.5px; }

  /* Form grids → stack */
  .field-grid,
  .farm-field-grid,
  .blanket-modal .field-grid {
    grid-template-columns: 1fr !important;
  }

  /* Filter toolbars stack */
  .grid-toolbar, .filter-bar {
    flex-direction: column;
    align-items: stretch !important;
    gap: 8px;
  }
  .grid-toolbar > *, .filter-bar > * { width: 100% !important; }

  /* Dashboard grid → single column */
  .dash-grid, .grid-2col, .grid-3col {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Footer / bulk bars stack */
  .bulk-bar { flex-direction: column; align-items: stretch; }
  .bulk-bar .field { width: 100%; }
  .bulk-bar .spacer { display: none; }

  /* Customer portal shop grid → 2 columns */
  .shop-grid { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }
  .product-card { padding: 8px !important; }
  .product-card .title { font-size: 12px; }

  /* Cart drawer / sticky bottom */
  .cart-drawer, .order-summary-sticky {
    position: fixed; inset: auto 0 0 0;
    width: 100%; max-width: 100%;
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -4px 20px rgba(15,23,42,0.15);
  }

  /* Farm banner shrinks */
  .farm-banner { margin: 0 8px 8px; padding: 8px 10px; font-size: 10.5px; }

  /* ===== Farm Portal — mobile-specific polish =====
     The farm portal is the page operators use from the field on phones.
     These rules tighten layout, keep the dropdown tap-friendly, and hide
     decorative elements that don't fit on small screens. NO LOGIC CHANGED. */

  /* Compact topbar — keep avatar + dropdown caret accessible */
  .topbar-actions { gap: 4px !important; }
  .topbar-icon {
    width: 36px !important; height: 36px !important;
    padding: 0 !important;
    display: inline-flex !important; align-items: center; justify-content: center;
  }
  .topbar-icon svg { width: 18px !important; height: 18px !important; }
  .topbar-divider { display: none !important; }

  /* Avatar dropdown — always accessible on mobile, tap-friendly items */
  .user, #topUserMenu { padding: 4px 6px !important; }
  .user .avatar, #tbAvatar {
    width: 34px !important; height: 34px !important;
    font-size: 12px !important;
  }
  .user .caret { width: 18px !important; height: 18px !important; opacity: 0.85; }
  /* The dropdown panel itself — center it on mobile so it visually
     anchors to the screen instead of squeezing against the right edge.
     position:fixed + left:50% + translateX(-50%) is the universal center-
     in-viewport pattern. Width clamped so it always fits with 16px gutter. */
  #topUserDropdown {
    position: fixed !important;
    top: 60px !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    width: calc(100vw - 32px) !important;
    max-width: 340px !important;
    min-width: 0 !important;
    box-sizing: border-box;
  }
  #topUserDropdown a {
    padding: 14px 16px !important;
    font-size: 14px !important;
    min-height: 48px !important;
    box-sizing: border-box;
  }

  /* Farm dashboard — tighter card padding so phone screens aren't wasted */
  .stat-tile {
    padding: 10px !important;
    gap: 8px !important;
  }
  .stat-tile .label { font-size: 10.5px !important; }
  .stat-tile .value { font-size: 18px !important; }
  .stat-tile .icon { width: 32px !important; height: 32px !important; }

  /* "My Shipments Trend" line chart — ensure it never overflows the card */
  .card svg { max-width: 100% !important; height: auto !important; }
  .card-head { flex-wrap: wrap; gap: 6px; }
  .card-head h3, .card-head .card-title { font-size: 14px !important; }

  /* Quick Actions buttons — full width on phone, comfortable tap target */
  .quick-actions, .quick-actions-grid {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }
  .quick-actions a, .quick-actions button { min-height: 44px; font-size: 13px; }

  /* Sidebar drawer — wider tap-friendly nav links */
  .sidebar.farm-portal .nav-link, .sidebar .nav-link {
    padding: 12px 14px !important;
    font-size: 14px !important;
    min-height: 44px;
  }

  /* Hide the live-dot pulse animation on phones (decorative, saves CPU) */
  .live-dot::after { animation: none !important; opacity: 0 !important; }

  /* Farm Purchase Orders table — turn each row into a card-style block via
     scoped padding adjustments. The table still scrolls horizontally on
     extreme widths, but row cells get more breathing room. */
  .data thead th { font-size: 10.5px !important; padding: 8px 6px !important; }
  .data td { padding: 8px 6px !important; vertical-align: top; }

  /* Per-line expand rows on the farm PO table — keep the indent visible */
  .po-line-row td:first-child { padding-left: 12px !important; }

  /* RFQ / Profile / Products page wide-grid containers */
  .form-grid, .grid, .opt-grid { grid-template-columns: 1fr !important; }

  /* Farm profile header (avatar + meta + actions) stacks */
  .profile-head {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    text-align: left;
  }

  /* RFQ cards — buttons stack inside their row */
  .rfq-card-row { flex-wrap: wrap; gap: 6px; }

  /* ===== Round-2 mobile fixes — patterns the audit caught =====
     Each rule here addresses a specific issue found in the in-scope pages
     that wasn't covered by the generic attribute selectors above. Class-
     based targeting is more reliable than [style*="..."] for custom multi-
     column grids that don't use repeat() or 2fr 1fr. */

  /* Page-specific 2-column / multi-column layouts that need to stack */
  .ck-layout,             /* portal/checkout.html — order + summary */
  .grid-detail,           /* portal/order-detail.html — info + sidebar */
  .acct-layout,           /* portal/account.html — nav + body */
  .integrations,          /* farm-products.html — integration cards */
  .perf-strip,            /* farm-profile.html — 5-col perf grid */
  .cart-row,              /* portal/cart.html — 8-col line row */
  .portal-row,            /* portal/shop.html — 7-col list row */
  .stat-tile-grid,        /* admin dashboard 5-col stat tiles */
  .quick-actions-grid,
  .opt-grid,
  .doc-grid,
  .awb-form,
  .line-items-table {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  /* Customer portal account sidebar — collapses into a horizontal tab strip
     instead of a 220px-wide left column eating the whole viewport. */
  .acct-nav {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 4px !important;
    padding: 6px !important;
    margin-bottom: 12px !important;
  }
  .acct-nav .nav-link, .acct-nav a {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    padding: 10px 12px !important;
    font-size: 12.5px !important;
    text-align: center;
  }

  /* Universal modal override — beat any page-scoped max-width. Already
     covered for .modal-backdrop, but several pages use bare .modal too. */
  .modal,
  .modal-backdrop .modal,
  div[class*="modal"][style*="max-width"] {
    max-width: 100vw !important;
    width: 100vw !important;
    max-height: 100vh !important;
    height: 100vh !important;
    border-radius: 0 !important;
    margin: 0 !important;
  }

  /* Any bare <table> without a .table-wrap parent gets horizontal scroll.
     Block display lets overflow-x work on the table element itself. */
  .content > table,
  .main > table,
  .card > table {
    display: block !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  /* Tables inside dashboard cards (admin + customer dashboards) overflow on
     mobile because their cells contain wide composites (icon + name + sub).
     Convert to stacked-card list pattern: hide thead, every <tr> becomes a
     vertical block. Cards stay edge-to-edge with no horizontal scroll. */
  .card { overflow: hidden !important; }
  .card .data { min-width: 0 !important; width: 100% !important; }
  .card .data thead { display: none !important; }
  .card .data, .card .data tbody, .card .data tr, .card .data td {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box;
  }
  .card .data tr {
    border-top: 1px solid var(--gray-200);
    padding: 12px 16px !important;
    position: relative;
  }
  .card .data tr td {
    padding: 3px 0 !important;
    border: 0 !important;
    text-align: left !important;
    white-space: normal !important;
  }
  /* First cell of each row = primary identifier — make it stand out */
  .card .data tr td:first-child {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--gray-900);
  }
  .card .data tr td.text-right { text-align: left !important; }
  /* Action buttons inside table rows stack right-aligned at the bottom */
  .card .data tr td button.btn-sm {
    margin-top: 6px;
    width: auto !important;
    align-self: flex-start;
  }
  /* The "PO" / action button column — small visual chip */
  .card .data tr td:last-child:not(:only-child) { margin-top: 4px; }

  /* Order entry line-items table stays as a scrollable matrix though — the
     buyer needs every column. Override the stacked-card rule for that page. */
  body.page-order-entry .card .data,
  table.line-items {
    display: table !important;
    min-width: 640px !important;
  }
  body.page-order-entry .card .data thead { display: table-header-group !important; }
  body.page-order-entry .card .data tr { display: table-row !important; padding: 0 !important; }
  body.page-order-entry .card .data td { display: table-cell !important; }

  /* "You might also like" grids (cart suggestions) collapse to 2-up */
  .suggest-grid,
  .recommend-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  /* RFQ response modal — 5-col layout collapses */
  .qr-response-grid,
  .rfq-response-row {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  /* Customer search / vendor search inputs that have hardcoded width */
  .cust-search input,
  .vendor-search input,
  .search-cell input {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* Cart subtotal / order summary stacks at the bottom on mobile so the
     line items above can be scrolled freely without a sticky sidebar
     eating screen. */
  .order-summary,
  .ck-summary,
  .cart-summary {
    position: static !important;
    width: 100% !important;
    margin-top: 16px !important;
  }

  /* ===== Login pages — collapse the 2-col hero/form layout =====
     login.html (admin) and farm-login.html use the shared .login-page grid.
     portal/login.html has its own scoped media query at 880px and is
     unaffected. On phones we stack: hero on top (compact), form below.    */
  .login-page {
    grid-template-columns: 1fr !important;
  }
  .login-hero {
    padding: 24px 20px !important;
    min-height: auto !important;
  }
  .login-hero h1 { font-size: 22px !important; margin: 8px 0 6px !important; }
  .login-hero p  { font-size: 13px !important; }
  .login-hero .brand-mark {
    width: 44px !important; height: 44px !important;
    border-radius: 12px !important;
  }
  .login-form-wrap { padding: 20px !important; }
  .login-form { max-width: 100% !important; }
  .login-form h2 { font-size: 20px !important; }
  /* Farm-login extras: chips wrap nicely + demo-creds card is full width */
  .farm-list { flex-wrap: wrap !important; gap: 6px !important; }
  .farm-list .chip { font-size: 11px !important; padding: 4px 8px !important; }
  .demo-creds { padding: 10px 12px !important; font-size: 11.5px !important; }
}

/* Tablet — keep two columns but ease the hero padding */
@media (min-width: 721px) and (max-width: 1024px) {
  .login-hero { padding: 32px 32px !important; }
  .login-form-wrap { padding: 28px !important; }
}

/* =============================================================
   NUCLEAR MOBILE FIX — added 2026-05-24 (Daniel: "make it work")
   Hard ceiling at ≤720px: nothing leaves the viewport, every grid
   stacks. This runs AFTER all other rules so it always wins.
   Logic untouched — pure CSS.
   ============================================================= */
@media (max-width: 720px) {
  /* IMPORTANT: overflow-x: hidden ONLY on <html>, NOT on <body>.
     iOS Safari has a known bug where `body { overflow-x: hidden }` causes
     `position: fixed` elements (like our sidebar drawer) to behave like
     position:absolute and become invisible. */
  html {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }
  body {
    max-width: 100vw !important;
  }
  /* Universal width clamp — nothing escapes */
  body * {
    max-width: 100% !important;
  }
  /* Every multi-column grid → vertical stack */
  body .content [style*="display:grid"],
  body .content [style*="display: grid"],
  body .content .grid,
  body .content .grid-2,
  body .content .grid-3,
  body .content .grid-4,
  body .content .kpi-strip,
  body .content .perf-strip,
  body .content .stat-tile-grid,
  body .main [style*="display:grid"],
  body .main [style*="display: grid"],
  body .main .grid,
  body .main .grid-2,
  body .main .grid-3,
  body .main .grid-4,
  body .main .kpi-strip,
  body .main .perf-strip,
  body .main .stat-tile-grid,
  body .pcc-metrics,
  body .dash-metrics {
    display: block !important;
    grid-template-columns: none !important;
  }
  /* Stacked grid children get vertical spacing */
  body .content [style*="grid"] > *,
  body .main [style*="grid"] > *,
  body .grid > *, body .grid-2 > *, body .grid-3 > *, body .grid-4 > *,
  body .kpi-strip > *, body .perf-strip > * {
    margin-bottom: 10px !important;
    width: 100% !important;
  }
  /* Tables stay scrollable but never push the page wider */
  body .content table, body .main table {
    display: block !important;
    overflow-x: auto !important;
    width: 100% !important;
    -webkit-overflow-scrolling: touch;
  }
  /* Cards expand naturally */
  body .card {
    width: auto !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  /* Images, charts, SVGs */
  body img, body svg, body canvas {
    max-width: 100% !important;
    height: auto !important;
  }
  /* Make the hamburger trigger visually prominent so farm operators
     immediately see it's tappable */
  .menu-btn.mobile-menu-trigger,
  .mobile-menu-trigger {
    background: rgba(255,255,255,0.14) !important;
    border-radius: 10px !important;
    width: 42px !important;
    height: 42px !important;
  }
  .mobile-menu-trigger:hover,
  .mobile-menu-trigger:active {
    background: rgba(255,255,255,0.26) !important;
  }

  /* ===== Catch-all wrappers — covers the remaining admin pages =====
     Any flex container must wrap on mobile (prevents toolbar overflow).
     Any hardcoded pixel width on an input/select/button collapses to
     a fluid full-width. Page-title rows stack their actions below.
     These rules apply to every page that uses .styles.css. */
  body .toolbar,
  body .filter-bar,
  body .row,
  body .row-between,
  body .header-row,
  body .page-head,
  body .grid-toolbar,
  body .actions,
  body .actions-cluster,
  body .btn-group,
  body .card-head,
  body .card-foot,
  body .modal-head,
  body .modal-foot {
    flex-wrap: wrap !important;
  }
  body .toolbar > *,
  body .filter-bar > *,
  body .grid-toolbar > *,
  body .actions > *,
  body .actions-cluster > * {
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }
  /* Inputs / selects / buttons / dropdowns with hardcoded widths */
  body input,
  body select,
  body textarea,
  body .input,
  body .select,
  body .btn,
  body .btn-sm,
  body .btn-pill,
  body .pill,
  body .chip {
    max-width: 100% !important;
  }
  /* Specifically the inputs / selects that use inline style="width:NNNpx" */
  body input[style*="width"],
  body select[style*="width"],
  body textarea[style*="width"] {
    width: 100% !important;
    min-width: 0 !important;
  }
  /* Page title + action button rows stack title on top, actions below */
  body .topbar h1.page-title,
  body .page-title-row {
    width: 100%;
  }
  /* SVG icons inside topbars / cards never exceed their container */
  body .topbar svg,
  body .card svg,
  body .modal svg {
    max-width: 100% !important;
    flex-shrink: 0;
  }
  /* Sticky footers (action bars) become bottom-fixed full-width strips */
  body .pcc-footer,
  body .bulk-bar,
  body .sticky-bar {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 0 !important;
    z-index: 40;
  }
}

/* Extra-small phones */
@media (max-width: 420px) {
  .pcc-metrics,
  .dash-metrics,
  .metrics-row,
  .farm-metrics,
  .kpi-strip,
  .grid-2,
  .grid-3,
  [style*="grid-template-columns: 2fr 1fr"],
  [style*="grid-template-columns:2fr 1fr"],
  [style*="grid-template-columns: repeat(2"],
  [style*="grid-template-columns:repeat(2"],
  [style*="grid-template-columns: repeat(3"],
  [style*="grid-template-columns:repeat(3"],
  [style*="grid-template-columns: repeat(4"],
  [style*="grid-template-columns:repeat(4"],
  [style*="grid-template-columns: repeat(5"],
  [style*="grid-template-columns:repeat(5"],
  [style*="grid-template-columns: repeat(6"],
  [style*="grid-template-columns:repeat(6"],
  [style*="grid-template-columns: repeat(12"],
  [style*="grid-template-columns:repeat(12"] {
    grid-template-columns: 1fr !important;
  }
  .shop-grid { grid-template-columns: 1fr !important; }
  .topbar .page-title { display: none; }

  /* Extra-small phones — hide ONLY the notification bell icon to make
     room for the avatar + dropdown. The cart icon, search button, and
     filter button inside .topbar-actions MUST stay visible (they're the
     primary mobile controls on the shop page). Notifications are still
     reachable via the sidebar drawer. The bell is the .topbar-icon that
     does NOT carry one of our action-specific classes (search/filter/cart). */
  .topbar-actions .topbar-icon:not(.topbar-search-btn):not(.topbar-filter-btn):not([href]) {
    display: none !important;
  }

  /* Farm chip list (login) — even tighter */
  .farm-list .chip { font-size: 10px !important; padding: 3px 6px !important; }

  /* Stat tile icon hides — value is what matters at this size */
  .stat-tile .icon { display: none !important; }
}
.tracking-step .when { font-size: 11px; color: var(--gray-500); }
