/* Añadidos del shell sobre el diseño del mockup (app.css).
   Solo cubren lo que el mockup no tenía: buscador con resultados, avisos,
   cargador y botón de salir. */

.sb-cargando {
  padding: 18px 14px;
  font-size: 12px;
  color: #5f7d6c;
}

/* Pie del menú: versión y derechos, siempre visibles sin scrollear */
.sb-pie {
  flex-shrink: 0;
  padding: 10px 18px 12px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  background: rgba(0, 0, 0, .15);
}
.sb-pie-vers { font-size: 10px; color: #5f9e78; letter-spacing: .3px; }
.sb-pie-copy { font-size: 9.5px; color: #4a6a58; margin-top: 2px; }

/* La pantalla se inyecta por fetch; `on` la hace visible (ver .page en app.css) */
.cargador {
  padding: 40px 22px;
  color: var(--muted);
  font-size: 13px;
}

.aviso {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px;
  margin: 22px;
  max-width: 560px;
}
.aviso h2 { font-size: 17px; margin-bottom: 8px; color: var(--ink); }
.aviso p  { font-size: 13px; color: var(--muted); line-height: 1.55; }

/* Resultados del buscador */
.search { position: relative; }
.search-res {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: 0 10px 28px rgba(22, 33, 28, .12);
  overflow: hidden;
  z-index: 90;
}
.search-res.on { display: block; }
.sr-i {
  padding: 9px 14px;
  font-size: 12.5px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.sr-i:last-child { border-bottom: 0; }
.sr-i:hover { background: var(--green-soft); }
.sr-vacio { color: var(--muted); cursor: default; }
.sr-vacio:hover { background: transparent; }

/* Avatar con foto de Google */
.user-chip .av { background-position: center; }

#btnSalir { padding: 6px 13px; font-size: 11.5px; }

/* ===========================================================================
   LOGIN
   Misma estructura visual que el ERP de Janser (fondo animado, tarjeta
   centrada, versión y derechos al pie), con la identidad de St. Patrick:
   verde institucional y azul marino en lugar de los azules de Janser.
   =========================================================================== */
.login-wrap {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
  background: linear-gradient(135deg, #061109 0%, #0d1f16 55%, #0a4a24 100%);
}

/* Resplandor inferior */
.lg-halo {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 115%,
    rgba(72, 171, 82, .26) 0%, rgba(13, 127, 54, .08) 42%, rgba(6, 17, 9, 0) 70%);
}

/* Destellos: puntos que laten muy despacio */
.lg-destello {
  position: absolute; border-radius: 50%; background: var(--green-2);
  z-index: 1; pointer-events: none; animation: lgBrillar 5s ease-in-out infinite;
}
.lg-destello.d1 { top: 14%; left: 12%;  width: 5px; height: 5px; animation-duration: 4.2s; }
.lg-destello.d2 { top: 26%; right: 16%; width: 4px; height: 4px; animation-duration: 5.6s; animation-delay: 1.2s; }
.lg-destello.d3 { top: 9%;  right: 34%; width: 3px; height: 3px; background: var(--gold); animation-duration: 6.4s; animation-delay: 2.1s; }
.lg-destello.d4 { top: 38%; left: 26%;  width: 3px; height: 3px; background: var(--gold); animation-duration: 5s;   animation-delay: .6s; }

/* Partículas que suben */
.lg-burbuja {
  position: absolute; bottom: -14px; border-radius: 50%;
  border: 1px solid rgba(72, 171, 82, .55);
  background: rgba(72, 171, 82, .08);
  z-index: 1; pointer-events: none; animation: lgSubir linear infinite;
}

/* Ondas del pie, en tres capas a distinta velocidad */
.lg-ola {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 2;
  background-repeat: repeat-x; background-position: 0 bottom; pointer-events: none;
}
.lg-ola.o1 {
  height: 150px; opacity: .30; background-size: 680px 150px;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%22680%22%20height%3D%22150%22%20viewBox%3D%220%200%20680%20150%22%20preserveAspectRatio%3D%22none%22%3E%3Cpath%20d%3D%22M0%2070%20Q%2085%2030%20170%2070%20T%20340%2070%20T%20510%2070%20T%20680%2070%20V150%20H0%20Z%22%20fill%3D%22%2348AB52%22/%3E%3C/svg%3E");
  animation: lgOlaBgA 16s linear infinite;
}
.lg-ola.o2 {
  height: 120px; opacity: .45; background-size: 680px 120px;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%22680%22%20height%3D%22120%22%20viewBox%3D%220%200%20680%20120%22%20preserveAspectRatio%3D%22none%22%3E%3Cpath%20d%3D%22M0%2060%20Q%2085%2095%20170%2060%20T%20340%2060%20T%20510%2060%20T%20680%2060%20V120%20H0%20Z%22%20fill%3D%22%230D7F36%22/%3E%3C/svg%3E");
  animation: lgOlaBgB 11s linear infinite;
}
.lg-ola.o3 {
  height: 90px; opacity: .85; background-size: 680px 90px;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%22680%22%20height%3D%2290%22%20viewBox%3D%220%200%20680%2090%22%20preserveAspectRatio%3D%22none%22%3E%3Cpath%20d%3D%22M0%2045%20Q%2085%2015%20170%2045%20T%20340%2045%20T%20510%2045%20T%20680%2045%20V90%20H0%20Z%22%20fill%3D%22%230a2b16%22/%3E%3C/svg%3E");
  animation: lgOlaBgA 8s linear infinite;
}

@keyframes lgOlaBgA { 0% { background-position-x: 0; }      100% { background-position-x: -680px; } }
@keyframes lgOlaBgB { 0% { background-position-x: -680px; } 100% { background-position-x: 0; } }
@keyframes lgSubir  { 0% { transform: translateY(0); opacity: 0; } 12% { opacity: .55; } 88% { opacity: .45; } 100% { transform: translateY(-70vh); opacity: 0; } }
@keyframes lgBrillar { 0%, 100% { opacity: .25; } 50% { opacity: .6; } }

/* Ondas más bajas donde hay poco alto disponible */
@media (max-width: 560px) {
  .lg-ola.o1 { height: 90px; background-size: 480px 90px; }
  .lg-ola.o2 { height: 72px; background-size: 480px 72px; }
  .lg-ola.o3 { height: 54px; background-size: 480px 54px; }
}
@media (max-height: 640px) {
  .lg-ola.o1 { height: 80px; background-size: 560px 80px; }
  .lg-ola.o2 { height: 64px; background-size: 560px 64px; }
  .lg-ola.o3 { height: 48px; background-size: 560px 48px; }
}

/* Respeta a quien pidió menos movimiento en su sistema */
@media (prefers-reduced-motion: reduce) {
  .lg-destello, .lg-burbuja, .lg-ola { animation: none; }
  .lg-burbuja { display: none; }
}

.login-card {
  position: relative;
  z-index: 3;
  background: var(--white);
  border-radius: 18px;
  padding: 34px 30px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  text-align: center;
}
.login-card .sb-crest { width: 56px; height: 70px; margin: 0 auto 12px; display: block; }
.login-card h1 { font-size: 20px; margin-bottom: 3px; letter-spacing: -.3px; }
.login-card .sub { font-size: 12.5px; color: var(--muted); }
.login-card .grp {
  font-size: 11px;
  color: #9aa8a0;
  margin-top: 3px;
  margin-bottom: 24px;
  letter-spacing: .2px;
}
.login-card .pie {
  margin-top: 20px;
  font-size: 10.5px;
  color: #9aa8a0;
  line-height: 1.55;
}
.login-card .version {
  font-size: 10px;
  color: #c2ccc6;
  margin-top: 8px;
  letter-spacing: .3px;
}
.login-error {
  display: none;
  background: #fdecec;
  border: 1px solid #f5b5b5;
  color: #9b1c1c;
  border-radius: 9px;
  padding: 10px 13px;
  font-size: 12px;
  margin-bottom: 16px;
  text-align: left;
}
.login-error.on { display: block; }
.login-dev {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.login-dev input {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 13px;
  margin-bottom: 10px;
}
.login-dev button { width: 100%; }
#gbtn { display: flex; justify-content: center; min-height: 44px; }

/* ===========================================================================
   PANTALLAS CON DATOS REALES
   Tablas, formularios y modales de Configuración. Sigue el mismo lenguaje
   visual del boceto (mismas variables de color, mismos radios).
   =========================================================================== */

.head-acciones { display: flex; align-items: center; gap: 10px; }

.inp-busca {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 13px;
  font-size: 12.5px;
  width: 250px;
  background: var(--white);
  outline: none;
}
.inp-busca:focus { border-color: var(--green-2); }

.aviso-linea {
  background: var(--green-soft);
  border: 1px solid #cfe6d8;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12px;
  color: #2c5c40;
  margin-bottom: 16px;
  line-height: 1.5;
}
.aviso-linea.warn { background: #FFF8E1; border-color: #F2DFA0; color: #7a5c00; }

.cargador, .vacio {
  padding: 34px 22px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* --- Tablas --- */
.tabla-caja {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: auto;
}
.tabla { width: 100%; border-collapse: collapse; }
.tabla th {
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  font-weight: 600;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfdfc;
  position: sticky;
  top: 0;
  z-index: 1;
}
.tabla td { padding: 11px 14px; font-size: 12.5px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tabla tbody tr:last-child td { border-bottom: 0; }
.tabla tbody tr:hover { background: #fafcfb; }
.tabla .t-name { font-weight: 600; color: var(--ink); }
.tabla .t-sub  { color: var(--muted); font-size: 11.5px; }
.fila-inactiva { opacity: .55; }
.tabla-pie { font-size: 11px; color: var(--muted); padding: 10px 3px; }

.celda-usr { display: flex; align-items: center; gap: 10px; }
.av-mini {
  width: 30px; height: 30px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0; display: grid; place-items: center;
}
.av-mini.av-txt { background: var(--navy); color: #fff; font-size: 10.5px; font-weight: 700; }

.btn-mini {
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 7px;
  padding: 5px 11px;
  font-size: 11.5px;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
}
.btn-mini:hover { border-color: var(--green); color: var(--green); }

/* --- Matriz de permisos --- */
.seg { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; }
.seg button {
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 9px;
  padding: 7px 13px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
  display: flex; align-items: center; gap: 7px;
}
.seg button:hover { border-color: var(--green-2); }
.seg button.seg-on { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.seg-n {
  background: rgba(0, 0, 0, .07); border-radius: 20px;
  padding: 0 6px; font-size: 10px; min-width: 18px; text-align: center;
}
.seg-on .seg-n { background: rgba(255, 255, 255, .25); }

.rol-cab {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; flex-wrap: wrap; margin-bottom: 14px;
}
.rol-nombre { font-size: 15px; font-weight: 700; }
.rol-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.rol-metricas { display: flex; gap: 16px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.rol-metricas b { color: var(--ink); font-size: 13px; }

.matriz .col-chk { text-align: center; width: 84px; }
.matriz input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; accent-color: var(--green); }
.matriz input[type="checkbox"]:disabled { cursor: not-allowed; opacity: .45; }
.fila-modulo td { background: #f4f8f6; font-size: 12px; }
.fila-modulo:hover td { background: #eef5f1; }
.mod-ic { margin-right: 4px; }
.celda-pantalla { padding-left: 34px !important; color: #4a5a52; }

.matriz-pie {
  display: flex; justify-content: flex-end; align-items: center; gap: 14px;
  padding: 14px 3px; position: sticky; bottom: 0;
  background: linear-gradient(to top, var(--bg) 60%, transparent);
}

/* --- Formularios --- */
.campo { margin-bottom: 14px; }
.campo > label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.campo-fila { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.campo-nota { font-size: 10.5px; color: var(--muted); margin-top: 5px; line-height: 1.5; }

.inp {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: var(--white);
  color: var(--ink);
}
.inp:focus { border-color: var(--green-2); }
.inp:disabled { background: #f4f7f5; color: var(--muted); cursor: not-allowed; }

.chk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.chk {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
}
.chk:hover { border-color: var(--green-2); }
.chk input { accent-color: var(--green); width: 15px; height: 15px; }
.chk-solo { border: 0; padding: 0; }
.chk-solo:hover { border: 0; }
.chk-nota { margin-left: auto; font-size: 10px; color: var(--muted); }

.modal-pie {
  display: flex; justify-content: flex-end; gap: 9px;
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line);
}

/* --- Modal --- */
.modal-ov {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(10, 24, 16, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto;
}
.modal {
  background: var(--white); border-radius: 15px; width: 100%;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .3);
}
.modal-cab {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 22px 14px; border-bottom: 1px solid var(--line);
}
.modal-cab h3 { font-size: 15.5px; }
.modal-x {
  border: 0; background: transparent; font-size: 22px; line-height: 1;
  cursor: pointer; color: var(--muted); padding: 0 4px;
}
.modal-x:hover { color: var(--ink); }
.modal-cuerpo { padding: 20px 22px 22px; }

/* --- Aviso flotante --- */
.toast {
  position: fixed; bottom: 22px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff;
  padding: 11px 20px; border-radius: 10px;
  font-size: 12.5px; z-index: 300;
  opacity: 0; pointer-events: none; transition: .2s;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  max-width: calc(100vw - 40px);
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #9b1c1c; }

/* --- Buscador de pantallas (Cmd/Ctrl + K) --- */
.cmdk-ov {
  position: fixed; inset: 0; z-index: 250;
  background: rgba(10, 24, 16, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 90px 16px 20px;
}
.cmdk {
  background: var(--white); border-radius: 14px; width: 100%; max-width: 560px;
  box-shadow: 0 26px 70px rgba(0, 0, 0, .35); overflow: hidden;
  display: flex; flex-direction: column; max-height: 65vh;
}
.cmdk-busca { display: flex; align-items: center; gap: 10px; padding: 14px 17px; border-bottom: 1px solid var(--line); }
.cmdk-busca input {
  flex: 1; border: 0; outline: none; font-size: 14.5px;
  font-family: inherit; color: var(--ink); background: transparent;
}
.cmdk-esc {
  font-size: 10px; color: var(--muted); border: 1px solid var(--line);
  border-radius: 5px; padding: 2px 6px; font-family: inherit;
}
.cmdk-lista { overflow-y: auto; padding: 6px; }
.cmdk-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  border: 0; background: transparent; text-align: left;
  padding: 9px 12px; border-radius: 9px; cursor: pointer;
  font-family: inherit; font-size: 13px; color: var(--ink);
}
.cmdk-item.sel { background: var(--green-soft); }
.cmdk-mod { margin-left: auto; font-size: 10.5px; color: var(--muted); }
.cmdk-vacio { padding: 26px; text-align: center; color: var(--muted); font-size: 12.5px; }
.cmdk-pie {
  border-top: 1px solid var(--line); padding: 8px 15px;
  font-size: 10.5px; color: var(--muted); display: flex; gap: 12px;
}
.cmdk-pie kbd {
  border: 1px solid var(--line); border-radius: 4px;
  padding: 1px 5px; font-family: inherit; font-size: 10px;
}

/* --- Móvil --- */
@media (max-width: 760px) {
  .head-acciones { width: 100%; flex-wrap: wrap; }
  .inp-busca { width: 100%; }
  .campo-fila, .chk-grid { grid-template-columns: 1fr; }
  .modal-ov { padding: 12px; }
  .tabla th, .tabla td { padding: 9px 11px; }
  .matriz { min-width: 520px; }
  .cmdk-ov { padding-top: 50px; }
}

/* --- KPIs, bloques y barras de avance (gobierno institucional) --- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi {
  background: var(--white); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px;
}
.kpi-n { font-size: 26px; font-weight: 700; letter-spacing: -.5px; }
.kpi-t { font-size: 11px; color: var(--muted); margin-top: 2px; }
.kpi.ok   .kpi-n { color: var(--green); }
.kpi.warn .kpi-n { color: #C77700; }

.bloque { margin-bottom: 22px; }
.bloque-cab {
  font-size: 11px; font-weight: 700; letter-spacing: .6px;
  color: var(--navy); text-transform: uppercase; margin-bottom: 8px;
}

.barra {
  height: 6px; background: var(--line); border-radius: 20px; overflow: hidden;
  min-width: 70px; margin-bottom: 3px;
}
.barra span { display: block; height: 100%; background: var(--green); border-radius: 20px; }

.cita {
  background: var(--green-soft); border-left: 3px solid var(--green);
  border-radius: 0 8px 8px 0; padding: 11px 14px; font-size: 12.5px; line-height: 1.5;
}

h2.sec { font-size: 14px; margin: 26px 0 10px; color: var(--ink); }
h2.sec:first-child { margin-top: 0; }

.varia { font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.varia.sube { color: var(--green); }
.varia.baja { color: var(--red); }

/* --- Plan estratégico --- */
.obj {
  background: var(--white); border: 1px solid var(--line);
  border-radius: 13px; padding: 16px 18px; margin-bottom: 14px;
}
.obj-cab { display: flex; gap: 14px; align-items: flex-start; }
.obj-n {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  background: var(--navy); color: #fff; display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
}
.obj-txt { flex: 1; min-width: 0; }
.obj-nombre { font-size: 14px; font-weight: 700; }
.obj-desc { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.obj-meta { width: 170px; flex-shrink: 0; text-align: right; }
.obj-meta .barra { margin: 6px 0 3px auto; }
.obj-ind { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.obj-ind-t { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }

@media (max-width: 760px) {
  .obj-cab { flex-wrap: wrap; }
  .obj-meta { width: 100%; text-align: left; }
  .obj-meta .barra { margin-left: 0; }
}
