/* SGI · capa 1 · tema común Medianoche (reglas v1, decisiones del usuario del 05/11).
   Se enlaza desde _sgi_header.html (después de los <style> de cada pantalla: empata y gana sin !important)
   y a mano en las pantallas sin cabecera. Fuera de su alcance: la cabecera (capa 2) y la hoja de impresión (.hoja). */
@import url("sgi_fuentes.css");

:root {
  --m-letra: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --m-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --m-texto: #0B132B; --m-sec: #4a5568; --m-titulo: #1C2541; --m-acento: #3A506B; --m-acento-s: #e9edf2;
  --m-linea: #d8dde5; --m-fondo: #f3f5f8; --m-th: #f1f3f7; --m-blanco: #ffffff; --m-hover: #2c3d63;
  --m-ok: #3d6b50; --m-ok-s: #e9f1ec; --m-pend: #87642a; --m-pend-s: #f7f0e3;
  --m-err: #9c4a44; --m-err-s: #f7ebe9; --m-info: #4a5568; --m-info-s: #f1f3f7;
  --m-radio: 10px; --m-radio-c: 8px; --m-boton: 36px; --m-boton-p: 32px;
}

/* .brand-panel = panel oscuro del ingreso (login.html): queda con su estilo, como la cabecera. */
@scope (:root) to (.hoja, .sgi-app-header, .brand-panel) {
  /* Cuerpo y títulos (R2, R3, R4, R14) */
  body { font-family: var(--m-letra); color: var(--m-texto); background: var(--m-fondo); }
  code, kbd, pre, .mono { font-family: var(--m-mono); }
  h1 { font-size: 22px; font-weight: 700; color: var(--m-titulo); }
  /* Raya 28 × 2 bajo el título como fondo: no depende de si el h1 es flex (con ::after quedaba al lado del texto). */
  h1 { padding-bottom: 8px; background: linear-gradient(var(--m-acento), var(--m-acento)) left bottom / 28px 2px no-repeat; }
  h2, h3 { font-size: 15px; font-weight: 700; color: var(--m-titulo); }

  /* Enlaces (R6, pregunta 4) */
  a { color: var(--m-acento); text-decoration: none; }   /* sin a:visited: con 0,1,1 le ganaba a los enlaces blancos de clase (tarjetas, franja) ya visitados */
  a:hover, a:focus-visible, p a, li > a:only-child:not(.btn) { text-decoration: underline; }

  /* Botones (R5) */
  .btn, .btn-sec, .btn-secondary, .btn-plain, .btn-primary, .btn-prim, .btn-ok, .btn-success, .btn-bad, .btn-danger {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--m-boton);
    padding: 0 14px; border: 1px solid var(--m-linea); border-radius: var(--m-radio-c);
    background: var(--m-blanco); color: var(--m-texto); font: 600 13.5px/1.2 var(--m-letra);
    background-image: none; box-shadow: none; text-shadow: none; text-decoration: none; cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease, transform 160ms ease-out;
  }
  .btn-primary, .btn-prim, .btn-ok, .btn-success { background: var(--m-titulo); border-color: var(--m-titulo); color: var(--m-blanco); }
  .btn-bad, .btn-danger { color: var(--m-err); border-color: var(--m-err); }
  .btn-sm, .btn-mini { min-height: var(--m-boton-p); padding: 0 10px; font-size: 12.5px; }
  .btn:hover, .btn-sec:hover, .btn-secondary:hover, .btn-plain:hover { background: var(--m-acento-s); text-decoration: none; }
  .btn-primary:hover, .btn-prim:hover, .btn-ok:hover, .btn-success:hover { background: var(--m-hover); border-color: var(--m-hover); }
  .btn-bad:hover, .btn-danger:hover { background: var(--m-err-s); }
  :is(.btn, .btn-sec, .btn-secondary, .btn-plain, .btn-primary, .btn-prim, .btn-ok, .btn-success, .btn-bad, .btn-danger):active { transform: scale(0.97); }
  :is(.btn, .btn-sec, .btn-secondary, .btn-plain, .btn-primary, .btn-prim, .btn-ok, .btn-success, .btn-bad, .btn-danger):disabled { opacity: .55; cursor: not-allowed; transform: none; }
  .btn-glow::before, .btn-glow::after { display: none; }

  /* Foco visible (WCAG 2.4.7) */
  :focus-visible { outline: 2px solid var(--m-acento); outline-offset: 2px; }

  /* Tarjetas (R9) */
  .card, .card-box, .panel, .section-box, .table-card, .kpi-card {
    background: var(--m-blanco); background-image: none; border: 1px solid var(--m-linea); border-radius: var(--m-radio); box-shadow: none;
  }

  /* Tablas (R8) */
  table { border-collapse: collapse; }
  th { background: var(--m-th); color: var(--m-acento); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
  th, td { height: 40px; padding: 8px 12px; border-width: 0 0 1px 0; border-style: solid; border-color: var(--m-linea); }
  td.num, th.num, td.r, th.r, .num { text-align: right; font-variant-numeric: tabular-nums; }

  /* Formularios */
  input:not([type="checkbox"], [type="radio"], [type="file"], [type="hidden"], [type="range"], [type="color"]), select, textarea, .form-control, .form-select {
    min-height: var(--m-boton); border: 1px solid var(--m-linea); border-radius: var(--m-radio-c);
    background-color: var(--m-blanco); color: var(--m-texto); font-family: var(--m-letra); font-size: 13.5px; box-shadow: none;
  }
  textarea { min-height: 72px; }
  :is(input, select, textarea, .form-control, .form-select):focus { border-color: var(--m-acento); outline: 2px solid var(--m-acento); outline-offset: 0; }
  .form-label { font-size: 12.5px; font-weight: 600; color: var(--m-sec); }

  /* Avisos y estados (R7) */
  .flash-mensajes > p { padding: 10px 14px; border-radius: var(--m-radio-c); font-size: 13.5px; }
  .flash-exito, .flash-success, .badge-ok, .badge-activo, .badge-success { color: var(--m-ok); background: var(--m-ok-s); }
  .flash-advertencia, .flash-warning, .badge-pendiente, .badge-warning { color: var(--m-pend); background: var(--m-pend-s); }
  .flash-error, .flash-danger, .badge-error, .badge-danger { color: var(--m-err); background: var(--m-err-s); }
  .flash-info, .flash-message, .badge-info, .badge-inactivo { color: var(--m-info); background: var(--m-info-s); }
  .badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background-image: none; box-shadow: none; }

  /* Sin barras de desplazamiento visibles; las flechas las pone sgi_tema.js (R11) */
  * { scrollbar-width: none; }
  *::-webkit-scrollbar { width: 0; height: 0; }

  /* Celular (R13): las tablas se corren dentro de su recuadro */
  @media (max-width: 600px) {
    img, video, canvas, svg { max-width: 100%; }
    .tabla, .table-responsive, .table-card, .tbl-wrap { max-width: 100%; overflow-x: auto; }
    .barra-col { min-width: 0; }   /* panel de evaluaciones: con Inter las etiquetas corrían 6 px la fila */
  }
}

/* La página tampoco muestra su barra (el ámbito de arriba no incluye la raíz). */
:root { scrollbar-width: none; }
:root::-webkit-scrollbar { width: 0; height: 0; }

/* La hoja de impresión solo toma la letra (pregunta 5). */
.hoja { font-family: var(--m-letra); }

/* Flechas de «hay más datos» (reemplazan la barra). */
.sgi-xf { position: sticky; left: calc(100% - 28px); top: 0; display: block; width: 0; height: 0; z-index: 5; pointer-events: none; }
.sgi-xf.izq { left: 6px; }
.sgi-xf::after { content: ""; position: absolute; top: 8px; left: 0; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(28,37,65,.85) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6l6 6-6 6'/%3E%3C/svg%3E") center/12px no-repeat;
  animation: sgiDer 1.6s ease-in-out infinite; transition: opacity .25s; }
.sgi-xf.izq::after { transform: scaleX(-1); animation-name: sgiIzq; }
.sgi-xf.no::after { opacity: 0; animation: none; }
#sgi-yf { position: fixed; left: 50%; bottom: 18px; z-index: 58; width: 28px; height: 28px; margin-left: -14px; padding: 0; border: 2px solid #fff; border-radius: 50%; cursor: pointer;
  background: rgba(28,37,65,.88) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center/14px no-repeat;
  animation: sgiAbajo 1.6s ease-in-out infinite; transition: opacity .25s; }
#sgi-yf[hidden] { display: block; opacity: 0; pointer-events: none; animation: none; }
@keyframes sgiDer { 0%, 100% { opacity: .4; translate: 0; } 50% { opacity: .95; translate: 3px; } }
@keyframes sgiIzq { 0%, 100% { opacity: .4; translate: 0; } 50% { opacity: .95; translate: -3px; } }
@keyframes sgiAbajo { 0%, 100% { opacity: .45; translate: 0 0; } 50% { opacity: 1; translate: 0 4px; } }
@media print { .sgi-xf, #sgi-yf { display: none !important; } }

/* Movimiento reducido (R16), en toda la página */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
