/* Panel del detector de caidas.
 *
 * Rediseno del 9 oct 2026: aspecto de producto, no de prototipo. Barra lateral
 * de navegacion, tipografia Inter servida desde el propio panel (la CSP solo
 * admite 'self'), paleta institucional y estados con significado fijo:
 * verde = vigilando, ambar = sin imagen, rojo = sin senal.
 *
 * Mantiene TODAS las clases que usan las vistas y los scripts: las plantillas
 * no se tocaron salvo los dos layouts. Regla que viene de la reconstruccion del
 * 13/08: el CSS y las plantillas se editan a mano.
 */

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/inter-latin.woff2") format("woff2");
}

:root {
    /* Marca */
    --marca: #1d4f91;
    --marca-oscura: #163d70;
    --marca-suave: #eef4fb;
    --lateral: #0f1f33;
    --lateral-borde: #1c3150;
    --lateral-texto: #b6c2d2;

    /* Tinta y superficies */
    --tinta: #101828;
    --tinta-media: #344054;
    --tinta-suave: #667085;
    --papel: #ffffff;
    --fondo: #f5f7fa;
    --borde: #e4e7ec;
    --borde-fuerte: #d0d5dd;

    /* Estados */
    --bien: #067647;
    --bien-suave: #ecfdf3;
    --bien-borde: #abefc6;
    --aviso: #b54708;
    --aviso-suave: #fffaeb;
    --aviso-borde: #fedf89;
    --malo: #b42318;
    --malo-suave: #fef3f2;
    --malo-borde: #fecdca;
    --info: #175cd3;
    --info-suave: #eff8ff;
    --info-borde: #b2ddff;
    --neutro-suave: #f2f4f7;

    --radio: 10px;
    --sombra: 0 1px 2px rgba(16, 24, 40, .05);
    --sombra-alta: 0 4px 12px rgba(16, 24, 40, .08);
    --foco: 0 0 0 4px rgba(29, 79, 145, .16);
    --ancho-lateral: 248px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    color: var(--tinta);
    background: var(--fondo);
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "cv11", "ss01";
}

a { color: var(--marca); text-decoration: none; }
a:hover { color: var(--marca-oscura); text-decoration: underline; }

h1 { font-size: 24px; line-height: 1.25; font-weight: 650; letter-spacing: -.015em; margin: 0 0 6px; }
h2 { font-size: 17px; line-height: 1.35; font-weight: 600; letter-spacing: -.01em; margin: 36px 0 14px; }
h3 { font-size: 15px; font-weight: 600; margin: 0 0 8px; }
h4 { font-size: 14px; font-weight: 600; margin: 14px 0 6px; }
p { margin: 0 0 12px; }
strong { font-weight: 600; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: var(--neutro-suave); padding: 1px 5px; border-radius: 4px; }

::selection { background: #cfe0f5; }

/* ================================================================ estructura */

.app { display: flex; min-height: 100vh; }

.lateral {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--ancho-lateral);
    display: flex;
    flex-direction: column;
    background: var(--lateral);
    color: var(--lateral-texto);
    z-index: 10;
}

.lateral .marca {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 20px 20px;
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid var(--lateral-borde);
}
.lateral .marca:hover { text-decoration: none; color: #fff; }
.logo { width: 36px; height: 36px; flex: none; }
.marca-texto { display: flex; flex-direction: column; line-height: 1.2; }
.marca-nombre { font-weight: 650; font-size: 15px; letter-spacing: -.01em; }
.marca-lema { font-size: 12px; color: var(--lateral-texto); margin-top: 2px; }

.lateral nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.lateral nav .seccion {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #7d8ca1;
    padding: 14px 12px 6px;
}
.lateral nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--lateral-texto);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}
.lateral nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.lateral nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.lateral nav a.activo { background: rgba(255, 255, 255, .1); color: #fff; }
.lateral nav a.activo svg { opacity: 1; }

.usuario {
    border-top: 1px solid var(--lateral-borde);
    padding: 16px 20px 18px;
    margin: 0;
}
.usuario .quien { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.inicial {
    width: 34px; height: 34px; flex: none;
    border-radius: 50%;
    background: #29456b;
    color: #fff;
    display: grid; place-items: center;
    font-weight: 600; font-size: 14px;
}
.quien-nombre { color: #fff; font-size: 14px; font-weight: 500; line-height: 1.25; word-break: break-word; }
.quien-rol { font-size: 12px; color: #7d8ca1; }
.usuario .enlaces { display: flex; gap: 8px; }
.usuario .enlaces a,
.usuario .enlaces button {
    flex: 1;
    text-align: center;
    padding: 7px 10px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    border: 1px solid var(--lateral-borde);
    background: transparent;
    color: var(--lateral-texto);
    text-decoration: none;
    box-shadow: none;
}
.usuario .enlaces a:hover,
.usuario .enlaces button:hover { background: rgba(255, 255, 255, .06); color: #fff; border-color: #2c4566; }

.contenido { flex: 1; margin-left: var(--ancho-lateral); min-width: 0; display: flex; flex-direction: column; }
main { width: 100%; max-width: 1180px; margin: 0 auto; padding: 32px 40px 64px; }
.pie-app {
    margin-top: auto;
    padding: 18px 40px;
    font-size: 12px;
    color: var(--tinta-suave);
    border-top: 1px solid var(--borde);
    background: var(--papel);
}

@media (max-width: 960px) {
    .app { display: block; }
    .lateral { position: static; width: auto; }
    .lateral .marca { padding: 14px 16px; }
    .lateral nav { flex-direction: row; padding: 8px 10px; overflow-x: auto; gap: 4px; }
    .lateral nav .seccion { display: none; }
    .lateral nav a { white-space: nowrap; padding: 8px 10px; }
    .usuario { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; }
    .usuario .quien { margin: 0; }
    .contenido { margin-left: 0; }
    main { padding: 24px 16px 48px; }
    .pie-app { padding: 16px; }
}

/* ===================================================================== texto */

.sub { color: var(--tinta-suave); margin: 0 0 24px; font-size: 14px; }
.pie { color: var(--tinta-suave); font-size: 13px; line-height: 1.5; }
.nota {
    background: var(--aviso-suave);
    border: 1px solid var(--aviso-borde);
    color: #7a2e0e;
    padding: 12px 14px;
    border-radius: var(--radio);
    font-size: 14px;
}
.texto-error { color: var(--malo); }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* =================================================================== bloques */

.tarjeta {
    background: var(--papel);
    border: 1px solid var(--borde);
    border-radius: 12px;
    padding: 20px 22px;
    margin-bottom: 16px;
    box-shadow: var(--sombra);
}
.tarjeta > h3:first-child, .tarjeta > h2:first-child { margin-top: 0; }
.estrecho { max-width: 480px; }
.dos-columnas { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.dos-columnas > div > h2:first-child { margin-top: 0; }
.rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
@media (max-width: 900px) { .dos-columnas, .rejilla { grid-template-columns: 1fr; } }

/* Indicadores */
.cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 8px; }
.cifra {
    background: var(--papel);
    border: 1px solid var(--borde);
    border-radius: 12px;
    padding: 18px 20px;
    box-shadow: var(--sombra);
}
.cifra .valor {
    display: block;
    font-size: 28px;
    line-height: 1.15;
    font-weight: 650;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
    color: var(--tinta);
}
.cifra .rotulo { display: block; margin-top: 6px; color: var(--tinta-suave); font-size: 13px; font-weight: 500; }
.cifra.malo { border-color: var(--malo-borde); background: var(--malo-suave); }
.cifra.malo .valor { color: var(--malo); }

/* ================================================================== botones */

.boton, button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 16px;
    border: 1px solid var(--marca);
    border-radius: 8px;
    background: var(--marca);
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    box-shadow: var(--sombra);
    transition: background-color .12s, border-color .12s, box-shadow .12s;
}
.boton:hover, button:hover { background: var(--marca-oscura); border-color: var(--marca-oscura); color: #fff; text-decoration: none; }
.boton:focus-visible, button:focus-visible { outline: none; box-shadow: var(--foco); }
.boton.secundario, button.secundario {
    background: var(--papel);
    color: var(--tinta-media);
    border-color: var(--borde-fuerte);
}
.boton.secundario:hover, button.secundario:hover { background: #f9fafb; color: var(--tinta); border-color: var(--borde-fuerte); }
/* Las acciones destructivas no son el boton principal de ninguna pantalla:
   contorno rojo en vez de bloque rojo, que se ve sin gritar. */
.boton.peligro, button.peligro {
    background: var(--papel);
    color: var(--malo);
    border-color: var(--malo-borde);
}
.boton.peligro:hover, button.peligro:hover { background: var(--malo-suave); color: var(--malo); border-color: #fda29b; }
button:disabled { opacity: .5; cursor: default; }
.acciones { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }

/* ============================================================== formularios */

label { display: block; font-size: 13px; font-weight: 500; color: var(--tinta-media); margin-bottom: 6px; }
input[type=text], input[type=search], input[type=email], input[type=password],
input[type=number], input[type=url], input[type=time], select, textarea {
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--borde-fuerte);
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    background: var(--papel);
    color: var(--tinta);
    margin-bottom: 14px;
    box-shadow: var(--sombra);
    transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #84adff; box-shadow: var(--foco); }
select {
    appearance: none;
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23667085' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}
textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.5; }
.filtros {
    display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
    margin-bottom: 20px; padding: 16px 18px;
    background: var(--papel); border: 1px solid var(--borde); border-radius: 12px; box-shadow: var(--sombra);
}
.filtros > div { min-width: 170px; }
.filtros input, .filtros select { margin-bottom: 0; }
.opcion {
    display: block;
    border: 1px solid var(--borde);
    border-radius: var(--radio);
    padding: 14px 16px;
    margin-bottom: 8px;
    cursor: pointer;
    background: var(--papel);
    color: var(--tinta);
    font-size: 14px;
    font-weight: 500;
}
.opcion:hover { border-color: var(--borde-fuerte); }
.opcion:has(input:checked) { border-color: var(--marca); background: var(--marca-suave); }
.opcion input { width: auto; margin-right: 8px; accent-color: var(--marca); }
.opcion .sub { margin: 4px 0 0; display: block; font-size: 13px; font-weight: 400; }

/* Interruptores: el checkbox se dibuja como conmutador. El texto de ayuda va
   dentro del <label> para que se pueda pulsar entero. */
.interruptor { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.interruptor input[type=checkbox] {
    appearance: none;
    flex: none;
    width: 36px; height: 20px;
    margin: 1px 0 0;
    border-radius: 999px;
    background: var(--borde-fuerte);
    position: relative;
    cursor: pointer;
    transition: background-color .15s;
}
.interruptor input[type=checkbox]::after {
    content: "";
    position: absolute;
    top: 2px; left: 2px;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .2);
    transition: transform .15s;
}
.interruptor input[type=checkbox]:checked { background: var(--marca); }
.interruptor input[type=checkbox]:checked::after { transform: translateX(16px); }
.interruptor input[type=checkbox]:focus-visible { outline: none; box-shadow: var(--foco); }
.interruptor label { font-size: 14px; color: var(--tinta); font-weight: 600; margin: 0; cursor: pointer; }
.interruptor label .nota, label .nota {
    display: block; margin-top: 4px; padding: 0;
    background: none; border: none;
    font-size: 13px; font-weight: 400; color: var(--tinta-suave);
    line-height: 1.5; max-width: 64ch;
}
.tarjeta > div[data-caja] + div[data-caja] { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--borde); }

/* Bloques plegables ("Avanzado"). */
details { background: var(--papel); border: 1px solid var(--borde); border-radius: 12px; box-shadow: var(--sombra); margin-bottom: 16px; }
details > summary {
    list-style: none; cursor: pointer;
    padding: 16px 22px; font-weight: 600; font-size: 14px; color: var(--tinta);
    display: flex; align-items: center; gap: 10px;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
    content: ""; width: 8px; height: 8px; flex: none;
    border-right: 2px solid var(--tinta-suave); border-bottom: 2px solid var(--tinta-suave);
    transform: rotate(-45deg); transition: transform .15s;
}
details[open] > summary::before { transform: rotate(45deg); }
details[open] > summary { border-bottom: 1px solid var(--borde); }
details > :not(summary) { margin-left: 22px; margin-right: 22px; }
details > :last-child:not(summary) { margin-bottom: 20px; }
details > summary + * { margin-top: 16px; }
details.tarjeta { padding: 0; }
/* Camaras dentro del arbol de domicilios: fila compacta, no tarjeta. */
.habitacion details { box-shadow: none; margin-bottom: 8px; }
.habitacion details > summary { padding: 12px 16px; flex-wrap: wrap; row-gap: 2px; }
.habitacion details > summary .sub { margin: 0; font-size: 13px; font-weight: 400; flex-basis: 100%; padding-left: 18px; }
.habitacion details > :not(summary) { margin-left: 16px; margin-right: 16px; }
@media (max-width: 600px) { th, td { padding: 10px 12px; } }

/* ==================================================================== tablas */

.tabla-envoltorio {
    overflow-x: auto;
    border: 1px solid var(--borde);
    border-radius: 12px;
    background: var(--papel);
    box-shadow: var(--sombra);
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--borde); vertical-align: middle; }
th {
    background: #f9fafb;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--tinta-suave);
    white-space: nowrap;
}
tbody tr:hover td { background: #fafbfc; }
tr:last-child td { border-bottom: none; }
td a { font-weight: 500; }
.paginacion { display: flex; gap: 8px; margin-top: 16px; align-items: center; color: var(--tinta-suave); font-size: 14px; }

/* Codigo de 6 cifras con el que se coteja un aparato al darlo de alta. Iba en
   un style="" que la CSP bloqueaba: nunca llego a verse grande. */
.codigo-alta { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 20px; font-weight: 700; letter-spacing: .15em; white-space: nowrap; }

/* ================================================================ etiquetas */

.etiqueta, [class^="nivel-"], [class*=" nivel-"] {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--borde);
    background: var(--neutro-suave);
    color: var(--tinta-media);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.6;
    white-space: nowrap;
}
.etiqueta::before, [class^="nivel-"]::before, [class*=" nivel-"]::before {
    content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8;
}
/* Nivel de gravedad: de gris a rojo, en ese orden. */
.nivel-informativo { background: var(--neutro-suave); color: var(--tinta-media); border-color: var(--borde); }
.nivel-aviso { background: var(--aviso-suave); color: var(--aviso); border-color: var(--aviso-borde); }
.nivel-alerta { background: #fff4ed; color: #c4320a; border-color: #f9dbaf; }
.nivel-urgente { background: var(--malo-suave); color: var(--malo); border-color: var(--malo-borde); }
/* Estado de revision. */
.etiqueta.est-nuevo { background: var(--info-suave); color: var(--info); border-color: var(--info-borde); }
.etiqueta.est-visto { background: var(--neutro-suave); color: var(--tinta-media); border-color: var(--borde); }
.etiqueta.est-confirmado { background: var(--malo-suave); color: var(--malo); border-color: var(--malo-borde); }
.etiqueta.est-falsa_alarma { background: var(--neutro-suave); color: var(--tinta-suave); border-color: var(--borde); }

/* Salud de un detector. */
.estado {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 600;
    color: var(--tinta-media);
}
.estado::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--borde-fuerte); }
.estado.viva { color: var(--bien); }
.estado.viva::before { background: #17b26a; box-shadow: 0 0 0 3px #dcfae6; }
.estado.ciega { color: var(--aviso); }
.estado.ciega::before { background: #f79009; box-shadow: 0 0 0 3px #fef0c7; }
.estado.muda { color: var(--malo); }
.estado.muda::before { background: #f04438; box-shadow: 0 0 0 3px #fee4e2; }
.estado.sin_estrenar { color: var(--tinta-suave); }

/* ==================================================================== avisos */

.aviso {
    position: relative;
    padding: 14px 16px 14px 46px;
    border-radius: var(--radio);
    border: 1px solid var(--borde);
    margin-bottom: 20px;
    font-size: 14px;
    background: var(--papel);
    box-shadow: var(--sombra);
}
.aviso::before {
    content: "";
    position: absolute; left: 16px; top: 15px;
    width: 18px; height: 18px;
    background: currentColor;
    -webkit-mask: var(--icono) no-repeat center / contain;
    mask: var(--icono) no-repeat center / contain;
}
.aviso-ok {
    background: var(--bien-suave); border-color: var(--bien-borde); color: #085d3a;
    --icono: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 1a9 9 0 110 18 9 9 0 010-18zm4.2 5.8a1 1 0 00-1.4 0L8.8 10.8 7.2 9.2a1 1 0 10-1.4 1.4l2.3 2.3a1 1 0 001.4 0l4.7-4.7a1 1 0 000-1.4z'/%3E%3C/svg%3E");
}
/* Un aviso no es un exito: en verde se leeria como "todo correcto" y se pasaria
   por alto justo lo que hay que apuntar (la clave de un dispositivo nuevo). */
.aviso-aviso {
    background: var(--aviso-suave); border-color: var(--aviso-borde); color: #7a2e0e;
    --icono: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M8.3 2.6a2 2 0 013.4 0l7 12A2 2 0 0117 17.6H3a2 2 0 01-1.7-3l7-12zM10 7a1 1 0 00-1 1v3a1 1 0 102 0V8a1 1 0 00-1-1zm0 6.5a1.1 1.1 0 100 2.2 1.1 1.1 0 000-2.2z'/%3E%3C/svg%3E");
}
.aviso-error {
    background: var(--malo-suave); border-color: var(--malo-borde); color: #912018;
    --icono: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 1a9 9 0 110 18 9 9 0 010-18zm0 4a1 1 0 00-1 1v4.5a1 1 0 102 0V6a1 1 0 00-1-1zm0 8a1.2 1.2 0 100 2.4 1.2 1.2 0 000-2.4z'/%3E%3C/svg%3E");
}
/* Alertas que no se han podido entregar: es lo unico de este panel que
   significa "el sistema hizo su trabajo y aun asi nadie se ha enterado". Mas
   fuerte que los demas avisos, sin dejar de ser sobrio. */
.aviso-urgente {
    background: var(--malo-suave);
    border: 1px solid var(--malo-borde);
    border-left: 4px solid var(--malo);
    color: #7a271a;
    --icono: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M8.3 2.6a2 2 0 013.4 0l7 12A2 2 0 0117 17.6H3a2 2 0 01-1.7-3l7-12zM10 7a1 1 0 00-1 1v3a1 1 0 102 0V8a1 1 0 00-1-1zm0 6.5a1.1 1.1 0 100 2.2 1.1 1.1 0 000-2.2z'/%3E%3C/svg%3E");
}
.aviso-urgente::before { color: var(--malo); }
.aviso strong { font-weight: 600; }

.lista-simple { margin: 0; padding-left: 20px; }
.lista-simple li { margin: 2px 0; }

/* Tarjeta de cada casa en la portada: franja de color segun su salud. */
.casa {
    display: block;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
    transition: box-shadow .15s, border-color .15s, transform .15s;
}
.casa::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--borde-fuerte); }
.casa:hover { text-decoration: none; color: inherit; box-shadow: var(--sombra-alta); border-color: var(--borde-fuerte); }
.casa h3 { font-size: 15px; margin-bottom: 4px; }
.casa .pie { margin: 4px 0 0; }
.casa.viva::before, .casa.bueno::before { background: #17b26a; }
.casa.ciega::before, .casa.regular::before { background: #f79009; }
.casa.muda::before, .casa.malo::before { background: #f04438; }

.captura { max-width: 100%; border-radius: 12px; border: 1px solid var(--borde); box-shadow: var(--sombra); }
.clave {
    font-family: ui-monospace, Menlo, monospace;
    font-size: 14px;
    background: var(--neutro-suave);
    border: 1px solid var(--borde);
    padding: 10px 12px;
    border-radius: 8px;
    word-break: break-all;
}
.habitacion { border-left: 2px solid var(--borde); padding-left: 16px; margin: 16px 0; }

/* ======================================================== editor de zonas */

/* Ocupa todo el ancho disponible, saliendose del contenedor: colocar las
   esquinas de una cama pide toda la pantalla que haya. */
.editor-zonas { width: 100%; margin-bottom: 24px; }

/* CLAVE: el contenedor mide EXACTAMENTE lo que la imagen y el lienzo la cubre al
   100 %. Cualquier cosa que los desacople (flex, centrados, tamanos propios) deja
   el dibujo desplazado respecto a la foto. La foto es 4:3: a 74vh de alto le
   corresponden 74vh*4/3 de ancho. */
.lienzo-zonas {
    display: block;
    position: relative;
    margin: 0 auto;
    max-width: min(100%, calc(74vh * 4 / 3));
    line-height: 0;
    border: 1px solid var(--borde);
    border-radius: 12px;
    overflow: hidden;
    background: var(--papel);
    box-shadow: var(--sombra);
}
.lienzo-zonas img { display: block; width: 100%; height: auto; image-rendering: -webkit-optimize-contrast; }
.lienzo-zonas canvas {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    cursor: crosshair;
    /* Sin esto, arrastrar un punto con el dedo desplaza la pagina. */
    touch-action: none;
}

.zona-fila { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--borde); }
.zona-fila:last-child { border-bottom: none; }
.zona-fila input, .zona-fila select { margin-bottom: 0; }
.zona-fila input[data-nombre] { flex: 1; min-width: 140px; }
.zona-fila select { width: auto; min-width: 130px; }
.zona-color { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.marca-guardado { margin-left: 10px; color: var(--tinta-suave); font-size: 13px; }

.cabecera-zonas {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 20px; flex-wrap: wrap; margin-bottom: 20px;
}
.barra-dibujo, .pie-lienzo {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
    max-width: min(100%, calc(74vh * 4 / 3));
    margin: 0 auto;
    padding: 12px 2px;
}
.barra-dibujo .pista { color: var(--tinta-suave); font-size: 13px; }
.pie-lienzo .acciones { display: flex; gap: 8px; }
.pie-lienzo form { display: inline; }
.pie-lienzo .pie { max-width: 60ch; }

.cabecera-lista {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; flex-wrap: wrap; margin-bottom: 10px;
}
.cabecera-lista h2 { margin: 0; }

/* =================================================================== acceso */

body.centrado { min-height: 100vh; background: var(--papel); }
.acceso { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; }
.acceso-marca {
    background: var(--lateral);
    color: var(--lateral-texto);
    padding: 48px 56px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.acceso-marca .marca { display: flex; align-items: center; gap: 12px; color: #fff; }
.acceso-marca .logo { width: 40px; height: 40px; }
.acceso-marca h2 { color: #fff; font-size: 30px; line-height: 1.2; font-weight: 650; letter-spacing: -.02em; margin: 0 0 16px; max-width: 18ch; }
.acceso-marca p { max-width: 46ch; font-size: 15px; }
.acceso-marca .puntos { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; }
.acceso-marca .puntos li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.acceso-marca .puntos li::before {
    content: ""; flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%;
    background: #29456b url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M6 10.5l2.5 2.5L14 7.5' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / 14px;
}
.acceso-marca .legal { font-size: 12px; color: #7d8ca1; }
.acceso-formulario { display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.tarjeta-acceso { width: 100%; max-width: 380px; }
.tarjeta-acceso h1 { font-size: 26px; margin-bottom: 6px; }
.tarjeta-acceso .sub { margin-bottom: 28px; }
.tarjeta-acceso button[type=submit] { width: 100%; min-height: 44px; margin-top: 6px; }
.simple { max-width: 640px; margin: 40px auto; padding: 0 20px; }
@media (max-width: 900px) {
    .acceso { grid-template-columns: 1fr; }
    .acceso-marca { padding: 28px 24px; }
    .acceso-marca h2, .acceso-marca p, .acceso-marca .puntos, .acceso-marca .legal { display: none; }
}

/* =============================================================== utilidades */

.m-0 { margin: 0; }
.mb-0 { margin-bottom: 0; }
.mb-12 { margin-bottom: 12px; }
.ml-10 { margin-left: 10px; }
.mt-0 { margin-top: 0; }
.mt-6 { margin-top: 6px; }
.mt-8 { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-32 { margin-top: 32px; }
.my-6 { margin: 6px 0; }
.my-12 { margin: 12px 0; }
