/* SGO Navimag · shell (login, inicio, usuarios). Usa los tokens de base.css. */

.app { min-height: 100vh; min-height: 100dvh; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; background: var(--ground); }
.app.ancha { max-width: 1040px; }

/* ---------- Encabezado ---------- */
.hdr {
  position: sticky; top: 0; z-index: 10; background: var(--red); color: #fff;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  display: flex; align-items: center; gap: 10px; min-height: 60px;
}
.hdr h1 { margin: 0; font-size: 20px; font-weight: 700; line-height: 1.15; }
.hdr .sub { font-size: 12px; opacity: .9; font-weight: 500; }
.hdr .grow { flex-grow: 1; min-width: 0; }
.hdr .icon-btn { color: #fff; margin: -6px; }
.hdr .icon-btn:hover { background: rgba(255,255,255,.12); }
.hdr a.icon-btn { text-decoration: none; }

.scr { flex-grow: 1; padding: 16px; display: flex; flex-direction: column; gap: 14px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }

/* ---------- Login ---------- */
.login { margin: auto 0; display: flex; flex-direction: column; gap: 14px; }
.marca { text-align: center; margin-bottom: 8px; }
.marca strong { display: block; font-size: 34px; font-weight: 700; color: var(--red); letter-spacing: -.5px; line-height: 1.1; }
.marca span { font-size: 14px; color: var(--ink-2); }
.login .btn { height: 52px; font-size: 16px; }
.aviso { background: var(--warn-bg); border: 1px solid var(--warn-bd); color: var(--warn-fg); border-radius: 10px; padding: 10px 12px; font-size: 14px; line-height: 1.4; }

/* ---------- Inicio ---------- */
.saludo { padding: 4px 2px 0; }
.saludo h2 { margin: 0; font-size: 22px; font-weight: 700; }
.saludo p { margin: 4px 0 0; font-size: 14px; color: var(--ink-2); }

.mods { display: flex; flex-direction: column; gap: 10px; }
.mod {
  display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 16px;
  text-decoration: none; color: #fff; min-height: 96px;
}
.mod:hover { color: #fff; filter: brightness(1.06); }
.mod.plan { background: var(--blue); }
.mod.plano { background: #14384F; }
.mod.portalon { background: #2B3A4A; }
.mod-ic { width: 48px; height: 48px; border-radius: 14px; background: rgba(255,255,255,.14); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mod .t { font-size: 18px; font-weight: 700; line-height: 1.2; }
.mod .d { font-size: 13px; opacity: .88; margin-top: 2px; }
.mod .r { display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 600; background: rgba(255,255,255,.16); padding: 3px 8px; border-radius: 6px; }
.mod .grow { flex-grow: 1; min-width: 0; }
.mod .chev { opacity: .7; flex-shrink: 0; }

.acciones { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.accion {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); font: 600 15px var(--font);
  text-decoration: none; cursor: pointer; text-align: left; width: 100%;
}
.accion:hover { background: #FAFBFC; color: var(--ink); }
.accion svg { color: var(--blue); flex-shrink: 0; }
.accion.salir svg { color: var(--err-fg); }

/* ---------- Página de módulo en integración ---------- */
.integrando { margin: auto 0; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.integrando .mod-ic { background: var(--blue-soft); color: var(--blue); width: 64px; height: 64px; border-radius: 18px; }
.integrando h2 { margin: 0; font-size: 22px; }
.integrando p { margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.5; max-width: 40ch; }

/* ---------- Usuarios ---------- */
.barra { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.barra .ctl { flex: 1 1 220px; }
.barra .btn { flex-shrink: 0; }
.filtro { display: flex; gap: 6px; flex-wrap: wrap; }
.filtro button {
  height: 34px; padding: 0 12px; border-radius: 17px; border: 1px solid var(--line-2); background: var(--surface);
  font: 600 13px var(--font); color: var(--ink-2); cursor: pointer;
}
.filtro button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

.lista { display: flex; flex-direction: column; gap: 8px; }
.usr {
  width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center;
}
.usr:hover { border-color: var(--line-2); background: #FAFBFC; }
.usr.inactivo { opacity: .55; }
.usr .n { font-weight: 700; font-size: 15px; }
.usr .u { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.usr .tags { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.usr .term { font-size: 12px; color: var(--ink-2); font-weight: 600; text-align: right; }
.tag { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px; background: var(--line-3); color: var(--ink-2); }
.tag.admin { background: var(--err-bg); color: var(--red); }
.tag.plan { background: var(--blue-soft); color: var(--blue-d); }
.tag.plano { background: #DCE8EE; color: #14384F; }
.tag.portalon { background: #E3E7EC; color: #2B3A4A; }
.tag.off { background: var(--off-bg); color: var(--off-fg); }

@media (min-width: 760px) {
  .usr { grid-template-columns: minmax(180px, 1.2fr) minmax(0, 2fr) auto; }
  .usr .tags { grid-column: auto; margin-top: 0; }
}

/* Formulario de usuario */
dialog.dlg-usr { width: min(640px, calc(100vw - 24px)); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
.sec-t { margin: 6px 0 0; font-size: 15px; font-weight: 700; }
.sec-d { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

.modbox { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.modbox-h { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #FAFBFC; }
.modbox-h .grow { flex-grow: 1; font-weight: 700; font-size: 15px; }
.modbox-b { padding: 12px; display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); }
.modbox.apagado .modbox-b { display: none; }
.perms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; }
@media (max-width: 520px) { .perms { grid-template-columns: minmax(0, 1fr); } }
.chk { display: flex; align-items: center; gap: 8px; font-size: 14px; min-height: 32px; cursor: pointer; }
.chk input { width: 18px; height: 18px; accent-color: var(--blue); flex-shrink: 0; }
.chk.fuerte { font-weight: 600; }
.nota { font-size: 13px; color: var(--muted); line-height: 1.4; }

/* Flecha de los select (base.css quita la del sistema) */
select.ctl {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2357606A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}

/* Diálogos largos: encabezado y botones fijos, solo el contenido se desplaza */
dialog.dlg > form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); }
dialog.dlg > form .dlg-body { flex: 1 1 auto; min-height: 0; overflow: auto; }
dialog.dlg { overflow: hidden; }

@media (min-width: 760px) {
  .usr { grid-template-columns: 240px minmax(0, 1fr) 170px; }
}

/* ---------- Inicio en versión web (escritorio) ---------- */
.hdr-in { display: flex; align-items: center; gap: 10px; width: 100%; }
.app.web { max-width: none; }
.app.web .login { width: 100%; max-width: 420px; margin: auto; }

@media (min-width: 900px) {
  .app.web .hdr { padding: 0 32px; min-height: 68px; }
  .app.web .hdr-in { max-width: 1136px; margin: 0 auto; }   /* alineado con el contenido (1200 - 2×32 de margen) */
  .app.web .hdr h1 { font-size: 22px; }
  .app.web .hdr .sub { font-size: 13px; }

  .app.web #s-home { width: 100%; max-width: 1200px; margin: 0 auto; padding: 40px 32px 48px; gap: 28px; }
  .app.web .saludo h2 { font-size: 30px; }
  .app.web .saludo p { font-size: 15px; margin-top: 6px; }

  .app.web .mods { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
  .app.web .mod {
    position: relative; flex-direction: column; align-items: flex-start; gap: 18px;
    min-height: 230px; padding: 26px; border-radius: 18px;
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
  }
  .app.web .mod:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(27,31,36,.18); filter: none; }
  .app.web .mod-ic { width: 60px; height: 60px; border-radius: 16px; }
  .app.web .mod-ic svg { width: 30px; height: 30px; }
  .app.web .mod .grow { display: flex; flex-direction: column; flex-grow: 1; }
  .app.web .mod .t { font-size: 22px; }
  .app.web .mod .d { font-size: 14px; margin-top: 6px; line-height: 1.4; }
  .app.web .mod .r { margin-top: auto; align-self: flex-start; font-size: 12.5px; padding: 4px 10px; }
  .app.web .mod .chev { position: absolute; top: 24px; right: 22px; }

  .app.web .acciones { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 4px; }
  .app.web .accion { min-height: 64px; padding: 0 20px; border-radius: 14px; }
  .app.web .accion:hover { border-color: var(--line-2); box-shadow: 0 4px 14px rgba(27,31,36,.06); }
  .app.web .empty { padding: 32px; }
}

/* ---------- Acciones de cuenta en la barra superior ---------- */
.hdr-acc { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.hdr-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 10px;
  background: none; border: none; color: #fff; font: 600 14px var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.hdr-btn:hover { background: rgba(255,255,255,.14); color: #fff; }
.hdr-btn svg { width: 20px; height: 20px; flex-shrink: 0; color: #fff; }
.hdr-btn + .hdr-btn, .hdr-btn[hidden] + .hdr-btn { margin-left: 0; }
#btnSalir { border: 1px solid rgba(255,255,255,.35); margin-left: 6px; }
@media (max-width: 720px) {
  .hdr-btn span { display: none; }             /* en el celular quedan solo los íconos */
  .hdr-btn { padding: 0 9px; }
  #btnSalir { border: none; margin-left: 0; }
}
