:root {
  --bg: #0b1120;
  --surface: #111827;
  --surface-2: #1e293b;
  --surface-3: #273449;
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.28);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #38bdf8;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --bottom-nav-h: 64px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  overflow-x: clip;
  min-height: 100dvh;
}

.hidden { display: none !important; }
.muted { color: var(--text-muted); margin: 0; }
.small { font-size: 12px; }
.text-info { color: var(--info); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }

/* ================= LOGIN SCREEN ================= */
.login-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at top, rgba(99, 102, 241, 0.2), transparent 55%), var(--bg);
}

.login-card {
  width: 100%;
  max-width: 390px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow);
}

.login-logo {
  text-align: center;
  margin-bottom: 22px;
}
.login-logo h1 {
  margin: 12px 0 4px;
  font-size: 20px;
}
.login-logo p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}
.login-hint {
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}
.login-hint code {
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 5px;
  color: #c7d2fe;
}
.form-error {
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

/* ================= APP SHELL & TOPBAR ================= */
.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom) + 12px);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(11, 17, 32, 0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.brand-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}
.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.brand-text strong {
  font-size: 15px;
  letter-spacing: -0.01em;
}
.brand-text span {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.desktop-nav {
  display: none;
  gap: 4px;
  background: var(--surface);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.nav-pill {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 7px 13px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.nav-pill:hover { color: var(--text); }
.nav-pill.active {
  background: var(--primary);
  color: #fff;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  background: var(--warning);
  color: #0b1120;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
}

/* Live SSE Banner */
.live-job-banner {
  border-top: 1px solid var(--border);
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.14), rgba(16, 185, 129, 0.12));
}
.live-job-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 8px 14px 10px;
}
.live-job-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.live-job-pct {
  margin-left: auto;
  font-weight: 700;
  color: var(--info);
}
.live-job-msg {
  font-size: 12px;
  color: var(--text-muted);
  margin: 2px 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.progress-track {
  height: 5px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  transition: width 0.25s ease;
}
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ================= MAIN & TABS ================= */
.main-content {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 14px;
  flex: 1;
}

.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn 0.18s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.section-head h2 {
  margin: 0 0 2px;
  font-size: 19px;
  letter-spacing: -0.02em;
}

/* ================= CARDS & FORMS ================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 14px;
}
.card h3 {
  margin: 0 0 6px;
  font-size: 16px;
}
.card h4 {
  margin: 0 0 8px;
  font-size: 14px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.stack-md { display: flex; flex-direction: column; gap: 14px; }
.divider-top { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 14px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field label {
  font-size: 12px;
  font-weight: 600;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 6px;
}
.field input,
.field select {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.field input:focus,
.field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

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

/* ================= BUTTONS ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.48; cursor: not-allowed; }
.btn-sm { min-height: 36px; padding: 6px 11px; font-size: 12px; }
.btn-lg { min-height: 46px; font-size: 15px; }
.btn-block { width: 100%; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-3); }
.btn-success { background: var(--success); color: #052e16; }
.btn-warning { background: var(--warning); color: #1c1917; }
.btn-danger { background: rgba(239, 68, 68, 0.18); color: #fca5a5; border-color: rgba(239, 68, 68, 0.4); }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ================= DASHBOARD KPIs ================= */
.price-alert-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.18), rgba(245, 158, 11, 0.14));
  border: 1px solid rgba(239, 68, 68, 0.45);
}
.price-alert-body {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.price-alert-ico { font-size: 22px; flex-shrink: 0; }
.price-alert-banner strong { display: block; color: #fecaca; font-size: 14px; }

.pf-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
@media (min-width: 540px) {
  .pf-summary-grid { grid-template-columns: repeat(4, 1fr); }
}

.st-price-crit { background: rgba(239, 68, 68, 0.24); color: #fecaca; border: 1px solid rgba(239, 68, 68, 0.45); }
.st-price-low { background: rgba(249, 115, 22, 0.22); color: #fed7aa; border: 1px solid rgba(249, 115, 22, 0.42); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.kpi-card {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.kpi-card.accent::before { background: var(--primary); }
.kpi-card.warning::before { background: var(--warning); }
.kpi-card.success::before { background: var(--success); }
.kpi-card.danger::before { background: var(--danger); }
.kpi-card:hover { border-color: var(--border-strong); }
.kpi-card:active { transform: scale(0.98); }

.kpi-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.kpi-val { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.kpi-sub { font-size: 11px; color: var(--text-muted); }

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.mini-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 8px;
  text-align: center;
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.mini-num { font-size: 19px; font-weight: 800; }
.mini-lbl { font-size: 11px; color: var(--text-muted); line-height: 1.25; }

.provider-quick-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.prov-quick-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 4px solid rgba(148, 163, 184, 0.35);
  border-radius: var(--radius-sm);
}
.prov-quick-item.sync-ok { border-left-color: var(--success); }
.prov-quick-item.sync-stale { border-left-color: var(--warning); }
.prov-quick-item.sync-pending { border-left-color: rgba(148, 163, 184, 0.35); }
.prov-quick-meta { min-width: 0; }
.prov-quick-meta strong { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 14px; }
.prov-quick-meta span.meta-sub { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.b2b-sync-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.sync-summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
}
.b2b-card.sync-ok { border-left: 4px solid var(--success); }
.b2b-card.sync-stale { border-left: 4px solid var(--warning); }
.b2b-card.sync-pending { border-left: 4px solid rgba(148, 163, 184, 0.3); }

/* ================= COMPARATOR ================= */
.filter-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-ico {
  position: absolute;
  left: 12px;
  font-size: 14px;
  pointer-events: none;
}
.search-box input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px 10px 36px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.search-box input:focus { border-color: var(--primary); }

.filter-selects {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.filter-selects select {
  min-height: 40px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
}

.batch-bar {
  position: sticky;
  top: 58px;
  z-index: 25;
  background: #1e1b4b;
  border: 1px solid rgba(99, 102, 241, 0.5);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.batch-btns { display: flex; flex-wrap: wrap; gap: 6px; }

/* Mobile Product Cards */
.mobile-product-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.prod-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
}
.prod-card-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.prod-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-2);
  flex-shrink: 0;
}
.prod-info {
  flex: 1;
  min-width: 0;
}
.prod-title {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.3;
  margin-bottom: 3px;
}
.prod-codes {
  font-size: 11px;
  color: var(--text-muted);
  word-break: break-all;
}
.prod-metrics-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.pm-box {
  background: var(--surface-2);
  border-radius: 7px;
  padding: 6px 7px;
  text-align: center;
}
.pm-box span { display: block; font-size: 10px; color: var(--text-muted); }
.pm-box strong { font-size: 12px; }

.prod-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}
.prod-card-actions .btn-row { justify-content: flex-end; flex: 1; }

/* Badges & Status Pills */
.status-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.st-ok { background: rgba(16, 185, 129, 0.16); color: #6ee7b7; }
.st-diff { background: rgba(245, 158, 11, 0.18); color: #fcd34d; }
.st-price { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }
.st-unmapped { background: rgba(239, 68, 68, 0.14); color: #fda4af; }
.st-not_created { background: rgba(56, 189, 248, 0.16); color: #7dd3fc; }
.st-draft { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; }

.pill-mini {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
}
.pill-mini.warn {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
}

.stock-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12px;
}
.stock-in { background: rgba(16, 185, 129, 0.16); color: #6ee7b7; }
.stock-out { background: rgba(239, 68, 68, 0.16); color: #fca5a5; }
.stock-neutral { background: rgba(148, 163, 184, 0.16); color: #cbd5e1; }

/* Desktop Table */
.desktop-table-wrap {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
}
.data-table tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.col-check { width: 34px; text-align: center; }

.table-prod-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 340px;
}
.table-prod-cell .prod-thumb { width: 40px; height: 40px; }

.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}
.pagination-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}
.page-pill {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

/* ================= B2B CARDS ================= */
.b2b-cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.b2b-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.b2b-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.b2b-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 17px;
  flex-shrink: 0;
}
.b2b-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.b2b-card-title h3 { margin: 0; font-size: 15px; }
.b2b-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  color: #cbd5e1;
}
.b2b-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ================= CRON & LOGS ================= */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
}
.toggle-input {
  width: 22px;
  height: 22px;
  accent-color: var(--primary);
}
.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
}
.chip:hover { border-color: var(--primary); color: #c7d2fe; }

.check-group { display: flex; flex-direction: column; gap: 8px; }
.check-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}
.check-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.logs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.log-row {
  padding: 10px 12px;
  background: var(--surface-2);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.log-row.ok { border-left-color: var(--success); }
.log-row.error { border-left-color: var(--danger); }
.log-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}
.log-msg { font-size: 13px; }

/* ================= SETTINGS ================= */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.provider-settings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.prov-set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.prov-set-info { min-width: 0; }
.prov-set-info strong { display: block; font-size: 13px; }
.prov-set-info span { font-size: 11px; color: var(--text-muted); }

.backup-btn-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

/* ================= MOBILE BOTTOM NAV ================= */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(17, 24, 39, 0.96);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}
.bnav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
}
.bnav-btn.active { color: #a5b4fc; }
.bnav-ico { font-size: 18px; line-height: 1; }
.bnav-badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 22px);
  background: var(--warning);
  color: #0b1120;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 999px;
}

/* ================= MODALS ================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}
.modal-sheet {
  position: relative;
  width: 100%;
  max-width: 680px;
  max-height: 90dvh;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 18px 18px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.modal-head {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.modal-head h3 { margin: 0 0 2px; }
.icon-close {
  background: var(--surface-2);
  border: none;
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
}
.modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}
.modal-foot {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.preview-box { margin-top: 14px; }
.scroll-x { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
.preview-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.preview-table th, .preview-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.preview-table th { background: var(--surface-2); color: var(--text-muted); }

/* ================= TOASTS ================= */
.toast-container {
  position: fixed;
  top: 70px;
  right: 12px;
  left: 12px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--primary);
  color: var(--text);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 13px;
  pointer-events: auto;
  animation: fadeIn 0.2s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

.empty-state {
  text-align: center;
  padding: 28px 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.hide-xs { display: none; }
.show-xs { display: inline-flex; }

/* ================= RESPONSIVE >= 768px (TABLET / DESKTOP) ================= */
@media (min-width: 768px) {
  .app-shell { padding-bottom: 24px; }
  .desktop-nav { display: flex; }
  .bottom-nav { display: none; }
  .hide-xs { display: inline-flex; }
  .show-xs { display: none; }

  .kpi-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; }
  .provider-quick-grid { grid-template-columns: repeat(2, 1fr); }
  .b2b-cards-grid { grid-template-columns: repeat(2, 1fr); }
  .settings-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row-2 { grid-template-columns: 1fr 1fr; }

  .filter-panel { flex-direction: row; align-items: center; }
  .search-box { flex: 1; }
  .filter-selects { width: auto; min-width: 380px; }

  .mobile-product-list { display: none; }
  .desktop-table-wrap { display: block; }

  .modal { align-items: center; padding: 20px; }
  .modal-sheet { border-radius: 16px; }

  .toast-container { left: auto; width: 360px; }
}

@media (min-width: 1080px) {
  .provider-quick-grid { grid-template-columns: repeat(3, 1fr); }
  .b2b-cards-grid { grid-template-columns: repeat(3, 1fr); }
}
