/* Chriscadi Electricidad — interfaz.
   Tema oscuro único: negro predominante, superficies grafito y un solo acento azul eléctrico. */
:root {
  color-scheme: dark;
  --bg: #09090b;
  --panel: #111114;
  --panel-2: #17171b;
  --panel-3: #1e1e24;
  --field: #0c0c0f;
  --line: #222229;
  --line-2: #2e2e37;
  --text: #ededf0;
  --muted: #8b8b97;
  --brand: #4d8df6;
  --brand-2: #142341;
  --brand-3: #6ea2ff;
  --volt: #f6c433;
  --ok: #3ccb7f;
  --ok-bg: #0f2a1d;
  --warn: #e9b13b;
  --warn-bg: #2c2210;
  --bad: #f06565;
  --bad-bg: #351618;
  --info: #a3a3ff;
  --info-bg: #222247;
  --radius: 10px;
  --shadow: 0 12px 32px rgba(0, 0, 0, .45);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14.5px/1.5 var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-3); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 600; margin: 0 0 4px; letter-spacing: -.015em; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; letter-spacing: -.005em; }
h3 { font-size: 11.5px; font-weight: 600; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.hidden { display: none !important; }
::selection { background: var(--brand); color: #fff; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- iconos */
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; display: inline-block; vertical-align: -4px; }
.btn .ic { width: 16px; height: 16px; vertical-align: -3px; }

/* ---------- layout */
.sidebar {
  width: 236px; flex: none; background: var(--bg); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow: hidden;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 20px 18px 16px; }
.brand-mark { width: 40px; height: 40px; flex: none; display: block; }
.brand-mark svg { width: 100%; height: 100%; display: block; font-family: var(--font); }
/* menú lateral: en negrita; en negro cuando el fondo es claro (sobre fondo oscuro el negro no se vería) */
#nav a span, #nav .nav-group-head span { font-weight: 700; }
#btn-salir { margin-top: 10px; color: var(--bad); border-top: 1px solid var(--line); padding-top: 12px; border-radius: 0; }
#btn-salir span { letter-spacing: .04em; font-size: 12.5px; font-weight: 650; }
#btn-salir:hover { background: var(--bad-bg); }
.brand-mark img { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: 10px; background: #fff; }
/* foto de fondo (marca de agua): fija, detrás de todo el contenido principal */
main { position: relative; isolation: isolate; }
body.con-marca main::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: var(--marca) center / cover no-repeat; opacity: var(--marca-opacidad, .15); }
body.con-marca .card, body.con-marca .mail-app, body.con-marca .topbar { background-color: color-mix(in srgb, var(--panel) 92%, transparent); }
/* color de fondo de las ventanas emergentes (paleta o degradado): solo los diálogos */
body.ventanas-personalizadas .modal { background: var(--ventana-fondo); color: var(--ventana-texto); border-color: var(--ventana-line-2);
  --panel: var(--ventana-panel); --panel-2: var(--ventana-panel-2); --panel-3: var(--ventana-panel-3); --field: var(--ventana-field);
  --line: var(--ventana-line); --line-2: var(--ventana-line-2); --text: var(--ventana-texto); --muted: var(--ventana-muted); --brand-2: var(--ventana-brand-2); }
body.ventanas-personalizadas .modal-foot { background: color-mix(in srgb, var(--ventana-base) 88%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
body.ventanas-personalizadas .modal-head { background: transparent; }
body.ventanas-claras .modal .btn.primary { color: #fff; }
body.ventanas-claras .modal .mail-row.noleido { background: linear-gradient(90deg, rgba(0, 0, 0, .08), rgba(0, 0, 0, .04) 55%, rgba(0, 0, 0, .025)); box-shadow: inset 3px 0 0 rgba(0, 0, 0, .25); }
body.ventanas-claras .modal .mail-cuerpo iframe { background: #fff; }
.luz { display: flex; align-items: center; gap: 10px; max-width: 520px; }
.luz input[type=range] { flex: 1; accent-color: var(--brand); }
.luz [data-panel-luz-valor] { width: 32px; text-align: right; }
body.paneles-claros .btn.primary, body.paneles-claros .mail-folder .cuenta, body.paneles-claros .btn .cuenta { color: #fff; }
body.paneles-claros .mail-row.noleido { background: linear-gradient(90deg, rgba(0, 0, 0, .08), rgba(0, 0, 0, .04) 55%, rgba(0, 0, 0, .025)); box-shadow: inset 3px 0 0 rgba(0, 0, 0, .25); }
body.paneles-claros .brand-mark img { background: transparent; }
body.paneles-claros .sidebar, body.paneles-claros .topbar { --text: #ededf0; --muted: #9a9aa6; }
.paleta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.muestra { width: 38px; height: 38px; border-radius: 10px; border: 2px solid var(--line-2); cursor: pointer; padding: 0; transition: transform .1s; }
.muestra:hover { transform: scale(1.08); }
.muestra.sel { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-2); }
.muestra-propia { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }
.muestra-propia input[type=color] { width: 38px; height: 38px; padding: 0; border: 2px solid var(--line-2); border-radius: 10px; background: none; cursor: pointer; }
.brand-mark .mark-bg { fill: var(--brand-2); stroke: var(--line-2); }
.brand-mark .mark-line { fill: none; stroke: var(--brand); stroke-width: 1.5; stroke-linecap: round; opacity: .55; }
.brand-mark .mark-text { fill: var(--brand-3); font-size: 14.5px; font-weight: 800; letter-spacing: -.03em; }
.brand strong { display: block; font-size: 17px; font-weight: 650; letter-spacing: -.01em; line-height: 1.15; }
/* (17-11-2026) con los grupos abiertos el menú no cabe en pantallas bajas: Privacidad, Copias y Ajustes se salían del panel
   claro y quedaban en negro sobre el fondo negro (solo se veían al pasar el ratón). Ahora el menú se desplaza dentro del panel. */
#nav { display: flex; flex-direction: column; padding: 6px 12px; gap: 2px; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
#nav a {
  display: flex; gap: 11px; align-items: center; padding: 8px 11px; border-radius: 8px; color: var(--muted);
  font-weight: 500; font-size: 14px; transition: background .12s, color .12s;
}
#nav a:hover { background: var(--panel); color: var(--text); text-decoration: none; }
#nav a.active { background: var(--panel-2); color: var(--text); }
#nav a.active .ic { color: var(--brand-3); stroke: var(--brand-3); }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-head {
  display: flex; gap: 11px; align-items: center; width: 100%; padding: 8px 11px; border-radius: 8px; border: 0; background: none;
  color: var(--muted); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; text-align: left; transition: background .12s, color .12s;
}
.nav-group-head:hover { background: var(--panel); color: var(--text); }
.nav-group-head span { flex: 1; letter-spacing: .02em; }
.nav-group-head .chev { width: 14px; height: 14px; transition: transform .15s; opacity: .7; }
.nav-group.open .nav-group-head .chev { transform: rotate(90deg); }
.nav-group-items { display: none; flex-direction: column; gap: 2px; margin-left: 19px; padding-left: 10px; border-left: 1px solid var(--line); }
.nav-group.open .nav-group-items { display: flex; }
.nav-group-items a { padding: 7px 10px; font-size: 13.5px; }
.nav-group-items a .ic { width: 16px; height: 16px; }
.nav-back { display: none; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--line); }
.sidebar-foot .btn { width: 100%; justify-content: center; }
body.servidor #btn-obsidian, body.servidor [data-carpeta] { display: none; }

main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; gap: 12px; padding: 12px 28px; align-items: center;
  background: rgba(9, 9, 11, .82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 5; border-bottom: 1px solid var(--line);
}
.quick-ask {
  flex: 1; display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line-2);
  border-radius: 8px; padding: 0 12px; color: var(--muted); max-width: 720px; transition: border-color .12s, box-shadow .12s;
}
.quick-ask:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-2); }
.quick-ask input { border: 0; outline: 0; background: transparent; flex: 1; padding: 9px 0; font: inherit; color: var(--text); min-width: 0; }
.quick-ask input::placeholder { color: var(--muted); }
#view { padding: 26px 28px 80px; max-width: 1280px; width: 100%; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- components */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack > * + * { margin-top: 14px; }

.kpi { padding: 16px 18px; }
.kpi .label { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.kpi .value { font-size: 24px; font-weight: 600; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

.btn {
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); padding: 7px 13px; border-radius: 8px;
  font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; display: inline-flex; gap: 7px; align-items: center; white-space: nowrap;
  line-height: 1.3; transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--panel-3); border-color: #3a3a45; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-3); border-color: var(--brand-3); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #07160e; }
.btn.ok:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); border-color: var(--bad-bg); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); border-color: transparent; }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn.small .ic { width: 14px; height: 14px; }
.btn.icon { padding: 7px 8px; }
.btn.icon .ic { width: 17px; height: 17px; vertical-align: 0; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.rec { background: var(--bad); color: #fff; border-color: var(--bad); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .65; } }
@media (prefers-reduced-motion: reduce) { .btn.rec, .typing::after { animation: none; } }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--field); border: 1px solid var(--line-2); border-radius: 8px;
  padding: 8px 10px; width: 100%; transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: #5f5f6b; }
textarea { resize: vertical; min-height: 70px; }
textarea.titulo-multi { min-height: 0; resize: none; overflow: hidden; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-2); }
input[type="file"] { padding: 6px 8px; color: var(--muted); }
label.field { display: block; }
label.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
.form { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form .full { grid-column: 1 / -1; }
.search { width: 300px; max-width: 100%; }
.toolbar .grow, .selbar .grow { flex: 1; }
.btn.active { border-color: var(--brand); color: var(--brand-3); background: var(--brand-2); }
.btn .cuenta { background: var(--brand); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 600; padding: 0 6px; line-height: 16px; }
.filtros { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.filtros-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 12px; }
.filtros-foot { margin-top: 8px; }
.selbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--brand-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; font-size: 13.5px; }
th.selcol, td.selcol { width: 34px; padding-right: 0; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand); margin: 0; vertical-align: -3px; cursor: pointer; }
tr.sel td { background: var(--brand-2); }
.btn.small.danger:not(:disabled):hover { background: var(--bad-bg); border-color: var(--bad-bg); }
.split-agenda { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.split-factura { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
td.right, th.right { white-space: nowrap; }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--panel-3); color: var(--muted); white-space: nowrap; letter-spacing: .01em;
}
.badge.borrador { background: var(--info-bg); color: var(--info); }
.badge.aprobada { background: var(--brand-2); color: var(--brand-3); }
.badge.emitido { background: var(--brand-2); color: var(--brand-3); }
.badge.facturado { background: var(--ok-bg); color: var(--ok); }
.badge.enviada { background: var(--warn-bg); color: var(--warn); }
.badge.vencida { background: var(--bad-bg); color: var(--bad); }
.badge.pagada, .badge.hecho, .badge.terminado, .badge.cobrado { background: var(--ok-bg); color: var(--ok); }
.badge.facturado { background: var(--brand-2); color: var(--brand-3); }
.badge.anulada { text-decoration: line-through; }
.badge.en-curso { background: var(--brand-2); color: var(--brand-3); }
.badge.presupuesto { background: var(--info-bg); color: var(--info); }
.badge.cancelado { text-decoration: line-through; }
.kpi.mini { padding: 10px 12px; background: var(--panel-2); border-radius: 8px; }
.split-proy { grid-template-columns: 260px minmax(0, 1fr); align-items: start; }
.acciones-cerebro { display: flex; gap: 8px; flex-wrap: wrap; }
.acciones-cerebro .btn { padding: 9px 14px; }
.drop-on { outline: 2px dashed var(--brand); outline-offset: -6px; background: var(--brand-2); }
.lote { display: flex; flex-direction: column; gap: 8px; }
.lote-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lote-th { width: 46px; height: 46px; border-radius: 7px; object-fit: cover; background: var(--field); flex: none; display: grid; place-items: center; padding: 0; font-size: 11px; }
.lote-st { flex: none; white-space: nowrap; }
.lote-st.bad { color: var(--bad); }
.lote-item { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.lote-form { margin-top: 8px; }
.lote-analisis { margin-top: 6px; }
.lote-analisis .analisis { max-height: 32vh; margin-top: 6px; }
.lote-nuevo { margin-top: 12px; }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chk { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer; }
.chk input { width: auto; margin: 0; }
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
/* fondo «gota de agua» sobre lo que se ha tocado (fila, día, botón) mientras se actualiza, en vez de recargar la pantalla (05-11-2026) */
.gota { position: relative; border-radius: 10px; background: radial-gradient(ellipse at 30% 20%, rgba(170, 220, 255, .42), rgba(96, 170, 255, .22) 55%, rgba(96, 170, 255, .10)) !important; box-shadow: inset 0 0 0 1px rgba(150, 205, 255, .35); animation: gota 1.1s ease-in-out infinite; }
.event.gota { padding-left: 8px; padding-right: 8px; margin-left: -8px; margin-right: -8px; }
.mail-row.gota { border-radius: 0; }
@keyframes gota { 0%, 100% { opacity: 1; } 50% { opacity: .72; } }

/* carpetas dentro de la documentación de un proyecto */
.carpetas { display: flex; flex-direction: column; gap: 8px; }
.carpeta { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.carpeta-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 6px 10px; }
.carpeta-nombre { display: inline-flex; align-items: center; gap: 8px; min-width: 0; background: none; border: 0; padding: 4px 0; color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.carpeta-nombre::before { content: "▾"; font-size: 10px; color: var(--muted); width: 10px; }
.carpeta.plegada .carpeta-nombre::before { content: "▸"; }
.carpeta-nombre b { font-weight: 600; }
.carpeta-acts { display: flex; gap: 4px; align-items: center; margin-left: auto; }
.carpeta-docs { padding: 0 10px 10px; }
.carpeta-docs[hidden] { display: none; }
.carpeta-min .ic { transition: transform .15s; }
.carpeta.plegada .carpeta-min .ic { transform: rotate(-90deg); }
.carpeta.plegada { border-style: dashed; }
.carpeta .empty.small { padding: 4px 0 0; grid-column: 1 / -1; }
/* anotaciones dentro de las carpetas de Vivienda y Personal (29-11-2026) */
.fich-notas { display: grid; gap: 6px; margin-bottom: 10px; }
.fich-nota { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; background: var(--field); border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: 8px; padding: 8px 10px; }
.fich-nota-txt { min-width: 0; flex: 1; }
.fich-nota-cuerpo { white-space: pre-wrap; overflow-wrap: anywhere; }
.docs.docs-lista { display: block; }
.fich-abrir { background: none; border: 0; padding: 0; color: var(--text); font: inherit; cursor: pointer; text-align: left; text-decoration: none; overflow-wrap: anywhere; }
.fich-abrir:hover b { text-decoration: underline; }
.fich-acts { white-space: nowrap; width: 1%; }
@media (max-width: 760px) { .docs-lista th:nth-child(1), .docs-lista tbody td:nth-child(1), .docs-lista th:nth-child(4), .docs-lista tbody td:nth-child(4) { display: none; } .docs-lista th, .docs-lista td { padding-left: 6px; padding-right: 6px; } }
.doc { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.doc-prev { display: grid; place-items: center; aspect-ratio: 4 / 3; background: var(--field); overflow: hidden; color: var(--muted); text-decoration: none; }
.doc-prev:hover { text-decoration: none; }
.doc-prev img, .doc-prev video { width: 100%; height: 100%; object-fit: cover; display: block; }
.doc-prev.audio { aspect-ratio: auto; padding: 14px 8px; }
.doc-prev.audio audio { width: 100%; }
.doc-ext { font-weight: 700; letter-spacing: .08em; font-size: 13px; text-transform: uppercase; background: var(--panel-3); color: var(--text); padding: 6px 10px; border-radius: 6px; }
.doc-ext.big { display: grid; place-items: center; height: 120px; font-size: 20px; }
.doc-info { padding: 8px 10px 4px; min-width: 0; }
.doc-info strong { display: block; font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-acts { display: flex; justify-content: flex-end; gap: 2px; padding: 0 6px 6px; }
.prev-media { width: 100%; max-height: 320px; object-fit: contain; border-radius: 8px; background: var(--field); display: block; }
.analisis { max-height: 46vh; overflow: auto; padding-right: 4px; }
.msg-adj { max-width: 260px; max-height: 200px; border-radius: 8px; display: block; margin-bottom: 8px; }
.msg-adj-doc { display: inline-flex; gap: 6px; align-items: center; margin-bottom: 8px; font-weight: 500; }
.bloqueo { max-width: 520px; }
.bloqueo .codigo { font-size: 22px; letter-spacing: .25em; font-variant-numeric: tabular-nums; text-align: center; width: 200px; }
.qr { background: #fff; border-radius: 10px; padding: 10px; display: grid; place-items: center; }
.qr svg { width: 230px; height: 230px; display: block; }
.secreto { font-family: var(--mono); font-size: 14px; letter-spacing: .08em; word-break: break-all; background: var(--field); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; margin: 6px 0 8px; }
.codigos-rec { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 8px; }
.codigos-rec span { font-family: var(--mono); font-size: 15px; letter-spacing: .06em; background: var(--field); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; text-align: center; }
.creds td { vertical-align: middle; }
.creds td:nth-child(2), .creds td:nth-child(4) { white-space: nowrap; }
.creds td:nth-child(3) { min-width: 160px; }
.cred-sitio { display: flex; gap: 10px; align-items: center; min-width: 0; }
.cred-logo { width: 32px; height: 32px; border-radius: 8px; object-fit: contain; background: #fff; padding: 3px; flex: none; }
.cred-inicial { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; color: #fff; flex: none; }
.kpi.mini .value { font-size: 17px; margin-top: 2px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .07em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { border-top: 1px solid var(--line-2); border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--panel-2); }
.table-wrap { overflow-x: auto; }
.card.table-wrap { padding: 6px 10px; }

.list { display: flex; flex-direction: column; }
.list .item { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list .item:last-child { border-bottom: 0; }
.list .item .grow { flex: 1; min-width: 0; }
.empty { color: var(--muted); padding: 14px 0; font-size: 13.5px; }
.tag-type { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 650; background: var(--panel-3); padding: 2px 6px; border-radius: 4px; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 10px; flex-wrap: wrap; }
.section-title .toolbar { margin-left: auto; }
.section-title h2 { margin: 0; }

/* ---------- clientes */
.client { padding: 0; overflow: hidden; }
.client + .client { margin-top: 10px; }
.client-head { display: grid; grid-template-columns: 1.6fr repeat(5, 1fr) 24px; gap: 12px; align-items: center; padding: 14px 18px; cursor: pointer; }
.client-head:hover { background: var(--panel-2); }
.client-head .name strong { display: block; font-weight: 600; }
.client-head .stat { font-size: 12.5px; }
.client-head .stat b { display: block; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.client-body { border-top: 1px solid var(--line); padding: 18px; background: var(--bg); }
.chev { transition: transform .15s; color: var(--muted); text-align: center; }
.client.open .chev { transform: rotate(90deg); }
dl.data { display: grid; grid-template-columns: 140px 1fr; gap: 7px 12px; margin: 0; }
dl.data dt { color: var(--muted); font-size: 13px; }
dl.data dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- materiales */
.mat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.mat { padding: 0; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; transition: border-color .12s; }
.mat:hover { border-color: var(--line-2); }
.mat .photo { aspect-ratio: 4/3; background: var(--panel-2); display: grid; place-items: center; overflow: hidden; color: var(--muted); }
.mat .photo .ic { width: 40px; height: 40px; stroke-width: 1.2; }
.mat .photo img { width: 100%; height: 100%; object-fit: cover; }
.mat .info { padding: 12px 14px; }
.mat .code { font-size: 11.5px; font-weight: 650; color: var(--brand-3); letter-spacing: .04em; }
/* (24-11-2026) casilla para marcar materiales y borrarlos de una vez */
.mat { position: relative; }
.mat-sel { position: absolute; top: 8px; left: 8px; z-index: 2; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: rgba(0, 0, 0, .55); cursor: pointer; }
.mat-sel input { width: 18px; height: 18px; margin: 0; cursor: pointer; }
.mat.marcado { border-color: var(--brand); }
.sel-barra { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.mat-photo-big { width: 100%; max-height: 360px; object-fit: contain; border-radius: 10px; background: var(--panel-2); }
.btn-foto { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
button.doc-prev { width: 100%; border: 0; padding: 0; cursor: zoom-in; font: inherit; }

.event .ev-trabajo { font-weight: 400; color: var(--text); margin-top: 1px; }
/* notas de una cita: lista de puntos que se tachan */
.tareas-ev { margin-top: 6px; display: flex; flex-direction: column; gap: 2px; }
/* la casilla va en la primera línea del texto, no centrada con todas las líneas de la nota (petición 06-11-2026) */
.tarea { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; line-height: 1.4; cursor: pointer; padding: 2px 0; }
.tarea input[type="checkbox"] { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--brand); flex: none; cursor: pointer; }
.tarea span { flex: 1; min-width: 0; white-space: pre-wrap; }  /* conserva saltos de línea y los espacios del tabulador */
.tarea.hecha span { text-decoration: line-through; color: var(--muted); }
.tarea { flex-wrap: wrap; }
.tarea .tarea-txt { cursor: text; padding: 2px 4px; margin: -2px -4px; border-radius: 6px; }
.tarea .tarea-txt:hover { background: var(--panel-2); }
.tarea .tarea-lapiz { padding: 4px 6px; opacity: .8; }
.tarea .tarea-lapiz .ic { width: 15px; height: 15px; }
.tarea .tarea-lapiz:hover { opacity: 1; }
.tarea-edit-inline { flex-basis: 100%; display: flex; flex-direction: column; gap: 6px; padding: 2px 0 4px; cursor: default; }
.tarea-edit-inline .tarea-nueva { width: 100%; }
.tareas-edit { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 8px; }
.tareas-edit .tarea { padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); cursor: default; }
.tareas-edit .tarea { align-items: flex-start; }
.tareas-edit .tarea input[type="checkbox"] { margin-top: 7px; }
.tareas-edit .tarea-texto { flex: 1; min-width: 0; border: 1px solid var(--line-2); background: var(--panel); color: var(--text); font: inherit; line-height: 1.4; padding: 5px 8px; border-radius: 6px; outline: 0; resize: none; overflow: hidden; min-height: 30px; }
.tp-add .tarea-nueva { flex: 1 1 240px; min-width: 0; resize: none; overflow: hidden; line-height: 1.4; min-height: 38px; }
.tareas-edit .tarea-texto:focus { background: var(--panel-2); border-color: var(--brand); }
.tareas-edit .tarea-texto, .tarea-nueva, textarea[name="texto_nota"] { touch-action: manipulation; -webkit-user-select: text; user-select: text; }
@media (max-width: 760px) { .tareas-edit .tarea-texto, .tarea-nueva, textarea[name="texto_nota"] { font-size: 16px; } }  /* iOS no hace zoom al enfocar */
.tareas-edit .tarea.hecha .tarea-texto { text-decoration: line-through; color: var(--muted); }
.tareas-edit .tarea .btn.icon { padding: 5px 6px; margin-top: 2px; }
.tareas-edit .tarea .btn.icon .ic { width: 15px; height: 15px; }
.event.done .ev-trabajo { text-decoration: line-through; color: var(--muted); }

.pdf-marco { width: 100%; height: 68vh; border: 0; border-radius: 8px; background: #fff; display: block; }
.modal-back.max .pdf-marco { height: calc(100vh - 190px); }
@media (max-width: 760px) { .pdf-marco { height: 55vh; } }

/* ---------- visor de fotos dentro de la app */
.visor { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .96); display: flex; flex-direction: column; color: #fff; -webkit-tap-highlight-color: transparent; }
.visor-top { display: flex; align-items: center; gap: 6px; padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top)); }
.visor-nombre { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 14px; }
.visor-top .btn { color: #fff; }
.visor-top .btn:hover { background: rgba(255, 255, 255, .12); }
.visor-cuerpo { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; }
.visor-cuerpo img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; user-select: none; -webkit-user-select: none; }
.visor-flecha { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .14); color: #fff; display: grid; place-items: center; cursor: pointer; }
.visor-flecha:hover { background: rgba(255, 255, 255, .26); }
.visor-flecha .ic { width: 22px; height: 22px; }
.visor-flecha.prev { left: 10px; }
.visor-flecha.next { right: 10px; }
.visor-pie { text-align: center; padding: 10px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); font-size: 13px; color: rgba(255, 255, 255, .7); min-height: 20px; }
@media (max-width: 760px) { .visor-flecha { display: none; } }  /* en el móvil se desliza con el dedo */
.mat-photo-empty { display: grid; place-items: center; height: 200px; color: var(--muted); }
.mat-photo-empty .ic { width: 56px; height: 56px; stroke-width: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--brand-2); color: var(--brand-3); padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 500; cursor: pointer; border: 0; font-family: inherit; }
.chip:hover { filter: brightness(1.15); }

/* ---------- agenda */
.capture { display: flex; gap: 8px; align-items: stretch; }
.capture input { flex: 1; font-size: 15px; padding: 11px 14px; }
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { font-size: 11px; color: var(--muted); text-align: center; padding: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.cal .day {
  min-height: 84px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 7px; cursor: pointer; background: var(--field);
  overflow: hidden; transition: border-color .12s, background .12s;
}
.cal .day:hover { border-color: var(--line-2); }
.cal.semana .day { min-height: 170px; }
.cal.semana.dos .day { min-height: 130px; }
.cal.semana .num .small { font-weight: 400; }
.cal .day.out { opacity: .38; }
.cal .day.today { border-color: var(--brand); }
.cal .day.today .num { color: var(--brand-3); }
.cal .day.sel { background: var(--brand-2); border-color: var(--brand); }
/* día con todos sus eventos completados: verde agua claro (petición 22-10-2026) */
.cal .day.completo { background: rgba(94, 234, 212, .16); border-color: rgba(94, 234, 212, .45); }
.cal .day.completo .num { color: #7ff0dc; }
.cal .day.completo.sel { background: rgba(94, 234, 212, .3); border-color: #5eead4; }
.cal .day.completo.today { border-color: #5eead4; }
.cal .num { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cal .ev { font-size: 11.5px; border-radius: 4px; padding: 1px 5px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--panel-3); color: var(--text); }
.cal .ev.cobro, .cal .ev.factura { background: var(--warn-bg); color: var(--warn); }
.cal .ev.visita { background: var(--info-bg); color: var(--info); }
.cal .ev.hecho { text-decoration: line-through; opacity: .55; }
.event { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.event:last-child { border-bottom: 0; }
.event .time { width: 56px; flex: none; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--muted); }
.event .grow { flex: 1; min-width: 0; }
.event .grow strong { font-weight: 600; }
.event.done .grow strong { text-decoration: line-through; color: var(--muted); }
.check { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line-2); background: var(--field); cursor: pointer; flex: none; display: grid; place-items: center; color: #07160e; padding: 0; margin-top: 1px; transition: background .12s, border-color .12s; }
.check:hover { border-color: var(--brand); }
.check .ic { width: 13px; height: 13px; stroke-width: 2.6; }
.check.on { background: var(--ok); border-color: var(--ok); }
.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
/* eventos hechos plegados (05-11-2026): solo la hora y la línea principal; la pestaña de la derecha los despliega */
.event.plegado .ev-trabajo, .event.plegado .grow > .small, .event.plegado .tareas-ev, .event.plegado .thumb { display: none; }
.event .ev-mover { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; margin: -5px 0 0; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--brand); cursor: pointer; }
.event .ev-mover:hover { background: var(--brand-2); color: var(--brand-3); }
.event .ev-mover .ic { width: 20px; height: 20px; stroke-width: 2.2; }
.event.plegado .ev-mover { display: none; }
.event .ev-pliegue { padding: 2px 4px; margin: -2px 0 0; }
.event .ev-pliegue .ic { width: 16px; height: 16px; transition: transform .15s; }
.event.plegado .ev-pliegue .ic { transform: rotate(-90deg); }
.ev-pliegue-todos .ic { width: 15px; height: 15px; transition: transform .15s; transform: rotate(-90deg); }
.ev-pliegue-todos.abierto .ic { transform: rotate(0deg); }

/* ---------- facturas */
/* pestañas (Todas / Borradores / Emitidos…): como botones con borde y la activa en azul, para que se vean sobre cualquier fondo (2-11-2026) */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button { background: var(--panel-2); border: 1px solid var(--line-2, var(--line)); border-radius: 8px; padding: 7px 13px; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--text); cursor: pointer; }
.tabs button:hover { border-color: var(--brand); color: var(--text); }
.tabs button.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.proy-tabs { margin: 0 0 8px; padding: 0 10px; }
.proy-tabs button { flex: 1; padding: 6px 10px; }
.lines td { padding: 6px 4px; }
.lines input, .lines textarea { padding: 6px 8px; }
.lines textarea { min-height: 38px; }
.totals { margin-left: auto; width: 300px; }
.totals div { display: flex; justify-content: space-between; padding: 5px 0; }
.totals .grand { font-size: 18px; font-weight: 650; border-top: 1px solid var(--line-2); margin-top: 4px; padding-top: 8px; }
.preview-frame { width: 100%; height: 72vh; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.steps { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.steps .s { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line-2); }
.steps .s.done { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.steps .s.now { background: var(--brand); color: #fff; border-color: transparent; }
.steps-sep { width: 12px; height: 1px; background: var(--line-2); flex: none; }

/* ---------- mail */
.split-mail { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); align-items: start; }
.split-inicio { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); align-items: start; }
.inicio-bloques { display: flex; flex-direction: column; gap: 14px; }
.mail-cuenta {
  display: flex; gap: 12px; align-items: center; width: 100%; padding: 10px 12px; border: 0; border-radius: 8px;
  background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: background .12s;
}
.mail-cuenta:hover { background: var(--panel-2); text-decoration: none; }
.mail-cuenta.sel { background: var(--brand-2); }
.mail-cuenta .grow { flex: 1; min-width: 0; }
.mail-cuenta strong { display: block; font-weight: 600; }
.mail-cuenta .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-lista { display: flex; flex-direction: column; gap: 2px; margin: 0 -6px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-2); color: var(--brand-3); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.mail-inbox { margin-top: 16px; padding: 18px; border: 1px dashed var(--line-2); border-radius: 8px; }
.card h3.sub { margin: 16px 0 4px; }
.card .section-title + h3.sub { margin-top: 4px; }

/* ---------- cerebro */
.chat-layout { grid-template-columns: 250px minmax(0, 1fr); align-items: start; }
.chat-lista { padding: 6px; max-height: calc(100vh - 190px); overflow-y: auto; }
.chat-lista-head { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; padding: 8px 10px 6px; }
.conv { display: flex; align-items: center; gap: 2px; border-radius: 8px; }
.conv:hover { background: var(--panel-2); }
.conv.sel { background: var(--brand-2); }
.conv-abrir { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-align: left; background: none; border: 0; padding: 8px 10px; color: var(--text); font: inherit; cursor: pointer; border-radius: 8px; }
.conv-abrir strong { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-borrar { opacity: 0; flex: none; }
.conv:hover .conv-borrar, .conv.sel .conv-borrar { opacity: 1; }
.chat { display: flex; flex-direction: column; height: calc(100vh - 190px); min-height: 420px; padding: 0; }
.chat-log { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; white-space: normal; }
.msg.bot p { margin: 0 0 6px; }
.msg.bot ul { margin: 4px 0; padding-left: 20px; }
.msg .acts { margin-top: 8px; font-size: 13px; color: var(--ok); }
.msg.bot.ancho { max-width: 100%; width: 100%; }
.fuentes { margin-top: 10px; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }

/* ---------- widgets del chat: tablas y gráficas */
.widget { margin-top: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.widget-title { font-weight: 600; margin-bottom: 8px; }
.widget-nota { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.w-tabla th, .w-tabla td { padding: 6px 8px; font-size: 13px; }
.w-tabla td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.w-svg { width: 100%; max-width: 720px; height: auto; display: block; font-family: var(--font); }
.widget.grafica { max-width: 760px; }
.w-svg .grid { stroke: var(--line); stroke-width: 1; }
.w-svg .axis { stroke: var(--line-2); stroke-width: 1; }
.w-svg .lbl { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.w-svg .lbl.end { fill: var(--text); font-size: 11.5px; font-weight: 600; }
.w-svg .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.w-svg .dot { stroke: var(--panel); stroke-width: 2; }
.w-svg .hit { fill: transparent; stroke: none; }
.w-svg .bar:hover { filter: brightness(1.15); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.w-datos { margin-top: 6px; }
.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-input input { flex: 1; }
.typing::after { content: "…"; animation: pulse 1s infinite; }

/* ---------- modal & toasts */
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .62); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: flex; align-items: flex-start; justify-content: center; z-index: 50; padding: 4vh 16px; overflow-y: auto; }
.modal { background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; width: 100%; max-width: 640px; box-shadow: var(--shadow); }
.modal.wide { max-width: 1040px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); gap: 10px; }
.modal-head h2 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; position: sticky; bottom: 0; background: var(--panel); border-radius: 0 0 12px 12px; z-index: 1; }
.modal-botones { display: flex; gap: 2px; flex: none; }
/* ventana maximizada: ocupa toda la pantalla; el botón vuelve al tamaño anterior */
.modal-back.max { padding: 0; align-items: stretch; }
.modal-back.max .modal { max-width: none; width: 100%; min-height: 100%; border-radius: 0; border: 0; display: flex; flex-direction: column; }
.modal-back.max .modal-body { flex: 1; }
.modal-back.max .modal-foot { border-radius: 0; }
.modal-back.max .mail-read iframe { min-height: 60vh; }
#toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 99; }
.toast { background: #f3f3f6; color: #111114; padding: 10px 16px; border-radius: 9px; box-shadow: var(--shadow); max-width: 380px; font-weight: 500; font-size: 13.5px; }
.toast.bad { background: var(--bad); color: #fff; }
.notice { background: var(--warn-bg); color: var(--warn); padding: 10px 14px; border-radius: 9px; font-size: 13.5px; }
.notice.info { background: var(--brand-2); color: var(--brand-3); }
code { background: var(--panel-3); border: 1px solid var(--line-2); padding: 1px 5px; border-radius: 5px; font-size: 12px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
details summary { cursor: pointer; color: var(--muted); }

/* ---------- responsive */
@media (max-width: 1000px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: 1fr; }
  .client-head { grid-template-columns: 1.6fr 1fr 1fr 24px; }
  .client-head .opt { display: none; }
}
@media (max-width: 760px) {
  body { flex-direction: column; }
  .sidebar { position: fixed; bottom: 0; top: auto; height: auto; width: 100%; z-index: 20; flex-direction: row; border-right: 0; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); background: rgba(9, 9, 11, .94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
  .brand, .sidebar-foot { display: none; }
  #nav { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 4px; gap: 0; }
  #nav a { flex: 1 0 auto; flex-direction: column; gap: 3px; font-size: 9.5px; padding: 7px 2px 5px; min-width: 46px; text-align: center; border-radius: 6px; }
  #nav a .ic { width: 20px; height: 20px; }
  /* móvil: la barra inferior funciona como el menú del ordenador. FTGE es un botón más; al pulsarlo la barra
     muestra solo lo que hay dentro (Clientes, Proveedores…) con un botón «Menú» para volver (petición 17-10-2026). */
  .nav-group { display: contents; }
  .nav-group-head, .nav-back {
    display: flex; flex: 1 0 auto; flex-direction: column; gap: 3px; align-items: center; justify-content: flex-start;
    font-size: 9.5px; font-weight: 700; padding: 7px 2px 5px; min-width: 46px; width: auto; text-align: center; border-radius: 6px;
    border: 0; background: none; color: var(--muted); font-family: inherit; cursor: pointer;
  }
  .nav-group-head span, .nav-back span { flex: none; letter-spacing: 0; }
  .nav-group-head .chev { display: none; }
  .nav-group-head .ic, .nav-back .ic, .nav-group-items a .ic { width: 20px; height: 20px; }
  .nav-group.contiene-activo .nav-group-head { background: var(--panel-2); color: var(--text); }
  .nav-group.contiene-activo .nav-group-head .ic { color: var(--brand-3); stroke: var(--brand-3); }
  .nav-group-items, .nav-group.open .nav-group-items { display: none; margin: 0; padding: 0; border: 0; }
  #nav.en-grupo > a, #nav.en-grupo .nav-group-head { display: none; }
  #nav.en-grupo .nav-group.activo .nav-group-items { display: contents; }
  .nav-group-items a { padding: 7px 2px 5px; font-size: 9.5px; }
  body.externo #nav .nav-group-items { display: contents !important; }
  .topbar { padding: 10px 16px; }
  .quick-ask { max-width: none; }
  #btn-agendar { padding: 8px 10px; }
  #view { padding: 16px 16px 110px; }
  /* minmax(0, 1fr) y no 1fr a secas: con 1fr una tabla o un botón largo ensanchaban la columna más que la pantalla (Proyectos
     medía 651 px en un móvil de 390). Una página más ancha que la pantalla descoloca lo fijo, menú incluido. Para ver una
     tabla ancha entera, el usuario aleja con dos dedos (zoomContenidoMovil), que encoge el contenido y no el menú. */
  .g2, .g4, .split-agenda, .split-factura, .split-mail, .split-inicio, .chat-layout, .split-proy { grid-template-columns: minmax(0, 1fr); }
  .g2 > *, .g4 > *, .split-agenda > *, .split-factura > *, .split-mail > *, .split-inicio > *, .chat-layout > *, .split-proy > * { min-width: 0; }
  .docs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chat-lista { max-height: 180px; }
  .conv-borrar { opacity: 1; }
  .capture { flex-wrap: wrap; }
  .capture input { flex: 1 1 100%; }
  .capture .btn.primary { flex: 1; justify-content: center; }
  .search { width: 100%; }
  .page-head .toolbar { width: 100%; }
  .mat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .preview-frame { height: 60vh; }
  .form { grid-template-columns: 1fr; }
  .client-head { grid-template-columns: 1fr auto 24px; }
  .client-head .stat.opt2 { display: none; }
  dl.data { grid-template-columns: 1fr; }
  dl.data dt { margin-top: 6px; }
  .cal .day { min-height: 54px; }
  .cal.semana .day { min-height: 64px; }
  .cal.semana.dos .day { min-height: 54px; }
  .cal .ev { display: none; }
  .cal .day.has::after { content: ""; display: block; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); margin-top: 6px; }
  .msg { max-width: 92%; }
  .totals { width: 100%; }
  .chat { height: calc(100vh - 230px); }
}

/* ---------- mail: cliente de correo */
.mail-app { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); min-height: calc(100vh - 150px); overflow: hidden; }
.mail-nav { border-right: 1px solid var(--line); padding: 10px 8px; display: flex; flex-direction: column; gap: 8px; min-width: 0; overflow-y: auto; }
.mail-nav-top { display: flex; flex-direction: column; gap: 6px; }
.mail-nav-top .btn { width: 100%; justify-content: center; }
.mail-nav-foot { margin-top: auto; padding-top: 8px; }
.mail-acc { margin-top: 6px; }
.mail-acc-head { display: flex; align-items: center; gap: 6px; padding: 6px 6px 4px 2px; min-width: 0; }
.mail-plegar { padding: 2px; color: var(--muted); }
.mail-plegar .chev { width: 14px; height: 14px; transition: transform .15s; transform: rotate(90deg); }
.mail-acc.plegada .mail-plegar .chev { transform: rotate(0deg); }
.mail-acc.plegada .mail-acc-carpetas { display: none; }
.mail-acc-head .avatar { width: 24px; height: 24px; font-size: 11px; }
.mail-acc-head .btn.icon.small { padding: 3px; }
.mail-acc-head .grow { flex: 1; min-width: 0; }
.mail-acc-head strong { display: block; font-size: 13.5px; line-height: 1.2; }
.mail-del-cuenta { color: var(--muted); }
.mail-del-cuenta:hover { color: var(--bad); background: var(--bad-bg); }
.mail-folder { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 10px 6px 14px; border: 0; border-radius: 7px; background: none; color: var(--text); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; }
.mail-folder:hover { background: var(--panel-2); }
.mail-folder.sel { background: var(--brand-2); color: var(--brand-3); font-weight: 600; }
.mail-folder.todas { padding-left: 10px; font-weight: 600; }
.mail-folder .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-folder .cuenta { background: var(--brand); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 600; padding: 0 6px; line-height: 16px; }
.mail-otras summary { padding: 6px 14px; cursor: pointer; list-style: none; }
.mail-otras summary::before { content: "▸ "; font-size: 10px; }
.mail-otras[open] summary::before { content: "▾ "; }
.mail-error { color: var(--bad); padding: 2px 10px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-list { display: flex; flex-direction: column; min-width: 0; }
.mail-list-head { display: flex; gap: 6px; align-items: center; padding: 10px; border-bottom: 1px solid var(--line); }
.mail-list-head input { flex: 1; min-width: 0; }
.mail-filtros { display: flex; gap: 2px; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.mail-filtros [data-titulo-lista] { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.mail-filtros .grow { flex: 1; }
.mail-acciones { display: flex; gap: 6px; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.mail-acciones .grow { flex: 1; }
.mail-acciones .chk { margin-right: 4px; }
.mail-chk { width: auto; margin: 3px 0 0; align-self: flex-start; flex: none; accent-color: var(--brand); }
.mail-row.marcado { background: var(--brand-2); }
.mail-rows { overflow-y: auto; flex: 1; max-height: calc(100vh - 275px); }
.mail-row { display: flex; gap: 6px; padding: 10px 12px 10px 6px; border-bottom: 1px solid var(--line); cursor: pointer; min-width: 0; }
.mail-row:hover { background: var(--panel-2); }
.mail-row.sel { background: var(--brand-2); }
.mail-row .grow { flex: 1; min-width: 0; }
.mail-row-top { display: flex; align-items: center; gap: 6px; }
.mail-row-top .de { flex: 1; min-width: 0; font-weight: 500; }
.mail-row-top .ic { width: 14px; height: 14px; color: var(--muted); }
.mail-row-top .fecha { font-size: 12px; color: var(--muted); flex: none; font-variant-numeric: tabular-nums; }
.mail-row .asunto { font-size: 13.5px; }
.mail-row.noleido { background: linear-gradient(90deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .07) 55%, rgba(255, 255, 255, .05)); box-shadow: inset 3px 0 0 rgba(255, 255, 255, .35); }
.mail-row.noleido:hover { background: linear-gradient(90deg, rgba(255, 255, 255, .13), rgba(255, 255, 255, .07)); }
.mail-row.noleido .de, .mail-row.noleido .asunto { font-weight: 700; color: var(--text); }
.mail-row.noleido .fecha { color: var(--brand-3); font-weight: 600; }
.mail-row .resumen .tag-type { margin-right: 4px; }
.estrella { background: none; border: 0; color: var(--line-2); cursor: pointer; padding: 2px; align-self: flex-start; flex: none; }
.estrella:hover { color: var(--volt); }
.estrella.on { color: var(--volt); }
.estrella.on .ic { fill: var(--volt); }
.btn.estrella { color: var(--muted); }
.mail-mas { margin: 10px auto; display: block; }
.mail-read { display: flex; flex-direction: column; min-width: 0; }
.ventana-mail .modal-body { padding: 0; }
.ventana-mail .modal-head h2 { font-size: 17px; }
.mail-vacio { display: grid; place-items: center; flex: 1; text-align: center; color: var(--muted); padding: 40px; }
.mail-vacio .ic { width: 40px; height: 40px; color: var(--line-2); }
.mail-read-head { padding: 12px 16px 0; border-bottom: 1px solid var(--line); }
.mail-read-bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.mail-read-bar .grow { flex: 1; }
.mail-mover { width: auto; max-width: 90px; padding: 5px 8px; font-size: 12.5px; }
.mail-asunto { font-size: 18px; margin: 0 0 10px; font-weight: 600; letter-spacing: -.01em; }
.mail-remite { display: flex; gap: 12px; align-items: flex-start; padding-bottom: 12px; }
.mail-remite .grow { flex: 1; min-width: 0; }
.mail-remite .small { overflow-wrap: anywhere; }
.mail-aviso { display: flex; gap: 8px; align-items: center; padding: 6px 0 10px; }
.mail-cuerpo { padding: 12px 16px; }
.mail-cuerpo iframe { width: 100%; border: 0; border-radius: 8px; background: var(--panel-2); height: 300px; display: block; transition: opacity .18s; }
.mail-cuerpo iframe.cargando { opacity: 0; }
.mail-cuerpo.gota { margin: 12px 16px; padding: 0; min-height: 120px; }
.mail-adjuntos { padding: 0 16px 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--panel-2); font-size: 13px; color: var(--text); }
.chip:hover { text-decoration: none; border-color: var(--brand); }
.chip .ic { width: 14px; height: 14px; }
.chip .btn.icon.small { padding: 0 2px; }
.chip input { width: auto; margin: 0; }
.con-extra { display: flex; gap: 6px; align-items: center; }
.con-extra input { flex: 1; min-width: 0; }
.redactor textarea { font: inherit; }
.mail-solo-movil { display: none; }
.girando .ic { animation: girar 1s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
@media (max-width: 1000px) {
  .mail-app { grid-template-columns: 200px minmax(0, 1fr); }
  .mail-solo-ancho { display: none; }
}
@media (max-width: 760px) {
  .mail-app { grid-template-columns: 1fr; min-height: 0; }
  .mail-app .mail-nav, .mail-app .mail-list { display: none; border-right: 0; }
  .mail-app.pane-nav .mail-nav, .mail-app.pane-list .mail-list { display: flex; }
  .mail-solo-movil { display: inline-flex; }
  .mail-rows { max-height: none; }
  .mail-filtros [data-titulo-lista] { flex-basis: 100%; max-width: none; order: -1; padding: 2px 6px 4px; }
}

/* Mail a pantalla completa (botón de maximizar en la lista de correos) */
/* (17-11-2026) solo en el ordenador: en el teléfono el modo a pantalla completa escondía la barra de menú y no se podía volver */
@media (min-width: 761px) {
  body.mail-max .sidebar, body.mail-max .topbar { display: none; }
  body.mail-max #view { padding: 0; max-width: none; }
  body.mail-max .mail-app { min-height: 100vh; border: 0; border-radius: 0; }
}
@media (max-width: 760px) { [data-max-mail] { display: none !important; } }
.modal-botones .modal-max-texto { padding: 6px 10px; white-space: nowrap; }

.chk-lista { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; }
.chk-lista .chk { display: flex; gap: 8px; align-items: center; font-size: 13.5px; }
.chk-lista input { width: auto; margin: 0; }
@media (max-width: 760px) { .chk-lista { grid-template-columns: 1fr; } }

/* ---------- barra lateral clara: menús en negro y negrita (petición del usuario) */
.sidebar { background: #f3f3f1; border-right-color: #d9d9d4; }
.brand strong { color: #000; }
#nav a, #nav .nav-group-head, #nav .nav-back { color: #000; font-weight: 700; }
#nav a .ic, #nav .nav-group-head .ic, #nav .nav-back .ic { color: #000; stroke: #000; }
#nav a:hover, #nav .nav-group-head:hover, #nav .nav-back:hover { background: #e4e4df; color: #000; }
#nav a.active, #nav .nav-group.contiene-activo .nav-group-head { background: #d6e4ff; color: #000; }
#nav a.active .ic, #nav .nav-group.contiene-activo .nav-group-head .ic { color: #1a56c4; stroke: #1a56c4; }
.nav-group-items { border-left-color: #cfcfca; }
#btn-salir { color: #b3261e; border-top-color: #d9d9d4; }
#btn-salir .ic { color: #b3261e; stroke: #b3261e; }
#btn-salir:hover { background: #fbe4e2; }
.sidebar-foot { border-top-color: #d9d9d4; }
.sidebar-foot .btn.ghost { color: #333; }
.sidebar-foot .btn.ghost:hover { background: #e4e4df; color: #000; }
.brand-mark img { background: #fff; border: 1px solid #d9d9d4; }
body.paneles-claros .sidebar { --text: #000; --muted: #333; }
@media (max-width: 760px) {
  .sidebar { background: rgba(243, 243, 241, .96); border-top-color: #d9d9d4; }
}

/* ---------- alarmas de la agenda */
.alarma-tag .ic { width: 14px; height: 14px; color: var(--volt); vertical-align: -2px; }
.alarma-modal .modal { border-color: var(--volt); box-shadow: 0 0 0 3px rgba(246, 196, 51, .25), var(--shadow); }
.alarma-modal .modal-head h2 .ic { color: var(--volt); }

/* ---- Trabajos pendientes por cliente */
.conv.sin-pendientes .conv-abrir strong { color: var(--muted); font-weight: 500; }
.tp-urgente { color: var(--bad); font-weight: 600; }
.tp-tarde { color: var(--warn); font-weight: 600; }
.tp-add { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; }
.tp-add input[name="titulo"] { flex: 1 1 240px; min-width: 0; }
.tp-add select, .tp-add input[type="date"] { width: auto; flex: none; }
.tp-lista .tp { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.tp-lista .tp:last-child { border-bottom: 0; }
.tp .grow { flex: 1; min-width: 0; }
.tp-titulo { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.tp-titulo strong { font-weight: 600; }
.tp.tarde .tp-titulo strong { color: var(--warn); }
.tp.done .tp-titulo strong { text-decoration: line-through; color: var(--muted); }
.tp.done .badge { opacity: .6; }
.tp-botones { display: flex; gap: 2px; flex: none; align-items: center; }
.tp-parte { border: 0; cursor: pointer; font: inherit; font-size: 11.5px; font-weight: 600; }
.tp-parte:hover { filter: brightness(1.15); }
@media (max-width: 760px) {
  .tp-lista .tp { flex-wrap: wrap; }
  .tp-botones { width: 100%; justify-content: flex-end; padding-left: 32px; }
}
.check.fijo { cursor: default; }
.badge.tp-externo { background: var(--info-bg); color: var(--info); }
/* acceso externo (un cliente): solo su lista de trabajos pendientes */
body.externo .topbar, body.externo .sidebar-foot, body.externo #nav .nav-group-head,
body.externo #nav a:not([data-view="pendientes"]):not([data-view="proyectos"]):not([data-view="planos"]):not([data-view="transcripciones"]):not(#btn-salir) { display: none !important; }
body.externo:not(.externo-proyectos) #nav a[data-view="proyectos"] { display: none !important; }
body.externo:not(.externo-planos) #nav a[data-view="planos"] { display: none !important; }
/* acceso solo a Transcripciones: ni pendientes ni proyectos; un acceso de cliente no ve Transcripciones */
body.externo-transcripciones #nav a[data-view="pendientes"], body.externo-transcripciones #nav a[data-view="proyectos"] { display: none !important; }
body.externo:not(.externo-transcripciones) #nav a[data-view="transcripciones"] { display: none !important; }
body.externo #nav .nav-group-items { margin-left: 0; padding-left: 0; border-left: 0; }
body.externo .split-proy { grid-template-columns: minmax(0, 1fr); }
body.externo .split-proy .chat-lista { display: none; }
body.externo .modal .chk { white-space: normal; }
.pasos-wa { margin: 0 0 6px; padding-left: 20px; display: grid; gap: 6px; font-size: 13.5px; }
.pasos-wa code { background: var(--panel-3); padding: 2px 6px; border-radius: 5px; font-size: 12.5px; }

/* entrada con Face ID / Touch ID */
.login-modal .modal-foot { justify-content: space-between; }
.login-modal .modal-foot .btn.bio { margin-right: auto; }
/* pantalla de entrada: solo la ventana de usuario y contraseña sobre la foto de fondo de la app */
body.arrancando .sidebar, body.arrancando main, body.en-login .sidebar, body.en-login main, body.en-login .modal-back:not(.login-modal) { display: none !important; }
body.en-login::before { content: ""; position: fixed; inset: 0; z-index: 0; background: var(--fondo-entrada, none) center / cover no-repeat; }
.modal-back.login-modal { background: rgba(0, 0, 0, .28); backdrop-filter: none; -webkit-backdrop-filter: none; align-items: center; }
.login-modal .modal { max-width: 420px; }

/* apartados plegables de Ajustes */
.card.plegable .sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; user-select: none; }
.card.plegable .sec-head h2 { margin: 0; }
.card.plegable .sec-head .btn.icon.small { padding: 3px; }
.card.plegable .sec-head .ic { transition: transform .18s; }
.card.plegable .sec-body { margin-top: 12px; }
.card.plegable.plegado .sec-body { display: none; }
.card.plegable.plegado .sec-head .ic { transform: rotate(-90deg); }
.card.plegable.plegado { padding-top: 12px; padding-bottom: 12px; }
.btn[hidden] { display: none; }
/* adjuntos del correo a un proyecto */
.mail-adjuntos h3 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lbl { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.check-line input { accent-color: var(--brand); width: 16px; height: 16px; margin: 0; }
.stack.small > * + * { margin-top: 6px; }
.mail-en-proyectos { margin-top: 6px; }
.mail-en-proyectos .chip { cursor: pointer; }
.check-line.full { grid-column: 1 / -1; }
/* presupuestos */
.badge.enviado { background: var(--warn-bg); color: var(--warn); }
.badge.aceptado { background: var(--ok-bg); color: var(--ok); }
.badge.rechazado { background: var(--bad-bg); color: var(--bad); text-decoration: line-through; }
.badge.caducado { background: var(--bad-bg); color: var(--bad); }
.badge.interno { background: color-mix(in srgb, var(--muted) 18%, transparent); color: var(--text); }
.codigo-prev { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: var(--panel-3); padding: 6px 10px; border-radius: 8px; overflow-wrap: anywhere; }
/* proveedores: textos largos en la cabecera de la tarjeta */
.client-head .stat { min-width: 0; }
.client-head .stat b.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
/* contactos de un proveedor */
.contactos { display: grid; gap: 8px; }
.contacto { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.contacto .grow { flex: 1; min-width: 0; }
.contacto .small { overflow-wrap: anywhere; }
.contacto .doc-acts { display: flex; gap: 2px; flex: none; }
/* sugerencias de destinatarios al redactar un correo (05-11-2026) */
.con-sugerencias { position: relative; }
.sugerencias { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; background: var(--panel); border: 1px solid var(--line-2, var(--line)); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); padding: 4px; max-height: 240px; overflow: auto; }
.sugerencias .sug { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--text); font: inherit; padding: 7px 10px; border-radius: 7px; cursor: pointer; }
.sugerencias .sug:hover, .sugerencias .sug.sel { background: var(--panel-2); }
.mail-contacto { margin-left: 6px; vertical-align: middle; }
.mail-contacto.en-contactos { color: var(--brand-3); }
/* Contactos (agenda personal, en FTG; 05-11-2026) */
.contactos-cats { margin-bottom: 4px; }
.contactos-grupo { margin: 16px 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.contacto-ficha { align-items: center; }
.contacto-ficha .avatar { flex: none; }
.contacto-ficha .doc-acts { flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 760px) { .contacto-ficha { flex-wrap: wrap; } .contacto-ficha .doc-acts { width: 100%; justify-content: flex-start; padding-left: 42px; } }
/* etiquetas de Privacidad */
.etiq { display: inline-block; padding: 1px 8px; margin-left: 4px; border-radius: 999px; font-size: 11.5px; font-weight: 500; background: var(--brand-2); color: var(--brand-3); border: 0; cursor: pointer; vertical-align: 2px; font-family: inherit; }
.etiq:hover { filter: brightness(1.15); }
.etiq-filtro { margin-bottom: 12px; align-items: center; }
.etiq-filtro .chip, .chip.small { cursor: pointer; padding: 3px 9px; font-size: 12.5px; }
.chip.sel { border-color: var(--brand); background: var(--brand-2); color: var(--brand-3); }
.creds td.cred-etiq { white-space: normal; max-width: 180px; }
.creds td.cred-etiq .etiq { margin: 2px 4px 2px 0; }
.etiq-casillas label.chip input { width: 14px; height: 14px; margin: 0; accent-color: var(--brand); }
/* seguridad de inicio de sesión */
.seg-resumen { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.seg-kpi { border-left: 4px solid var(--c); }
.seg-barra { height: 8px; border-radius: 999px; background: var(--panel-3); overflow: hidden; margin-top: 4px; }
.seg-relleno { height: 100%; border-radius: 999px; transition: width .3s; }
.seg-nivel { font-size: 13px; }

b.bad { color: var(--bad); }

.pend-conf { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--brand); border-radius: 10px; background: var(--brand-2); }
.pend-conf .pend-txt { margin-bottom: 8px; font-weight: 600; }
.pend-conf .pend-txt.hecho { color: var(--ok); margin-bottom: 0; }
.pend-conf .pend-txt.bad { color: var(--bad); margin-bottom: 0; }
.pend-conf .pend-txt.muted { margin-bottom: 0; }

/* ficha del proyecto, pestaña «Por días» (22-10-2026) */
.dia { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: var(--panel-2); }
.dia-cab { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.dia-cab strong::first-letter { text-transform: uppercase; }
.dia-anots { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.dia-anot { display: flex; gap: 8px; align-items: flex-start; background: var(--field); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.dia-anot-texto { flex: 1; min-width: 0; white-space: pre-wrap; font-size: 13.5px; line-height: 1.45; }
.dia-anot-acts { display: flex; gap: 2px; flex: none; }
.dia-anot .grow { flex: 1; min-width: 0; }
.dia-docs { margin-bottom: 8px; }
.dia-tabla { margin-bottom: 6px; }
.dia-nueva .tp-add { margin: 0; }
.dia-nueva input[type="date"] { flex: none; }

/* imprimir el proyecto por días: selección de anotaciones y fotos (22-10-2026) */
.imp-dia .chk { white-space: normal; align-items: flex-start; }
.imp-anot { display: flex; gap: 8px; padding: 4px 0; font-size: 13.5px; }
.imp-anot span { white-space: pre-wrap; }
.imp-fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 6px; }
.imp-foto { display: flex; flex-direction: column; gap: 4px; background: var(--field); border: 1px solid var(--line); border-radius: 8px; padding: 6px; cursor: pointer; min-width: 0; }
.imp-foto img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; display: block; }
.imp-foto input { width: auto; margin: 0; }
.imp-foto span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-foto:has(input:checked) { border-color: var(--brand); background: var(--brand-2); }

/* proyectos terminados: van al final de la lista y se atenúan un poco */
tr.proy-fin td { opacity: .72 }
tr.proy-fin:hover td { opacity: 1 }

/* botón «Mover a otro día» dentro del editor de eventos */
.form .mover-dia { gap: 10px; align-items: center; flex-wrap: wrap; margin: -4px 0 2px }

/* elegir qué eventos del día se imprimen */
.imp-evento { padding: 6px 0 }
.imp-evento .badge { margin-left: 4px }

/* firma del cliente en los albaranes: lienzo para firmar con el dedo */
.firma-lienzo { display: block; width: 100%; aspect-ratio: 3 / 1; background: #fff; border: 1px dashed var(--line-2, #555); border-radius: 8px; touch-action: none; cursor: crosshair; }

/* ---------- estadísticas de facturación en Inicio (2-11-2026) */
.kpis-fact { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi.stat-fact .value { font-size: 20px; }
.stats-fact.plegada .section-title { margin-bottom: 0; }
.stats-fact .fact-min .ic { transition: transform .15s; }
.stats-fact.plegada .fact-min .ic { transform: rotate(-90deg); }
.stats-fact-cuerpo[hidden] { display: none; }
.kpi.stat-fact.alerta { border-left: 3px solid var(--bad); }
.var-ok { color: var(--ok); } .var-bad { color: var(--bad); }
.grafico-fact { position: relative; }
.svg-fact { width: 100%; height: auto; display: block; overflow: visible; }
.svg-fact .grid-l { stroke: var(--line); stroke-width: 1; }
.svg-fact .grid-t { fill: var(--muted); font-size: 10px; }
.svg-fact .base { stroke: var(--line-2, var(--line)); stroke-width: 1; }
.svg-fact .barra path { fill: var(--brand); opacity: .62; transition: opacity .12s; }
.svg-fact .barra.actual path { opacity: 1; }
.svg-fact .barra:hover path { opacity: 1; }
.svg-fact .barra .hit { fill: transparent; cursor: pointer; }
.svg-fact .barra .vacio { stroke: var(--line-2, var(--line)); stroke-width: 2; }
.svg-fact .valor { fill: var(--text); font-size: 10.5px; font-weight: 600; text-anchor: middle; font-variant-numeric: tabular-nums; }
.svg-fact .eje { fill: var(--muted); font-size: 10px; text-anchor: middle; }
.tooltip-fact { position: absolute; background: var(--panel); border: 1px solid var(--line-2, var(--line)); border-radius: 8px; padding: 6px 9px; font-size: 12.5px; pointer-events: none; box-shadow: var(--shadow); white-space: nowrap; z-index: 2; }
.top-clientes { display: flex; flex-direction: column; gap: 6px; }
.top-cli { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr) auto auto; gap: 10px; align-items: center; color: inherit; text-decoration: none; font-size: 13px; }
.top-cli .nombre { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-cli .barra-cli { height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.top-cli .barra-cli span { display: block; height: 100%; background: var(--brand); opacity: .7; border-radius: 4px; }
@media (max-width: 760px) {
  .kpis-fact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top-cli { grid-template-columns: minmax(0, 1fr) auto; }
  .top-cli .barra-cli, .top-cli .small { display: none; }
}

/* Privacidad como C2 Password (05-11-2026): tipos, favoritos, papelera, códigos de un solo uso, generador, compartir */
.cred-tipo { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--panel-3); color: var(--brand-3); }
.cred-tipo .ic { width: 18px; height: 18px; }
.cred-tipo.tipo-tarjeta { color: #f0a35a; } .cred-tipo.tipo-banco { color: #5ad0a0; } .cred-tipo.tipo-identidad { color: #c79bff; } .cred-tipo.tipo-nota { color: var(--volt); } .cred-tipo.tipo-mail { color: #5ec1f2; }
.filtro-tipos { margin-bottom: 10px; }
.filtro-tipos .chip { cursor: pointer; padding: 4px 10px; font-size: 12.5px; gap: 5px; }
.filtro-tipos .chip .ic { width: 14px; height: 14px; }
.filtro-tipos .chip-papelera { margin-left: auto; }
.estrella.on, .estrella.on:hover { color: var(--volt); }
.estrella.on .ic { fill: var(--volt); }
.creds tr.fav td:first-child b::before { content: "★ "; color: var(--volt); font-size: 11px; vertical-align: 1px; }
.nota-prev { white-space: normal; max-width: 320px; }
.otp-linea { margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.otp-code { font-size: 15px; letter-spacing: .06em; color: var(--brand-3); }
.otp-seg { font-size: 11.5px; color: var(--muted); letter-spacing: 0; }
.otp-seg.poco { color: var(--bad); }
.papelera-cab { justify-content: space-between; padding: 6px 0 4px; }
.tipos-cred { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.tipo-btn { display: grid; justify-items: start; gap: 6px; text-align: left; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 12px; padding: 14px; cursor: pointer; font: inherit; color: var(--text); }
.tipo-btn:hover { border-color: var(--brand); background: var(--panel-3); }
.tipo-btn .cred-tipo { width: 36px; height: 36px; }
.cred-detalle { display: grid; gap: 2px; }
.cd-fila { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cd-fila:last-child { border-bottom: 0; }
.cd-nombre { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.cd-valor { overflow-wrap: anywhere; white-space: pre-wrap; }
.cd-btns { flex-wrap: nowrap; }
.campo-extra { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.campo-extra .check-line { white-space: nowrap; }
.toolbar.nowrap { flex-wrap: nowrap; }
.historial summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.hist-fila { display: flex; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--line); }
.hist-fila .mono { flex: 1; overflow-wrap: anywhere; }
.mas-priv { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.mas-priv .btn { justify-content: flex-start; }
.gen-salida { display: flex; align-items: center; gap: 8px; background: var(--field); border: 1px solid var(--line-2); border-radius: 9px; padding: 10px 12px; margin-bottom: 8px; }
.gen-salida .mono { flex: 1; font-family: var(--mono, ui-monospace, Menlo, monospace); font-size: 16px; overflow-wrap: anywhere; letter-spacing: .03em; }
.gen .seg-barra { margin-top: 0; }
.gen-modos { margin: 14px 0 10px; }
.gen input[type=range] { width: 100%; accent-color: var(--brand); }
.email-fila { margin-bottom: 6px; }
.email-fila.con-ref { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.email-fila.con-ref [data-em-ref] { flex: 1 1 150px; min-width: 0; }
.email-fila.con-ref [data-em] { flex: 2 1 200px; min-width: 0; }
@media (max-width: 720px) {
  .cd-fila { grid-template-columns: 1fr; gap: 4px; }
  .campo-extra { grid-template-columns: 1fr 1fr; }
  .filtro-tipos .chip-papelera { margin-left: 0; }
}
.relleno-aviso { width: 100%; margin: -6px 0 8px; color: var(--warn); }

/* Privacidad con el diseño de C2 Password (05-11-2026): cabecera con «+», buscador grande, tarjetas de categorías y barra inferior */
.priv-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; min-height: 44px; }
.priv-mas-btn { width: 44px; height: 44px; border-radius: 50%; padding: 0; font-size: 26px; line-height: 1; display: grid; place-items: center; background: var(--panel-3); border-color: var(--line-2); margin-left: auto; }
.priv-mas-btn:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.priv-atras { padding-left: 4px; }
.priv-titulo { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 14px; }
.priv-buscar { display: flex; align-items: center; gap: 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 16px; margin-bottom: 14px; }
.priv-buscar .ic { width: 20px; height: 20px; color: var(--muted); }
.priv-buscar input { flex: 1; background: transparent; border: 0; padding: 13px 0; font-size: 16px; outline: none; }
.priv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
/* (17-11-2026, petición del usuario) las tarjetas de categorías van en azul con las letras en blanco */
.priv-cat { position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; align-items: start; gap: 10px 8px; text-align: left; background: #2a62d9; border: 1px solid #3a74ec; border-radius: 18px; padding: 18px; min-height: 130px; cursor: pointer; font: inherit; color: #fff; }
.priv-cat:hover { border-color: #8db4ff; background: #3570ec; }
.priv-cat-ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: #fff; box-shadow: 0 0 0 1px rgba(255, 255, 255, .18); }
.priv-cat-ic .ic { width: 22px; height: 22px; stroke-width: 2; }
.priv-cat-ic.cat-todos { background: #2f5f52; color: #8fd9c0; } .priv-cat-ic.cat-login { background: #3fb59a; } .priv-cat-ic.cat-banco { background: #5a6ed6; }
.priv-cat-ic.cat-tarjeta { background: #8a5fd6; } .priv-cat-ic.cat-identidad { background: #d67f4a; } .priv-cat-ic.cat-nota { background: #2d47b5; } .priv-cat-ic.cat-mail { background: #1f9bd6; } .priv-cat-ic.cat-papelera { background: #4a4a55; }
.priv-cat-n { justify-self: end; font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; color: #fff; }
.priv-cat-t { grid-column: 1 / -1; font-size: 17px; font-weight: 600; color: #fff; line-height: 1.25; }
.priv-cat-papelera { min-height: 0; }
.cred-lista { padding: 4px 6px; }
.cred-item { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-bottom: 1px solid var(--line); cursor: pointer; }
.cred-item:last-child { border-bottom: 0; }
.cred-item:hover { background: var(--panel-2); }
.cred-item .grow { flex: 1; min-width: 0; }
.cred-item .grow b, .cred-item .grow .small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cred-item-acts { display: flex; align-items: center; gap: 2px; flex: none; }
.cred-chev { display: inline-flex; margin-left: 4px; }
.cred-chev .ic { width: 16px; height: 16px; transform: rotate(-90deg); }
.priv-barra { position: sticky; bottom: 12px; margin: 22px auto 0; width: max-content; max-width: 100%; display: flex; gap: 4px; background: color-mix(in srgb, var(--panel-3) 92%, transparent); border: 1px solid var(--line-2); border-radius: 999px; padding: 5px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: var(--shadow); z-index: 5; }
.priv-barra button { display: grid; justify-items: center; gap: 2px; min-width: 104px; padding: 8px 14px; border: 0; border-radius: 999px; background: transparent; color: var(--text); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.priv-barra button .ic { width: 22px; height: 22px; }
.priv-barra button:hover { background: var(--panel-2); }
.priv-barra button.active { background: #2a62d9; color: #fff; }
@media (max-width: 760px) {
  .priv-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .priv-cat { padding: 14px; min-height: 120px; border-radius: 16px; }
  .priv-titulo { font-size: 28px; }
  .priv-barra { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom)); margin: 0; width: calc(100% - 32px); justify-content: space-around; }
  .priv-barra button { min-width: 0; flex: 1; }
  #view:has(.priv-barra) { padding-bottom: 120px; }
}

/* Ventana de subida en curso: fondo de agua animado que cubre la pantalla mientras se envía un archivo */
.subida-back { position: fixed; inset: 0; z-index: 95; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: subida-aparecer .25s ease-out; }
.subida { position: relative; overflow: hidden; width: 100%; max-width: 520px; min-height: 250px; border-radius: 16px; border: 1px solid rgba(120, 190, 255, .35); box-shadow: 0 30px 80px rgba(0, 0, 0, .6); background: linear-gradient(180deg, #06243f 0%, #063f6e 40%, #0a5fa3 100%); display: flex; align-items: center; justify-content: center; }
.subida .ola { position: absolute; left: 0; right: 0; bottom: 0; height: 58%; pointer-events: none; background-repeat: repeat-x; background-position: 0 bottom; background-size: 600px 100%; }
.subida .ola.o1 { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 200' preserveAspectRatio='none'><path d='M0 90 C150 40 150 140 300 90 C450 40 450 140 600 90 L600 200 L0 200 Z' fill='rgba(90,170,240,0.45)'/></svg>"); animation: subida-ola 11s linear infinite; }
.subida .ola.o2 { height: 48%; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 200' preserveAspectRatio='none'><path d='M0 100 C150 150 150 50 300 100 C450 150 450 50 600 100 L600 200 L0 200 Z' fill='rgba(40,130,220,0.6)'/></svg>"); animation: subida-ola 8s linear infinite reverse; }
.subida .ola.o3 { height: 38%; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 200' preserveAspectRatio='none'><path d='M0 110 C100 70 200 150 300 110 C400 70 500 150 600 110 L600 200 L0 200 Z' fill='rgba(140,205,255,0.5)'/></svg>"); animation: subida-ola 6s linear infinite; }
.subida .luz { position: absolute; inset: 0; background: radial-gradient(ellipse at 30% 0%, rgba(255, 255, 255, .22), transparent 55%); pointer-events: none; }
.subida .texto { position: relative; z-index: 1; text-align: center; color: #fff; padding: 24px 24px 60px; text-shadow: 0 2px 12px rgba(0, 30, 70, .9); }
.subida .texto strong { display: block; font-size: 22px; letter-spacing: .12em; font-weight: 700; line-height: 1.3; }
.subida .texto span { display: block; margin-top: 10px; font-size: 13.5px; opacity: .92; }
.subida .texto .gotas { display: flex; justify-content: center; gap: 7px; margin-top: 16px; }
.subida .texto .gotas i { width: 9px; height: 9px; border-radius: 50%; background: #fff; opacity: .5; animation: subida-gota 1.2s ease-in-out infinite; }
.subida .texto .gotas i:nth-child(2) { animation-delay: .2s; }
.subida .texto .gotas i:nth-child(3) { animation-delay: .4s; }
@keyframes subida-ola { from { background-position-x: 0; } to { background-position-x: 600px; } }
@keyframes subida-gota { 0%, 100% { opacity: .35; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-5px); } }
@keyframes subida-aparecer { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .subida .ola, .subida .texto .gotas i { animation: none; } }

/* Visor de documentos (PDF) dentro de la app: páginas dibujadas con PDF.js, con desplazamiento */
.visor-paginas { flex: 1; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; padding: 8px 12px calc(16px + env(safe-area-inset-bottom)); }
.visor-paginas canvas { display: block; margin: 0 auto 10px; background: #fff; box-shadow: 0 6px 24px rgba(0, 0, 0, .5); max-width: 100%; }
.visor-aviso { text-align: center; color: rgba(255, 255, 255, .75); font-size: 13.5px; padding: 30px 12px; }

/* Mail: «Bloqueados» como subapartado de «Bloquear remitente» (30-11-2026): menú que se abre debajo del botón */
.submenu { position: relative; display: inline-flex; }
.submenu-flecha { display: inline-block; margin-left: 6px; border: 4px solid transparent; border-top-color: currentColor; border-bottom-width: 0; vertical-align: 2px; }
.submenu-lista { position: absolute; left: 0; top: calc(100% + 4px); z-index: 30; min-width: 100%; display: flex; flex-direction: column; padding: 4px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
.submenu-lista[hidden] { display: none; }
.submenu-lista button { padding: 8px 10px; border: 0; border-radius: 6px; background: none; color: var(--text); font: inherit; font-size: 13px; text-align: left; white-space: nowrap; cursor: pointer; }
.submenu-lista button:hover:not(:disabled), .submenu-lista button:focus-visible { background: var(--panel-3); }
.submenu-lista button:disabled { opacity: .5; cursor: default; }

/* Mail: ventana de remitentes bloqueados (17-11-2026) */
.bloq-lista { padding: 0; }
.bloq-fila { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.bloq-fila:last-child { border-bottom: 0; }
.bloq-quien { flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* Menú lateral fijo en el ordenador (17-11-2026, petición del usuario): al desplazar el contenido de la derecha el menú
   no se mueve. Antes era «sticky» dentro de un body de la altura de la pantalla, así que en páginas largas se iba hacia arriba. */
@media (min-width: 761px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; height: auto; z-index: 6; }
  main { margin-left: 236px; }
  body.mail-max main { margin-left: 0; }
}
@media print { main { margin-left: 0 !important; } }

/* planos (18-11-2026): lista de documentos insertados */
.plano-doc { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); min-width: 0; }
.plano-doc + .plano-doc { margin-top: 6px; }
.plano-doc-prev { flex: 0 0 52px; width: 52px; height: 52px; border: 0; padding: 0; border-radius: 6px; overflow: hidden; background: var(--bg); display: flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; }
.plano-doc-prev img { width: 100%; height: 100%; object-fit: cover; display: block; }
.plano-doc-info { flex: 1 1 auto; min-width: 0; }
.plano-doc-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plano-doc-info .chk { margin-top: 4px; white-space: normal; }
.plano-doc-acts { flex: 0 0 auto; display: flex; gap: 2px; }
.plano-elegir { max-height: 52vh; overflow: auto; }
.plano-elegible { cursor: pointer; }
.plano-elegible input { width: auto; flex: 0 0 auto; margin: 0; }
.plano-elegible .plano-doc-info .small { display: block; }
/* planos: rejilla para escribir una tabla */
.tabla-plano-wrap { overflow: auto; max-height: 56vh; border: 1px solid var(--line); border-radius: 8px; }
.tabla-plano { border-collapse: collapse; width: 100%; }
.tabla-plano th, .tabla-plano td { padding: 0; border: 1px solid var(--line); min-width: 110px; }
.tabla-plano input { width: 100%; border: 0; border-radius: 0; background: transparent; padding: 8px 9px; font-size: 14px; }
.tabla-plano th input { font-weight: 700; text-align: center; background: var(--panel-2); }
.tabla-plano input:focus { outline: 2px solid var(--accent, #4c8dff); outline-offset: -2px; }
button.plano-doc-prev .doc-ext { font-size: 10px; }
@media (max-width: 760px) { .tabla-plano input { font-size: 16px; } }
/* planos: colocar una tabla sobrepuesta */
.colocar { display: flex; gap: 18px; align-items: flex-start; }
.colocar-lado { flex: 0 0 300px; min-width: 0; }
.colocar-hoja { position: relative; flex: 0 0 auto; background: #fff; border: 1px solid var(--line); line-height: 0; user-select: none; -webkit-user-select: none; }
.colocar-hoja canvas { display: block; }
.colocar-caja { position: absolute; box-sizing: border-box; border: 2px solid #2f7dff; background: rgba(47, 125, 255, .14); cursor: move; touch-action: none; }
.colocar-asa { position: absolute; right: -9px; bottom: -9px; width: 18px; height: 18px; border-radius: 50%; background: #2f7dff; border: 2px solid #fff; cursor: nwse-resize; touch-action: none; }
@media (max-width: 760px) { .colocar { flex-direction: column; } .colocar-lado { flex: 0 0 auto; width: 100%; } .colocar-asa { width: 26px; height: 26px; right: -13px; bottom: -13px; } }
/* imprimir un PDF de la app (planos): solo salen sus páginas, a hoja completa y sin márgenes añadidos */
#impresion { display: none; }
@page { size: A4 portrait; margin: 0; }
@media print {
  html, body { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  body:has(> #impresion) > *:not(#impresion) { display: none !important; }
  #impresion { display: block; }
  /* cada hoja mide exactamente 210 x 297 mm: las medidas del plano (márgenes de 25 y 15 mm) salen reales en el papel */
  #impresion .hoja-impresa { width: 210mm; height: 297mm; overflow: hidden; break-after: page; page-break-after: always; break-inside: avoid; }
  #impresion .hoja-impresa:last-child { break-after: auto; page-break-after: auto; }
  #impresion canvas { display: block; width: 210mm; height: 297mm; }
}
/* visores (19-11-2026): «Volver» con texto, ampliación propia y sin ampliar la página entera con los dedos (la barra se perdía) */
.visor { touch-action: pan-x pan-y; }
.visor-top { flex: 0 0 auto; }
.visor-volver { flex: 0 0 auto; gap: 2px; padding-left: 6px; font-weight: 600; border: 1px solid rgba(255, 255, 255, .28); }
.visor-top .btn:disabled { opacity: .35; }
.visor-cuerpo.ampliado { display: block; overflow: auto; -webkit-overflow-scrolling: touch; }
.visor-cuerpo.ampliado img { max-width: none; max-height: none; height: auto; }
.visor-paginas { touch-action: pan-x pan-y; }
@media (max-width: 760px) { .visor-nombre { font-size: 12.5px; } .visor-top { gap: 2px; padding-left: 8px; padding-right: 8px; } }
.plano-previa { display: block; width: 100%; min-height: 120px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: #333; overflow: hidden; cursor: zoom-in; }
.plano-previa canvas { display: block; width: 100%; height: auto; }
.plano-previa canvas + canvas { border-top: 6px solid var(--bg); }
/* la ficha del plano no puede ser más ancha que la pantalla del móvil (un desplegable o un nombre largo la ensanchaban) */
.plano-ficha > * { min-width: 0; }
.plano-ficha select, .plano-ficha input { max-width: 100%; min-width: 0; }
@media (max-width: 760px) { .plano-ficha { grid-template-columns: minmax(0, 1fr); } .plano-ficha .field > span { white-space: normal; } }
/* enviar documentos: elegir correo o WhatsApp */
.vias-envio { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vias-envio .btn { justify-content: center; padding: 16px 10px; font-size: 15px; }
/* Zoom en el móvil (19-11-2026): lo hace la app sobre el contenido (zoomContenidoMovil), no el teléfono sobre la pantalla
   entera; así el menú inferior queda siempre visible, fijo y del mismo tamaño. touch-action quita el pellizco y el doble
   toque del navegador pero deja desplazarse con un dedo. */
@media (max-width: 760px) {
  html, body { touch-action: pan-x pan-y; }
  .sidebar[data-fijo] { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgb(9, 9, 11); }
}
/* Entrada (primero solo en el móvil; desde el 18-11-2026 también en el navegador del ordenador): el recuadro del usuario
   y la contraseña es una «gota de agua» transparente; la foto de fondo se ve tal cual, sin oscurecer ni emborronar.
   Antes era un panel negro opaco que tapaba media foto. */
@media all {
  .modal-back.login-modal { background: transparent; }
  .login-modal .modal {
    background: radial-gradient(ellipse 70% 46% at 26% 10%, rgba(255, 255, 255, .34), rgba(255, 255, 255, .10) 55%, rgba(255, 255, 255, 0) 78%),
                radial-gradient(ellipse 60% 34% at 74% 96%, rgba(255, 255, 255, .16), rgba(255, 255, 255, 0) 70%),
                rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .50);
    border-radius: 42px;
    box-shadow: inset 0 2px 5px rgba(255, 255, 255, .50), inset 0 -16px 28px rgba(0, 0, 0, .13), inset 0 0 0 1px rgba(255, 255, 255, .08), 0 16px 34px rgba(0, 0, 0, .26);
    backdrop-filter: saturate(1.12) brightness(1.04); -webkit-backdrop-filter: saturate(1.12) brightness(1.04);
    overflow: hidden;
  }
  .login-modal .modal-head { border-bottom-color: transparent; padding: 20px 26px 4px; }
  .login-modal .modal-head h2 { color: #fff; font-size: 19px; text-shadow: 0 1px 3px rgba(0, 0, 0, .65), 0 0 12px rgba(0, 0, 0, .35); }
  .login-modal .modal-body { padding: 12px 26px 8px; }
  .login-modal .modal-foot { background: none; border-top-color: transparent; padding: 10px 26px 24px; border-radius: 0; position: static; }
  .login-modal .field > span { color: #fff; font-weight: 600; text-shadow: 0 1px 3px rgba(0, 0, 0, .7), 0 0 10px rgba(0, 0, 0, .35); }
  .login-modal input {
    background: rgba(255, 255, 255, .13); border: 1px solid rgba(255, 255, 255, .55); border-radius: 22px; color: #fff; font-size: 16px;
    box-shadow: inset 0 1px 3px rgba(255, 255, 255, .30), inset 0 -4px 8px rgba(0, 0, 0, .08); text-shadow: 0 1px 2px rgba(0, 0, 0, .55);
    -webkit-text-fill-color: #fff; caret-color: #fff;
  }
  .login-modal input::placeholder { color: rgba(255, 255, 255, .7); }
  .login-modal input:focus { border-color: #fff; box-shadow: inset 0 1px 3px rgba(255, 255, 255, .35), 0 0 0 3px rgba(255, 255, 255, .28); }
  /* el relleno automático del iPhone pinta los cuadros de amarillo opaco: se deja transparente */
  .login-modal input:-webkit-autofill, .login-modal input:-webkit-autofill:focus { -webkit-text-fill-color: #fff; transition: background-color 9999s ease-out 0s; box-shadow: inset 0 0 0 1000px rgba(255, 255, 255, .13); }
  .login-modal .btn { border-radius: 22px; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .55); color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); box-shadow: inset 0 1px 3px rgba(255, 255, 255, .30); }
  .login-modal .btn.primary { background: rgba(60, 130, 255, .58); border-color: rgba(255, 255, 255, .65); padding-left: 22px; padding-right: 22px; }
  .login-modal .small, .login-modal .muted, .login-modal .notice { color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); }
}

/* (23-11-2026) documento interno de un proyecto: el acceso del cliente no lo ve */
.doc-interno { color: #fbbf24; }
.doc-acts [data-interno][data-es="1"] { color: #fbbf24; }
body.paneles-claros .doc-interno, body.paneles-claros .doc-acts [data-interno][data-es="1"] { color: #b45309; }  /* ámbar oscuro sobre panel claro */
body.paneles-claros th.ordenable.ordenada { color: #1d4ed8; }

/* (23-11-2026) desplegables con filtro: se escribe y debajo quedan solo las coincidencias */
.sel-b { position: relative; display: block; width: 100%; min-width: 0; }
.sel-b-oculto { display: none !important; }
.sel-b-inp { width: 100%; padding-right: 30px !important; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b8b97' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 16px; }
.sel-b-lista { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 60; max-height: 260px; min-width: 180px; overflow-y: auto;
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px; }
.sel-b-op { padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.sel-b-op:hover, .sel-b-op.activo { background: var(--brand-2); color: var(--text); }  /* con paneles claros --brand-2 es claro: letra del tema, no blanca */
.sel-b-op.elegida { font-weight: 600; }
.sel-b-nada { padding: 8px 10px; color: var(--muted); font-size: 13px; }
@media (max-width: 760px) { .sel-b-inp { font-size: 16px; } .sel-b-op { padding: 11px 10px; } }

/* (23-11-2026) columnas del listado de facturas que se ordenan al pulsarlas */
th.ordenable { cursor: pointer; user-select: none; white-space: nowrap; }
th.ordenable:hover { color: var(--text); }
th.ordenable.ordenada { color: var(--brand-3); }
.ord-flecha { font-size: 9px; margin-left: 5px; vertical-align: middle; }

/* (23-11-2026) listado de facturas: una línea por factura, filas juntas, cabecera y sumas siempre a la vista */
.fact-lista { overflow: auto; padding: 0 !important; overscroll-behavior: contain; }
.fact-tabla { border-collapse: separate; border-spacing: 0; font-size: 13px; }
.fact-tabla th, .fact-tabla td { padding: 3px 7px; white-space: nowrap; vertical-align: middle; }
.fact-tabla td.fact-cli { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.fact-tabla .badge { padding-top: 1px; padding-bottom: 1px; font-size: 11px; }
.fact-tabla .btn.icon.small { padding: 0; width: 22px; height: 22px; min-height: 0; min-width: 0; }
.fact-tabla .btn.icon.small .ic { width: 14px; height: 14px; }
.fact-tabla th, .fact-tabla td { line-height: 1.25; }
.fact-tabla .badge { line-height: 1.3; }
.fact-tabla thead th { position: sticky; top: 0; z-index: 2; background: var(--panel); border-bottom: 1px solid var(--line-2); }
.fact-tabla tfoot td { position: sticky; bottom: 0; z-index: 2; background: var(--panel-2); border-top: 1px solid var(--line-2); padding-top: 8px; padding-bottom: 8px; }
.fact-tabla tbody tr:last-child td { border-bottom: 1px solid var(--line); }
.fact-tabla td.fact-forma { max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.fact-tabla td.fact-cli { max-width: 260px; }

/* (23-11-2026) facturación por años: una ficha por año encima del listado de facturas */
.fact-anios { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }
.fact-anios:empty { display: none; }
.fact-anio { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 7px 12px; min-width: 150px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; color: var(--text); font: inherit; font-size: 12px; cursor: pointer; text-align: left; }
.fact-anio span { color: var(--muted); }
.fact-anio .tot { color: var(--text); font-weight: 700; font-size: 14px; }
.fact-anio:hover { border-color: var(--line-2); }
.fact-anio.active { border-color: var(--brand); background: var(--brand-2); }

/* (23-11-2026) facturas ya cobradas: toda la fila con un fondo algo más oscuro, de lado a lado */
/* segunda versión: solo un punto más oscuro que el fondo normal de la lista (#111114), no casi negro */
/* tercera versión: el tono sale del color del panel que tenga puesto el usuario en Ajustes (en producción es claro, con
   letra oscura: un fondo oscuro fijo dejaba la fila en negro e ilegible). Siempre un punto más oscuro que el fondo. */
.fact-tabla tbody tr.cobrada td { background: color-mix(in srgb, var(--panel) 58%, #000); }  /* «2 puntos menos» (historia: 90, 82, 70, 46 %; cada punto = 6) */
/* (24-11-2026) albaranes de proveedor con todo su material ya en albaranes o facturas de cliente: mismo fondo oscuro */
.compra-tabla tbody tr.cobrada td, table.lines tbody tr.cobrada td { background: color-mix(in srgb, var(--panel) 58%, #000); }
.compra-tabla tbody tr.cobrada:hover td { background: color-mix(in srgb, var(--panel) 52%, #000); }
.fact-tabla tbody tr.cobrada:hover td { background: color-mix(in srgb, var(--panel) 52%, #000); }
.fact-tabla tbody tr.cobrada .muted { color: inherit; }  /* sobre un fondo tan oscuro el gris de «No» no se leía */
.fact-tabla th { letter-spacing: .03em; }
.fact-tabla { font-size: 12.5px; }
.fact-tabla th, .fact-tabla td { padding: 3px 6px; }
.fact-tabla th { font-size: 10px; }
.fact-tabla td.fact-cli { max-width: 210px; }
.fact-tabla td.fact-forma { max-width: 150px; }

/* (24-11-2026) buscador de la agenda: lista de resultados */
.ev-resultados { display: flex; flex-direction: column; max-height: 46vh; overflow-y: auto; }
.ev-res { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; text-align: left; padding: 7px 8px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--text); font: inherit; cursor: pointer; }
.ev-res:first-child { border-top: 0; }
.ev-res:hover { background: var(--panel-2); }
.ev-res.hecho .ev-res-t b { font-weight: 500; }
.ev-res-f { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ev-res-d { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 700px) { .ev-res { grid-template-columns: minmax(0, 1fr); gap: 2px; } }

/* (24-11-2026) descripción original del material, en segundo plano bajo el texto que escribe el usuario en la línea */
.linea-original { margin-top: 3px; font-size: 11.5px; line-height: 1.3; opacity: .8; }

/* Horas internas de llegada y salida en las líneas de mano de obra (25-11-2026) */
.horas-internas { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 6px; padding: 6px 8px; border: 1px dashed var(--line); border-radius: 8px; }
.horas-internas label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin: 0; }
.horas-internas input[type=time] { width: auto; min-width: 104px; padding: 4px 6px; }
.horas-internas input[name=hora_nota] { flex: 1 0 100%; padding: 4px 8px; font-size: 13px; }

/* «Cómo piensa el Cerebro» dentro de la app y como fondo de pantalla (25-11-2026) */
.neuronal-frame { display: block; width: 100%; height: calc(100vh - 175px); min-height: 600px; border: 1px solid var(--line); border-radius: 12px; background: #050508; }
/* El Cerebro al entrar en la aplicación (26-11-2026): ocupa todo menos el menú; app.js le pone el borde izquierdo o el de abajo */
.cerebro-entrada { position: fixed; inset: 0; z-index: 15; background: #050508; }
.cerebro-entrada iframe { display: block; width: 100%; height: 100%; border: 0; }
body.con-cerebro-entrada { overflow: hidden; }
/* Pestañas de Inicio («Cómo piensa el Cerebro» y fondo), bien visibles y sin montarse (petición 26-11-2026): dos grupos
   con su rótulo, cada pestaña con borde y fondo propios, y la elegida en azul macizo. En el móvil cada grupo ocupa su fila. */
.pestanas-cerebro { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: stretch; }
.pestanas-cerebro .grupo { display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 4px 14px rgba(0, 0, 0, .3); }
.pestanas-cerebro .rotulo { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); padding: 0 6px 0 4px; white-space: nowrap; }
.pestanas-cerebro .pest { font: inherit; font-size: 13.5px; font-weight: 650; line-height: 1.2; white-space: nowrap; color: var(--text); background: var(--panel-3); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 13px; cursor: pointer; }
.pestanas-cerebro .pest:hover { border-color: var(--brand); }
.pestanas-cerebro .pest.principal { background: var(--brand-2); border-color: var(--brand); color: #dbe8ff; }
.pestanas-cerebro .pest.active { background: var(--brand); border-color: var(--brand-3); color: #fff; }
.pestanas-cerebro .pest:focus-visible { outline: 2px solid var(--brand-3); outline-offset: 2px; }
@media (max-width: 760px) {
  .pestanas-cerebro { width: 100%; }
  .pestanas-cerebro .grupo { flex: 1 1 100%; flex-wrap: wrap; }
  .pestanas-cerebro .rotulo { flex: 1 0 100%; padding: 2px 4px; }
  .pestanas-cerebro .pest { flex: 1 1 auto; text-align: center; }
}
.fondo-cerebro-frame { position: fixed; inset: 0 0 0 236px; width: calc(100% - 236px); height: 100%; border: 0; z-index: -1; pointer-events: none; opacity: .6; }
body.fondo-cerebro.con-marca main::before { display: none; }
body.fondo-cerebro .card, body.fondo-cerebro .mail-app, body.fondo-cerebro .topbar { background-color: color-mix(in srgb, var(--panel) 86%, transparent); }
@media (max-width: 760px) { .fondo-cerebro-frame { inset: 0; width: 100%; } .neuronal-frame { height: calc(100vh - 260px); } }

/* Barra de preguntas al Cerebro, más remarcada (petición 26-11-2026): caja blanca con borde azul, letra negra nítida
   y el micrófono en azul macizo para que se vea. Vale con cualquier color de paneles elegido en Ajustes. */
.topbar .quick-ask { background: #fff; border: 2px solid var(--brand); border-radius: 10px; padding: 0 14px; color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent), 0 4px 14px rgba(0, 0, 0, .35); }
.topbar .quick-ask:focus-within { border-color: var(--brand-3); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 40%, transparent), 0 4px 14px rgba(0, 0, 0, .35); }
.topbar .quick-ask .ic { width: 20px; height: 20px; stroke-width: 2.2; color: var(--brand); }
.topbar .quick-ask input { color: #000; font-size: 15.5px; font-weight: 500; padding: 11px 0; caret-color: var(--brand); -webkit-text-fill-color: #000; }
.topbar .quick-ask input::placeholder { color: #5c5c68; -webkit-text-fill-color: #5c5c68; font-weight: 400; opacity: 1; }
.topbar #btn-voz { width: 46px; height: 46px; flex: none; padding: 0; justify-content: center; border-radius: 50%; background: var(--brand); border: 2px solid var(--brand-3); color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35); }
.topbar #btn-voz .ic { width: 24px; height: 24px; stroke-width: 2.2; color: #fff; stroke: #fff; }
.topbar #btn-voz:hover { background: var(--brand-3); }
.topbar .quick-ask input, .topbar .quick-ask input:focus, .topbar .quick-ask input:focus-visible { border: 0; outline: 0; box-shadow: none; background: transparent; border-radius: 0; }

/* eBUS (26-11-2026): valores de la caldera en tarjetas que se reparten solas según el ancho */
.ebus-kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.ebus-pasos { margin: 0 0 10px; padding-left: 18px; display: grid; gap: 8px; }
@media (max-width: 760px) { .ebus-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Facturas recibidas (26-11-2026): la ficha a la izquierda y el documento a la derecha; en pantallas estrechas, uno bajo otro */
.rec-edicion { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.rec-edicion .pdf-marco { height: 62vh; }
@media (max-width: 900px) { .rec-edicion { grid-template-columns: 1fr; } .rec-edicion .pdf-marco { height: 45vh; } }
.rec-tabla tbody tr.cobrada td { background: color-mix(in srgb, var(--panel) 58%, #000); }  /* fondo más oscuro, como facturas y albaranes: artículos ya en Materiales o no añadidos por estar subidos desde albaranes */
.rec-tabla tbody tr.click { cursor: pointer; }
/* (26-11-2026, petición) cada factura en una sola línea: nada se parte en dos renglones; el proveedor largo se recorta con puntos */
.rec-tabla th, .rec-tabla td { white-space: nowrap; padding-left: 6px; padding-right: 6px; }
.rec-tabla td { font-size: 13px; }
.rec-tabla th:first-child, .rec-tabla td:first-child { padding-left: 14px; }
.rec-tabla td.rec-corta { max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
.rec-tabla .badge { font-size: 11px; }
.badge.servicio { background: var(--info-bg); color: var(--info); max-width: 130px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }  /* (26-11-2026) factura de un servicio */
