:root {
  --color-primary: #3b9ef5;
  --color-primary-dark: #2388e0;
  --color-primary-soft: #eaf5ff;
  --color-accent: #5eb0f8;
  --color-ink: #0e141c;
  --color-body: #2a3344;
  --color-muted: #64748b;
  --color-subtle: #94a3b8;
  --color-border: #e4e7ec;
  --color-border-strong: #d0d5dd;
  --color-surface: #ffffff;
  --color-canvas: #f7f8fc;
  --color-error: #d92d20;
  --color-error-soft: #fef3f2;
  --shadow-card: 0 1px 2px rgba(14, 20, 28, 0.03), 0 8px 24px rgba(14, 20, 28, 0.06);
  --shadow-float: 0 16px 40px rgba(14, 20, 28, 0.14);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --bg: var(--color-canvas);
  --bg-soft: var(--color-canvas);
  --panel: var(--color-surface);
  --panel-alt: var(--color-canvas);
  --borde: var(--color-border);
  --texto: var(--color-ink);
  --texto-suave: var(--color-muted);
  --acento: var(--color-primary);
  --acento-2: var(--color-primary-dark);
  --ok: #12996b;
  --warn: #c47c07;
  --error: var(--color-error);
  --radio: var(--radius-md);
  --sombra: var(--shadow-card);
  --sombra-alta: var(--shadow-float);
  --fuente: "DM Sans", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--fuente);
  color: var(--texto);
  background: var(--color-canvas);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--acento);
}

button {
  font-family: inherit;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0;
}

/* ---------- Splash de redireccion ---------- */
.page-splash {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background: #090d13;
  color: #94a3b8;
  font-size: 0.9rem;
}

/* ---------- Formularios ---------- */
.campo {
  display: block;
  margin-bottom: 14px;
}

.campo > span {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--texto-suave);
}

input[type="text"],
input[type="password"],
input[type="search"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 11px 13px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--texto);
  background: #fff;
  border: 1px solid var(--borde);
  border-radius: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  resize: vertical;
  min-height: 88px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--acento);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.16);
}

input[type="file"] {
  padding: 9px;
  background: var(--panel-alt);
  cursor: pointer;
}

.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #fff;
  background: linear-gradient(135deg, #4cacf8, #2388e0);
  border: 1px solid #2d94ed;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 7px 18px rgba(35, 136, 224, 0.22);
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.boton:hover {
  background: linear-gradient(135deg, #3b9ef5, #177dce);
  box-shadow: 0 10px 24px rgba(35, 136, 224, 0.3);
  transform: translateY(-1px);
}

.boton:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.boton--secundario {
  background: #fff;
  color: var(--texto);
  border: 1px solid var(--borde);
}

.boton--peligro {
  background: linear-gradient(135deg, #e23d54, #b3122c);
}

.boton--mini {
  padding: 7px 11px;
  font-size: 0.78rem;
  border-radius: 8px;
}

.fila-campos {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.alerta {
  margin: 12px 0 0;
  padding: 11px 13px;
  border-radius: 10px;
  font-size: 0.88rem;
  border: 1px solid transparent;
}

.alerta--error {
  color: #8f1226;
  background: #ffe9ec;
  border-color: #ffc2cb;
}

.alerta--ok {
  color: #0a5f43;
  background: #e2f8ef;
  border-color: #b0e7d1;
}

/* ---------- Estructura de la app ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, #0f2840, #12324f);
  box-shadow: 0 10px 28px rgba(10, 28, 46, 0.22);
}

.app-header__inner {
  display: flex;
  width: min(1180px, 100% - 2rem);
  min-height: 72px;
  margin: 0 auto;
  padding: 8px 0;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff;
  text-decoration: none;
  flex: 0 0 auto;
}

.brand-mark {
  display: flex;
  width: 118px;
  align-items: center;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 44px;
  object-fit: contain;
}

.brand-copy,
.profile-copy {
  display: grid;
  line-height: 1.15;
}

.brand-copy strong {
  color: #fff;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}

.brand-copy small,
.profile-copy small {
  margin-top: 0.18rem;
  color: rgba(226, 238, 248, 0.72);
  font-size: 0.72rem;
}

.buscar {
  position: relative;
  flex: 1 1 320px;
  min-width: 200px;
  max-width: 520px;
}

.buscar input {
  width: 100%;
  min-height: 42px;
  padding: 0.6rem 0.9rem 0.6rem 2.6rem;
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(9, 20, 32, 0.45);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.buscar input:hover {
  border-color: rgba(255, 255, 255, 0.3);
}

.buscar input:focus {
  outline: none;
  border-color: #3b9ef5;
  background: rgba(9, 20, 32, 0.65);
  box-shadow: 0 0 0 4px rgba(59, 158, 245, 0.18);
}

.buscar input::placeholder {
  color: rgba(226, 238, 248, 0.55);
}

.buscar__icono {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(226, 238, 248, 0.6);
  pointer-events: none;
  display: inline-flex;
}

.buscar__icono svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.sesion {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-left: auto;
  flex: 0 0 auto;
}

.profile-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #12324f;
  border-radius: 50%;
  background: #e8f3fc;
  font-size: 0.82rem;
  font-weight: 700;
}

.profile-copy strong {
  max-width: 160px;
  overflow: hidden;
  color: #fff;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-button {
  display: inline-flex;
  width: 40px;
  height: 38px;
  align-items: center;
  justify-content: center;
  color: rgba(236, 244, 252, 0.92);
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.logout-button:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.08);
}

.logout-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.contenedor {
  max-width: 1280px;
  margin: 0 auto;
  padding: 26px 22px 60px;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.tab {
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--borde);
  background: #fff;
  color: var(--texto-suave);
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
}

.tab[aria-selected="true"] {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--acento), var(--acento-2));
}

.panel {
  background: var(--panel);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 22px;
  margin-bottom: 24px;
}

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

.panel__cabecera h2 {
  font-size: 1.08rem;
}

.panel__cabecera p {
  margin: 4px 0 0;
  font-size: 0.83rem;
  color: var(--texto-suave);
}

[hidden] {
  display: none !important;
}

/* ---------- Checkboxes de departamentos ---------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--borde);
  border-radius: 999px;
  background: var(--panel-alt);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.chip input {
  accent-color: var(--acento);
  width: 16px;
  height: 16px;
}

.chip:has(input:checked) {
  background: rgba(47, 107, 255, 0.12);
  border-color: var(--acento);
  color: #1d3f96;
}

/* ---------- Grid de tarjetas ---------- */
.grid-contenido {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.tarjeta {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  overflow: hidden;
  box-shadow: var(--sombra);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.tarjeta:hover {
  transform: translateY(-3px);
  box-shadow: var(--sombra-alta);
}

.tarjeta__media {
  position: relative;
  background: #0d1224;
  min-height: 200px;
  display: grid;
  place-items: center;
}

.tarjeta__media video,
.tarjeta__media iframe,
.tarjeta__media embed {
  width: 100%;
  height: 260px;
  border: 0;
  display: block;
  background: #000;
}

.tarjeta__media img {
  width: 100%;
  height: 260px;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

.tarjeta__tipo {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(10, 14, 30, 0.75);
  backdrop-filter: blur(4px);
}

.tarjeta__cuerpo {
  padding: 16px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.tarjeta__titulo {
  font-size: 1rem;
  font-weight: 700;
}

.tarjeta__descripcion {
  margin: 0;
  font-size: 0.87rem;
  color: var(--texto-suave);
  flex: 1;
}

.tarjeta__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--texto-suave);
}

.etiqueta {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--panel-alt);
  border: 1px solid var(--borde);
}

.etiqueta--acento {
  background: rgba(47, 107, 255, 0.1);
  border-color: rgba(47, 107, 255, 0.28);
  color: #1d3f96;
}

.tarjeta__acciones {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

/* ---------- Listados / tablas ---------- */
.tabla {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}

.tabla th,
.tabla td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--borde);
  vertical-align: middle;
}

.tabla th {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--texto-suave);
  background: var(--panel-alt);
}

.tabla tr:last-child td {
  border-bottom: none;
}

.envoltura-tabla {
  overflow-x: auto;
  border: 1px solid var(--borde);
  border-radius: 12px;
}

.vacio {
  padding: 44px 20px;
  text-align: center;
  color: var(--texto-suave);
  border: 1px dashed var(--borde);
  border-radius: var(--radio);
  background: #fff;
}

.vacio strong {
  display: block;
  color: var(--texto);
  margin-bottom: 4px;
}

/* ---------- Barra de progreso ---------- */
.progreso {
  height: 8px;
  border-radius: 999px;
  background: var(--panel-alt);
  overflow: hidden;
  border: 1px solid var(--borde);
}

.progreso__barra {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--acento), var(--acento-2));
  transition: width 0.2s ease;
}

/* ---------- Toasts ---------- */
.zona-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, calc(100vw - 36px));
}

.toast {
  padding: 12px 15px;
  border-radius: 12px;
  color: #fff;
  font-size: 0.87rem;
  box-shadow: var(--sombra-alta);
  animation: aparecer 0.18s ease-out;
}

.toast--ok {
  background: #0f8a62;
}

.toast--error {
  background: #c62439;
}

.toast--info {
  background: #26407d;
}

@keyframes aparecer {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(6, 9, 20, 0.9);
}

.lightbox img {
  max-width: 96%;
  max-height: 88vh;
  border-radius: 10px;
  box-shadow: var(--sombra-alta);
}

.lightbox__cerrar {
  position: absolute;
  top: 18px;
  right: 22px;
  font-size: 1.7rem;
  line-height: 1;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  cursor: pointer;
}

/* ---------- Visor embebido (modal) ---------- */
.visor-modal {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: flex;
  flex-direction: column;
  background: rgba(6, 10, 18, 0.94);
  backdrop-filter: blur(4px);
}

.visor-modal__cabecera {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.9rem 1.2rem;
  color: #fff;
}

.visor-modal__tipo {
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(59, 158, 245, 0.2);
  border: 1px solid rgba(94, 176, 248, 0.4);
  color: #bae0ff;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.visor-modal__titulo {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 0.95rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.visor-modal__cerrar {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.visor-modal__cerrar:hover {
  background: rgba(255, 255, 255, 0.16);
}

.visor-modal__cuerpo {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 0 1.2rem 1.2rem;
}

.visor-modal__cuerpo iframe {
  width: min(1100px, 100%);
  height: 100%;
  border: 0;
  border-radius: 12px;
  background: #fff;
}

.visor-modal__cuerpo video {
  max-width: min(1100px, 100%);
  max-height: 100%;
  border-radius: 12px;
  background: #000;
}

.visor-modal__cuerpo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
}

/* ---------- Utilidades ---------- */
.muted {
  color: var(--texto-suave);
}

.separador {
  height: 1px;
  background: var(--borde);
  margin: 18px 0;
  border: none;
}

.cargando {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: girar 0.7s linear infinite;
}

@keyframes girar {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 720px) {
  .app-header__inner {
    width: calc(100% - 1.25rem);
    min-height: 64px;
    gap: 0.75rem;
  }
  .brand-copy,
  .profile-copy {
    display: none;
  }
  .brand-mark {
    width: 84px;
  }
  .contenedor {
    padding: 18px 14px 50px;
  }
  .tarjeta__media video,
  .tarjeta__media iframe,
  .tarjeta__media embed,
  .tarjeta__media img {
    height: 210px;
  }
}
