:root {
  --bg-dark: #070b14;
  --bg-card: rgba(15, 23, 42, 0.85);
  --bg-card-hover: rgba(30, 41, 59, 0.92);
  --border-subtle: rgba(148, 163, 184, 0.16);
  --border-glow: rgba(56, 189, 248, 0.45);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --accent-cyan: #38bdf8;
  --accent-indigo: #6366f1;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #a855f7;
  --radius-lg: 14px;
  --radius-md: 10px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: radial-gradient(circle at 15% 15%, #0f172a 0%, #070b14 60%, #030712 100%);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.55;
}

/* Header */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  background: rgba(10, 15, 29, 0.9);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-wrap: wrap;
  gap: 14px;
}

.brand-box {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: #fff;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.35);
}

.brand-title h1 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #fff, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-title p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.14);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.65; }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 15px;
  border-radius: 8px;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: rgba(30, 41, 59, 0.85);
  color: var(--text-main);
  text-decoration: none;
  transition: all 0.18s ease;
}

.btn:hover {
  border-color: var(--accent-cyan);
  background: rgba(51, 65, 85, 0.95);
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #4f46e5);
  border-color: rgba(56, 189, 248, 0.5);
  color: #fff;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1, #4338ca);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.35);
}

.btn-emerald {
  background: linear-gradient(135deg, #059669, #10b981);
  border-color: rgba(16, 185, 129, 0.5);
  color: #fff;
}

.btn-amber {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.45);
  color: #fbbf24;
}

/* Main Layout */
.container {
  max-width: 1480px;
  margin: 0 auto;
  padding: 22px 28px 60px;
}

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

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent-cyan);
}

.kpi-card.emerald::before { background: var(--accent-emerald); }
.kpi-card.purple::before { background: var(--accent-purple); }
.kpi-card.amber::before { background: var(--accent-amber); }
.kpi-card.rose::before { background: var(--accent-rose); }

.kpi-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
}

.kpi-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab-btn {
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(30, 41, 59, 0.8);
}

.tab-btn.active {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.22), rgba(99, 102, 241, 0.22));
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.15);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.22s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Section Grids & Cards */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(460px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color 0.2s ease;
}

.card:hover {
  border-color: rgba(148, 163, 184, 0.32);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-cyan { background: rgba(56, 189, 248, 0.16); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.35); }
.badge-emerald { background: rgba(16, 185, 129, 0.16); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.35); }
.badge-purple { background: rgba(168, 85, 247, 0.16); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.35); }
.badge-amber { background: rgba(245, 158, 11, 0.16); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.35); }

/* Progress Bar */
.progress-wrap {
  background: rgba(15, 23, 42, 0.9);
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  margin: 10px 0;
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-emerald));
  border-radius: 999px;
  transition: width 0.35s ease;
}

/* Task List */
.task-list {
  list-style: none;
  margin-top: 10px;
}

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.task-item:hover {
  background: rgba(30, 41, 59, 0.65);
}

.task-item input[type="checkbox"] {
  margin-top: 4px;
  accent-color: var(--accent-emerald);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.task-item.done .task-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-owner {
  margin-left: auto;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(51, 65, 85, 0.7);
  color: #cbd5e1;
  white-space: nowrap;
}

/* Product Cards */
.feature-list {
  margin: 12px 0 16px 18px;
  color: #cbd5e1;
  font-size: 0.85rem;
}

.feature-list li {
  margin-bottom: 5px;
}

.card-footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

/* 3D Inspector Layout */
.inspector-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 18px;
  height: 640px;
}

@media (max-width: 980px) {
  .inspector-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
}

.asset-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.asset-list-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.asset-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.82rem;
  margin-bottom: 4px;
  border: 1px solid transparent;
}

.asset-row:hover {
  background: rgba(30, 41, 59, 0.8);
}

.asset-row.active {
  background: rgba(14, 165, 233, 0.18);
  border-color: rgba(56, 189, 248, 0.45);
  color: #38bdf8;
  font-weight: 600;
}

.viewport-panel {
  background: #050811;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#three-inspector-canvas {
  width: 100%;
  flex: 1;
  min-height: 480px;
  display: block;
}

.viewport-overlay-top {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  flex-wrap: wrap;
  gap: 8px;
}

.viewport-controls {
  display: flex;
  gap: 8px;
  pointer-events: auto;
  background: rgba(15, 23, 42, 0.85);
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
}

.viewport-stats-bar {
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid var(--border-subtle);
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.82rem;
}

/* Leads Table / Cards */
.lead-filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
  background: var(--bg-card);
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.lead-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 14px;
  transition: all 0.18s ease;
}

.lead-card:hover {
  border-color: var(--accent-cyan);
}

.lead-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 8px 0 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.proposal-preview-box {
  background: rgba(7, 11, 20, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 0.8rem;
  color: #e2e8f0;
  white-space: pre-wrap;
  max-height: 170px;
  overflow-y: auto;
  margin: 10px 0;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.82);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 24px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  background: #0f172a;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 16px;
  max-width: 920px;
  width: 100%;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.95);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 0.84rem;
  white-space: pre-wrap;
  color: #e2e8f0;
  line-height: 1.65;
}
