:root { color-scheme: light; }
body { margin: 0; }
[hidden] { display: none !important; }
/* Concepto: panel de gestión claro, con menú lateral en pantallas grandes, tarjetas blancas redondeadas con sombra suave y un solo color de acento violeta.
   Color: fondo lavanda muy suave, tarjetas blancas, tinta azul violeta oscura, acento violeta. Estados con sus propios colores (verde, ámbar, rojo, azul).
   Tipo: Plus Jakarta Sans en pesos 500 a 800 (títulos en 800). */
:root {
  --bg: #f6f5fb;
  --surface: #ffffff;
  --ink: #1b1736;
  --muted: #6a6688;
  --field-line: #8a86a5;
  --line: #e8e5f2;
  --accent: #6d3fe0;
  --accent-ink: #ffffff;
  --accent-soft: #efe9fd;
  --ok: #136b42;
  --ok-bg: #def5e8;
  --warn: #8a5204;
  --warn-bg: #fdefd2;
  --bad: #b42a3a;
  --bad-bg: #fde5e8;
  --info: #2559c4;
  --info-bg: #e2ebfc;
  --shadow: 0 1px 2px rgba(41, 24, 92, 0.06), 0 12px 30px -16px rgba(41, 24, 92, 0.22);
  --shadow-btn: 0 8px 18px -8px rgba(109, 63, 224, 0.65);
  --font-display: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --font-body: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --surface: #16181c;
    --ink: #e7e9ea;
    --muted: #8b98a5;
    --field-line: #6b7780;
    --line: #2f3336;
    --accent: #a98bfa;
    --accent-ink: #160f33;
    --accent-soft: #221d3a;
    --ok: #6fd9a0;
    --ok-bg: #0f2a20;
    --warn: #efc36e;
    --warn-bg: #2e240d;
    --bad: #f49aa6;
    --bad-bg: #35161c;
    --info: #8fb6f5;
    --info-bg: #11233f;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.03), 0 14px 30px -18px rgba(0, 0, 0, 0.7);
    --shadow-btn: 0 8px 18px -10px rgba(169, 139, 250, 0.55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000;
  --surface: #16181c;
  --ink: #e7e9ea;
  --muted: #8b98a5;
  --field-line: #6b7780;
  --line: #2f3336;
  --accent: #a98bfa;
  --accent-ink: #160f33;
  --accent-soft: #221d3a;
  --ok: #6fd9a0;
  --ok-bg: #0f2a20;
  --warn: #efc36e;
  --warn-bg: #2e240d;
  --bad: #f49aa6;
  --bad-bg: #35161c;
  --info: #8fb6f5;
  --info-bg: #11233f;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03), 0 14px 30px -18px rgba(0, 0, 0, 0.7);
  --shadow-btn: 0 8px 18px -10px rgba(169, 139, 250, 0.55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  margin: 0;
}
.app { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 100%; }
.wrap { max-width: 1120px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.main { min-width: 0; padding-block: 18px 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Cabecera de la página */
.top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.top h1 { font-family: var(--font-display); font-weight: 800; font-size: 1.6rem; line-height: 1.1; letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
.top p { margin: 4px 0 0; color: var(--muted); }

/* Menú lateral */
.sidebar { background: var(--surface); border-bottom: 1px solid var(--line); padding-block: 14px 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; font-size: 1.25rem; box-shadow: var(--shadow-btn); }
.brand strong { display: block; font-weight: 800; font-size: 1.1rem; letter-spacing: -0.01em; line-height: 1.15; }
.brand small { display: block; color: var(--muted); font-size: 0.8rem; }
.btn {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 9px 16px;
  font-weight: 700;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: var(--shadow-btn); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 6px 12px; font-size: 0.86rem; border-radius: 10px; }

/* Resumen (mismo aspecto que las ilustraciones de la página de inicio) */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kpi { position: relative; display: flex; flex-direction: column; align-items: flex-start; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; min-width: 0; width: 100%; transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease; }
.kpi::after { content: "\2192"; position: absolute; top: 14px; right: 16px; color: var(--muted); font-weight: 700; transition: transform 0.18s ease, color 0.18s ease; }
.kpi:hover, .kpi:focus-visible { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); }
.kpi:hover::after, .kpi:focus-visible::after { color: var(--accent); transform: translateX(3px); }
.kpi small { display: block; color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.kpi strong { display: block; font-family: var(--font-display); font-size: 2rem; line-height: 1.1; font-weight: 800; letter-spacing: -0.03em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi em { font-style: normal; }
.kpi strong { font-size: 2.6rem; margin: auto 0 0; }
.kpi-d { display: block; color: var(--muted); font-size: 0.82rem; margin: 2px 0 12px; }
.kpi.warn strong { color: var(--warn); }
.kpi.bad strong { color: var(--bad); }
.kpi.ok strong { color: var(--ok); }
.bar { height: 6px; border-radius: 999px; background: var(--accent-soft); margin-top: 8px; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }

/* ===== CSS de los módulos (cada uno en su hueco) ===== */
/* Fichas: inquilino y contrato */
.fic-box { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.fic-h { font-family: var(--font-display); font-weight: 800; font-size: 1rem; margin: 0 0 4px; }
.fic-sub { color: var(--muted); font-size: 0.86rem; margin: 0 0 12px; }
.fic-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.fic-hint { color: var(--muted); font-size: 0.82rem; }
.fic-ct { margin-top: 6px; font-size: 0.84rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; overflow-wrap: anywhere; }
.fic-ct a { color: var(--accent); font-weight: 600; text-decoration: none; }
.fic-ct a:hover { text-decoration: underline; }
.room .rm-acts a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.fic-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.fic-aj-txt { width: 100%; min-height: 320px; font-family: ui-monospace, Consolas, monospace; font-size: 0.84rem; line-height: 1.5; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; resize: vertical; box-sizing: border-box; }
.fic-aj-cmp { font-size: 0.84rem; color: var(--muted); margin: 0; overflow-wrap: anywhere; }
.fic-aj-cmp code { background: var(--bg); border-radius: 6px; padding: 1px 5px; color: var(--ink); }
.fic-msg { font-size: 0.88rem; min-height: 1.2em; }
.fic-msg.mal { color: var(--bad); }
body.lector #fic-aj-edit { display: none !important; }
/* --- Cobros, fianzas y suministros --- */
.cob-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.cob-tab { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 8px 18px; font-weight: 700; }
.cob-tab:hover { border-color: var(--accent); color: var(--ink); }
.cob-tab[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
#cob-panel { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
#cob-panel:focus { outline: none; }
.cob-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cob-mes { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; min-width: 11ch; text-align: center; }
.cob-bar .spacer { flex: 1; }
.cob-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 12px; }
.cob-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; min-width: 0; }
.cob-kpi small { display: block; color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.cob-kpi strong { display: block; font-family: var(--font-display); font-size: 1.7rem; line-height: 1.15; font-weight: 800; letter-spacing: -0.03em; margin-top: 4px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cob-kpi.ok strong { color: var(--ok); } .cob-kpi.warn strong { color: var(--warn); } .cob-kpi.bad strong { color: var(--bad); }
.cob-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.cob-card.alerta { border-color: var(--bad); }
.cob-card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; margin-bottom: 8px; }
.cob-card-head h3 { font-family: var(--font-display); font-weight: 800; font-size: 1rem; margin: 0; overflow-wrap: anywhere; }
.cob-card-head small { color: var(--muted); font-variant-numeric: tabular-nums; }
.cob-row { display: grid; grid-template-columns: minmax(0, 1.2fr) 90px minmax(0, 1fr) minmax(0, 1.7fr); gap: 8px 14px; align-items: center; padding: 10px 0 10px 12px; border-top: 1px solid var(--line); border-left: 4px solid var(--line); margin-top: -1px; }
.cob-row:first-of-type { border-top: 0; }
.cob-row.st-pagado { border-left-color: var(--ok); } .cob-row.st-pendiente { border-left-color: var(--warn); } .cob-row.st-impagado { border-left-color: var(--bad); }
.cob-row:focus { outline: none; }
.cob-who { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cob-who strong { overflow-wrap: anywhere; }
.cob-who small, .cob-sub { color: var(--muted); font-size: 0.82rem; overflow-wrap: anywhere; }
.cob-imp { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cob-est { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.cob-acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.cob-acts a.btn { text-decoration: none; display: inline-block; color: var(--ink); }
body.lector .cob-solo-edit { display: none !important; }
.cob-form { grid-column: 1 / -1; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 4px 12px 4px 0; }
.cob-aviso { background: var(--warn-bg); color: var(--warn); border-radius: 12px; padding: 10px 14px; font-weight: 600; }
.cob-aviso ul { margin: 6px 0 0; padding-left: 18px; font-weight: 500; }
.cob-tabla { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.cob-tabla th, .cob-tabla td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.cob-tabla th { color: var(--muted); font-size: 0.8rem; font-weight: 700; }
.cob-tabla td.n, .cob-tabla th.n { text-align: right; }
.cob-tabla tfoot td { font-weight: 800; border-bottom: 0; }
.cob-scroll { overflow-x: auto; }
.cob-hist { display: flex; flex-direction: column; gap: 10px; }
.cob-liq-fila { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.cob-liq-fila input { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; width: 100%; min-width: 0; }
.cob-liq-res { background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; margin-top: 10px; display: flex; flex-direction: column; gap: 4px; font-variant-numeric: tabular-nums; }
.cob-liq-res strong { font-size: 1.15rem; }
@media (max-width: 700px) {
  .cob-row { grid-template-columns: minmax(0, 1fr) auto; }
  .cob-est { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
  .cob-acts { grid-column: 1 / -1; justify-content: flex-start; }
}
/*@@CSS:cobros@@*/
/*@@CSS:informes@@*/
/* --- Buscador global (bus) --- */
.bus-btn { display: none; align-items: center; gap: 10px; width: 100%; background: var(--bg); color: var(--muted); border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; font-weight: 600; font-size: 0.92rem; text-align: left; }
.bus-btn svg, #bus-btn-m svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bus-btn span { flex: 1; }
.bus-btn kbd { font: 700 0.7rem/1 var(--font-body, inherit); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; background: var(--surface); color: var(--muted); }
.bus-btn:hover { color: var(--ink); border-color: var(--accent); }
#bus-btn-m { display: inline-flex; align-items: center; justify-content: center; padding: 6px 9px; }
@media (min-width: 960px) { .bus-btn { display: flex; } #bus-btn-m { display: none; } }
body.portal-on .bus-btn, body.portal-on #bus-btn-m { display: none !important; }
.modal.bus-modal { z-index: 55; }
.bus-box { max-width: 640px; margin-block: 4vh auto; }
.bus-box .search { flex: none; width: 100%; display: block; font-size: 1rem; }
.bus-res { margin-top: 12px; max-height: min(60vh, 520px); overflow-y: auto; }
.bus-g { margin-bottom: 10px; }
.bus-gt { font-size: 0.74rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin: 8px 4px 4px; }
.bus-it { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 10px; padding: 8px 10px; cursor: pointer; color: var(--ink); min-width: 0; }
.bus-it b { display: block; font-weight: 700; overflow-wrap: anywhere; }
.bus-it small { display: block; color: var(--muted); overflow-wrap: anywhere; }
.bus-it.on, .bus-it:hover { background: var(--accent-soft); }
.bus-it mark { background: var(--accent-soft); color: var(--accent); border-radius: 3px; padding: 0 1px; font-weight: 800; }
.bus-it.on mark, .bus-it:hover mark { background: var(--accent); color: var(--accent-ink); }
.bus-mas { margin: 2px 4px 0; font-size: 0.86rem; }
.bus-vacio { padding: 18px 8px; text-align: center; color: var(--muted); }
.bus-ayuda { margin: 10px 2px 0; font-size: 0.78rem; color: var(--muted); }
.bus-flash { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 12px; }
/* --- Proveedores (Ajustes) --- */
.prv-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.prv-item { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-start; justify-content: space-between; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.prv-main { min-width: 0; flex: 1 1 220px; display: flex; flex-direction: column; gap: 2px; }
.prv-main b { overflow-wrap: anywhere; }
.prv-main small { color: var(--muted); font-size: 0.84rem; overflow-wrap: anywhere; }
.prv-links { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.88rem; margin-top: 4px; }
.prv-links a { color: var(--accent); font-weight: 600; overflow-wrap: anywhere; }
.prv-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.prv-form { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.prv-form .field input, .prv-form .field textarea { background: var(--surface); }
body.lector .prv-acts, body.lector #prv-add { display: none !important; }
/* --- Incidencias: coste, fotos y avisos --- */
.inf-box { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.inf-avisos { display: flex; flex-wrap: wrap; gap: 8px; }
.inf-avisos a.btn { text-decoration: none; display: inline-block; }
.inf-file-lab { cursor: pointer; }
.inf-file-lab:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.tk .tk-extra { color: var(--muted); }
/* --- Informes --- */
.inf { display: flex; flex-direction: column; gap: 18px; }
.inf-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.inf-mes { display: inline-flex; align-items: center; gap: 6px; }
.inf-mes-n { min-width: 9em; text-align: center; font-weight: 800; text-transform: capitalize; }
.inf-bar .spacer { flex: 1 1 0; }
.inf-bar .btn[disabled] { opacity: 0.5; cursor: default; }
.inf-bar .btn[disabled]:hover { border-color: var(--line); }
.inf-head h2 { font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; margin: 0; text-wrap: balance; }
.inf-head p { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; }
.inf-sec { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.inf-h { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; margin: 0; }
.inf-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.inf-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; min-width: 0; display: flex; flex-direction: column; }
.inf-kpi small { color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.inf-kpi strong { font-family: var(--font-display); font-size: 2rem; line-height: 1.1; font-weight: 800; letter-spacing: -0.03em; margin-top: 4px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.inf-kpi .kpi-d { margin: 2px 0 0; }
.inf-kpi.ok strong { color: var(--ok); }
.inf-kpi.warn strong { color: var(--warn); }
.inf-kpi.bad strong { color: var(--bad); }
.inf-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.inf-grid .cc.wide { grid-column: 1 / -1; }
@media (max-width: 860px) { .inf-grid { grid-template-columns: minmax(0, 1fr); } }
.inf .row .tx b, .inf .row .tx small { white-space: normal; overflow: visible; text-overflow: clip; }
.inf .rows { gap: 8px; }
.inf-note { margin: 0; color: var(--muted); font-size: 0.9rem; background: var(--surface); border: 1px dashed var(--line); border-radius: 14px; padding: 14px; }
.inf-pie { color: var(--muted); font-size: 0.82rem; margin: 0; }
@media print {
  :root, :root:not([data-theme="light"]), :root[data-theme="dark"] {
    --bg: #fff; --surface: #fff; --ink: #1b1736; --muted: #555170; --line: #cfcbe0; --accent: #6d3fe0; --accent-soft: #efe9fd;
    --ok: #136b42; --ok-bg: #def5e8; --warn: #8a5204; --warn-bg: #fdefd2; --bad: #b42a3a; --bad-bg: #fde5e8; --info: #2559c4; --info-bg: #e2ebfc;
    color-scheme: light;
  }
  @page { margin: 14mm; }
  .inf-print .top { display: none !important; }
  .inf-noprint { display: none !important; }
  .inf { gap: 14px; }
  .inf-sec { break-inside: auto; }
  .inf-h { break-after: avoid; }
  .inf-kpi, .cc, .inf-note, .inf .row { break-inside: avoid; }
  .inf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inf-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .inf-kpi strong { font-size: 1.5rem; }
  body, .main { background: #fff !important; }
  .inf svg, .inf .br-fill, .inf .sb-s, .inf .dot, .inf .pill { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
/*@@CSS:historial@@*/
.his-staging { position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 9999; background: #b45309; color: #fff; font-weight: 800; font-size: 0.78rem; letter-spacing: 0.08em; padding: 3px 16px; border-radius: 0 0 10px 10px; box-shadow: 0 2px 8px rgba(0,0,0,.3); pointer-events: none; }
.his-staging[hidden] { display: none; }
.his-toggle { display: flex; align-items: flex-start; gap: 12px; width: 100%; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; color: inherit; }
.his-toggle .his-chev { margin-left: auto; align-self: center; transition: transform .15s; color: var(--muted); }
.his-toggle[aria-expanded="true"] .his-chev { transform: rotate(180deg); }
.his-body { display: flex; flex-direction: column; gap: 12px; }
.his-body[hidden], #aj-historial[hidden] { display: none; }
.his-filtros { display: flex; flex-wrap: wrap; gap: 8px; }
.his-filtros select { flex: 1 1 140px; min-width: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; }
.his-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.his-item { display: grid; grid-template-columns: 8px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.his-item:first-child { border-top: 0; }
.his-punto { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: var(--accent); }
.his-item.crear .his-punto { background: var(--ok); }
.his-item.borrar .his-punto { background: var(--bad); }
.his-meta { color: var(--muted); font-size: 0.8rem; }
.his-txt { overflow-wrap: anywhere; font-size: 0.92rem; margin-top: 2px; }
.his-txt b { font-weight: 700; }
.his-msg { color: var(--muted); font-size: 0.86rem; }
/*@@CSS:portales@@*/
#portal { min-height: 100vh; }
.por-wrap { max-width: 980px; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-right, 0px)) 56px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 16px; }
.por-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.por-top .brand small { overflow-wrap: anywhere; }
.por-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.por-cuerpo { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.por-bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 14px; }
.por-bar h1 { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; line-height: 1.1; letter-spacing: -0.02em; margin: 0; }
.por-bar p { margin: 4px 0 0; color: var(--muted); }
.por-bar .por-ctl { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.por-bar .field select { min-width: 160px; }
.por-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 700px) { .por-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.por-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; min-width: 0; }
.por-kpi small { display: block; color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.por-kpi strong { display: block; font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.por-kpi.ok strong { color: var(--ok); } .por-kpi.warn strong { color: var(--warn); } .por-kpi.bad strong { color: var(--bad); }
.por-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.por-card h2, .por-card h3 { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; margin: 0; overflow-wrap: anywhere; }
.por-card h4 { margin: 0; font-size: 0.9rem; }
.por-sub { color: var(--muted); font-size: 0.84rem; }
.por-sum { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.84rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.por-sum strong { color: var(--ink); }
.por-room-l { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.por-room .pill { background: var(--surface); margin: 4px 0 0; align-self: flex-start; }
.por-inc { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.por-inc .tx { flex: 1 1 180px; min-width: 0; }
.por-inc .tx b { display: block; font-size: 0.9rem; overflow-wrap: anywhere; }
.por-inc .tx small { color: var(--muted); font-size: 0.8rem; }
.por-dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0; }
.por-dl div { background: var(--bg); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.por-dl dt { color: var(--muted); font-size: 0.78rem; font-weight: 600; }
.por-dl dd { margin: 2px 0 0; font-weight: 700; overflow-wrap: anywhere; }
.por-tabla { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.por-tabla th, .por-tabla td { text-align: left; padding: 8px 6px; border-top: 1px solid var(--line); }
.por-tabla th { color: var(--muted); font-size: 0.78rem; font-weight: 700; border-top: 0; }
.por-tabla td.n, .por-tabla th.n { text-align: right; }
.por-form { display: grid; gap: 10px; }
.por-form .btn { justify-self: start; }
.por-msg { font-size: 0.88rem; color: var(--ok); min-height: 1.2em; }
.por-msg.bad { color: var(--bad); }
.por-cargando { color: var(--muted); text-align: center; padding: 24px; }
.por-sel-card { max-width: 440px; }
.por-lista { display: grid; gap: 8px; }
.por-emp { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.por-emp:hover, .por-emp.sel { border-color: var(--accent); }
.por-emp .tx { flex: 1; min-width: 0; }
.por-emp .tx b { display: block; overflow-wrap: anywhere; }
.por-emp .tx small { color: var(--muted); }
.por-checks { display: grid; gap: 4px; max-height: 190px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; background: var(--bg); }
.por-checks label { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--ink); font-weight: 500; }
.por-checks input { width: auto; flex: none; }
#mu-form .field.por-wide { flex: 1 1 100%; }
#mu-form .por-checks label { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 10px; min-height: 32px; text-align: left; }
#mu-form .por-checks input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; padding: 0; margin: 0; flex: none; accent-color: var(--accent); }

/* Pestañas: fila en el móvil, menú lateral en pantallas grandes */
.tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(66px, 1fr); gap: 2px; background: var(--surface); border: 1px solid var(--line); padding: 4px; border-radius: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; background: none; border: 0; border-radius: 11px; padding: 8px 1px; font-weight: 600; font-size: 0.68rem; line-height: 1.15; text-align: center; min-width: 0; color: var(--muted); }
.tab[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 800; }
.tab svg, .ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab .n { position: absolute; top: 2px; right: 4px; min-width: 16px; padding: 0 4px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 0.66rem; font-weight: 700; line-height: 16px; text-align: center; }
.tab[aria-selected="true"] .n { background: var(--accent); color: var(--accent-ink); }
.tab .n:empty { display: none; }
@media (min-width: 960px) {
  .app { grid-template-columns: 240px minmax(0, 1fr); }
  .app { height: 100vh; overflow: hidden; }
  .main { height: 100vh; overflow-y: auto; overscroll-behavior: contain; }
  .sidebar { position: relative; top: 0; height: 100vh; overflow-y: auto; align-self: start; border-bottom: 0; border-right: 1px solid var(--line); padding: 22px 12px; gap: 22px; }
  .tabs { display: flex; flex-direction: column; gap: 4px; background: none; border: 0; padding: 0; overflow: visible; }
  .tab { flex-direction: row; gap: 10px; padding: 10px 12px; font-size: 0.95rem; line-height: 1.4; border-radius: 10px; text-align: left; }
  .tab:not([aria-selected="true"]):hover { background: var(--bg); color: var(--ink); }
  .tab svg { width: 20px; height: 20px; }
  .tab .n { position: static; margin-left: auto; }
  .brand { padding: 0 8px; }
  .logo { width: 34px; height: 34px; border-radius: 10px; font-size: 1.1rem; }
  .main { padding: 30px 36px 56px; }
  .top h1 { font-size: 2rem; }
}

/* Iconos en círculo de color */
.ico { flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; }
.ico-accent { background: var(--accent-soft); color: var(--accent); }
.ico-bad { background: var(--bad-bg); color: var(--bad); }
.ico-warn { background: var(--warn-bg); color: var(--warn); }
.ico-info { background: var(--info-bg); color: var(--info); }
.ico-ok { background: var(--ok-bg); color: var(--ok); }

/* Formularios */
.form { background: var(--surface); border: 1px solid var(--accent); border-radius: 18px; padding: 20px; scroll-margin-top: 12px; box-shadow: var(--shadow); }
.form h2 { font-family: var(--font-display); font-size: 1.2rem; margin: 0 0 12px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  width: 100%;
  min-width: 0;
}
.field textarea { resize: vertical; min-height: 64px; }
.check { flex-direction: row; align-items: center; gap: 8px; padding-top: 22px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.check label { color: var(--ink); font-size: 0.95rem; }
.tenant { display: contents; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }
.form-actions .spacer { flex: 1; }
.error { color: var(--bad); font-size: 0.88rem; margin-top: 10px; min-height: 1em; }

/* Búsqueda y filtros */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.search { flex: 1 1 220px; min-width: 0; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a86a8' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat 14px center / 18px; border: 1px solid var(--line); border-radius: 14px; padding: 11px 14px 11px 42px; box-shadow: var(--shadow); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 14px; font-size: 0.88rem; font-weight: 600; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-btn); }
.count { color: var(--muted); font-size: 0.86rem; margin: -4px 2px 10px; }
.fbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.fbar .search { flex: 1 1 100%; }
.fgroup { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.fgroup .lbl { font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.fbar .count { margin: 0; }

/* Para actuar ya */
.dash { display: flex; flex-direction: column; gap: 18px; }
.prio-wrap { display: flex; flex-direction: column; gap: 10px; }
.prio-title { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; margin: 0; }
.glance, .d-act { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; align-items: stretch; }
.glance > #d-ocup { grid-column: span 5; display: flex; }
.glance > #d-ocup > .cc { flex: 1; }
.glance > .kpis { grid-column: span 7; }
.d-act > :first-child { grid-column: span 7; }
.d-act > :last-child { grid-column: span 5; }
@media (max-width: 860px) {
  .glance > #d-ocup, .glance > .kpis, .d-act > :first-child, .d-act > :last-child { grid-column: 1 / -1; }
}
.top-acts { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 600px) { .top-acts { width: 100%; } .top-acts .btn { flex: 1 1 auto; } }
.live { white-space: nowrap; }
.live::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 6px; vertical-align: 1px; }
.at-card { gap: 10px; }
.at-tabs { display: flex; gap: 2px; overflow-x: auto; overflow-y: hidden; border-bottom: 1px solid var(--line); margin: 0 -4px; padding: 0 4px; scrollbar-width: none; }
.at-tabs::-webkit-scrollbar { display: none; }
.at-tab { flex: none; display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 8px 12px; font-weight: 700; font-size: 0.9rem; color: var(--muted); white-space: nowrap; border-radius: 8px 8px 0 0; }
.at-tab:hover { color: var(--ink); }
.at-tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.at-n { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 0 8px; font-size: 0.76rem; font-variant-numeric: tabular-nums; line-height: 1.6; }
.at-tab:not([aria-selected="true"]) .at-n { background: var(--bg); color: var(--muted); }
.at-panel { display: flex; flex-direction: column; gap: 12px; flex: 1; }
.at-panel .prio-more { margin-top: auto; }
.rows > li { min-width: 0; }
.prio-card, .cc, .piso-card, .aj-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; min-width: 0; }
.prio-card { display: flex; flex-direction: column; gap: 12px; }
.mc-h { margin: 0; font-size: 0.95rem; font-weight: 800; letter-spacing: -0.005em; display: flex; justify-content: space-between; gap: 8px; }
.mc-h span { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.mc-sub { margin: -8px 0 0; color: var(--muted); font-size: 0.8rem; }
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.row { display: flex; align-items: center; gap: 10px; min-width: 0; }
button.row { width: 100%; text-align: left; background: none; border: 0; border-radius: 10px; padding: 6px 8px; margin: 0 -8px; width: calc(100% + 16px); }
button.row:hover { background: var(--bg); }
.av { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 800; font-size: 0.76rem; flex: none; }
.row .tx { min-width: 0; flex: 1; }
.row .tx b { display: block; font-size: 0.9rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .tx small { display: block; font-size: 0.8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sev { width: 8px; align-self: stretch; min-height: 34px; border-radius: 4px; flex: none; }
.sev.bad { background: var(--bad); } .sev.warn { background: var(--warn); } .sev.info { background: var(--info); }
.prio-more { align-self: flex-start; }
.prio-empty { margin: 0; color: var(--muted); font-size: 0.9rem; }

/* Datos y documentos del piso */
.pc-info { color: var(--muted); font-size: 0.86rem; margin-top: 2px; overflow-wrap: anywhere; }
.pc-info strong { color: var(--ink); font-weight: 600; }
.pc-docs { display: flex; flex-direction: column; gap: 6px; }
.docs-box { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.docs-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
.docs-hint { color: var(--muted); font-size: 0.84rem; }
.docs-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.docs-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
.docs-list a { color: var(--accent); font-weight: 600; overflow-wrap: anywhere; flex: 1 1 160px; min-width: 0; }
.docs-size { color: var(--muted); font-size: 0.84rem; font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.docs-nombre { flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
#md-lista { margin: 12px 0; }
.docs-none { color: var(--muted); font-size: 0.9rem; }
.docs-add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.docs-add input[type="file"] { max-width: 100%; min-width: 0; }
.docs-msg { font-size: 0.86rem; color: var(--muted); }
.docs-msg.bad { color: var(--bad); }

.rooms-box { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.rooms-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.rooms-rows { display: flex; flex-direction: column; gap: 6px; }
.rrow { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 8px; }
.rrow input, .rrow select { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; min-width: 0; }
@media (max-width: 700px) { .rrow { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

.prio-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; }
.aviso { background: var(--ok-bg); color: var(--ok); border-radius: 14px; padding: 10px 14px; font-weight: 600; }
.nota { background: var(--accent-soft); color: var(--ink); font-size: 0.88rem; border-radius: 10px; padding: 5px 9px; margin-top: 6px; overflow-wrap: anywhere; }
.nota-meta { display: block; font-size: 0.76rem; font-weight: 600; color: var(--muted); }

/* Ventana de cambio de estado */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(8, 20, 23, 0.55);
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto;
  padding-block: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.modal-box { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 20px; padding: 20px; box-shadow: var(--shadow); width: 100%; max-width: 560px; margin-block: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.modal-head h2 { font-family: var(--font-display); font-size: 1.2rem; margin: 0; text-wrap: balance; }
.field .flabel { font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.me-actual { min-height: 38px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.me-cuenta { font-size: 0.82rem; color: var(--muted); min-height: 1.1em; }
.me-hist { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; font-size: 0.86rem; color: var(--muted); }
.me-hist strong { color: var(--ink); }
.me-hist:empty { display: none; }

.fields + .fields { margin-top: 12px; }
.c-name { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.piso-ref { color: var(--muted); font-size: 0.82rem; overflow-wrap: anywhere; }
.stack > .room { background: var(--surface); box-shadow: var(--shadow); }
.vista-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chooser { margin-bottom: 12px; }
#piso-form.esperando > .fields, #piso-form.esperando > .rooms-box, #piso-form.esperando > .docs-box, #piso-form.esperando > .error { display: none; }
#piso-form.esperando button[type="submit"], #piso-form.esperando #fp-eliminar { display: none; }
.rrow-nombre { font-weight: 600; align-self: center; padding: 0 4px; }
.rrow-estado { display: flex; align-items: center; }

/* Etiquetas de estado (el color sale del tono de cada estado) */
.pill { display: inline-block; flex: none; font-size: 0.76rem; font-weight: 700; line-height: 1.5; border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.t-libre, .p-acc { background: var(--accent-soft); color: var(--accent); }
.t-ok, .p-ok { background: var(--ok-bg); color: var(--ok); }
.t-info, .p-info { background: var(--info-bg); color: var(--info); }
.t-warn, .p-warn { background: var(--warn-bg); color: var(--warn); }
.t-bad, .p-bad { background: var(--bad-bg); color: var(--bad); }

/* Tarjeta de piso: cabecera, casillas de habitación por estado y leyenda */
.stack { display: flex; flex-direction: column; gap: 12px; }
.piso-card { display: flex; flex-direction: column; gap: 14px; }
.pc-head { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; }
.pc-title h3 { font-family: var(--font-display); font-weight: 800; font-size: 1rem; margin: 0; overflow-wrap: anywhere; }
.pc-sub { color: var(--muted); font-size: 0.82rem; }
.pc-occ { font-size: 0.84rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.pc-occ strong { color: var(--ink); }
.pc-occ .pill { margin-bottom: 6px; }
.flat-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.flat-head b { font-size: 1rem; font-weight: 800; }
.flat-head small { color: var(--muted); font-size: 0.82rem; display: block; }
.acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.nohab { color: var(--muted); font-size: 0.88rem; }
.pc-detail { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.rooms.full { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
@media (max-width: 480px) { .rooms { grid-template-columns: repeat(2, minmax(0, 1fr)); } .rooms.full { grid-template-columns: minmax(0, 1fr); } }
.mini-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.mini-legend span { display: inline-flex; align-items: center; gap: 6px; }
.mini-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }

/* Habitación: casilla coloreada por estado (el color sale de t-ok, t-bad, t-info, t-warn) */
.room { border-radius: 14px; padding: 12px; min-width: 0; display: flex; flex-direction: column; gap: 2px; border: 1px solid transparent; }
.room b { display: block; font-size: 0.92rem; font-weight: 800; }
.room small { display: block; font-size: 0.8rem; opacity: 0.95; overflow-wrap: anywhere; line-height: 1.35; }
.room small strong { font-weight: 700; }
.room .pill { background: var(--surface); margin-left: 4px; }
.room .inc-aviso { font-weight: 700; }
.room .nota { margin-top: 6px; padding: 5px 8px; font-size: 0.8rem; background: var(--surface); color: var(--ink); }
.room .nota-meta { display: inline; margin-right: 6px; }
.room .rm-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.room .btn { color: var(--ink); }
.room .btn.small { padding: 4px 10px; font-size: 0.8rem; }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: 14px; padding: 24px; text-align: center; color: var(--muted); }

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 0.84rem; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; font-size: inherit; }

/* Incidencias */
/* Tablero de incidencias: cinco columnas, una por estado */
.board { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 640px) { .board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .board { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (min-width: 960px) and (max-width: 1299px) { .board { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(210px, 1fr); overflow-x: auto; padding-bottom: 8px; } }
.col { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; min-width: 0; }
.col h3 { margin: 0 0 10px; font-size: 0.86rem; font-weight: 800; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.col h3 span { color: var(--muted); font-weight: 700; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.col-vacia { margin: 0; padding: 10px 8px; text-align: center; color: var(--muted); font-size: 0.8rem; border: 1px dashed var(--line); border-radius: 12px; }
.tk { display: block; width: 100%; text-align: left; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease; }
.tk:last-child { margin-bottom: 0; }
.tk:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent); }
body.lector .tk { cursor: default; }
.tk b { display: block; font-size: 0.9rem; font-weight: 700; overflow-wrap: anywhere; }
.tk small { display: block; color: var(--muted); font-size: 0.8rem; margin: 2px 0 0; overflow-wrap: anywhere; }
.tk .tk-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 8px; }
.tk .tk-pills small { margin: 0; }
.tk.done b { text-decoration: line-through; text-decoration-color: var(--muted); color: var(--muted); }
.room .inc-aviso { font-weight: 700; }
.i-res { grid-column: 1 / -1; }
@media (max-width: 700px) {
  .kpi-main { grid-column: 1 / -1; }
  .pc-head { grid-template-columns: minmax(0, 1fr); }
  .pc-head .acts { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } .kpi:hover, .kpi:focus-visible, .kpi:hover::after, .kpi:focus-visible::after { transform: none; } }
[data-tip]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Pantallas de entrada y avisos */
.pantalla { min-height: 100vh; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); color: var(--muted); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px; color: var(--ink); }
.login-card .btn { width: 100%; padding: 12px 16px; }
.login-card p { margin: 0; color: var(--muted); }
.userbox { display: flex; align-items: center; gap: 10px; position: absolute; top: 14px; right: max(16px, env(safe-area-inset-right, 0px)); }
.userbox #user-email { display: none; color: var(--muted); font-size: 0.84rem; overflow-wrap: anywhere; }
.userbox-btns { display: flex; align-items: center; gap: 8px; }
.ajbtn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 6px 9px; }
.ajbtn svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ajbtn .ajbtn-t { display: none; }
.ajbtn[aria-current="page"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.sidebar { position: relative; }
@media (min-width: 960px) {
  .userbox { position: static; margin-top: auto; flex-direction: column; align-items: stretch; gap: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
  .userbox #user-email { display: block; }
  .userbox-btns .ajbtn { flex: 1; padding: 6px 12px; }
  .ajbtn .ajbtn-t { display: inline; }
}
.syncbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(16px, env(safe-area-inset-bottom, 0px)); z-index: 60; max-width: min(520px, calc(100vw - 32px)); background: var(--warn-bg); color: var(--warn); border-radius: 14px; padding: 10px 16px; font-weight: 600; box-shadow: var(--shadow); }
.syncbar.mal { background: var(--bad-bg); color: var(--bad); }
.syncbar.bien { background: var(--ok-bg); color: var(--ok); }
.login-card .linklike { align-self: center; font-size: 0.9rem; }
.info-ok { color: var(--ok); font-size: 0.9rem; }
/* ===== ENTRADA (prefijo ent-): cargando, entrar, crear cuenta, recuperar, nueva contraseña, invitaciones, sin empresa y selector de empresa ===== */
.pantalla.ent { position: relative; isolation: isolate; overflow: clip; min-height: 100vh; min-height: 100dvh; background: var(--bg); }
.pantalla.ent.np-flot { position: fixed; inset: 0; z-index: 60; overflow-y: auto; background: rgba(8, 20, 23, 0.55); }
.pantalla.ent.np-flot::before, .pantalla.ent.np-flot .ent-marca { display: none; }
.pantalla.ent::before { content: ""; position: absolute; left: 50%; top: -300px; width: min(1000px, 170vw); height: 700px; transform: translateX(-50%); background: radial-gradient(closest-side, var(--accent-soft), transparent); z-index: -1; pointer-events: none; }
.ent-col { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 18px; }
#invitaciones .ent-col, #selector-empresa .ent-col { max-width: 460px; }
.ent-marca { align-self: center; display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 1.1rem; letter-spacing: -0.01em; border-radius: 12px; }
.rlogo { display: block; width: auto; max-width: 100%; }
.rlogo-o { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .rlogo-c { display: none; } :root:not([data-theme="light"]) .rlogo-o { display: block; } }
:root[data-theme="dark"] .rlogo-c { display: none; }
:root[data-theme="dark"] .rlogo-o { display: block; }
.ent-marca .rlogo { height: 48px; }
.ent .login-card { max-width: none; padding: 28px; gap: 18px; border-radius: 22px; }
@media (max-width: 440px) { .ent .login-card { padding: 22px 18px; } }
.ent-head { display: flex; flex-direction: column; gap: 6px; }
.ent-head h1 { margin: 0; font-size: 1.5rem; line-height: 1.2; letter-spacing: -0.025em; font-weight: 800; text-wrap: balance; overflow-wrap: anywhere; }
.ent-head p { font-size: 0.95rem; line-height: 1.5; }
.ent-ico { width: 48px; height: 48px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 8px; }
.ent-ico svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ent .field { gap: 6px; }
.ent .field label { color: var(--ink); font-size: 0.88rem; font-weight: 700; }
.ent .field input { min-height: 48px; font-size: 1rem; padding: 11px 14px; border-radius: 12px; transition: border-color 0.15s, box-shadow 0.15s, background 0.15s; }
.ent .field input { border-color: var(--muted); border-color: color-mix(in srgb, var(--muted) 65%, var(--line)); }
.ent .field input:hover { border-color: var(--muted); }
.ent .inv-lista .tx small { white-space: normal; overflow: visible; text-overflow: clip; }
.ent .field input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 5px var(--accent-soft); }
.ent-pass { position: relative; }
.ent-pass input { padding-right: 52px; }
.ent-ojo { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; background: none; color: var(--muted); border-radius: 10px; display: grid; place-items: center; }
.ent-ojo:hover { color: var(--ink); background: var(--accent-soft); }
.ent-ojo svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ent-tacha { display: none; }
.ent-ojo[aria-pressed="true"] .ent-tacha { display: inline; }
.ent .login-card .btn { min-height: 48px; border-radius: 14px; font-size: 1rem; }
.ent .login-card .btn.primary:hover { transform: translateY(-1px); }
.ent .login-card .btn:disabled { opacity: 0.65; cursor: progress; filter: none; transform: none; }
.ent .login-card .error { margin: 0; }
.ent .login-card .error:not(:empty) { background: var(--bad-bg); padding: 10px 14px; border-radius: 12px; font-weight: 600; }
.ent .login-card .info-ok:not(:empty) { background: var(--ok-bg); padding: 10px 14px; border-radius: 12px; font-weight: 600; }
.ent .login-card .error:empty, .ent .login-card .info-ok:empty { min-height: 0; height: 0; margin: -8px 0; padding: 0; }
.ent-alta { display: grid; gap: 10px; justify-items: stretch; text-align: center; margin-top: 4px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.95rem; }
.ent-links { display: flex; flex-direction: column; align-items: center; margin-top: -6px; }
.ent .login-card .linklike { text-decoration: none; font-weight: 600; font-size: 0.92rem; min-height: 44px; padding: 0 8px; display: inline-flex; align-items: center; border-radius: 8px; text-align: center; }
.ent .login-card .linklike:hover { text-decoration: underline; text-underline-offset: 3px; }
.ent-pie { margin: 0; text-align: center; font-size: 0.85rem; color: var(--muted); }
.ent-pie a { color: var(--muted); font-weight: 600; text-underline-offset: 3px; }
.ent-pie a:hover { color: var(--accent); }
.ent-carga .ent-load { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.ent-load p { margin: 0; font-weight: 600; }
.ent-load .logo { width: 48px; height: 48px; border-radius: 14px; font-size: 1.5rem; }
.ent-spin { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: ent-giro 0.8s linear infinite; }
@keyframes ent-giro { to { transform: rotate(360deg); } }
.ent .inv-lista { gap: 10px; }
.ent .inv-lista .row { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 12px; gap: 10px 12px; }
.ent .inv-lista .row-end { display: flex; gap: 8px; }
.ent .inv-lista .btn { flex: 1 1 0; width: auto; min-height: 44px; padding: 0 16px; font-size: 0.95rem; }
.ent .por-lista { gap: 10px; }
.ent .por-emp { min-height: 64px; padding: 12px 14px; position: relative; padding-right: 40px; transition: border-color 0.15s, background 0.15s; }
.ent .por-emp::after { content: ""; position: absolute; right: 18px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-top: 2px solid var(--muted); transform: translateY(-50%) rotate(45deg); }
.ent .por-emp:hover { background: var(--accent-soft); }
.ent .por-emp.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ent .por-emp .logo { width: 40px; height: 40px; border-radius: 12px; font-size: 1.1rem; }
.ent .por-emp .pill { margin-right: 4px; }
.ent .por-emp:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* ===== fin ENTRADA ===== */
.docs-list select { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; color: var(--ink); }
.mu-sub { font-size: 0.95rem; margin: 14px 0 6px; }
#mu-form { align-items: flex-end; margin-top: 4px; }
#mu-form .field { flex: 1 1 180px; }
.team { gap: 8px; }
.team .row { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; flex-wrap: wrap; }
.team .row .tx small { white-space: normal; }
.av.q { background: var(--warn-bg); color: var(--warn); }
.team .row-end { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.rol-sel { appearance: none; -webkit-appearance: none; border: 0; border-radius: 999px; padding: 3px 26px 3px 12px; font-weight: 700; font-size: 0.8rem; cursor: pointer; background-repeat: no-repeat; background-position: right 9px center; background-size: 10px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238a86a8' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E"); }
.rol-sel:disabled { cursor: default; }
.rol-sel option { background: var(--surface); color: var(--ink); }
#mu-form .field input, #mu-form .field select { background: var(--bg); }
/* Lectores: no ven los botones que cambian datos */
body.lector .top-acts, body.lector #btn-estado, body.lector #btn-inc-nueva, body.lector #btn-inc-add, body.lector #btn-add,
body.lector #btn-editar-piso, body.lector #btn-importar, body.lector #card-import, body.lector .docs-add, body.lector [data-d="quitar"],
body.lector .btn[data-act="editar-hab"], body.lector .btn[data-act="nueva-hab"],
body.lector .btn[data-act="editar-piso"], body.lector .btn[data-act="editar-inc"] { display: none !important; }
/* Ajustes */
.ajustes { display: flex; flex-direction: column; gap: 16px; }
.aj-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.prv-vista { display: flex; flex-direction: column; gap: 16px; }
.aj-card { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
.aj-head { display: flex; align-items: flex-start; gap: 12px; }
.aj-head h2 { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; margin: 0; }
.aj-head p { margin: 2px 0 0; color: var(--muted); font-size: 0.88rem; }
.aj-dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin: 0; }
.aj-dl > div { background: var(--bg); border-radius: 12px; padding: 10px 14px; min-width: 0; }
.aj-dl dt { font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.aj-dl dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.aj-note { margin: 0; background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; font-size: 0.92rem; }
.aj-admin { display: flex; flex-direction: column; gap: 4px; }
.aj-admin .mu-sub:first-child { margin-top: 0; }
.aj-card .dato { box-shadow: none; background: var(--bg); border-color: transparent; }
#form-imp { margin-bottom: 0; }
.datos-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.dato { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.dato p { margin: 0; color: var(--muted); font-size: 0.88rem; overflow-wrap: anywhere; }
.dato-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: auto; padding-top: 4px; }
.imp-list { margin: 8px 0 0; padding-left: 20px; font-size: 0.9rem; color: var(--muted); }
.imp-list li { margin: 2px 0; overflow-wrap: anywhere; }
#imp-pisos { list-style: none; padding-left: 0; color: var(--ink); }
#imp-pisos li { margin: 6px 0; }
.bad { color: var(--bad); }

/* Gráficos del panel (SVG y CSS; los colores salen de los mismos tokens que las etiquetas de estado) */
.an-hint { color: var(--muted); font-size: 0.86rem; font-weight: 600; }
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cc { display: flex; flex-direction: column; gap: 14px; }
.cc.wide { grid-column: 1 / -1; }
.cc-title { font-family: var(--font-display); font-weight: 800; font-size: 0.95rem; margin: 0; }
.cc-sub { margin: 2px 0 0; color: var(--muted); font-size: 0.84rem; }
.cc-stats { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.cc-stats .pill strong { font-variant-numeric: tabular-nums; }
.cc-h4 { font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 0; }
.cc-div { border: 0; border-top: 1px solid var(--line); margin: 0; }
.cc-empty { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px dashed var(--line); border-radius: 14px; color: var(--muted); font-size: 0.9rem; }
.tn-ok { --c: var(--ok); }
.tn-info { --c: var(--info); }
.tn-warn { --c: var(--warn); }
.tn-bad { --c: var(--bad); }
.tn-libre, .tn-accent { --c: var(--accent); }
.soft { opacity: 0.42; }
.mk { fill: var(--c); }
.mk-s { stroke: var(--c); transition: stroke-width 0.15s; }
.mk-s:hover { stroke-width: 16; }
.dot { flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.lg { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.lg li { display: flex; align-items: center; gap: 8px; font-size: 0.86rem; font-weight: 600; color: var(--muted); min-width: 0; }
.lg-n { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.lg-v { font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.lg-p { color: var(--muted); font-size: 0.82rem; min-width: 3.2ch; text-align: right; font-variant-numeric: tabular-nums; }
.occ { display: flex; align-items: center; justify-content: center; gap: 12px 26px; flex-wrap: wrap; padding-block: 8px; }
.occ .donut { width: 168px; max-width: 100%; height: auto; flex: none; }
.occ .lg { flex: 1 1 190px; }
.dash svg text { font-family: var(--font-body); font-variant-numeric: tabular-nums; }
.dn-track { stroke: var(--line); }
.dn-pct { fill: var(--ink); font-size: 26px; font-weight: 800; }
.dn-sub { fill: var(--muted); font-size: 9.5px; font-weight: 600; }
.colchart { width: 100%; height: auto; display: block; }
.ax-base { stroke: var(--line); stroke-width: 1; }
.ax-v { fill: var(--ink); font-size: 11px; font-weight: 700; }
.ax-l { fill: var(--muted); font-size: 10.5px; font-weight: 600; }
.ax-l.now { fill: var(--ink); font-weight: 800; }
.zero { fill: var(--line); }
.hit { fill: transparent; }
.hit:hover { fill: var(--accent-soft); fill-opacity: 0.45; }
.brs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.brs.compact { gap: 9px; }
.brs.compact .br-track { height: 6px; margin-top: 3px; }
.zl { margin-top: auto; }
.br-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 0.9rem; }
.br-l { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.br-l small { color: var(--muted); font-weight: 500; margin-left: 6px; font-size: 0.78rem; }
.br-v { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 0.84rem; }
.br-v strong { color: var(--ink); }
.br-track { height: 8px; border-radius: 999px; background: var(--accent-soft); margin-top: 5px; overflow: hidden; }
.br-fill { display: block; height: 100%; border-radius: 999px; background: var(--c, var(--accent)); }
.sb { display: flex; gap: 2px; height: 12px; border-radius: 999px; overflow: hidden; background: var(--line); }
.sb-s { flex: 1 1 0; min-width: 4px; background: var(--c); }
.inc-cols .lg { flex-direction: row; flex-wrap: wrap; gap: 4px 14px; }
.inc-cols .lg-n { flex: none; }
.inc-cols .lg-p { display: none; }
.inc-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.inc-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tip { position: fixed; z-index: 70; pointer-events: none; background: var(--ink); color: var(--surface); border-radius: 10px; padding: 6px 10px; font-size: 0.8rem; font-weight: 600; max-width: 240px; box-shadow: var(--shadow); }
@media (max-width: 860px) { .charts { grid-template-columns: minmax(0, 1fr); } }
/* ===== onboarding (onb), invitaciones (inv) y RGPD (rgp) ===== */
.onb { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); margin-bottom: 12px; }
.onb-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.onb-top h2 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; }
.onb-top p { margin: 2px 0 0; color: var(--muted); }
.onb-top .linklike { flex: none; color: var(--muted); font-size: 0.86rem; }
.onb-bar { height: 8px; border-radius: 999px; background: var(--accent-soft); margin: 12px 0; overflow: hidden; }
.onb-bar span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.onb-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.onb-paso { display: flex; gap: 12px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); }
.onb-paso.actual { border-color: var(--accent); background: var(--accent-soft); }
.onb-paso.hecho { opacity: 0.8; }
.onb-num { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 0.86rem; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.onb-paso.actual .onb-num { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.onb-paso.hecho .onb-num { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-bg); }
.onb-tx { min-width: 0; flex: 1; }
.onb-tx p { margin: 2px 0 8px; color: var(--muted); font-size: 0.92rem; }
.onb-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.inv-card { max-width: 480px; }
.inv-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.inv-lista .row { flex-wrap: wrap; }
.inv-lista .btn { width: auto; padding: 6px 12px; }
.inv-emp { font-size: 1.05rem; overflow-wrap: anywhere; }
.inv-lista small { color: var(--muted); overflow-wrap: anywhere; white-space: normal; text-overflow: clip; overflow: visible; display: block; }
.inv-lista .row-end { flex-basis: 100%; justify-content: flex-end; }
.rgp-box { margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--line); }
.rgp-t { margin: 0 0 4px; font-size: 0.82rem; font-weight: 700; color: var(--muted); }
.rgp-peligro { color: var(--bad); font-weight: 600; }
.rgp-nota { margin: 0; color: var(--muted); font-size: 0.86rem; }
.rgp-purga { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); }
.rgp-purga p { margin: 2px 0 8px; color: var(--muted); font-size: 0.92rem; }
.rgp-fila { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rgp-modal { position: fixed; inset: 0; z-index: 90; background: rgba(17, 15, 29, 0.55); display: grid; place-items: center; padding: 16px; }
.rgp-card { width: 100%; max-width: 440px; max-height: 90vh; overflow: auto; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); }
.rgp-card h2 { margin: 0 0 8px; font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; }
.rgp-card p { margin: 0 0 8px; }
/* ===== dis-core: pulido de las pantallas diarias (panel, habitaciones, pisos, incidencias) ===== */
.btn { transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.1s ease; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn.primary[disabled]:hover, .btn.primary:disabled:hover { filter: none; }
.btn.danger:hover { border-color: var(--bad); background: var(--bad-bg); }
.chip { transition: border-color 0.15s ease, color 0.15s ease; }
.chip:hover { border-color: var(--accent); color: var(--ink); }
.chip[aria-pressed="true"]:hover { color: var(--accent-ink); }
.tab { transition: background-color 0.15s ease, color 0.15s ease; }
@media (max-width: 959px) { .tab { font-size: 0.72rem; } }
@media (pointer: coarse) { .chip { padding: 10px 16px; } .btn:not(.small) { min-height: 44px; } .btn.small { min-height: 36px; } }
/* Aviso de acción hecha: aparece abajo, visible aunque se haya bajado en la página */
.aviso { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(16px, env(safe-area-inset-bottom, 0px)); z-index: 61; width: max-content; max-width: min(520px, calc(100vw - 32px)); border: 1px solid var(--ok); box-shadow: var(--shadow); animation: dc-toast 0.2s ease-out; }
body:has(#aviso:not([hidden])) .syncbar { bottom: calc(max(16px, env(safe-area-inset-bottom, 0px)) + 62px); }
@keyframes dc-toast { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
/* Primeros pasos: los pasos hechos van en una sola fila compacta y solo el pendiente ocupa espacio */
.onb { padding: 16px 18px; }
.onb-bar { margin: 10px 0; }
.onb-lista { flex-direction: row; flex-wrap: wrap; gap: 8px; }
.onb-paso { flex: 1 1 100%; order: 1; }
.onb-paso.hecho { order: 0; flex: 0 0 auto; align-items: center; gap: 8px; padding: 5px 12px 5px 6px; border-radius: 999px; opacity: 1; background: var(--ok-bg); border-color: transparent; }
.onb-paso.hecho .onb-tx b { font-size: 0.86rem; color: var(--ok); font-weight: 700; }
.onb-paso.hecho .pill { display: none; }
.onb-paso.hecho .onb-num { width: 22px; height: 22px; font-size: 0.76rem; border-color: transparent; background: var(--surface); }
/* Leyenda de colores: el estado ya va escrito en cada casilla, no hace falta repetirla en cada piso */
.piso-card > .mini-legend { display: none; }
/* Casillas de habitación: acciones alineadas abajo, más discretas */
.room .rm-acts { margin-top: auto; padding-top: 8px; gap: 4px 6px; }
.room .btn.small { padding: 3px 10px; font-size: 0.78rem; border-radius: 8px; }
.room b { overflow-wrap: anywhere; }
@media (pointer: coarse) { .room .btn.small { padding: 6px 12px; } }
/* Listas largas: no se pinta lo que está fuera de la pantalla (72 a 400 habitaciones) */
#lista-habs > .piso-card { content-visibility: auto; contain-intrinsic-size: auto 280px; }
/* Tablero de incidencias: urgentes con franja roja, columnas con tope de altura propio no; títulos largos cortados a 2 líneas */
.tk.urg { border-left: 4px solid var(--bad); padding-left: 9px; }
.tk b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tk:focus-visible { border-color: var(--accent); }
.col h3 { font-size: 0.88rem; }
.col-vacia { padding: 14px 8px; }
@media print {
  body { background: #fff; }
  .sidebar, .vista-bar, .fbar, .syncbar, .userbox, .foot, #vista-ajustes, .tip, .modal, .btn, .form, .top-acts { display: none !important; }
  .cc { break-inside: avoid; }
  .app { display: block; height: auto; overflow: visible; }
  .main { padding: 0; height: auto; overflow: visible; }
  * { box-shadow: none !important; }
  article { break-inside: avoid; }
}

/* ===== dis-final: auditoría transversal (contraste, campos, menú de casilla, filtros móvil, Ajustes, esqueletos) ===== */
::placeholder { color: var(--muted); opacity: 1; }
/* Campos: borde visible (>= 3:1) y mismo foco en toda la app; las pantallas de entrada solo los agrandan */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="color"]), select, textarea { border-color: var(--field-line); }
.field input, .field select, .field textarea, #mu-form .field input, #mu-form .field select, .bus-box .search { border-color: var(--field-line); }
.docs-list select, .rol-sel:not(:disabled), .fic-aj-txt { border: 1px solid var(--field-line); }
.field input, .field select { min-height: 44px; }
.field input:hover, .field select:hover, .field textarea:hover, .search:hover { border-color: var(--muted); }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible, .search:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.field input[aria-invalid="true"], .field select[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: var(--bad); }
.ent .field input { border-color: var(--field-line); }
.ent .field input:hover { border-color: var(--muted); }
.ent .field input:focus-visible { border-color: var(--accent); }
/* Botón de acción repetida (p. ej. "Marcar pagado" en cada fila): contorno de acento, el relleno queda para la acción principal de la pantalla */
.btn.accent { color: var(--accent); border-color: var(--accent); background: var(--surface); }
.btn.accent:hover { background: var(--accent-soft); }
.btn.danger:not(.primary) { border-color: var(--bad); }
.btn.danger.primary { background: var(--bad); border-color: var(--bad); color: var(--surface); box-shadow: none; }
/* Objetivos táctiles: enlaces de texto con al menos 24 px de alto (44 px en pantallas táctiles) */
.linklike, .prv-links a, .fic-ct a { display: inline-flex; align-items: center; min-height: 28px; }
@media (pointer: coarse) { .linklike, .prv-links a, .fic-ct a { min-height: 44px; } .field input, .field select { min-height: 48px; } }
/* Estados vacíos: texto + siguiente paso */
.empty p { margin: 0 0 12px; }
.empty p:last-child { margin-bottom: 0; }
/* Informes: las tarjetas de una fila no se estiran hasta la altura de la vecina */
.inf-grid { align-items: start; }
/* Esqueletos de carga */
.sk { display: block; background: linear-gradient(90deg, var(--line) 25%, var(--bg) 50%, var(--line) 75%); background-size: 200% 100%; animation: sk-brillo 1.4s ease-in-out infinite; border-radius: 12px; }
.sk-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; width: min(520px, 86vw); margin-top: 18px; }
.sk-card { height: 84px; }
@keyframes sk-brillo { to { background-position: -200% 0; } }
/* Filtros plegables en móvil, con insignia de filtros activos */
.fgroups { display: contents; }
.fbar-toggle { display: none; }
.fbar-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 0.72rem; font-weight: 800; display: inline-grid; place-items: center; }
@media (max-width: 700px) {
  .fbar.fb-col .fbar-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; }
  .fbar.fb-col:not(.abierto) .fgroups { display: none; }
  .fbar.fb-col.abierto .fgroups { display: flex; flex-direction: column; gap: 12px; width: 100%; }
}
/* Menú "⋯" de la casilla de habitación */
.room { position: relative; }
.rm-more { display: inline-flex; }
.room .rm-more-btn { min-height: 28px; min-width: 36px; font-weight: 800; font-size: 1.15rem; line-height: 1; letter-spacing: 0; }
.rm-menu { position: absolute; right: 8px; bottom: 46px; z-index: 30; min-width: 190px; max-width: calc(100% - 16px); display: flex; flex-direction: column; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 4px; }
.rm-item { display: flex; align-items: center; width: 100%; min-height: 40px; padding: 8px 12px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; font-weight: 600; font-size: 0.88rem; text-align: left; text-decoration: none; cursor: pointer; }
.rm-item:hover, .rm-item:focus-visible { background: var(--accent-soft); color: var(--accent); }
.rm-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* Ajustes: mini-navegación fija */
.aj-nav { position: sticky; top: 0; z-index: 20; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 8px 0; background: var(--bg); }
.aj-nav::-webkit-scrollbar { display: none; }
.aj-nav-a { flex: none; display: inline-flex; align-items: center; min-height: 36px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-weight: 600; font-size: 0.88rem; text-decoration: none; }
.aj-nav-a:hover { border-color: var(--accent); color: var(--ink); }
.aj-nav-a[aria-current] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 800; }
.aj-card { scroll-margin-top: 64px; }
@media (pointer: coarse) { .aj-nav-a { min-height: 44px; } }
/* Escritorio: el menú de Ajustes pasa a una columna fija a la izquierda de las tarjetas */
@media (min-width: 960px) {
  .ajustes { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 24px; align-items: start; }
  .aj-nav { flex-direction: column; gap: 2px; overflow: visible; top: 8px; padding: 0; background: none; z-index: 1; }
  .aj-nav-a { border: 0; border-radius: 10px; background: none; min-height: 40px; padding: 8px 12px; font-size: 0.95rem; }
  .aj-nav-a:hover { background: var(--surface); border-color: transparent; }
  .aj-nav-a[aria-current] { border-color: transparent; }
}
/* Móvil: marca sin solaparse con los botones y pestañas como barra inferior con zona segura */
.brand > div { min-width: 0; }
.brand strong, .brand small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 700px) {
  .sidebar { padding-right: calc(max(16px, env(safe-area-inset-right, 0px)) + 176px); }
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; grid-auto-columns: minmax(70px, 1fr); border-radius: 0; border-width: 1px 0 0; padding: 4px max(4px, env(safe-area-inset-right, 0px)) max(4px, env(safe-area-inset-bottom, 0px)) max(4px, env(safe-area-inset-left, 0px)); box-shadow: 0 -8px 24px -16px rgba(41, 24, 92, 0.35); }
  .tab { font-size: 0.68rem; }
  .main { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
  .aviso, .syncbar { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  body:has(#aviso:not([hidden])) .syncbar { bottom: calc(138px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 700px) { .modal { padding-bottom: max(16px, env(safe-area-inset-bottom, 0px)); } .modal-box { max-height: calc(100dvh - 32px); overflow-y: auto; } }
@media print { .tabs, .sk-grid { display: none !important; } }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 10px 16px; border-radius: 10px; font-weight: 700; text-decoration: none; }
.skip:focus { top: 12px; }
#contenido:focus { outline: none; }
@media (max-width: 380px) { .brand small { display: none; } .sidebar { padding-right: calc(max(16px, env(safe-area-inset-right, 0px)) + 120px); } }

/* Formularios (piso, habitación, incidencia, importar) como ventana emergente */
.form.modal { background: rgba(8, 20, 23, 0.55); border: 0; border-radius: 0; box-shadow: none; padding-top: max(16px, env(safe-area-inset-top, 0px)); }
.form.modal > .form-box { max-width: 760px; border-color: var(--line); }
.form.modal .form-box h2 { font-size: 1.3rem; }

/* Visión general: franja de 4 números + una sola lista "Qué hacer hoy" */
.glance > .kpis { grid-column: 1 / -1; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.d-act > :first-child { grid-column: 1 / -1; }
.glance .kpi strong { font-size: 2.2rem; }
.glance .kpi-d { margin-bottom: 10px; }
.at-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; }
.at-title { font-family: var(--font-display); font-size: 1.2rem; margin: 0; }
.at-sub { margin: 0; color: var(--muted); font-size: 0.88rem; }
.prio-resto { margin: 0; color: var(--muted); font-size: 0.86rem; }
@media (max-width: 860px) { .glance > .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Proveedor en ventana emergente; botón de documentos de la casilla */
.modal .prv-form { background: none; border: 0; padding: 0; }
.modal .prv-form .field input, .modal .prv-form .field textarea { background: var(--bg); }
.rm-docs-btn { display: inline-flex; align-items: center; justify-content: center; padding-inline: 10px; }
.rm-docs-btn svg { display: block; }


/* Visión general: tres tarjetas que unen la cifra grande y su gráfico pequeño */
.glance > .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mk-card { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px 12px; min-width: 0; box-shadow: var(--shadow-card, none); }
.mk-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.mk-h small { display: block; color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.mk-h strong { display: block; font-family: var(--font-display); font-size: 2.2rem; line-height: 1.1; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.mk-card.bad .mk-h strong { color: var(--bad); }
.mk-card.ok .mk-h strong { color: var(--ok); }
.mk-ver { border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 0.8rem; font-weight: 700; cursor: pointer; min-height: 32px; }
.mk-ver:hover { border-color: var(--accent); color: var(--accent); }
#kpis .mk-card { cursor: pointer; transition: border-color .15s, transform .15s; }
#kpis .mk-card:hover { border-color: var(--accent); }
#kpis .mk-card:hover .mk-ver { border-color: var(--accent); color: var(--accent); }
@media (prefers-reduced-motion: no-preference) { #kpis .mk-card:hover { transform: translateY(-2px); } }
.mk-pills { display: flex; flex-wrap: wrap; gap: 6px; min-height: 24px; }
.mk-pillbtn { border: 0; font: inherit; font-size: 0.74rem; font-weight: 700; cursor: pointer; }
.mk-pillbtn:hover { filter: brightness(0.95); }
.mk-card .cc-h4 { margin-top: 2px; }
.mk-graf { min-width: 0; }
.mk-graf .occ { flex-wrap: nowrap; padding-block: 0; gap: 14px; justify-content: flex-start; }
.mk-graf .occ .donut { width: 112px; }
.mk-graf .occ .lg { flex: 1 1 auto; gap: 4px; }
.mk-graf .colchart { display: block; width: 100%; height: auto; }
@media (max-width: 860px) { .glance > .kpis { grid-template-columns: minmax(0, 1fr); } }
