:root {
  /* Color Palette - Industrial & Urgent (Rail/Transit aesthetic) */
  --bg-main: #0a0b10;
  --bg-card: #14161f;
  --bg-nav: #1c1f2b;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-primary: #3b82f6; /* Transit Blue */
  --accent-secondary: #f59e0b; /* Caution Yellow */
  --accent-success: #10b981;
  --accent-danger: #ef4444;
  --border-color: #2d334a;
  
  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --radius: 8px;
  
  /* Typography */
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-main);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
}

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

aside {
  background-color: var(--bg-nav);
  border-right: 1px solid var(--border-color);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

main {
  padding: var(--space-lg);
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* Navigation */
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--accent-primary);
}

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

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  text-decoration: none;
  color: var(--text-secondary);
  border-radius: var(--radius);
  transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active {
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--text-primary);
}

.nav-link.active {
  color: var(--accent-primary);
  font-weight: 600;
}

/* Components */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  overflow: hidden;
}

.grid-cols-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.grid-dashboard {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-md);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s;
  text-decoration: none;
  font-size: 0.9rem;
}

.btn-primary { background-color: var(--accent-primary); color: white; }
.btn-outline { background-color: transparent; border: 1px solid var(--border-color); color: var(--text-primary); }
.btn-ghost { background-color: transparent; color: var(--text-secondary); }

/* Status Badges */
.badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-on-time { background: rgba(16, 185, 129, 0.1); color: var(--accent-success); border: 1px solid var(--accent-success); }
.badge-delayed { background: rgba(239, 68, 68, 0.1); color: var(--accent-danger); border: 1px solid var(--accent-danger); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--accent-secondary); border: 1px solid var(--accent-secondary); }

/* Tables */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--space-sm);
}

th {
  text-align: left;
  padding: var(--space-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-color);
}

td {
  padding: var(--space-sm);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}

/* Specific UI Elements */
.stat-value {
  font-size: 2rem;
  font-weight: 800;
  margin: var(--space-xs) 0;
}

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

.placeholder-icon {
  width: 20px;
  height: 20px;
  display: inline-block;
  background: currentColor;
  opacity: 0.2;
  border-radius: 4px;
}

.map-placeholder {
  width: 100%;
  height: 400px;
  background: #1a1d28;
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.map-grid {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(59, 130, 246, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
}

.vehicle-node {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--accent-success);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-success);
}

.vehicle-node.delayed {
  background: var(--accent-danger);
  box-shadow: 0 0 10px var(--accent-danger);
}

.w3w-tag {
  font-family: var(--font-mono);
  color: var(--accent-danger);
  font-size: 0.8rem;
}

/* Duty Timeline Visualizer */
.timeline {
  display: flex;
  gap: 2px;
  height: 8px;
  background: #2d334a;
  border-radius: 4px;
  overflow: hidden;
  margin-top: var(--space-sm);
}

.timeline-segment { height: 100%; }
.timeline-segment.active { background: var(--accent-success); }
.timeline-segment.pending { background: var(--accent-primary); }

/* Forms */
.form-group { margin-bottom: var(--space-md); }
.form-label { display: block; color: var(--text-secondary); margin-bottom: var(--space-xs); font-size: 0.85rem; }
.form-control {
  width: 100%;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.6rem;
  border-radius: 4px;
}

/* Sidebar Toggle/Active Marker */
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  width: 4px;
  height: 24px;
  background: var(--accent-primary);
  border-radius: 0 4px 4px 0;
}

/* Duty Creator Components */
.action-hero {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(10, 11, 16, 0.4) 100%);
  border: 1px solid rgba(59, 130, 246, 0.3);
  position: relative;
  overflow: hidden;
}

.action-hero::after {
  content: 'START HERE';
  position: absolute;
  top: 12px;
  right: -30px;
  background: var(--accent-primary);
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 4px 40px;
  transform: rotate(45deg);
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.error-card {
  border-left: 4px solid var(--accent-danger);
  background: rgba(239, 68, 68, 0.03);
}

.ready-card {
  border-left: 4px solid var(--accent-success);
}

.step-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.step {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.step.active { color: var(--accent-primary); font-weight: 600; }
.step-line { flex: 1; height: 1px; background: var(--border-color); }

.blockade-group {
  margin-bottom: var(--space-lg);
}

.blockade-header {
  background: rgba(255, 255, 255, 0.03);
  padding: var(--space-sm);
  border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid var(--border-color);
  border-bottom: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.duty-row-nested {
  margin-left: var(--space-md);
  padding: var(--space-sm);
  border-left: 2px solid var(--border-color);
  background: rgba(255, 255, 255, 0.01);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.duty-row-nested:last-child {
  border-radius: 0 0 var(--radius) var(--radius);
}

.btn-success { background-color: var(--accent-success); color: white; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  width: 90%;
  max-width: 500px;
  border-radius: 12px;
  padding: var(--space-lg);
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.route-option {
  padding: var(--space-sm);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: var(--space-xs);
  cursor: pointer;
  transition: all 0.2s;
}

.route-option:hover {
  border-color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.05);
}

.route-option.selected {
  border-color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.1);
}

.alert-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-danger);
  display: inline-block;
  margin-right: 4px;
}
