:root {
  --bg: #f4f5f7; --panel: #ffffff; --text: #1f2933; --muted: #6b7480; --line: #dfe3e8;
  --accent: #1d5fa8; --accent-text: #ffffff; --ok: #1a7f45; --ok-bg: #e3f4ea;
  --err: #b42318; --err-bg: #fdecea; --off: #6b7480; --off-bg: #eceef1;
  --warn: #9a5b00; --warn-bg: #fff3dc;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181c; --panel: #1e2227; --text: #e6e9ed; --muted: #9aa3ad; --line: #30363d;
    --accent: #4d94e0; --accent-text: #0b1520; --ok: #5fd08f; --ok-bg: #173826;
    --err: #ff8a80; --err-bg: #3d1a17; --off: #9aa3ad; --off-bg: #2a2f35;
    --warn: #f5c26b; --warn-bg: #3a2e14;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--text); text-decoration: none; letter-spacing: .02em; }
nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; flex: 1; }
nav form { margin-left: auto; }
a { color: var(--accent); }
nav a { text-decoration: none; }
/* Árbol de navegación del portal: secciones y opciones según permisos. */
.portal-header { gap: 10px 16px; }
.portal-nav { gap: 4px; min-width: 0; align-items: flex-start; }
.nav-branch { position: relative; margin: 0; }
.nav-branch > summary { display: flex; align-items: center; gap: 7px; padding: 9px 11px;
  border-radius: 7px; list-style: none; cursor: pointer; font-size: .92em; font-weight: 600; }
.nav-branch > summary::-webkit-details-marker { display: none; }
.nav-branch > summary::after { content: ''; width: 6px; height: 6px; border: solid currentColor;
  border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); margin: -3px 0 0 3px; }
.nav-branch[open] > summary::after { transform: rotate(225deg); margin-top: 3px; }
.nav-branch > summary:hover, .nav-branch[open] > summary, .nav-branch[data-current] > summary {
  background: color-mix(in srgb, var(--accent) 10%, var(--panel)); color: var(--accent); }
.nav-branch > summary:focus-visible, .nav-children a:focus-visible, .portal-tools a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-children { position: absolute; z-index: 30; top: 100%; left: 0; min-width: 235px;
  margin: 5px 0 0; padding: 9px 10px 9px 24px; list-style: none; border: 1px solid var(--line);
  border-radius: 9px; background: var(--panel); box-shadow: 0 12px 30px #0002; }
.nav-children li { position: relative; padding: 2px 0 2px 7px; border-left: 1px solid var(--line); }
.nav-children li::before { content: ''; position: absolute; left: 0; top: 21px; width: 7px;
  border-top: 1px solid var(--line); }
.nav-children a { display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-radius: 5px; color: var(--text); font-size: .92em; }
.nav-children a:hover, .nav-children a[aria-current] { background: var(--bg); color: var(--accent); }
.portal-tools { display: flex; align-items: center; gap: 12px; margin-left: auto; min-width: 0; }
.portal-account { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-decoration: none; font-size: .9em; }
.portal-logout, .language-picker { margin: 0; }
.portal-logout button { padding: 7px 0; font-size: .9em; white-space: nowrap; }
.language-picker label { display: flex; align-items: center; gap: 7px; margin: 0; font-size: .8em; }
.language-picker select { width: auto; min-width: 105px; max-width: 145px; margin: 0; padding: 7px 9px;
  border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--text); }
.language-picker noscript button { margin-top: 5px; }
@media (max-width: 1150px) {
  .portal-header > .brand { flex: 1; }
  .portal-nav { order: 3; flex-basis: 100%; }
}
@media (max-width: 700px) {
  header.portal-header { display: flex; }
  .portal-header > .brand { flex: 0 0 auto; }
  .portal-tools { gap: 9px; flex-wrap: wrap; justify-content: flex-end; flex: 1 1 200px; }
  .portal-account { max-width: 95px; }
  .language-picker label > span { display: none; }
  .portal-nav { margin-top: 2px; gap: 3px 7px; }
  .nav-branch { flex: 1 1 130px; }
  .nav-branch > summary { justify-content: space-between; padding: 9px 10px; }
  .nav-children { position: static; min-width: 0; margin: 3px 0 7px; padding-left: 15px;
    box-shadow: none; }
}
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.5rem; margin: .4em 0 .6em; }
h2 { font-size: 1.1rem; margin: 0 0 .7em; }
h3 { font-size: 1rem; margin: 1em 0 .4em; }
.muted { color: var(--muted); font-size: .9em; }
.small { font-size: .9em; }
.right { text-align: right; }
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 20px; }
table { width: 100%; border-collapse: collapse; }
table.list th, table.list td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.list th { font-size: .8em; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--bg); white-space: nowrap; }
table.list tbody tr:last-child td { border-bottom: 0; }
table.list tbody tr:hover td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
td.nowrap { white-space: nowrap; }
table.list .num { text-align: right; font-variant-numeric: tabular-nums; }
table.list td.actions-cell { text-align: right; white-space: normal; min-width: 12em; }
table.list td.actions-cell > * { display: inline-block; margin: 2px 0 2px 6px; white-space: nowrap; vertical-align: middle; }
.fw { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85em; }
footer { max-width: 1100px; margin: 0 auto; padding: 8px 16px 24px; color: var(--muted); font-size: .8em; text-align: right; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 20px; }
.card.narrow { max-width: 520px; }
.card.danger { border-color: var(--err); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
label { display: block; margin-bottom: 12px; font-size: .92em; }
label input, label select, label textarea { display: block; width: 100%; margin-top: 4px; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
label.check { display: flex; gap: 8px; align-items: center; }
label.check input { width: auto; margin: 0; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 16px; margin-bottom: 12px; }
button { padding: 7px 14px; border: 0; border-radius: 6px; background: var(--accent); color: var(--accent-text); cursor: pointer; font-weight: 600; }
button:hover { filter: brightness(1.08); }
button.danger { background: var(--err); color: #fff; }
button.link { background: none; color: var(--accent); padding: 0; font-weight: normal; }
form.inline { display: inline; }
form.row { display: flex; gap: 8px; flex-wrap: wrap; }
form.row input { flex: 1; min-width: 180px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: .82em; font-weight: 600; white-space: nowrap; }
.badge.on { color: var(--ok); background: var(--ok-bg); }
.badge.down { color: var(--warn); background: var(--warn-bg); }
.badge.off { color: var(--off); background: var(--off-bg); }
button.badge { border: 0; cursor: pointer; font: inherit; font-size: .82em; font-weight: 600; line-height: 1.5; }
.badge.alarm { color: #fff; background: var(--err); }
button.badge.alarm:hover { filter: brightness(1.1); }
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.flash.ok { color: var(--ok); background: var(--ok-bg); }
.flash.err { color: var(--err); background: var(--err-bg); }
.text-err { color: var(--err); }
dl.grid { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.grid dt { color: var(--muted); }
dl.grid dd { margin: 0; overflow-wrap: anywhere; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--bg); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
.login { max-width: 380px; margin: 8vh auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 24px; }
.login button { width: 100%; margin-top: 6px; }
@media (max-width: 700px) {
  .hide-sm { display: none; }
  table.list th, table.list td { padding: 9px 10px; }
  dl.grid { grid-template-columns: 1fr; gap: 0; }
  dl.grid dd { margin-bottom: 8px; }
}
a.button { display: inline-block; padding: 7px 14px; border-radius: 6px; background: var(--accent); color: var(--accent-text); font-weight: 600; text-decoration: none; }
a.button:hover { filter: brightness(1.08); }
/* Visor VNC */
.vnc-body { display: flex; flex-direction: column; height: var(--vvh, 100vh); margin: 0; overflow: hidden; }
.vnc-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.vnc-bar a { text-decoration: none; }
#vnc-status { color: var(--muted); font-size: .9em; }
#vnc-status.vnc-error { color: var(--err); font-weight: 600; }
.vnc-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-left: auto; }
.vnc-tools label.check { margin: 0; }
.vnc-auth { display: flex; gap: 8px; align-items: flex-end; padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.vnc-auth label { margin: 0; }
.vnc-screen { flex: 1; min-height: 0; background: #111; }
/* Pantalla completa dentro de la página: Safari del iPhone no permite la del navegador. */
.vnc-max .vnc-bar { display: none; }
/* --vvh y --vvtop: zona visible (sin el teclado del móvil), que calcula vnc.js. */
.vnc-max .vnc-screen { position: fixed; left: 0; right: 0; top: var(--vvtop, 0px); height: var(--vvh, 100dvh); z-index: 10; }
.vnc-float { position: fixed; z-index: 20; display: flex; gap: 8px;
  left: calc(8px + env(safe-area-inset-left)); top: calc(var(--vvtop, 0px) + 8px + env(safe-area-inset-top)); }
.vnc-float[hidden] { display: none; }
.vnc-round { width: 44px; height: 44px; padding: 0; border-radius: 50%; display: grid; place-items: center;
  background: #fff; color: var(--accent); border: 2px solid var(--accent); box-shadow: 0 2px 6px rgba(0,0,0,.35); opacity: .9; }
.vnc-round svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.vnc-round.active { background: var(--accent); color: #fff; outline: none; }
.vnc-exit { color: #b42318; border-color: #b42318; }
/* Campo invisible que abre el teclado del móvil; 16px evita el zoom automático de iOS. */
.vnc-kbd-input { position: fixed; left: 0; bottom: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0;
  font-size: 16px; resize: none; }
.vnc-tools button.active { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Agrupación por empresa e instalación */
h2.group { margin: 28px 0 6px; padding-bottom: 4px; border-bottom: 2px solid var(--line); }
h3.group { margin: 16px 0 8px; font-size: 1rem; }
h3.group .muted { font-weight: normal; }
/* Consumos: varias tablas con las mismas columnas alineadas */
table.list.traffic { table-layout: fixed; }
table.list.traffic td:first-child, table.list.traffic th:first-child { width: 32%; overflow-wrap: anywhere; }
/* Botón secundario, bloques de órdenes y ayuda bajo un campo */
button.secondary { background: var(--bg); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
pre { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .88em; background: var(--bg); padding: 8px 10px; border-radius: 6px; overflow-x: auto; }
details summary { cursor: pointer; margin: 8px 0; }
label > .muted { display: block; font-size: .9em; margin-top: 3px; }
/* Panel de equipos: barra de búsqueda y vista compacta */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 12px 0 8px; }
.toolbar input[type=search] { flex: 1 1 260px; min-width: 0; }
.toolbar select { flex: 0 0 auto; }
.toolbar .views { margin-left: auto; display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.toolbar .views a { padding: 5px 12px; text-decoration: none; color: inherit; }
.toolbar .views a.on { background: var(--accent); color: var(--accent-text); font-weight: 600; }
[hidden] { display: none !important; }
table.list.compact td { padding-top: 4px; padding-bottom: 4px; }
table.list.compact td.ellipsis { max-width: 18em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.list.compact td.actions-cell { white-space: nowrap; }
@media (max-width: 640px) { .toolbar .views { margin-left: 0; } table.list.compact td.ellipsis { max-width: 9em; } }
table.list.compact button, table.list.compact a.button { padding: 3px 10px; font-size: .88em; }
table.list.compact form.inline { margin: 0; }
/* IP de origen y equipos pendientes de validar */
.ip { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9em; }
nav .badge { font-size: .75em; padding: 0 6px; vertical-align: 1px; }
.pending { border-left: 4px solid var(--warn, #d97706); }
.pending td.actions-cell details { display: block; text-align: left; white-space: normal; margin-top: 6px; }
.pending details.accept form { min-width: 16em; max-width: 26em; margin-left: auto; }
/* Diagnósticos */
tr.unseen td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
pre.diag { max-height: 70vh; overflow: auto; white-space: pre-wrap; word-break: break-word; font-size: .82em; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0 0 12px; }
dl.facts dt { color: var(--muted, #666); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
code.token { display: block; padding: 6px 8px; font-size: .9em; user-select: all; overflow-wrap: anywhere; }
/* Biblioteca de la API */
pre.api { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .84em; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.api-endpoint h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 0; }
.api-endpoint h3 code { font-size: 1em; }
ul.api-toc { columns: 2 22em; padding-left: 18px; }
ul.api-toc li { margin: 3px 0; break-inside: avoid; }
/* Móvil: cabecera en dos líneas, formularios en fila sin estirar los botones y tablas
   como fichas (una fila por ficha; app.js pone el nombre de la columna en data-label). */
form.row { align-items: flex-end; }
form.row label { margin: 0; }
@media (max-width: 700px) {
  header { display: block; padding: 10px 16px 8px; }
  nav { margin-top: 6px; gap: 2px 14px; font-size: .95em; }
  nav form { margin-left: 0; }
  form.row label { flex: 1 1 100%; }
  table.list:not(.traffic) thead { display: none; }
  table.list:not(.traffic) tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px;
    padding: 10px 12px; border-bottom: 1px solid var(--line); }
  table.list:not(.traffic) tbody tr:last-child { border-bottom: 0; }
  table.list:not(.traffic) td { display: block; padding: 0; border: 0; min-width: 0; max-width: 100%; }
  table.list:not(.traffic) td.hide-sm { display: none; }
  table.list:not(.traffic) td:empty { display: none; }
  /* Consumos sigue en columnas para comparar cifras; el mes anterior queda en su enlace. */
  table.list.traffic th, table.list.traffic td { padding: 8px 5px; font-size: .88em; }
  table.list.traffic th { white-space: normal; font-size: .7em; letter-spacing: 0; text-transform: none; }
  table.list.traffic td:nth-child(5), table.list.traffic th:nth-child(5) { display: none; }
  table.list.traffic td:first-child, table.list.traffic th:first-child { width: 36%; padding-left: 10px; }
  table.list:not(.traffic) td:first-child { flex: 1 1 100%; }
  table.list:not(.traffic) td:not(:first-child):not(.actions-cell)[data-label]::before {
    content: attr(data-label) ": "; color: var(--muted); font-size: .85em; }
  table.list:not(.traffic) td.num { text-align: left; }
  table.list:not(.traffic) td.actions-cell { flex: 1 1 100%; text-align: left; min-width: 0; white-space: normal; }
  table.list:not(.traffic) td.actions-cell > * { margin: 2px 6px 2px 0; }
  table.list.compact td.ellipsis { max-width: 100%; white-space: normal; }
  table.list tbody tr:hover td { background: none; }
  .pending details.accept form { margin-left: 0; }
}
/* Login cuántico OSAKA */
@keyframes mxrsys-pulse-core {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 12px rgba(56, 189, 248, .75)); }
  50% { transform: scale(1.07); filter: drop-shadow(0 0 24px rgba(125, 211, 252, 1)); }
}
@keyframes mxrsys-dash-pulse { to { stroke-dashoffset: -36; } }
@keyframes mxrsys-orbit-cw { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes mxrsys-ping { 75%, 100% { transform: scale(2.1); opacity: 0; } }
.login-svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
body.login-quantum-body {
  min-height: 100vh; margin: 0; display: flex; flex-direction: column;
  background: #040914; color: #f1f5f9;
}
.login-quantum-main {
  flex: 1; display: flex; align-items: center; justify-content: center;
  max-width: none; width: 100%; margin: 0; padding: 24px;
}
.login-quantum-card {
  width: min(1000px, 100%); min-height: 590px; border-radius: 24px; overflow: hidden;
  display: grid; grid-template-columns: 7fr 5fr;
  background: #081121; border: 1px solid rgba(14, 165, 233, .3);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .75);
}
.login-visual-quantum {
  position: relative; padding: 30px; color: #fff;
  display: flex; flex-direction: column; justify-content: space-between; overflow: hidden;
  border-right: 1px solid rgba(14, 165, 233, .2);
  background:
    radial-gradient(circle at 50% 52%, rgba(0, 163, 224, .22) 0%, rgba(8, 47, 89, .38) 42%, rgba(4, 12, 26, .98) 100%),
    #050d1a;
}
.login-visual-top {
  display: flex; align-items: center; justify-content: flex-start; gap: 12px;
}
.login-brand-pill {
  padding: 10px 16px; border-radius: 12px; background: rgba(9, 24, 46, .9);
  border: 1px solid rgba(56, 189, 248, .3); display: flex; align-items: center; gap: 12px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .35);
}
.login-brand-mark { width: 32px; height: 32px; fill: #38bdf8; flex-shrink: 0; }
.login-brand-title { font-size: 1rem; font-weight: 900; letter-spacing: .07em; line-height: 1.1; color: #fff; }
.login-brand-accent { color: #38bdf8; }
.login-brand-sub { display: block; font-size: .75rem; color: rgba(186, 230, 253, .78); margin-top: 2px; }
.login-status-bar {
  display: flex; align-items: center; justify-content: center;
  min-height: 36px; height: 36px; margin: 6px 0 10px;
}
.login-status-pill {
  padding: 6px 14px; border-radius: 999px; background: rgba(8, 47, 73, .7);
  border: 1px solid rgba(56, 189, 248, .3); display: inline-flex; align-items: center; gap: 8px;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .75rem; color: #bae6fd;
  max-width: 100%; box-sizing: border-box; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.login-status-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #34d399; position: relative; flex-shrink: 0;
}
.login-status-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: #34d399; animation: mxrsys-ping 1.6s cubic-bezier(0, 0, .2, 1) infinite;
}
.login-osaka-stage { display: flex; align-items: center; justify-content: center; margin: 4px 0 2px; }
.login-osaka-svg { width: 100%; max-width: 430px; aspect-ratio: 1; overflow: visible; }
.login-beam-flow { stroke-dasharray: 6 6; animation: mxrsys-dash-pulse 1.1s linear infinite; }
.login-orbit-cw { transform-origin: 250px 250px; animation: mxrsys-orbit-cw 36s linear infinite; }
.login-core-pulse { transform-origin: 250px 250px; animation: mxrsys-pulse-core 3.2s ease-in-out infinite; }
.login-petal-group { cursor: pointer; }
.login-petal-shape {
  transition: filter .28s ease;
  filter: drop-shadow(0 10px 24px rgba(0, 163, 224, .28));
}
.login-petal-group:hover .login-petal-shape {
  filter: brightness(1.16) drop-shadow(0 0 26px rgba(56, 189, 248, .75));
}
.login-visual-bottom {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  border-top: 1px solid rgba(56, 189, 248, .2); padding-top: 14px;
}
.login-visual-bottom h2 { margin: 0; font-size: 1.35rem; font-weight: 700; color: #fff; line-height: 1.25; }
.login-visual-bottom p { margin: 4px 0 0; font-size: .78rem; color: rgba(186, 230, 253, .82); }
.login-visual-tag {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .75rem;
  color: rgba(125, 211, 252, .9); white-space: nowrap;
}
.login-form-quantum.login {
  max-width: none; margin: 0; border: 0; border-radius: 0;
  padding: 40px 38px; background: #081121; color: #fff;
  display: flex; flex-direction: column; justify-content: center;
}
.login-form-top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px;
}
.login-access-badge {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px;
  border-radius: 6px; background: rgba(14, 165, 233, .14);
  border: 1px solid rgba(56, 189, 248, .26); color: #7dd3fc;
  font-size: .75rem; font-weight: 600; letter-spacing: .04em;
}
.login-access-badge svg { width: 15px; height: 15px; fill: currentColor; }
.login-lang-switch { display: inline-flex; gap: 4px; }
.login-lang-switch .language-picker label { color: #aabbd1; }
.login-lang-switch .language-picker select { background: #101f36; border-color: #426080; color: #f2f6fc; }
.login-lang-link {
  padding: 3px 7px; border-radius: 5px; font-size: .74rem; font-weight: 600;
  color: #94a3b8; text-decoration: none; border: 1px solid transparent;
}
.login-lang-link:hover { color: #e2e8f0; }
.login-lang-link.active {
  color: #38bdf8; background: rgba(14, 165, 233, .15); border-color: rgba(56, 189, 248, .3);
}
.login-form-quantum h1 { margin: 0; font-size: 1.65rem; font-weight: 700; color: #fff; }
.login-subtitle { margin: 6px 0 24px; font-size: .88rem; color: #94a3b8; }
.login-field {
  display: block; margin-bottom: 18px; font-size: .8rem; font-weight: 600; color: #cbd5e1;
}
.login-field input {
  margin-top: 6px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid rgba(14, 165, 233, .3); background: #050c18; color: #fff; font-size: .92rem;
}
.login-field input:focus {
  outline: none; border-color: #38bdf8; box-shadow: 0 0 0 3px rgba(14, 165, 233, .22);
}
.login-pass-wrap { display: flex; gap: 8px; align-items: stretch; margin-top: 6px; }
.login-pass-wrap input { margin-top: 0; flex: 1; min-width: 0; }
.login-pass-toggle {
  width: auto !important; margin-top: 0 !important; padding: 0 14px;
  border-radius: 12px; border: 1px solid rgba(14, 165, 233, .3);
  background: #0f172a; color: #7dd3fc; font-size: .78rem; font-weight: 600;
}
.login-pass-toggle:hover { background: #1e293b; filter: none; }
.login-submit-btn {
  width: 100%; margin-top: 8px !important; padding: 12px 18px; border-radius: 12px;
  background: linear-gradient(90deg, #0095da, #0284c7); color: #fff;
  font-size: .95rem; font-weight: 700; box-shadow: 0 10px 25px rgba(2, 132, 199, .32);
}
.login-form-footer {
  margin-top: 28px; padding-top: 18px; border-top: 1px solid rgba(30, 41, 59, .9);
}
.login-pillars {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: .76rem; color: #94a3b8;
}
.login-pillars span { display: inline-flex; align-items: center; gap: 7px; }
.login-pillars i {
  width: 7px; height: 7px; border-radius: 50%; background: #38bdf8; display: inline-block; flex-shrink: 0;
}
.login-version { margin: 14px 0 0; text-align: center; font-size: .75rem; color: #64748b; }
@media (max-width: 860px) {
  .login-quantum-card { grid-template-columns: 1fr; }
  .login-visual-quantum { border-right: 0; border-bottom: 1px solid rgba(14, 165, 233, .2); padding: 22px; }
  .login-osaka-svg { max-width: 320px; }
  .login-form-quantum.login { padding: 28px 22px; }
}

/* Barra de visualización de usuario (impersonación) */
.impersonation-bar {
  background: linear-gradient(90deg, #b45309, #d97706);
  color: #ffffff;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: .88rem;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
  position: sticky;
  top: 0;
  z-index: 1000;
}
.impersonation-bar strong { font-weight: 700; text-decoration: underline; }
.impersonation-content { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.impersonation-icon { display: inline-flex; align-items: center; font-size: 1.1rem; line-height: 1; }
.impersonation-bar .btn-revert {
  background: #ffffff;
  color: #92400e;
  border: 1px solid rgba(255, 255, 255, .8);
  font-weight: 700;
  font-size: .82rem;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.impersonation-bar .btn-revert:hover {
  background: #fef3c7;
  color: #78350f;
  filter: none;
}
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 7px;
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--line);
  cursor: pointer;
  line-height: 1;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-icon:hover {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-color: var(--accent);
}
.eye-btn svg { display: block; }
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s;
}
.btn-secondary:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-color: var(--accent);
  filter: none;
}

/* One logical audit row per save, with all field changes inside it. */
.audit-trail td{vertical-align:top}.audit-changes{margin:0;padding-left:1.2rem;white-space:normal;overflow-wrap:anywhere}.audit-changes li+li{margin-top:.35rem}.audit-before{color:#934619}.audit-after{color:#17623a}.audit-changes small{color:#52617a}.audit-changes details{margin:.35rem 0}.audit-trail .table-wrap{overflow-x:auto}

.ntfy-subscription-url{font-family:ui-monospace,monospace;font-size:.9rem}.ntfy-connection{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:8px 14px;margin:16px 0}.ntfy-connection dt{font-weight:600}.ntfy-connection dd{margin:0;overflow-wrap:anywhere}.ntfy-subscription .button{max-width:100%;white-space:normal}@media(max-width:520px){.ntfy-connection{grid-template-columns:minmax(0,1fr);gap:5px}.ntfy-connection dd{margin-bottom:10px}}
