/* Estilo compartido con Indicadores Básicos: guinda, dorado y marfil.
   Copiado de esa app (portada, acceso, barra y menú) para que ambas se vean igual. */
:root {
  --guinda: #691c32;
  --guinda-medio: #8a2442;
  --guinda-oscuro: #4a1223;
  --dorado: #bc955c;
  --dorado-claro: #e2cfa4;
  --dorado-texto: #8a6632;
  --marfil: #f8f4ec;
  --marfil-hondo: #efe7d8;

  --fondo: var(--marfil);
  --tarjeta: #ffffff;
  --texto: #1f1a1c;
  --texto-sec: #6b6466;
  --borde: rgba(105, 28, 50, 0.12);
  --relleno: #f3eee6;
  --primario: var(--guinda);
  --acento: var(--dorado-texto);
  --error: #b42318;
  --error-suave: rgba(180, 35, 24, 0.08);
  --placa: transparent;

  --sombra: 0 1px 2px rgba(74, 18, 35, 0.05), 0 24px 60px -12px rgba(74, 18, 35, 0.22);
  --radio: 24px;
  --radio-control: 12px;

  --fuente: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --fuente-titulo: 'Montserrat', system-ui, sans-serif;
}

html[data-theme='dark'] {
  --fondo: #141012;
  --tarjeta: #1d1719;
  --texto: #f4eff0;
  --texto-sec: #a9a1a3;
  --borde: rgba(226, 207, 164, 0.14);
  --relleno: #2a2225;
  --primario: #d9798f;
  --acento: var(--dorado);
  --error: #ff8a80;
  --error-suave: rgba(255, 138, 128, 0.1);
  --placa: var(--marfil);
  --sombra: 0 1px 2px rgba(0, 0, 0, 0.4), 0 24px 60px -12px rgba(0, 0, 0, 0.6);
}

:focus-visible {
  outline: 2px solid var(--dorado);
  outline-offset: 3px;
}


/* ---------- Elementos comunes ---------- */
.filete {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(340px, 72vw);
}

.filete span {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--dorado));
}

.filete span:last-child {
  background: linear-gradient(90deg, var(--dorado), transparent);
}

.filete i {
  width: 9px;
  height: 9px;
  flex-shrink: 0;
  transform: rotate(45deg);
  background: var(--guinda);
  box-shadow: 0 0 0 2px var(--marfil), 0 0 0 3px var(--dorado);
}

.filete-chico {
  width: 200px;
  gap: 10px;
}

.filete-chico i {
  width: 7px;
  height: 7px;
}

.btn-guinda {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 34px;
  border: 1px solid rgba(188, 149, 92, 0.75);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--guinda-medio), var(--guinda));
  color: #fff;
  font-weight: 650;
  font-size: 1rem;
  letter-spacing: 0.06em;
  box-shadow:
    0 12px 26px -8px rgba(105, 28, 50, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  transition: transform 0.15s ease, filter 0.15s ease, opacity 0.15s ease, box-shadow 0.2s ease;
}

.btn-guinda svg {
  color: var(--dorado-claro);
  transition: transform 0.2s ease;
}

.btn-guinda:hover:not(:disabled) {
  filter: brightness(1.1);
}

.btn-guinda:hover:not(:disabled) svg {
  transform: translateX(3px);
}

.btn-guinda:active:not(:disabled) {
  transform: scale(0.97);
}

.btn-guinda:disabled {
  opacity: 0.45;
  cursor: default;
  box-shadow: none;
}

.btn-ancho {
  width: 100%;
}

.btn-texto {
  border: 0;
  background: none;
  padding: 8px 4px;
  font-weight: 600;
  color: var(--primario);
}


/* ---------- Portada ---------- */
.portada {
  position: relative;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
  color: var(--texto);
  color-scheme: light;
  background:
    radial-gradient(60% 50% at 50% 38%, #fffdf9 0%, rgba(255, 253, 249, 0) 70%),
    radial-gradient(80% 60% at 100% 100%, rgba(188, 149, 92, 0.12), transparent 70%),
    radial-gradient(70% 60% at 0% 0%, rgba(105, 28, 50, 0.06), transparent 70%),
    var(--marfil);
}

/* Marco doble tipo diploma */
.portada-marco {
  position: absolute;
  inset: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  border: 1px solid rgba(188, 149, 92, 0.55);
  box-shadow:
    inset 0 0 0 5px var(--marfil),
    inset 0 0 0 6px rgba(188, 149, 92, 0.3);
  pointer-events: none;
  animation: aparecer 1.2s ease both;
}

.esquina {
  position: absolute;
  width: 11px;
  height: 11px;
  background: var(--marfil);
  border: 1px solid var(--dorado);
  transform: rotate(45deg);
}

.esquina::after {
  content: '';
  position: absolute;
  inset: 2px;
  background: var(--guinda);
}

.esquina-si { top: -6px; left: -6px; }
.esquina-sd { top: -6px; right: -6px; }
.esquina-ii { bottom: -6px; left: -6px; }
.esquina-id { bottom: -6px; right: -6px; }

.portada-cuerpo {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: max(48px, calc(env(safe-area-inset-top) + 34px)) 32px 16px;
  text-align: center;
}

.portada-emblema {
  position: relative;
  margin: 0;
  width: min(80vw, 420px, 40dvh * 1.19);
  filter: drop-shadow(0 22px 28px rgba(105, 28, 50, 0.16));
  animation: emblema 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.portada-emblema img {
  display: block;
  width: 100%;
  height: auto;
}

/* Destello: un brillo recorre solo la silueta del emblema */
.portada-destello {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 42%, rgba(255, 250, 235, 0.75) 50%, transparent 58%);
  background-size: 300% 100%;
  background-repeat: no-repeat;
  -webkit-mask: var(--emblema) center / 100% 100% no-repeat;
  mask: var(--emblema) center / 100% 100% no-repeat;
  mix-blend-mode: soft-light;
  animation: destello 2.4s 0.9s ease-in-out both;
}

.portada-separador {
  display: none;
}

.portada-texto {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 18px;
}

.portada-sobretitulo {
  margin: 0 0 10px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--texto-sec);
  animation: subir 0.8s 0.35s ease both;
}

.portada-titulo {
  margin: 0;
  font-family: var(--fuente-titulo);
  font-size: clamp(1.9rem, 7.4vw, 3.6rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--guinda);
  text-wrap: balance;
  animation: subir 0.8s 0.45s ease both;
}

.portada-titulo span {
  background: linear-gradient(180deg, #d9b977 0%, #b08443 55%, #8a6632 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.portada-texto .filete {
  margin: 18px 0 14px;
  animation: ensanchar 1s 0.6s ease both;
}

.portada-subtitulo {
  margin: 0;
  padding-left: 0.42em; /* compensa el tracking para centrar ópticamente */
  font-size: clamp(0.85rem, 2.6vw, 1.05rem);
  font-weight: 600;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--dorado-texto);
  animation: subir 0.8s 0.7s ease both;
}

.portada-btn {
  margin-top: 34px;
  animation: subir 0.8s 0.85s ease both;
}

.portada-pie {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 16px max(36px, calc(env(safe-area-inset-bottom) + 28px));
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--texto-sec);
  animation: aparecer 1s 1s ease both;
}

.portada-pie i {
  width: 5px;
  height: 5px;
  background: var(--dorado);
  transform: rotate(45deg);
}

/* Pantallas anchas (Mac, PC, iPad horizontal): emblema y título lado a lado */
@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  .portada-cuerpo {
    flex-direction: row;
    gap: clamp(36px, 5vw, 80px);
    padding: 56px 72px 0;
  }

  .portada-emblema {
    width: min(42vw, 560px, 62dvh * 1.19);
  }

  .portada-separador {
    display: block;
    align-self: center;
    width: 1px;
    height: min(52dvh, 380px);
    background: linear-gradient(180deg, transparent, var(--dorado), transparent);
    animation: aparecer 1s 0.5s ease both;
  }

  .portada-texto {
    align-items: flex-start;
    text-align: left;
    margin-top: 0;
  }

  .portada-titulo {
    font-size: clamp(2.6rem, 4.4vw, 4.4rem);
  }

  .portada-titulo span {
    display: block;
  }

  .portada-texto .filete {
    width: min(360px, 28vw);
  }

  .portada-texto .filete span:first-child {
    background: var(--dorado);
  }

  .portada-subtitulo {
    padding-left: 0;
  }
}


/* ---------- Login ---------- */
.login {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  background:
    radial-gradient(70% 55% at 50% 0%, rgba(188, 149, 92, 0.16), transparent 70%),
    var(--fondo);
  animation: aparecer 0.4s ease both;
}

.login-tarjeta {
  width: 100%;
  max-width: 440px;
  display: grid;
  overflow: hidden;
  border-radius: var(--radio);
  background: var(--tarjeta);
  box-shadow: var(--sombra);
  border: 1px solid var(--borde);
  animation: subir 0.5s 0.05s ease both;
}

.login-identidad {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 28px 24px 22px;
  text-align: center;
  color-scheme: light;
  background:
    radial-gradient(60% 60% at 50% 40%, #fffdf9, transparent 75%),
    radial-gradient(80% 60% at 100% 100%, rgba(188, 149, 92, 0.14), transparent 70%),
    var(--marfil);
  border-bottom: 1px solid rgba(188, 149, 92, 0.4);
}

.login-emblema {
  display: none;
}

.login-marca {
  width: auto;
  height: 92px;
  filter: drop-shadow(0 10px 14px rgba(105, 28, 50, 0.16));
}

.login-nombre {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.login-nombre h1 {
  margin: 0;
  font-family: var(--fuente-titulo);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--guinda);
}

.login-nombre p {
  margin: 0;
  padding-left: 0.32em;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--dorado-texto);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 24px 20px;
}

.login-saludo h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.login-saludo p {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--texto-sec);
}

@media (min-width: 820px) {
  .login-tarjeta {
    max-width: 940px;
    grid-template-columns: 1.05fr 1fr;
  }

  .login-identidad {
    padding: 44px 40px;
    gap: 22px;
    border-bottom: 0;
    border-right: 1px solid rgba(188, 149, 92, 0.4);
  }

  .login-emblema {
    display: block;
    width: 100%;
    max-width: 380px;
    height: auto;
    filter: drop-shadow(0 18px 24px rgba(105, 28, 50, 0.16));
  }

  .login-marca,
  .login-nombre p {
    display: none;
  }

  .login-form {
    justify-content: center;
    padding: 48px 44px 32px;
  }

  .login-saludo h2 {
    font-size: 1.5rem;
  }
}

.segmentado {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  gap: 4px;
  background: var(--relleno);
  border-radius: var(--radio-control);
}

.segmentado button {
  min-height: 42px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font-weight: 600;
  color: var(--texto-sec);
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.segmentado button.activo {
  background: var(--tarjeta);
  color: var(--primario);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), inset 0 -2px 0 var(--dorado);
}

.login-modo {
  margin: -6px 0 0;
  font-size: 0.82rem;
  color: var(--texto-sec);
  min-height: 1.2em;
}

.campo {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.campo > span {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--texto-sec);
}

.campo input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--borde);
  border-radius: var(--radio-control);
  background: var(--relleno);
  font-size: 16px; /* evita el zoom automático de iOS */
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.campo input:focus {
  outline: none;
  border-color: var(--dorado);
  background: var(--tarjeta);
  box-shadow: 0 0 0 4px rgba(188, 149, 92, 0.18);
}

.campo-contrasena {
  position: relative;
}

.campo-contrasena input {
  padding-right: 88px;
}

.campo-ojo {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  padding: 8px 10px;
  border: 0;
  background: none;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primario);
}

.login-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--error-suave);
  color: var(--error);
  font-size: 0.88rem;
  font-weight: 500;
}

.login-pie {
  margin: 2px 0 0;
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--texto-sec);
}


/* ---------- Animaciones ---------- */
@keyframes aparecer {
  from {
    opacity: 0;
  }
}

@keyframes subir {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

@keyframes emblema {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.94);
  }
}

@keyframes destello {
  from {
    background-position: 130% 0;
  }
  to {
    background-position: -30% 0;
  }
}

@keyframes ensanchar {
  from {
    opacity: 0;
    transform: scaleX(0.2);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
}


.barra {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--tarjeta) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(16px);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-bottom: 1px solid rgba(188, 149, 92, 0.5);
}

.barra-identidad {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.barra-marca {
  height: 44px;
  width: auto;
  flex-shrink: 0;
  padding: 2px 4px;
  border-radius: 8px;
  background: var(--placa);
}

.barra-nombre {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.barra-nombre strong {
  font-family: var(--fuente-titulo);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primario);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.barra-nombre span {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--acento);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 480px) {
  .barra {
    gap: 8px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .barra-marca {
    height: 38px;
  }

  .barra-identidad {
    gap: 8px;
  }

  /* En teléfono el nombre va en dos líneas; la marca ya identifica a Control Patrimonial */
  .barra-nombre strong {
    font-size: 0.9rem;
    line-height: 1.12;
    letter-spacing: 0.03em;
    white-space: normal;
  }

  .barra-nombre span {
    display: none;
  }

  .barra-derecha {
    gap: 6px;
  }

  .insignia {
    padding: 3px 8px;
    font-size: 0.62rem;
  }
}

.barra-derecha {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.insignia {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.insignia-editor {
  background: var(--guinda);
  color: #fff;
}

.insignia-consulta {
  background: var(--dorado-claro);
  color: var(--guinda-oscuro);
}

.barra-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-right: auto;
  margin-left: 18px;
}

.barra-boton {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--texto-sec);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.barra-boton:hover {
  background: var(--relleno);
  color: var(--primario);
}

.barra-boton.activo,
.barra-boton.abierto {
  border-color: rgba(188, 149, 92, 0.6);
  background: var(--relleno);
  color: var(--primario);
}

.barra-menu {
  position: relative;
}

.barra-desplegable {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  width: min(380px, calc(100vw - 24px));
  max-height: min(70dvh, 560px);
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--borde);
  border-radius: 18px;
  background: var(--tarjeta);
  box-shadow: 0 24px 50px -18px rgba(40, 10, 20, 0.45);
  animation: aparecer 0.15s ease both;
}

.barra-desplegable-titulo {
  display: block;
  padding: 6px 10px 4px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--acento);
}

.barra-desplegable button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
}

.barra-desplegable button:hover {
  background: var(--relleno);
}

.barra-desplegable button.activo {
  background: color-mix(in srgb, var(--guinda) 8%, var(--tarjeta));
}

.barra-desplegable i {
  flex-shrink: 0;
  width: 28px;
  font-style: normal;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--acento);
  text-align: center;
}

.barra-desplegable span {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.barra-desplegable strong {
  font-size: 0.92rem;
  color: var(--primario);
}

.barra-desplegable em {
  font-style: normal;
  font-size: 0.74rem;
  color: var(--texto-sec);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.barra-desplegable b {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--guinda);
  color: #fff;
  font-size: 0.64rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.barra-desplegable-admin {
  margin-top: 4px;
  border-top: 1px solid var(--borde) !important;
  border-radius: 0 0 12px 12px !important;
}

/* En pantallas medianas y teléfono los botones de la barra quedan solo con ícono */
@media (max-width: 760px) {
  .barra-nav {
    margin-left: 8px;
    gap: 2px;
  }

  .barra-boton {
    width: 40px;
    padding: 0;
    justify-content: center;
  }

  .barra-boton span {
    display: none;
  }

  .barra-desplegable {
    position: fixed;
    top: calc(max(10px, env(safe-area-inset-top)) + 58px);
    left: 12px;
    right: 12px;
    width: auto;
  }
}

/* En teléfono la barra muestra solo el logotipo para dejar espacio a Inicio y Módulos */
@media (max-width: 480px) {
  .barra-nombre {
    display: none;
  }

  .barra-nav {
    margin-left: 4px;
  }
}


/* ---------- Ajustes del Panel de Trabajo ---------- */
/* El logotipo de la Coordinación trae fondo blanco: se funde con el marfil */
.portada-emblema img,
.login-emblema,
.login-marca,
.barra-marca { mix-blend-mode: multiply; }
html[data-theme='dark'] .barra-marca { mix-blend-mode: normal; }
.portada { position: fixed; inset: 0; z-index: 1000; overflow: auto; }
.portada[hidden], .login[hidden] { display: none; }
button.barra-identidad { border: 0; background: none; padding: 0; text-align: left; cursor: pointer; }
.credito-portada { position: relative; margin: -22px 0 0; padding: 0 16px max(28px, calc(env(safe-area-inset-bottom) + 20px)); text-align:center; font-size:.64rem; font-weight:600; letter-spacing:.1em; color:var(--texto-sec); opacity:1; user-select:none; }
.login-info { margin:0; padding:10px 12px; border-radius:10px; background:rgba(46,125,79,.1); color:#2e7d4f; font-size:.88rem; font-weight:500; }
