:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --accent: #0ea5a9;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --text: #1e2433;
  --text-muted: #6b7280;
  --border: #e5e9f2;
  --radius: 14px;
  --shadow: 0 6px 20px rgba(20, 30, 60, 0.08);
  --sidebar-w: 260px;
}

* { box-sizing: border-box; }

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

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ===== Header público ===== */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header .header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.15rem;
}
.brand .logo-dot {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
}
.nav-links { display: flex; gap: 20px; font-size: .95rem; }

/* ===== Contenedores ===== */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 56px 0 70px;
}
.hero h1 { font-size: 2.1rem; margin: 0 0 12px; }
.hero p { max-width: 640px; opacity: .92; margin: 0 0 24px; }
.hero .meta { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.hero .meta span {
  background: rgba(255,255,255,0.15);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: .85rem;
}

/* ===== Botones ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 10px;
  padding: 12px 22px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: white; color: var(--primary-dark); box-shadow: var(--shadow); }
.btn-primary:hover { background: #f3f6ff; }
.btn-outline { background: transparent; border: 1.5px solid rgba(255,255,255,.6); color: white; }
.btn-outline:hover { background: rgba(255,255,255,.12); }
.btn-solid { background: var(--primary); color: white; }
.btn-solid:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: white; }
.btn-ghost { background: var(--primary-light); color: var(--primary-dark); }
.btn-sm { padding: 8px 14px; font-size: .82rem; border-radius: 8px; }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* ===== Tarjetas ===== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.card + .card { margin-top: 20px; }
.card h2, .card h3 { margin-top: 0; }

.section { padding: 44px 0; }
.section-title { font-size: 1.5rem; margin-bottom: 6px; }
.section-sub { color: var(--text-muted); margin-bottom: 24px; }

/* ===== Mapa ===== */
.map-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin: -46px auto 0;
  max-width: 1100px;
  position: relative;
  z-index: 5;
}
#map, #admin-map { width: 100%; height: 420px; }
#session-map { width: 100%; height: 320px; border-radius: var(--radius); overflow: hidden; }

.map-toolbar {
  background: var(--surface);
  padding: 16px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

/* ===== Alertas / avisos ===== */
.alert {
  border-radius: 10px;
  padding: 14px 16px;
  font-size: .9rem;
  margin: 16px 0;
}
.alert-info { background: #eef4ff; color: #1e40af; border: 1px solid #c7dbff; }
.alert-success { background: #ecfdf3; color: #166534; border: 1px solid #b7ecc9; }
.alert-warning { background: #fff8e6; color: #92660a; border: 1px solid #ffe4a3; }
.alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ===== Formularios ===== */
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .88rem; }
input[type="text"], input[type="password"], input[type="date"], input[type="search"], select {
  width: 100%;
  padding: 11px 13px;
  border-radius: 9px;
  border: 1.5px solid var(--border);
  font-size: .95rem;
  background: white;
  color: var(--text);
}
input:focus, select:focus { outline: none; border-color: var(--primary); }
.form-row { margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }

/* ===== Footer público ===== */
.site-footer {
  background: #111827;
  color: #d1d5db;
  padding: 34px 0;
  margin-top: 60px;
  font-size: .88rem;
}
.site-footer a { color: #93c5fd; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }

/* ===== Panel administrativo: layout ===== */
.admin-body { background: var(--bg); min-height: 100vh; }
.admin-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: #101828;
  color: #cbd5e1;
  flex-shrink: 0;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar .brand { color: white; padding: 6px 10px 22px; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #cbd5e1;
  padding: 11px 12px;
  border-radius: 9px;
  font-size: .92rem;
  margin-bottom: 4px;
}
.sidebar nav a:hover, .sidebar nav a.active {
  background: rgba(255,255,255,.08);
  color: white;
  text-decoration: none;
}
.sidebar .icon { width: 18px; text-align: center; }

.admin-main { flex: 1; min-width: 0; }
.admin-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
}
.admin-topbar .menu-toggle { display: none; background: none; border: none; font-size: 1.4rem; cursor: pointer; }
.admin-content { padding: 26px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.stat-card .stat-label { color: var(--text-muted); font-size: .82rem; margin-bottom: 6px; }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; }
.stat-card .stat-value.small { font-size: 1.15rem; }

/* ===== Tablas ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
tr:hover td { background: #f9fafc; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.badge-blue { background: var(--primary-light); color: var(--primary-dark); }
.badge-green { background: #dcfce7; color: #166534; }
.badge-gray { background: #eef0f4; color: #4b5563; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.toolbar .filters { display: flex; flex-wrap: wrap; gap: 10px; }

.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: .85rem;
  color: var(--text);
}
.pagination .active { background: var(--primary); color: white; border-color: var(--primary); }

/* ===== Login admin ===== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, #101828 100%);
  padding: 20px;
}
.login-card {
  background: white;
  border-radius: var(--radius);
  padding: 34px 30px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 45px rgba(0,0,0,.25);
}
.login-card h1 { font-size: 1.3rem; margin-top: 0; }

/* ===== Utilidades ===== */
.text-muted { color: var(--text-muted); }
.text-sm { font-size: .85rem; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.hidden { display: none !important; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: -280px; top: 0; z-index: 100; transition: left .2s ease; box-shadow: 10px 0 30px rgba(0,0,0,.2); }
  .sidebar.open { left: 0; }
  .admin-topbar .menu-toggle { display: block; }
  .admin-content { padding: 16px; }
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 90;
  }
  .sidebar-overlay.open { display: block; }
}
@media (max-width: 640px) {
  .hero h1 { font-size: 1.6rem; }
  .nav-links { display: none; }
  #map, #admin-map { height: 300px; }
  .header-inner { padding: 12px 16px; }
}
