/* =========================================================
   NOWII·AI — Enterprise AI Operations Platform
   ========================================================= */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Dark theme */
  --bg: #0a0c12;
  --bg-2: #0e111a;
  --bg-3: #131722;
  --surface: rgba(255,255,255,.028);
  --surface-2: rgba(255,255,255,.055);
  --surface-3: rgba(255,255,255,.09);
  --border: rgba(255,255,255,.075);
  --border-strong: rgba(255,255,255,.16);
  --text: #e8ecf3;
  --text-muted: #8592a8;
  --text-dim: #566178;

  --brand: #2563eb;
  --brand-hover: #1d4ed8;
  --brand-glow: rgba(37,99,235,.35);
  --info: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --purple: #8b5cf6;

  --ease: cubic-bezier(.4,0,.2,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
  --ease-bounce: cubic-bezier(.34,1.56,.64,1);
  --shadow-lg: 0 30px 80px -20px rgba(0,0,0,.8);
  --shadow-md: 0 12px 32px -8px rgba(0,0,0,.5);
  --shadow-sm: 0 4px 12px -4px rgba(0,0,0,.3);

  --sidebar-w: 260px;
  --topbar-h: 62px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

html[data-theme="light"] {
  --bg: #f6f8fc;
  --bg-2: #ffffff;
  --bg-3: #f1f4f9;
  --surface: rgba(15,23,42,.02);
  --surface-2: rgba(15,23,42,.045);
  --surface-3: rgba(15,23,42,.08);
  --border: rgba(15,23,42,.08);
  --border-strong: rgba(15,23,42,.16);
  --text: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --shadow-lg: 0 30px 80px -20px rgba(15,23,42,.18);
  --shadow-md: 0 12px 32px -8px rgba(15,23,42,.12);
  --shadow-sm: 0 4px 12px -4px rgba(15,23,42,.08);
}

html[data-density="compact"] { font-size: 13px; }
html[data-density="comfortable"] { font-size: 15px; }

html.no-anim *, html.no-anim *::before, html.no-anim *::after {
  animation-duration: .001ms !important;
  transition-duration: .001ms !important;
}

html.no-magnetic .qa-btn,
html.no-magnetic .copilot-trigger,
html.no-magnetic .btn-primary { transform: none !important; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}

body.no-scroll { overflow: hidden; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

::selection { background: var(--brand); color: #fff; }

/* ============ SPLASH ============ */
.splash {
  position: fixed; inset: 0; background: var(--bg); z-index: 9999;
  display: grid; place-items: center; overflow: hidden;
  transition: opacity .6s var(--ease), visibility .6s var(--ease);
}
.splash.hidden { opacity: 0; visibility: hidden; }

.splash-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .4;
  pointer-events: none;
}
.splash-orb-1 {
  width: 500px; height: 500px;
  background: var(--brand);
  top: -200px; left: -150px;
  animation: orbFloat1 12s ease-in-out infinite;
}
.splash-orb-2 {
  width: 400px; height: 400px;
  background: var(--info);
  bottom: -150px; right: -100px;
  animation: orbFloat2 14s ease-in-out infinite;
}
@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, 30px) scale(1.15); }
}
@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-40px, -30px) scale(1.1); }
}

.splash-inner { text-align: center; position: relative; z-index: 2; }

.splash-logo {
  position: relative;
  width: 68px; height: 68px; margin: 0 auto 20px;
  display: grid; place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--brand), var(--info));
  color: #fff;
  box-shadow: 0 20px 60px -15px var(--brand);
  animation: logoPop .8s var(--ease-bounce) .1s backwards;
}
.splash-logo svg { width: 36px; height: 36px; }
@keyframes logoPop {
  0% { transform: scale(0) rotate(-30deg); opacity: 0; }
  60% { transform: scale(1.1) rotate(6deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.splash-logo-ring {
  position: absolute; inset: -8px;
  border-radius: 20px;
  border: 2px solid transparent;
  border-top-color: var(--info);
  border-right-color: var(--brand);
  animation: ringSpin 1.5s linear infinite;
  opacity: .6;
}
@keyframes ringSpin { to { transform: rotate(360deg); } }

.splash-title {
  font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em;
  margin-bottom: 6px; animation: fadeIn .5s var(--ease) .5s backwards;
}
.splash-title span { color: var(--brand); }
.splash-sub {
  font-size: .78rem; color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: .04em; margin-bottom: 24px;
  animation: fadeIn .5s var(--ease) .6s backwards;
}
.splash-bar {
  width: 220px; height: 3px; margin: 0 auto 20px;
  border-radius: 99px; background: var(--surface-3); overflow: hidden;
  animation: fadeIn .5s var(--ease) .3s backwards;
}
.splash-bar span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--brand), var(--info));
  animation: barLoad 1.4s cubic-bezier(.4,0,.2,1) .2s forwards;
}
@keyframes barLoad { 0% { width: 0; } 100% { width: 100%; } }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.splash-steps {
  display: flex;
  gap: 12px;
  justify-content: center;
  animation: fadeIn .5s var(--ease) .9s backwards;
}
.splash-step {
  font-size: .68rem;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
  transition: color .3s var(--ease);
}
.splash-step.active { color: var(--text); }
.splash-step.done { color: var(--success); }

/* ============ APP LAYOUT ============ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  opacity: 0;
  transition: opacity .4s var(--ease);
}
.app.ready { opacity: 1; }

/* ============ SIDEBAR ============ */
.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100;
}

.sidebar-head {
  padding: 16px 16px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--info));
  color: #fff;
  transition: transform .3s var(--ease-bounce);
}
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.08); }
.brand-mark svg { width: 16px; height: 16px; }
.brand-name { font-weight: 700; font-size: .9rem; letter-spacing: -.02em; }
.brand-name span { color: var(--brand); }

.sidebar-toggle { display: none; }

.workspace-switcher {
  margin: 10px 12px 4px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: all .2s var(--ease);
  text-align: left;
  width: calc(100% - 24px);
}
.workspace-switcher:hover { background: var(--surface-2); border-color: var(--border-strong); transform: translateY(-1px); }
.workspace-avatar {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  color: #fff;
  font-weight: 700;
  font-size: .72rem;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.workspace-info { flex: 1; min-width: 0; }
.workspace-info strong { display: block; font-size: .84rem; font-weight: 600; }
.workspace-info small { display: block; font-size: .68rem; color: var(--text-muted); margin-top: 1px; }
.workspace-chevron { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; }

.nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.nav::-webkit-scrollbar { width: 4px; }
.nav::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; }

.nav-section {
  padding: 12px 10px 6px;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: .85rem;
  font-weight: 500;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  transition: all .2s var(--ease);
  text-align: left;
  position: relative;
  width: 100%;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; transition: transform .2s var(--ease-bounce); }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item:hover svg { transform: scale(1.1); }
.nav-item.active {
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  color: var(--text);
  border-color: color-mix(in srgb, var(--brand) 25%, transparent);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: var(--brand);
  border-radius: 0 3px 3px 0;
  animation: navSlide .3s var(--ease-out);
}
@keyframes navSlide {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--danger);
  color: #fff;
  font-size: .66rem;
  font-weight: 700;
  display: grid; place-items: center;
  font-family: 'JetBrains Mono', monospace;
  animation: badgePulse 2s infinite;
}
@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}
.nav-tag {
  margin-left: auto;
  font-size: .58rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--brand) 15%, transparent);
  color: var(--brand);
  letter-spacing: .05em;
}
.nav-hint {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: .62rem;
  color: var(--text-dim);
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--surface);
  opacity: 0;
  transition: opacity .2s var(--ease);
}
.nav-item:hover .nav-hint { opacity: 1; }

.sidebar-status {
  margin: 8px 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.status-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(16,185,129,.6);
  animation: statusPulse 2s infinite;
}
.status-dot.warning { background: var(--warning); }
.status-dot.danger { background: var(--danger); }
@keyframes statusPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,.6); }
  50% { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
}
.status-label { font-size: .74rem; color: var(--text-muted); font-weight: 500; }
.status-meta {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 6px;
}
.status-meta span:first-child { font-size: .82rem; font-weight: 700; color: var(--text); }
.status-meta span:last-child { font-size: .68rem; color: var(--text-muted); }
.status-progress {
  height: 2px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
}
.status-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--success), var(--info));
  border-radius: 99px;
  transition: width 1s var(--ease-out);
}

.sidebar-foot {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  transition: all .2s var(--ease);
  width: 100%;
  text-align: left;
  color: var(--text);
  font-family: inherit;
}
.user-card:hover { background: var(--surface); border-color: var(--border); transform: translateX(2px); }
.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--info));
  color: #fff;
  font-weight: 700;
  font-size: .74rem;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-info strong { display: block; font-size: .82rem; font-weight: 600; }
.user-info small { display: block; font-size: .7rem; color: var(--text-muted); }
.user-chevron { width: 12px; height: 12px; color: var(--text-muted); transition: transform .3s var(--ease); }
.user-card:hover .user-chevron { transform: rotate(180deg); }

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  z-index: 99;
  opacity: 0;
  transition: opacity .3s var(--ease);
}
.sidebar-overlay.active { display: block; opacity: 1; }

/* ============ MAIN ============ */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
  overflow: hidden;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  flex-shrink: 0;
  z-index: 50;
}
.menu-btn { display: none; }

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .84rem;
  flex: 1;
  min-width: 0;
}
.bc-muted { color: var(--text-muted); }
.bc-sep { width: 12px; height: 12px; color: var(--text-dim); }
.bc-current { font-weight: 600; color: var(--text); }

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

/* Global search */
.global-search-wrap { position: relative; }
.topbar-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-family: inherit;
  font-size: .82rem;
  cursor: pointer;
  transition: all .2s var(--ease);
  min-width: 260px;
}
.topbar-search:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.topbar-search svg { width: 14px; height: 14px; }
.topbar-search span { flex: 1; text-align: left; }
.topbar-search kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: .65rem;
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
}

/* Quick search inline */
.quick-search {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 420px;
  max-width: 90vw;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all .2s var(--ease-out);
  overflow: hidden;
}
.quick-search.open {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.quick-search-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.quick-search-input svg { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }
.quick-search-input input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: .88rem;
  min-width: 0;
}
.quick-search-input input::placeholder { color: var(--text-muted); }
.quick-search-input kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: .62rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.quick-search-results {
  max-height: 400px;
  overflow-y: auto;
  padding: 6px;
}
.qs-section {
  padding: 8px 10px 4px;
  font-size: .66rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.qs-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s var(--ease);
  color: var(--text);
  font-size: .84rem;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.qs-item:hover, .qs-item.selected { background: var(--surface); }
.qs-item svg { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; }
.qs-item-text { flex: 1; min-width: 0; }
.qs-item-text strong { display: block; font-weight: 500; }
.qs-item-text small { font-size: .72rem; color: var(--text-muted); }
.qs-empty {
  padding: 30px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: .84rem;
}

.copilot-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, var(--brand), var(--info));
  color: #fff;
  font-family: inherit;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .25s var(--ease-bounce);
  box-shadow: 0 6px 18px -6px var(--brand-glow);
  position: relative;
  overflow: hidden;
}
.copilot-trigger::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,.25) 50%, transparent 100%);
  transform: translateX(-100%);
  transition: transform .6s var(--ease);
}
.copilot-trigger:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 26px -6px var(--brand-glow);
}
.copilot-trigger:hover::before { transform: translateX(100%); }
.copilot-trigger svg { width: 15px; height: 15px; position: relative; z-index: 1; }
.copilot-trigger span { position: relative; z-index: 1; }
.copilot-trigger kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: .62rem;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(0,0,0,.2);
  border: 1px solid rgba(255,255,255,.15);
  position: relative;
  z-index: 1;
}

.icon-btn {
  width: 34px; height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  display: grid; place-items: center;
  transition: all .2s var(--ease);
  position: relative;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 16px; height: 16px; transition: transform .3s var(--ease); }
.icon-btn.spinning svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.sm svg { width: 14px; height: 14px; }
.icon-btn.primary {
  background: var(--brand);
  color: #fff;
  border-color: transparent;
}
.icon-btn.primary:hover { background: var(--brand-hover); }

.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--danger);
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  display: grid; place-items: center;
  font-family: 'JetBrains Mono', monospace;
  border: 2px solid var(--bg);
  animation: badgePulse 2s infinite;
}

/* ============ VIEW CONTAINER ============ */
.view-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  scroll-behavior: smooth;
}
.view-container::-webkit-scrollbar { width: 10px; }
.view-container::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; }

.view {
  display: none;
  padding: 24px 28px 60px;
  max-width: 1600px;
  margin: 0 auto;
}
.view.active { display: block; animation: viewIn .35s var(--ease-out); }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.view-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.view-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.03em;
  margin-bottom: 4px;
  line-height: 1.2;
}
.view-sub {
  color: var(--text-muted);
  font-size: .84rem;
}
.live-text { color: var(--brand); font-weight: 600; }
.view-head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Segment control */
.segment-control {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
}
.segment-control button {
  padding: 6px 14px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: .78rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all .2s var(--ease);
  white-space: nowrap;
}
.segment-control button:hover { color: var(--text); }
.segment-control button.active {
  background: var(--bg-2);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  font-family: inherit;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .25s var(--ease);
  border: 1px solid transparent;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 6px 16px -6px var(--brand-glow);
}
.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,.25) 50%, transparent 100%);
  transform: translateX(-100%);
  transition: transform .6s var(--ease);
}
.btn-primary:hover { background: var(--brand-hover); transform: translateY(-2px); box-shadow: 0 10px 22px -6px var(--brand-glow); }
.btn-primary:hover::before { transform: translateX(100%); }
.btn-primary > * { position: relative; z-index: 1; }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--surface-2); border-color: var(--border-strong); transform: translateY(-1px); }
.btn-secondary.danger { color: var(--danger); }
.btn-secondary.danger:hover { background: color-mix(in srgb, var(--danger) 8%, transparent); border-color: var(--danger); }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface); color: var(--text); }
.btn-ghost.danger { color: var(--danger); }
.btn-ghost.danger:hover { background: color-mix(in srgb, var(--danger) 8%, transparent); }

.btn-primary svg, .btn-secondary svg, .btn-ghost svg { width: 14px; height: 14px; position: relative; z-index: 1; }

.link-btn {
  background: none;
  border: none;
  color: var(--brand);
  font-family: inherit;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.link-btn:hover { text-decoration: underline; }

/* ============ KPI GRID ============ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-card {
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-2);
  position: relative;
  overflow: hidden;
  transition: all .3s var(--ease);
  cursor: pointer;
  animation: cardIn .4s var(--ease-out) backwards;
}
.kpi-card:nth-child(1) { animation-delay: 0ms; }
.kpi-card:nth-child(2) { animation-delay: 60ms; }
.kpi-card:nth-child(3) { animation-delay: 120ms; }
.kpi-card:nth-child(4) { animation-delay: 180ms; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.kpi-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.kpi-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--brand) 12%, transparent), transparent 60%);
  opacity: 0;
  transition: opacity .35s var(--ease);
  pointer-events: none;
}
.kpi-card:hover::before { opacity: 1; }

.kpi-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
}
.kpi-label {
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.kpi-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: var(--surface-2);
  color: var(--text-muted);
  transition: all .3s var(--ease);
}
.kpi-card:hover .kpi-icon {
  background: color-mix(in srgb, var(--brand) 15%, transparent);
  color: var(--brand);
  transform: rotate(-8deg) scale(1.1);
}
.kpi-icon svg { width: 15px; height: 15px; }

.kpi-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -.03em;
  margin-bottom: 6px;
  line-height: 1.1;
  position: relative;
  z-index: 1;
}

.kpi-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .76rem;
  position: relative;
  z-index: 1;
}
.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}
.kpi-delta.up { color: var(--success); }
.kpi-delta.down { color: var(--danger); }
.kpi-delta svg { width: 10px; height: 10px; }
.kpi-period { color: var(--text-muted); }

.kpi-spark {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 80px;
  height: 30px;
  opacity: .35;
  pointer-events: none;
}

/* ============ PANELS ============ */
.grid { display: grid; gap: 16px; margin-bottom: 18px; }
.grid-2-1 { grid-template-columns: 2fr 1fr; }
.grid-1-1-1 { grid-template-columns: 1fr 1fr 1fr; }

.panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
  animation: cardIn .5s var(--ease-out) backwards;
}
.panel:hover { border-color: var(--border-strong); }
.panel.panel-wide { grid-column: span 2; }

.panel-head {
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.panel-title {
  font-size: .88rem;
  font-weight: 700;
  letter-spacing: -.01em;
  margin-bottom: 2px;
}
.panel-sub {
  font-size: .74rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.panel-body { padding: 16px 18px; flex: 1; min-height: 0; }
.panel-body-map { padding: 0; position: relative; }
.panel-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface); }

.panel-legend {
  display: flex;
  gap: 14px;
  font-size: .72rem;
  color: var(--text-muted);
}
.panel-legend span { display: flex; align-items: center; gap: 6px; }
.panel-legend i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}

.panel-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--surface-2);
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.panel-tag.live {
  background: color-mix(in srgb, var(--success) 15%, transparent);
  color: var(--success);
}
.panel-tag.live span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: statusPulse 2s infinite;
}

/* Chart stats */
.chart-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.chart-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chart-stat-label {
  font-size: .68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
}
.chart-stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
}

/* ============ CHARTS ============ */
.chart-canvas {
  width: 100%;
  height: 260px;
  display: block;
}

/* ============ SERVICES ============ */
.services-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.service-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background .2s var(--ease);
  cursor: pointer;
}
.service-item:hover { background: var(--surface); }
.service-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.service-dot.ok { background: var(--success); box-shadow: 0 0 8px var(--success); }
.service-dot.warn { background: var(--warning); box-shadow: 0 0 8px var(--warning); animation: statusPulse 2s infinite; }
.service-dot.err { background: var(--danger); box-shadow: 0 0 8px var(--danger); animation: statusPulse 1s infinite; }
.service-info { flex: 1; min-width: 0; }
.service-info strong { display: block; font-size: .82rem; font-weight: 600; margin-bottom: 4px; }
.service-bar {
  height: 3px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
}
.service-bar span {
  display: block;
  height: 100%;
  border-radius: 99px;
  transition: width .8s var(--ease-out);
}
.service-bar span.ok { background: var(--success); }
.service-bar span.warn { background: var(--warning); }
.service-bar span.err { background: var(--danger); }
.service-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: .76rem;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
}

/* ============ MAP ============ */
.panel-map { min-height: 380px; }
.map-canvas {
  width: 100%;
  height: 320px;
  display: block;
  background: radial-gradient(ellipse at center, color-mix(in srgb, var(--brand) 6%, transparent), transparent 70%);
}
.map-legend {
  position: absolute;
  bottom: 14px;
  left: 18px;
  display: flex;
  gap: 16px;
  padding: 8px 14px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg-2) 90%, transparent);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  font-size: .72rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.map-legend b { color: var(--text); font-weight: 700; }
.map-legend i {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
  margin-right: 4px;
  box-shadow: 0 0 8px var(--success);
}
.map-legend i.accent { background: var(--brand); box-shadow: 0 0 8px var(--brand); }

/* ============ EVENT TIMELINE ============ */
.event-timeline {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 340px;
  overflow-y: auto;
}
.event-timeline::-webkit-scrollbar { width: 4px; }
.event-timeline::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; }

.tl-item {
  display: flex;
  gap: 12px;
  padding: 10px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .2s var(--ease);
  align-items: flex-start;
}
.tl-item:hover { background: var(--surface); transform: translateX(3px); }

.tl-icon {
  width: 26px; height: 26px;
  border-radius: 7px;
  display: grid; place-items: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.tl-icon svg { width: 13px; height: 13px; }
.tl-icon.critical { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.tl-icon.warning { background: color-mix(in srgb, var(--warning) 15%, transparent); color: var(--warning); }
.tl-icon.info { background: color-mix(in srgb, var(--info) 15%, transparent); color: var(--info); }
.tl-icon.success { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }

.tl-body { flex: 1; min-width: 0; }
.tl-title {
  font-size: .82rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 3px;
  word-break: break-word;
}
.tl-meta {
  display: flex;
  gap: 10px;
  font-size: .7rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  flex-wrap: wrap;
}
.tl-meta .service-tag {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-2);
  font-size: .65rem;
  font-weight: 700;
}

/* ============ REGIONS / SERVICES / AUDIT ============ */
.regions-list, .top-services, .audit-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.region-row, .ts-row, .audit-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .82rem;
}
.region-name, .ts-name, .audit-action {
  flex: 1;
  min-width: 0;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.region-bar, .ts-bar {
  flex: 1;
  height: 4px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
  min-width: 60px;
}
.region-bar span, .ts-bar span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--brand), var(--info));
  animation: barGrow .9s var(--ease-out);
}
@keyframes barGrow {
  from { transform: scaleX(0); transform-origin: left; }
  to { transform: scaleX(1); transform-origin: left; }
}
.region-value, .ts-value, .audit-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: .74rem;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
  text-align: right;
}
.audit-row {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: .78rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.audit-row:last-child { border-bottom: none; }
.audit-action strong { color: var(--text); font-weight: 600; margin-right: 4px; }
.audit-time { font-size: .68rem; color: var(--text-dim); text-align: right; }

/* ============ QUICK ACTIONS ============ */
.quick-actions {
  position: fixed;
  bottom: 30px;
  right: 30px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 90;
  pointer-events: none;
}
.qa-btn {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text);
  cursor: pointer;
  display: grid; place-items: center;
  box-shadow: var(--shadow-md);
  transition: all .25s var(--ease-bounce);
  pointer-events: auto;
  position: relative;
}
.qa-btn:hover {
  transform: translateY(-4px) scale(1.08);
  border-color: var(--brand);
  color: var(--brand);
  box-shadow: 0 12px 30px -8px var(--brand-glow);
}
.qa-btn:active { transform: scale(.94); }
.qa-btn svg { width: 20px; height: 20px; }

/* ============ OPERATIONS VIEW ============ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  padding: 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all .25s var(--ease);
  cursor: pointer;
  animation: cardIn .4s var(--ease-out) backwards;
}
.stat-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.stat-card-label {
  font-size: .7rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 8px;
}
.stat-card-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: 4px;
}
.stat-card-meta { font-size: .72rem; color: var(--text-muted); }

/* Filters bar */
.filters-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filter-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  flex: 1;
  min-width: 220px;
  transition: all .25s var(--ease);
}
.filter-search:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent);
}
.filter-search svg { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }
.filter-search input {
  border: none;
  background: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: .84rem;
  flex: 1;
  min-width: 0;
}
.filter-search input::placeholder { color: var(--text-muted); }

.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-muted);
  font-family: inherit;
  font-size: .76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); }
.chip.active {
  background: color-mix(in srgb, var(--brand) 15%, transparent);
  color: var(--text);
  border-color: color-mix(in srgb, var(--brand) 40%, transparent);
}
.chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.dot.danger { background: var(--danger); }
.dot.warning { background: var(--warning); }
.dot.info { background: var(--info); }
.dot.success { background: var(--success); }

/* Bulk actions */
.bulk-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 9px;
  border: 1px solid color-mix(in srgb, var(--brand) 40%, transparent);
  background: color-mix(in srgb, var(--brand) 8%, transparent);
  animation: cardIn .25s var(--ease-out);
}
.bulk-count {
  font-size: .78rem;
  color: var(--text-muted);
  margin-right: 4px;
}
.bulk-count b { color: var(--text); font-weight: 700; }
.bulk-actions .btn-ghost { padding: 5px 10px; font-size: .76rem; }

.select-input {
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text);
  font-family: inherit;
  font-size: .82rem;
  cursor: pointer;
  outline: none;
  transition: all .2s var(--ease);
}
.select-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent); }

/* ============ DATA TABLE ============ */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  padding: 12px 14px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  white-space: nowrap;
}
.data-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color .2s var(--ease);
  position: relative;
}
.data-table th.sortable:hover { color: var(--text); }
.data-table th.sortable .sort-arrow {
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 4px;
  opacity: 0;
  transition: opacity .2s var(--ease);
}
.data-table th.sortable:hover .sort-arrow { opacity: .4; }
.data-table th.sortable.sort-asc .sort-arrow,
.data-table th.sortable.sort-desc .sort-arrow { opacity: 1; }
.data-table th.sortable.sort-asc .sort-arrow::before { content: '↑'; }
.data-table th.sortable.sort-desc .sort-arrow::before { content: '↓'; }

.data-table th.col-check,
.data-table td.col-check { width: 36px; text-align: center; padding: 12px 6px; }
.data-table input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--brand);
  cursor: pointer;
}

.data-table td {
  padding: 12px 14px;
  font-size: .82rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr {
  transition: background .15s var(--ease);
  cursor: pointer;
}
.data-table tbody tr:hover { background: var(--surface); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr.selected { background: color-mix(in srgb, var(--brand) 8%, transparent); }

.sev-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-family: 'JetBrains Mono', monospace;
}
.sev-pill.critical { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.sev-pill.warning { background: color-mix(in srgb, var(--warning) 15%, transparent); color: var(--warning); }
.sev-pill.info { background: color-mix(in srgb, var(--info) 15%, transparent); color: var(--info); }
.sev-pill.success { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }

.mono { font-family: 'JetBrains Mono', monospace; font-size: .76rem; }
.muted { color: var(--text-muted); }

.cust-cell { display: flex; align-items: center; gap: 10px; }
.cust-avatar {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: grid; place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: .72rem;
  flex-shrink: 0;
}
.cust-avatar-lg { width: 48px; height: 48px; border-radius: 12px; font-size: 1rem; }
.cust-info strong { display: block; font-size: .84rem; font-weight: 600; }
.cust-info small { font-size: .72rem; color: var(--text-muted); }

.plan-pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.plan-pill.enterprise { background: color-mix(in srgb, var(--purple) 15%, transparent); color: var(--purple); }
.plan-pill.pro { background: color-mix(in srgb, var(--brand) 15%, transparent); color: var(--brand); }
.plan-pill.starter { background: var(--surface-2); color: var(--text-muted); }

.sentiment {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .74rem;
  font-weight: 600;
}
.sentiment.positive { color: var(--success); }
.sentiment.neutral { color: var(--text-muted); }
.sentiment.negative { color: var(--danger); }

.row-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity .15s var(--ease);
}
.data-table tbody tr:hover .row-actions { opacity: 1; }
.row-action {
  width: 26px; height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-muted);
  cursor: pointer;
  display: grid; place-items: center;
  transition: all .15s var(--ease);
}
.row-action:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); transform: scale(1.08); }
.row-action svg { width: 12px; height: 12px; }

/* ============ COPILOT VIEW ============ */
.copilot-wrap {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-h) - 160px);
  min-height: 500px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.copilot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 32px 32px 20px;
}
.copilot-messages::-webkit-scrollbar { width: 8px; }
.copilot-messages::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; }

.copilot-welcome {
  max-width: 600px;
  margin: 40px auto 0;
  text-align: center;
  animation: fadeIn .5s var(--ease-out);
}
.copilot-logo {
  width: 64px; height: 64px;
  margin: 0 auto 20px;
  display: grid; place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--brand), var(--info));
  color: #fff;
  box-shadow: 0 20px 50px -15px var(--brand-glow);
  animation: logoPop .6s var(--ease-bounce);
}
.copilot-logo svg { width: 32px; height: 32px; }
.copilot-welcome h2 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.03em;
  margin-bottom: 10px;
}
.copilot-welcome > p {
  color: var(--text-muted);
  font-size: .9rem;
  line-height: 1.6;
  margin-bottom: 28px;
}

.copilot-suggestions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  max-width: 500px;
  margin: 0 auto;
}
.copilot-suggestions button {
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s var(--ease);
  text-align: left;
}
.copilot-suggestions button:hover {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, transparent);
  transform: translateY(-2px);
}

.copilot-input-wrap {
  padding: 16px 32px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}
.copilot-input {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 8px 8px 8px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg);
  transition: all .2s var(--ease);
}
.copilot-input:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 12%, transparent);
}
.copilot-input textarea {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  resize: none;
  color: var(--text);
  font-family: inherit;
  font-size: .9rem;
  line-height: 1.5;
  padding: 8px 0;
  max-height: 140px;
  min-height: 24px;
}
.copilot-input textarea::placeholder { color: var(--text-muted); }
.copilot-input-actions { display: flex; gap: 6px; }

.copilot-foot {
  text-align: center;
  font-size: .7rem;
  color: var(--text-dim);
  margin-top: 10px;
  font-family: 'JetBrains Mono', monospace;
}

/* Messages */
.copilot-msg {
  display: flex;
  gap: 14px;
  max-width: 800px;
  margin: 0 auto 24px;
  animation: msgIn .3s var(--ease-out);
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.copilot-msg-avatar {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: grid; place-items: center;
  flex-shrink: 0;
  font-weight: 800;
  font-size: .72rem;
  font-family: 'JetBrains Mono', monospace;
}
.copilot-msg.user .copilot-msg-avatar { background: var(--surface-3); color: var(--text); }
.copilot-msg.assistant .copilot-msg-avatar { background: linear-gradient(135deg, var(--brand), var(--info)); color: #fff; }
.copilot-msg-avatar svg { width: 16px; height: 16px; }

.copilot-msg-body { flex: 1; min-width: 0; padding-top: 2px; }
.copilot-msg-author {
  font-size: .76rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-muted);
  letter-spacing: .02em;
  text-transform: uppercase;
}
.copilot-msg-content {
  font-size: .9rem;
  line-height: 1.7;
  color: var(--text);
  word-break: break-word;
}
.copilot-msg-content p { margin-bottom: .7em; }
.copilot-msg-content p:last-child { margin-bottom: 0; }
.copilot-msg-content strong { font-weight: 700; }
.copilot-msg-content ul, .copilot-msg-content ol { margin: .5em 0 .9em 1.3em; display: grid; gap: .3em; }
.copilot-msg-content code {
  font-family: 'JetBrains Mono', monospace;
  font-size: .85em;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--brand);
}

.copilot-typing { display: inline-flex; gap: 3px; padding: 6px 0; }
.copilot-typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingBounce 1.4s infinite;
}
.copilot-typing span:nth-child(2) { animation-delay: .2s; }
.copilot-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

.stream-cursor {
  display: inline-block;
  width: 6px;
  height: 1em;
  background: var(--brand);
  vertical-align: text-bottom;
  margin-left: 2px;
  animation: cursorBlink .8s step-end infinite;
}
@keyframes cursorBlink { 50% { opacity: 0; } }

/* ============ REPORTS ============ */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.report-card {
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-2);
  cursor: pointer;
  transition: all .3s var(--ease);
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
  animation: cardIn .3s var(--ease-out) backwards;
}
.report-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.report-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 6%, transparent), transparent);
  opacity: 0;
  transition: opacity .3s var(--ease);
  pointer-events: none;
}
.report-card:hover::before { opacity: 1; }

.report-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--brand) 15%, transparent);
  color: var(--brand);
  position: relative;
  z-index: 1;
  transition: transform .3s var(--ease-bounce);
}
.report-card:hover .report-icon { transform: scale(1.08) rotate(-4deg); }
.report-icon svg { width: 20px; height: 20px; }
.report-body { flex: 1; position: relative; z-index: 1; }
.report-title {
  font-size: .95rem;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -.01em;
}
.report-desc {
  font-size: .78rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 12px;
}
.report-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .72rem;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 1;
}
.report-status {
  padding: 2px 8px;
  border-radius: 99px;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
}
.report-status.ready { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.report-status.generating { background: color-mix(in srgb, var(--warning) 15%, transparent); color: var(--warning); }

/* ============ SETTINGS ============ */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 14px;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; padding-bottom: 0; }
.setting-row:first-child { padding-top: 0; }
.setting-row strong { display: block; font-size: .84rem; font-weight: 600; margin-bottom: 3px; }
.setting-row small { font-size: .76rem; color: var(--text-muted); }

.setting-row-column {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.setting-row-column strong { display: block; font-size: .84rem; font-weight: 600; margin-bottom: 3px; }
.setting-row-column small { font-size: .76rem; color: var(--text-muted); }
.setting-row-column input {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: .82rem;
  outline: none;
  transition: all .2s var(--ease);
}
.setting-row-column input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent); }

.segmented {
  display: inline-flex;
  padding: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  gap: 2px;
}
.segmented button {
  padding: 5px 11px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: .76rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 4px;
  transition: all .2s var(--ease);
}
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface-3); color: var(--text); font-weight: 600; }

.switch {
  position: relative;
  width: 36px; height: 20px;
  flex-shrink: 0;
}
.switch input { display: none; }
.switch .slider {
  position: absolute; inset: 0;
  background: var(--surface-3);
  border-radius: 99px;
  cursor: pointer;
  transition: background .2s var(--ease);
}
.switch .slider::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  top: 3px; left: 3px;
  transition: transform .25s var(--ease-bounce);
}
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider::before { transform: translateX(16px); }

/* ============ HELP ============ */
.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.help-grid .panel-wide { grid-column: span 2; }

.shortcuts-list { display: flex; flex-direction: column; gap: 2px; }
.shortcut-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
  font-size: .84rem;
}
.shortcut-row:last-child { border-bottom: none; }
.shortcut-row span { color: var(--text-muted); }
.shortcut-row div { display: flex; gap: 4px; }
.shortcut-row kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: .68rem;
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  min-width: 22px;
  text-align: center;
}

.guide-list { display: flex; flex-direction: column; gap: 4px; }
.guide-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 10px;
  border-radius: 10px;
  border: none;
  background: none;
  cursor: pointer;
  transition: all .2s var(--ease);
  text-align: left;
  width: 100%;
  font-family: inherit;
  color: var(--text);
}
.guide-item:hover { background: var(--surface); transform: translateX(3px); }
.guide-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 1.1rem;
  background: var(--surface-2);
  flex-shrink: 0;
}
.guide-item > div:nth-child(2) { flex: 1; }
.guide-item strong { display: block; font-size: .88rem; font-weight: 600; margin-bottom: 2px; }
.guide-item small { font-size: .76rem; color: var(--text-muted); }
.guide-item > svg { width: 14px; height: 14px; color: var(--text-muted); transition: transform .2s var(--ease); }
.guide-item:hover > svg { transform: translateX(3px); color: var(--brand); }

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.contact-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all .3s var(--ease);
  text-align: center;
  font-family: inherit;
  color: var(--text);
}
.contact-card:hover {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 6%, var(--surface));
  transform: translateY(-3px);
}
.contact-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  color: #fff;
}
.contact-icon.chat { background: linear-gradient(135deg, var(--brand), var(--info)); }
.contact-icon.email { background: linear-gradient(135deg, #8b5cf6, #ec4899); }
.contact-icon.call { background: linear-gradient(135deg, var(--success), var(--info)); }
.contact-icon.docs { background: linear-gradient(135deg, var(--warning), var(--danger)); }
.contact-icon svg { width: 20px; height: 20px; }
.contact-card strong { font-size: .88rem; font-weight: 600; }
.contact-card small { font-size: .74rem; color: var(--text-muted); }

/* ============ COPILOT DRAWER ============ */
.copilot-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 440px;
  max-width: 100vw;
  background: var(--bg-2);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 500;
  transform: translateX(100%);
  transition: transform .35s var(--ease-out);
  box-shadow: -30px 0 80px -20px rgba(0,0,0,.6);
}
.copilot-drawer.open { transform: none; }

.copilot-drawer-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.copilot-drawer-brand { display: flex; align-items: center; gap: 12px; }
.copilot-drawer-logo {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--info));
  color: #fff;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.copilot-drawer-logo svg { width: 18px; height: 18px; }
.copilot-drawer-brand strong { display: block; font-size: .88rem; font-weight: 700; }
.copilot-drawer-brand small { font-size: .72rem; color: var(--text-muted); }

.copilot-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.copilot-drawer-body::-webkit-scrollbar { width: 6px; }
.copilot-drawer-body::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; }

.drawer-welcome { text-align: center; padding: 24px 8px; }
.drawer-welcome-icon {
  width: 48px; height: 48px;
  margin: 0 auto 14px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--brand) 15%, transparent);
  color: var(--brand);
}
.drawer-welcome-icon svg { width: 24px; height: 24px; }
.drawer-welcome p { font-size: .86rem; color: var(--text-muted); margin-bottom: 18px; }
.drawer-suggestions { display: flex; flex-direction: column; gap: 6px; }
.drawer-suggestions button {
  padding: 10px 14px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s var(--ease);
  text-align: left;
}
.drawer-suggestions button:hover {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 6%, var(--surface));
  transform: translateX(3px);
}

.copilot-drawer-input {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}
.copilot-drawer-input textarea {
  flex: 1;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: .86rem;
  resize: none;
  outline: none;
  max-height: 100px;
  min-height: 40px;
  line-height: 1.4;
}
.copilot-drawer-input textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 12%, transparent);
}
.copilot-drawer-input textarea::placeholder { color: var(--text-muted); }

.copilot-drawer-body .copilot-msg { margin-bottom: 18px; }

.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(3px);
  z-index: 499;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s var(--ease), visibility .3s var(--ease);
}
.drawer-overlay.open { opacity: 1; visibility: visible; }

/* ============ MODAL ============ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 600;
  display: grid; place-items: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all .25s var(--ease);
  overflow-y: auto;
}
.modal-backdrop.open { opacity: 1; visibility: visible; }

.modal {
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(.94) translateY(12px);
  transition: transform .3s var(--ease-out);
  box-shadow: var(--shadow-lg);
}
.modal-backdrop.open .modal { transform: none; }
.modal-xs { max-width: 320px; padding: 0; }
.modal-sm { max-width: 480px; }
.modal-lg { max-width: 820px; }

.modal-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-shrink: 0;
}
.modal-head h2 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -.02em;
}
.modal-head-actions { display: flex; align-items: center; gap: 10px; }

.modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
}
.modal-body::-webkit-scrollbar { width: 6px; }
.modal-body::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; }

.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* Workspace switcher modal */
.ws-list { display: grid; gap: 6px; }
.ws-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  cursor: pointer;
  transition: all .2s var(--ease);
  text-align: left;
  width: 100%;
  font-family: inherit;
  color: var(--text);
}
.ws-item:hover { border-color: var(--brand); background: var(--surface); transform: translateY(-1px); }
.ws-item.active { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, transparent); }
.ws-item-info { flex: 1; min-width: 0; }
.ws-item-info strong { display: block; font-size: .86rem; font-weight: 600; }
.ws-item-info small { display: block; font-size: .74rem; color: var(--text-muted); margin-top: 2px; }
.ws-item-check { color: var(--brand); width: 16px; height: 16px; opacity: 0; }
.ws-item.active .ws-item-check { opacity: 1; }

/* Notifications */
.notif-list { display: grid; gap: 4px; }
.notif-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all .2s var(--ease);
}
.notif-item:hover { background: var(--surface); transform: translateX(3px); }
.notif-item.unread { background: color-mix(in srgb, var(--brand) 5%, transparent); }
.notif-icon {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.notif-icon svg { width: 15px; height: 15px; }
.notif-icon.critical { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.notif-icon.warning { background: color-mix(in srgb, var(--warning) 15%, transparent); color: var(--warning); }
.notif-icon.info { background: color-mix(in srgb, var(--info) 15%, transparent); color: var(--info); }
.notif-icon.success { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.notif-body { flex: 1; min-width: 0; }
.notif-body strong { display: block; font-size: .84rem; font-weight: 600; margin-bottom: 2px; }
.notif-body small { display: block; font-size: .76rem; color: var(--text-muted); line-height: 1.4; }
.notif-time { font-size: .68rem; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; margin-top: 4px; display: block; }

/* Event modal */
.event-modal-head { display: flex; align-items: center; gap: 12px; }
.event-modal-title { font-size: 1rem; font-weight: 700; letter-spacing: -.02em; }
.event-modal-sub { font-size: .76rem; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; margin-top: 2px; }

.event-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.event-detail-item {
  padding: 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.event-detail-item label {
  display: block;
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}
.event-detail-item span { font-size: .86rem; font-weight: 600; }
.event-log {
  padding: 14px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-family: 'JetBrains Mono', monospace;
  font-size: .76rem;
  line-height: 1.7;
  color: var(--text-muted);
  overflow-x: auto;
  white-space: pre-wrap;
}
.event-log .log-time { color: var(--text-dim); }
.event-log .log-ok { color: var(--success); }
.event-log .log-warn { color: var(--warning); }
.event-log .log-err { color: var(--danger); }

/* Customer modal */
.cust-modal-head { display: flex; gap: 14px; align-items: center; }
.cust-modal-name { font-size: 1.05rem; font-weight: 700; letter-spacing: -.02em; }
.cust-modal-sub { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }

.cust-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
.cust-metric {
  padding: 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.cust-metric-label {
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}
.cust-metric-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.cust-section { margin-bottom: 22px; }
.cust-section-title {
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 10px;
}
.cust-timeline { display: flex; flex-direction: column; gap: 10px; }
.cust-timeline-item {
  display: flex;
  gap: 12px;
  padding: 10px;
  border-radius: 8px;
  background: var(--surface);
  font-size: .82rem;
}
.cust-timeline-item time {
  font-family: 'JetBrains Mono', monospace;
  font-size: .72rem;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 80px;
}

/* Form */
.form-row { display: grid; gap: 6px; margin-bottom: 16px; }
.form-row label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
}
.form-row input,
.form-row textarea {
  padding: 10px 14px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: .86rem;
  outline: none;
  transition: all .2s var(--ease);
  resize: vertical;
}
.form-row input:focus,
.form-row textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent);
}
.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: .82rem;
  transition: all .2s var(--ease);
}
.checkbox-row:hover { border-color: var(--border-strong); background: var(--surface-2); }
.checkbox-row input { accent-color: var(--brand); }

/* User menu */
.user-menu-panel { padding: 6px; }
.user-menu-head {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.user-menu-avatar {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--info));
  color: #fff;
  font-weight: 700;
  font-size: .9rem;
  display: grid; place-items: center;
}
.user-menu-head strong { display: block; font-size: .88rem; font-weight: 700; }
.user-menu-head small { font-size: .74rem; color: var(--text-muted); }

.user-menu-list { display: grid; gap: 1px; }
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  border: none;
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all .15s var(--ease);
}
.user-menu-item:hover { background: var(--surface); transform: translateX(2px); }
.user-menu-item svg { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }
.user-menu-item.danger { color: var(--danger); }
.user-menu-item.danger svg { color: var(--danger); }
.user-menu-item.danger:hover { background: color-mix(in srgb, var(--danger) 8%, transparent); }
.user-menu-divider { height: 1px; background: var(--border); margin: 6px 8px; }

/* Command palette */
.cmd-palette {
  width: 100%;
  max-width: 560px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: scale(.94) translateY(12px);
  transition: transform .25s var(--ease-out);
}
.modal-backdrop.open .cmd-palette { transform: none; }

.cmd-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.cmd-input-wrap svg { width: 17px; height: 17px; color: var(--text-muted); flex-shrink: 0; }
.cmd-input-wrap input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: .95rem;
}
.cmd-input-wrap input::placeholder { color: var(--text-muted); }
.cmd-input-wrap kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: .68rem;
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.cmd-results { max-height: 400px; overflow-y: auto; padding: 8px; }
.cmd-section {
  padding: 10px 12px 4px;
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.cmd-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: none;
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: .85rem;
  cursor: pointer;
  transition: background .1s var(--ease);
  width: 100%;
  text-align: left;
}
.cmd-item:hover, .cmd-item.selected { background: var(--surface); }
.cmd-item svg { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }
.cmd-item-text { flex: 1; min-width: 0; }
.cmd-item-text strong { display: block; font-weight: 500; }
.cmd-item-text small { font-size: .72rem; color: var(--text-muted); }
.cmd-item kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: .62rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
}

/* ============ TOAST ============ */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
  pointer-events: none;
}
.toast {
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: .84rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  max-width: 400px;
  animation: toastIn .35s var(--ease-bounce);
  pointer-events: auto;
}
.toast.out { animation: toastOut .25s var(--ease) forwards; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px) scale(.92); }
  to { opacity: 1; transform: none; }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(30px) scale(.92); }
}
.toast-icon {
  width: 22px; height: 22px;
  border-radius: 6px;
  display: grid; place-items: center;
  flex-shrink: 0;
  color: #fff;
}
.toast-icon svg { width: 12px; height: 12px; }
.toast.success .toast-icon { background: var(--success); }
.toast.info .toast-icon { background: var(--brand); }
.toast.warning .toast-icon { background: var(--warning); }
.toast.error .toast-icon { background: var(--danger); }

/* ============ RESPONSIVE ============ */
@media (max-width: 1200px) {
  .grid-1-1-1 { grid-template-columns: 1fr 1fr; }
  .help-grid { grid-template-columns: 1fr; }
  .help-grid .panel-wide { grid-column: auto; }
}

@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-w);
    transform: translateX(-100%);
    transition: transform .3s var(--ease-out);
    z-index: 200;
  }
  .sidebar.open { transform: none; }
  .sidebar-toggle { display: grid; }
  .menu-btn { display: grid; }
  .grid-2-1 { grid-template-columns: 1fr; }
  .grid-1-1-1 { grid-template-columns: 1fr; }
  .copilot-drawer { width: 400px; }
  .topbar-search span { display: none; }
  .topbar-search { min-width: 44px; padding: 8px 12px; }
  .topbar-search kbd { display: none; }
  .quick-search { right: -60px; }
}

@media (max-width: 640px) {
  .view { padding: 16px 14px 40px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .copilot-trigger span { display: none; }
  .copilot-trigger { padding: 8px 10px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .copilot-suggestions { grid-template-columns: 1fr; }
  .event-detail-grid { grid-template-columns: 1fr; }
  .cust-metrics { grid-template-columns: 1fr 1fr; }
  .copilot-drawer { width: 100%; }
  .reports-grid { grid-template-columns: 1fr; }
  .view-title { font-size: 1.25rem; }
  .checkbox-grid { grid-template-columns: 1fr; }
  .quick-actions { bottom: 20px; right: 20px; }
  .qa-btn { width: 42px; height: 42px; }
  .qa-btn svg { width: 18px; height: 18px; }
  .quick-search { right: -20px; width: 340px; }
}

/* Utility */
.hidden { display: none !important; }
.mono { font-family: 'JetBrains Mono', monospace; }