:root {
  --navy: #182538;
  --teal: #136979;
  --gold: #c08d3d;
  --gris: #5c6b73;
  --fondo: #f4f6f7;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--fondo);
  color: #1b2630;
}

/* ---- Login ---- */
.login-pantalla {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy), var(--teal));
}
.login-caja {
  background: #fff;
  border-radius: 12px;
  padding: 40px 36px;
  width: 340px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
  text-align: center;
}
.login-caja h1 {
  font-size: 1.3rem;
  color: var(--navy);
  margin: 4px 0 2px;
}
.login-caja .subtitulo {
  color: var(--gris);
  font-size: 0.85rem;
  margin-bottom: 24px;
}
.login-caja input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #cfd6da;
  border-radius: 7px;
  font-size: 0.95rem;
  margin-bottom: 14px;
}
.login-caja button {
  width: 100%;
  padding: 11px;
  background: var(--teal);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.login-caja button:hover { background: var(--navy); }
.login-error {
  color: #a32d2d;
  font-size: 0.82rem;
  min-height: 18px;
  margin-top: -4px;
  margin-bottom: 10px;
}

/* ---- Shell del portal ---- */
.shell {
  display: flex;
  height: 100vh;
}
.barra-lateral {
  width: 240px;
  flex-shrink: 0;
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}
.barra-lateral button {
  font: inherit;
  text-align: left;
  background: none;
  border: none;
  width: 100%;
}
.barra-lateral button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -2px;
}
.barra-lateral .marca {
  color: #fff;
  cursor: pointer;
  padding: 0 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  margin-bottom: 14px;
  user-select: none;
}
.barra-lateral .marca:hover strong { color: #c08d3d; }
.barra-lateral .marca strong {
  display: block;
  font-size: 1.05rem;
  letter-spacing: 0.3px;
}
.barra-lateral .marca span {
  display: block;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.6);
  margin-top: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  border-left: 3px solid transparent;
  font-size: 0.92rem;
  transition: background 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.06); }
.nav-grupo {
  padding: 16px 20px 6px;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
  font-weight: 600;
}
.nav-item.activo {
  background: rgba(192,141,61,0.15);
  border-left-color: var(--gold);
  color: #fff;
  font-weight: 600;
}
.barra-lateral .salir {
  margin-top: auto;
  padding: 13px 20px;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  font-size: 0.85rem;
  border-top: 1px solid rgba(255,255,255,0.12);
}
.barra-lateral .salir:hover { color: #fff; }
.contenido {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.contenido iframe {
  flex: 1;
  border: none;
  width: 100%;
}
.pantalla-bienvenida {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gris);
  font-size: 1rem;
}

.contenido iframe[hidden],
.pantalla-bienvenida[hidden] { display: none; }

/* ---- Pantallas angostas: el menú pasa arriba, en una franja horizontal ---- */
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .barra-lateral {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 8px;
  }
  .barra-lateral .marca, .nav-grupo { display: none; }
  .barra-lateral .nav-item, .barra-lateral .salir {
    width: auto;
    padding: 8px 12px;
    border-left: none;
    border-top: none;
    margin-top: 0;
  }
  .nav-item.activo { border-bottom: 2px solid var(--gold); }
}

/* ---- Nuevo diseño: menú lateral de alto contraste con la paleta institucional ---- */
.barra-lateral { background: #13202f; }
.barra-lateral .marca strong { color: #ffffff; font-weight: 700; }
.barra-lateral .marca span { color: #e2c08c; font-weight: 600; }
.nav-grupo { color: #e2c08c !important; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.72rem; }
.barra-lateral .nav-item {
  color: #ffffff !important; font-weight: 600; border-left: none !important;
  border-radius: 8px; margin: 2px 10px; width: calc(100% - 20px);
}
.barra-lateral .nav-item:hover { background: rgba(255,255,255,0.12); }
.barra-lateral .nav-item.activo { background: #d4b07a !important; color: #13202f !important; font-weight: 700; }
.barra-lateral .salir { color: #ffffff; font-weight: 600; }
.contenido { background: #e3e9ef; }

/* ---- Aplicación instalable: botón e instrucciones ---- */
.instalar-boton { display: flex; align-items: center; justify-content: center; gap: 8px; width: calc(100% - 20px); margin: 0 10px 8px; padding: 9px 12px; border-radius: 9px; border: 1px solid #d4b07a; background: transparent; color: #e2c08c; font-weight: 700; font-size: 0.85rem; cursor: pointer; font-family: inherit; }
.instalar-boton:hover { background: rgba(212,176,122,0.15); }
.instalar-boton:focus-visible { outline: 2px solid #e2c08c; }
.instalar-boton[hidden] { display: none; }
.login-instalar { margin-top: 14px; background: transparent; border: none; color: #136979; font-weight: 700; text-decoration: underline; cursor: pointer; font-family: inherit; font-size: 0.88rem; }
.login-instalar[hidden] { display: none; }
.instalar-fondo { position: fixed; inset: 0; background: rgba(11,21,32,0.5); display: flex; align-items: center; justify-content: center; z-index: 3000; }
.instalar-caja { background: #ffffff; border-radius: 16px; padding: 24px; width: min(380px, 92vw); text-align: center; color: #0b1520; font-family: inherit; }
.instalar-caja img { width: 72px; height: 72px; border-radius: 16px; }
.instalar-caja h2 { margin: 10px 0 6px; color: #142a46; font-size: 1.2rem; }
.instalar-caja p { font-size: 0.9rem; color: #26333f; margin: 0 0 12px; }
.instalar-caja b { display: block; text-align: left; color: #142a46; font-size: 0.9rem; }
.instalar-caja ol { text-align: left; font-size: 0.9rem; color: #26333f; padding-left: 20px; margin: 6px 0 16px; line-height: 1.5; }
.instalar-caja button { border: none; background: #1F3A5F; color: #ffffff; font-weight: 700; padding: 10px 22px; border-radius: 10px; cursor: pointer; font-size: 0.92rem; }
.barra-lateral .instalar-boton { margin-top: auto; }
.barra-lateral .instalar-boton:not([hidden]) + .salir { margin-top: 0; }
.barra-lateral .instalar-boton { border: 1px solid #d4b07a !important; border-radius: 9px !important; padding: 9px 12px !important; width: calc(100% - 20px) !important; margin-left: 10px !important; margin-right: 10px !important; background: transparent !important; color: #e2c08c !important; }
.barra-lateral .instalar-boton:hover { background: rgba(212,176,122,0.15) !important; }
.login-caja .login-instalar { display: block; width: 100%; margin-top: 12px; background: transparent; color: #136979; border: none; text-decoration: underline; font-weight: 700; }
.login-caja .login-instalar[hidden] { display: none; }
