:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel-2: #334155;
  --text: #f1f5f9;
  --text-dim: #94a3b8;
  --accent: #38bdf8;
  --accent-2: #22c55e;
  --warn: #f59e0b;
  --radius: 14px;
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--panel-2);
}
.topbar h1 { font-size: 1.1rem; font-weight: 600; }

.dot {
  width: 12px; height: 12px; border-radius: 50%;
  display: inline-block;
}
.dot--live { background: var(--accent-2); box-shadow: 0 0 0 0 rgba(34,197,94,.7); animation: pulse 1.8s infinite; }
.dot--idle { background: var(--text-dim); }
.dot--error { background: #ef4444; }
.dot--done { background: var(--accent); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,.6); }
  70% { box-shadow: 0 0 0 10px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

/* Screens */
.screen { height: calc(100vh - 49px); }
.hidden { display: none !important; }

.screen--center {
  display: flex; align-items: center; justify-content: center; padding: 20px;
}

.card {
  background: var(--panel); padding: 28px; border-radius: var(--radius);
  max-width: 460px; border: 1px solid var(--panel-2);
}
.card h2 { margin-bottom: 10px; }
.card p { color: var(--text-dim); line-height: 1.5; }
.card code {
  background: var(--bg); padding: 2px 6px; border-radius: 4px;
  font-size: .85em; color: var(--accent);
}

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  height: 100%;
}
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
}

/* Stats panel */
.stats-panel {
  background: var(--panel);
  padding: 20px;
  border-right: 1px solid var(--panel-2);
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px;
}
@media (max-width: 820px) {
  .stats-panel { border-right: none; border-bottom: 1px solid var(--panel-2); }
}

.progress-bar {
  height: 10px; background: var(--bg); border-radius: 99px; overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .6s ease;
  border-radius: 99px;
}

.stat-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stat-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 14px;
  display: flex; flex-direction: column; gap: 4px;
  border: 1px solid transparent;
}
.stat-card--primary { border-color: var(--accent); }
.stat-card--accent { border-color: var(--accent-2); }
.stat-card--driving { border-color: var(--warn); }
.stat-card--maxspeed { border-color: #f43f5e; }
.stat-sub--dim { opacity: 0.6; }
.stat-card--driving.is-driving {
  box-shadow: 0 0 0 2px var(--warn) inset;
  animation: driveGlow 2s ease-in-out infinite;
}
@keyframes driveGlow {
  0%, 100% { box-shadow: 0 0 0 2px rgba(245,158,11,.5) inset; }
  50% { box-shadow: 0 0 0 2px rgba(245,158,11,1) inset; }
}
.stat-card--wide { grid-column: 1 / -1; }

.stat-label {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-dim);
}
.stat-value { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.stat-value--small { font-size: 1rem; font-weight: 600; }
.stat-sub { font-size: .8rem; color: var(--text-dim); }

.distance-row {
  display: flex; gap: 8px; justify-content: center;
  font-size: .85rem; color: var(--text-dim);
}
.distance-row .sep { opacity: .5; }

/* Map */
.map { width: 100%; height: 100%; min-height: 300px; background: #0b1120; }

/* Leaflet tweaks pentru tema inchisa */
.leaflet-container { background: #0b1120; }

/* Stops section */
.stops-section { margin-top: 4px; }
.stops-title {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-dim); margin-bottom: 8px;
}
.stops-grid {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.stops-empty {
  font-size: .8rem; color: var(--text-dim); opacity: .7;
}
.stop-chip {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--bg); border: 1px solid var(--panel-2);
  border-radius: 10px; padding: 8px 12px; min-width: 64px;
}
.stop-chip__emoji { font-size: 1.3rem; }
.stop-chip__count { font-size: 1.1rem; font-weight: 700; }
.stop-chip__dur { font-size: .7rem; color: var(--text-dim); }
.stop-chip__label { font-size: .7rem; color: var(--text-dim); }

/* Costs section */
.costs-section { margin-top: 12px; }
.costs-grid {
  display: flex; gap: 8px; align-items: stretch;
}
.cost-chip {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--bg); border: 1px solid var(--panel-2);
  border-radius: 10px; padding: 10px; flex: 1; min-width: 0;
}
.cost-chip__emoji { font-size: 1.3rem; }
.cost-chip__amount { font-size: 1.1rem; font-weight: 700; }
.cost-chip__label { font-size: .7rem; color: var(--text-dim); }
.cost-chip--total {
  flex: 1.4;
  background: var(--accent-2); color: #052e16;
  border-color: var(--accent-2);
}
.cost-chip--total .cost-chip__amount { font-size: 1.5rem; }
.cost-chip--total .cost-chip__label { color: #166534; font-weight: 600; }
