/* ============================================================================
   TrainingMiG — sistema visual
   ----------------------------------------------------------------------------
   Todo sale del logo de MiG Sistemas: el azul eléctrico, el azul profundo, el
   periwinkle y la diagonal de las cápsulas del isotipo. Esa diagonal es el
   motivo estructural del sitio: marca lo activo, separa los niveles de una ruta
   de menú y aparece de fondo en las pantallas de entrada.
   ========================================================================== */

:root {
  /* --- marca (medidos sobre el logo original) ----------------------- */
  --navy:        #0A1240;
  --indigo:      #2432A0;
  --electrico:   #2050F0;
  --periwinkle:  #7080F0;
  --lavanda:     #B0BCF5;
  --palido:      #DCE3FD;

  /* --- superficies: tema claro -------------------------------------- */
  --fondo:       #F5F7FE;
  --superficie:  #FFFFFF;
  --superficie2: #EDF0FD;
  --linea:       #DFE4F7;
  --linea-suave: #EBEEFB;

  --tinta:       #0A1240;
  --tinta2:      #59618C;
  --tinta3:      #8E96BC;
  --sobre-color: #FFFFFF;

  --acento:      var(--electrico);
  --acento-piso: #E8ECFE;

  --verde: #17795A;  --verde-piso: #E1F4EC;
  --ambar: #9A6B12;  --ambar-piso: #FBF0DC;
  --rojo:  #C0392B;  --rojo-piso:  #FCE9E7;

  --rail:        linear-gradient(180deg, #0A1240 0%, #111B57 100%);
  --rail-texto:  #B8C0E6;
  --rail-suave:  #737DAE;

  --sombra-1: 0 1px 2px rgba(10,18,64,.06);
  --sombra-2: 0 2px 4px rgba(10,18,64,.05), 0 12px 28px rgba(10,18,64,.07);
  --sombra-3: 0 30px 70px rgba(6,11,40,.28);

  --sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "DM Mono", ui-monospace, Consolas, monospace;

  --r-chico: 8px;
  --r: 14px;
  --r-grande: 20px;
  --lectura: 66ch;
}

:root[data-tema="oscuro"] {
  --fondo:       #070B24;
  --superficie:  #0E1436;
  --superficie2: #161D48;
  --linea:       #242C5E;
  --linea-suave: #1B2249;

  --tinta:       #E8EBFC;
  --tinta2:      #A2AAD4;
  --tinta3:      #6F78A6;

  --acento:      #5B7BFF;
  --acento-piso: #141C4A;

  --verde: #4FCB9B;  --verde-piso: #0F2C26;
  --ambar: #E3B25C;  --ambar-piso: #2B2413;
  --rojo:  #FF8F7E;  --rojo-piso:  #331A1C;

  --rail:        linear-gradient(180deg, #05091C 0%, #0B1236 100%);
  --rail-texto:  #A2AAD4;
  --rail-suave:  #6F78A6;

  --sombra-1: 0 1px 2px rgba(0,0,0,.5);
  --sombra-2: 0 2px 6px rgba(0,0,0,.45);
  --sombra-3: 0 30px 70px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }

html { color-scheme: light; height: 100%; }
:root[data-tema="oscuro"] { color-scheme: dark; }

body {
  height: 100%;
  margin: 0;
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.62;
  color: var(--tinta);
  background: var(--fondo);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--acento); }

:focus-visible {
  outline: 2px solid var(--acento);
  outline-offset: 2px;
  border-radius: 4px;
}

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

/* ======================================================== barra lateral */

.armazon { display: flex; height: 100%; overflow: hidden; }

.costado {
  position: relative;
  width: 272px;
  flex-shrink: 0;
  background: var(--rail);
  color: var(--rail-texto);
  display: flex;
  flex-direction: column;
  padding: 22px 14px 14px;
  overflow-y: auto;
}
/* El isotipo, enorme y casi invisible, sosteniendo la columna por detrás. */
.costado::after {
  content: "";
  position: absolute;
  right: -58px;
  bottom: 86px;
  width: 250px;
  height: 185px;
  background: url("isotipo.png") no-repeat center / contain;
  opacity: .07;
  pointer-events: none;
}
.costado > * { position: relative; z-index: 1; }

.marca { display: block; padding: 0 8px 22px; }
.marca img { width: 168px; height: auto; display: block; }

.nueva {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border-radius: var(--r-chico);
  background: linear-gradient(135deg, var(--electrico), #4A6BFF);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 14.5px;
  box-shadow: 0 6px 18px rgba(32,80,240,.32);
  transition: transform .12s, box-shadow .12s;
}
.nueva:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(32,80,240,.42); }
.nueva svg { width: 15px; height: 15px; fill: currentColor; flex-shrink: 0; }

.rotulo {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--rail-suave);
  margin: 26px 10px 8px;
}

.historial { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.historial a {
  position: relative;
  display: block;
  padding: 8px 10px 8px 14px;
  border-radius: var(--r-chico);
  color: var(--rail-texto);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .12s, color .12s;
}
.historial a:hover { background: rgba(255,255,255,.06); color: #fff; }
.historial a.activa { background: rgba(255,255,255,.1); color: #fff; font-weight: 600; }
/* La diagonal del isotipo marca lo que está activo. */
.historial a.activa::before {
  content: "";
  position: absolute;
  left: 3px; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--periwinkle), var(--electrico));
  transform: skewX(-12deg);
}
.historial .vacio { color: var(--rail-suave); font-size: 13.5px; padding: 8px 10px; line-height: 1.45; }

.pie-costado {
  border-top: 1px solid rgba(255,255,255,.1);
  padding-top: 14px;
  margin-top: 14px;
}
.identidad { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px;
  flex-shrink: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--periwinkle), var(--electrico));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: .02em;
}
.quien { color: #fff; font-weight: 600; font-size: 14px; line-height: 1.25; min-width: 0; }
.quien small { display: block; color: var(--rail-suave); font-weight: 500; font-size: 12px; }

.enlaces-pie { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.enlaces-pie a, .enlaces-pie button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--rail-texto);
  background: rgba(255,255,255,.05);
  border: none;
  border-radius: 7px;
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.enlaces-pie a:hover, .enlaces-pie button:hover { background: rgba(255,255,255,.12); color: #fff; }

.insignia {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  background: var(--electrico);
  color: #fff;
  border-radius: 10px;
  padding: 0 6px;
  font-size: 11.5px;
  font-weight: 700;
}

.principal {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
}

/* ================================================================== chat */

.conversacion { flex: 1; min-height: 0; overflow-y: auto; padding: 34px 28px 6px; }
.centro { max-width: 812px; margin: 0 auto; }

/* --- portada: el índice del manual ---------------------------------- */

.portada-chat { padding-top: 2vh; }

.saludo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--acento-piso);
  color: var(--acento);
  border-radius: 100px;
  padding: 6px 15px 6px 9px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 18px;
}
.saludo img { width: 22px; height: 16px; object-fit: contain; }

.portada-chat h1 {
  font-size: 40px;
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
  max-width: 15ch;
}
.portada-chat h1 em {
  font-style: normal;
  background: linear-gradient(100deg, var(--acento), #6E86FF);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.portada-chat .entrada { color: var(--tinta2); max-width: 58ch; margin: 0 0 30px; font-size: 16px; }

.indice { display: grid; gap: 12px; }

.modulo {
  position: relative;
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: var(--r);
  padding: 16px 18px 14px 20px;
  overflow: hidden;
  box-shadow: var(--sombra-1);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.modulo:hover { border-color: var(--tono); box-shadow: var(--sombra-2); transform: translateY(-1px); }
/* Una barra diagonal, del color que le toca al módulo: las cuatro cápsulas
   del isotipo tienen cada una su azul, y aquí se reparten igual. */
.modulo::before {
  content: "";
  position: absolute;
  left: -6px; top: -10%;
  width: 6px; height: 120%;
  background: var(--tono);
  transform: skewX(-12deg);
}
.modulo h2 {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--tono-texto);
  margin: 0 0 9px;
}
.modulo ul { list-style: none; margin: 0; padding: 0; }
.modulo button {
  display: block;
  width: 100%;
  background: none;
  border: none;
  padding: 6px 8px 6px 0;
  font: inherit;
  font-size: 14.8px;
  color: var(--tinta);
  text-align: left;
  cursor: pointer;
  transition: color .12s, padding .12s;
}
.modulo button::after {
  content: "›";
  color: var(--tinta3);
  margin-left: 7px;
  opacity: 0;
  transition: opacity .12s;
}
.modulo button:hover { color: var(--tono-texto); padding-left: 6px; }
.modulo button:hover::after { opacity: 1; }

/* Los cuatro azules de las cápsulas del isotipo, uno por módulo. */
.modulo.m1 { --tono: #2050F0; --tono-texto: #2050F0; }
.modulo.m2 { --tono: #2432A0; --tono-texto: #2432A0; }
.modulo.m3 { --tono: #7080F0; --tono-texto: #4F5DD4; }
.modulo.m4 { --tono: #B0BCF5; --tono-texto: #6B76B6; }
.modulo.m5 { --tono: linear-gradient(180deg, #7080F0, #2050F0); --tono-texto: #3A55D0; }

:root[data-tema="oscuro"] .modulo.m1 { --tono-texto: #7C97FF; }
:root[data-tema="oscuro"] .modulo.m2 { --tono: #3A4BC8; --tono-texto: #8394FF; }
:root[data-tema="oscuro"] .modulo.m3 { --tono-texto: #9AA6FF; }
:root[data-tema="oscuro"] .modulo.m4 { --tono-texto: #AEB8EC; }
:root[data-tema="oscuro"] .modulo.m5 { --tono-texto: #8EA0FF; }

/* --- turnos ---------------------------------------------------------- */

.turno { margin-bottom: 30px; }
.turno.mio { display: flex; justify-content: flex-end; }
.turno.mio .globo {
  background: linear-gradient(135deg, var(--electrico), #4468FF);
  color: #fff;
  border-radius: 16px 16px 4px 16px;
  padding: 12px 17px;
  max-width: 78%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 8px 22px rgba(32,80,240,.22);
  font-size: 15.5px;
}

.firma {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--tinta2);
}
.sello {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: var(--superficie);
  border: 1px solid var(--linea);
  display: grid;
  place-items: center;
  box-shadow: var(--sombra-1);
  flex-shrink: 0;
}
.sello img { width: 19px; height: 14px; object-fit: contain; }

.globo { max-width: min(var(--lectura), 100%); overflow-wrap: anywhere; font-size: 15.8px; }
.globo > :first-child { margin-top: 0; }
.globo > :last-child { margin-bottom: 0; }
.globo p { margin: 0 0 13px; }
.globo h2, .globo h3 {
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 26px 0 9px;
  line-height: 1.3;
}
.globo h2 { font-size: 20px; }
.globo h3 { font-size: 17px; }
.globo ol, .globo ul { padding-left: 22px; margin: 0 0 13px; }
.globo li { margin: 5px 0; }
.globo li::marker { color: var(--acento); font-weight: 700; }
.globo strong { font-weight: 700; }
.globo hr { border: none; border-top: 1px solid var(--linea); margin: 22px 0; }

.globo code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--superficie2);
  padding: 2px 6px;
  border-radius: 5px;
}
.globo pre {
  max-width: 100%;
  background: var(--superficie2);
  border: 1px solid var(--linea);
  padding: 14px 16px;
  border-radius: var(--r);
  overflow-x: auto;
  font-size: 13px;
}
.globo pre code { background: none; padding: 0; }

.desborde { max-width: 100%; overflow-x: auto; margin: 16px 0; }
.desborde table { margin: 0; min-width: 460px; }

.globo table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  margin: 16px 0;
  font-size: 14.8px;
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: var(--r);
  overflow: hidden;
}
.globo th, .globo td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--linea-suave); }
.globo th {
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--tinta2);
  background: var(--superficie2);
}
.globo tr:last-child td { border-bottom: none; }

.globo blockquote {
  position: relative;
  margin: 16px 0;
  padding: 13px 16px 13px 46px;
  background: var(--ambar-piso);
  border-radius: var(--r);
  color: var(--tinta);
  font-size: 15px;
}
.globo blockquote::before {
  content: "!";
  position: absolute;
  left: 15px; top: 15px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--ambar);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
}
.globo blockquote p:last-child { margin-bottom: 0; }

/* --- la ruta de menú: la pieza principal ----------------------------- */

.ruta {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: 10px;
  padding: 5px 12px 5px 11px;
  margin: 3px 0;
  box-shadow: var(--sombra-1);
  font-size: 14.5px;
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s;
}
.ruta:hover { border-color: var(--acento); box-shadow: var(--sombra-2); }
.ruta .nivel { font-weight: 600; color: var(--tinta2); }
.ruta .nivel:nth-last-of-type(2) { color: var(--acento); font-weight: 700; }
/* El separador es la diagonal del isotipo, no una flecha cualquiera. */
.ruta .barra {
  width: 2px;
  height: 13px;
  margin: 0 9px;
  border-radius: 2px;
  background: var(--lavanda);
  transform: skewX(-18deg);
}
.ruta .copiar {
  margin-left: 10px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--tinta3);
}
.ruta:hover .copiar { color: var(--acento); }
.ruta.copiada { border-color: var(--verde); }
.ruta.copiada .copiar { color: var(--verde); }

/* --- el paso en curso ------------------------------------------------ */

.paso {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: 100px;
  padding: 6px 15px 6px 12px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--tinta2);
  margin-bottom: 10px;
  box-shadow: var(--sombra-1);
}
.pulso {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--acento);
  flex-shrink: 0;
  animation: latido 1.3s ease-in-out infinite;
}
@keyframes latido {
  0%, 100% { opacity: .3; transform: scale(.85); }
  50%      { opacity: 1;  transform: scale(1.1); }
}

.escribiendo::after {
  content: "";
  display: inline-block;
  width: 9px; height: 17px;
  border-radius: 2px;
  background: var(--acento);
  margin-left: 3px;
  vertical-align: text-bottom;
  animation: latido 1s steps(2) infinite;
}

/* --- acciones --------------------------------------------------------- */

.acciones {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--linea-suave);
  max-width: min(var(--lectura), 100%);
}
.acciones button {
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: 100px;
  padding: 5px 13px;
  cursor: pointer;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--tinta2);
  transition: border-color .12s, color .12s, background .12s;
}
.acciones button:hover { border-color: var(--acento); color: var(--acento); }
.acciones button.marcado { background: var(--acento); border-color: var(--acento); color: #fff; }
.acciones .nota { font-size: 13.5px; color: var(--tinta2); margin-left: 4px; }

.aviso-error {
  background: var(--rojo-piso);
  border: 1px solid var(--rojo);
  color: var(--rojo);
  border-radius: var(--r);
  padding: 11px 15px;
  margin-top: 10px;
  max-width: min(var(--lectura), 100%);
  font-size: 14.5px;
}

/* --- redacción -------------------------------------------------------- */

.redaccion { border-top: 1px solid var(--linea); background: var(--fondo); padding: 16px 28px 18px; }
.caja {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: var(--r);
  padding: 8px 8px 8px 16px;
  box-shadow: var(--sombra-2);
  transition: border-color .15s, box-shadow .15s;
}
.caja:focus-within { border-color: var(--acento); box-shadow: 0 0 0 4px var(--acento-piso), var(--sombra-2); }
.caja textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  font: inherit;
  font-size: 15.5px;
  background: none;
  max-height: 190px;
  padding: 8px 0;
  color: var(--tinta);
}
.caja textarea::placeholder { color: var(--tinta3); }
.enviar {
  background: linear-gradient(135deg, var(--electrico), #4A6BFF);
  color: #fff;
  border: none;
  border-radius: 10px;
  width: 38px; height: 38px;
  cursor: pointer;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 16px rgba(32,80,240,.32);
  transition: transform .12s, box-shadow .12s;
}
.enviar:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(32,80,240,.42); }
.enviar:disabled { opacity: .45; box-shadow: none; cursor: default; }
.enviar svg { width: 17px; height: 17px; fill: currentColor; }

.pie-nota { font-size: 12.5px; color: var(--tinta3); text-align: center; margin: 10px 0 0; }

/* ================================================= entrada / instalación */

.puerta {
  min-height: 100%;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  background: var(--fondo);
}

.puerta-marca {
  position: relative;
  background: var(--rail);
  color: #fff;
  padding: 48px 56px 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
/* El isotipo gigante, saliéndose por el borde: es la marca, no un adorno. */
.puerta-marca::before {
  content: "";
  position: absolute;
  right: -180px; bottom: -150px;
  width: 700px; height: 518px;
  background: url("isotipo.png") no-repeat center / contain;
  opacity: .17;
  pointer-events: none;
}
/* Un resplandor eléctrico detrás, para que el navy no quede plano. */
.puerta-marca::after {
  content: "";
  position: absolute;
  left: -150px; top: -170px;
  width: 580px; height: 580px;
  background: radial-gradient(circle, rgba(32,80,240,.45), transparent 68%);
  pointer-events: none;
}
.puerta-marca > * { position: relative; z-index: 1; }
.puerta-marca img.logotipo { width: 212px; height: auto; align-self: flex-start; }

.puerta-marca h1 {
  font-size: 46px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.035em;
  margin: 0 0 16px;
  max-width: 14ch;
}
.puerta-marca h1 em {
  font-style: normal;
  background: linear-gradient(100deg, #A7B6FF, #6E86FF);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.puerta-marca .lema { color: #AEB8E8; max-width: 42ch; margin: 0; font-size: 16.5px; }

.puntos { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 26px 0 0; padding: 0; list-style: none; }
.puntos li {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #C4CCEE;
  font-size: 14.5px;
  font-weight: 500;
}
.puntos li::before {
  content: "";
  width: 4px; height: 15px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--periwinkle), var(--electrico));
  transform: skewX(-16deg);
  flex-shrink: 0;
}

.pie-marca { font-size: 13.5px; color: var(--rail-suave); }

.puerta-forma { display: grid; place-items: center; padding: 40px 32px; }
.forma {
  width: 100%;
  max-width: 392px;
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: var(--r-grande);
  padding: 34px 34px 30px;
  box-shadow: var(--sombra-2);
}
.forma-iso { width: 46px; height: 34px; object-fit: contain; margin-bottom: 18px; }
.forma h2 { font-size: 27px; font-weight: 800; letter-spacing: -0.025em; margin: 0 0 5px; }
.forma .sub { color: var(--tinta2); margin: 0 0 26px; font-size: 15px; }

/* ================================================================ formas */

label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; color: var(--tinta2); }

input[type=text], input[type=password], select, textarea.campo {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--linea);
  border-radius: var(--r-chico);
  font: inherit;
  font-size: 15px;
  background: var(--superficie);
  color: var(--tinta);
  margin-bottom: 16px;
  transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: var(--tinta3); }
input[type=text]:focus, input[type=password]:focus, select:focus, textarea.campo:focus {
  outline: none;
  border-color: var(--acento);
  box-shadow: 0 0 0 4px var(--acento-piso);
}

.boton {
  display: inline-block;
  text-align: center;
  text-decoration: none;
  background: linear-gradient(135deg, var(--electrico), #4A6BFF);
  color: #fff;
  border: none;
  border-radius: var(--r-chico);
  padding: 11px 20px;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(32,80,240,.28);
  transition: transform .12s, box-shadow .12s;
}
.boton:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(32,80,240,.38); }
.boton.ancho { width: 100%; }
.boton.segundo {
  background: var(--superficie);
  color: var(--tinta);
  border: 1px solid var(--linea);
  box-shadow: var(--sombra-1);
  font-weight: 600;
}
.boton.segundo:hover { border-color: var(--acento); color: var(--acento); }
.boton.riesgo {
  background: var(--superficie);
  color: var(--rojo);
  border: 1px solid var(--linea);
  box-shadow: none;
  font-weight: 600;
}
.boton.riesgo:hover { border-color: var(--rojo); background: var(--rojo-piso); }
.boton.chico { padding: 6px 13px; font-size: 13.5px; border-radius: 7px; box-shadow: none; }

.nota-forma { font-size: 13.5px; color: var(--tinta3); margin: 16px 0 0; text-align: center; }

.aviso { border-radius: var(--r-chico); padding: 11px 15px; margin-bottom: 18px; font-size: 14.5px; border: 1px solid; }
.aviso.error { background: var(--rojo-piso); border-color: var(--rojo); color: var(--rojo); }
.aviso.ok { background: var(--verde-piso); border-color: var(--verde); color: var(--verde); }

/* =============================================================== paneles */

.hoja { padding: 34px 36px 60px; max-width: 1100px; width: 100%; }
.cabecera { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 28px; }
.hoja h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; margin: 0; line-height: 1.15; }
.hoja h2 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 38px 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hoja h2::before {
  content: "";
  width: 4px; height: 17px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--periwinkle), var(--electrico));
  transform: skewX(-16deg);
}
.hoja .entrada { color: var(--tinta2); margin: 6px 0 0; max-width: 62ch; }
.acciones-cabecera { display: flex; gap: 8px; flex-shrink: 0; }

.regreso { display: inline-block; color: var(--tinta2); text-decoration: none; font-size: 14px; margin-bottom: 16px; font-weight: 500; }
.regreso:hover { color: var(--acento); }

.cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.cifra {
  position: relative;
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: var(--r);
  padding: 16px 18px;
  overflow: hidden;
  box-shadow: var(--sombra-1);
}
.cifra::before {
  content: "";
  position: absolute;
  left: -5px; top: -10%;
  width: 5px; height: 120%;
  background: var(--lavanda);
  transform: skewX(-12deg);
}
.cifra.ojo::before { background: linear-gradient(180deg, var(--periwinkle), var(--electrico)); }
.cifra.alarma::before { background: var(--rojo); }
.cifra.alarma b { color: var(--rojo); }
.cifra b { display: block; font-size: 31px; font-weight: 800; line-height: 1.1; letter-spacing: -0.03em; }
.cifra.ojo b { color: var(--acento); }
.cifra span { font-size: 13px; color: var(--tinta2); font-weight: 500; }

table.datos {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--sombra-1);
}
table.datos th, table.datos td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--linea-suave); font-size: 14.5px; }
table.datos th {
  background: var(--superficie2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--tinta2);
}
table.datos tr:last-child td { border-bottom: none; }
table.datos tr.apagado td { color: var(--tinta3); }
table.datos code { font-family: var(--mono); font-size: 13px; color: var(--tinta2); }
.persona { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.persona .avatar { width: 30px; height: 30px; border-radius: 9px; font-size: 12px; }

.tarjeta {
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: var(--r);
  padding: 22px 24px;
  margin-bottom: 14px;
  box-shadow: var(--sombra-1);
}
.tarjeta .meta { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--tinta2); margin-bottom: 10px; font-weight: 500; }
.tarjeta .consulta { font-size: 18px; font-weight: 700; line-height: 1.35; letter-spacing: -0.02em; margin-bottom: 12px; }
.tarjeta .falto { font-size: 14.5px; margin: 0 0 14px; color: var(--tinta2); }
.tarjeta .falto b { color: var(--tinta); }

.desplegable summary { cursor: pointer; font-size: 13.5px; color: var(--tinta2); margin-bottom: 10px; font-weight: 500; }
.desplegable summary:hover { color: var(--acento); }
.dijo {
  background: var(--superficie2);
  padding: 13px 16px;
  border-radius: var(--r-chico);
  font-size: 14px;
  color: var(--tinta2);
  max-height: 210px;
  overflow-y: auto;
  white-space: pre-wrap;
  margin-bottom: 14px;
}

.rejilla-forma { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 0 14px; }
.editor { width: 100%; min-height: 62vh; font-family: var(--mono); font-size: 13.5px; line-height: 1.7; }
.vacio-panel {
  background: var(--superficie);
  border: 1px dashed var(--linea);
  border-radius: var(--r);
  padding: 38px;
  text-align: center;
  color: var(--tinta2);
}
.vacio-panel img { width: 54px; height: 40px; object-fit: contain; opacity: .45; display: block; margin: 0 auto 12px; }

/* ================================================================ móvil */

@media (max-width: 940px) {
  .puerta { grid-template-columns: 1fr; }
  .puerta-marca { padding: 26px 24px 30px; gap: 24px; }
  .puerta-marca h1 { font-size: 32px; }
  .puerta-marca::before { right: -230px; bottom: -190px; }
  .pie-marca { display: none; }
  .puntos { margin-top: 18px; }
}

@media (max-width: 760px) {
  .armazon { flex-direction: column; height: 100%; }
  .costado {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 12px;
    padding: 10px 16px;
    overflow: visible;
  }
  .costado::after { display: none; }
  .marca { padding: 0; }
  .marca img { width: 118px; }
  .rotulo, .historial, .identidad { display: none; }
  .pie-costado { border: none; margin: 0; padding: 0; }
  .enlaces-pie { margin: 0; }
  .nueva { padding: 8px 12px; font-size: 13.5px; }
  .conversacion, .redaccion, .hoja { padding-left: 16px; padding-right: 16px; }
  .portada-chat h1 { font-size: 29px; }
  .turno.mio .globo { max-width: 88%; }
  .cabecera { flex-direction: column; align-items: flex-start; }
}

/* ============================================================== diálogos */

.dialogo {
  width: min(440px, calc(100vw - 32px));
  padding: 26px 28px 22px;
  border: 1px solid var(--linea);
  border-radius: var(--r-grande);
  background: var(--superficie);
  color: var(--tinta);
  box-shadow: var(--sombra-3);
  font-family: var(--sans);
}
.dialogo::backdrop {
  background: rgba(7, 11, 36, .62);
  backdrop-filter: blur(3px);
}
.dialogo h2 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  padding-left: 14px;
  position: relative;
}
/* La diagonal de la marca, también aquí. */
.dialogo h2::before {
  content: "";
  position: absolute;
  left: 0; top: 4px;
  width: 4px; height: 18px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--periwinkle), var(--electrico));
  transform: skewX(-16deg);
}
.dialogo.peligro h2::before { background: var(--rojo); }
.dialogo p { margin: 0 0 10px; color: var(--tinta2); font-size: 15px; line-height: 1.55; }
.dialogo p.detalle {
  background: var(--superficie2);
  border-radius: var(--r-chico);
  padding: 10px 13px;
  font-size: 14px;
  margin-bottom: 16px;
}
.dialogo label { margin-top: 14px; }
.dialogo .campo { margin-bottom: 4px; }
.dialogo.falta .campo { border-color: var(--rojo); box-shadow: 0 0 0 3px var(--rojo-piso); }
.dialogo .botones {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 20px;
}
.dialogo .botones .boton { padding: 9px 18px; font-size: 14.5px; }
/* El anillo de foco, del color del botón que rodea. */
.boton.riesgo:focus-visible { outline-color: var(--rojo); }
.boton.segundo:focus-visible { outline-color: var(--tinta2); }

@media (max-width: 460px) {
  .dialogo .botones { flex-direction: column-reverse; }
  .dialogo .botones .boton { width: 100%; }
}

/* ---------------------------------------------- pantallas dibujadas del MIG */

.pantalla {
  margin: 18px 0;
  max-width: 100%;
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--sombra-1);
}
.pantalla a { display: block; line-height: 0; }
.pantalla img { width: auto; max-width: 100%; height: auto; display: block; margin: 0 auto; }
.pantalla figcaption {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--tinta2);
  padding: 9px 13px;
  background: var(--superficie2);
  border-top: 1px solid var(--linea-suave);
}
