:root {
  --azul: #0b5fa5;
  --azul-oscuro: #063a68;
  --naranja: #f5871f;
  --gris-bg: #f4f6f8;
  --gris-borde: #d9dfe4;
  --texto: #23303a;
  --verde: #2e9e57;
  --rojo: #d64545;
  --amarillo: #e6a817;
  --radius: 10px;
  --sombra: 0 2px 8px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--gris-bg);
  color: var(--texto);
}
a { color: var(--azul); text-decoration: none; }

/* Inputs a 16px SIEMPRE (evita zoom automático en iOS) */
input, select, textarea, button {
  font-size: 16px;
  font-family: inherit;
}

.container { max-width: 1200px; margin: 0 auto; padding: 16px; }

/* ---------- TOPBAR ---------- */
.topbar {
  background: var(--azul-oscuro);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--sombra);
}
.topbar .brand { font-weight: 700; font-size: 18px; color: #fff; display:flex; align-items:center; gap:8px; }
.topbar .brand-logo { height: 32px; width: auto; border-radius: 4px; object-fit: contain; }
.topbar .hamburger {
  display: none;
  background: none; border: none; color: #fff;
  font-size: 26px; cursor: pointer; padding: 6px 10px;
}
.topbar .user-chip { font-size: 14px; opacity: .9; }

/* ---------- LAYOUT ADMIN ---------- */
.layout { display: flex; min-height: calc(100vh - 56px); }
.sidebar {
  width: 220px;
  background: #fff;
  border-right: 1px solid var(--gris-borde);
  padding: 12px 0;
}
.sidebar a {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px;
  color: var(--texto);
  font-size: 15px;
  border-left: 3px solid transparent;
}
.sidebar a.active, .sidebar a:hover {
  background: #eef5fb;
  border-left-color: var(--azul);
  color: var(--azul);
}
.main-content { flex: 1; padding: 20px; min-width: 0; }

/* ---------- CARDS / TABLAS ---------- */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--sombra);
  padding: 18px;
  margin-bottom: 16px;
}
.card h2, .card h3 { margin-top: 0; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
}
table.data-table th, table.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--gris-borde);
  font-size: 14px;
}
table.data-table th { background: #f0f3f5; font-weight: 600; }
table.data-table tr:hover td { background: #fafcfe; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}
.badge-abierto, .badge-pagado { background: var(--verde); }
.badge-completo, .badge-sena { background: var(--amarillo); }
.badge-confirmado { background: var(--azul); }
.badge-cancelado, .badge-pendiente { background: var(--rojo); }

.btn {
  display: inline-block;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: none;
  background: var(--azul);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.btn:hover { background: var(--azul-oscuro); }
.btn-secondary { background: #6c757d; }
.btn-danger { background: var(--rojo); }
.btn-success { background: var(--verde); }
.btn-sm { padding: 6px 10px; font-size: 13px; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gris-borde);
  border-radius: 8px;
  background: #fff;
}
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 180px; }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fdecea; color: var(--rojo); border: 1px solid #f5c2c0; }
.alert-success { background: #e9f9ee; color: var(--verde); border: 1px solid #b7e7c5; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-box {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--sombra);
  padding: 16px;
  text-align: center;
}
.stat-box .num { font-size: 28px; font-weight: 700; color: var(--azul); }
.stat-box .label { font-size: 13px; color: #6c757d; margin-top: 4px; }

/* ---------- BOTTOM NAV (modo standalone / mobile) ---------- */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 1px solid var(--gris-borde);
  z-index: 100;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
}
.bottom-nav ul { display: flex; list-style: none; margin: 0; padding: 6px 0; }
.bottom-nav li { flex: 1; text-align: center; }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: #6c757d; }
.bottom-nav a.active { color: var(--azul); }
.bottom-nav .icon { font-size: 20px; }

/* ---------- LOGIN ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--azul-oscuro), var(--azul));
  padding: 16px;
}
.login-box {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
}
.login-box .logo { text-align: center; margin-bottom: 20px; }
.login-box .logo .login-logo { max-height: 70px; max-width: 200px; object-fit: contain; margin-bottom: 10px; }
.login-box .logo .name { font-size: 22px; font-weight: 800; color: var(--azul-oscuro); }
.login-box .logo .tag { font-size: 13px; color: var(--naranja); font-weight: 600; letter-spacing: .5px; }

/* =========================================================
   RESPONSIVE / MOBILE
   ========================================================= */
@media (max-width: 768px) {
  .topbar .hamburger { display: inline-block; }

  .sidebar {
    position: fixed;
    top: 56px; left: 0; bottom: 0;
    width: 240px;
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 99;
    overflow-y: auto;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 56px 0 0 0;
    background: rgba(0,0,0,.4);
    z-index: 98;
  }
  .sidebar-overlay.open { display: block; }

  .main-content { padding: 12px; padding-bottom: 76px; }

  /* Tablas -> tarjetas en mobile */
  table.data-table thead { display: none; }
  table.data-table, table.data-table tbody, table.data-table tr, table.data-table td {
    display: block; width: 100%;
  }
  table.data-table tr {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--sombra);
    margin-bottom: 12px;
    padding: 8px 4px;
  }
  table.data-table td {
    border: none;
    padding: 6px 12px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 14px;
  }
  table.data-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #6c757d;
  }

  .bottom-nav { display: block; }

  /* Modales al 95% en mobile */
  .modal-content { width: 95% !important; }
}
