/* NOLO Admin: panel del dueño. Sin recursos externos. */
:root {
  color-scheme: light dark;
  --fondo: #f6f6f7;
  --panel: #ffffff;
  --panel2: #f1f1f3;
  --hover: #ececef;
  --borde: #e3e3e7;
  --borde2: #cfcfd6;
  --tx: #17171a;
  --tx2: #4f4f58;
  --tx3: #6b6b76;
  --acento: #2559d6;
  --acento-tx: #ffffff;
  --acento-suave: #e9efff;
  --acento-link: #1d4ed8;
  --ok: #167a3a;
  --ok-fondo: #dcf5e4;
  --aviso: #9a5a00;
  --aviso-fondo: #fdf0d2;
  --mal: #b42318;
  --mal-fondo: #fde4e1;
  --graf: #9db8f2;
  --graf-fuerte: #2559d6;
  --graf-rejilla: #e3e3e7;
  --sombra: 0 1px 2px rgba(0, 0, 0, .05);
  --sombra-grande: 0 12px 40px rgba(0, 0, 0, .22);
  --radio: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --lateral: 236px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #0b0b0d;
    --panel: #131316;
    --panel2: #1a1a1f;
    --hover: #222228;
    --borde: #26262c;
    --borde2: #383841;
    --tx: #f3f3f5;
    --tx2: #b4b4be;
    --tx3: #8d8d99;
    --acento: #3b6df0;
    --acento-tx: #ffffff;
    --acento-suave: #1a2342;
    --acento-link: #7ea2ff;
    --ok: #4ade80;
    --ok-fondo: #12301d;
    --aviso: #fbbf24;
    --aviso-fondo: #33260a;
    --mal: #ff7b72;
    --mal-fondo: #3a1613;
    --graf: #34447a;
    --graf-fuerte: #6f93ff;
    --graf-rejilla: #26262c;
    --sombra: none;
    --sombra-grande: 0 12px 40px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--tx);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--acento-link); }
code, pre, .mono { font-family: var(--mono); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; border-radius: 4px; }
@media (prefers-color-scheme: dark) { :focus-visible { outline-color: var(--graf-fuerte); } }
.solo-lectores { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Iconos ───────────────────────────────────────────── */
.ic { display: inline-flex; width: 18px; height: 18px; flex: none; }
.ic svg { width: 100%; height: 100%; }

/* ── Entrada ──────────────────────────────────────────── */
.inicio { min-height: 100vh; display: grid; place-items: center; color: var(--tx3); }
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-caja {
  width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--borde);
  border-radius: 14px; padding: 28px 24px; box-shadow: var(--sombra);
}
.marca { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 16px; letter-spacing: -.01em; }
.marca-o {
  width: 26px; height: 26px; border-radius: 8px; background: var(--tx); display: grid; place-items: center; flex: none;
}
.marca-o::after { content: ""; width: 10px; height: 10px; border-radius: 50%; border: 2.5px solid var(--panel); }
.marca small { font-weight: 500; color: var(--tx3); font-size: 12px; margin-left: 2px; }
.login h1 { font-size: 20px; margin: 22px 0 4px; letter-spacing: -.01em; }
.login-sub { color: var(--tx2); margin-bottom: 18px; }
.login-pista { margin-top: 18px; color: var(--tx3); font-size: 13px; padding-top: 14px; border-top: 1px solid var(--borde); }

/* ── Estructura ───────────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--lateral) minmax(0, 1fr); min-height: 100vh; }
.lateral {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--panel); border-right: 1px solid var(--borde); padding: 16px 12px; overflow-y: auto;
}
.lateral .marca { padding: 4px 8px 16px; }
.menu { display: flex; flex-direction: column; gap: 2px; }
.menu a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--tx2);
  text-decoration: none; font-weight: 500; min-height: 36px;
}
.menu a:hover { background: var(--hover); color: var(--tx); }
.menu a[aria-current="page"] { background: var(--acento-suave); color: var(--acento-link); }
.menu .distintivo {
  margin-left: auto; background: var(--acento); color: var(--acento-tx); border-radius: 99px; padding: 0 7px;
  font-size: 11px; line-height: 18px; font-weight: 600;
}
.pie { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--borde); display: flex; flex-direction: column; gap: 6px; }
.pie-yo { padding: 0 8px 4px; color: var(--tx3); font-size: 12px; overflow-wrap: anywhere; }
.pie-yo b { display: block; color: var(--tx2); font-family: var(--mono); font-weight: 500; font-size: 12px; }
.pie .btn { justify-content: flex-start; width: 100%; }

.principal { min-width: 0; padding: 24px 32px 64px; }
.contenido { max-width: 1320px; margin: 0 auto; }
.cabecera { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.cabecera-txt { flex: 1; min-width: 0; }
.cabecera h1 { font-size: 22px; letter-spacing: -.015em; line-height: 1.25; }
.cabecera p { color: var(--tx2); margin-top: 2px; }
.barra-movil { display: none; }
.capa-menu { display: none; }

@media (max-width: 759px) {
  .app { display: block; }
  .barra-movil {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; height: 52px;
    padding: 0 12px 0 8px; background: var(--panel); border-bottom: 1px solid var(--borde);
  }
  .barra-movil .marca { flex: 1; }
  .lateral {
    position: fixed; z-index: 50; top: 0; left: 0; bottom: 0; width: min(290px, 86vw); height: auto;
    transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--sombra-grande);
  }
  .app.menu-abierto .lateral { transform: none; }
  .capa-menu { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .45); }
  .app.menu-abierto .capa-menu { display: block; }
  .principal { padding: 16px 16px 56px; }
  .cabecera h1 { font-size: 20px; }
  .cabecera .btn .txt-btn { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ── Botones y campos ─────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 34px; padding: 6px 12px;
  border: 1px solid var(--borde2); border-radius: 8px; background: var(--panel); color: var(--tx); cursor: pointer;
  font-weight: 550; line-height: 1.2; text-decoration: none; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--hover); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primario { background: var(--acento); border-color: var(--acento); color: var(--acento-tx); }
.btn.primario:hover:not(:disabled) { filter: brightness(1.1); background: var(--acento); }
.btn.peligro { color: var(--mal); border-color: color-mix(in srgb, var(--mal) 45%, var(--borde2)); }
.btn.peligro:hover:not(:disabled) { background: var(--mal-fondo); }
.btn.peligro.lleno { background: var(--mal); border-color: var(--mal); color: #fff; }
.btn.peligro.lleno:hover:not(:disabled) { background: var(--mal); filter: brightness(1.1); }
.btn.fantasma { border-color: transparent; background: transparent; }
.btn.fantasma:hover:not(:disabled) { background: var(--hover); }
.btn.peq { min-height: 28px; padding: 3px 9px; font-size: 13px; }
.btn.cargando { position: relative; }
.btn.cargando::after {
  content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  animation: gira .7s linear infinite;
}
@keyframes gira { to { transform: rotate(360deg); } }
.btn.menu-btn { padding: 6px 8px; }

.campo { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; min-width: 0; }
.campo > label, .etq { font-weight: 600; font-size: 13px; color: var(--tx); }
.ayuda { color: var(--tx3); font-size: 12.5px; }
input[type=text], input[type=password], input[type=search], input[type=number], select, textarea {
  width: 100%; min-height: 36px; padding: 7px 10px; background: var(--panel); border: 1px solid var(--borde2);
  border-radius: 8px; color: var(--tx);
}
textarea { resize: vertical; line-height: 1.45; }
input:disabled, select:disabled, textarea:disabled { background: var(--panel2); color: var(--tx3); }
input::placeholder, textarea::placeholder { color: var(--tx3); }
.con-boton { display: flex; gap: 8px; align-items: stretch; }
.con-boton > input, .con-boton > textarea { flex: 1; min-width: 0; }
.mono-campo { font-family: var(--mono); font-size: 13px; }
.oculto-texto { -webkit-text-security: disc; text-security: disc; }
.fila-campos { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.fila-campos .campo { margin-bottom: 0; flex: 1 1 200px; }
.fila-campos.arriba { align-items: flex-start; }
.barra-accion { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }

.casilla { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; }
.casilla input { width: 16px; height: 16px; margin: 0; accent-color: var(--acento); }
.interruptor { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-weight: 550; }
.interruptor input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.interruptor .pista { width: 36px; height: 20px; border-radius: 99px; background: var(--borde2); position: relative; transition: background .15s; flex: none; }
.interruptor .pista::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s;
}
.interruptor input:checked + .pista { background: var(--acento); }
.interruptor input:checked + .pista::after { transform: translateX(16px); }
.interruptor input:focus-visible + .pista { outline: 2px solid var(--acento); outline-offset: 2px; }

.segmento { display: inline-flex; background: var(--panel2); border: 1px solid var(--borde); border-radius: 9px; padding: 2px; gap: 2px; flex-wrap: wrap; }
.segmento button { border: 0; background: transparent; padding: 5px 11px; border-radius: 7px; cursor: pointer; color: var(--tx2); font-weight: 550; min-height: 28px; }
.segmento button:hover { color: var(--tx); }
.segmento button[aria-pressed="true"] { background: var(--panel); color: var(--tx); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.controles { display: flex; flex-wrap: wrap; gap: 14px 22px; margin-bottom: 16px; align-items: center; }
.control { display: flex; align-items: center; gap: 8px; }
.control > span { color: var(--tx3); font-size: 13px; }

/* Pestañas (enlaces) */
.pestanas { display: flex; gap: 4px; border-bottom: 1px solid var(--borde); margin-bottom: 18px; overflow-x: auto; }
.pestanas a {
  padding: 8px 12px; color: var(--tx2); text-decoration: none; font-weight: 550; border-bottom: 2px solid transparent;
  margin-bottom: -1px; white-space: nowrap;
}
.pestanas a:hover { color: var(--tx); }
.pestanas a[aria-current="page"] { color: var(--tx); border-bottom-color: var(--acento); }

/* ── Tarjetas ─────────────────────────────────────────── */
.tarjeta { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 16px; box-shadow: var(--sombra); min-width: 0; }
.tarjeta > h2, .tarjeta > .tarjeta-cab > h2 { font-size: 14.5px; font-weight: 650; letter-spacing: -.005em; }
.tarjeta-cab { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.tarjeta-cab > div { flex: 1; min-width: 0; }
.tarjeta-sub { color: var(--tx3); font-size: 13px; margin-top: 1px; }
.tarjeta + .tarjeta { margin-top: 0; }
.rejilla { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); margin-bottom: 16px; }
.rejilla.ancha { grid-template-columns: repeat(auto-fit, minmax(min(100%, 600px), 1fr)); }
.rejilla.chica { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.pila > * + * { margin-top: 16px; }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 14px 16px; box-shadow: var(--sombra); min-width: 0; text-align: left; font: inherit; }
button.kpi { cursor: pointer; }
button.kpi:hover { border-color: var(--borde2); }
.kpi-et { display: block; color: var(--tx3); font-size: 13px; }
.kpi-v { display: block; font-size: 26px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; margin-top: 2px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-nota { display: block; font-size: 12.5px; color: var(--tx3); margin-top: 2px; }
.kpi-nota.sube { color: var(--ok); }
.kpi-nota.baja { color: var(--mal); }
.sep { height: 1px; background: var(--borde); margin: 14px 0; }

/* ── Avisos y etiquetas ───────────────────────────────── */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--panel2); color: var(--tx2); line-height: 20px; white-space: nowrap; }
.chip.ok { background: var(--ok-fondo); color: var(--ok); }
.chip.aviso { background: var(--aviso-fondo); color: var(--aviso); }
.chip.mal { background: var(--mal-fondo); color: var(--mal); }
.chip.azul { background: var(--acento-suave); color: var(--acento-link); }
.punto { width: 8px; height: 8px; border-radius: 50%; background: var(--borde2); display: inline-block; flex: none; }
.punto.ok { background: #22c55e; }
.punto.mal { background: #ef4444; }
.punto.aviso { background: #f59e0b; }
.color-acento { background: var(--acento-suave); color: var(--acento-link); }
.color-oro { background: #fdf0c8; color: #7a5200; }
.color-verde { background: var(--ok-fondo); color: var(--ok); }
.color-azul { background: #dbeafe; color: #1d4ed8; }
.color-rojo { background: var(--mal-fondo); color: var(--mal); }
.color-gris { background: var(--panel2); color: var(--tx2); }
@media (prefers-color-scheme: dark) {
  .color-oro { background: #3a2c07; color: #fbd56a; }
  .color-azul { background: #14284f; color: #8db4ff; }
}
.num-chapa { font-family: var(--mono); font-weight: 650; background: var(--tx); color: var(--panel); }

.banner { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--radio); border: 1px solid; margin-bottom: 16px; }
.banner > :first-child { flex: 1 1 260px; }
.banner.aviso { background: var(--aviso-fondo); border-color: color-mix(in srgb, var(--aviso) 40%, transparent); color: var(--tx); }
.banner.info { background: var(--acento-suave); border-color: color-mix(in srgb, var(--acento) 30%, transparent); }
.banner.ok { background: var(--ok-fondo); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.banner b { font-weight: 650; }
.vacio { text-align: center; padding: 36px 16px; color: var(--tx3); }
.vacio b { display: block; color: var(--tx2); font-size: 15px; margin-bottom: 4px; }
.error-linea { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--radio); background: var(--mal-fondo); color: var(--mal); border: 1px solid color-mix(in srgb, var(--mal) 35%, transparent); }
.error-linea span { flex: 1 1 240px; }
.caja-error { background: var(--mal-fondo); color: var(--mal); border: 1px solid color-mix(in srgb, var(--mal) 35%, transparent); border-radius: 8px; padding: 10px 12px; margin: 10px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.caja-error.mono { font-family: var(--mono); font-size: 13px; }
.caja-ok { background: var(--ok-fondo); color: var(--ok); border-radius: 8px; padding: 10px 12px; margin: 10px 0; }
.nota-linea { color: var(--tx3); font-size: 12.5px; margin-top: 14px; }

/* ── Esqueletos ───────────────────────────────────────── */
.esq { background: linear-gradient(90deg, var(--panel2) 0%, var(--hover) 50%, var(--panel2) 100%); background-size: 200% 100%; animation: brillo 1.4s ease-in-out infinite; border-radius: var(--radio); }
@keyframes brillo { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.esq-kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); margin-bottom: 16px; }
.esq-kpis .esq { height: 84px; }
.esq-cuerpo { height: 220px; }
.esq-linea { height: 14px; margin: 10px 0; border-radius: 6px; }

/* ── Tablas ───────────────────────────────────────────── */
.tabla-caja { overflow: auto; max-width: 100%; border: 1px solid var(--borde); border-radius: var(--radio); background: var(--panel); }
.tarjeta .tabla-caja { border-radius: 8px; }
.tabla-caja.alta { max-height: 70vh; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--borde); vertical-align: top; }
th { position: sticky; top: 0; background: var(--panel2); color: var(--tx2); font-weight: 600; font-size: 12.5px; white-space: nowrap; z-index: 1; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.clicable { cursor: pointer; }
tr.clicable:hover td { background: var(--panel2); }
td.mono, td .mono { font-family: var(--mono); font-size: 12.5px; }
td .ajustar { white-space: normal; min-width: 220px; }
.celda { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.nulo { color: var(--tx3); font-style: italic; font-family: var(--mono); font-size: 12px; }
th button.orden { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
th button.orden:hover { color: var(--tx); }
th button.orden:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }
.paginacion { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; color: var(--tx2); }
.acciones { display: flex; gap: 6px; flex-wrap: wrap; }
.titulo-grupo { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--tx3); font-weight: 650; margin: 22px 0 8px; }
.titulo-grupo:first-child { margin-top: 0; }
.titulo-grupo small { text-transform: none; letter-spacing: 0; font-weight: 500; margin-left: 6px; }

@media (max-width: 759px) {
  table.apilada thead { display: none; }
  table.apilada, table.apilada tbody, table.apilada tr, table.apilada td { display: block; width: 100%; }
  table.apilada tr { padding: 10px 12px; border-bottom: 1px solid var(--borde); }
  table.apilada tbody tr:last-child { border-bottom: 0; }
  table.apilada td { border: 0; padding: 2px 0; }
  table.apilada td[data-etq]::before { content: attr(data-etq); display: block; font-size: 11.5px; color: var(--tx3); text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }
  table.apilada td.acc { padding-top: 8px; }
}

/* ── Gráficas ─────────────────────────────────────────── */
.graf-lectura { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; min-height: 22px; flex-wrap: wrap; }
.graf-lectura b { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
.graf-lectura span { color: var(--tx3); }
.graf-area { position: relative; }
.graf-max { position: absolute; top: -2px; left: 0; font-size: 11px; color: var(--tx3); pointer-events: none; background: var(--panel); padding-right: 4px; z-index: 1; }
.graf svg { display: block; width: 100%; height: 150px; touch-action: pan-y; cursor: crosshair; border-radius: 4px; }
.graf svg .rejilla-l { stroke: var(--graf-rejilla); stroke-width: 1; vector-effect: non-scaling-stroke; }
.graf svg .b { fill: var(--graf); }
.graf svg .b.hoy { fill: var(--graf-fuerte); }
.graf svg .b.sel { fill: var(--graf-fuerte); }
.graf svg .b.tenue { fill: var(--graf); opacity: .55; }
.graf-ejes { display: flex; justify-content: space-between; color: var(--tx3); font-size: 11.5px; margin-top: 4px; }

.hbarras { display: flex; flex-direction: column; gap: 8px; }
.hbarra { display: grid; grid-template-columns: minmax(80px, 38%) minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.hbarra-et { overflow-wrap: anywhere; line-height: 1.3; }
.hbarra-pista { height: 8px; border-radius: 99px; background: var(--panel2); overflow: hidden; }
.hbarra-pista i { display: block; height: 100%; background: var(--graf-fuerte); border-radius: 99px; min-width: 2px; }
.hbarra.tenue .hbarra-pista i { background: var(--graf); }
.hbarra-v { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.hbarra-v small { color: var(--tx3); margin-left: 6px; font-size: 12px; }
.hbarra.cero .hbarra-pista i { min-width: 0; }
@media (max-width: 480px) { .hbarra { grid-template-columns: minmax(70px, 34%) minmax(0, 1fr) auto; gap: 8px; } }

.medidor { display: flex; flex-direction: column; gap: 5px; }
.medidor-cab { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.medidor-cab span { color: var(--tx3); font-size: 12.5px; }
.medidor-pista { height: 10px; border-radius: 99px; background: var(--panel2); overflow: hidden; }
.medidor-pista i { display: block; height: 100%; border-radius: 99px; background: #22c55e; }
.medidor-pista i.aviso { background: #f59e0b; }
.medidor-pista i.mal { background: #ef4444; }

/* ── Velocidad ────────────────────────────────────────── */
.nota-caja { display: flex; align-items: center; gap: 18px; }
.nota-n { font-size: 52px; font-weight: 700; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.nota-n.bien, .metrica-v.bien { color: var(--ok); }
.nota-n.mejorable, .metrica-v.mejorable { color: var(--aviso); }
.nota-n.mal, .metrica-v.mal { color: var(--mal); }
.metricas { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); margin-bottom: 16px; }
.metrica { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.metrica.tenue { opacity: .75; }
.metrica-et { color: var(--tx2); font-size: 13px; min-height: 38px; }
.metrica-cod { font-family: var(--mono); font-size: 11.5px; color: var(--tx3); }
.metrica-fila { display: flex; align-items: baseline; gap: 8px; }
.metrica-v { font-size: 26px; font-weight: 650; letter-spacing: -.02em; }
.dist { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--panel2); margin-top: 4px; }
.dist i { display: block; width: var(--w); }
.dist i.b { background: #22c55e; }
.dist i.m { background: #f59e0b; }
.dist i.x { background: #ef4444; }

/* ── Firewall ─────────────────────────────────────────── */
.prots { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.prot { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--borde); border-radius: 9px; }
.prot .ic { margin-top: 1px; }
.prot.ok .ic { color: var(--ok); }
.prot.aviso { border-color: color-mix(in srgb, var(--aviso) 45%, var(--borde)); background: var(--aviso-fondo); }
.prot.aviso .ic { color: var(--aviso); }
.prot.nulo .ic { color: var(--tx3); }
.prot-txt { flex: 1; min-width: 0; }
.prot-txt b { display: block; font-weight: 600; }
.prot-txt span { color: var(--tx3); font-size: 12.5px; }
.prot-v { color: var(--tx2); font-size: 12.5px; white-space: nowrap; }

/* ── Registros / código ───────────────────────────────── */
.registro {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.55; background: #0e0e11; color: #d8d8de; border-radius: var(--radio);
  padding: 12px 14px; overflow: auto; height: calc(100vh - 330px); min-height: 300px; border: 1px solid var(--borde);
}
.registro .l { display: block; white-space: pre-wrap; overflow-wrap: anywhere; padding: 1px 0; }
.registro .l time { color: #7d7d88; margin-right: 10px; }
.registro .l.err { color: #ff8f86; }
.registro .l.av { color: #f6c860; }
.registro .vacio { color: #8d8d99; }
pre.codigo { font-family: var(--mono); font-size: 12.5px; line-height: 1.55; background: #0e0e11; color: #d8d8de; border-radius: 8px; padding: 12px 14px; overflow: auto; max-height: 340px; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ── Servidor ─────────────────────────────────────────── */
.servicio { display: flex; flex-direction: column; gap: 6px; }
.servicio-cab { display: flex; align-items: center; gap: 8px; }
.servicio-cab b { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 650; }
.servicio-meta { color: var(--tx3); font-size: 13px; }
.servicio .btn { align-self: flex-start; margin-top: 6px; }

/* ── Versiones ────────────────────────────────────────── */
.version-actual { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.version-actual > div:first-child { flex: 1 1 280px; min-width: 0; }
.sha { font-family: var(--mono); font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
.version-msg { color: var(--tx2); margin-top: 2px; overflow-wrap: anywhere; }

/* ── Opiniones ────────────────────────────────────────── */
.opinion { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 14px 16px; }
.opinion.archivada { opacity: .72; }
.opinion + .opinion { margin-top: 12px; }
.opinion-cab { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; color: var(--tx3); font-size: 12.5px; margin-bottom: 8px; }
.estrellas { color: #d99a00; letter-spacing: 1px; }
.opinion-msg { white-space: pre-wrap; overflow-wrap: anywhere; }
.opinion details { margin-top: 10px; }
.opinion summary { cursor: pointer; color: var(--tx2); font-weight: 550; }
.opinion details div { margin-top: 6px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; color: var(--tx2); background: var(--panel2); border-radius: 8px; padding: 10px 12px; max-height: 260px; overflow: auto; }
.respuesta-previa { margin-top: 12px; background: var(--acento-suave); border-radius: 8px; padding: 10px 12px; }
.respuesta-previa small { display: block; color: var(--tx3); margin-bottom: 3px; }
.respuesta-previa div { white-space: pre-wrap; overflow-wrap: anywhere; }
.opinion textarea { margin-top: 12px; }
.opinion-pie { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.opinion-pie .vacio-flex { flex: 1; }
.plantillas { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.plantillas button { border: 1px dashed var(--borde2); background: transparent; border-radius: 99px; padding: 2px 10px; cursor: pointer; font-size: 12.5px; color: var(--tx2); }
.plantillas button:hover { background: var(--hover); }

/* ── Personas ─────────────────────────────────────────── */
.reservados { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 5px; }
.celda-res { border: 1px solid var(--borde); background: var(--panel2); border-radius: 6px; padding: 4px 0; text-align: center; font-size: 12px; color: var(--tx3); font-variant-numeric: tabular-nums; }
button.celda-res { cursor: pointer; font: inherit; font-size: 12px; background: #fdf0c8; color: #7a5200; border-color: #ecd486; font-weight: 650; }
@media (prefers-color-scheme: dark) { button.celda-res { background: #3a2c07; color: #fbd56a; border-color: #5e4811; } }
.ficha-cab { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.colores { display: flex; gap: 6px; flex-wrap: wrap; }
.colores button { border: 2px solid transparent; border-radius: 99px; padding: 2px 11px; cursor: pointer; font-size: 12.5px; font-weight: 600; }
.colores button[aria-pressed="true"] { border-color: var(--tx); }

/* ── Claves ───────────────────────────────────────────── */
.clave-nombre { font-family: var(--mono); font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }

/* ── Capas: confirmación y cajón ──────────────────────── */
.velo { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .5); display: grid; place-items: center; padding: 16px; }
.dialogo { width: 100%; max-width: 440px; background: var(--panel); border: 1px solid var(--borde); border-radius: 14px; padding: 22px; box-shadow: var(--sombra-grande); }
.dialogo h2 { font-size: 17px; margin-bottom: 8px; letter-spacing: -.01em; }
.dialogo p { color: var(--tx2); overflow-wrap: anywhere; }
.dialogo .casilla { margin-top: 14px; align-items: flex-start; }
.dialogo-pie { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.velo-cajon { display: block; padding: 0; }
.cajon {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--panel); border-left: 1px solid var(--borde);
  display: flex; flex-direction: column; box-shadow: var(--sombra-grande); animation: entra .18s ease-out;
}
@keyframes entra { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.cajon-cab { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--borde); }
.cajon-cab h2 { flex: 1; font-size: 16px; min-width: 0; overflow-wrap: anywhere; }
.cajon-cuerpo { flex: 1; overflow: auto; padding: 18px; }
.cajon-pie { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--borde); flex-wrap: wrap; align-items: center; }
.cajon-pie .sep-flex { flex: 1; }
.campo-fila { border-bottom: 1px solid var(--borde); padding: 12px 0; }
.campo-fila:first-child { padding-top: 0; }
.campo-fila-cab { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.campo-fila-cab b { font-family: var(--mono); font-size: 13px; }
.campo-fila-cab small { color: var(--tx3); font-family: var(--mono); font-size: 12px; }
.campo-fila-cab .marcas { margin-left: auto; display: flex; gap: 12px; font-size: 13px; }
.col-fila { display: grid; grid-template-columns: minmax(120px, 1.2fr) minmax(110px, 1fr) auto auto minmax(100px, 1fr) auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--borde); }
@media (max-width: 759px) { .col-fila { grid-template-columns: 1fr 1fr; } .col-fila > :nth-child(5) { grid-column: 1 / -1; } }

#avisos { position: fixed; z-index: 200; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.aviso-t { background: var(--tx); color: var(--panel); padding: 10px 14px; border-radius: 10px; box-shadow: var(--sombra-grande); overflow-wrap: anywhere; animation: entra .18s ease-out; }
.aviso-t.mal { background: var(--mal); color: #fff; }

/* Tarjetas sueltas dentro de una zona de datos: separadas de lo que sigue */
#vista > .tarjeta, #vista > div > .tarjeta { margin-bottom: 16px; }
.ficha-cab { min-height: 24px; }
table.claves { table-layout: fixed; min-width: 760px; }
table.claves th:nth-child(1) { width: 27%; }
table.claves th:nth-child(2) { width: 32%; }
table.claves th:nth-child(3) { width: 16%; }
table.claves th:nth-child(4) { width: 11%; }
table.claves th:nth-child(5) { width: 14%; }
@media (max-width: 759px) { table.claves { table-layout: auto; min-width: 0; } }
