/* =========================================================
   Outbound CRM - Shell: Sidebar + Top Bar (v4 · Themed)
   ========================================================= */

:root {
  --sb-w-full: 252px;
  --sb-w-mini: 76px;
  --sb-gap: 14px;
}

.app {
  display: grid;
  grid-template-columns: var(--sb-w-full) 1fr;
  min-height: 100vh;
  position: relative;
  z-index: 1;
  transition: grid-template-columns 0.28s cubic-bezier(.4,.0,.2,1);
}
.app.sb-mini { grid-template-columns: var(--sb-w-mini) 1fr; }

/* ============== Sidebar (floating glass) ============== */
.sidebar {
  position: sticky;
  top: var(--sb-gap);
  height: calc(100vh - var(--sb-gap) * 2);
  margin: var(--sb-gap) 0 var(--sb-gap) var(--sb-gap);
  background: var(--sidebar-bg);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  color: var(--text);
  display: flex;
  flex-direction: column;
  z-index: 30;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-pop);
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.sidebar::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--sidebar-glow);
  pointer-events: none;
  transition: background 0.3s ease;
}
.sidebar > * { position: relative; }

/* ---------- Brand ---------- */
.sb-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 16px 16px;
  border-bottom: 1px solid var(--line-2);
  position: relative;
}
.sb-logo-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: var(--grad-primary);
  border-radius: 11px;
  font-weight: 700;
  color: #fff;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(16,185,129,0.45), inset 0 1px 0 rgba(255,255,255,0.35);
  letter-spacing: -0.02em;
  position: relative;
}
.sb-logo-mark::after {
  content: '';
  position: absolute; inset: -3px;
  border-radius: 14px;
  background: var(--grad-primary);
  filter: blur(12px);
  opacity: 0.40;
  z-index: -1;
}
.sb-logo-text {
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: 15px;
  color: var(--text);
  line-height: 1.15;
}
.sb-logo-sub {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 2px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.sb-collapse {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.18s ease;
}
.sb-collapse:hover {
  background: var(--primary-tint);
  border-color: var(--primary-border);
  color: var(--text);
}
.sb-collapse svg { width: 13px; height: 13px; transition: transform 0.22s; }
.app.sb-mini .sb-collapse svg { transform: rotate(180deg); }

/* Mini-mode */
.app.sb-mini .sb-logo-text,
.app.sb-mini .sb-logo-sub,
.app.sb-mini .sb-label,
.app.sb-mini .sb-item-label,
.app.sb-mini .sb-item .sb-kbd,
.app.sb-mini .sb-profile-text,
.app.sb-mini .sb-profile-chev,
.app.sb-mini .sb-foot-text { display: none; }
.app.sb-mini .sb-brand { justify-content: center; padding: 18px 8px 16px; }
.app.sb-mini .sb-collapse { position: static; transform: none; margin: 8px auto 0; }
.app.sb-mini .sb-item { justify-content: center; padding: 11px; }
.app.sb-mini .sb-item .sb-badge { position: absolute; top: 4px; right: 4px; min-width: 16px; padding: 0 4px; transform: scale(0.85); }
.app.sb-mini .sb-profile { justify-content: center; padding: 10px 8px; }
.app.sb-mini .sb-foot { justify-content: center; padding: 10px 8px; }

/* ---------- Sections ---------- */
.sb-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 12px 8px;
}
.sb-nav::-webkit-scrollbar { width: 4px; }
.sb-nav::-webkit-scrollbar-thumb { background: var(--line-3); border-radius: 2px; }
.sb-section { margin-bottom: 6px; }
.sb-label {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-2);
  padding: 14px 12px 7px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: space-between;
}
.sb-label .sb-section-toggle {
  background: none; border: none;
  color: var(--muted-2);
  cursor: pointer;
  width: 18px; height: 18px;
  display: grid; place-items: center;
  border-radius: 5px;
  padding: 0;
  transition: all 0.15s;
}
.sb-label .sb-section-toggle:hover { color: var(--text); background: var(--surface-hover); }
.sb-label .sb-section-toggle svg { width: 11px; height: 11px; transition: transform 0.18s; }
.sb-section.collapsed .sb-section-toggle svg { transform: rotate(-90deg); }
.sb-section.collapsed .sb-item { display: none; }
.sb-section.pinned .sb-label { color: var(--primary-3); }

/* ---------- Nav items ---------- */
.sb-item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 9px 11px;
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.18s cubic-bezier(.4,.0,.2,1);
  font-weight: 500;
  margin-bottom: 2px;
  border: 1px solid transparent;
}
.sb-item:hover {
  background: var(--surface-hover);
  color: var(--text);
  transform: translateX(2px);
}
.sb-item:hover .sb-kbd { opacity: 1; }

.sb-item.active {
  background: linear-gradient(135deg, var(--primary-tint-2) 0%, rgba(6,182,212,0.10) 100%);
  color: var(--text);
  border-color: var(--primary-border);
  box-shadow: 0 6px 20px rgba(16,185,129,0.18), var(--inner-highlight);
  transform: none;
}
.sb-item.active::before {
  content: '';
  position: absolute;
  left: -13px;
  top: 9px; bottom: 9px;
  width: 3px;
  background: var(--grad-primary);
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 12px rgba(16,185,129,0.70);
}
.app.sb-mini .sb-item.active::before { left: -9px; }

.sb-item svg.ic {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: 0.80;
  transition: opacity 0.18s;
}
.sb-item:hover svg.ic, .sb-item.active svg.ic { opacity: 1; }
.sb-item-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sb-item .sb-badge {
  font-size: 10.5px;
  background: var(--surface-soft);
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--text-2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--line);
}
.sb-item .sb-badge.urgent {
  background: linear-gradient(135deg, #EF4444, #F43F5E);
  color: #fff;
  border-color: rgba(239,68,68,0.40);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.12);
  animation: badge-pulse 2.5s infinite;
}
@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(239,68,68,0.12); }
  50%      { box-shadow: 0 0 0 5px rgba(239,68,68,0.04); }
}
.sb-item .sb-badge.hot {
  background: linear-gradient(135deg, #8B5CF6, #06B6D4);
  color: #fff;
  border-color: rgba(139,92,246,0.40);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.10), 0 0 12px rgba(139,92,246,0.45);
  animation: ai-glow 2.4s ease-in-out infinite;
}
@keyframes ai-glow {
  0%, 100% { box-shadow: 0 0 0 3px rgba(139,92,246,0.10), 0 0 10px rgba(139,92,246,0.40); }
  50%      { box-shadow: 0 0 0 5px rgba(139,92,246,0.04), 0 0 16px rgba(139,92,246,0.65); }
}
.sb-item.active .sb-badge { background: var(--surface-hover); border-color: var(--line); }

.sb-kbd {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--kbd-bg);
  border: 1px solid var(--kbd-border);
  color: var(--kbd-fg);
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transition: opacity 0.18s;
  font-family: var(--font-mono);
}
.sb-item.active .sb-kbd { display: none; }

/* ---------- Profile + footer ---------- */
.sb-profile {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 14px;
  border-top: 1px solid var(--line-2);
  background: var(--surface-soft);
  cursor: pointer;
  transition: background 0.18s;
}
.sb-profile:hover { background: var(--surface-hover); }
.sb-profile .av {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--grad-purple);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 12px;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 4px 12px rgba(139,92,246,0.35), inset 0 1px 0 rgba(255,255,255,0.25);
}
.sb-profile .av::after {
  content: '';
  position: absolute; bottom: -2px; right: -2px;
  width: 11px; height: 11px; border-radius: 50%;
  background: #22C55E;
  border: 2px solid var(--badge-ring);
  box-shadow: 0 0 0 2px rgba(34,197,94,0.35);
  animation: online-pulse 2.4s ease-in-out infinite;
}
@keyframes online-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(34,197,94,0.35); }
  50%      { box-shadow: 0 0 0 5px rgba(34,197,94,0.08); }
}
.sb-profile-text { min-width: 0; flex: 1; }
.sb-profile-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-profile-role { font-size: 11px; color: var(--muted); margin-top: 1px; }
.sb-profile-chev { color: var(--muted-2); }
.sb-profile-chev svg { width: 14px; height: 14px; }

.sb-foot {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 16px 14px;
  background: var(--surface-soft);
}
.sb-foot .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #34D399;
  box-shadow: 0 0 0 3px rgba(52,211,153,0.20), 0 0 14px rgba(52,211,153,0.55);
  flex-shrink: 0;
  animation: aura-pulse 2.4s infinite;
}
@keyframes aura-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(52,211,153,0.20), 0 0 14px rgba(52,211,153,0.55); }
  50%      { box-shadow: 0 0 0 6px rgba(52,211,153,0.05), 0 0 18px rgba(52,211,153,0.85); }
}
.sb-foot-text {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}
.sb-foot-text b { color: var(--text); font-weight: 600; }

/* Mini-mode tooltip */
.app.sb-mini .sb-item { position: relative; }
.app.sb-mini .sb-item:hover::after {
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 14px); top: 50%;
  transform: translateY(-50%);
  background: var(--tooltip-bg, var(--text));
  color: var(--canvas);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 7px;
  white-space: nowrap;
  z-index: 80;
  box-shadow: var(--shadow-lg);
  font-weight: 500;
}
.app.sb-mini .sb-item:hover::before {
  content: '';
  position: absolute;
  left: calc(100% + 9px); top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 8px; height: 8px;
  background: var(--tooltip-bg, var(--text));
  z-index: 79;
}

/* ============== Top Bar ============== */
.main {
  display: flex; flex-direction: column;
  min-width: 0;
  padding: var(--sb-gap) var(--sb-gap) var(--sb-gap) 0;
}

.topbar {
  position: sticky;
  top: var(--sb-gap);
  z-index: 20;
  height: var(--tb-h);
  background: var(--topbar-bg);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  display: flex; align-items: center;
  padding: 0 16px 0 20px;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: background 0.3s, border-color 0.3s;
}

.tb-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tb-crumb {
  font-size: 11px; color: var(--muted);
  display: flex; align-items: center; gap: 6px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.tb-crumb .sep { opacity: 0.4; }
.tb-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-top: 2px;
}

/* Search bar */
.tb-search {
  flex: 1;
  max-width: 620px;
  margin: 0 auto;
  display: flex; align-items: center;
  gap: 10px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 12px;
  padding: 8px 14px;
  cursor: text;
  transition: all 0.18s ease;
  height: 38px;
}
.tb-search:hover {
  background: var(--input-bg-hover);
  border-color: var(--input-border-hover);
}
.tb-search:focus-within,
.tb-search.focused {
  background: var(--input-bg-focus);
  border-color: var(--primary-border-2);
  box-shadow: 0 0 0 4px var(--input-ring), 0 8px 24px rgba(16,185,129,0.06);
}
.tb-search input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 13px; color: var(--text);
}
.tb-search input::placeholder { color: var(--muted); }
.tb-search svg { width: 16px; height: 16px; color: var(--primary-2); }
.tb-search .kbd {
  font-size: 10.5px; padding: 2px 7px;
  border-radius: 6px;
  background: var(--kbd-bg);
  border: 1px solid var(--kbd-border);
  color: var(--kbd-fg);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

.tb-right { display: flex; align-items: center; gap: 4px; }
.tb-btn {
  position: relative;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.18s ease;
}
.tb-btn:hover, .tb-btn.open {
  background: var(--surface-hover);
  border-color: var(--line);
  color: var(--text);
}
.tb-btn:hover { transform: translateY(-1px); }
.tb-btn svg { width: 18px; height: 18px; }
.tb-btn .badge {
  position: absolute; top: -3px; right: -3px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  background: var(--grad-primary);
  color: #fff;
  font-size: 10px; font-weight: 700;
  border-radius: 999px;
  display: grid; place-items: center;
  border: 2px solid var(--badge-ring);
  font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 10px rgba(16,185,129,0.45);
}
.tb-btn .badge.red {
  background: linear-gradient(135deg, #EF4444, #F43F5E);
  box-shadow: 0 4px 10px rgba(239,68,68,0.45);
  animation: badge-pulse 2.5s infinite;
}
.tb-btn .badge.wa { background: linear-gradient(135deg, #22C55E, #10B981); }

/* Theme toggle */
.tb-theme {
  position: relative;
  width: 38px; height: 38px;
  border-radius: 11px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--text-2);
  cursor: pointer;
  display: grid; place-items: center;
  transition: all 0.22s cubic-bezier(.4,.0,.2,1);
  overflow: hidden;
}
.tb-theme:hover {
  background: var(--surface-hover);
  border-color: var(--primary-border);
  color: var(--text);
  transform: translateY(-1px);
}
.tb-theme svg {
  width: 17px; height: 17px;
  transition: transform 0.35s cubic-bezier(.4,.0,.2,1), opacity 0.2s;
  position: absolute;
}
.tb-theme .sun  { opacity: 0; transform: rotate(-90deg) scale(0.6); }
.tb-theme .moon { opacity: 1; transform: rotate(0)     scale(1); color: var(--purple-400); }
[data-theme="light"] .tb-theme .sun  { opacity: 1; transform: rotate(0)    scale(1); color: var(--amber-500); }
[data-theme="light"] .tb-theme .moon { opacity: 0; transform: rotate(90deg) scale(0.6); }

.tb-avatar {
  width: 36px; height: 36px;
  border-radius: 11px;
  background: var(--grad-purple);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 12px;
  margin-left: 6px;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.10);
  transition: all 0.18s;
  position: relative;
  box-shadow: 0 4px 12px rgba(139,92,246,0.35), inset 0 1px 0 rgba(255,255,255,0.25);
}
.tb-avatar:hover, .tb-avatar.open {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(139,92,246,0.50), inset 0 1px 0 rgba(255,255,255,0.25);
}

/* ============== Popovers ============== */
.pop {
  position: absolute;
  top: calc(100% + 8px);
  background: var(--pop-bg);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-pop);
  min-width: 280px;
  z-index: 60;
  overflow: hidden;
  animation: pop-in 0.18s cubic-bezier(.4,.0,.2,1);
  color: var(--text);
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.pop-right { right: 0; }
.pop-head {
  padding: 13px 16px 11px;
  border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: space-between;
}
.pop-head h4 { font-size: 13px; color: var(--text); }
.pop-head .small { font-size: 11px; color: var(--muted); }
.pop-body { max-height: 400px; overflow-y: auto; padding: 4px 0; }
.pop-foot {
  padding: 9px 14px;
  border-top: 1px solid var(--line-2);
  font-size: 12px;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface-soft);
}
.pop-foot a { color: var(--primary-3); font-weight: 500; transition: color 0.15s; }
.pop-foot a:hover { color: var(--primary-2); }
.pop-foot kbd {
  background: var(--kbd-bg);
  border: 1px solid var(--kbd-border);
  padding: 1px 5px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--kbd-fg);
}

.pop-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}
.pop-item:hover {
  background: var(--primary-tint);
  border-left-color: var(--primary);
  color: var(--text);
}
.pop-item .ic {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--primary-tint);
  color: var(--primary-3);
  display: grid; place-items: center;
  flex-shrink: 0;
  border: 1px solid var(--primary-border);
}
.pop-item .ic svg { width: 14px; height: 14px; }
.pop-item .sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.pop-item .kbd {
  margin-left: auto;
  font-size: 10.5px;
  padding: 2px 6px;
  background: var(--kbd-bg);
  border: 1px solid var(--kbd-border);
  border-radius: 5px;
  color: var(--kbd-fg);
  font-family: var(--font-mono);
}
.pop-divider { height: 1px; background: var(--line-2); margin: 5px 0; }

/* Notification items */
.nt-item {
  display: flex; gap: 11px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-2);
  cursor: pointer;
  transition: background 0.15s;
}
.nt-item:hover { background: var(--surface-hover); }
.nt-item:last-child { border-bottom: none; }
.nt-item.unread {
  background: linear-gradient(90deg, var(--primary-tint) 0%, transparent 70%);
}
.nt-item .ic {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: grid; place-items: center;
  flex-shrink: 0;
  border: 1px solid var(--line);
}
.nt-item .ttl { font-size: 12.5px; font-weight: 500; color: var(--text); line-height: 1.3; }
.nt-item .ts { font-size: 11px; color: var(--muted); margin-top: 3px; }
.nt-item .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary);
  align-self: center;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--primary-tint);
}

/* WhatsApp popover */
.wa-item {
  display: flex; gap: 11px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-2);
  cursor: pointer;
  transition: background 0.15s;
}
.wa-item:hover { background: var(--surface-hover); }
.wa-item .avatar { width: 34px; height: 34px; font-size: 11px; }
.wa-item .row1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wa-item .name { font-size: 12.5px; font-weight: 600; color: var(--text); }
.wa-item .when { font-size: 10.5px; color: var(--muted); }
.wa-item .msg {
  font-size: 12px; color: var(--muted);
  margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 280px;
}
.wa-item .count {
  background: linear-gradient(135deg, #22C55E, #10B981);
  color: #fff;
  font-size: 10px; font-weight: 700;
  border-radius: 999px;
  padding: 0 7px;
  min-width: 20px;
  height: 20px;
  display: grid; place-items: center;
  align-self: center;
  box-shadow: 0 4px 10px rgba(16,185,129,0.40);
}

/* User menu */
.um-head {
  padding: 16px;
  display: flex; gap: 12px; align-items: center;
  background:
    radial-gradient(circle at 0% 0%, rgba(139,92,246,0.18), transparent 60%),
    radial-gradient(circle at 100% 100%, var(--primary-tint-2), transparent 60%);
  border-bottom: 1px solid var(--line-2);
}
.um-head .av {
  width: 44px; height: 44px;
  background: var(--grad-purple);
  color: #fff;
  border-radius: 12px;
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px;
  box-shadow: 0 8px 22px rgba(139,92,246,0.45), inset 0 1px 0 rgba(255,255,255,0.30);
}
.um-head .name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.um-head .role { font-size: 11px; color: var(--muted); }
.um-section {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 11px 14px 4px;
  font-weight: 600;
}

/* ============== Command Palette ============== */
.cmdk-bg {
  position: fixed; inset: 0;
  background: var(--modal-scrim);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 90;
  display: grid; place-items: flex-start center;
  padding-top: 12vh;
  animation: cmdk-fade 0.18s ease;
}
@keyframes cmdk-fade { from { opacity: 0; } to { opacity: 1; } }
.cmdk {
  width: 100%;
  max-width: 620px;
  background: var(--modal-bg);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-pop), 0 0 80px rgba(16,185,129,0.10);
  overflow: hidden;
  animation: cmdk-scale 0.22s cubic-bezier(.4,.0,.2,1);
}
@keyframes cmdk-scale {
  from { transform: translateY(-14px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.cmdk-input {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-2);
}
.cmdk-input svg { width: 18px; height: 18px; color: var(--primary-2); }
.cmdk-input input {
  flex: 1; border: none; outline: none;
  background: transparent;
  font-size: 16px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.cmdk-input input::placeholder { color: var(--muted); }
.cmdk-input .esc {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--kbd-bg);
  border: 1px solid var(--kbd-border);
  color: var(--kbd-fg);
  font-family: var(--font-mono);
}
.cmdk-list { max-height: 420px; overflow-y: auto; padding: 8px; }
.cmdk-group-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 10px 6px;
  font-weight: 600;
}
.cmdk-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  cursor: pointer;
  color: var(--text-2);
  transition: all 0.12s;
  border: 1px solid transparent;
}
.cmdk-item .ic {
  width: 30px; height: 30px;
  background: var(--primary-tint);
  color: var(--primary-3);
  border-radius: 8px;
  display: grid; place-items: center;
  border: 1px solid var(--primary-border);
}
.cmdk-item .ic svg { width: 14px; height: 14px; }
.cmdk-item .sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
.cmdk-item.active {
  background: linear-gradient(135deg, var(--primary-tint-2), rgba(6,182,212,0.08));
  border-color: var(--primary-border);
  color: var(--text);
  box-shadow: 0 6px 18px rgba(16,185,129,0.18);
}
.cmdk-item .kbd {
  margin-left: auto;
  font-size: 11px;
  padding: 2px 7px;
  background: var(--kbd-bg);
  border: 1px solid var(--kbd-border);
  border-radius: 6px;
  color: var(--kbd-fg);
  font-family: var(--font-mono);
}
.cmdk-foot {
  padding: 10px 16px;
  border-top: 1px solid var(--line-2);
  font-size: 11px;
  color: var(--muted);
  display: flex; gap: 16px;
  background: var(--surface-soft);
}
.cmdk-foot kbd {
  background: var(--kbd-bg);
  border: 1px solid var(--kbd-border);
  padding: 2px 6px; border-radius: 5px;
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--text-2);
}

/* ============== Page content frame ============== */
.page {
  padding: 22px 4px 40px;
  min-height: calc(100vh - var(--tb-h));
  position: relative;
}
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 14px;
}
.page-head h1 { font-size: 24px; letter-spacing: -0.02em; font-weight: 600; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 5px; }

/* ============== AI Hero ============== */
.ai-hero {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 22px 26px;
  margin-bottom: 18px;
  overflow: hidden;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}
.ai-hero::before {
  content: '';
  position: absolute; inset: -1px;
  background:
    radial-gradient(ellipse 600px 300px at 0% 0%,    var(--primary-tint-2),    transparent 60%),
    radial-gradient(ellipse 600px 300px at 100% 100%, rgba(139,92,246,0.16), transparent 60%),
    radial-gradient(ellipse 400px 200px at 60% 0%,   rgba(6,182,212,0.12),  transparent 60%);
  pointer-events: none;
}
.ai-hero > * { position: relative; }
.ai-hero-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.ai-greeting {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(139,92,246,0.14);
  border: 1px solid rgba(139,92,246,0.30);
  color: var(--purple-500);
  font-size: 11.5px; font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.ai-greeting .pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--purple-500);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.30);
  animation: aura-pulse 2.4s infinite;
}
.ai-hero h1 {
  font-size: 30px; letter-spacing: -0.025em;
  line-height: 1.15; font-weight: 700;
  color: var(--text);
}
.ai-hero h1 .wave { display: inline-block; animation: wave 2.6s ease-in-out infinite; transform-origin: 70% 70%; }
@keyframes wave { 0%,100%{transform:rotate(0)} 15%{transform:rotate(14deg)} 30%{transform:rotate(-8deg)} 45%{transform:rotate(10deg)} 60%{transform:rotate(0)} }
.ai-hero .subtitle {
  font-size: 14px; color: var(--text-2);
  margin-top: 6px; line-height: 1.55;
}
.ai-hero .subtitle b { color: var(--text); font-weight: 600; }
.ai-hero .subtitle .grad {
  background: var(--grad-primary);
  -webkit-background-clip: text; background-clip: text;
  color: transparent; font-weight: 700;
}

.ai-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.ai-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
  transition: all 0.18s;
  cursor: pointer;
}
.ai-chip:hover {
  background: var(--primary-tint);
  border-color: var(--primary-border);
  color: var(--text);
  transform: translateY(-1px);
}
.ai-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary-2); }
.ai-chip .dot.purple { background: var(--purple-500); }
.ai-chip .dot.cyan { background: var(--cyan-500); }
.ai-chip .dot.amber { background: var(--amber-500); }
.ai-chip .dot.rose { background: var(--rose-500); }

/* Mobile */
@media (max-width: 1024px) {
  :root { --sb-gap: 10px; }
  .app { grid-template-columns: var(--sb-w-mini) 1fr; }
  .app .sb-logo-text, .app .sb-logo-sub, .app .sb-label, .app .sb-item-label,
  .app .sb-item .sb-kbd, .app .sb-profile-text, .app .sb-profile-chev, .app .sb-foot-text { display: none; }
  .app .sb-brand { justify-content: center; padding: 16px 8px 14px; }
  .app .sb-collapse { display: none; }
  .app .sb-item { justify-content: center; padding: 11px; position: relative; }
  .app .sb-profile { justify-content: center; padding: 10px 8px; }
  .app .sb-foot { justify-content: center; padding: 10px 8px; }
}
@media (max-width: 768px) {
  .tb-search { display: none; }
  .page { padding: 14px 6px 28px; }
  .ai-hero { padding: 18px; }
  .ai-hero h1 { font-size: 22px; }
}
