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

body {
  display: flex;
  height: 100vh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0d1117;
  color: #c9d1d9;
}

/* ── Sidebar ──────────────────────────────────────────────────── */
#sidebar {
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  width: 268px;
  background: #161b22;
  border-right: 1px solid #30363d;
  padding: 14px 12px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1002;
  transform: translateX(0);
  transition: transform 0.3s cubic-bezier(.4,0,.2,1);
}

#sidebar.collapsed {
  transform: translateX(-268px);
}

/* ── Sidebar toggle tab ───────────────────────────────────────── */
#sidebar-toggle {
  position: fixed;
  left: 268px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1001;
  width: 18px;
  height: 36px;
  background: #161b22;
  border: 1px solid #30363d;
  border-left: none;
  border-radius: 0 6px 6px 0;
  color: #8b949e;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: left 0.3s cubic-bezier(.4,0,.2,1), color 0.15s;
}

#sidebar-toggle:hover { color: #c9d1d9; }

#sidebar-toggle.collapsed { left: 0; }

.toggle-chevron {
  display: inline-block;
  font-size: 14px;
  line-height: 1;
  transition: transform 0.3s cubic-bezier(.4,0,.2,1);
}

#sidebar-toggle:not(.collapsed) .toggle-chevron {
  transform: rotate(180deg);
}

.sidebar-header {
  padding: 4px 2px 6px;
}

.sidebar-header h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.35rem;
  color: #f0f6fc;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.sidebar-header .subtitle {
  font-size: 0.70rem;
  color: #6e7681;
  margin-top: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Sections ─────────────────────────────────────────────────── */
.section {
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 11px 12px;
}

.section h2 {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8b949e;
  margin-bottom: 8px;
}

/* ── Radio buttons ────────────────────────────────────────────── */
.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  cursor: pointer;
  font-size: 0.88rem;
  color: #c9d1d9;
  user-select: none;
}

.radio-label input[type="radio"] {
  accent-color: #58a6ff;
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.radio-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  overflow: hidden;
}
.radio-dot.delivery {
  background: linear-gradient(to right, #3fb950 50%, #f85149 50%);
}

.radio-icon {
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

.legend-vehicle-icon {
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  width: 11px;
  text-align: center;
}

/* ── Number input ─────────────────────────────────────────────── */
.input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

#vehicle-capacity {
  width: 72px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid #30363d;
  background: #0d1117;
  color: #c9d1d9;
  font-size: 0.9rem;
  text-align: center;
}

.input-hint {
  font-size: 0.8rem;
  color: #8b949e;
}

/* ── Item counter ─────────────────────────────────────────────── */
#item-count {
  font-size: 0.85rem;
  color: #c9d1d9;
}

.sep { margin: 0 4px; color: #30363d; }

.hint {
  font-size: 0.78rem;
  color: #f0883e;
  margin-top: 5px;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

.hidden { display: none !important; }

/* ── Buttons ──────────────────────────────────────────────────── */
.actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn {
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s, opacity 0.15s;
}

.btn:hover  { filter: brightness(1.15); }
.btn:active { filter: brightness(0.9); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; filter: none; }

.btn-primary   { background: #238636; color: #fff; }
.btn-secondary {
  background: transparent;
  color: #8b949e;
  border: 1px solid #30363d;
}
.btn-secondary:hover { color: #c9d1d9; border-color: #8b949e; }

/* ── Toggle switch ───────────────────────────────────────────── */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.switch-label {
  font-size: 0.85rem;
  color: #c9d1d9;
}

.switch {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.switch-track {
  display: block;
  width: 40px;
  height: 22px;
  background: #30363d;
  border-radius: 999px;
  transition: background 0.25s;
  position: relative;
}

.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #8b949e;
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(.4,0,.2,1), background 0.25s;
}

.switch input:checked + .switch-track {
  background: #1f6feb;
}

.switch input:checked + .switch-track .switch-thumb {
  transform: translateX(18px);
  background: #fff;
}

/* ── Loading spinner ─────────────────────────────────────────── */
#loading {
  text-align: center;
  padding: 14px 0;
  font-size: 0.82rem;
  color: #8b949e;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #30363d;
  border-top-color: #58a6ff;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin: 0 auto 8px;
}

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

/* ── Results ─────────────────────────────────────────────────── */
.route-item {
  padding: 8px 10px;
  margin: 5px 0;
  background: #0d1117;
  border-radius: 5px;
  border-left: 4px solid #58a6ff;
  font-size: 0.8rem;
  line-height: 1.55;
  color: #c9d1d9;
  cursor: pointer;
  transition: background 0.15s;
}

.route-item:hover {
  background: #161b22;
}

.route-item strong { color: #f0f6fc; }

.status-optimal    { color: #3fb950; font-weight: 700; font-size: 0.85rem; }
.status-partial    { color: #f0883e; font-weight: 700; font-size: 0.85rem; }
.status-no_solution { color: #f85149; font-weight: 700; font-size: 0.85rem; }

.warning {
  color: #f0883e;
  font-size: 0.78rem;
  margin-top: 4px;
  line-height: 1.4;
}

/* ── Legend ──────────────────────────────────────────────────── */
.legend { display: flex; flex-direction: column; gap: 5px; }

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  color: #8b949e;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid rgba(255,255,255,0.25);
}
.dot.green { background: #3fb950; }
.dot.red   { background: #f85149; }

.hint-sm { font-size: 0.72rem; color: #6e7681; margin-top: 2px; }

/* ── Map ─────────────────────────────────────────────────────── */
#map {
  flex: 1;
  z-index: 0;
}

/* ── Animated route polylines ────────────────────────────────── */
@keyframes dash-move {
  to { stroke-dashoffset: -20; }
}
