:root {
  color-scheme: dark;
  --bg: #0f172a;
  --card: #111827;
  --border: #1f2937;
  --muted: #94a3b8;
  --text: #e2e8f0;
  --accent: #ec4899;
  --net: #38bdf8;
  --epex: #22c55e;
}

body {
  font-family: Inter, Arial, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  font-size: 22px;
  font-weight: 800;
  padding: 0 20px 20px;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 12px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  padding: 12px;
  border-radius: 10px;
  font-size: 15px;
  transition: background 0.15s ease;
}

.sidebar-link:hover,
.sidebar-link.active {
  background: rgba(236, 72, 153, 0.12);
  color: #f9a8d4;
}

.sidebar-icon {
  font-size: 18px;
  line-height: 1;
}

.content {
  min-width: 0;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

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

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-top: 20px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  margin-top: 6px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(280px, 1.4fr) minmax(0, 2fr);
  gap: 20px;
  align-items: stretch;
}

.hero-main {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.18), rgba(56, 189, 248, 0.10));
  border: 1px solid #334155;
  border-radius: 18px;
  padding: 22px;
}

.hero-kicker {
  color: #f9a8d4;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-value {
  font-size: 48px;
  font-weight: 800;
  line-height: 1;
  margin: 10px 0 8px;
}

.hero-meta {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 14px;
  color: #cbd5e1;
}

.hero-meta strong {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.forecast-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.forecast-slot {
  background: #0b1220;
  border: 1px solid #223047;
  border-radius: 14px;
  padding: 16px;
}

.forecast-slot-cheap {
  border-color: #14532d;
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.12), rgba(11, 18, 32, 1));
}

.forecast-slot-expensive {
  border-color: #7f1d1d;
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.14), rgba(11, 18, 32, 1));
}

.forecast-slot-time {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.forecast-slot-price {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
}

.forecast-slot-unit {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.best-window {
  margin-top: 12px;
  background: #0b1220;
  border: 1px solid #223047;
  border-radius: 14px;
  padding: 16px;
}

.best-window-label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.best-window-time {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.best-window-price {
  color: #86efac;
  margin-top: 6px;
  font-size: 14px;
}

.graph-wrap {
  position: relative;
}

.graph-tooltip {
  position: fixed;
  display: none;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid #334155;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 1000;
}

.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  color: #cbd5e1;
  font-size: 14px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend-swatch {
  width: 14px;
  height: 3px;
  border-radius: 999px;
  display: inline-block;
}

h2 {
  margin: 0 0 16px;
  font-size: 22px;
}

svg {
  width: 100%;
  height: auto;
  display: block;
}

.empty-state {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.offline-banner {
  display: none;
  background: #7f1d1d;
  color: #fff;
  text-align: center;
  padding: 8px;
  font-size: 14px;
}

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

  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
  }

  .sidebar-brand {
    padding: 0 16px 12px;
    margin-bottom: 8px;
  }

  .sidebar-nav {
    flex-direction: row;
    padding: 0 12px;
    overflow-x: auto;
  }

  .sidebar-link {
    white-space: nowrap;
  }

  main {
    padding: 16px;
  }

  h1 {
    font-size: 24px;
  }

  .card {
    padding: 16px;
    border-radius: 14px;
  }

  .stat-value {
    font-size: 22px;
  }

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

  .hero-value {
    font-size: 36px;
  }

  .forecast-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.form-grid {
  display: grid;
  gap: 16px;
}

.form-grid h2 {
  margin-top: 8px;
  margin-bottom: 0;
  font-size: 18px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: #cbd5e1;
}

.form-grid input,
.form-grid select {
  background: #0b1220;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 15px;
}

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  justify-self: start;
}

.btn.danger {
  background: #7f1d1d;
}

.flash {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid #14532d;
  color: #86efac;
  padding: 12px 16px;
  border-radius: 10px;
  margin-top: 16px;
}

.trip-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.trip-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0b1220;
  border: 1px solid #223047;
  border-radius: 10px;
  padding: 12px 14px;
}

.inline-form {
  margin: 0;
}

.warning-list {
  background: rgba(239, 68, 68, 0.10);
  border: 1px solid #7f1d1d;
  color: #fca5a5;
  border-radius: 10px;
  padding: 12px 16px;
  margin: 0 0 16px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  color: var(--muted);
  font-weight: 600;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.form-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

textarea {
  width: 100%;
  background: var(--input-bg, #1e293b);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font: inherit;
  resize: vertical;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge.success {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.badge.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.site-footer {
  padding: 1rem;
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
  border-top: 1px solid #1e293b;
  margin-top: 1rem;
}
