#app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-primary);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 200ms, transform 300ms;
  overflow: hidden;
  z-index: 50;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .sidebar-group-label,
.sidebar.collapsed .sidebar-item span,
.sidebar.collapsed .sidebar-footer span { display: none; }

.sidebar-header {
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border-default);
  height: 56px;
}
.sidebar-logo {
  width: 20px; height: 20px;
  fill: var(--accent-gold);
  flex-shrink: 0;
}
.sidebar-title {
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.sidebar-group { margin-bottom: 2px; }
.sidebar-group-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-tertiary);
  padding: 12px 20px 4px;
  white-space: nowrap;
  opacity: 0.5;
  transition: opacity 150ms;
}
.sidebar-group:hover .sidebar-group-label { opacity: 0.8; }
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  margin: 1px 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  font-size: 13px;
  border-radius: 8px;
  position: relative;
}
.sidebar-item:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
}
.sidebar-item:active {
  background: rgba(255,255,255,0.06);
  transform: scale(0.98);
}
.sidebar-item.active {
  color: var(--text-primary);
  background: rgba(212,175,55,0.08);
  font-weight: 500;
}
.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent-gold);
}
.sidebar-item svg { width: 16px; height: 16px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.5; opacity: 0.7; transition: opacity 150ms; }
.sidebar-item:hover svg, .sidebar-item.active svg { opacity: 1; }
.sidebar-item .sidebar-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--accent-gold-subtle);
  color: var(--accent-gold);
  padding: 1px 5px;
  border-radius: 8px;
}

.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0,0,0,0.2);
}

.mobile-menu-btn {
  display: none;
  background: none; border: none; color: var(--text-primary); cursor: pointer; padding: 4px;
}
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 40;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.topbar {
  height: 56px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
  gap: 12px;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title { font-weight: 600; font-size: 16px; white-space: nowrap; }
.topbar-breadcrumb {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-tertiary);
}
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.detail-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 480px; max-width: 90vw;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-default);
  box-shadow: var(--shadow-lg);
  z-index: 60;
  transform: translateX(100%);
  transition: transform 300ms;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.detail-panel.open { transform: translateX(0); }
.detail-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}
.detail-panel-tabs {
  display: flex; border-bottom: 1px solid var(--border-default); flex-shrink: 0;
}
.detail-panel-tab {
  padding: 8px 16px; font-size: 11px; cursor: pointer;
  color: var(--text-tertiary); border-bottom: 2px solid transparent;
  font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.5px;
  transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
}
.detail-panel-tab:hover { color: var(--text-secondary); background: rgba(255,255,255,0.02); }
.detail-panel-tab.active { color: var(--accent-gold); border-bottom-color: var(--accent-gold); }
.detail-panel-body { flex: 1; overflow-y: auto; padding: 20px; }

.palette-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 120px;
  z-index: 100;
  opacity: 0; pointer-events: none;
  transition: opacity 150ms;
}
.palette-overlay.open { opacity: 1; pointer-events: all; }

.palette {
  width: 560px; max-width: 94vw;
  max-height: 400px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.palette-input {
  font-family: var(--font-heading);
  font-size: 16px;
  background: transparent; border: none;
  border-bottom: 1px solid var(--border-default);
  color: var(--text-primary);
  padding: 14px 16px;
  outline: none; width: 100%;
}
.palette-results { overflow-y: auto; flex: 1; }
.palette-item {
  padding: 8px 16px; display: flex; align-items: center; gap: 10px;
  cursor: pointer; font-size: 13px; color: var(--text-secondary);
  transition: all 100ms cubic-bezier(0.4, 0, 0.2, 1);
  margin: 1px 4px;
  border-radius: 6px;
}
.palette-item:hover, .palette-item.selected {
  background: rgba(255,255,255,0.05); color: var(--text-primary);
}
.palette-item:active { transform: scale(0.99); }
.palette-item-shortcut {
  margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--text-tertiary);
}

.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px; text-align: center; color: var(--text-tertiary);
}
.empty-state svg { opacity: 0.3; margin-bottom: 16px; }
.empty-state p { font-size: 13px; max-width: 300px; }

.sparkline { display: inline-flex; align-items: flex-end; gap: 1px; height: 24px; }
.sparkline-bar {
  width: 3px; background: var(--accent-gold-subtle); border-radius: 1px;
  transition: height 200ms;
}

.progress-bar {
  height: 4px; background: var(--bg-elevated); border-radius: 2px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; border-radius: 2px; transition: width 300ms;
}

.tab-bar { display: flex; border-bottom: 1px solid var(--border-default); margin-bottom: 16px; }
.tab-bar-item {
  padding: 8px 16px; font-size: 13px; cursor: pointer;
  color: var(--text-tertiary); border-bottom: 2px solid transparent;
  transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
}
.tab-bar-item:hover { color: var(--text-secondary); background: rgba(255,255,255,0.02); }
.tab-bar-item.active { color: var(--text-primary); border-bottom-color: var(--accent-gold); }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes countUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: 200px 0; }
}
.fade-in { animation: fadeIn 200ms ease-out; }

.content .card { animation: fadeInUp 300ms ease-out both; }
.content .card:nth-child(1) { animation-delay: 0ms; }
.content .card:nth-child(2) { animation-delay: 40ms; }
.content .card:nth-child(3) { animation-delay: 80ms; }
.content .card:nth-child(4) { animation-delay: 120ms; }
.content .card:nth-child(5) { animation-delay: 160ms; }
.content .card:nth-child(6) { animation-delay: 200ms; }
.content .card:nth-child(7) { animation-delay: 240ms; }
.content .card:nth-child(8) { animation-delay: 280ms; }
.content .card:nth-child(n+9) { animation-delay: 300ms; }

.content .grid { animation: fadeIn 200ms ease-out; }
.content table { animation: fadeIn 250ms ease-out; }

.metric-value { animation: countUp 400ms ease-out; }

.skeleton {
  background: linear-gradient(90deg, #111 25%, #1a1a1a 50%, #111 75%);
  background-size: 400px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width) !important;
    transform: translateX(-100%);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-backdrop.visible { display: block; }
  .mobile-menu-btn { display: block; }
  .topbar { padding: 0 16px; }
  .content { padding: 16px; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .palette { width: 94vw; }
  .palette-overlay { padding-top: 60px; }
  .detail-panel { width: 100vw; }
  .topbar-breadcrumb { display: none; }
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  .metric-value { font-size: 20px; }
  .content .card { animation-delay: 0ms !important; }
  .btn { font-size: 12px; padding: 6px 10px; }
}

@media (max-width: 480px) {
  .topbar-title { font-size: 14px; }
  .content { padding: 12px; }
  .card { padding: 12px; }
}
