:root {
  --bg: #f6faf7;
  --surface: #ffffff;
  --surface-alt: #eefbf1;
  --border: #dcece1;
  --text: #14231a;
  --muted: #667a6d;
  --accent: #16a34a;
  --accent-hover: #15803d;
  --accent-tint: #dcfce7;
  --success: #059669;
  --success-tint: #ecfdf5;
  --danger: #dc2626;
  --danger-tint: #fef2f2;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 35, 26, 0.05), 0 1px 3px rgba(20, 35, 26, 0.07);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10160f;
    --surface: #1a2318;
    --surface-alt: #1f2c1f;
    --border: #2e3d2e;
    --text: #eaf5eb;
    --muted: #9db3a1;
    --accent: #22c55e;
    --accent-hover: #4ade80;
    --accent-tint: #163825;
    --success: #34d399;
    --success-tint: #12261f;
    --danger: #f87171;
    --danger-tint: #2a1616;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 16px; color: var(--text); text-decoration: none; }
.brand-mark { width: 26px; height: 26px; flex-shrink: 0; display: block; object-fit: contain; }

.app-shell { display: flex; min-height: 100vh; align-items: flex-start; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
}

.sidebar nav { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.sidebar nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-weight: 500;
}
.sidebar nav a:hover { color: var(--text); background: var(--surface-alt); }
.sidebar nav a.active { color: var(--accent-hover); background: var(--accent-tint); font-weight: 700; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.sidebar-footer .user-name { color: var(--muted); font-weight: 600; }
.sidebar-footer a { color: var(--muted); text-decoration: none; }
.sidebar-footer a:hover { color: var(--accent); }

.container { flex: 1; max-width: 640px; margin: 0 auto; padding: 32px 28px; }
.container.centrado { max-width: 400px; margin: 64px auto; }
.container.ancho { max-width: 960px; padding: 0; }
.container.completo { max-width: none; padding: 24px 28px; }

@media (max-width: 720px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%; min-height: 0; position: static; flex-direction: row;
    align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px;
  }
  .sidebar nav { flex-direction: row; }
  .sidebar-footer { margin-top: 0; padding-top: 0; border-top: none; }
  .container { padding: 20px 16px; }
}

h1 { font-size: 21px; font-weight: 700; margin: 0 0 18px; letter-spacing: -0.01em; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
.subtitle { color: var(--muted); font-size: 13px; margin: -14px 0 20px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 18px;
}

label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 14px 0 5px; }
input, select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit; background: var(--surface); color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }

button, .btn {
  display: inline-flex; align-items: center; gap: 6px; background: var(--accent); color: #fff; border: none;
  padding: 10px 16px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600; cursor: pointer;
  text-decoration: none; margin-top: 16px; transition: background 0.12s;
}
button:hover, .btn:hover { background: var(--accent-hover); }
button.secondary, .btn.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
button.secondary:hover, .btn.secondary:hover { background: var(--surface-alt); }
button.danger, .btn.danger { background: var(--surface); color: var(--danger); border: 1px solid var(--border); }

.error, .msg { border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13.5px; margin-bottom: 16px; }
.error { color: var(--danger); background: var(--danger-tint); }
.msg { color: var(--success); background: var(--success-tint); }

.row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: none; }
.empty { color: var(--muted); font-size: 13.5px; }

.badge {
  display: inline-block;
  background: var(--accent-tint);
  color: var(--accent-hover);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 10.5px;
  font-weight: 700;
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* módulos */
.modulo-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.modulo-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; display: flex; flex-direction: column; gap: 8px;
}
.modulo-card.bloqueado { opacity: 0.6; }
.modulo-titulo { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 15px; }
.modulo-precio { font-size: 13px; color: var(--muted); font-weight: 600; }
.modulo-desc { font-size: 13px; color: var(--muted); line-height: 1.5; }

.precio-tag { font-weight: 700; color: var(--accent-hover); }

.fila-estacion.seleccionada { background: var(--accent-tint); margin: 0 -16px; padding: 10px 16px; border-radius: 8px; }

.bencina-layout { display: grid; grid-template-columns: minmax(380px, 480px) 1fr; gap: 20px; align-items: start; }
.bencina-col-lista { min-width: 0; }
.bencina-col-mapa { position: sticky; top: 24px; height: calc(100vh - 48px); min-height: 420px; }
.bencina-col-mapa .card { height: 100%; margin-bottom: 0; }
.bencina-col-mapa #mapa { height: 100%; width: 100%; }

@media (max-width: 960px) {
  .bencina-layout { grid-template-columns: 1fr; }
  .bencina-col-mapa { position: static; height: 380px; min-height: 0; order: -1; }
}

.mapa-pin {
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  transform: translateY(-10px);
}

/* landing pública */
.landing-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 28px; border-bottom: 1px solid var(--border);
}
.landing-hero {
  text-align: center; padding: 72px 28px 56px;
}
.landing-hero h1 {
  font-size: 38px; line-height: 1.15; margin: 0 0 14px; letter-spacing: -0.02em;
}
.landing-hero .lead {
  font-size: 16.5px; color: var(--muted); max-width: 520px; margin: 0 auto 28px; line-height: 1.5;
}
.landing-section { padding: 0 28px 64px; }
.landing-section h2 { text-align: center; font-size: 22px; margin: 0 0 28px; }
.landing-modulo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; max-width: 900px; margin: 0 auto; }
@media (max-width: 720px) {
  .landing-hero h1 { font-size: 28px; }
  .landing-modulo-grid { grid-template-columns: 1fr; }
  .landing-nav { padding: 16px 20px; }
}
