/* ==========================================================================
   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 {
  background: var(--white) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238c8997' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>") no-repeat 12px center;
  padding-left: 36px;
}
.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 {
  position: absolute; right: 0; top: calc(100% + 6px);
  width: 360px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 25;
  display: none;
  overflow: hidden;
}
.cart-panel.open { display: block; }
.cart-panel header {
  padding: 12px 16px;
  background: var(--cream-50);
  border-bottom: 1px solid var(--gray-200);
  display: flex; justify-content: space-between; align-items: center;
}
.cart-panel header strong { font-size: 13px; color: var(--gray-900); }
.cart-panel .items {
  max-height: 260px; overflow-y: auto;
  padding: 6px 0;
}
.cart-panel .items .row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  padding: 8px 16px;
  align-items: center;
  font-size: 12.5px;
}
.cart-panel .items .row .nm { font-weight: 600; color: var(--gray-900); line-height: 1.2; }
.cart-panel .items .row .qt { color: var(--gray-500); font-size: 11px; }
.cart-panel .items .row .pr { font-weight: 700; color: var(--gray-900); font-variant-numeric: tabular-nums; }
.cart-panel footer {
  padding: 12px 16px;
  border-top: 1px solid var(--gray-100);
  background: var(--cream-50);
}
.cart-panel footer .totals {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 12.5px; margin-bottom: 10px;
}
.cart-panel footer .totals .r { display:flex; justify-content:space-between; }
.cart-panel footer .totals .grand { font-weight: 700; color: var(--purple-700); font-size: 14px; padding-top:6px; border-top: 1px dashed var(--gray-300); }

/* ==========================================================================
   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); }
.status-pick-menu .opt .swatch.s-finalized    { background: #047857; }
.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; }
  .sidebar { display: none; }
  .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;
  grid-template-columns: auto 1.4fr 1fr 0.9fr 0.9fr 0.9fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
}
.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);
}
.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; }
.tracking-step .when { font-size: 11px; color: var(--gray-500); }
