:root {
  --bg-dark: #0a0e17;
  --bg-section: #0f1420;
  --bg-card: #161c2e;
  --fg: #e8ecf4;
  --fg-muted: #8892a8;
  --accent: #f59e0b;
  --accent-glow: rgba(245, 158, 11, 0.15);
  --accent-bright: #fbbf24;
  --border: rgba(136, 146, 168, 0.12);
  --radius: 12px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg-dark);
  color: var(--fg);
  font-family: 'DM Sans', -apple-system, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: 'Space Grotesk', sans-serif;
  line-height: 1.15;
  font-weight: 700;
}

.accent {
  color: var(--accent);
}

/* ====== HERO ====== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 80px 24px 60px;
  background:
    radial-gradient(ellipse 60% 50% at 70% 0%, rgba(245, 158, 11, 0.08) 0%, transparent 70%),
    radial-gradient(ellipse 40% 60% at 0% 50%, rgba(59, 130, 246, 0.05) 0%, transparent 60%),
    var(--bg-dark);
}

.hero-inner {
  max-width: 900px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid rgba(245, 158, 11, 0.25);
  padding: 6px 16px;
  border-radius: 100px;
  margin-bottom: 32px;
}

.hero h1 {
  font-size: clamp(2.8rem, 7vw, 5.2rem);
  margin-bottom: 28px;
  letter-spacing: -0.02em;
}

.lede {
  font-size: 1.15rem;
  color: var(--fg-muted);
  max-width: 620px;
  margin-bottom: 56px;
  line-height: 1.7;
}

.hero-stats {
  display: flex;
  gap: 48px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
}

.stat-number {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-bright);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin-top: 4px;
}

/* ====== PROBLEM ====== */
.problem {
  padding: 100px 24px;
  background: var(--bg-section);
}

.problem-inner {
  max-width: 1000px;
  margin: 0 auto;
}

.problem h2 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin-bottom: 56px;
  text-align: center;
}

.problem-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.problem-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  transition: border-color 0.2s;
}

.problem-card:hover {
  border-color: rgba(245, 158, 11, 0.3);
}

.problem-icon {
  font-size: 1.8rem;
  margin-bottom: 16px;
}

.problem-card h3 {
  font-size: 1.15rem;
  margin-bottom: 10px;
}

.problem-card p {
  font-size: 0.95rem;
  color: var(--fg-muted);
  line-height: 1.65;
}

/* ====== FEATURES ====== */
.features {
  padding: 100px 24px;
  background: var(--bg-dark);
}

.features-inner {
  max-width: 1000px;
  margin: 0 auto;
}

.features-header {
  margin-bottom: 64px;
}

.features-header h2 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin-bottom: 16px;
}

.features-sub {
  font-size: 1.1rem;
  color: var(--fg-muted);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.feature-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  transition: transform 0.2s, border-color 0.2s;
}

.feature-block:hover {
  transform: translateY(-2px);
  border-color: rgba(245, 158, 11, 0.3);
}

.feature-large {
  grid-column: span 2;
  background:
    linear-gradient(135deg, rgba(245, 158, 11, 0.06) 0%, transparent 60%),
    var(--bg-card);
}

.feature-tag {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 14px;
}

.feature-block h3 {
  font-size: 1.2rem;
  margin-bottom: 10px;
}

.feature-block p {
  font-size: 0.95rem;
  color: var(--fg-muted);
  line-height: 1.65;
}

/* ====== NUMBERS ====== */
.numbers {
  padding: 100px 24px;
  background: var(--bg-section);
  text-align: center;
}

.numbers-inner {
  max-width: 900px;
  margin: 0 auto;
}

.numbers h2 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin-bottom: 56px;
}

.numbers-row {
  display: flex;
  justify-content: center;
  gap: 64px;
  flex-wrap: wrap;
  margin-bottom: 48px;
}

.number-item {
  display: flex;
  flex-direction: column;
}

.big-number {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  font-weight: 700;
  color: var(--accent-bright);
  line-height: 1;
}

.number-desc {
  font-size: 0.9rem;
  color: var(--fg-muted);
  margin-top: 10px;
}

.numbers-kicker {
  font-size: 1.1rem;
  color: var(--fg-muted);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.65;
}

/* ====== CLOSING ====== */
.closing {
  padding: 120px 24px;
  background:
    radial-gradient(ellipse 50% 40% at 50% 100%, rgba(245, 158, 11, 0.06) 0%, transparent 70%),
    var(--bg-dark);
  text-align: center;
}

.closing-inner {
  max-width: 700px;
  margin: 0 auto;
}

.closing h2 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 24px;
}

.closing-text {
  font-size: 1.15rem;
  color: var(--fg-muted);
  line-height: 1.7;
  margin-bottom: 20px;
}

.closing-vision {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  color: var(--accent);
  font-weight: 500;
}

/* ====== FOOTER ====== */
.site-footer {
  padding: 40px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-dark);
}

.footer-inner {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-brand {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
}

.footer-tagline {
  font-size: 0.85rem;
  color: var(--fg-muted);
}

/* ====== NAVIGATION ====== */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--fg);
}

.nav-brand span { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  padding: 8px 16px;
  font-size: 0.9rem;
  color: var(--fg-muted);
  text-decoration: none;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}

.nav-link:hover { color: var(--fg); background: rgba(255,255,255,0.05); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #000;
}

.btn-primary:hover { background: var(--accent-bright); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-outline {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
}

.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-sm { padding: 7px 14px; font-size: 0.82rem; }

/* hero CTA */
.hero-cta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 56px;
}

/* ====== DASHBOARD ====== */
.dashboard-page {
  padding: 80px 24px 60px;
  max-width: 1100px;
  margin: 0 auto;
  min-height: 100vh;
}

.dashboard-header {
  margin-bottom: 40px;
  padding-top: 24px;
}

.dashboard-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin-bottom: 8px;
}

.dashboard-header p {
  color: var(--fg-muted);
  font-size: 1rem;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
  align-items: start;
}

/* ─── Route Form ─── */
.route-form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

.form-title {
  font-size: 1.1rem;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--fg);
}

.form-group {
  margin-bottom: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg-muted);
  margin-bottom: 7px;
  letter-spacing: 0.03em;
}

input, select {
  width: 100%;
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 14px;
  color: var(--fg);
  font-size: 0.95rem;
  font-family: 'DM Sans', sans-serif;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

input::placeholder { color: var(--fg-muted); opacity: 0.6; }

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

.form-section-title {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
  text-transform: uppercase;
  margin: 24px 0 14px;
}

.error-banner {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  padding: 12px 16px;
  color: #fca5a5;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.hidden { display: none !important; }

/* spinner */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0,0,0,0.3);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.calculating .route-form-card {
  opacity: 0.7;
  pointer-events: none;
}

/* ─── History sidebar ─── */
.history-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: sticky;
  top: 80px;
}

.history-sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-list {
  max-height: 500px;
  overflow-y: auto;
}

.history-card {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.history-card:hover { background: rgba(255,255,255,0.03); }

.hist-route {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}

.hist-meta {
  display: flex;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--fg-muted);
}

.hist-date { margin-left: auto; }

.empty-state {
  padding: 24px 20px;
  font-size: 0.88rem;
  color: var(--fg-muted);
  line-height: 1.5;
}

/* ─── Result section ─── */
#result-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.route-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.route-arrow { color: var(--accent); font-size: 1.3rem; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.summary-card {
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 16px;
  text-align: center;
  transition: border-color 0.2s;
}

.accent-card {
  border-color: rgba(245, 158, 11, 0.3);
  background: var(--accent-glow);
}

.card-icon { font-size: 1.4rem; margin-bottom: 8px; }

.card-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent-bright);
  line-height: 1;
  margin-bottom: 4px;
}

.card-label {
  font-size: 0.82rem;
  color: var(--fg-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.card-sub { font-size: 0.75rem; color: var(--fg-muted); }

.warnings-box {
  background: rgba(245, 158, 11, 0.07);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 24px;
}

.warnings-box ul { list-style: none; }

.warnings-box li {
  font-size: 0.9rem;
  color: #fde68a;
  padding: 3px 0;
}

.result-block { margin-bottom: 32px; }

.block-title {
  font-size: 1rem;
  margin-bottom: 14px;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}

.data-table th {
  background: var(--bg-section);
  padding: 10px 14px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--fg-muted);
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.data-table td {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  color: var(--fg);
}

.data-table tr:hover td { background: rgba(255,255,255,0.02); }

.seg-notes { font-size: 0.78rem; color: var(--fg-muted); max-width: 220px; }

.accent-text { color: var(--accent-bright); font-weight: 600; }

.badge {
  display: inline-block;
  background: var(--accent-glow);
  border: 1px solid rgba(245,158,11,0.25);
  color: var(--accent);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.rest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.rest-card {
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.rest-icon { font-size: 1.4rem; flex-shrink: 0; }

.rest-info { flex: 1; }

.rest-location { font-weight: 700; font-size: 0.9rem; margin-bottom: 4px; }

.rest-reason { font-size: 0.8rem; color: var(--fg-muted); }

.rest-duration {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  color: var(--accent-bright);
  font-size: 0.95rem;
  white-space: nowrap;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
  .problem-grid {
    grid-template-columns: 1fr;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .feature-large {
    grid-column: span 1;
  }

  .hero-stats {
    gap: 32px;
  }

  .numbers-row {
    gap: 40px;
  }

  .footer-inner {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .hero {
    padding: 60px 20px 40px;
  }

  .problem,
  .features,
  .numbers {
    padding: 72px 20px;
  }

  .closing {
    padding: 80px 20px;
  }
}

/* ─── Dashboard responsive ─── */
@media (max-width: 900px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .history-sidebar {
    position: static;
    order: -1;
  }

  .history-list { max-height: 200px; }

  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .dashboard-page { padding: 72px 16px 40px; }

  .route-form-card, #result-section { padding: 20px 16px; }

  .summary-grid { grid-template-columns: 1fr 1fr; }

  .form-row { grid-template-columns: 1fr; }

  .result-header { flex-direction: column; align-items: flex-start; }

  .route-title { font-size: 0.95rem; }
}