/* ── BRAND TOKENS ── */
:root {
  --brand-primary: #258acb;
  --brand-primary-rgb: 37, 138, 203;
  --brand-secondary: #395ba9;
  --brand-secondary-rgb: 57, 91, 169;
  --brand-accent: #f7966c;
  --brand-accent-rgb: 247, 150, 108;

  --bg-base: #eef2f7;
  --bg-surface: #ffffff;
  --bg-elevated: #f8fafc;

  --header-bg: #0d1421;
  --header-surface: rgba(255,255,255,0.06);

  --text-primary: #0f172a;
  --text-secondary: rgba(15,23,42,0.65);
  --text-tertiary: rgba(15,23,42,0.40);
  --text-disabled: rgba(15,23,42,0.25);
  --text-on-dark: rgba(255,255,255,0.92);
  --text-on-dark-muted: rgba(255,255,255,0.55);

  --status-danger: #ef4444;
  --status-warning: #f59e0b;
  --status-info: #3b82f6;

  --font-display: 'Outfit', 'Segoe UI', system-ui, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;

  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;
  --space-12: 48px;

  /* Spring physics */
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 110ms;
  --dur-base: 220ms;
  --dur-slow: 380ms;

  --radius-sm: 5px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Z-index scale */
  --z-sidebar:       50;
  --z-table-head:   150;
  --z-toolbar:      200;
  --z-header:       300;
  --z-overlay:      400;
  --z-modal:        500;
  --z-delete:       600;
  --z-toast:        700;
  --z-loading:     9999;

  /* Tinted shadows */
  --shadow-sm:  0 1px 3px rgba(var(--brand-primary-rgb),0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:  0 4px 12px rgba(var(--brand-primary-rgb),0.12), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg:  0 8px 28px rgba(var(--brand-primary-rgb),0.16), 0 4px 8px rgba(0,0,0,0.08);
  --shadow-accent: 0 4px 16px rgba(var(--brand-accent-rgb),0.30);
}

/* ── RESET ── */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-body); background: var(--bg-base); color: var(--text-primary); min-height: 100vh; }

/* ── REDUCED MOTION ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── FOCUS VISIBLE ── */
:focus:not(:focus-visible) { outline: none; }
:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ────────────── HEADER ────────────── */
.header {
  background: var(--header-bg);
  position: relative;
  z-index: var(--z-header);
  overflow: visible;
  padding: var(--space-5) var(--space-8) var(--space-6);
}
/* Ambient glow — intentional grid break element */
.header::before {
  content: '';
  position: absolute;
  top: -60px; left: -40px;
  width: 420px; height: 280px;
  background: radial-gradient(ellipse, rgba(37,138,203,0.18) 0%, transparent 70%);
  pointer-events: none;
}
.header::after {
  content: '';
  position: absolute;
  bottom: -80px; right: 60px;
  width: 300px; height: 200px;
  background: radial-gradient(ellipse, rgba(247,150,108,0.10) 0%, transparent 65%);
  pointer-events: none;
}

.logo-row { display: flex; align-items: center; gap: var(--space-5); position: relative; z-index: 1; margin-bottom: var(--space-4); }

.header-divider {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.15) 30%, rgba(37,138,203,0.2) 60%, transparent 100%);
  margin: var(--space-4) 0 var(--space-3);
  position: relative; z-index: 1;
}

.header-bottom { display: flex; align-items: baseline; gap: var(--space-3); position: relative; z-index: 1; }

.header h1 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text-on-dark);
}

.header-meta {
  font-size: 12px;
  color: var(--text-on-dark-muted);
  margin-top: var(--space-2);
  position: relative; z-index: 1;
}

/* ────────────── HEADER TABS ────────────── */
.header-tabs {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  position: relative;
  z-index: 1;
}
.header-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: none;
  border: none;
  color: var(--text-on-dark-muted);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  border-bottom: 2px solid transparent;
  transition: color var(--dur-fast) ease, border-color var(--dur-fast) ease, background var(--dur-fast) ease;
}
.header-tab:hover {
  color: var(--text-on-dark);
  background: rgba(255,255,255,0.06);
}
.header-tab.active {
  color: var(--text-on-dark);
  border-bottom-color: var(--brand-primary);
}
.header-tab svg { opacity: 0.7; }
.header-tab.active svg { opacity: 1; }
.header-tab-spacer { flex: 1; }
.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--brand-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 9px;
  line-height: 1;
}

/* ────────────── NOTIFICATION BELL ────────────── */
.notif-wrap { position: relative; z-index: 2; }
.notif-bell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: none;
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text-on-dark-muted);
  cursor: pointer;
  position: relative;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.notif-bell:hover { background: rgba(255,255,255,0.08); color: var(--text-on-dark); }
.notif-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 2px solid var(--header-bg);
}
.notif-panel {
  display: none;
  position: absolute;
  top: 44px;
  right: 0;
  width: 340px;
  max-height: 420px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0,0,0,0.06);
  overflow: hidden;
  z-index: 10;
}
.notif-panel.open { display: block; animation: notifSlide 180ms var(--ease-out); }
@keyframes notifSlide { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.notif-panel-title { font-family: var(--font-display); font-size: 14px; font-weight: 600; color: var(--text-primary); }
.notif-mark-all {
  background: none;
  border: none;
  color: var(--brand-primary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.notif-mark-all:hover { text-decoration: underline; }
.notif-panel-list { max-height: 360px; overflow-y: auto; }
.notif-item {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  cursor: pointer;
  transition: background var(--dur-fast) ease;
}
.notif-item:hover { background: var(--bg-elevated); }
.notif-item.unread { background: rgba(37,138,203,0.04); }
.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}
.notif-dot.green { background: #22c55e; }
.notif-dot.blue  { background: var(--brand-primary); }
.notif-dot.red   { background: #ef4444; }
.notif-dot.gray  { background: #94a3b8; }
.notif-content { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 500; color: var(--text-primary); line-height: 1.4; }
.notif-time  { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
.notif-empty {
  padding: 32px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-tertiary);
}

/* ────────────── AVATAR & SETTINGS ────────────── */
.avatar-wrap { margin-left: auto; position: relative; z-index: 1; flex-shrink: 0; }

.avatar-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
  border: 2px solid rgba(255,255,255,0.22);
  cursor: pointer; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(var(--brand-primary-rgb),0.45);
  transition: transform 160ms cubic-bezier(0.34,1.56,0.64,1), box-shadow 160ms ease, border-color 160ms ease;
  padding: 0;
}
.avatar-btn:hover  { transform: scale(1.1); border-color: rgba(255,255,255,0.40); box-shadow: 0 4px 18px rgba(var(--brand-primary-rgb),0.65); }
.avatar-btn:active { transform: scale(0.94); transition: transform 60ms ease; }
.avatar-btn img    { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.avatar-initials   { font-size: 13px; font-weight: 700; color: white; letter-spacing: 0.02em; line-height: 1; margin-top: -1px; pointer-events: none; }

@keyframes panelOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(-5px) scale(0.97); }
}

.avatar-menu {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 224px;
  background: white;
  border: 1px solid rgba(0,0,0,0.09);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(var(--brand-primary-rgb),0.18), 0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden; z-index: 9999;
  display: none;
  transform-origin: top right;
}
.avatar-menu.open    { display: block; animation: panelIn 180ms cubic-bezier(0.34,1.56,0.64,1) both; }
.avatar-menu.closing { animation: panelOut 120ms ease forwards; }

.avatar-menu-user  { padding: 14px 16px 12px; border-bottom: 1px solid rgba(0,0,0,0.07); }
.avatar-menu-name  { display: block; font-size: 13px; font-weight: 600; color: var(--text-primary); }
.avatar-menu-email { display: block; font-size: 11px; color: var(--text-tertiary); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar-menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 16px;
  background: none; border: none; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--text-primary);
  text-align: left; transition: background 100ms ease;
}
.avatar-menu-item:hover  { background: rgba(0,0,0,0.04); }
.avatar-menu-item:active { background: rgba(0,0,0,0.07); }
.avatar-menu-item.danger { color: var(--status-danger); }
.avatar-menu-item.danger:hover { background: rgba(239,68,68,0.06); }
.avatar-menu-sep { height: 1px; background: rgba(0,0,0,0.07); margin: 4px 0; }

/* Settings drawer avatar section */
.settings-avatar-section {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 24px; padding: 16px;
  background: rgba(0,0,0,0.025); border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.06);
}
.settings-avatar-circle {
  width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(var(--brand-primary-rgb),0.35);
}
.settings-avatar-circle img  { width: 100%; height: 100%; object-fit: cover; display: block; }
.settings-avatar-circle span { font-size: 24px; font-weight: 700; color: white; margin-top: -1px; }
.settings-avatar-actions { display: flex; flex-direction: column; gap: 7px; }
.settings-upload-btn {
  display: inline-block; cursor: pointer;
  font-size: 12px; font-weight: 600; padding: 6px 14px;
  border-radius: var(--radius-sm); border: none;
  background: var(--brand-primary); color: white;
  box-shadow: 0 2px 8px rgba(var(--brand-primary-rgb),0.3);
  transition: filter 120ms ease, transform 80ms ease;
  text-align: center;
}
.settings-upload-btn:hover  { filter: brightness(1.1); }
.settings-upload-btn:active { transform: scale(0.97); }
.settings-remove-btn {
  background: none; cursor: pointer;
  font-size: 12px; font-weight: 500; padding: 5px 12px;
  border-radius: var(--radius-sm); color: var(--text-secondary);
  border: 1px solid rgba(0,0,0,0.12);
  transition: border-color 120ms ease, color 120ms ease;
}
.settings-remove-btn:hover { border-color: var(--status-danger); color: var(--status-danger); }
.settings-upload-status { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; min-height: 16px; }

/* ────────────── TOOLBAR (Glassmorphism) ────────────── */
.toolbar {
  position: sticky;
  top: 0;
  z-index: var(--z-toolbar);
  padding: var(--space-3) var(--space-6) var(--space-2);
  background: rgba(238, 242, 247, 0.88);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid rgba(255,255,255,0.7);
  box-shadow: var(--shadow-sm);
}

.search-row { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }

.search-wrap {
  flex: 1;
  min-width: 200px;
  position: relative;
}
.search-icon {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 14px;
  pointer-events: none;
}
.search-box {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: var(--font-body);
  background: rgba(255,255,255,0.9);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-base) ease;
}
.search-box:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb),0.12), var(--shadow-sm);
}
.search-box::placeholder { color: var(--text-tertiary); }



.page-size-select {
  padding: 7px 10px;
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: var(--radius-md);
  font-size: 12px;
  font-family: var(--font-body);
  background: rgba(255,255,255,0.9);
  color: var(--text-secondary);
  cursor: pointer;
}

/* ────────────── APP LAYOUT (Sidebar + Main) ────────────── */
.app-layout {
  display: flex;
  min-height: calc(100vh - 140px);
}

/* ── MANUFACTURER SIDEBAR ── */
.mfr-sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-surface);
  border-right: 1px solid rgba(0,0,0,0.07);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: calc(100vh - 140px);
  overflow: hidden;
  z-index: var(--z-sidebar);
}

.mfr-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 0;
}
.sidebar-close-btn {
  display: none; /* shown only on mobile */
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-tertiary);
  font-size: 16px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  line-height: 1;
  flex-shrink: 0;
}
.sidebar-close-btn:hover { background: rgba(0,0,0,0.06); color: var(--text-primary); }
.mfr-sidebar-title {
  font: 600 13px var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin: 0;
}
.mfr-sidebar-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: rgba(var(--brand-primary-rgb), 0.10);
  color: var(--brand-primary);
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
}

.mfr-sidebar-search {
  padding: 12px 16px 8px;
}
.mfr-sidebar-search input {
  width: 100%;
  padding: 7px 10px;
  border: 1.5px solid rgba(0,0,0,0.10);
  border-radius: var(--radius-sm);
  font: 12px var(--font-body);
  background: var(--bg-elevated);
  outline: none;
  transition: border-color var(--dur-fast) ease;
}
.mfr-sidebar-search input:focus { border-color: var(--brand-primary); }
.mfr-sidebar-search input::placeholder { color: var(--text-disabled); }

.mfr-sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
}

/* Manufacturer card */
.mfr-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 2px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-body);
  text-align: left;
  transition: background var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.mfr-card:hover { background: rgba(var(--brand-primary-rgb), 0.05); }
.mfr-card.active {
  background: rgba(var(--brand-primary-rgb), 0.10);
  box-shadow: inset 0 0 0 1.5px rgba(var(--brand-primary-rgb), 0.20);
}
.mfr-card.hidden { display: none; }

.mfr-card-color {
  width: 4px;
  height: 32px;
  border-radius: 2px;
  flex-shrink: 0;
}

.mfr-card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.mfr-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mfr-card-meta {
  font-size: 11px;
  color: var(--text-tertiary);
}

.mfr-card-badges {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.mfr-card-type {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 3px;
  line-height: 1;
}
.mfr-card-type.dealer { background: rgba(16,185,129,0.14); color: #059669; }
.mfr-card-type.list   { background: rgba(59,130,246,0.14); color: #2563eb; }
.mfr-card-type.unknown { background: rgba(245,158,11,0.14); color: #d97706; }

.mfr-card-conf {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 3px;
  line-height: 1;
}
.mfr-card-conf.conf-high { background: rgba(16,185,129,0.14); color: #059669; }
.mfr-card-conf.conf-low  { background: rgba(245,158,11,0.14); color: #d97706; }

.mfr-card-unconfirmed {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 50%;
  background: rgba(245,158,11,0.15);
  color: #d97706;
}

/* "All Products" button at sidebar bottom */
.mfr-sidebar-all {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border: none;
  border-top: 1px solid rgba(0,0,0,0.07);
  background: var(--bg-elevated);
  cursor: pointer;
  font: 600 13px var(--font-body);
  color: var(--text-secondary);
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
  flex-shrink: 0;
}
.mfr-sidebar-all:hover { background: rgba(var(--brand-primary-rgb), 0.05); color: var(--brand-primary); }
.mfr-sidebar-all.active { color: var(--brand-primary); background: rgba(var(--brand-primary-rgb), 0.08); }
.mfr-all-icon { font-size: 14px; }

/* ── MAIN CONTENT ── */
.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── MANUFACTURER DETAIL HEADER ── */
.mfr-detail-header {
  background: var(--bg-surface);
  border-bottom: 1px solid rgba(0,0,0,0.07);
  padding: 20px 24px;
  animation: detailIn 220ms var(--ease-out) both;
}
@keyframes detailIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.mfr-detail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.mfr-detail-name-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mfr-detail-color {
  width: 5px;
  height: 28px;
  border-radius: 3px;
}
.mfr-detail-name {
  font: 700 20px var(--font-display);
  color: var(--text-primary);
  margin: 0;
}
.mfr-detail-type-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 4px;
}
.mfr-detail-type-badge.dealer { background: rgba(16,185,129,0.14); color: #059669; }
.mfr-detail-type-badge.list   { background: rgba(59,130,246,0.14); color: #2563eb; }
.mfr-detail-type-badge.unknown { background: rgba(245,158,11,0.14); color: #d97706; }

.mfr-detail-warn {
  font-size: 11px;
  font-weight: 600;
  color: #d97706;
  background: rgba(245,158,11,0.10);
  padding: 3px 8px;
  border-radius: 4px;
}
.mfr-detail-ok {
  font-size: 11px;
  font-weight: 600;
  color: #16a34a;
  background: rgba(22,163,74,0.10);
  padding: 3px 8px;
  border-radius: 4px;
}
.mfr-confirm-btn {
  font-size: 11px;
  font-weight: 600;
  color: #2563eb;
  background: rgba(37,99,235,0.10);
  border: none;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  margin-left: 6px;
}
.mfr-confirm-btn:hover { background: rgba(37,99,235,0.18); }

.mfr-detail-stats {
  display: flex;
  gap: 20px;
}
.mfr-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.mfr-stat-val {
  font: 700 16px var(--font-mono);
  color: var(--text-primary);
}
.mfr-stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
}

.mfr-detail-schema {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}
.mfr-schema-section {
  flex: 1;
  min-width: 180px;
}
.mfr-schema-label {
  font: 600 10px var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin: 0 0 8px;
}
.mfr-schema-tiers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mfr-schema-tier {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--bg-elevated);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.mfr-tier-label { font-weight: 600; color: var(--text-primary); }
.mfr-tier-qty { font-size: 10px; color: var(--text-tertiary); }
.mfr-tier-key {
  font: 500 10px var(--font-mono);
  color: var(--brand-primary);
  background: rgba(var(--brand-primary-rgb), 0.08);
  padding: 1px 5px;
  border-radius: 3px;
}

.mfr-schema-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.mfr-schema-field {
  font: 500 11px var(--font-mono);
  padding: 3px 8px;
  background: var(--bg-elevated);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

.mfr-schema-notes {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}
.mfr-schema-empty {
  font-size: 12px;
  color: var(--text-tertiary);
  font-style: italic;
  margin: 0;
}
.mfr-option.hidden { display: none; }

/* ────────────── MAIN CONTAINER ────────────── */
.container { padding: var(--space-4) var(--space-6) var(--space-12); flex: 1; min-width: 0; }

/* ────────────── TABLE CARD ────────────── */
.table-card {
  background: var(--bg-surface);
  border-radius: 5px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.8);
}

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

table { width: 100%; min-width: 1100px; border-collapse: collapse; font-size: 13px; }

thead th {
  position: sticky;
  top: 0;
  z-index: var(--z-table-head);
  background: var(--bg-elevated);
  border-bottom: 1px solid rgba(0,0,0,0.07);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
thead th:hover { background: #edf2f7; color: var(--brand-primary); }
thead th .sort-icon { margin-left: 4px; opacity: 0.3; font-size: 10px; }
thead th.sorted { color: var(--brand-primary); }
thead th.sorted .sort-icon { opacity: 1; }

/* Table row entry animation */
@keyframes rowIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

tbody tr {
  border-bottom: 1px solid rgba(0,0,0,0.04);
  animation: rowIn 240ms var(--ease-out) both;
  transition: background var(--dur-fast) ease;
  cursor: pointer;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f5f8ff; }
tbody tr.selected { background: #eef3ff; }
tbody tr.selected td.sku { color: var(--brand-primary); }
tbody tr.has-popup { position: relative; z-index: 100; }

/* Sticky checkbox column — stays visible during horizontal scroll */
.table-wrap thead th:first-child,
.table-wrap tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--bg-elevated);
}
.table-wrap thead th:first-child { z-index: 3; }
.table-wrap tbody tr:hover td:first-child    { background: #f5f8ff; }
.table-wrap tbody tr.selected td:first-child  { background: #eef3ff; }
/* Fade edge to indicate more content to the right */
.table-wrap thead th:first-child::after,
.table-wrap tbody td:first-child::after {
  content: '';
  position: absolute;
  top: 0; right: -8px; bottom: 0;
  width: 8px;
  background: linear-gradient(to right, rgba(0,0,0,0.04), transparent);
  pointer-events: none;
}

td { padding: 9px 12px; vertical-align: middle; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
td.price {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  color: var(--text-primary);
  white-space: nowrap;
}
td.sku {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
}
td.mfr { font-weight: 500; color: var(--text-primary); max-width: 180px; }
td.desc { max-width: 300px; }
td.notes { font-size: 12px; color: var(--text-tertiary); max-width: 200px; }

.cb { width: 15px; height: 15px; cursor: pointer; accent-color: var(--brand-primary); }

/* Larger touch target on mobile */
@media (max-width: 900px) {
  .cb { width: 18px; height: 18px; }
  .table-wrap thead th:first-child,
  .table-wrap tbody td:first-child { padding-left: 10px; padding-right: 10px; }
}

/* ────────────── DELETE BUTTON ────────────── */
.btn-delete {
  opacity: 0;
  transition: opacity var(--dur-fast) ease, color var(--dur-fast) ease;
  background: none;
  border: none;
  color: var(--text-disabled);
  cursor: pointer;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1;
}
tbody tr:hover .btn-delete { opacity: 1; }
.btn-delete:hover { color: var(--status-danger); background: rgba(239,68,68,0.08); }

/* ────────────── BUTTONS ────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  transition: transform var(--dur-base) var(--spring), box-shadow var(--dur-base) ease, background var(--dur-fast) ease;
}
.btn:active { transform: scale(0.96) !important; transition-duration: 70ms; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(var(--brand-primary-rgb), 0.25);
}
.btn-primary:hover {
  transform: scale(1.02) translateY(-1px);
  box-shadow: 0 6px 18px rgba(var(--brand-primary-rgb), 0.35);
}

.btn-danger {
  background: var(--status-danger);
  color: white;
  box-shadow: 0 2px 8px rgba(239,68,68,0.20);
}
.btn-danger:hover {
  transform: scale(1.02) translateY(-1px);
  box-shadow: 0 6px 16px rgba(239,68,68,0.30);
}

.btn-ghost {
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.2);
}
.btn-ghost:hover {
  transform: scale(1.02);
  background: rgba(255,255,255,0.22);
}

.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ────────────── SPECS POPUP ────────────── */
@keyframes popupIn {
  from { opacity: 0; transform: scale(0.93) translateY(4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes popupOut {
  from { opacity: 1; transform: scale(1) translateY(0); }
  to   { opacity: 0; transform: scale(0.93) translateY(4px); }
}

.specs-btn {
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid rgba(var(--brand-primary-rgb), 0.25);
  border-radius: 20px;
  background: rgba(var(--brand-primary-rgb), 0.06);
  color: var(--brand-primary);
  cursor: pointer;
  transition: background var(--dur-fast) ease, box-shadow var(--dur-base) var(--spring), transform var(--dur-base) var(--spring);
}
.specs-btn:hover {
  background: rgba(var(--brand-primary-rgb), 0.12);
  box-shadow: 0 2px 8px rgba(var(--brand-primary-rgb), 0.18);
  transform: scale(1.04);
}

.specs-cell { position: relative; }

/* Dynamic spec columns */
th.spec-col-header {
  white-space: nowrap;
  font-size: 11px;
  letter-spacing: .02em;
  color: var(--text-secondary, #6b7280);
  background: rgba(99,102,241,0.04);
  border-left: 1px solid rgba(99,102,241,0.12);
  padding: 0 10px;
  min-width: 80px;
  max-width: 160px;
}
td.spec-col-cell {
  font-size: 12px;
  color: var(--text-secondary, #6b7280);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
  border-left: 1px solid rgba(99,102,241,0.08);
  padding: 0 10px;
}
.specs-popup {
  display: none;
  position: absolute;
  right: 0; top: calc(100% + 4px);
  background: white;
  border: 1px solid rgba(0,0,0,0.09);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-3);
  z-index: 10;
  min-width: 200px;
  max-width: 320px;
  font-size: 12px;
  animation: popupIn 200ms var(--spring) both;
}
.specs-popup.show { display: block; }
.specs-popup.hiding { animation: popupOut 130ms var(--ease-out) forwards; }
.spec-row { display: flex; gap: var(--space-2); padding: 4px 0; border-bottom: 1px solid rgba(0,0,0,0.04); }
.spec-row:last-child { border-bottom: none; }
.spec-key { color: var(--text-tertiary); font-weight: 500; min-width: 90px; flex-shrink: 0; text-transform: capitalize; }
.spec-val { color: var(--text-primary); word-break: break-word; }

/* ────────────── PAGINATION ────────────── */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid rgba(0,0,0,0.05);
  background: var(--bg-elevated);
  font-size: 12px;
  color: var(--text-tertiary);
}
.page-btns { display: flex; gap: 3px; }
.page-btn {
  padding: 4px 10px;
  border: 1px solid rgba(0,0,0,0.09);
  background: white;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font-body);
  color: var(--text-secondary);
  transition: transform var(--dur-base) var(--spring), background var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.page-btn:hover:not(:disabled) {
  background: var(--bg-elevated);
  transform: scale(1.05);
  box-shadow: var(--shadow-sm);
}
.page-btn.active {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(var(--brand-primary-rgb), 0.3);
}
.page-btn:disabled { opacity: 0.35; cursor: default; }

/* ────────────── SELECTION BAR ────────────── */
@keyframes barIn  { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes barOut { from { transform: translateY(0); opacity: 1; } to { transform: translateY(100%); opacity: 0; } }

.selection-bar {
  display: none;
  position: fixed;
  bottom: var(--space-4); left: 50%; transform: translateX(-50%);
  background: var(--header-bg);
  color: white;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-xl);
  z-index: var(--z-header);
  align-items: center;
  gap: var(--space-3);
  box-shadow: 0 8px 32px rgba(0,0,0,0.35), 0 2px 8px rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.10);
  min-width: min(380px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
}
.selection-bar.visible {
  display: flex;
  animation: barIn 300ms var(--spring) both;
}
.selection-bar.hiding {
  animation: barOut 180ms var(--ease-out) forwards;
}
.sel-count-badge {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  color: white;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 60px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(var(--brand-primary-rgb), 0.4);
}
/* sel row wrappers – desktop: both rows display as inline flex contents */
.sel-top-row  { display: contents; }
.sel-actions  { display: contents; }
.sel-label    { font-size: 13px; color: rgba(255,255,255,0.7); flex: 1; }

/* ────────────── EMPTY STATE ────────────── */
@keyframes emptyFloat {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-8px); }
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-8);
  text-align: center;
  color: var(--text-tertiary);
}
.empty-icon {
  font-size: 48px;
  margin-bottom: var(--space-4);
  animation: emptyFloat 3s ease-in-out infinite;
  filter: grayscale(0.3);
}
.empty-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}
.empty-sub { font-size: 13px; max-width: 320px; }

/* ────────────── SHIMMER (diagonal) ────────────── */
@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position: 200% 0; }
}

/* ────────────── RESPONSIVE ────────────── */
@media (max-width: 900px) {
  /* Sidebar becomes a slide-in drawer from the left */
  .app-layout { flex-direction: row; } /* keep row so sidebar doesn't push content */

  .mfr-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 280px;
    min-width: 280px;
    height: 100%;
    max-height: 100%;
    z-index: calc(var(--z-modal) + 10); /* must be above toolbar (200) and table head (150) */
    transform: translateX(-100%);
    transition: transform 260ms var(--spring);
    border-right: 1px solid rgba(0,0,0,0.1);
    box-shadow: 4px 0 24px rgba(0,0,0,0.18);
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    overflow-y: auto;
  }
  .mfr-sidebar.drawer-open {
    transform: translateX(0);
  }

  /* Backdrop when drawer is open */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(13,20,33,0.45);
    z-index: calc(var(--z-modal) + 9);
    backdrop-filter: blur(2px);
  }
  .sidebar-backdrop.visible { display: block; }

  /* Main content takes full width */
  .main-content { width: 100%; min-width: 0; }

  /* Restore vertical sidebar styles */
  .sidebar-close-btn { display: block; }
  .mfr-sidebar-header { padding: 14px 16px 4px; }
  .mfr-sidebar-search { padding: 8px 14px 10px; }
  .mfr-sidebar-list { flex-direction: column; overflow-x: hidden; overflow-y: auto; padding: 4px 0 8px; gap: 0; display: flex; flex: 1; }
  .mfr-card { min-width: 0; flex-shrink: 1; }
  .mfr-sidebar-all { border-top: 1px solid rgba(0,0,0,0.07); border-left: none; padding: 12px 16px; }

  /* Mobile filter toggle button — visible only on mobile */
  .btn-filter-toggle { display: inline-flex !important; }

  .mfr-detail-header { padding: 14px 16px; }
  .mfr-detail-name { font-size: 16px; }
}
@media (max-width: 768px) {
  /* ── layout padding ── */
  .toolbar   { padding: 10px var(--space-4) 8px; }
  .container { padding-left: var(--space-4); padding-right: var(--space-4); }
  .header    { padding-left: var(--space-4); padding-right: var(--space-4); }

  /* ── header tabs ── */
  .header-tabs { gap: 0; }
  .header-tab  { padding: 6px 10px; font-size: 13px; }
  .notif-panel { width: 300px; right: -12px; }

  /* ── toolbar: stacked layout ── */
  .search-row {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }

  /* row 1: search takes full width */
  .search-wrap { min-width: 0; }

  /* row 3: page-size + action buttons side-by-side */
  .toolbar-row-bottom {
    display: flex;
    gap: 8px;
    align-items: center;
  }
  .page-size-select { flex: 1; box-sizing: border-box; }
  .toolbar-actions {
    flex-shrink: 0;
    display: flex;
    gap: 6px;
  }
  .btn-toolbar { padding: 7px 14px; font-size: 13px; }

  /* ── floating selection bar ── */
  .selection-bar {
    /* full-bleed with gutters, proper bottom safe-area */
    left: var(--space-3);
    right: var(--space-3);
    bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
    transform: none;
    min-width: 0;
    border-radius: 12px;

    /* switch to 2-row layout */
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 14px;
  }

  /* top row: badge + label */
  .sel-top-row {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .sel-label { flex: 1; }

  /* bottom row: buttons wrap */
  .sel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .sel-actions .btn {
    flex: 1;
    min-width: 0;
    justify-content: center;
    white-space: nowrap;
    font-size: 12px;
    padding: 7px 10px;
  }
}

/* very small phones */
@media (max-width: 400px) {
  .sel-actions .btn { font-size: 11.5px; padding: 6px 8px; }
  .btn-toolbar      { padding: 7px 11px; font-size: 12.5px; }
}

/* ────────────── IMPORT / ADD UI ────────────── */

/* Overlay */
.overlay {
  display: none; position: fixed; inset: 0; background: rgba(13,20,33,0.55);
  backdrop-filter: blur(4px); z-index: var(--z-overlay);
  animation: overlayIn 200ms ease both;
}
.overlay.visible { display: block; }
.overlay.hiding  { animation: overlayOut 180ms ease forwards; }
@keyframes overlayIn  { from { opacity:0 } to { opacity:1 } }
@keyframes overlayOut { from { opacity:1 } to { opacity:0 } }

/* Toast */
.toast-container { position:fixed; bottom:80px; right:24px; z-index:var(--z-toast); display:flex; flex-direction:column; gap:8px; pointer-events:none; }
@keyframes toastIn  { from { opacity:0; transform:translateX(20px) scale(0.95) } to { opacity:1; transform:translateX(0) scale(1) } }
@keyframes toastOut { to   { opacity:0; transform:translateX(20px) scale(0.95) } }
.toast {
  display:flex; align-items:center; gap:10px;
  padding:10px 16px; border-radius:10px; font-size:13px; font-weight:500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  animation: toastIn 280ms var(--spring) both;
  pointer-events:auto;
}
.toast.success { background:#0d1421; color:#fff; border:1px solid rgba(255,255,255,0.1); }
.toast.error   { background:#7f1d1d; color:#fca5a5; border:1px solid rgba(239,68,68,0.3); }
.toast-icon    { font-size:15px; margin-top:-1px; }
.toast.hiding  { animation: toastOut 180ms ease forwards; }

/* ── ADD DRAWER ── */
@keyframes drawerIn  { from { transform:translateX(100%) } to { transform:translateX(0) } }
@keyframes drawerOut { to   { transform:translateX(110%) } }
.drawer {
  display: none; position: fixed; top:0; right:0; height:100vh; width:460px; max-width:100vw;
  background: white; z-index: var(--z-modal);
  box-shadow: -8px 0 40px rgba(0,0,0,0.18);
  flex-direction: column; overflow: hidden;
}
.drawer.visible { display:flex; animation: drawerIn 320ms var(--spring) both; }
.drawer.hiding  { display:flex; animation: drawerOut 200ms var(--ease-out) forwards; }

.drawer-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.07);
  display: flex; align-items:center; justify-content:space-between;
  background: var(--header-bg);
}
.drawer-title { font-family:var(--font-display); font-size:17px; font-weight:600; letter-spacing:-0.02em; color:white; }
.drawer-close { background:none; border:none; cursor:pointer; color:rgba(255,255,255,0.5); font-size:20px; padding:2px 6px; border-radius:5px; transition:color 120ms ease, background 120ms ease; }
.drawer-close:hover { color:white; background:rgba(255,255,255,0.1); }

.drawer-body { flex:1; overflow-y:auto; padding:20px 24px; }
.drawer-footer { padding:16px 24px; border-top:1px solid rgba(0,0,0,0.07); display:flex; gap:10px; justify-content:flex-end; background:var(--bg-elevated); }

/* Form elements */
.form-group  { margin-bottom:16px; }
.form-row    { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.form-label  { display:block; font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:0.04em; color:var(--text-tertiary); margin-bottom:5px; }
.form-label .req { color:var(--brand-primary); margin-left:2px; }
.form-input, .form-select, .form-textarea {
  width:100%; padding:8px 12px; border:1px solid rgba(0,0,0,0.12); border-radius:var(--radius-md);
  font-size:13px; font-family:var(--font-body); color:var(--text-primary); background:white;
  transition: border-color 120ms ease, box-shadow 200ms ease;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline:none; border-color:var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb),0.12);
}
.form-textarea { resize:vertical; min-height:72px; line-height:1.5; }

/* Specs builder */
.specs-builder { margin-top:20px; }
.specs-builder-title { font-size:12px; font-weight:600; text-transform:uppercase; letter-spacing:0.04em; color:var(--text-tertiary); margin-bottom:10px; display:flex; align-items:center; justify-content:space-between; }
.spec-row-input { display:flex; gap:8px; align-items:center; margin-bottom:8px; }
.spec-row-input input { flex:1; padding:7px 10px; border:1px solid rgba(0,0,0,0.10); border-radius:var(--radius-sm); font-size:12px; font-family:var(--font-mono); }
.spec-row-input input:focus { outline:none; border-color:var(--brand-primary); }
.btn-spec-remove { background:none; border:none; cursor:pointer; color:var(--text-disabled); font-size:16px; padding:2px; transition:color 120ms ease; flex-shrink:0; }
.btn-spec-remove:hover { color:var(--status-danger); }
.btn-add-spec { background:none; border:1px dashed rgba(0,0,0,0.15); border-radius:var(--radius-sm); padding:6px 14px; font-size:12px; font-weight:500; color:var(--text-secondary); cursor:pointer; width:100%; transition:border-color 120ms ease, color 120ms ease; }
.btn-add-spec:hover { border-color:var(--brand-primary); color:var(--brand-primary); }

/* New item badge */
.new-badge { display:inline-block; padding:1px 7px; border-radius:20px; font-size:10px; font-weight:600; background:linear-gradient(135deg, #10b981, #059669); color:white; margin-left:6px; vertical-align:middle; }

/* ── IMPORT WIZARD MODAL ── */
@keyframes modalIn  { from { opacity:0; transform:scale(0.94) translateY(12px) } to { opacity:1; transform:scale(1) translateY(0) } }
@keyframes modalOut { to   { opacity:0; transform:scale(0.94) translateY(8px) } }
.modal {
  display:none; position:fixed; inset:0; z-index:var(--z-modal);
  align-items:center; justify-content:center; padding:20px;
}
.modal.visible { display:flex; }
.modal-box {
  background:white; border-radius:var(--radius-xl); width:700px; max-width:100%;
  max-height:90vh; display:flex; flex-direction:column; overflow:hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25), 0 4px 12px rgba(0,0,0,0.1);
  animation: modalIn 320ms var(--spring) both;
}
.modal.hiding .modal-box { animation: modalOut 180ms var(--ease-out) forwards; }

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.07);
  background: var(--header-bg);
  display:flex; align-items:center; justify-content:space-between; flex-shrink:0;
}
.modal-title { font-family:var(--font-display); font-size:17px; font-weight:600; letter-spacing:-0.02em; color:white; }
.modal-close { background:none; border:none; cursor:pointer; color:rgba(255,255,255,0.5); font-size:20px; padding:2px 6px; border-radius:5px; transition:color 120ms ease; }
.modal-close:hover { color:white; background:rgba(255,255,255,0.1); }
.modal-body   { flex:1; overflow-y:auto; padding:24px; }
.modal-footer { padding:16px 24px; border-top:1px solid rgba(0,0,0,0.07); display:flex; gap:10px; justify-content:space-between; align-items:center; background:var(--bg-elevated); flex-shrink:0; }

/* Step indicator */
.step-indicator { display:flex; align-items:center; gap:8px; margin-bottom:24px; }
.step-dot { width:28px; height:28px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; flex-shrink:0; transition:all 220ms var(--spring); }
.step-dot.done    { background:linear-gradient(135deg, var(--brand-primary), var(--brand-secondary)); color:white; box-shadow:0 2px 8px rgba(var(--brand-primary-rgb),0.35); }
.step-dot.active  { background:linear-gradient(135deg, var(--brand-primary), var(--brand-secondary)); color:white; box-shadow:0 2px 8px rgba(var(--brand-primary-rgb),0.35); transform:scale(1.1); }
.step-dot.pending { background:rgba(0,0,0,0.07); color:var(--text-tertiary); }
.step-line { flex:1; height:2px; background:rgba(0,0,0,0.08); border-radius:2px; overflow:hidden; }
.step-line-fill { height:100%; background:linear-gradient(90deg, var(--brand-primary), var(--brand-secondary)); transition:width 400ms var(--ease-out); }
.step-label { font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:0.04em; }
.step-label.active { color:var(--brand-primary); }
.step-label.done   { color:var(--text-secondary); }
.step-label.pending{ color:var(--text-tertiary); }

/* Drop zone */
.drop-zone {
  border:2px dashed rgba(0,0,0,0.15); border-radius:var(--radius-lg);
  padding:48px 32px; text-align:center; cursor:pointer;
  transition:border-color 200ms ease, background 200ms ease;
  position:relative; background:var(--bg-elevated);
}
.drop-zone:hover, .drop-zone.drag-over { border-color:var(--brand-primary); background:rgba(var(--brand-primary-rgb),0.04); }
.drop-zone input[type=file] { position:absolute; inset:0; opacity:0; cursor:pointer; }
.drop-icon { font-size:40px; margin-bottom:12px; opacity:0.5; }
.drop-title { font-family:var(--font-display); font-size:16px; font-weight:600; letter-spacing:-0.01em; color:var(--text-primary); margin-bottom:6px; }
.drop-sub   { font-size:13px; color:var(--text-tertiary); }
.drop-types { margin-top:12px; display:flex; gap:6px; justify-content:center; flex-wrap:wrap; }
.drop-type-badge { padding:3px 10px; border-radius:20px; font-size:11px; font-weight:600; background:rgba(0,0,0,0.06); color:var(--text-secondary); }

/* File ready state */
.file-ready { display:flex; align-items:center; gap:14px; padding:16px; background:rgba(var(--brand-primary-rgb),0.06); border:1px solid rgba(var(--brand-primary-rgb),0.18); border-radius:var(--radius-md); margin-top:16px; }
.file-icon { font-size:28px; }
.file-info .file-name { font-weight:600; font-size:14px; color:var(--text-primary); }
.file-info .file-meta { font-size:12px; color:var(--text-tertiary); margin-top:2px; }
.file-remove { margin-left:auto; background:none; border:none; cursor:pointer; color:var(--text-tertiary); font-size:18px; padding:4px; border-radius:5px; transition:color 120ms ease; }
.file-remove:hover { color:var(--status-danger); }

/* Mapping step */
.mapping-grid { display:flex; flex-direction:column; gap:10px; }
.mapping-row  { display:grid; grid-template-columns:1fr 24px 1fr; gap:10px; align-items:center; }
.mapping-target { font-size:13px; font-weight:500; color:var(--text-primary); }
.mapping-req { color:var(--brand-primary); font-size:11px; margin-left:4px; }
.mapping-arrow { color:var(--text-tertiary); text-align:center; font-size:14px; }
.mapping-select { width:100%; padding:7px 10px; border:1px solid rgba(0,0,0,0.12); border-radius:var(--radius-md); font-size:12px; font-family:var(--font-body); background:white; cursor:pointer; transition:border-color 120ms ease; }
.mapping-select:focus { outline:none; border-color:var(--brand-primary); }
.mapping-select.mapped { border-color:rgba(var(--brand-primary-rgb),0.4); background:rgba(var(--brand-primary-rgb),0.04); }
.mapping-note { font-size:12px; color:var(--text-tertiary); margin-top:16px; padding:10px 14px; background:var(--bg-elevated); border-radius:var(--radius-md); border-left:3px solid var(--brand-primary); }

/* Preview step */
.preview-stats { display:grid; grid-template-columns:repeat(3, 1fr); gap:12px; margin-bottom:20px; }
.preview-stat { padding:14px 16px; background:var(--bg-elevated); border-radius:var(--radius-md); text-align:center; }
.preview-stat .stat-val { font-family:var(--font-display); font-size:22px; font-weight:700; letter-spacing:-0.02em; color:var(--text-primary); font-variant-numeric:tabular-nums; }
.preview-stat .stat-label { font-size:11px; color:var(--text-tertiary); text-transform:uppercase; letter-spacing:0.04em; margin-top:3px; }
.preview-table-wrap { overflow-x:auto; border:1px solid rgba(0,0,0,0.07); border-radius:var(--radius-md); }
.preview-table { width:100%; border-collapse:collapse; font-size:12px; }
.preview-table th { padding:8px 10px; background:var(--bg-elevated); font-size:10px; text-transform:uppercase; letter-spacing:0.04em; color:var(--text-tertiary); border-bottom:1px solid rgba(0,0,0,0.07); text-align:left; white-space:nowrap; }
.preview-table td { padding:7px 10px; border-bottom:1px solid rgba(0,0,0,0.04); color:var(--text-secondary); max-width:160px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.preview-table tr:last-child td { border-bottom:none; }
.preview-more { padding:10px; text-align:center; font-size:12px; color:var(--text-tertiary); }

/* Toolbar bottom row wrapper – desktop: transparent flex passthrough */
.toolbar-row-bottom { display: contents; }
/* Toolbar import buttons */
.toolbar-actions { display:flex; gap:8px; flex-shrink:0; }
.btn-toolbar { display:inline-flex; align-items:center; gap:6px; padding:7px 14px; border-radius:var(--radius-md); font-size:13px; font-weight:500; font-family:var(--font-body); cursor:pointer; transition:transform var(--dur-base) var(--spring), box-shadow var(--dur-base) ease, background var(--dur-fast) ease; border:none; white-space:nowrap; }
.btn-filter-toggle { display:none; background:white; border:1px solid rgba(0,0,0,0.12); color:var(--text-secondary); box-shadow:var(--shadow-sm); } /* shown only on mobile via media query */
.btn-filter-toggle:hover { color:var(--brand-primary); border-color:rgba(var(--brand-primary-rgb),0.3); }
.btn-toolbar:active { transform:scale(0.96) !important; transition-duration:70ms; }
.btn-add-item { background:linear-gradient(135deg, var(--brand-primary), var(--brand-secondary)); color:white; box-shadow:0 2px 8px rgba(var(--brand-primary-rgb),0.25); }
.btn-add-item:hover { transform:scale(1.02) translateY(-1px); box-shadow:0 4px 14px rgba(var(--brand-primary-rgb),0.35); }
.btn-import-file { background:white; border:1px solid rgba(0,0,0,0.12); color:var(--text-secondary); box-shadow:var(--shadow-sm); }
.btn-import-file:hover { transform:scale(1.02) translateY(-1px); box-shadow:var(--shadow-md); color:var(--brand-primary); border-color:rgba(var(--brand-primary-rgb),0.3); }

/* ── QUOTE MODAL ── */
.quote-modal {
  display:none; position:fixed; inset:0; z-index:var(--z-modal);
  align-items:stretch; justify-content:stretch; padding:16px;
}
.quote-modal.visible { display:flex; }
.quote-modal-box {
  background:white; border-radius:var(--radius-xl); width:100%; max-width:100%;
  height:100%; max-height:100%; display:flex; flex-direction:column; overflow:hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25), 0 4px 12px rgba(0,0,0,0.1);
  animation: modalIn 320ms var(--spring) both;
}
.quote-modal.hiding .quote-modal-box { animation: modalOut 180ms var(--ease-out) forwards; }
.quote-modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.07);
  background: var(--header-bg);
  display:flex; align-items:center; justify-content:space-between; flex-shrink:0;
}
.quote-modal-title { font-family:var(--font-display); font-size:17px; font-weight:600; letter-spacing:-0.02em; color:white; display:flex; align-items:center; gap:10px; }
.quote-modal-title .quote-icon { font-size:20px; opacity:0.7; }
.quote-modal-close { background:none; border:none; cursor:pointer; color:rgba(255,255,255,0.5); font-size:20px; padding:2px 6px; border-radius:5px; transition:color 120ms ease, background 120ms ease; }
.quote-modal-close:hover { color:white; background:rgba(255,255,255,0.1); }
.quote-modal-body { flex:1; overflow-y:auto; padding:24px; }
.quote-modal-footer { padding:16px 24px; border-top:1px solid rgba(0,0,0,0.07); display:flex; gap:10px; justify-content:flex-end; align-items:center; background:var(--bg-elevated); flex-shrink:0; }

/* ── DELETE CONFIRM MODAL ── */
.del-modal {
  display:none; position:fixed; inset:0; z-index:var(--z-delete);
  align-items:center; justify-content:center; padding:20px;
  background: rgba(0,0,0,0.55); backdrop-filter:blur(4px);
}
.del-modal.visible { display:flex; }
.del-modal-box {
  background:white; border-radius:12px; width:420px; max-width:100%;
  display:flex; flex-direction:column; overflow:hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.35), 0 4px 12px rgba(0,0,0,0.12);
  animation: modalIn 280ms var(--spring) both;
}
.del-modal.hiding .del-modal-box { animation: modalOut 160ms var(--ease-out) forwards; }
.del-modal-header {
  padding: 20px 24px 16px;
  background: #1a0a0a;
  display:flex; align-items:center; justify-content:space-between; flex-shrink:0;
  border-bottom: 1px solid rgba(239,68,68,0.3);
}
.del-modal-title {
  font-family:var(--font-display); font-size:16px; font-weight:600;
  letter-spacing:-0.02em; color:white;
  display:flex; align-items:center; gap:9px;
}
.del-modal-title .del-icon {
  width:28px; height:28px; background:rgba(239,68,68,0.18); border:1px solid rgba(239,68,68,0.35);
  border-radius:6px; display:flex; align-items:center; justify-content:center;
  font-size:14px; flex-shrink:0;
}
.del-modal-close {
  background:none; border:none; cursor:pointer; color:rgba(255,255,255,0.45);
  font-size:20px; padding:2px 6px; border-radius:5px; transition:color 120ms, background 120ms;
}
.del-modal-close:hover { color:white; background:rgba(255,255,255,0.1); }
.del-modal-body { padding:24px; }
.del-modal-desc {
  font-size:13.5px; color:var(--text-secondary); line-height:1.6; margin:0 0 18px;
}
.del-modal-desc strong { color:var(--text-primary); font-weight:600; }
.del-modal-label {
  font-size:12px; font-weight:600; letter-spacing:0.05em; text-transform:uppercase;
  color:var(--status-danger); margin-bottom:8px;
}
.del-confirm-wrap { position:relative; }
.del-confirm-input {
  width:100%; box-sizing:border-box;
  padding:10px 14px; border:2px solid rgba(0,0,0,0.12);
  border-radius:7px; font-family:var(--font-mono); font-size:14px; font-weight:600;
  letter-spacing:0.08em; background:var(--bg-elevated); color:var(--text-primary);
  outline:none; transition:border-color 140ms, box-shadow 140ms;
}
.del-confirm-input:focus { border-color:var(--status-danger); box-shadow:0 0 0 3px rgba(239,68,68,0.12); }
.del-confirm-input.matched { border-color:#22c55e; box-shadow:0 0 0 3px rgba(34,197,94,0.12); }
.del-modal-footer {
  padding:16px 24px; border-top:1px solid rgba(0,0,0,0.07);
  display:flex; gap:10px; justify-content:flex-end; align-items:center;
  background:var(--bg-elevated); flex-shrink:0;
}
.btn-del-confirm {
  display:inline-flex; align-items:center; gap:7px;
  padding:9px 20px; border:none; border-radius:7px; cursor:pointer;
  font-size:13.5px; font-weight:600; font-family:var(--font-display);
  background:var(--status-danger); color:white;
  transition:background 140ms, opacity 140ms, transform 120ms;
}
.btn-del-confirm:disabled { opacity:0.35; cursor:not-allowed; transform:none; }
.btn-del-confirm:not(:disabled):hover { background:#dc2626; transform:translateY(-1px); }
.btn-del-confirm:not(:disabled):active { transform:translateY(0); }

.quote-summary {
  display:flex; gap:12px; margin-bottom:20px;
}
.quote-stat {
  flex:1; padding:14px 16px; background:var(--bg-elevated); border-radius:var(--radius-md); text-align:center;
  border:1px solid rgba(0,0,0,0.05);
}
.quote-stat .q-val { font-family:var(--font-display); font-size:22px; font-weight:700; letter-spacing:-0.02em; color:var(--text-primary); font-variant-numeric:tabular-nums; }
.quote-stat .q-val.q-total { color:var(--brand-primary); }
.quote-stat .q-label { font-size:11px; color:var(--text-tertiary); text-transform:uppercase; letter-spacing:0.04em; margin-top:3px; }

.quote-section-title { font-size:12px; font-weight:600; text-transform:uppercase; letter-spacing:0.05em; color:var(--text-tertiary); margin-bottom:12px; margin-top:4px; }

/* ── Quote Line Items table (inside modal) ── */
.qli-wrap { margin-bottom:20px; max-height:60vh; overflow:auto; border:1px solid rgba(0,0,0,0.07); border-radius:var(--radius-md); }
.qli-table { width:100%; border-collapse:collapse; font-size:12px; table-layout:auto; }
.qli-table thead { position:sticky; top:0; z-index:1; }
.qli-table thead th { padding:9px 8px; font-size:10px; font-weight:600; text-transform:uppercase; letter-spacing:0.05em; color:var(--text-tertiary); background:var(--bg-elevated); border-bottom:1px solid rgba(0,0,0,0.08); text-align:left; white-space:nowrap; }
.qli-table thead th.th-num { text-align:right; }
.qli-table thead th.th-ctr { text-align:center; }
.qli-table tbody tr:nth-child(even) { background:rgba(0,0,0,0.02); }
.qli-table tbody tr:hover { background:rgba(var(--brand-primary-rgb),0.04); }
.qli-table tbody td { padding:8px 8px; vertical-align:middle; border-bottom:1px solid rgba(0,0,0,0.04); color:var(--text-primary); }
.qli-table tbody tr:last-child td { border-bottom:none; }
.qli-td-sku { font-family:var(--font-mono); font-size:10.5px; color:var(--brand-primary); white-space:nowrap; }
.qli-td-mfr { font-weight:600; font-size:11px; white-space:nowrap; }
.qli-td-item-name { font-size:12px; word-break:break-word; }
.qli-td-desc { font-size:11px; color:var(--text-secondary); word-break:break-word; }
.qli-td-price, .qli-td-total { text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap; }
.qli-td-price { font-size:11px; color:var(--text-secondary); }
.qli-td-total { font-weight:700; color:var(--brand-primary); font-size:12px; }
.qli-td-qty { text-align:center; }
.qli-qty-input { width:58px; padding:5px 4px; border:1px solid rgba(0,0,0,0.15); border-radius:6px; font-size:13px; text-align:center; font-family:var(--font-mono); font-weight:600; color:var(--text-primary); background:var(--bg-surface); -moz-appearance:textfield; transition:border-color 0.15s, box-shadow 0.15s; }
.qli-qty-input::-webkit-inner-spin-button,.qli-qty-input::-webkit-outer-spin-button { opacity:1; }
.qli-qty-input:focus { outline:none; border-color:var(--brand-primary); box-shadow:0 0 0 3px rgba(var(--brand-primary-rgb),0.15); }

/* ── Quote line items: toolbar, drag handle, delete, typeahead ── */
.qli-toolbar { display:flex; justify-content:flex-end; padding:8px 10px; background:var(--bg-elevated); border-bottom:1px solid rgba(0,0,0,0.06); position:sticky; top:0; z-index:2; }
.qli-add-btn { background:transparent; border:1px dashed rgba(var(--brand-primary-rgb),0.45); color:var(--brand-primary); padding:6px 14px; border-radius:var(--radius-md); font-size:12px; font-weight:600; cursor:pointer; transition:background 0.15s, border-color 0.15s; }
.qli-add-btn:hover { background:rgba(var(--brand-primary-rgb),0.08); border-color:var(--brand-primary); }

.qli-th-drag, .qli-th-delete { width:28px; padding:9px 4px !important; }
.qli-drag-handle { width:28px; padding:4px !important; text-align:center; color:var(--text-tertiary); cursor:grab; user-select:none; font-size:14px; }
.qli-drag-handle:active { cursor:grabbing; }
.qli-delete-cell { width:32px; padding:4px !important; text-align:center; }
.qli-delete-btn { background:none; border:none; color:var(--text-tertiary); cursor:pointer; padding:4px 6px; border-radius:6px; font-size:13px; transition:color 0.15s, background 0.15s; }
.qli-delete-btn:hover { color:var(--status-danger, #ef4444); background:rgba(239,68,68,0.08); }

.qli-new-row { background:rgba(var(--brand-primary-rgb),0.04) !important; }
.qli-typeahead-cell { position:relative; padding:6px 8px !important; }
.qli-typeahead-input { width:100%; padding:6px 10px; border:1px solid rgba(var(--brand-primary-rgb),0.35); border-radius:6px; font-size:12px; background:var(--bg-surface); color:var(--text-primary); }
.qli-typeahead-input:focus { outline:none; border-color:var(--brand-primary); box-shadow:0 0 0 3px rgba(var(--brand-primary-rgb),0.15); }
.qli-typeahead-dropdown { position:absolute; top:100%; left:8px; right:8px; max-height:260px; overflow:auto; z-index:30; background:var(--bg-surface); border:1px solid rgba(0,0,0,0.12); border-radius:var(--radius-md); box-shadow:0 8px 24px rgba(0,0,0,0.12); margin-top:2px; }
.qli-typeahead-option { padding:8px 12px; cursor:pointer; border-bottom:1px solid rgba(0,0,0,0.04); }
.qli-typeahead-option:last-child { border-bottom:none; }
.qli-typeahead-option:hover, .qli-typeahead-option.qli-typeahead-active { background:rgba(var(--brand-primary-rgb),0.08); }
.qli-ta-name { font-size:12px; font-weight:600; color:var(--text-primary); }
.qli-ta-meta { font-size:11px; color:var(--text-secondary); margin-top:2px; }
.qli-ta-sku { font-family:var(--font-mono); color:var(--brand-primary); }

.sortable-ghost { opacity:0.4; background:rgba(var(--brand-primary-rgb),0.10) !important; }
.sortable-chosen { box-shadow:0 4px 12px rgba(0,0,0,0.12); cursor:grabbing; }

/* ── Quote Preview Overlay ── */
.quote-preview { display:none; position:fixed; inset:0; z-index:650; background:rgba(6,10,18,0.97); overflow-y:auto; }
.quote-preview.visible { display:block; }
.qp-topbar { position:sticky; top:0; z-index:10; background:rgba(13,20,33,0.98); backdrop-filter:blur(20px); border-bottom:1px solid rgba(255,255,255,0.07); padding:12px 20px; display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.qp-title { font-size:13px; font-weight:600; color:rgba(255,255,255,0.85); letter-spacing:-0.01em; white-space:nowrap; flex-shrink:0; }
.qp-actions { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.btn-qp-ghost { color:rgba(255,255,255,0.65) !important; border-color:rgba(255,255,255,0.13) !important; background:transparent !important; }
.btn-qp-ghost:hover { color:white !important; background:rgba(255,255,255,0.09) !important; }
.qp-body { max-width:820px; margin:32px auto 60px; padding:0 24px; }
.qp-doc { background:white; border-radius:14px; overflow:hidden; box-shadow:0 32px 80px rgba(0,0,0,0.65), 0 4px 16px rgba(0,0,0,0.25); }

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

/* Generate button in selection bar */
.btn-quote {
  background: linear-gradient(135deg, var(--brand-accent), #e07a4a);
  color: white;
  box-shadow: 0 2px 8px rgba(var(--brand-accent-rgb), 0.3);
}
.btn-quote:hover {
  transform: scale(1.02) translateY(-1px) !important;
  box-shadow: 0 4px 14px rgba(var(--brand-accent-rgb), 0.45) !important;
}

/* Loading state */
.btn-generating {
  position:relative;
  pointer-events:none;
  opacity:0.8;
}
.btn-generating::after {
  content:'';
  position:absolute;
  top:50%; left:50%;
  width:16px; height:16px;
  margin:-8px 0 0 -8px;
  border:2px solid rgba(255,255,255,0.3);
  border-top-color:white;
  border-radius:50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform:rotate(360deg) } }


/* ── LOADING SCREEN ── */
#loadingScreen {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--header-bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 20px;
  transition: opacity 500ms ease, transform 500ms ease;
}
#loadingScreen.fade-out {
  opacity: 0;
  pointer-events: none;
}
.loader-bar-track {
  width: 220px;
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 99px;
  overflow: hidden;
}
.loader-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent));
  animation: loaderPulse 1.4s ease-in-out infinite;
  transform-origin: left;
}
@keyframes loaderPulse {
  0%   { transform: scaleX(0.1) translateX(0%); }
  50%  { transform: scaleX(0.6) translateX(60%); }
  100% { transform: scaleX(0.1) translateX(200%); }
}
.loader-msg {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}
.error-screen {
  position: fixed; inset: 0; z-index: 9998;
  background: var(--header-bg);
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px; text-align: center; padding: 40px;
}
.error-screen.visible { display: flex; }

/* ────────────── LOGIN SCREEN ────────────── */
#loginScreen {
  position: fixed; inset: 0; z-index: 10000;
  background: var(--header-bg);
  background-image:
    radial-gradient(ellipse 90% 70% at 50% 38%, rgba(var(--brand-primary-rgb), 0.13) 0%, transparent 65%),
    radial-gradient(ellipse 50% 40% at 50% 10%, rgba(var(--brand-secondary-rgb), 0.08) 0%, transparent 60%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.login-card {
  background: transparent;
  padding: 48px 40px;
  width: 100%; max-width: 360px;
  text-align: left;
  animation: loginFadeUp 480ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes loginFadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.login-logo-wrap {
  position: relative;
  text-align: center;
  margin-bottom: 40px;
}
.login-logo-wrap::before {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 200px; height: 100px;
  background: radial-gradient(ellipse at center, rgba(var(--brand-primary-rgb), 0.45) 0%, transparent 70%);
  pointer-events: none;
  filter: blur(8px);
}
.login-logo-wrap img {
  position: relative; /* above the glow pseudo-element */
}
.login-title {
  margin: 0 0 28px;
  font-size: 21px; font-weight: 600; letter-spacing: -0.01em;
  color: rgba(255,255,255,0.92); text-align: center;
}
.login-field { margin-bottom: 16px; }
.login-field label {
  display: block; margin-bottom: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase;
  color: rgba(255,255,255,0.40);
}
.login-field input {
  width: 100%; box-sizing: border-box; padding: 11px 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  font: 14px var(--font-body); color: rgba(255,255,255,0.92);
  outline: none;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}
.login-field input::placeholder { color: rgba(255,255,255,0.22); }
.login-field input:focus {
  border-color: var(--brand-primary);
  background: rgba(var(--brand-primary-rgb), 0.09);
  box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb), 0.20);
}
.login-submit {
  width: 100%; justify-content: center;
  padding: 11px 16px; margin-top: 8px;
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
  border: none; border-radius: var(--radius-sm);
  color: white; font: 600 14px var(--font-body); cursor: pointer;
  box-shadow: 0 4px 16px rgba(var(--brand-primary-rgb), 0.40);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.login-submit:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 22px rgba(var(--brand-primary-rgb), 0.55);
}
.login-submit:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(var(--brand-primary-rgb), 0.30);
  transition: transform 60ms ease;
}
.login-error { color: #ff7675; font-size: 13px; margin-bottom: 16px; text-align: center; display: none; }
.login-divider { display:flex; align-items:center; gap:12px; margin:20px 0; color:rgba(255,255,255,0.25); font-size:12px; font-weight:500; letter-spacing:0.05em; text-transform:uppercase; }
.login-divider::before, .login-divider::after { content:''; flex:1; height:1px; background:rgba(255,255,255,0.10); }
.btn-google { width:100%; display:flex; align-items:center; justify-content:center; gap:10px; padding:11px 16px; background:rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.12); border-radius:var(--radius-sm); color:rgba(255,255,255,0.85); font:500 14px var(--font-body); cursor:pointer; transition:background 180ms ease, border-color 180ms ease; }
.btn-google:hover { background:rgba(255,255,255,0.10); border-color:rgba(255,255,255,0.22); }
.btn-google:disabled { opacity:0.5; cursor:not-allowed; }
@media (prefers-reduced-motion: reduce) {
  .login-card { animation: none; }
  .login-submit, .login-field input { transition: none; }
}

.error-icon { font-size: 48px; opacity: 0.6; }
.error-title { font-family: var(--font-display); font-size: 20px; font-weight: 600; color: white; }
.error-msg { font-size: 13px; color: rgba(255,255,255,0.5); max-width: 400px; line-height: 1.6; }
.error-retry { margin-top: 8px; }




/* ────────────── INLINE CELL EDITING ────────────── */
td.editable-cell {
  cursor: text;
  position: relative;
  transition: background var(--dur-fast) ease;
}
td.editable-cell:hover { background: rgba(37,138,203,0.05) !important; }

td.editable-cell:focus-within {
  background: #fff !important;
  box-shadow: inset 0 0 0 2px var(--brand-primary), 0 2px 12px rgba(37,138,203,0.13);
  z-index: 5;
  border-radius: 5px;
}

.cell-edit-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  color: inherit;
  resize: none;
  min-width: 40px;
}
textarea.cell-edit-input { line-height: 1.45; min-height: 2em; }

@keyframes cellFlashGreen {
  0%   { background: rgba(34,197,94,0.22) !important; }
  100% { background: transparent; }
}
@keyframes cellFlashRed {
  0%,100% { background: transparent; }
  30%,70% { background: rgba(239,68,68,0.18) !important; }
}
td.cell-saved  { animation: cellFlashGreen 900ms ease forwards; }
td.cell-saving { opacity: 0.55; pointer-events: none; }
td.cell-error  { animation: cellFlashRed 500ms ease; }

/* ── PRICING BADGES (product table) ── */
.price-type-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: middle;
  line-height: 1;
}
.price-type-badge.dealer { background: rgba(16,185,129,0.14); color: #059669; }
.price-type-badge.list   { background: rgba(59,130,246,0.14); color: #2563eb; }
.price-type-badge.unknown { background: rgba(245,158,11,0.14); color: #d97706; }

/* ── TABLE PRICE MODE TOGGLE ── */
.tbl-price-bar { display:flex; align-items:center; gap:6px; padding:8px 14px; border-bottom:1px solid rgba(0,0,0,0.06); background:var(--bg-elevated); }
.tbl-price-label { font-size:11px; font-weight:600; color:var(--text-tertiary); margin-right:4px; }
.tbl-mode-btn { font-size:11px; font-weight:600; padding:4px 12px; border:1px solid rgba(0,0,0,0.10); border-radius:var(--radius-sm); background:white; color:var(--text-secondary); cursor:pointer; transition:all 150ms ease; }
.tbl-mode-btn:hover { border-color:var(--brand-primary); color:var(--brand-primary); }
.tbl-mode-btn.active { background:var(--brand-primary); color:white; border-color:var(--brand-primary); }

/* ── DUAL-PRICE CELL ── */
.tbl-price-primary { font-family:var(--font-mono); font-size:13px; font-weight:600; font-variant-numeric:tabular-nums; color:var(--text-primary); white-space:nowrap; }
.tbl-price-secondary { font-family:var(--font-mono); font-size:10.5px; font-weight:500; color:var(--text-tertiary); white-space:nowrap; margin-top:1px; }

/* ── TIERS BADGE WITH CSS TOOLTIP ── */
.tbl-tier-badge { display:inline-block; font-size:8.5px; font-weight:700; letter-spacing:0.05em; padding:1px 5px; border-radius:3px; background:rgba(37,138,203,0.12); color:var(--brand-primary); margin-left:5px; vertical-align:middle; cursor:help; position:relative; }
.tbl-tier-badge::after { content:attr(data-tiers); position:absolute; bottom:calc(100% + 6px); right:0; background:#1e2a3a; color:rgba(255,255,255,0.9); font-size:10px; font-weight:500; font-family:var(--font-mono); white-space:nowrap; padding:6px 10px; border-radius:5px; opacity:0; pointer-events:none; transition:opacity 150ms ease; z-index:200; box-shadow:var(--shadow-md); }
.tbl-tier-badge:hover::after { opacity:1; }

/* ── UNCONFIRMED ROW INDICATOR ── */
tbody tr.row-unconfirmed { border-left:3px solid rgba(245,158,11,0.55); }
tbody tr.row-unconfirmed:hover { border-left-color:rgba(245,158,11,0.85); }

/* ── INACTIVE ROW ── */
tbody tr.row-inactive { opacity:0.5; }

/* ── PRICE CONFIDENCE BADGE ── */
.price-confidence-badge { display:inline-block; font-size:8.5px; font-weight:700; letter-spacing:0.04em; padding:1px 5px; border-radius:3px; margin-left:4px; vertical-align:middle; }
.price-confidence-badge.conf-level-high { background:rgba(239,68,68,0.1); color:#dc2626; }
.price-confidence-badge.conf-level-unconfirmed { background:rgba(245,158,11,0.12); color:#d97706; }
.price-confidence-badge.conf-level-partial { background:rgba(37,138,203,0.1); color:#258acb; }

/* ── QUOTE STATUS BADGE ── */
.qli-status-badge { display:inline-block; font-size:8px; font-weight:700; padding:1px 5px; border-radius:3px; margin-left:4px; background:rgba(245,158,11,0.12); color:#d97706; vertical-align:middle; }

/* ── FORM 3-COL ROW ── */
.form-row-3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:12px; }

/* ── QUOTE MODAL — Price Mode Toggle ── */
.qli-price-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 8px 12px;
  background: var(--bg-elevated, #f8fafc);
  border-radius: var(--radius-md, 5px);
  border: 1px solid rgba(0,0,0,0.06);
}
.qli-toggle-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-right: 4px;
}
.qli-toggle-btn {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px;
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: var(--radius-sm, 4px);
  background: white;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 150ms ease;
}
.qli-toggle-btn:hover { border-color: var(--brand-primary); color: var(--brand-primary); }
.qli-toggle-btn.active {
  background: var(--brand-primary, #258acb);
  color: white;
  border-color: var(--brand-primary, #258acb);
}

/* ── QUOTE LINE ITEM BADGES ── */
.qli-tier-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(37,138,203,0.12);
  color: var(--brand-primary, #258acb);
  margin-left: 6px;
  vertical-align: middle;
  white-space: nowrap;
}
.qli-ctn-hint {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-top: 3px;
  white-space: nowrap;
}
.qli-ctn-warn {
  font-size: 10px;
  color: #d97706;
  margin-top: 3px;
  white-space: nowrap;
}
.qli-moq-warn {
  font-size: 10px;
  color: #d97706;
  margin-top: 3px;
  white-space: nowrap;
}
.qli-ctn-fix {
  background: none;
  border: none;
  color: #258acb;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.qli-next-tier {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-top: 3px;
  white-space: nowrap;
}
.qli-sugg-fallback {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-tertiary);
  margin-left: 4px;
  opacity: 0.7;
}
.qli-pack-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(57,91,169,0.10);
  color: var(--brand-secondary, #395ba9);
  margin-left: 4px;
  vertical-align: middle;
}
.qli-unconfirmed-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 50%;
  background: rgba(245,158,11,0.15);
  color: #d97706;
  margin-left: 4px;
  vertical-align: middle;
  cursor: help;
}

