/* ===================================================================
   styles.css - base institucional, mobile-first
   =================================================================== */
:root {
  /* Paleta institucional en tono GUINDA (los nombres --azul se conservan
     para no tocar todas las referencias; los valores son guinda). */
  --azul: #7a1b3d;
  --azul-900: #581329;
  --azul-50: #f6e7ec;
  --gris-900: #1a1f2b;
  --gris-700: #3a4256;
  --gris-500: #6b7280;
  --gris-300: #d1d5db;
  --gris-100: #f3f4f6;
  --gris-50: #f9fafb;
  --blanco: #ffffff;
  --verde: #0f9d58;
  --verde-50: #e6f4ea;
  --rojo: #d93025;
  --rojo-50: #fce8e6;
  --amarillo: #f29900;
  --amarillo-50: #fef7e0;
  --radio: 12px;
  --sombra: 0 1px 3px rgba(16, 24, 40, 0.1), 0 1px 2px rgba(16, 24, 40, 0.06);
  --sombra-lg: 0 10px 24px rgba(16, 24, 40, 0.12);
  --fuente: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--fuente);
  color: var(--gris-900);
  background: var(--gris-100);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0 0 0.5rem; font-weight: 600; color: var(--gris-900); }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.75rem; }
a { color: var(--azul); }

/* ---------- Layout ---------- */
.contenedor { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }

.topbar {
  background: var(--azul);
  color: var(--blanco);
  padding: 12px 0;
  box-shadow: var(--sombra);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .contenedor {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topbar__marca { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.topbar__marca svg { width: 26px; height: 26px; }
.topbar__user { font-size: 0.85rem; opacity: 0.95; display: flex; align-items: center; gap: 10px; }

/* ---------- Pestañas ---------- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 16px 0; }
.tab {
  background: var(--blanco);
  border: 1px solid var(--gris-300);
  border-radius: var(--radio);
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--gris-700);
}
.tab--activa { background: var(--azul); color: var(--blanco); border-color: var(--azul); }

.panel { display: none; }
.panel--activo { display: block; }

/* ---------- Tarjetas ---------- */
.card {
  background: var(--blanco);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 16px;
  margin-bottom: 16px;
}
.card__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 12px; flex-wrap: wrap; }

/* ---------- Formularios ---------- */
.campo { margin-bottom: 14px; }
.campo label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 4px; color: var(--gris-700); }
.campo input, .campo select, .campo textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--gris-300);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--blanco);
}
.campo input:focus, .campo select:focus, .campo textarea:focus {
  outline: none;
  border-color: var(--azul);
  box-shadow: 0 0 0 3px var(--azul-50);
}
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid transparent;
  font-size: 0.95rem; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: background 0.15s, opacity 0.15s;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn--primary { background: var(--azul); color: var(--blanco); }
.btn--primary:hover:not(:disabled) { background: var(--azul-900); }
.btn--ghost { background: var(--blanco); color: var(--azul); border-color: var(--gris-300); }
.btn--danger { background: var(--rojo); color: var(--blanco); }
.btn--sm { padding: 6px 10px; font-size: 0.8rem; }
.btn--block { width: 100%; }

/* ---------- Tablas ---------- */
.tabla-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--gris-100); white-space: nowrap; }
th { color: var(--gris-500); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.02em; }
tr:hover td { background: var(--gris-50); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 0.74rem; font-weight: 600; }
.badge--borrador { background: var(--gris-100); color: var(--gris-700); }
.badge--programado { background: var(--azul-50); color: var(--azul); }
.badge--activo { background: var(--verde-50); color: var(--verde); }
.badge--finalizado { background: var(--gris-100); color: var(--gris-500); }
.badge--cancelado { background: var(--rojo-50); color: var(--rojo); }
.badge--on { background: var(--verde-50); color: var(--verde); }
.badge--off { background: var(--rojo-50); color: var(--rojo); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; }

/* ---------- Utilidades ---------- */
.muted { color: var(--gris-500); font-size: 0.85rem; }
.text-right { text-align: right; }
.flex { display: flex; gap: 8px; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.hidden { display: none !important; }
.row-actions { display: flex; gap: 6px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; width: calc(100% - 32px); max-width: 420px; }
.toast { background: var(--gris-900); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: var(--sombra-lg); opacity: 0; transform: translateY(10px); transition: opacity 0.25s, transform 0.25s; font-size: 0.9rem; }
.toast--show { opacity: 1; transform: translateY(0); }
.toast--success { background: var(--verde); }
.toast--error { background: var(--rojo); }
.toast--info { background: var(--azul); }

/* ---------- Loader ---------- */
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.vacio { text-align: center; color: var(--gris-500); padding: 28px 12px; }
