/* ── Tenant Admin Design System ───────────────────────────────────────────── */
:root {
  --bp-primary:       #0d9488;
  --bp-primary-dark:  #0f766e;
  --bp-primary-light: #5eead4;
  --bp-accent:        #f59e0b;
  --bp-sidebar-bg:    #0f172a;
  --bp-sidebar-text:  #94a3b8;
  --bp-sidebar-hover: rgba(255,255,255,.07);
  --bp-sidebar-w:     228px;
  --bp-topnav-h:      56px;
  --bp-page-bg:       #f5f6fa;
  --bp-card-bg:       #ffffff;
  --bp-border:        #e5e7eb;
  --bp-text:          #0f172a;
  --bp-muted:         #6b7280;
  --bp-light:         #9ca3af;
  --bp-radius:        10px;
}

* { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: .875rem;
  background: var(--bp-page-bg);
  color: var(--bp-text);
  margin: 0;
}

/* ── Top Navigation ──────────────────────────────────────────────────────── */
.bp-topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--bp-topnav-h);
  background: #fff;
  border-bottom: 1px solid var(--bp-border);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  z-index: 1040;
  gap: 1rem;
}

.bp-topnav-brand {
  display: flex;
  align-items: center;
  gap: .625rem;
  font-weight: 700;
  font-size: 1rem;
  color: var(--bp-primary);
  text-decoration: none;
  width: var(--bp-sidebar-w);
}

.bp-topnav-brand .brand-icon {
  width: 30px; height: 30px;
  background: var(--bp-primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: .875rem;
  flex-shrink: 0;
}

.bp-topnav-spacer { flex: 1; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.bp-sidebar {
  position: fixed;
  top: var(--bp-topnav-h);
  left: 0;
  bottom: 0;
  width: var(--bp-sidebar-w);
  background: var(--bp-sidebar-bg);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1030;
  padding: 1rem 0 2rem;
}

.bp-sidebar::-webkit-scrollbar { width: 4px; }
.bp-sidebar::-webkit-scrollbar-track { background: transparent; }
.bp-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 2px; }

.bp-nav-section {
  padding: .375rem 1rem .25rem;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(148,163,184,.45);
  margin-top: .75rem;
}

.bp-nav-item {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .5rem 1.25rem;
  color: var(--bp-sidebar-text);
  text-decoration: none;
  font-size: .8125rem;
  font-weight: 500;
  transition: background .15s, color .15s;
  position: relative;
}

.bp-nav-item:hover {
  background: var(--bp-sidebar-hover);
  color: #fff;
}

.bp-nav-item.active {
  background: var(--bp-primary);
  color: #fff;
}

.bp-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--bp-accent);
}

.bp-nav-item i { font-size: .9375rem; width: 16px; text-align: center; flex-shrink: 0; }

/* Brand-market-scoped nav items (Stores/Menus/etc. only make sense once a BM is selected) get a
   subtle accent rail + a small "BM" chip, distinguishing them from tenant-global items
   (Brand-Markets, Roles) that apply regardless of which BM is currently selected. */
.bp-nav-item.bp-nav-bm-scoped { border-left: 2px solid rgba(245,158,11,.35); padding-left: calc(1.25rem - 2px); }
.bp-nav-item.bp-nav-bm-scoped.active { border-left-color: var(--bp-accent); }
.bp-nav-bm-chip {
  margin-left: auto;
  font-size: .55rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: rgba(245,158,11,.85);
  border: 1px solid rgba(245,158,11,.35);
  border-radius: 4px;
  padding: .0625rem .3rem;
  flex-shrink: 0;
}
.bp-nav-item.active .bp-nav-bm-chip { color: #fff; border-color: rgba(255,255,255,.5); }

/* ── Main Content ─────────────────────────────────────────────────────────── */
.bp-content {
  margin-left: var(--bp-sidebar-w);
  margin-top: var(--bp-topnav-h);
  padding: 1.75rem;
  min-height: calc(100vh - var(--bp-topnav-h));
}

/* ── Page Header ─────────────────────────────────────────────────────────── */
.bp-page-header {
  display: flex;
  align-items: center;
  gap: .875rem;
  margin-bottom: 1.5rem;
}

.bp-page-icon {
  width: 40px; height: 40px;
  background: rgba(13,148,136,.1);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--bp-primary);
  font-size: 1rem;
  flex-shrink: 0;
}

.bp-page-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--bp-text);
  margin: 0;
  line-height: 1.2;
}

.bp-page-subtitle {
  font-size: .8rem;
  color: var(--bp-muted);
  margin: .125rem 0 0;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.bp-card {
  background: var(--bp-card-bg);
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
  padding: 1.25rem;
}

.bp-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.bp-card-title {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--bp-text);
  margin: 0;
}

/* ── Stat Cards ──────────────────────────────────────────────────────────── */
.bp-stat-card {
  background: var(--bp-card-bg);
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.bp-stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.bp-stat-icon.teal   { background: rgba(13,148,136,.1);  color: var(--bp-primary); }
.bp-stat-icon.green  { background: rgba(16,185,129,.1);  color: #059669; }
.bp-stat-icon.amber  { background: rgba(245,158,11,.1);  color: var(--bp-accent); }
.bp-stat-icon.red    { background: rgba(239,68,68,.1);   color: #ef4444; }
.bp-stat-icon.indigo { background: rgba(79,70,229,.1);   color: #4f46e5; }

.bp-stat-value { font-size: 1.625rem; font-weight: 700; line-height: 1; }
.bp-stat-label { font-size: .75rem;   color: var(--bp-muted); margin-top: .25rem; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.bp-table-wrap { overflow-x: auto; }

.bp-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

.bp-table th {
  background: #f9fafb;
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--bp-muted);
  padding: .625rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--bp-border);
  white-space: nowrap;
}

.bp-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
  color: var(--bp-text);
  font-size: .8125rem;
}

.bp-table tbody tr:hover td { background: #f9fafb; }
.bp-table tbody tr:last-child td { border-bottom: none; }

/* Denser variant for tables nested inside another card (e.g. a category's product list) */
.bp-table-compact th { padding: .4rem .75rem; }
.bp-table-compact td { padding: .5rem .75rem; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.bp-badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .25rem .625rem;
  border-radius: 99px;
  font-size: .6875rem;
  font-weight: 600;
  white-space: nowrap;
}

.bp-badge-active   { background: #d1fae5; color: #065f46; }
.bp-badge-inactive { background: #fee2e2; color: #991b1b; }
.bp-badge-pending  { background: #fef3c7; color: #92400e; }
.bp-badge-blue     { background: #dbeafe; color: #1e40af; }
.bp-badge-teal     { background: #ccfbf1; color: #0f766e; }
.bp-badge-gray     { background: #f3f4f6; color: #374151; }
.bp-badge-warning  { background: #fef3c7; color: #92400e; }
.bp-badge-danger   { background: #fee2e2; color: #991b1b; }
.bp-badge-success  { background: #d1fae5; color: #065f46; }
.bp-badge-purple   { background: #ede9fe; color: #5b21b6; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.bp-btn {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .5rem 1rem;
  border-radius: 8px;
  font-size: .8125rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s, background .15s;
  line-height: 1.4;
}

.bp-btn:disabled { opacity: .55; cursor: not-allowed; }

.bp-btn-primary { background: var(--bp-primary); color: #fff; }
.bp-btn-primary:hover:not(:disabled) { background: var(--bp-primary-dark); color: #fff; }

.bp-btn-outline { background: transparent; color: var(--bp-primary); border: 1.5px solid var(--bp-primary); }
.bp-btn-outline:hover:not(:disabled) { background: var(--bp-primary); color: #fff; }

.bp-btn-danger { background: #ef4444; color: #fff; }
.bp-btn-danger:hover:not(:disabled) { background: #dc2626; color: #fff; }

.bp-btn-sm { padding: .3rem .75rem; font-size: .75rem; border-radius: 6px; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.bp-form-section {
  background: #fff;
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.bp-form-section-title {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--bp-text);
  margin: 0 0 1.25rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--bp-border);
}

.bp-label,
.bp-form-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--bp-text);
  margin-bottom: .375rem;
}

.bp-input,
.bp-form-control {
  width: 100%;
  padding: .5rem .75rem;
  border: 1.5px solid var(--bp-border);
  border-radius: 8px;
  font-size: .875rem;
  color: var(--bp-text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

.bp-input:focus,
.bp-form-control:focus {
  border-color: var(--bp-primary);
  box-shadow: 0 0 0 3px rgba(13,148,136,.12);
}

.bp-input.is-invalid,
.bp-form-control.is-invalid { border-color: #ef4444; }
.bp-input.is-invalid:focus,
.bp-form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(239,68,68,.12); }

/* select/textarea don't inherit input styling via a type selector, so bp-form-control
   is applied directly in markup to <select>/<textarea> too — no extra rule needed since
   the class covers width/padding/border/radius identically for all three elements. */

.bp-error-msg,
.bp-form-error { color: #ef4444; font-size: .75rem; margin-top: .25rem; display: block; }

/* ── Toasts / Alerts ─────────────────────────────────────────────────────── */
.bp-alert {
  padding: .875rem 1.125rem;
  border-radius: 8px;
  font-size: .8125rem;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: 1rem;
}

.bp-alert-success { background: #d1fae5; color: #065f46; border-left: 4px solid #059669; }
.bp-alert-error   { background: #fee2e2; color: #991b1b; border-left: 4px solid #ef4444; }
.bp-alert-info    { background: #ccfbf1; color: #0f766e; border-left: 4px solid var(--bp-primary); }
.bp-alert-warn    { background: #fef3c7; color: #92400e; border-left: 4px solid var(--bp-accent); }

/* ── Search Bar ──────────────────────────────────────────────────────────── */
.bp-search-wrap { position: relative; }

.bp-search-wrap i {
  position: absolute;
  left: .75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--bp-muted);
  font-size: .875rem;
  pointer-events: none;
}

.bp-search-wrap .bp-input { padding-left: 2.25rem; }

/* ── Auth / Login Page ───────────────────────────────────────────────────── */
.bp-auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #0f766e 50%, #0d9488 100%);
  padding: 2rem;
}

.bp-auth-card {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 25px 50px rgba(0,0,0,.35);
}

.bp-auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  margin-bottom: 2rem;
}

.bp-auth-logo-icon {
  width: 44px; height: 44px;
  background: var(--bp-primary);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 1.25rem;
}

.bp-auth-logo-text {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--bp-text);
}

.bp-auth-logo-text span { color: var(--bp-primary); }

.bp-auth-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--bp-text);
  margin: 0 0 .375rem;
  text-align: center;
}

.bp-auth-subtitle {
  font-size: .8rem;
  color: var(--bp-muted);
  text-align: center;
  margin: 0 0 1.75rem;
}

.bp-auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: .75rem;
  color: var(--bp-muted);
}

/* ── Password Input Toggle ───────────────────────────────────────────────── */
.bp-password-wrap { position: relative; }
.bp-password-wrap .bp-input { padding-right: 2.5rem; }
.bp-password-toggle {
  position: absolute;
  right: .75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--bp-muted);
  padding: 0;
  font-size: .9rem;
}
.bp-password-toggle:hover { color: var(--bp-primary); }

/* ── TOTP Input ──────────────────────────────────────────────────────────── */
.bp-totp-input {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: .25em;
  padding: .75rem;
}

/* ── QR Code Setup ───────────────────────────────────────────────────────── */
.bp-qr-container { text-align: center; margin: 1.25rem 0; }

.bp-qr-container img {
  border: 8px solid #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
  border-radius: 12px;
  max-width: 180px;
}

.bp-secret-code {
  background: #f0fdf9;
  border: 1px dashed var(--bp-border);
  border-radius: 8px;
  padding: .625rem 1rem;
  font-family: 'Courier New', monospace;
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--bp-primary);
  text-align: center;
  word-break: break-all;
  margin: .75rem 0;
}

/* ── User Avatar ─────────────────────────────────────────────────────────── */
.bp-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bp-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Topnav Profile Button ───────────────────────────────────────────────── */
.bp-topnav-profile {
  display: flex;
  align-items: center;
  gap: .625rem;
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  line-height: 1;
  background: transparent;
  border: 1.5px solid var(--bp-border);
  border-radius: 50px;
  padding: .3rem .75rem .3rem .375rem;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  text-align: left;
}

.bp-topnav-profile:focus        { outline: none; }
.bp-topnav-profile:focus-visible { outline: 2px solid var(--bp-primary); outline-offset: 2px; border-radius: 50px; }

.bp-topnav-profile:hover,
.bp-topnav-profile[aria-expanded="true"] {
  background: #f5f6fa;
  border-color: #d1d5db;
}

.bp-topnav-profile-name {
  font-size: .8rem;
  font-weight: 600;
  color: var(--bp-text);
  line-height: 1.2;
}

.bp-topnav-profile-email {
  font-size: .7rem;
  color: var(--bp-muted);
  line-height: 1.2;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bp-topnav-chevron {
  font-size: .65rem;
  color: var(--bp-muted);
  margin-left: .125rem;
  transition: transform .2s;
}

.bp-topnav-profile[aria-expanded="true"] .bp-topnav-chevron {
  transform: rotate(180deg);
}

/* ── Brand-Market Selector Chip ─────────────────────────────────────────── */
.bp-bm-selector {
  display: flex;
  align-items: center;
  gap: .375rem;
  padding: .3rem .75rem;
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  border-radius: 999px;
  color: var(--bp-primary-dark, #0f766e);
  font-size: .813rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.bp-bm-selector:hover,
.bp-bm-selector[aria-expanded="true"] {
  background: var(--bp-primary-dark, #0f766e);
  border-color: var(--bp-primary-dark, #0f766e);
  color: #fff;
}
.bp-bm-selector[aria-expanded="true"] .bp-topnav-chevron {
  transform: rotate(180deg);
  color: inherit;
}
.bp-bm-selector-name {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bp-dropdown-item.active {
  background: #f0fdfa;
  color: var(--bp-primary-dark, #0f766e);
  font-weight: 600;
}

/* ── Dropdown Profile Header ─────────────────────────────────────────────── */
.bp-dropdown-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
}

.bp-avatar-lg { width: 40px; height: 40px; font-size: .875rem; flex-shrink: 0; }

.bp-dropdown-header-name {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--bp-text);
  line-height: 1.2;
}

.bp-dropdown-header-email {
  font-size: .75rem;
  color: var(--bp-muted);
  line-height: 1.4;
  word-break: break-all;
}

/* ── Dropdown ────────────────────────────────────────────────────────────── */
.dropdown-menu {
  display: none;
  position: absolute;
  z-index: 1050;
  list-style: none;
  margin: 0;
  padding: 0;
  background: #fff;
}
.dropdown-menu.show { display: block; }

.bp-dropdown-menu {
  min-width: 220px;
  padding: .375rem 0;
  border: 1px solid var(--bp-border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}

.bp-dropdown-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  padding: .5rem 1rem;
  font-family: inherit;
  font-size: .8125rem;
  color: var(--bp-text);
  cursor: pointer;
  text-align: left;
  background: transparent;
  border: none;
  text-decoration: none;
  line-height: 1.4;
}

.bp-dropdown-item:hover { background: #f9fafb; }

.bp-dropdown-item-danger       { color: #ef4444; }
.bp-dropdown-item-danger:hover { background: #fef2f2; color: #dc2626; }

.bp-dropdown-divider { border-top: 1px solid var(--bp-border); margin: .25rem 0; }

/* ── Utilities ───────────────────────────────────────────────────────────── */
.bp-flex         { display: flex; }
.bp-flex-col     { display: flex; flex-direction: column; }
.bp-items-center { align-items: center; }
.bp-gap-1        { gap: .5rem; }
.bp-gap-2        { gap: 1rem; }
.bp-mb-1         { margin-bottom: .5rem; }
.bp-mb-2         { margin-bottom: 1rem; }
.bp-mb-3         { margin-bottom: 1.5rem; }
.bp-text-muted   { color: var(--bp-muted); }
.bp-text-sm      { font-size: .75rem; }
.bp-fw-600       { font-weight: 600; }
.bp-w-100        { width: 100%; }
.d-none          { display: none !important; }
.d-md-block      { display: none; }
@media (min-width: 768px) { .d-md-block { display: block !important; } }

/* ── Toasts (stacked, auto-dismiss — replaces the old static banner) ───────── */
.bp-toast-stack {
  position: fixed;
  top: calc(var(--bp-topnav-h) + 1rem);
  right: 1rem;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  gap: .625rem;
  width: 340px;
  max-width: calc(100vw - 2rem);
}

.bp-toast {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
  padding: .875rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: .625rem;
  border-left: 4px solid var(--bp-border);
  animation: bp-toast-in .2s ease-out;
}

.bp-toast.bp-toast-success { border-left-color: #059669; }
.bp-toast.bp-toast-error   { border-left-color: #ef4444; }

.bp-toast i { font-size: 1.05rem; flex-shrink: 0; margin-top: .0625rem; }
.bp-toast.bp-toast-success i { color: #059669; }
.bp-toast.bp-toast-error i   { color: #ef4444; }

.bp-toast-body { flex: 1; font-size: .8125rem; color: var(--bp-text); }

.bp-toast-close {
  background: none; border: none; color: var(--bp-muted); cursor: pointer;
  padding: 0; line-height: 1; font-size: .9rem; flex-shrink: 0;
}
.bp-toast-close:hover { color: var(--bp-text); }

@keyframes bp-toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.bp-toast.bp-toast-hide { animation: bp-toast-out .15s ease-in forwards; }
@keyframes bp-toast-out { to { opacity: 0; transform: translateX(12px); } }

/* ── Image preview (bound to an Image URL text input or file picker) ───────── */
.bp-image-preview {
  width: 90px; height: 90px;
  border-radius: 8px;
  border: 1.5px dashed var(--bp-border);
  background: #f9fafb center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  color: var(--bp-light);
  font-size: 1.25rem;
  flex-shrink: 0;
  overflow: hidden;
}
.bp-image-preview img { width: 100%; height: 100%; object-fit: cover; }
.bp-image-preview.has-image { border-style: solid; }

/* ── Mapping picker checkbox list (search-filterable "available" panel) ─────── */
.bp-picker-list {
  max-height: 260px;
  overflow-y: auto;
  border: 1.5px solid var(--bp-border);
  border-radius: 8px;
  padding: .25rem;
}
.bp-picker-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: .8125rem;
  margin: 0;
}
.bp-picker-row:hover { background: #f9fafb; }
.bp-picker-row input[type="checkbox"] { flex-shrink: 0; }
.bp-picker-row-label { flex: 1; }
.bp-picker-row.bp-picker-row-hidden { display: none; }

/* ── Drag-reorder list (SortableJS-backed) ──────────────────────────────────── */
.bp-reorder-list { list-style: none; margin: 0; padding: 0; }
.bp-reorder-item {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .5rem .75rem;
  border: 1px solid var(--bp-border);
  border-radius: 8px;
  background: #fff;
  margin-bottom: .375rem;
  cursor: grab;
}
.bp-reorder-item:active { cursor: grabbing; }
.bp-reorder-item .bp-reorder-handle { color: var(--bp-light); font-size: .9rem; }
.bp-reorder-item.sortable-ghost { opacity: .4; }
.bp-reorder-item.sortable-drag { box-shadow: 0 8px 20px rgba(0,0,0,.15); }

/* ── Mapping picker shell (used by both the wizard and the structure-map drawer) ──
   Flexbox + flex-basis wrapping responds to the CONTAINER's width, not the viewport's —
   unlike Bootstrap's col-md-6, this correctly stacks to one column inside a narrow
   480px drawer even though the page itself is well past the md breakpoint. */
.bp-picker-cols { display: flex; flex-wrap: wrap; gap: 1.25rem; padding: 1.125rem; }
.bp-picker-col { flex: 1 1 260px; min-width: 220px; }
.bp-picker-col-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .5rem;
}
.bp-picker-col-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--bp-muted);
}
.bp-picker-col-count {
  font-size: .68rem;
  font-weight: 700;
  color: var(--bp-muted);
  background: #f3f4f6;
  border-radius: 99px;
  padding: .05rem .5rem;
}
.bp-picker-col-hint { font-size: .7rem; color: var(--bp-light); margin: -.25rem 0 .5rem; }
.bp-picker-empty {
  font-size: .78rem;
  color: var(--bp-light);
  border: 1.5px dashed var(--bp-border);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}
.bp-picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .875rem 1.125rem;
  border-top: 1px solid var(--bp-border);
  background: #fafbfc;
  border-radius: 0 0 var(--bp-radius) var(--bp-radius);
}
.bp-picker-footer-hint { font-size: .7rem; color: var(--bp-light); }
.bp-picker-price-input { width: 96px; flex-shrink: 0; }

/* ── Wizard step bar ─────────────────────────────────────────────────────────── */
.bp-wizard-steps {
  display: flex;
  align-items: center;
  margin-bottom: 1.5rem;
}
.bp-wizard-step {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--bp-muted);
  font-size: .8125rem;
  font-weight: 600;
}
.bp-wizard-step-dot {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #f3f4f6;
  color: var(--bp-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  flex-shrink: 0;
}
.bp-wizard-step.active .bp-wizard-step-dot { background: var(--bp-primary); color: #fff; }
.bp-wizard-step.active { color: var(--bp-text); }
.bp-wizard-step.done .bp-wizard-step-dot { background: #065f46; color: #fff; }
.bp-wizard-connector { flex: 1; height: 2px; background: var(--bp-border); margin: 0 .75rem; }
.bp-wizard-connector.done { background: #059669; }
.bp-wizard-pane { display: none; }
.bp-wizard-pane.active { display: block; }

/* ── View switcher tabs (e.g. Templates list ↔ Structure map) ──────────────── */
.bp-view-tabs {
  display: inline-flex;
  background: #f3f4f6;
  border-radius: 8px;
  padding: .2rem;
  gap: .2rem;
}
.bp-view-tab {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .4rem .875rem;
  border: none;
  background: transparent;
  color: var(--bp-muted);
  font-size: .8125rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
}
.bp-view-tab.active { background: #fff; color: var(--bp-text); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.bp-view-tab:hover:not(.active) { color: var(--bp-text); }

/* ── Structure map (fixed 5-column node graph: Template → Categories → Products →
   Modifier Groups → Modifiers, matching the MVP prototype's tenant-admin/menu/templates/list.html) */
.bp-map-shell {
  position: relative;
  background: radial-gradient(circle at 20% 50%, #f8faff 0%, #f5f6fa 100%);
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
  height: calc(100vh - var(--bp-topnav-h) - 13rem);
  min-height: 480px;
  overflow: hidden;
  cursor: grab;
  user-select: none;
}
.bp-map-shell.bp-map-panning { cursor: grabbing; }

.bp-map-canvas {
  position: absolute;
  top: 0; left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.bp-map-svg { position: absolute; top: 0; left: 0; pointer-events: none; overflow: visible; }
.bp-map-edge { fill: none; stroke-width: 1.5px; opacity: .35; transition: opacity .15s, stroke-width .15s; }
.bp-map-edge.bp-map-edge-lit { opacity: .9; stroke-width: 2.5px; }
.bp-map-edge.bp-map-edge-dim { opacity: .08; }

.bp-map-col-hdr {
  position: absolute;
  text-align: center;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .25rem .625rem;
  background: rgba(255,255,255,.9);
  border-radius: 6px;
  border: 1px solid;
}

.bp-map-node {
  position: absolute;
  border-radius: 10px;
  border: 2px solid;
  padding: .5rem .625rem;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  cursor: default;
  transition: box-shadow .15s, opacity .2s;
  overflow: hidden;
}
.bp-map-node:hover { box-shadow: 0 4px 18px rgba(0,0,0,.14); }
.bp-map-node-name { font-weight: 700; font-size: .8rem; line-height: 1.3; padding-right: 1.25rem; color: var(--bp-text); }
.bp-map-node-sub  { font-size: .72rem; color: var(--bp-muted); margin-top: .2rem; line-height: 1.4; }
.bp-map-node-override .bp-map-node-sub del { opacity: .5; margin-right: .25rem; }

.bp-map-node-edit-btn {
  position: absolute;
  top: .3rem; right: .3rem;
  background: transparent;
  border: none;
  color: #d1d5db;
  cursor: pointer;
  padding: .1rem .25rem;
  border-radius: 4px;
  font-size: .72rem;
  line-height: 1;
}
.bp-map-node-edit-btn:hover { background: #f3f4f6; color: var(--bp-text); }

.bp-map-toolbar {
  position: absolute;
  bottom: .75rem;
  right: .75rem;
  z-index: 5;
  display: flex;
  gap: .3rem;
  align-items: center;
}
.bp-map-toolbar button {
  background: rgba(255,255,255,.92);
  border: 1px solid var(--bp-border);
  border-radius: 8px;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: .82rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
}
.bp-map-toolbar button:hover { background: #f3f4f6; }
.bp-map-zoom-label {
  background: rgba(255,255,255,.92);
  border: 1px solid var(--bp-border);
  border-radius: 8px;
  height: 30px; padding: 0 .5rem;
  font-size: .72rem; font-weight: 700; color: var(--bp-muted);
  min-width: 44px; text-align: center; line-height: 30px;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
}

.bp-map-legend {
  position: absolute;
  top: .75rem;
  left: .75rem;
  z-index: 5;
  background: rgba(255,255,255,.92);
  border: 1px solid var(--bp-border);
  border-radius: 8px;
  padding: .5rem .75rem;
  font-size: .68rem;
  color: var(--bp-muted);
}
.bp-map-legend-item { display: flex; align-items: center; gap: .375rem; margin-bottom: .2rem; }
.bp-map-legend-item:last-child { margin-bottom: 0; }
.bp-map-legend-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.bp-map-legend-override { margin-top: .3rem; padding-top: .3rem; border-top: 1px solid #f3f4f6; }

.bp-map-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  color: var(--bp-muted);
  font-size: .8125rem;
  background: var(--bp-card-bg);
  z-index: 6;
}

.bp-map-hint {
  position: absolute;
  bottom: .75rem;
  left: .75rem;
  z-index: 5;
  font-size: .7rem;
  color: var(--bp-light);
  pointer-events: none;
}

.bp-map-empty {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--bp-light);
  pointer-events: none;
}

.bp-map-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.35);
  z-index: 1090;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.bp-map-drawer-backdrop.bp-map-drawer-open { opacity: 1; pointer-events: auto; }

.bp-map-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 480px;
  max-width: 92vw;
  background: var(--bp-card-bg);
  z-index: 1091;
  box-shadow: -8px 0 30px rgba(0,0,0,.15);
  transform: translateX(100%);
  transition: transform .25s ease;
  display: flex;
  flex-direction: column;
}
.bp-map-drawer.bp-map-drawer-open { transform: translateX(0); }

.bp-map-drawer-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.125rem 1.25rem .875rem;
  border-bottom: 1px solid var(--bp-border);
  flex-shrink: 0;
}
.bp-map-drawer-dot {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.bp-map-drawer-header-text { flex: 1; min-width: 0; }
.bp-map-drawer-title { font-size: .92rem; font-weight: 700; margin: 0; }
.bp-map-drawer-subtitle { font-size: .73rem; color: var(--bp-light); margin: .1rem 0 0; }
.bp-map-drawer-close {
  border: none; background: transparent; color: var(--bp-muted);
  font-size: 1.1rem; cursor: pointer; line-height: 1; padding: .25rem;
}
.bp-map-drawer-close:hover { color: var(--bp-text); }

.bp-map-drawer-body { flex: 1; overflow-y: auto; padding: 1.25rem; }
.bp-map-drawer-body .bp-card { border: none; padding: 0; }
.bp-map-drawer-body .bp-card-header { display: none; }
