/* ============================================================
   Pluma — Tema "Aurora" (propuesta visual)
   Reemplaza a tema.css. Paleta sacada de la imagen de referencia:
     teal #1085b1 · naranja #fcb040 · índigo #2d3891
     fondo #f2f2f2 · tarjetas #ffffff
   ============================================================ */

:root {
  /* --- Marca --- */
  --marca:            #1085b1;
  --marca-claro:      #17a2d4;
  --marca-oscuro:     #0b6588;
  --naranja:          #fcb040;
  --indigo:           #2d3891;

  /* --- Superficies --- */
  --fondo:            #f2f2f2;
  --fondo-2:          #ffffff;
  --superficie:       #ffffff;
  --superficie-2:     #fafbfc;
  --tarjeta:          #ffffff;

  /* --- Bordes --- */
  --borde:            #e6e8ec;
  --borde-suave:      #eff1f3;

  /* --- Texto --- */
  --texto:            #1c2b3a;
  --texto-medio:      #5a6b7c;
  --texto-tenue:      #93a1ae;

  /* --- Semánticos --- */
  --verde:            #1aa97b;
  --ambar:            #fcb040;
  --rojo:             #e4572e;

  /* --- Sombras claras, tarjeta flotante --- */
  --sombra:           0 1px 2px rgba(28,43,58,.04), 0 4px 16px rgba(28,43,58,.06);
  --sombra-alta:      0 2px 4px rgba(28,43,58,.05), 0 12px 32px rgba(28,43,58,.10);

  /* --- Radios --- */
  --radio:            16px;
  --radio-sm:         10px;

  /* --- Variables heredadas del tema anterior --- */
  --vidrio:           #ffffff;
  --vidrio-alto:      #ffffff;
  --brillo:           transparent;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--texto);
  background: var(--fondo);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

/* Sin degradado ni capa de vidrio */
body::before { display: none !important; content: none !important; }

a { color: var(--marca); text-decoration: none; }

h1, h2, h3, h4, h5, h6 {
  color: var(--texto);
  font-weight: 750;
  letter-spacing: -.02em;
  line-height: 1.25;
  margin: 0 0 .5rem;
}

h1 { font-size: 1.4rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }

::selection { background: rgba(16,133,177,.18); }

/* Scrollbar discreta */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #d3d8dd;
  border-radius: 99px;
  border: 2px solid var(--fondo);
}
::-webkit-scrollbar-thumb:hover { background: #b9c0c7; }

/* ============================================================
   Estructura
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
}

/* ---------- Sidebar con degradado teal ---------- */
.sidebar {
  background: linear-gradient(168deg, #1085b1 0%, #0d7799 42%, #2d3891 100%);
  color: #fff;
  padding: 1.35rem .9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .15rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.marca {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .4rem .55rem 1.35rem;
}

.marca__logo {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: rgba(255,255,255,.18);
  padding: 6px;
  object-fit: contain;
  flex-shrink: 0;
}

.marca__nombre {
  font-weight: 750;
  font-size: 1.05rem;
  letter-spacing: -.01em;
  line-height: 1.15;
  color: #fff;
}

.marca__bajada {
  font-size: .67rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  opacity: .72;
  font-weight: 600;
  color: #fff;
}

.menu { display: flex; flex-direction: column; gap: .12rem; }

.menu-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .62rem .75rem;
  border-radius: 11px;
  color: rgba(255,255,255,.84);
  font-size: .89rem;
  font-weight: 500;
  transition: background .14s, color .14s;
  position: relative;
  text-decoration: none;
}

.menu-item i { font-size: 1.02rem; opacity: .92; }
.menu-item:hover { background: rgba(255,255,255,.13); color: #fff; }

.menu-item.activo {
  background: rgba(255,255,255,.19);
  color: #fff;
  font-weight: 650;
}

.menu-item.activo::after {
  content: '';
  position: absolute;
  right: 12px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
}

.menu-badge {
  margin-left: auto;
  background: var(--naranja);
  color: #43290a;
  font-size: .67rem;
  font-weight: 800;
  min-width: 19px;
  height: 19px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.menu-item.activo .menu-badge { margin-right: 14px; }

.menu-separador {
  font-size: .64rem;
  text-transform: uppercase;
  letter-spacing: .11em;
  font-weight: 750;
  color: rgba(255,255,255,.48);
  padding: 1.15rem .75rem .4rem;
}

.sidebar-pie {
  margin-top: auto;
  padding-top: .9rem;
  border-top: 1px solid rgba(255,255,255,.14);
}

.usuario-nombre {
  font-size: .87rem;
  font-weight: 650;
  padding: 0 .75rem;
  color: #fff;
}

.usuario-rol {
  font-size: .71rem;
  opacity: .65;
  padding: 0 .75rem .35rem;
  color: #fff;
}

.sidebar-pie .menu-item { font-size: .85rem; }

/* ---------- Contenido ---------- */
.contenido {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--fondo);
}

.barra-sup {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem clamp(1rem, 2.5vw, 2.25rem);
  background: #fff;
  border-bottom: 1px solid var(--borde-suave);
  position: sticky;
  top: 0;
  z-index: 50;
}

.barra-sup__titulo h1 {
  margin: 0;
  font-size: clamp(1.15rem, 1rem + .6vw, 1.4rem);
  font-weight: 750;
  letter-spacing: -.02em;
  color: var(--texto);
}

.miga {
  font-size: .71rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  color: var(--texto-tenue);
  margin-bottom: .1rem;
}

.principal {
  padding: 1.5rem clamp(1rem, 2.5vw, 2.25rem) 2.5rem;
  flex: 1;
}

.hamburguesa { display: none; }
.nav-velo { display: none; }
.nav-cerrar { display: none; }
.barra-inferior { display: none !important; }

/* ============================================================
   Tarjetas
   ============================================================ */
.tarjeta,
.tarjeta--vidrio {
  background: #fff;
  border: 1px solid var(--borde-suave);
  border-radius: var(--radio);
  padding: 1.35rem;
  box-shadow: var(--sombra);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.tarjeta__titulo {
  font-size: .67rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 750;
  color: var(--texto-tenue);
  margin-bottom: .5rem;
}

/* ============================================================
   KPIs de color
   ============================================================ */
.rejilla--kpi {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(195px, 100%), 1fr));
  margin-bottom: 1.5rem;
}

.kpi {
  border-radius: var(--radio);
  padding: 1.15rem 1.25rem;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: var(--sombra);
  border: none;
  background: var(--marca);
}

.kpi:nth-child(1) { background: linear-gradient(135deg, #fcb040 0%, #f59e2a 100%); color: #43290a; }
.kpi:nth-child(2) { background: linear-gradient(135deg, #2d3891 0%, #232c72 100%); }
.kpi:nth-child(3) { background: linear-gradient(135deg, #1085b1 0%, #0b6588 100%); }
.kpi:nth-child(4) { background: linear-gradient(135deg, #1aa97b 0%, #148f68 100%); }
.kpi:nth-child(5) { background: linear-gradient(135deg, #e4572e 0%, #c2461f 100%); }

.kpi::after {
  content: '';
  position: absolute;
  right: -34px;
  top: -34px;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  pointer-events: none;
}

.kpi__icono {
  font-size: 1.3rem;
  opacity: .88;
  margin-bottom: .5rem;
  display: block;
  color: inherit !important;
}

.kpi__valor {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.1;
}

.kpi__rotulo {
  font-size: .77rem;
  font-weight: 600;
  opacity: .85;
  margin-top: .2rem;
}

.kpi__extra {
  font-size: .73rem;
  opacity: .72;
  margin-top: .12rem;
}

/* ============================================================
   Tablas
   ============================================================ */
.tabla-envoltura {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radio-sm);
}

.tabla {
  width: 100%;
  border-collapse: collapse;
  font-size: .87rem;
}

.tabla thead th {
  text-align: left;
  font-size: .67rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 750;
  color: var(--texto-tenue);
  padding: .7rem .85rem;
  border-bottom: 1px solid var(--borde);
  white-space: nowrap;
  background: #fbfcfd;
}

.tabla tbody td {
  padding: .8rem .85rem;
  border-bottom: 1px solid var(--borde-suave);
  vertical-align: middle;
  color: var(--texto);
}

.tabla tbody tr:last-child td { border-bottom: none; }
.tabla tbody tr:hover { background: #fafcfd; }

/* ============================================================
   Botones
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .58rem 1.05rem;
  min-height: 42px;
  border-radius: var(--radio-sm);
  border: 1px solid var(--borde);
  background: #fff;
  color: var(--texto);
  font: inherit;
  font-size: .87rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .14s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  border-color: #d5d9de;
  box-shadow: 0 2px 8px rgba(28,43,58,.08);
  color: var(--texto);
}

.btn--primario {
  background: linear-gradient(135deg, #1085b1 0%, #0b6588 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 10px rgba(16,133,177,.28);
}

.btn--primario:hover {
  box-shadow: 0 4px 16px rgba(16,133,177,.38);
  transform: translateY(-1px);
  color: #fff;
}

.btn--peligro {
  background: var(--rojo);
  border-color: transparent;
  color: #fff;
}

.btn--peligro:hover { color: #fff; }

.btn--exito {
  background: var(--verde);
  border-color: transparent;
  color: #fff;
}

.btn--exito:hover { color: #fff; }

.btn--borde { background: #fff; }

.btn--sm {
  padding: .38rem .72rem;
  min-height: 34px;
  font-size: .81rem;
}

.btn--bloque { width: 100%; }

.btn-icono {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  border: 1px solid transparent;
  background: none;
  color: var(--texto-medio);
  cursor: pointer;
  transition: all .13s;
  text-decoration: none;
  font-size: 1rem;
}

.btn-icono:hover {
  background: #eef4f7;
  color: var(--marca);
  border-color: #dbe8ee;
}

.btn-icono--peligro:hover {
  background: #fdeeeb;
  color: var(--rojo);
  border-color: #f7d3ca;
}

/* ============================================================
   Formularios
   ============================================================ */
.campo { margin-bottom: 1rem; }

.campo__etiqueta {
  display: block;
  font-size: .79rem;
  font-weight: 650;
  color: var(--texto-medio);
  margin-bottom: .35rem;
}

.campo__ayuda {
  font-size: .75rem;
  color: var(--texto-tenue);
  margin-top: .3rem;
}

.req { color: var(--rojo); }

.input, .select, .textarea, select.input, textarea.input {
  width: 100%;
  min-height: 44px;
  padding: .55rem .85rem;
  border-radius: var(--radio-sm);
  border: 1px solid var(--borde);
  background: #fff;
  color: var(--texto);
  font: inherit;
  font-size: .89rem;
  transition: border-color .14s, box-shadow .14s;
  appearance: none;
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--marca);
  box-shadow: 0 0 0 3px rgba(16,133,177,.13);
}

.input::placeholder, .textarea::placeholder { color: #b3bec8; }

.textarea {
  min-height: 90px;
  resize: vertical;
  padding: .65rem .85rem;
}

select.select, select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2393a1ae' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .9rem center;
  padding-right: 2.2rem;
}

.buscador { position: relative; }

.buscador i {
  position: absolute;
  left: .8rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--texto-tenue);
  pointer-events: none;
  font-size: .9rem;
}

.buscador .input { padding-left: 2.2rem; }

.fila-doble {
  display: grid;
  gap: .9rem;
  grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
}

/* ============================================================
   Pastillas
   ============================================================ */
.pastilla {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .68rem;
  border-radius: 99px;
  font-size: .73rem;
  font-weight: 700;
  white-space: nowrap;
}

.pastilla--verde { background: #e6f7f1; color: #0d7d5b; }
.pastilla--ambar { background: #fff4e0; color: #a06a00; }
.pastilla--rojo  { background: #fdeeeb; color: #b03418; }
.pastilla--azul  { background: #e6f4fa; color: #0b6588; }
.pastilla--gris  { background: #f0f2f4; color: #5a6b7c; }

/* ============================================================
   Avisos
   ============================================================ */
.aviso {
  display: flex;
  gap: .7rem;
  align-items: flex-start;
  padding: .85rem 1rem;
  border-radius: var(--radio-sm);
  font-size: .87rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}

.aviso i { font-size: 1.05rem; flex-shrink: 0; margin-top: .1rem; }

.aviso--ok    { background: #e9f9f3; border-color: #bfeadd; color: #0d6b4f; }
.aviso--error { background: #fdeeeb; border-color: #f8cfc5; color: #a83219; }
.aviso--ambar { background: #fff7e9; border-color: #ffe2b0; color: #8a5800; }
.aviso--info  { background: #e9f4fa; border-color: #c3e2ef; color: #0b5c7c; }

/* ============================================================
   Modales
   ============================================================ */
.modal-fondo {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(28,43,58,.45);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}

.modal-fondo.abierto { display: flex; }

.modal-caja {
  background: #fff;
  border-radius: 20px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--sombra-alta);
  animation: modalEntra .18s ease-out;
}

@keyframes modalEntra {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

.modal-cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid var(--borde-suave);
}

.modal-titulo {
  font-size: 1.02rem;
  font-weight: 700;
  margin: 0;
  color: var(--texto);
}

.modal-cuerpo { padding: 1.35rem; overflow-y: auto; }

.modal-pie {
  display: flex;
  gap: .6rem;
  justify-content: flex-end;
  padding: 1rem 1.35rem;
  border-top: 1px solid var(--borde-suave);
  background: #fafbfc;
  border-radius: 0 0 20px 20px;
}

/* ============================================================
   Utilidades
   ============================================================ */
.flex { display: flex; }
.flex-entre { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.gap-1 { gap: .5rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: .75rem; }
.mb-2 { margin-bottom: 1.25rem; }
.mb-3 { margin-bottom: 1.75rem; }
.mt-1 { margin-top: .75rem; }
.mt-2 { margin-top: 1.25rem; }
.mt-3 { margin-top: 1.75rem; }
.texto-medio { color: var(--texto-medio); }
.texto-tenue { color: var(--texto-tenue); }

.rejilla--2 {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
}

.vacio-caja {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--texto-tenue);
}

.vacio-caja i {
  font-size: 2.2rem;
  display: block;
  margin-bottom: .6rem;
  opacity: .5;
}

.vacio-caja p { margin: 0; font-size: .9rem; }

.acciones-fila { display: flex; gap: .25rem; justify-content: flex-end; }

.chips-filtro .btn { border-radius: 99px; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 262px;
    height: 100vh;
    z-index: 140;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 0 0 40px rgba(28,43,58,.3);
  }

  .sidebar.abierto { transform: none; }

  .nav-velo {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(28,43,58,.45);
    z-index: 130;
  }

  .nav-velo.visible { display: block; }

  .hamburguesa { display: inline-flex; }

  .nav-cerrar {
    display: inline-flex;
    position: absolute;
    top: .8rem;
    right: .8rem;
    color: #fff;
    background: rgba(255,255,255,.12);
  }
}

@media (max-width: 560px) {
  body { font-size: 14px; }
  .tarjeta { padding: 1.05rem; border-radius: 12px; }
  .kpi { padding: 1rem 1.05rem; border-radius: 12px; }
  .kpi__valor { font-size: 1.4rem; }
  .principal { padding-left: .85rem; padding-right: .85rem; }
  .barra-sup { padding-left: .85rem; padding-right: .85rem; }
}

/* Tablas como tarjetas en móvil */
@media (max-width: 680px) {
  .tabla thead { display: none; }

  .tabla tbody tr {
    display: block;
    background: #fff;
    border: 1px solid var(--borde-suave);
    border-radius: var(--radio-sm);
    padding: .75rem .9rem;
    margin-bottom: .6rem;
    box-shadow: var(--sombra);
  }

  .tabla tbody td {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .28rem 0;
    border: none;
    font-size: .85rem;
  }

  .tabla tbody td::before {
    content: attr(data-etiqueta);
    font-size: .71rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 700;
    color: var(--texto-tenue);
    flex-shrink: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
