:root {
  --brand: #aad500;
  --brand-dark: #8fb300;
  --brand-ink: #0b0f14;
  --ink: #e5e7eb;
  --muted: #8b96a5;
  --border: #232b36;
  --bg: #0b0f14;
  --bg-soft: #10151c;
  --bg-elevated: #161c25;
  --ok: #4ade80;
  --off: #64748b;
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.12);
  --success-bg: rgba(74, 222, 128, 0.12);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}

.topbar__title h1 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--ink);
}

.topbar__title p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.bodega-form {
  display: flex;
  gap: 0.5rem;
  flex-grow: 1;
  min-width: 280px;
  max-width: 560px;
}

.bodega-form input {
  flex: 1;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  background: var(--bg-elevated);
  color: var(--ink);
}

.bodega-form input::placeholder {
  color: var(--muted);
}

.bodega-form input:focus {
  outline: none;
  border-color: var(--brand);
}

.bodega-form button {
  padding: 0.6rem 1.2rem;
  background: var(--brand);
  color: var(--brand-ink);
  border: none;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}

.bodega-form button:hover {
  background: var(--brand-dark);
}

.bodega-form button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.bodega-status {
  padding: 0.6rem 1.5rem;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.bodega-status.error {
  background: var(--danger-bg);
  color: var(--danger);
}

.bodega-status.success {
  background: var(--success-bg);
  color: var(--ok);
}

.layout {
  display: flex;
  height: calc(100vh - 74px);
}

.sidebar {
  width: 380px;
  min-width: 280px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--bg-soft);
}

.sidebar__filters {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar__filters select {
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--ink);
}

.legend-ticket {
  padding: 0.5rem 1rem;
  font-size: 0.78rem;
  color: var(--danger);
  border-bottom: 1px solid var(--border);
}

.filter-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.points-count {
  padding: 0.5rem 1rem 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.points-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem;
  overflow-y: auto;
  flex: 1;
}

.point-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
}

.point-item:hover,
.point-item:focus {
  border-color: var(--brand);
  outline: none;
}

.point-item.is-inactive {
  opacity: 0.55;
}

.point-item__header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.point-item__badge {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ok);
  flex-shrink: 0;
}

.point-item.is-inactive .point-item__badge {
  background: var(--off);
}

.point-item__nombre {
  font-weight: 600;
  font-size: 0.9rem;
  flex: 1;
  color: var(--ink);
}

.point-item__distancia {
  font-size: 0.78rem;
  color: var(--brand);
  font-weight: 700;
  white-space: nowrap;
}

.point-item__direccion {
  font-size: 0.82rem;
  color: var(--ink);
  margin-top: 0.15rem;
}

.point-item__comuna {
  font-size: 0.78rem;
  color: var(--muted);
}

.map-wrap {
  flex: 1;
  position: relative;
  background: var(--bg);
}

#map {
  height: 100%;
  width: 100%;
  background: var(--bg);
}

.point-marker-icon {
  border-radius: 6px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

.point-marker-icon--inactive {
  filter: grayscale(100%);
  opacity: 0.65;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--bg-elevated);
  color: var(--ink);
}

.leaflet-popup-close-button {
  color: var(--muted) !important;
}

.leaflet-popup-content {
  font-size: 0.85rem;
  line-height: 1.4;
}

.popup-title {
  font-weight: 700;
  margin-bottom: 0.2rem;
  color: var(--ink);
}

.popup-row {
  margin-top: 0.25rem;
}

.popup-row strong {
  color: var(--muted);
  font-weight: 600;
}

.popup-recepcion-restringida {
  color: var(--danger);
  font-weight: 600;
}

.popup-recepcion-abierta {
  color: var(--ok);
  font-weight: 600;
}

.leaflet-control-zoom a {
  background: var(--bg-elevated) !important;
  color: var(--ink) !important;
  border-color: var(--border) !important;
}

.leaflet-control-zoom a:hover {
  background: var(--bg-soft) !important;
}

.leaflet-control-attribution {
  background: rgba(11, 15, 20, 0.8) !important;
  color: var(--muted) !important;
}

.leaflet-control-attribution a {
  color: var(--ink) !important;
}

@media (max-width: 800px) {
  .layout {
    flex-direction: column;
    height: auto;
  }

  .sidebar {
    width: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 40vh;
  }

  .map-wrap {
    flex: none;
    height: 60vh;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .bodega-form {
    max-width: none;
  }
}
