/* App Fontanería · estilos (móvil primero)
   Modo oscuro: sigue al móvil salvo que el usuario elija con el botón de sol/luna (html[data-tema]).
   Cada regla oscura va dos veces: dentro de @media con html:not([data-tema="claro"]) y fuera con html[data-tema="oscuro"]. */
/* Tipografía propia (Source Sans 3, licencia OFL en assets/fuentes): igual en todos los móviles y ordenadores */
@font-face { font-family: "Source Sans 3"; src: url("fuentes/source-sans-3.woff2") format("woff2");
  font-weight: 200 900; font-style: normal; font-display: swap; }
:root {
  --azul: #1565c0;
  --azul-osc: #0d47a1;
  --azul-claro: #e3f0fd;
  --fondo: #f3f5f8;
  --tarjeta: #ffffff;
  --texto: #1d2733;
  --suave: #5f6b7a;
  --borde: #dde3ea;
  --ok: #2e7d32;
  --ok-fondo: #e8f5e9;
  --error: #c62828;
  --error-fondo: #fdecea;
  --naranja: #ef6c00;
  --radio: 12px;
  --sombra: 0 1px 3px rgba(20, 30, 50, .08);
  --menu-alto: 64px;
}
@media (prefers-color-scheme: dark) {
  html:not([data-tema="claro"]) {
    --azul: #64a8f0;
    --azul-osc: #90c2f7;
    --azul-claro: #1b2c40;
    --fondo: #12171d;
    --tarjeta: #1b222b;
    --texto: #e6ebf1;
    --suave: #9aa7b6;
    --borde: #2c3640;
    --ok-fondo: #183020;
    --error-fondo: #3a1c1c;
    --sombra: none;
  }
}
html[data-tema="oscuro"] {
    --azul: #64a8f0;
    --azul-osc: #90c2f7;
    --azul-claro: #1b2c40;
    --fondo: #12171d;
    --tarjeta: #1b222b;
    --texto: #e6ebf1;
    --suave: #9aa7b6;
    --borde: #2c3640;
    --ok-fondo: #183020;
    --error-fondo: #3a1c1c;
    --sombra: none;
  }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16.5px/1.45 "Source Sans 3", "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--fondo);
  color: var(--texto);
  padding-bottom: calc(var(--menu-alto) + env(safe-area-inset-bottom));
}
a { color: var(--azul); }
h1 { font-size: 1.5rem; margin: .25rem 0 1rem; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h1 small { color: var(--suave); font-weight: 400; font-size: 1rem; }
code { background: var(--azul-claro); padding: 0 .3em; border-radius: 4px; }

.icono { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Barra superior */
.barra {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--azul); color: #fff;
  padding: .5rem 1rem; padding-top: calc(.5rem + env(safe-area-inset-top));
  min-height: 52px;
}
@media (prefers-color-scheme: dark) { html:not([data-tema="claro"]) .barra { background: #0f2a47; } }
html[data-tema="oscuro"] .barra { background: #0f2a47; }
.barra-izq { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.barra-der { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.marca { color: #fff; font-weight: 700; font-size: 1.1rem; text-decoration: none; }
.btn-icono { color: #fff; display: inline-flex; padding: .35rem; margin-left: -.35rem; border-radius: 8px; }
.btn-icono .icono { width: 24px; height: 24px; }
.menu-escritorio { display: none; gap: .25rem; }
.menu-escritorio a { color: #fff; text-decoration: none; padding: .4rem .8rem; border-radius: 8px; opacity: .85; }
.menu-escritorio a.activo, .menu-escritorio a:hover { background: rgba(255,255,255,.15); opacity: 1; }

/* Menú inferior en móvil */
.menu-movil {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; background: var(--tarjeta); border-top: 1px solid var(--borde);
  padding-bottom: env(safe-area-inset-bottom);
}
.menu-movil a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: var(--menu-alto); font-size: .75rem; color: var(--suave); text-decoration: none; gap: 2px;
}
.menu-movil a .icono { width: 24px; height: 24px; }
.menu-movil a.activo { color: var(--azul); font-weight: 600; }

@media (min-width: 800px) { .solo-movil { display: none; } }
.contenido { max-width: 1100px; margin: 0 auto; padding: 1rem; }

@media (min-width: 800px) {
  body { padding-bottom: 0; }
  .menu-escritorio { display: flex; }
  .menu-movil { display: none; }
  .contenido { padding: 1.5rem 2rem; }
}

/* Tarjetas y estructura */
.tarjeta {
  background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio);
  box-shadow: var(--sombra); padding: 1rem; margin-bottom: 1rem;
}
.estrecha { max-width: 440px; margin: 1.5rem auto; }
.rejilla-2 { display: grid; gap: 1rem; }
@media (min-width: 800px) { .rejilla-2 { grid-template-columns: 1fr 1fr; } .rejilla-2 > .tarjeta { margin: 0; } }
.encabezado { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.encabezado h1 { margin-bottom: .75rem; }
.centrado { text-align: center; }
.vacio { color: var(--suave); text-align: center; padding: 1rem 0; margin: 0; }
.sub { color: var(--suave); margin: -.75rem 0 0; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .5rem 1rem; border-radius: 10px;
  border: 1px solid var(--borde); background: var(--tarjeta); color: var(--texto);
  font: inherit; font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--azul); }
.btn-principal { background: var(--azul); border-color: var(--azul); color: #fff; }
@media (prefers-color-scheme: dark) { html:not([data-tema="claro"]) .btn-principal { color: #0b1724; } }
html[data-tema="oscuro"] .btn-principal { color: #0b1724; }
.btn-principal:hover { background: var(--azul-osc); }
.btn-peligro { color: var(--error); border-color: var(--error); background: transparent; }
.btn-bloque { width: 100%; }
.btn-peq { min-height: 36px; padding: .3rem .7rem; font-size: .9rem; }
.btn-archivo { position: relative; }
.botones { display: flex; flex-wrap: wrap; gap: .5rem; }

/* Formularios */
.formulario { display: flex; flex-direction: column; gap: .85rem; }
.formulario label, .subir-fotos label:not(.btn) { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; color: var(--suave); }
input:not([type=hidden]):not([type=file]), textarea, select {
  font: inherit; font-size: 16px; /* evita el zoom automático en iPhone */
  color: var(--texto); background: var(--tarjeta);
  border: 1px solid var(--borde); border-radius: 10px; padding: .65rem .75rem; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--azul); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; }
.fila-2 { display: grid; gap: .85rem; }
@media (min-width: 600px) { .fila-2 { grid-template-columns: 1fr 1fr; } }

/* Avisos */
.aviso { padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem; }
.aviso-ok { background: var(--ok-fondo); color: var(--ok); }
.aviso-error { background: var(--error-fondo); color: var(--error); }
.lista-requisitos { list-style: none; padding: 0; }
.lista-requisitos .ok { color: var(--ok); }
.lista-requisitos .mal { color: var(--error); }

/* Buscador */
.buscador { position: relative; margin-bottom: 1rem; }
.buscador .icono { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--suave); }
.buscador input { padding-left: 2.6rem !important; border-radius: 999px !important; min-height: 48px; }

/* Inicio */
.saludo { font-size: 1.35rem; }
.acciones-rapidas { margin-bottom: 1rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.cifras { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: 1rem; }
.cifra { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: .75rem; text-align: center; }
.cifra strong { display: block; font-size: 1.5rem; color: var(--azul); }
.cifra span { font-size: .8rem; color: var(--suave); }

/* Listas */
.lista { list-style: none; margin: 0; padding: 0; }
.lista li + li { border-top: 1px solid var(--borde); }
.lista a { display: flex; flex-direction: column; padding: .7rem 0; color: inherit; text-decoration: none; }
.lista-titulo { font-weight: 600; }
.lista-titulo small { font-weight: 400; color: var(--suave); }
.lista-sub { color: var(--suave); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; }
.lista-clientes { padding: 0 1rem; }
.lista-clientes a { flex-direction: row; align-items: center; gap: .75rem; }
.lista-cuerpo { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.lista-cuerpo .lista-sub { white-space: nowrap; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: grid; place-items: center; background: var(--azul-claro); color: var(--azul); font-weight: 700;
}
.contadores { font-size: .8rem; color: var(--suave); display: none; }
@media (min-width: 600px) { .contadores { display: block; } }
.paginacion { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 1rem 0; }

/* Ficha */
.ficha-cabecera { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.ficha-cabecera h1 { margin-bottom: .9rem; }
.contacto { display: flex; gap: .5rem; overflow-x: auto; margin-bottom: 1rem; padding-bottom: .25rem; }
.contacto .btn { flex: none; }
.saltos { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.saltos a { background: var(--azul-claro); color: var(--azul); text-decoration: none; padding: .35rem .85rem; border-radius: 999px; font-size: .9rem; }
section[id] { scroll-margin-top: 64px; }
.chapa { display: inline-block; font-size: .75rem; padding: .1rem .5rem; border-radius: 999px; background: var(--borde); color: var(--texto); }
.datos { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0; }
.datos dt { color: var(--suave); }
.datos dd { margin: 0; overflow-wrap: anywhere; }

/* Notas */
.nota-nueva { margin-bottom: 1rem; }
.nota-nueva button { align-self: flex-end; }
.nota { border-top: 1px solid var(--borde); padding: .75rem 0; }
.nota header { font-size: .8rem; color: var(--suave); display: flex; gap: .4rem; }
.nota-texto { white-space: normal; overflow-wrap: anywhere; margin: .25rem 0; }
.nota-editar summary { font-size: .85rem; color: var(--azul); cursor: pointer; width: max-content; }
.nota-editar[open] { background: var(--fondo); border-radius: 10px; padding: .5rem; display: flex; flex-direction: column; gap: .5rem; }

/* Notas de voz */
.voz { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.voz [hidden], .voz-audio[hidden] { display: none !important; }
.voz .btn { align-self: auto; }
.voz .btn:disabled { opacity: .5; }
.voz .grabando { color: #fff; background: var(--error); border-color: var(--error); }
.punto-grabar { width: .7rem; height: .7rem; border-radius: 50%; background: var(--error); display: inline-block; }
.grabando .punto-grabar { background: #fff; animation: latido 1s infinite; }
@keyframes latido { 50% { opacity: .3; } }
.voz-estado { font-size: .85rem; color: var(--suave); flex-basis: 100%; }
.voz-estado:empty { display: none; }
.voz-estado.con-error { color: var(--error); }
.voz-audio { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.voz-audio audio, .nota-audio audio, .nota-pendiente audio { width: 100%; max-width: 420px; height: 40px; }
.nota-audio { display: flex; flex-direction: column; gap: .15rem; margin: .35rem 0; }
.nota-audio small { color: var(--suave); display: flex; align-items: center; gap: .3rem; }
.nota-audio .icono { width: 1em; height: 1em; }

/* Fotos */
.subir-fotos { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1rem; }
.progreso { position: relative; height: 28px; background: var(--fondo); border-radius: 8px; overflow: hidden; }
.progreso-barra { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--azul); opacity: .35; transition: width .2s; }
.progreso-texto { position: relative; display: block; text-align: center; font-size: .85rem; line-height: 28px; }
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; }
.foto { margin: 0; position: relative; background: var(--fondo); border-radius: 10px; overflow: visible; }
.foto > a { display: block; aspect-ratio: 1; border-radius: 10px 10px 0 0; overflow: hidden; }
.foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto .chapa { position: absolute; top: .4rem; left: .4rem; color: #fff; }
.chapa-antes { background: var(--naranja) !important; }
.chapa-despues { background: var(--ok) !important; }
.foto figcaption { display: flex; justify-content: space-between; align-items: center; gap: .25rem; font-size: .8rem; color: var(--suave); padding: .25rem .5rem; }
.foto figcaption > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.foto-menu summary { list-style: none; cursor: pointer; padding: 0 .4rem; font-size: 1.2rem; line-height: 1; color: var(--texto); }
.foto-menu summary::-webkit-details-marker { display: none; }
.foto-menu[open] > form:first-of-type { margin-top: .25rem; }
.foto-menu[open] {
  position: absolute; z-index: 5; right: 0; bottom: 0; width: 220px;
  background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 10px; padding: .5rem;
  box-shadow: 0 6px 20px rgba(0,0,0,.18); display: flex; flex-direction: column; gap: .5rem;
}
.foto-menu .formulario { gap: .4rem; }

/* Visor de fotos a pantalla completa */
.visor { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; }
.visor[hidden] { display: none; }
.visor img { max-width: 100vw; max-height: 85vh; object-fit: contain; }
.visor button { position: absolute; background: rgba(255,255,255,.12); color: #fff; border: 0; font-size: 2rem; width: 48px; height: 48px; border-radius: 50%; cursor: pointer; }
.visor-cerrar { top: calc(1rem + env(safe-area-inset-top)); right: 1rem; }
.visor-ant { left: .5rem; top: 50%; }
.visor-sig { right: .5rem; top: 50%; }
.visor-pie { position: absolute; bottom: calc(1rem + env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; color: #ddd; margin: 0; padding: 0 1rem; }

.zona-peligro { border-color: var(--error-fondo); display: flex; flex-direction: column; gap: 1rem; }
.zona-peligro p { margin: 0 0 .5rem; color: var(--suave); }

/* ===================== Presupuestos ===================== */
.ayuda, .texto-suave, .sub-texto { color: var(--suave); font-size: .9rem; }
.ayuda { margin: -.25rem 0 1rem; }
.tarjeta .ayuda { margin: 0; }
.saltos a.activo { background: var(--azul); color: #fff; }
@media (prefers-color-scheme: dark) { html:not([data-tema="claro"]) .saltos a.activo { color: #0b1724; } }
html[data-tema="oscuro"] .saltos a.activo { color: #0b1724; }
.fila-3 { display: grid; gap: .85rem; grid-template-columns: 1fr 1fr; }
.fila-3 > :first-child { grid-column: 1 / -1; }
@media (min-width: 600px) { .fila-3 { grid-template-columns: 1fr 1fr 1fr; } .fila-3 > :first-child { grid-column: auto; } }
.menu-movil a span { white-space: nowrap; font-size: .7rem; }
.centrado-botones { justify-content: center; margin: 1rem 0; }
.encabezado h2 { margin: 0; }
.tarjeta > .encabezado { margin-bottom: .5rem; }

/* Listas con importe a la derecha */
.lista-catalogo, .lista-presupuestos.tarjeta { padding: 0 1rem; }
.lista-catalogo a, .lista-presupuestos a { flex-direction: row; align-items: center; gap: .75rem; }
.lista-derecha { display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; flex: none; }
.precio { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.precio small { font-weight: 400; color: var(--suave); }
.chapa-borrador { background: var(--borde); }
.chapa-enviado { background: var(--azul-claro); color: var(--azul); }
.chapa-aceptado { background: var(--ok-fondo); color: var(--ok); }
.chapa-rechazado { background: var(--error-fondo); color: var(--error); }
h1 .chapa { vertical-align: middle; font-size: .8rem; }
.cifra span { display: block; }

.selector-tipo { display: flex; gap: .5rem; }
.selector-tipo label { flex: 1; flex-direction: row !important; align-items: center; gap: .4rem !important; color: var(--texto) !important;
  border: 1px solid var(--borde); border-radius: 10px; padding: .6rem .75rem; cursor: pointer; }
.selector-tipo label:has(input:checked) { border-color: var(--azul); background: var(--azul-claro); }
.selector-tipo input { width: auto !important; margin: 0; }

/* Editor de líneas */
.editor-presupuesto { gap: 0; }
.lineas { display: flex; flex-direction: column; gap: .6rem; margin-bottom: .75rem; }
.linea { border: 1px solid var(--borde); border-radius: 10px; padding: .6rem; display: grid; gap: .5rem; background: var(--fondo); }
.linea textarea, .linea input:not([type=hidden]), .linea select { padding: .45rem .55rem; }
.linea-concepto { display: grid; grid-template-columns: 1fr 112px; gap: .5rem; align-items: start; }
.linea-concepto textarea { min-height: 42px; }
.linea-concepto select { font-size: .8rem; padding-right: .2rem; }
.linea-numeros { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; align-items: end; }
.linea-numeros label { display: flex; flex-direction: column; font-size: .75rem; color: var(--suave); gap: .15rem; min-width: 0; }
.linea-importe { grid-column: 1 / -1; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.linea-acciones { display: flex; gap: .4rem; justify-content: flex-end; }
.linea-acciones .btn { min-width: 40px; }
@media (min-width: 800px) {
  .linea { grid-template-columns: 1fr 380px auto; align-items: start; }
  .linea-numeros { grid-template-columns: 70px 70px 1fr 60px; }
  .linea-importe { grid-column: 1 / -1; }
}

.totales { display: grid; grid-template-columns: 1fr auto; gap: .3rem 1.5rem; margin: 1rem 0 0 auto; max-width: 340px; font-variant-numeric: tabular-nums; }
.totales dt { color: var(--suave); text-align: right; }
.totales dd { margin: 0; text-align: right; }
.totales .total { font-size: 1.25rem; font-weight: 700; color: var(--azul); border-top: 1px solid var(--borde); padding-top: .3rem; }

.barra-guardar { position: sticky; bottom: calc(var(--menu-alto) + env(safe-area-inset-bottom)); z-index: 10; display: flex; gap: .5rem;
  background: var(--fondo); padding: .75rem 0; border-top: 1px solid var(--borde); }
.barra-guardar .btn-principal { flex: 1; }
@media (min-width: 800px) { .barra-guardar { bottom: 0; } .barra-guardar .btn-principal { flex: none; } }

/* Selector del catálogo */
.selector-catalogo { width: min(640px, 100vw - 1rem); max-height: 85vh; padding: 0; border: 0; border-radius: var(--radio);
  background: var(--tarjeta); color: var(--texto); box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.selector-catalogo::backdrop { background: rgba(0,0,0,.5); }
.selector-cabecera { position: sticky; top: 0; display: flex; gap: .5rem; padding: .75rem; background: var(--tarjeta); border-bottom: 1px solid var(--borde); }
.selector-catalogo .lista { padding: 0 .75rem; }
.selector-catalogo .lista button { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: .75rem; padding: .7rem 0; cursor: pointer; }
.selector-catalogo .lista button:focus-visible { outline: 2px solid var(--azul); }
.selector-catalogo .lista button.anadido { color: var(--ok); }

/* Vista del presupuesto */
.tabla-lineas { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tabla-lineas th { text-align: left; font-size: .8rem; color: var(--suave); font-weight: 600; border-bottom: 1px solid var(--borde); padding: .4rem .3rem; }
.tabla-lineas td { border-bottom: 1px solid var(--borde); padding: .55rem .3rem; vertical-align: top; overflow-wrap: anywhere; }
.tabla-lineas .num { text-align: right; white-space: nowrap; }
@media (max-width: 599px) {
  .tabla-lineas thead { display: none; }
  .tabla-lineas tr { display: grid; grid-template-columns: 1fr 1fr auto; border-bottom: 1px solid var(--borde); padding: .5rem 0; }
  .tabla-lineas td { border: 0; padding: .1rem .2rem; }
  .tabla-lineas td:first-child { grid-column: 1 / -1; }
  .tabla-lineas td.num:nth-child(2) { text-align: left; }
}
.logo-actual img { max-width: 220px; max-height: 100px; background: #fff; border: 1px solid var(--borde); border-radius: 8px; padding: .5rem; }
.acciones-envio { margin-bottom: .75rem; }
@media (max-width: 599px) { .acciones-envio .btn { flex: 1 1 calc(50% - .5rem); } }
/* ===================== Trabajos y agenda ===================== */
.chapa-urgente { background: var(--error) !important; color: #fff !important; }
.estado-visita        { background: #e8eaf6; color: #3949ab; }
.estado-presupuestado { background: #fff3e0; color: #e65100; }
.estado-aceptado      { background: #e0f2f1; color: #00796b; }
.estado-en_curso      { background: var(--azul-claro); color: var(--azul); }
.estado-terminado     { background: #f3e5f5; color: #7b1fa2; }
.estado-facturado     { background: #fff8e1; color: #8d6e00; }
.estado-cobrado       { background: var(--ok-fondo); color: var(--ok); }
.estado-cancelado     { background: var(--borde); color: var(--suave); text-decoration: line-through; }
@media (prefers-color-scheme: dark) {
  html:not([data-tema="claro"]) .estado-visita { background: #232a4a; color: #9fa8da; }
  html:not([data-tema="claro"]) .estado-presupuestado { background: #3a2a14; color: #ffb74d; }
  html:not([data-tema="claro"]) .estado-aceptado { background: #12302c; color: #80cbc4; }
  html:not([data-tema="claro"]) .estado-terminado { background: #2e1d35; color: #ce93d8; }
  html:not([data-tema="claro"]) .estado-facturado { background: #332b10; color: #ffd54f; }
}
html[data-tema="oscuro"] .estado-visita { background: #232a4a; color: #9fa8da; }
html[data-tema="oscuro"] .estado-presupuestado { background: #3a2a14; color: #ffb74d; }
html[data-tema="oscuro"] .estado-aceptado { background: #12302c; color: #80cbc4; }
html[data-tema="oscuro"] .estado-terminado { background: #2e1d35; color: #ce93d8; }
html[data-tema="oscuro"] .estado-facturado { background: #332b10; color: #ffd54f; }
.contador { display: inline-block; min-width: 1.4em; padding: 0 .4em; border-radius: 999px; background: var(--azul); color: #fff; font-size: .75rem; text-align: center; line-height: 1.5; vertical-align: middle; }
@media (prefers-color-scheme: dark) { html:not([data-tema="claro"]) .contador { color: #0b1724; } }
html[data-tema="oscuro"] .contador { color: #0b1724; }
.btn.activo { background: var(--azul-claro); border-color: var(--azul); color: var(--azul); }
.casilla { flex-direction: row !important; align-items: center; gap: .5rem !important; color: var(--texto) !important; }
.casilla input { width: 22px; height: 22px; margin: 0; }
.nota-pie, .ayuda-pendiente { color: var(--suave); font-size: .85rem; margin: .75rem 0 0; }
.ayuda-pendiente { margin: -.4rem 0 .5rem; }
.tarjeta > .encabezado h2 { margin: 0; }
.tarjeta > .encabezado { margin-bottom: .5rem; }
.sub .chapa { margin-right: .25rem; }

/* Filtros por estado: fila deslizable en el móvil */
.filtros { display: flex; gap: .4rem; overflow-x: auto; margin-bottom: 1rem; padding-bottom: .25rem; scrollbar-width: none; }
.filtros a { flex: none; background: var(--tarjeta); border: 1px solid var(--borde); color: var(--texto); text-decoration: none; padding: .35rem .8rem; border-radius: 999px; font-size: .9rem; }
.filtros a span { color: var(--suave); font-size: .8rem; }
.filtros a.activo { background: var(--azul); border-color: var(--azul); color: #fff; }
.filtros a.activo span { color: inherit; opacity: .8; }
@media (prefers-color-scheme: dark) { html:not([data-tema="claro"]) .filtros a.activo { color: #0b1724; } }
html[data-tema="oscuro"] .filtros a.activo { color: #0b1724; }

/* Listas de trabajos: estado a la derecha */
.lista-trabajos.tarjeta { padding: 0 1rem; }
.lista-trabajos li { display: flex; align-items: center; gap: .5rem; }
.lista-trabajos li > a { flex: 1; min-width: 0; flex-direction: row; align-items: center; gap: .75rem; }
.lista-trabajos .chapa { flex: none; }
.lista-acciones { display: flex; align-items: center; gap: .35rem; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.btn-icono-suave { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--azul-claro); color: var(--azul); flex: none; }
li.hecha .lista-titulo { text-decoration: line-through; color: var(--suave); }

/* Flujo de estados de un trabajo */
.flujo { list-style: none; display: flex; flex-wrap: wrap; gap: .3rem; padding: 0; margin: 0 0 1rem; counter-reset: paso; }
.flujo li { font-size: .8rem; padding: .25rem .6rem; border-radius: 999px; background: var(--fondo); color: var(--suave); border: 1px solid var(--borde); }
.flujo li.hecho { background: var(--ok-fondo); color: var(--ok); border-color: transparent; }
.flujo li.actual { background: var(--azul); color: #fff; border-color: var(--azul); font-weight: 600; }
@media (prefers-color-scheme: dark) { html:not([data-tema="claro"]) .flujo li.actual { color: #0b1724; } }
html[data-tema="oscuro"] .flujo li.actual { color: #0b1724; }
.desplegable { position: relative; }
.desplegable summary { list-style: none; }
.desplegable summary::-webkit-details-marker { display: none; }
.desplegable[open] form { position: absolute; z-index: 5; top: calc(100% + .3rem); left: 0; width: 240px; background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 10px; padding: .6rem; box-shadow: 0 6px 20px rgba(0,0,0,.18); gap: .5rem; }
.historial { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; font-size: .9rem; }
.historial span:not(.chapa) { color: var(--suave); }

/* Agenda */
.agenda-nav { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.agenda-nav strong { min-width: 9rem; text-align: center; }
.agenda-nav-der { display: flex; gap: .35rem; margin-left: auto; }
.agenda-dia { padding: .6rem 1rem; margin-bottom: .6rem; }
.agenda-dia h2 { font-size: 1rem; text-transform: none; }
.agenda-dia h2 small { color: var(--azul); font-weight: 600; font-size: .85rem; }
.agenda-dia.hoy { border-color: var(--azul); box-shadow: 0 0 0 1px var(--azul); }
.agenda-dia.sin-citas { opacity: .75; }
.agenda-dia.sin-citas > .encabezado { margin-bottom: 0; }
.btn-mas { color: var(--azul); display: inline-flex; padding: .3rem; border-radius: 8px; }
.citas li { display: flex; align-items: center; gap: .6rem; }
.citas li > a:not(.btn-icono-suave) { flex: 1; min-width: 0; padding: .55rem 0; }
.cita { border-left: 4px solid var(--azul); padding-left: .5rem; }
.lista .cita + .cita { border-top: 1px solid var(--borde); }
.tipo-visita { border-left-color: #3949ab !important; }
.tipo-trabajo { border-left-color: var(--azul) !important; }
.tipo-seguimiento { border-left-color: var(--naranja) !important; }
.tipo-otro { border-left-color: var(--suave) !important; }
.cita-check button {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--borde); background: var(--tarjeta);
  color: #fff; cursor: pointer; font-size: .85rem; display: grid; place-items: center; padding: 0;
}
.cita.hecha .cita-check button { background: var(--ok); border-color: var(--ok); }
.cita.hecha .lista-titulo { text-decoration: line-through; color: var(--suave); }

.mes { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; padding: 0; overflow: hidden; background: var(--borde); }
.mes-cab { background: var(--tarjeta); text-align: center; font-size: .75rem; color: var(--suave); padding: .35rem 0; text-transform: capitalize; }
.mes-dia { background: var(--tarjeta); min-height: 64px; padding: .25rem; text-decoration: none; color: var(--texto); display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.mes-dia.fuera { background: var(--fondo); color: var(--suave); }
.mes-dia.hoy .mes-num { background: var(--azul); color: #fff; border-radius: 999px; padding: 0 .4em; }
.mes-num { font-size: .8rem; font-weight: 600; align-self: flex-start; }
.mes-cita { font-size: .7rem; line-height: 1.3; border-left: 3px solid var(--azul); padding-left: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mes-cita.hecha { opacity: .5; text-decoration: line-through; }
.mes-cita span { display: none; }
.mes-mas { font-size: .7rem; color: var(--suave); }
@media (min-width: 700px) {
  .mes-dia { min-height: 96px; padding: .35rem; }
  .mes-cita span { display: inline; }
}

/* Menú inferior con seis secciones */
.menu-movil a { min-width: 0; }
.menu-movil a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 380px) { .menu-movil a span { font-size: .62rem; } }

/* Firma en pantalla */
.firma-caja { position: relative; border: 2px dashed var(--borde); border-radius: var(--radio); background: var(--tarjeta); }
.firma-lienzo { display: block; width: 100%; aspect-ratio: 3 / 1; touch-action: none; cursor: crosshair; color: var(--texto); }
.firma-guia { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; color: var(--suave); pointer-events: none; font-size: 1.1rem; }
.firma-linea { position: absolute; left: 8%; right: 8%; bottom: 22%; border-bottom: 1px solid var(--borde); pointer-events: none; }
.firma-borrar { position: absolute; top: .4rem; right: .4rem; }
.firma-imagen { display: block; width: 100%; max-width: 420px; aspect-ratio: 3 / 1; background: #fff; border: 1px solid var(--borde); border-radius: 8px; margin-bottom: .5rem; }
.firma-ficha { border-color: var(--ok-fondo); }
.casilla span { line-height: 1.35; }
.casilla:has(span) { align-items: flex-start; }
.casilla input[type=checkbox] { flex: none; width: 22px; height: 22px; min-height: 0; padding: 0; margin: .1rem 0 0; }

/* Sin cobertura: lo guardado en el móvil pendiente de enviar */
.pendientes-envio { margin-bottom: 1rem; }
.pendientes-envio .galeria { margin-top: .25rem; }
.nota-pendiente { border-top: 1px dashed var(--naranja); background: #fff8e1; padding: .6rem .75rem; border-radius: 10px; margin-bottom: .5rem; }
.nota-pendiente .nota-meta, .foto-pendiente figcaption { font-size: .8rem; color: var(--naranja); }
.nota-pendiente.con-error { background: var(--error-fondo); border-top-color: var(--error); }
.nota-pendiente.con-error .nota-meta { color: var(--error); }
.foto-pendiente { outline: 2px dashed var(--naranja); outline-offset: -2px; }
.foto-pendiente img { height: auto; aspect-ratio: 1; border-radius: 10px 10px 0 0; opacity: .85; }
.foto-pendiente figcaption { display: block; padding: .3rem .4rem; white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.3; }
@media (prefers-color-scheme: dark) {
  html:not([data-tema="claro"]) .nota-pendiente { background: #3a2c10; }
}
html[data-tema="oscuro"] .nota-pendiente { background: #3a2c10; }
.cola-estado {
  position: fixed; z-index: 25; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--menu-alto) + env(safe-area-inset-bottom) + .6rem);
  border: 0; border-radius: 999px; padding: .55rem 1rem; font: inherit; font-size: .9rem; font-weight: 600;
  background: var(--naranja); color: #fff; box-shadow: var(--sombra); cursor: pointer; white-space: nowrap;
}
.cola-estado.sin-red { background: #455a64; }
.cola-estado.con-error { background: var(--error); }
@media (min-width: 800px) { .cola-estado { bottom: 1.2rem; } }
.cola-panel { width: min(560px, calc(100vw - 2rem)); border: 0; border-radius: var(--radio); padding: 1rem; background: var(--tarjeta); color: var(--texto); }
.cola-panel::backdrop { background: rgba(0, 0, 0, .45); }
.cola-panel .lista { max-height: 55vh; overflow: auto; }
.cola-item { display: flex; align-items: center; gap: .6rem; padding: .6rem .75rem; }
.cola-item .lista-titulo { overflow-wrap: anywhere; }
.cola-item .lista-sub { white-space: normal; overflow: visible; }
.cola-item .lista-sub a { display: inline; padding: 0; min-height: 0; color: var(--azul); }

/* ---------- Horas, cuentas y equipo (vienen de la app de carpintería) ---------- */
/* Horas */
.apuntar-horas h2 { display: flex; align-items: center; gap: .5rem; }
.apuntar-horas h2 .icono { color: var(--azul); }
.ajustar-horas { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: .5rem; align-items: stretch; margin-top: .3rem; }
.ajustar-horas .btn { min-height: 56px; font-weight: 700; justify-content: center; }
.ajustar-horas input { text-align: center; font-size: 1.5rem !important; font-weight: 700; min-height: 56px; }
#horas-texto { min-height: 1.4em; margin-top: .35rem; }
.selector-mes { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: 1rem 0; }
.selector-mes strong { font-size: 1.1rem; }
.dia-horas { font-size: 1rem; margin: 1rem 0 .25rem; }
.dia-horas small { font-weight: 400; color: var(--suave); }
.lista-horas li { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .6rem 0; }
.lista-horas li > div { display: flex; flex-direction: column; min-width: 0; }
.btn-icono-suave { background: none; border: 0; color: var(--suave); padding: .5rem; border-radius: 8px; cursor: pointer; }
.btn-icono-suave .icono { width: 22px; height: 22px; }

/* Equipo */
.lista details summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; padding: .7rem 0; }
.lista details summary::-webkit-details-marker { display: none; }
.lista details[open] { padding-bottom: .75rem; }
.lista details form { margin-bottom: .75rem; }
.lista li.inactivo { opacity: .6; }
.opcion { display: flex !important; align-items: center; gap: .5rem; flex-direction: row !important; }
.acciones-apunte { display: flex; align-items: center; flex: none; }
.acciones-apunte a.btn-icono-suave { display: inline-flex; }

/* Cuentas */
.pestanas { margin-bottom: .75rem; }
.total-vivo { font-size: 1.1rem; margin: 0 0 .75rem; }
.fila-factura { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.fila-factura > a { min-width: 0; flex: 1; }
.fila-factura-pie { display: flex; flex-direction: column; align-items: flex-end; gap: .3rem; flex: none; }
.cifras-resultado { grid-template-columns: 1fr; }
.cifras-resultado .cifra { display: flex; justify-content: space-between; align-items: baseline; text-align: left; }
.cifras-resultado .cifra strong { order: 2; font-size: 1.3rem; white-space: nowrap; }
.cifras-resultado .cifra span { font-size: .95rem; }
@media (min-width: 800px) { .cifras-resultado { grid-template-columns: repeat(3, 1fr); } .cifras-resultado .cifra { display: block; text-align: center; } }
.cifra-positiva strong { color: var(--ok); }
.cifra-negativa strong { color: var(--error); }
.barras li { padding: .5rem 0; }
.barra-fila { display: flex; justify-content: space-between; margin-bottom: .3rem; }
.barra-pista { height: 8px; border-radius: 4px; background: var(--azul-claro); overflow: hidden; }
.barra-pista i { display: block; height: 100%; background: var(--azul); }
.leyenda { display: flex; align-items: center; gap: .4rem; color: var(--suave); font-size: .85rem; margin-bottom: .5rem; }
.muestra { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-left: .5rem; }
.muestra-ingresos, .b-ingresos { background: var(--ok); }
.muestra-gastos, .b-gastos { background: var(--naranja); }
.anual a { display: grid !important; grid-template-columns: 2.6rem 1fr 7.5rem; align-items: center; gap: .5rem; padding: .45rem 0 !important; }
.anual-mes { font-weight: 600; }
.anual-barras { display: flex; flex-direction: column; gap: 3px; }
.anual-barras i { display: block; height: 7px; border-radius: 4px; min-width: 0; }
.anual-res { text-align: right; font-variant-numeric: tabular-nums; }
.anual-res.negativo { color: var(--error); }
.anual .mes-actual { background: var(--azul-claro); margin: 0 -.5rem; padding: 0 .5rem; border-radius: 8px; }
.lista-permisos { margin: 0; padding-left: 1.2rem; line-height: 1.8; }

/* Equipo: casillas de permisos */
.casillas-permisos { border: 1px solid var(--borde); border-radius: var(--radio); padding: .6rem .8rem .8rem; margin: 0; display: flex; flex-direction: column; gap: .4rem; }
.casillas-permisos legend { font-weight: 600; padding: 0 .3rem; }
.atajos-permisos { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .2rem; }
.casillas-permisos .casilla { display: flex; flex-direction: row; align-items: flex-start; gap: .7rem; color: var(--texto); font-size: 1rem; padding: .55rem .2rem; border-bottom: 1px solid var(--borde); cursor: pointer; font-weight: normal; }
.casilla:last-of-type { border-bottom: 0; }
.casillas-permisos .casilla input[type=checkbox] { width: 1.4rem; height: 1.4rem; padding: 0; flex: 0 0 auto; margin-top: .1rem; accent-color: var(--azul); }
.casilla span { display: flex; flex-direction: column; gap: .1rem; }
.casilla small { color: var(--suave); font-size: .85rem; line-height: 1.3; }
.casilla input:disabled + span { opacity: .75; }
.btn-grande { min-height: 56px; font-size: 1.05rem; margin-bottom: 1rem; }
.total-final { font-weight: 700; }

/* Demo: «Ver como» en la barra y su ventana */
.demo-boton { display: inline-flex; align-items: center; gap: .35rem; flex: 0 1 auto; min-width: 0; max-width: 100%;
  background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.3); border-radius: 99px;
  padding: .3rem .75rem .3rem .55rem; font: inherit; font-size: .85rem; cursor: pointer; white-space: nowrap; }
.demo-boton span { overflow: hidden; text-overflow: ellipsis; }
.demo-boton .icono { width: 18px; height: 18px; }
.demo-boton:hover, .demo-boton:focus-visible { background: rgba(255,255,255,.24); }
.dialogo-demo { width: min(460px, 100vw - 1.5rem); max-height: 88vh; padding: 0; border: 0; border-radius: var(--radio);
  background: var(--tarjeta); color: var(--texto); box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.dialogo-demo::backdrop { background: rgba(0,0,0,.5); }
.dialogo-demo-cabecera { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1rem .25rem; }
.dialogo-demo-cabecera h2 { margin: 0; font-size: 1.15rem; }
.btn-cerrar { all: unset; cursor: pointer; font-size: 1.6rem; line-height: 1; padding: .1rem .5rem; border-radius: 8px; color: var(--suave); }
.btn-cerrar:focus-visible { outline: 2px solid var(--azul); }
.dialogo-demo-texto { margin: 0; padding: 0 1rem .75rem; color: var(--suave); font-size: .9rem; }
.dialogo-demo-lista { display: grid; gap: .5rem; padding: 0 1rem; margin: 0; }
.dialogo-demo-lista button { all: unset; box-sizing: border-box; display: grid; gap: .2rem; padding: .7rem .85rem;
  border: 1px solid var(--borde); border-radius: 10px; cursor: pointer; }
.dialogo-demo-lista button:hover { border-color: var(--azul); }
.dialogo-demo-lista button:focus-visible { outline: 2px solid var(--azul); }
.dialogo-demo-lista button.actual { border-color: var(--azul); background: var(--azul-claro); }
.demo-persona { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.demo-etiqueta { font-size: .78rem; color: var(--suave); }
.demo-ahora { margin-left: auto; font-size: .72rem; font-weight: 700; color: var(--azul); text-transform: uppercase; letter-spacing: .04em; }
.demo-permisos { font-size: .8rem; color: var(--suave); line-height: 1.35; }
.dialogo-demo-pie { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap;
  margin-top: .9rem; padding: .8rem 1rem 1rem; border-top: 1px solid var(--borde); font-size: .82rem; color: var(--suave); }
.dialogo-demo-pie p { margin: 0; flex: 1 1 14rem; }
.dialogo-demo-pie form { margin: 0; }
.barra:has(.demo-boton) .marca { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; min-width: 0; }
.barra:has(.demo-boton) .barra-izq { flex: 0 1 auto; min-width: 6.5rem; }
.barra:has(.demo-boton) { gap: .6rem; }
@media (max-width: 420px) { .demo-boton { font-size: .8rem; padding: .3rem .6rem .3rem .45rem; } .barra:has(.demo-boton) .marca { font-size: 1rem; } }

/* ===== Colores e iconos por sección =====
   Cada sección tiene su color (--sec). El body lleva la de la página; cualquier
   elemento con .sec-x la cambia solo para él (accesos de Inicio, menú inferior…). */
:root { --sec: var(--azul); }
.sec-inicio { --sec: #1565c0; --icono-sec: url("data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%231565c0%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><path d=%22M3 11l9-8 9 8%22/><path d=%22M5 10v10h14V10%22/></svg>"); }
.sec-clientes { --sec: #3949ab; --icono-sec: url("data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%233949ab%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><circle cx=%229%22 cy=%228%22 r=%224%22/><path d=%22M2 21c0-4 3-7 7-7s7 3 7 7%22/><path d=%22M16 4a4 4 0 010 8M22 21c0-3-2-5-4-6%22/></svg>"); }
.sec-presupuestos { --sec: #e0650b; --icono-sec: url("data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23e0650b%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><path d=%22M6 2h9l5 5v15H6z%22/><path d=%22M14 2v6h6M9 13h8M9 17h8%22/></svg>"); }
.sec-trabajos { --sec: #00897b; --icono-sec: url("data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%2300897b%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><path d=%22M14.7 6.3a4 4 0 015 5L11 20a2.1 2.1 0 01-3-3l8.7-8.7%22/><path d=%22M14.7 6.3L17 4l3 3-2.3 2.3%22/></svg>"); }
.sec-agenda { --sec: #8e24aa; --icono-sec: url("data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%238e24aa%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><rect x=%223%22 y=%225%22 width=%2218%22 height=%2216%22 rx=%222%22/><path d=%22M3 10h18M8 3v4M16 3v4%22/></svg>"); }
.sec-horas { --sec: #0277bd; --icono-sec: url("data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%230277bd%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><circle cx=%2212%22 cy=%2212%22 r=%229%22/><path d=%22M12 7v5l3 2%22/></svg>"); }
.sec-cuentas { --sec: #2e7d32; --icono-sec: url("data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%232e7d32%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><path d=%22M17 6a7 7 0 100 12%22/><path d=%22M4 10h9M4 14h9%22/></svg>"); }
.sec-equipo { --sec: #c2185b; --icono-sec: url("data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23c2185b%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><circle cx=%2212%22 cy=%227%22 r=%223%22/><path d=%22M6 20c0-3.5 2.7-6 6-6s6 2.5 6 6%22/><circle cx=%224.5%22 cy=%2210%22 r=%222%22/><circle cx=%2219.5%22 cy=%2210%22 r=%222%22/></svg>"); }
.sec-cuenta { --sec: #546e7a; --icono-sec: url("data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23546e7a%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><circle cx=%2212%22 cy=%2212%22 r=%223%22/><path d=%22M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M4.9 19.1L7 17M17 7l2.1-2.1%22/></svg>"); }
@media (prefers-color-scheme: dark) {
  html:not([data-tema="claro"]) .sec-inicio { --sec: #64a8f0; --icono-sec: url("data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%2364a8f0%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><path d=%22M3 11l9-8 9 8%22/><path d=%22M5 10v10h14V10%22/></svg>"); }
  html:not([data-tema="claro"]) .sec-clientes { --sec: #8c9eff; --icono-sec: url("data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%238c9eff%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><circle cx=%229%22 cy=%228%22 r=%224%22/><path d=%22M2 21c0-4 3-7 7-7s7 3 7 7%22/><path d=%22M16 4a4 4 0 010 8M22 21c0-3-2-5-4-6%22/></svg>"); }
  html:not([data-tema="claro"]) .sec-presupuestos { --sec: #ffa25c; --icono-sec: url("data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23ffa25c%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><path d=%22M6 2h9l5 5v15H6z%22/><path d=%22M14 2v6h6M9 13h8M9 17h8%22/></svg>"); }
  html:not([data-tema="claro"]) .sec-trabajos { --sec: #4fd1c0; --icono-sec: url("data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%234fd1c0%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><path d=%22M14.7 6.3a4 4 0 015 5L11 20a2.1 2.1 0 01-3-3l8.7-8.7%22/><path d=%22M14.7 6.3L17 4l3 3-2.3 2.3%22/></svg>"); }
  html:not([data-tema="claro"]) .sec-agenda { --sec: #d08af0; --icono-sec: url("data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23d08af0%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><rect x=%223%22 y=%225%22 width=%2218%22 height=%2216%22 rx=%222%22/><path d=%22M3 10h18M8 3v4M16 3v4%22/></svg>"); }
  html:not([data-tema="claro"]) .sec-horas { --sec: #5cc4ff; --icono-sec: url("data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%235cc4ff%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><circle cx=%2212%22 cy=%2212%22 r=%229%22/><path d=%22M12 7v5l3 2%22/></svg>"); }
  html:not([data-tema="claro"]) .sec-cuentas { --sec: #74d27a; --icono-sec: url("data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%2374d27a%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><path d=%22M17 6a7 7 0 100 12%22/><path d=%22M4 10h9M4 14h9%22/></svg>"); }
  html:not([data-tema="claro"]) .sec-equipo { --sec: #ff7fb0; --icono-sec: url("data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23ff7fb0%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><circle cx=%2212%22 cy=%227%22 r=%223%22/><path d=%22M6 20c0-3.5 2.7-6 6-6s6 2.5 6 6%22/><circle cx=%224.5%22 cy=%2210%22 r=%222%22/><circle cx=%2219.5%22 cy=%2210%22 r=%222%22/></svg>"); }
  html:not([data-tema="claro"]) .sec-cuenta { --sec: #a7bcc7; --icono-sec: url("data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23a7bcc7%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><circle cx=%2212%22 cy=%2212%22 r=%223%22/><path d=%22M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M4.9 19.1L7 17M17 7l2.1-2.1%22/></svg>"); }
}
html[data-tema="oscuro"] .sec-inicio { --sec: #64a8f0; --icono-sec: url("data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%2364a8f0%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><path d=%22M3 11l9-8 9 8%22/><path d=%22M5 10v10h14V10%22/></svg>"); }
html[data-tema="oscuro"] .sec-clientes { --sec: #8c9eff; --icono-sec: url("data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%238c9eff%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><circle cx=%229%22 cy=%228%22 r=%224%22/><path d=%22M2 21c0-4 3-7 7-7s7 3 7 7%22/><path d=%22M16 4a4 4 0 010 8M22 21c0-3-2-5-4-6%22/></svg>"); }
html[data-tema="oscuro"] .sec-presupuestos { --sec: #ffa25c; --icono-sec: url("data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23ffa25c%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><path d=%22M6 2h9l5 5v15H6z%22/><path d=%22M14 2v6h6M9 13h8M9 17h8%22/></svg>"); }
html[data-tema="oscuro"] .sec-trabajos { --sec: #4fd1c0; --icono-sec: url("data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%234fd1c0%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><path d=%22M14.7 6.3a4 4 0 015 5L11 20a2.1 2.1 0 01-3-3l8.7-8.7%22/><path d=%22M14.7 6.3L17 4l3 3-2.3 2.3%22/></svg>"); }
html[data-tema="oscuro"] .sec-agenda { --sec: #d08af0; --icono-sec: url("data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23d08af0%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><rect x=%223%22 y=%225%22 width=%2218%22 height=%2216%22 rx=%222%22/><path d=%22M3 10h18M8 3v4M16 3v4%22/></svg>"); }
html[data-tema="oscuro"] .sec-horas { --sec: #5cc4ff; --icono-sec: url("data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%235cc4ff%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><circle cx=%2212%22 cy=%2212%22 r=%229%22/><path d=%22M12 7v5l3 2%22/></svg>"); }
html[data-tema="oscuro"] .sec-cuentas { --sec: #74d27a; --icono-sec: url("data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%2374d27a%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><path d=%22M17 6a7 7 0 100 12%22/><path d=%22M4 10h9M4 14h9%22/></svg>"); }
html[data-tema="oscuro"] .sec-equipo { --sec: #ff7fb0; --icono-sec: url("data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23ff7fb0%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><circle cx=%2212%22 cy=%227%22 r=%223%22/><path d=%22M6 20c0-3.5 2.7-6 6-6s6 2.5 6 6%22/><circle cx=%224.5%22 cy=%2210%22 r=%222%22/><circle cx=%2219.5%22 cy=%2210%22 r=%222%22/></svg>"); }
html[data-tema="oscuro"] .sec-cuenta { --sec: #a7bcc7; --icono-sec: url("data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23a7bcc7%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><circle cx=%2212%22 cy=%2212%22 r=%223%22/><path d=%22M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M4.9 19.1L7 17M17 7l2.1-2.1%22/></svg>"); }
[class*="sec-"] { --sec-suave: color-mix(in srgb, var(--sec) 14%, var(--tarjeta)); --sec-borde: color-mix(in srgb, var(--sec) 35%, var(--borde)); }

/* Título de cada página con el icono de su sección */
.contenido h1:not(.saludo) { display: flex; align-items: center; gap: .55rem; }
.contenido .tarjeta h1 { display: block; }
.contenido h1:not(.saludo)::before {
  content: ""; display: block; flex: none;
  width: 1.55em; height: 1.55em; border-radius: .45em;
  background: var(--sec-suave) var(--icono-sec) center / 62% no-repeat;
}
.tarjeta h1::before { display: none !important; }

/* Tarjetas: cabecera separada y con el color de la sección */
.contenido .tarjeta { margin-bottom: 1.1rem; }
.tarjeta:not(.agenda-dia):not(.mes) > h2:first-child, .tarjeta:not(.agenda-dia):not(.mes) > .encabezado:first-child {
  padding-bottom: .65rem; margin-bottom: .75rem; border-bottom: 1px solid var(--borde);
}
.tarjeta > .encabezado:first-child h2 { margin: 0; }
.tarjeta h2 { display: flex; align-items: center; gap: .55rem; }
.tarjeta h2 > .icono { width: 32px; height: 32px; padding: 6px; border-radius: 9px; flex: none;
  color: var(--sec); background: var(--sec-suave); }
.tarjeta > h2:first-child:not(:has(.icono))::before,
.tarjeta > .encabezado:first-child h2:not(:has(.icono))::before {
  content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--sec); flex: none;
}
.lista a:hover .lista-titulo { color: var(--sec); }

/* Accesos grandes de Inicio */
.accesos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; margin: 0 0 1rem; }
@media (min-width: 640px) { .accesos { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 960px) { .accesos { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.acceso {
  display: flex; flex-direction: column; gap: .7rem; min-width: 0; padding: .9rem;
  background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 16px; box-shadow: var(--sombra);
  color: var(--texto); text-decoration: none; transition: border-color .15s, transform .15s;
}
.acceso:hover, .acceso:focus-visible { border-color: var(--sec); transform: translateY(-1px); }
.acceso:focus-visible { outline: 2px solid var(--sec); outline-offset: 2px; }
.acceso-icono { width: 52px; height: 52px; border-radius: 15px; background: var(--sec); color: #fff;
  display: grid; place-items: center; flex: none; }
.acceso-icono .icono { width: 28px; height: 28px; }
.acceso-texto { display: flex; flex-direction: column; min-width: 0; }
.acceso-texto strong { font-size: 1.05rem; line-height: 1.25; }
.acceso-texto small { color: var(--suave); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acceso-fila { flex-direction: row; align-items: center; }
.acceso-fila .acceso-icono { width: 44px; height: 44px; border-radius: 12px; }
.acceso-fila .acceso-icono .icono { width: 24px; height: 24px; }
@media (prefers-reduced-motion: reduce) { .acceso { transition: none; } .acceso:hover { transform: none; } }

/* Botones de crear con el color de su sección */
.btn-accion .icono { color: var(--sec); }
.btn-accion:hover { border-color: var(--sec); background: var(--sec-suave); }
.acciones-rapidas { margin-bottom: 1.1rem; }

/* Menú inferior: cada sección con su color */
.menu-movil a .icono { color: var(--sec); opacity: .9; }
.menu-movil a.activo { color: var(--sec); }
.menu-movil a.activo .icono { opacity: 1; background: var(--sec-suave); border-radius: 10px; padding: 3px 12px; box-sizing: content-box; }

/* Cifras con color de sección */
.cifra strong { color: var(--sec); }
.h2-dato { margin-left: auto; font-size: .8rem; font-weight: 400; color: var(--suave); }

/* Cifras del resultado con icono */
.cifras-resultado .cifra { align-items: center; gap: .65rem; }
.cifras-resultado .cifra > span:not(.cifra-icono) { flex: 1; }
.cifra-icono { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--sec-suave, var(--azul-claro)); color: var(--sec); }
.cifra-icono .icono { width: 20px; height: 20px; }
.cifra-ingresos { --sec: var(--ok); }
.cifra-gastos { --sec: var(--naranja); }
.cifra-ingresos, .cifra-gastos, .cifra-positiva, .cifra-negativa { --sec-suave: color-mix(in srgb, var(--sec) 14%, var(--tarjeta)); }
.cifra-positiva { --sec: var(--ok); } .cifra-negativa { --sec: var(--error); }
.cifra-ingresos strong { color: var(--ok); } .cifra-gastos strong { color: var(--naranja); }
@media (min-width: 800px) { .cifras-resultado .cifra-icono { margin: 0 auto .4rem; } }
@media (prefers-color-scheme: dark) { html:not([data-tema="claro"]) .acceso-icono { color: #10161d; } }
html[data-tema="oscuro"] .acceso-icono { color: #10161d; }

/* Títulos más compactos y lápiz de editar al final del título */
h1 { font-size: 1.3rem; }
@media (min-width: 800px) { h1 { font-size: 1.5rem; } }
.contenido h1:not(.saludo)::before { width: 1.45em; height: 1.45em; }
.contenido .ficha-cabecera h1 { display: block; font-size: 1.2rem; line-height: 1.3; margin-bottom: .3rem; }
@media (min-width: 800px) { .contenido .ficha-cabecera h1 { font-size: 1.4rem; } }
.ficha-cabecera h1::before { display: inline-block !important; vertical-align: -.35em; margin-right: .45rem; }
.editar-titulo { display: inline-flex; vertical-align: -.15em; margin-left: .25rem; padding: .2rem; border-radius: 8px;
  color: var(--suave); }
.editar-titulo .icono { width: 18px; height: 18px; }
.editar-titulo:hover, .editar-titulo:focus-visible { color: var(--sec); background: var(--sec-suave); }
.ficha-cabecera { margin-bottom: .85rem; }
.ficha-cabecera .sub { margin: .25rem 0 0; }

/* ===== Estado del trabajo: barra de cuadros de color ===== */
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.e-visita { --e: #3949ab; } .e-presupuestado { --e: #e65100; } .e-aceptado { --e: #00796b; } .e-en_curso { --e: #1565c0; }
.e-terminado { --e: #7b1fa2; } .e-facturado { --e: #b8860b; } .e-cobrado { --e: #2e7d32; } .e-cancelado { --e: #78838e; }
@media (prefers-color-scheme: dark) {
  html:not([data-tema="claro"]) .e-visita { --e: #8c9eff; }
  html:not([data-tema="claro"]) .e-presupuestado { --e: #ffab66; }
  html:not([data-tema="claro"]) .e-aceptado { --e: #4db6ac; }
  html:not([data-tema="claro"]) .e-en_curso { --e: #64b5f6; }
  html:not([data-tema="claro"]) .e-terminado { --e: #ce93d8; }
  html:not([data-tema="claro"]) .e-facturado { --e: #e6c35c; }
  html:not([data-tema="claro"]) .e-cobrado { --e: #81c784; }
  html:not([data-tema="claro"]) .e-cancelado { --e: #9aa5b1; }
}
html[data-tema="oscuro"] .e-visita { --e: #8c9eff; }
html[data-tema="oscuro"] .e-presupuestado { --e: #ffab66; }
html[data-tema="oscuro"] .e-aceptado { --e: #4db6ac; }
html[data-tema="oscuro"] .e-en_curso { --e: #64b5f6; }
html[data-tema="oscuro"] .e-terminado { --e: #ce93d8; }
html[data-tema="oscuro"] .e-facturado { --e: #e6c35c; }
html[data-tema="oscuro"] .e-cobrado { --e: #81c784; }
html[data-tema="oscuro"] .e-cancelado { --e: #9aa5b1; }
.estado-actual { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .55rem; }
.estado-paso { font-size: .8rem; color: var(--suave); }
.barra-estado { list-style: none; display: flex; gap: 3px; margin: 0 0 .9rem; padding: 0; align-items: center; }
.barra-estado li { flex: 1; height: 12px; background: var(--borde); }
.barra-estado li:first-child { border-radius: 6px 0 0 6px; }
.barra-estado li:last-child { border-radius: 0 6px 6px 0; }
.barra-estado li.hecho { background: var(--e); opacity: .55; }
.barra-estado li.actual { background: var(--e); height: 20px; border-radius: 5px; box-shadow: 0 0 0 2px var(--tarjeta), 0 0 0 4px var(--e); }
.barra-estado.cancelada li { opacity: .35; }
.botones-estado { margin-top: 0; }
.botones-estado > form { flex: 1 1 auto; display: flex; }
.botones-estado .btn { flex: 1 1 auto; justify-content: center; padding-left: .7rem; padding-right: .7rem; white-space: nowrap; }

/* ===== Ventanas genéricas (cambiar estado, nuevo…) ===== */
dialog.dialogo { width: min(420px, 100vw - 1.5rem); max-height: 88vh; padding: 0 0 1rem; border: 0; border-radius: var(--radio);
  background: var(--tarjeta); color: var(--texto); box-shadow: 0 10px 40px rgba(0,0,0,.3); }
dialog.dialogo::backdrop { background: rgba(0,0,0,.5); }
.dialogo-cabecera { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1rem .6rem; }
.dialogo-cabecera h2 { margin: 0; font-size: 1.1rem; border: 0; padding: 0; }
.dialogo-cabecera h2::before { display: none; }
.dialogo-opciones { display: grid; gap: .6rem; padding: 0 1rem; }
.lista-estados { display: grid; gap: .4rem; padding: 0 1rem; margin: 0; }
.lista-estados button { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: .65rem; padding: .7rem .85rem;
  border-radius: 10px; cursor: pointer; font-weight: 600; border: 1px solid transparent;
  background: color-mix(in srgb, var(--e) 10%, var(--tarjeta)); color: var(--texto); }
.lista-estados button:hover { border-color: var(--e); }
.lista-estados button:focus-visible { outline: 2px solid var(--e); }
.lista-estados button.actual { border: 2px solid var(--e); background: color-mix(in srgb, var(--e) 20%, var(--tarjeta)); }
.lista-estados .punto { width: 14px; height: 14px; border-radius: 4px; background: var(--e); flex: none; }
.lista-estados small { margin-left: auto; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--e); }
.lista-estados .e-cancelado { font-weight: 500; color: var(--suave); }

/* ===== Ficha del cliente: bloques con número ===== */
.bloques-ficha { display: grid; grid-template-columns: repeat(auto-fit, minmax(50px, 1fr)); gap: .4rem; margin: 0 0 1rem; }
.bloques-ficha a { display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .55rem .25rem .45rem;
  border-radius: 12px; background: var(--sec-suave); text-decoration: none; color: var(--texto); }
.bloques-ficha strong { font-size: 1.35rem; line-height: 1.15; color: var(--sec); display: flex; align-items: center; min-height: 1.55rem; }
.bloques-ficha strong .icono { width: 22px; height: 22px; }
.bloques-ficha span { font-size: .72rem; color: var(--suave); }
.bloques-ficha a:hover { outline: 2px solid var(--sec); outline-offset: -2px; }

/* ===== Contacto: solo icono en el móvil ===== */
.btn-contacto { color: #fff; border: 0; --c: #546e7a; background: var(--c); }
.btn-contacto:hover { background: var(--c); filter: brightness(1.08); color: #fff; }
.c-llamar { --c: #2e7d32; } .c-whatsapp { --c: #1faa53; } .c-mapa { --c: #1565c0; } .c-email { --c: #e0650b; }
.btn-contacto .icono { width: 22px; height: 22px; }
@media (max-width: 799px) {
  .contacto { overflow: visible; }
  .btn-contacto { width: 52px; height: 46px; padding: 0; justify-content: center; }
  .btn-contacto span { display: none; }
}
@media (max-width: 360px) { .encabezado { gap: .5rem; } .encabezado h2 { min-width: 0; } }
/* Botones junto al título: siempre en una línea */
.encabezado > .botones { flex-wrap: nowrap; flex: none; margin-bottom: .75rem; }
@media (max-width: 799px) { .encabezado > .botones .btn { padding: .45rem .75rem; font-size: .92rem; } }
.encabezado:has(> h1) { flex-wrap: wrap; column-gap: .75rem; row-gap: 0; }

/* Pesos más finos con la tipografía propia */
h1, h2, h3, b, strong, th, .marca { font-weight: 650; }
button, input, select, textarea { font-family: inherit; }

.sin-corte { white-space: nowrap; }

/* Ordenador: menú superior centrado (con sitio suficiente para centrarlo de verdad) */
@media (min-width: 1180px) {
  .barra { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; }
  .barra-der { display: contents; }
  .menu-escritorio { justify-self: center; }
  .barra-fin { justify-self: end; }
}
@media (min-width: 800px) and (max-width: 1050px) {
  .menu-escritorio { gap: 0; }
  .menu-escritorio a { padding: .4rem .5rem; font-size: .95rem; }
  .barra .barra-der { min-width: 0; }
  .barra .demo-boton { min-width: 0; max-width: 11rem; }
}

html[data-tema="claro"] { color-scheme: light; }
html[data-tema="oscuro"] { color-scheme: dark; }

/* Botón de modo claro / oscuro */
.btn-tema { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 36px; height: 36px; border-radius: 99px; color: #fff; cursor: pointer; background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.3); }
.btn-tema:hover, .btn-tema:focus-visible { background: rgba(255,255,255,.24); }
.btn-tema .icono { width: 19px; height: 19px; }
.btn-tema .tema-sol { display: none; }
html[data-tema="oscuro"] .btn-tema .tema-sol { display: block; }
html[data-tema="oscuro"] .btn-tema .tema-luna { display: none; }
@media (prefers-color-scheme: dark) {
  html:not([data-tema="claro"]) .btn-tema .tema-sol { display: block; }
  html:not([data-tema="claro"]) .btn-tema .tema-luna { display: none; }
}
.barra-fin { display: flex; align-items: center; gap: .45rem; min-width: 0; }
