:root {
  /* Colors */
  --bg-main: #09090b;
  --bg-card: #18181b;
  --bg-elevated: #27272a;
  --border: #3f3f46;
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  
  /* Status Colors */
  --status-safe: #10b981;
  --status-risk: #f59e0b;
  --status-illegal: #ef4444;
  --status-ai: #3b82f6;
  --status-locked: #52525b;
  
  /* Gradients */
  --grad-primary: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  --grad-ai: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  
  /* UI Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Layout */
.app-container {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  position: sticky;
  top: 0;
  height: 100vh;
}

.logo {
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.05em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.logo-icon {
  width: 28px;
  height: 28px;
  background: var(--grad-primary);
  border-radius: 6px;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.nav-item {
  text-decoration: none;
  color: var(--text-secondary);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.main-content {
  padding: var(--space-xl);
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* Typography */
h1 { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: var(--space-lg); }
h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: var(--space-md); }
.text-muted { color: var(--text-muted); font-size: 0.875rem; }
.text-secondary { color: var(--text-secondary); font-size: 0.875rem; }

/* Dashboard Cards */
.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.stat-value {
  font-size: 1.875rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
}

/* Anchor View Components */
.anchor-section {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: var(--space-xl);
  align-items: start;
}

.anchor-card {
  background: var(--bg-card);
  border: 2px solid var(--status-ai);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  position: relative;
}

.badge-ai {
  background: var(--status-ai);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  position: absolute;
  top: -10px;
  right: 20px;
}

.timeline-viz {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  min-height: 400px;
  position: relative;
}

.timeline-axis {
  height: 2px;
  background: var(--border);
  width: 100%;
  position: absolute;
  top: 50%;
  left: 0;
}

.timeline-marker {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-muted);
  margin-bottom: 8px;
}

.dot.anchor {
  width: 20px;
  height: 20px;
  background: var(--status-ai);
  box-shadow: 0 0 15px var(--status-ai);
}

.dot.risk {
  background: var(--status-risk);
}

/* Table Style */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: var(--space-lg);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: var(--bg-elevated);
  text-align: left;
  padding: 14px 20px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

td {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

/* Feasibility Simulator */
.simulator-layout {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: var(--space-xl);
}

.sim-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
}

.sim-day {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  min-height: 100px;
  transition: transform 0.2s;
}

.sim-day.status-safe { border-top: 4px solid var(--status-safe); }
.sim-day.status-tight { border-top: 4px solid var(--status-risk); }
.sim-day.status-violation { border-top: 4px solid var(--status-illegal); opacity: 0.6; }

.decision-feed {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid var(--border);
}

.feed-item {
  padding-bottom: 16px;
  border-left: 2px solid var(--status-ai);
  padding-left: 16px;
  margin-bottom: 16px;
  position: relative;
}

.feed-item::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--status-ai);
  border-radius: 50%;
  position: absolute;
  left: -5px;
  top: 0;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--grad-primary);
  color: white;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

/* Utilities */
.status-pill {
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pill-ai { background: rgba(59, 130, 246, 0.1); color: var(--status-ai); border: 1px solid rgba(59, 130, 246, 0.2); }
.pill-safe { background: rgba(16, 185, 129, 0.1); color: var(--status-safe); border: 1px solid rgba(16, 185, 129, 0.2); }
.pill-risk { background: rgba(245, 158, 11, 0.1); color: var(--status-risk); border: 1px solid rgba(245, 158, 11, 0.2); }

.placeholder-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.animate-spin {
  animation: spin 2s linear infinite;
}
