/* ========================================================================
   Overlays: drawer, modal, command palette, notifications, banner
   ======================================================================== */

/* ── Drawer ──────────────────────────────────────────────── */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(2px);
  z-index: 40;
  opacity: 0;
  transition: opacity var(--dur) var(--ease-out);
  pointer-events: none;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0; right: 0;
  height: 100vh;
  width: 520px;
  max-width: 92vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  z-index: 41;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--dur-slow) var(--ease-out);
}
.drawer.open { transform: translateX(0); }
.drawer.wide { width: 680px; }

.drawer-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.drawer-title {
  font-size: var(--t-15);
  font-weight: 600;
  letter-spacing: -0.008em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.drawer-close {
  margin-left: auto;
  width: 28px; height: 28px;
  border-radius: var(--r-4);
  display: grid; place-items: center;
  color: var(--text-muted);
}
.drawer-close:hover { background: var(--surface-hover); color: var(--text); }
.drawer-close svg { width: 14px; height: 14px; }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.drawer-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.drawer-foot .left { margin-right: auto; font-size: var(--t-12); color: var(--text-subtle); }

/* ── Modal ───────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(3px);
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--r-16);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  overflow: hidden;
  transform: translateY(8px) scale(0.98);
  opacity: 0;
  animation: modal-in var(--dur) var(--ease-out) forwards;
}
.modal.md { max-width: 600px; }
.modal.lg { max-width: 780px; }
@keyframes modal-in {
  to { transform: none; opacity: 1; }
}

.modal-head {
  padding: 18px 22px 10px;
}
.modal-title {
  font-size: var(--t-16);
  font-weight: 600;
  letter-spacing: -0.012em;
  margin: 0;
}
.modal-sub {
  font-size: var(--t-13);
  color: var(--text-muted);
  margin: 4px 0 0;
}
.modal-body { padding: 8px 22px 18px; }
.modal-foot {
  padding: 12px 22px;
  background: var(--surface-2);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Command palette ────────────────────────────────────── */
.cmdk-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(4px);
  z-index: 60;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}
.cmdk-backdrop.open { display: flex; }
.cmdk {
  width: 640px;
  max-width: 90vw;
  background: var(--surface);
  border-radius: var(--r-12);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  overflow: hidden;
  transform: translateY(-8px);
  opacity: 0;
  animation: modal-in var(--dur) var(--ease-out) forwards;
}
.cmdk-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.cmdk-search svg { width: 16px; height: 16px; color: var(--text-subtle); }
.cmdk-search input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  font-size: var(--t-15);
  color: var(--text);
}
.cmdk-search input::placeholder { color: var(--text-faint); }
.cmdk-list {
  max-height: 400px;
  overflow-y: auto;
  padding: 8px;
}
.cmdk-group-title {
  padding: 10px 10px 4px;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 600;
}
.cmdk-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-6);
  font-size: var(--t-13);
  color: var(--text-2);
  cursor: pointer;
}
.cmdk-item:hover, .cmdk-item.is-active {
  background: var(--primary-soft);
  color: var(--primary-text);
}
.cmdk-item svg { width: 15px; height: 15px; color: var(--text-muted); }
.cmdk-item:hover svg, .cmdk-item.is-active svg { color: var(--primary); }
.cmdk-item-shortcut { margin-left: auto; display: flex; gap: 3px; }
.cmdk-foot {
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 11.5px;
  color: var(--text-subtle);
}
.cmdk-foot .hint-item { display: flex; align-items: center; gap: 5px; }

/* ── Notifications sheet ────────────────────────────────── */
.notif-sheet {
  position: fixed;
  top: calc(var(--header-h) + 4px);
  right: 16px;
  width: 380px;
  max-height: 70vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-10);
  box-shadow: var(--shadow-xl);
  z-index: 30;
  overflow: hidden;
  display: none;
  flex-direction: column;
  transform: translateY(-6px);
  opacity: 0;
  animation: modal-in var(--dur) var(--ease-out) forwards;
}
.notif-sheet.open { display: flex; }
.notif-head {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}
.notif-head .notif-title { font-weight: 600; font-size: var(--t-13); }
.notif-head .spacer { flex: 1; }
.notif-tabs { display: flex; gap: 2px; padding: 4px; }
.notif-tab { padding: 4px 10px; font-size: var(--t-12); color: var(--text-muted); border-radius: var(--r-4); }
.notif-tab.on { background: var(--surface-hover); color: var(--text); font-weight: 500; }
.notif-list { flex: 1; overflow-y: auto; }
.notif-item {
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
}
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: color-mix(in oklab, var(--primary-soft) 30%, var(--surface)); }
.notif-icon {
  width: 28px; height: 28px;
  border-radius: var(--r-full);
  display: grid; place-items: center;
  flex-shrink: 0;
  background: var(--bg-sunken);
  color: var(--text-muted);
}
.notif-icon.success { background: var(--success-50); color: var(--success-600); }
.notif-icon.warning { background: var(--warning-50); color: var(--warning-600); }
.notif-icon.brand { background: var(--primary-soft); color: var(--primary-text); }
.notif-icon.danger { background: var(--danger-50); color: var(--danger-600); }
.notif-icon svg { width: 14px; height: 14px; }
.notif-body { flex: 1; min-width: 0; }
.notif-text { font-size: var(--t-13); color: var(--text); line-height: 1.4; }
.notif-text b { font-weight: 600; }
.notif-time { font-size: 11px; color: var(--text-subtle); margin-top: 3px; font-family: var(--font-mono); }
.notif-unread-dot {
  width: 6px; height: 6px;
  border-radius: var(--r-full);
  background: var(--primary);
  flex-shrink: 0;
  margin-top: 11px;
}
.notif-foot {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  text-align: center;
  font-size: var(--t-12);
  color: var(--primary-text);
  cursor: pointer;
  font-weight: 500;
}

/* ── Vendor status banner ───────────────────────────────── */
.vendor-banner {
  margin-bottom: 20px;
  border-radius: var(--r-10);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid;
  box-shadow: var(--shadow-sm);
}
.vendor-banner.onboarding {
  background: linear-gradient(135deg, oklch(0.97 0.04 240) 0%, oklch(0.98 0.02 270) 100%);
  border-color: color-mix(in oklab, var(--info-500) 20%, transparent);
  color: var(--info-600);
}
[data-theme="dark"] .vendor-banner.onboarding {
  background: linear-gradient(135deg, oklch(0.26 0.08 240) 0%, oklch(0.22 0.06 275) 100%);
  color: oklch(0.9 0.08 220);
  border-color: color-mix(in oklab, var(--info-500) 30%, transparent);
}
.vendor-banner.warning {
  background: var(--warning-50);
  border-color: color-mix(in oklab, var(--warning-500) 30%, transparent);
  color: var(--warning-600);
}
.vendor-banner-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-8);
  background: color-mix(in oklab, currentColor 14%, transparent);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.vendor-banner-icon svg { width: 18px; height: 18px; }
.vendor-banner-body { flex: 1; min-width: 0; }
.vendor-banner-title { font-weight: 600; font-size: var(--t-14); color: var(--text); letter-spacing: -0.008em; }
.vendor-banner-desc { font-size: var(--t-12); color: var(--text-muted); margin-top: 2px; }
.vendor-banner-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: var(--t-12);
}
.vendor-banner-progress .bar { width: 140px; height: 6px; }

/* ── AI chatbot bubble (vendor panel) ───────────────────── */
.ai-fab {
  position: fixed;
  bottom: 20px; right: 20px;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 10px;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--r-full);
  box-shadow: var(--shadow-lg);
  font-size: var(--t-13);
  font-weight: 500;
}
.ai-fab:hover { transform: translateY(-1px); box-shadow: var(--shadow-xl); }
[data-theme="dark"] .ai-fab { background: white; color: var(--n-950); }
.ai-fab-icon {
  width: 22px; height: 22px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, oklch(0.75 0.18 30), oklch(0.6 0.2 300));
  display: grid; place-items: center;
  color: white;
  font-size: 10px;
}
.ai-fab-icon svg { width: 12px; height: 12px; }

/* ── Toast ──────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 14px;
  border-radius: var(--r-8);
  font-size: var(--t-13);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-xl);
  z-index: 70;
}
[data-theme="dark"] .toast { background: white; color: var(--n-950); }
.toast svg { width: 14px; height: 14px; color: var(--success-400); }

/* ── Tweaks panel ───────────────────────────────────────── */
.tweaks {
  position: fixed;
  bottom: 20px; right: 20px;
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-12);
  box-shadow: var(--shadow-xl);
  z-index: 35;
  overflow: hidden;
  display: none;
}
.tweaks.open { display: block; }
.tweaks-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.tweaks-title { font-weight: 600; font-size: var(--t-13); }
.tweaks-body { padding: 12px 14px; max-height: 70vh; overflow-y: auto; }
.tweak-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.tweak-label {
  font-size: var(--t-12);
  color: var(--text-muted);
}
.tweak-seg {
  display: inline-flex;
  background: var(--bg-sunken);
  border-radius: var(--r-6);
  padding: 2px;
  gap: 2px;
}
.tweak-seg button {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: var(--r-4);
  color: var(--text-muted);
}
.tweak-seg button.on {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
  font-weight: 500;
}
