/* Tu Barrio Publicidad — piel 2026.
   Marca: terracota Alhambra, marfil y olivo. Títulos en serif editorial
   (Fraunces) que dialoga con la firma del logo; texto en Manrope.
   Estructura: barra lateral plegable con el activo en arco de herradura,
   barra superior con buscador (Ctrl+K) y «+ Crear», panel tipo bento,
   modo claro y oscuro, hojas inferiores en el móvil. */

:root {
  --terracota: #8A3F2D;
  --terracota-viva: #B4532F;
  --terracota-osc: #6B2F21;
  --terracota-suave: #F4E1D7;
  --oro: #C49A45;
  --olivo: #56604A;
  --olivo-suave: #E4E8DA;
  --albaicin: #2F5D73;
  --fondo: #F6EFE4;
  --superficie: #FFFBF5;
  --superficie-2: #F1E7D8;
  --tinta: #2A1C16;
  --tinta-suave: #6E5D52;
  --linea: #E6D7C2;
  --ok: #3F7A3A;
  --ok-suave: #DDEBD3;
  --aviso: #B86E12;
  --aviso-suave: #F7E3C4;
  --amarillo-suave: #F5ECC2;
  --error: #A3352B;
  --error-suave: #F5D6D1;
  --sombra-1: 0 1px 2px rgba(42, 28, 22, .05);
  --sombra-2: 0 1px 2px rgba(42, 28, 22, .05), 0 8px 24px -8px rgba(42, 28, 22, .14);
  --sombra-3: 0 24px 60px -12px rgba(42, 28, 22, .35);
  --radio: 18px;
  --radio-peq: 12px;
  --texto: "Manrope", system-ui, sans-serif;
  --titulo: "Fraunces", "Georgia", serif;
  --ancho-menu: 248px;
  --alto-barra: 64px;
  --patron-opacidad: .085;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) {
    --terracota: #D9734F; --terracota-viva: #EE8A63; --terracota-osc: #F2A27F; --terracota-suave: #3A231B;
    --oro: #D9B467; --olivo: #A9B48F; --olivo-suave: #2A2F23; --albaicin: #7FB2C9;
    --fondo: #15100D; --superficie: #1E1713; --superficie-2: #2A201B; --tinta: #F4EBDD; --tinta-suave: #B9A897;
    --linea: #3A2D26; --ok: #8CC57A; --ok-suave: #22311D; --aviso: #E7A853; --aviso-suave: #3A2A14;
    --amarillo-suave: #353016; --error: #F08A7E; --error-suave: #3B1E1A;
    --sombra-2: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -8px rgba(0,0,0,.6); --sombra-3: 0 24px 60px -12px rgba(0,0,0,.8);
    --patron-opacidad: .07; color-scheme: dark;
  }
}
:root[data-tema="oscuro"] {
  --terracota: #D9734F; --terracota-viva: #EE8A63; --terracota-osc: #F2A27F; --terracota-suave: #3A231B;
  --oro: #D9B467; --olivo: #A9B48F; --olivo-suave: #2A2F23; --albaicin: #7FB2C9;
  --fondo: #15100D; --superficie: #1E1713; --superficie-2: #2A201B; --tinta: #F4EBDD; --tinta-suave: #B9A897;
  --linea: #3A2D26; --ok: #8CC57A; --ok-suave: #22311D; --aviso: #E7A853; --aviso-suave: #3A2A14;
  --amarillo-suave: #353016; --error: #F08A7E; --error-suave: #3B1E1A;
  --sombra-2: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -8px rgba(0,0,0,.6); --sombra-3: 0 24px 60px -12px rgba(0,0,0,.8);
  --patron-opacidad: .07; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: var(--texto); color: var(--tinta); background: var(--fondo);
  font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
/* Lacería nazarí: estrellas de ocho y cruces entrelazadas en cinta doble,
   como los alicatados de la Alhambra. Está hecha con el método de los
   artesanos (red de octógonos y cuadrados; ver la losa en --laceria). Va
   como máscara para que el color salga de la paleta y cambie con el tema. */
:root { --laceria: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cdefs%3E%3Cmask id='m'%3E%3Cg fill='none' stroke-linecap='square'%3E%3Cpath d='M48 -0L24 9.94M24 9.94L33.94 33.94M33.94 33.94L9.94 24M9.94 24L0 48M0 48L-9.94 24M24 -9.94L48 -0M62.06 33.94L56.24 48M56.24 48L62.06 62.06M62.06 62.06L48 56.24M48 56.24L33.94 62.06M33.94 62.06L39.76 48M39.76 48L33.94 33.94M33.94 33.94L48 39.76M48 39.76L62.06 33.94M48 96L24 105.94M-9.94 72L-0 48M-0 48L9.94 72M9.94 72L33.94 62.06M33.94 62.06L24 86.06M24 86.06L48 96M105.94 24L96 48M96 48L86.06 24M86.06 24L62.06 33.94M62.06 33.94L72 9.94M72 9.94L48 0M48 0L72 -9.94M72 105.94L48 96M48 96L72 86.06M72 86.06L62.06 62.06M62.06 62.06L86.06 72M86.06 72L96 48M96 48L105.94 72' stroke='%23fff' stroke-width='5.2'/%3E%3Cpath d='M48 -0L24 9.94M24 9.94L33.94 33.94M33.94 33.94L9.94 24M9.94 24L0 48M0 48L-9.94 24M24 -9.94L48 -0M62.06 33.94L56.24 48M56.24 48L62.06 62.06M62.06 62.06L48 56.24M48 56.24L33.94 62.06M33.94 62.06L39.76 48M39.76 48L33.94 33.94M33.94 33.94L48 39.76M48 39.76L62.06 33.94M48 96L24 105.94M-9.94 72L-0 48M-0 48L9.94 72M9.94 72L33.94 62.06M33.94 62.06L24 86.06M24 86.06L48 96M105.94 24L96 48M96 48L86.06 24M86.06 24L62.06 33.94M62.06 33.94L72 9.94M72 9.94L48 0M48 0L72 -9.94M72 105.94L48 96M48 96L72 86.06M72 86.06L62.06 62.06M62.06 62.06L86.06 72M86.06 72L96 48M96 48L105.94 72' stroke='%23000' stroke-width='2.4'/%3E%3C/g%3E%3Cpath d='M3.2 0a3.2 3.2 0 1 0-6.4 0a3.2 3.2 0 1 0 6.4 0M3.2 96a3.2 3.2 0 1 0-6.4 0a3.2 3.2 0 1 0 6.4 0M99.2 0a3.2 3.2 0 1 0-6.4 0a3.2 3.2 0 1 0 6.4 0M99.2 96a3.2 3.2 0 1 0-6.4 0a3.2 3.2 0 1 0 6.4 0M48 45l3 3-3 3-3-3z' fill='%23fff'/%3E%3C/mask%3E%3C/defs%3E%3Crect width='100%25' height='100%25' fill='%23000' mask='url%28%23m%29'/%3E%3C/svg%3E"); }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: var(--patron-opacidad);
  background: var(--terracota);
  -webkit-mask: var(--laceria) 0 0 / 96px 96px repeat; mask: var(--laceria) 0 0 / 96px 96px repeat;
}
::selection { background: var(--terracota); color: #fff; }
a { color: var(--terracota); text-underline-offset: 3px; }
h1, h2, h3 { margin: 0 0 .35em; line-height: 1.15; }
h1 { font-family: var(--titulo); font-weight: 600; font-size: clamp(1.6rem, 2.6vw, 2.25rem); letter-spacing: -.02em; font-variation-settings: "opsz" 72, "SOFT" 50; }
h1 em { font-style: italic; color: var(--terracota); }
h2 { font-family: var(--titulo); font-weight: 600; font-size: 1.22rem; letter-spacing: -.01em; }
h3 { font-size: .98rem; font-weight: 800; }
small, .suave { color: var(--tinta-suave); }
svg.ico { width: 1.15em; height: 1.15em; stroke: currentColor; flex-shrink: 0; vertical-align: -.2em; }
.mono { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--terracota-viva); outline-offset: 2px; border-radius: 6px; }

/* ------------------------------------------------------------ estructura */

.app { min-height: 100vh; display: grid; grid-template-columns: var(--ancho-menu) 1fr; grid-template-rows: var(--alto-barra) 1fr; }
.app.plegado { --ancho-menu: 76px; }

.lateral {
  grid-row: 1 / 3; position: sticky; top: 0; height: 100vh; overflow: hidden auto;
  background: var(--superficie); border-right: 1px solid var(--linea);
  display: flex; flex-direction: column; padding: 14px 12px; z-index: 60;
  transition: width .25s ease;
}
.lateral .marca { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 6px; margin-bottom: 10px; }
.lateral .marca img.logo { height: 38px; width: auto; }
.lateral .marca img.icono { height: 36px; width: 36px; border-radius: 10px; display: none; }
.app.plegado .lateral .marca img.logo { display: none; }
.app.plegado .lateral .marca img.icono { display: block; }
.menu .grupo { font-size: .68rem; text-transform: uppercase; letter-spacing: .14em; color: var(--tinta-suave); margin: 18px 12px 6px; font-weight: 700; }
.app.plegado .menu .grupo { visibility: hidden; height: 6px; margin: 8px 0; }
.menu a {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 12px; margin: 2px 0;
  border-radius: 12px; color: var(--tinta); text-decoration: none; font-weight: 600; font-size: .92rem;
  transition: background .15s, color .15s;
}
.menu a svg { width: 20px; height: 20px; flex-shrink: 0; stroke: var(--tinta-suave); transition: stroke .15s; }
.menu a:hover { background: var(--superficie-2); }
.menu a:hover svg { stroke: var(--terracota); }
.menu a.activo { background: var(--terracota); color: #fff; border-radius: 24px 24px 12px 12px; box-shadow: 0 6px 16px -6px var(--terracota); }
.menu a.activo svg { stroke: #fff; }
.menu .contador { margin-left: auto; background: var(--terracota-suave); color: var(--terracota-osc); border-radius: 999px; font-size: .7rem; padding: 1px 8px; font-weight: 800; }
.menu a.activo .contador { background: rgba(255,255,255,.25); color: #fff; }
.app.plegado .menu a span:not(.contador) { display: none; }
.app.plegado .menu a { justify-content: center; padding: 11px; }
.app.plegado .menu .contador { position: absolute; top: 2px; right: 4px; padding: 0 5px; }
.lateral .pie-lateral { margin-top: auto; padding-top: 12px; display: flex; gap: 6px; align-items: center; }
.app.plegado .lateral .pie-lateral { flex-direction: column; }

.barra {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 12px; padding: 0 28px;
  background: color-mix(in srgb, var(--fondo) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid color-mix(in srgb, var(--linea) 70%, transparent);
}
.barra .hueco { flex: 1; }
.buscar-global {
  display: flex; align-items: center; gap: 10px; width: min(420px, 100%); height: 40px; padding: 0 14px;
  background: var(--superficie); border: 1px solid var(--linea); border-radius: 999px; color: var(--tinta-suave);
  cursor: pointer; font: inherit; font-size: .9rem; transition: border-color .15s, box-shadow .15s;
}
.buscar-global:hover { border-color: var(--terracota); box-shadow: 0 0 0 4px var(--terracota-suave); background: var(--superficie); color: var(--tinta-suave); }
.buscar-global svg { width: 18px; height: 18px; stroke: currentColor; }
.buscar-global kbd { margin-left: auto; }
kbd { font-family: var(--texto); font-size: .72rem; font-weight: 700; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--linea); background: var(--superficie-2); color: var(--tinta-suave); }
.boton-icono { width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 999px; background: var(--superficie); color: var(--tinta); border: 1px solid var(--linea); }
.boton-icono:hover { background: var(--superficie-2); color: var(--terracota); }
.boton-icono svg { width: 19px; height: 19px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; flex-shrink: 0;
  font-weight: 800; font-size: .82rem; color: #fff; background: var(--terracota); letter-spacing: .02em;
}
.avatar.peq { width: 26px; height: 26px; font-size: .68rem; }
.chip-usuario { display: flex; align-items: center; gap: 10px; padding: 3px 4px 3px 12px; border-radius: 999px; border: 1px solid var(--linea); background: var(--superficie); cursor: pointer; font: inherit; color: var(--tinta); }
.chip-usuario:hover { background: var(--superficie-2); color: var(--tinta); }
.chip-usuario .rol { font-size: .75rem; color: var(--olivo); font-weight: 700; display: block; line-height: 1.1; }
.chip-usuario .nombre { font-weight: 700; font-size: .85rem; display: block; line-height: 1.2; text-align: left; }

main { padding: 26px 28px 96px; min-width: 0; max-width: 1320px; width: 100%; }
.vista-entra { animation: entra .32s cubic-bezier(.2, .7, .2, 1); }
@keyframes entra { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.titulo-seccion { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.titulo-seccion .hueco { flex: 1; }
.titulo-seccion p { margin: 0; color: var(--tinta-suave); max-width: 64ch; }
.migas { font-size: .82rem; font-weight: 700; text-decoration: none; color: var(--tinta-suave); display: inline-flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.migas:hover { color: var(--terracota); }

/* ------------------------------------------------------------- piezas */

.tarjeta {
  background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio);
  box-shadow: var(--sombra-1); padding: 18px 20px; margin-bottom: 16px; position: relative;
}
.tarjeta.arco { border-radius: 64px 64px var(--radio) var(--radio); padding-top: 28px; }
a.tarjeta, .tarjeta.viva { transition: transform .18s ease, box-shadow .18s ease, border-color .18s; }
a.tarjeta:hover, .tarjeta.viva:hover { transform: translateY(-3px); box-shadow: var(--sombra-2); border-color: color-mix(in srgb, var(--terracota) 35%, var(--linea)); }
.tarjeta .cabeza-tarjeta { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.tarjeta .cabeza-tarjeta h2, .tarjeta .cabeza-tarjeta h3 { margin: 0; flex: 1; }
.rejilla { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.rejilla .tarjeta { margin: 0; }
.fila { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.fila .hueco { flex: 1; }
.columna { display: flex; flex-direction: column; gap: 8px; }

/* bento del panel */
.bento { display: grid; gap: 16px; grid-template-columns: repeat(12, 1fr); margin-bottom: 16px; }
.bento > * { margin: 0; min-width: 0; }
.b-3 { grid-column: span 3; } .b-4 { grid-column: span 4; } .b-5 { grid-column: span 5; } .b-6 { grid-column: span 6; }
.b-7 { grid-column: span 7; } .b-8 { grid-column: span 8; } .b-12 { grid-column: span 12; }
.heroe {
  position: relative; overflow: hidden; border-radius: 28px; padding: 28px 30px; color: #fff; margin-bottom: 16px;
  background: radial-gradient(120% 140% at 100% 0%, #B4532F 0%, #8A3F2D 45%, #5E2A1E 100%);
  box-shadow: 0 20px 40px -20px rgba(138, 63, 45, .7);
}
.heroe h1 { color: #fff; margin-bottom: 6px; }
.heroe h1 em { color: #F6D9A8; }
.heroe p { margin: 0; color: rgba(255,255,255,.82); }
.heroe .silueta { position: absolute; right: -10px; bottom: -6px; width: min(520px, 60%); opacity: .22; pointer-events: none; }
.heroe .acciones { position: relative; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.heroe .boton, .heroe button { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.35); color: #fff; backdrop-filter: blur(6px); }
.heroe .boton:hover, .heroe button:hover { background: rgba(255,255,255,.26); }
.heroe .boton.blanco { background: #fff; color: var(--terracota-osc); border-color: #fff; }

.kpi { padding: 18px 20px; }
.kpi .etiq { font-size: .78rem; font-weight: 700; color: var(--tinta-suave); display: flex; align-items: center; gap: 6px; }
.kpi .valor { font-family: var(--titulo); font-size: 2rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: .78rem; font-weight: 800; }
.kpi .delta.sube { color: var(--ok); } .kpi .delta.baja { color: var(--error); }
.kpi svg.mini { width: 100%; height: 38px; display: block; margin-top: 8px; overflow: visible; }

.cifras { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 16px; }
.cifra { background: var(--superficie); border: 1px solid var(--linea); border-radius: 40px 40px 14px 14px; padding: 18px 14px 14px; text-align: center; }
.cifra b { display: block; font-family: var(--titulo); font-size: 1.7rem; font-weight: 600; color: var(--terracota); font-variant-numeric: tabular-nums; }
.cifra span { font-size: .8rem; color: var(--tinta-suave); font-weight: 600; }

.anillo { --p: 0; --c: var(--olivo); width: 96px; height: 96px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--superficie-2) 0); }
.anillo::after { content: attr(data-texto); width: 74px; height: 74px; border-radius: 50%; background: var(--superficie); display: grid; place-items: center;
  font-family: var(--titulo); font-weight: 600; font-size: 1.2rem; }

.embudo { display: flex; flex-direction: column; gap: 8px; }
.embudo .paso { display: grid; grid-template-columns: 110px 1fr 40px; align-items: center; gap: 10px; font-size: .85rem; font-weight: 600; }
.embudo .barra-e { height: 12px; border-radius: 999px; background: var(--superficie-2); overflow: hidden; }
.embudo .barra-e span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--terracota), var(--oro)); transition: width .8s cubic-bezier(.2,.7,.2,1); }

.linea-tiempo { list-style: none; margin: 0; padding: 0; position: relative; }
.linea-tiempo::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--linea); }
.linea-tiempo li { position: relative; padding: 0 0 14px 26px; }
.linea-tiempo li::before { content: ""; position: absolute; left: 1px; top: 5px; width: 14px; height: 14px; border-radius: 50%; background: var(--superficie); border: 3px solid var(--terracota); }
.linea-tiempo li.olivo::before { border-color: var(--olivo); } .linea-tiempo li.oro::before { border-color: var(--oro); }
.linea-tiempo b { display: block; font-size: .9rem; } .linea-tiempo small { font-size: .78rem; }

/* botones */
.boton, button {
  font: inherit; font-weight: 700; font-size: .88rem; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--terracota); background: var(--terracota); color: #fff; border-radius: 999px; padding: 9px 18px;
  display: inline-flex; align-items: center; gap: 7px; text-decoration: none; line-height: 1.2;
  transition: background .15s, transform .08s, box-shadow .15s, color .15s;
}
.boton:hover, button:hover { background: var(--terracota-viva); border-color: var(--terracota-viva); color: #fff; }
.boton:active, button:active { transform: scale(.97); }
.boton svg, button svg { width: 17px; height: 17px; stroke: currentColor; flex-shrink: 0; }
.boton.sec, button.sec { background: transparent; color: var(--terracota); border-color: color-mix(in srgb, var(--terracota) 45%, var(--linea)); }
.boton.sec:hover, button.sec:hover { background: var(--terracota-suave); color: var(--terracota-osc); }
.boton.olivo, button.olivo { background: var(--olivo); border-color: var(--olivo); color: #fff; }
.boton.wa, button.wa { background: #1F8A55; border-color: #1F8A55; color: #fff; }
.boton.wa:hover, button.wa:hover { background: #17744A; }
.boton.fantasma, button.fantasma { background: transparent; border-color: transparent; color: var(--tinta-suave); }
.boton.fantasma:hover, button.fantasma:hover { background: var(--superficie-2); color: var(--tinta); }
.boton.peq, button.peq { padding: 5px 12px; font-size: .8rem; }
.boton.crear { box-shadow: 0 8px 20px -8px var(--terracota); padding: 9px 16px; }
button.link { background: none; border: 0; color: var(--terracota); padding: 0; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
button:disabled { opacity: .5; cursor: default; }

/* formularios */
label { display: block; font-size: .8rem; font-weight: 700; color: var(--tinta-suave); margin: 10px 0 4px; }
input, select, textarea {
  font: inherit; width: 100%; padding: 10px 12px; border-radius: var(--radio-peq);
  border: 1px solid var(--linea); background: var(--superficie); color: var(--tinta); transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--terracota) 30%, var(--linea)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--terracota); box-shadow: 0 0 0 4px var(--terracota-suave); }
textarea { min-height: 84px; resize: vertical; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--terracota); padding: 0; }
input[type=color] { height: 42px; padding: 4px; }
.form2 { display: grid; gap: 0 14px; grid-template-columns: 1fr 1fr; }
.form2 .ancho { grid-column: 1 / -1; }
.buscador { max-width: 300px; border-radius: 999px; padding-left: 16px; }

.pestanas { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 18px; border-radius: 999px; background: var(--superficie-2); border: 1px solid var(--linea); max-width: 100%; overflow-x: auto; }
.pestanas button { background: transparent; color: var(--tinta-suave); border: 0; border-radius: 999px; padding: 8px 16px; }
.pestanas button:hover { background: var(--superficie); color: var(--tinta); }
.pestanas button.activa { background: var(--superficie); color: var(--terracota); box-shadow: var(--sombra-2); }

.tabla { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tabla th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--tinta-suave); padding: 8px 10px; border-bottom: 1px solid var(--linea); font-weight: 800; }
.tabla td { padding: 10px; border-bottom: 1px solid var(--superficie-2); vertical-align: top; }
.tabla tbody tr { transition: background .12s; }
.tabla tbody tr:hover td { background: color-mix(in srgb, var(--superficie-2) 60%, transparent); }
.envoltura-tabla { overflow-x: auto; }

.etiqueta { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 800; border-radius: 999px; padding: 3px 10px; background: var(--superficie-2); color: var(--tinta); white-space: nowrap; }
.etiqueta::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.etiqueta.verde { background: var(--ok-suave); color: var(--ok); }
.etiqueta.naranja { background: var(--aviso-suave); color: var(--aviso); }
.etiqueta.amarilla { background: var(--amarillo-suave); color: #8A6D0A; }
:root[data-tema="oscuro"] .etiqueta.amarilla { color: #E4CF73; }
.etiqueta.roja { background: var(--error-suave); color: var(--error); }
.etiqueta.olivo { background: var(--olivo-suave); color: var(--olivo); }
.etiqueta.terracota { background: var(--terracota-suave); color: var(--terracota-osc); }

.lista { list-style: none; margin: 0; padding: 0; }
.lista > li { padding: 12px 0; border-bottom: 1px solid var(--superficie-2); display: flex; gap: 12px; align-items: flex-start; }
.lista > li:last-child { border-bottom: 0; padding-bottom: 2px; }
.lista .principal { flex: 1; min-width: 0; }
.lista .principal b { display: block; }
.vacio { text-align: center; color: var(--tinta-suave); padding: 28px 12px; font-weight: 600; }
.vacio svg { width: 64px; height: 64px; stroke: var(--terracota); opacity: .35; display: block; margin: 0 auto 10px; }

.aviso { border-radius: 14px; padding: 11px 15px; margin-bottom: 12px; background: var(--olivo-suave); border: 1px solid color-mix(in srgb, var(--olivo) 30%, transparent); }
.aviso.malo { background: var(--error-suave); border-color: color-mix(in srgb, var(--error) 30%, transparent); }
.aviso.cuidado { background: var(--aviso-suave); border-color: color-mix(in srgb, var(--aviso) 30%, transparent); }

.mapa { height: 420px; border-radius: var(--radio); border: 1px solid var(--linea); overflow: hidden; z-index: 1; }
.mapa.alto { height: 580px; }
:root[data-tema="oscuro"] .mapa .leaflet-tile-pane { filter: brightness(.75) contrast(1.1) saturate(.8); }
.leaflet-container { font-family: var(--texto) !important; }
.leaflet-tooltip { border-radius: 10px !important; font-weight: 700; }

.fotos { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.fotos a, .fotos div { position: relative; display: block; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--superficie-2); }
.fotos img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.fotos a:hover img { transform: scale(1.05); }
.fotos .marca { position: absolute; left: 6px; bottom: 6px; }

/* ventanas: modal en ordenador, hoja inferior en el móvil */
dialog {
  border: 0; border-radius: 32px 32px var(--radio) var(--radio); padding: 0; width: min(660px, calc(100vw - 24px));
  background: var(--superficie); color: var(--tinta); box-shadow: var(--sombra-3);
}
dialog[open] { animation: aparece .22s cubic-bezier(.2,.7,.2,1); }
@keyframes aparece { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
dialog::backdrop { background: rgba(30, 18, 12, .45); backdrop-filter: blur(3px); }
dialog .cabeza { padding: 22px 24px 6px; display: flex; align-items: center; gap: 10px; }
dialog .cabeza h2 { margin: 0; flex: 1; }
dialog .contenido { padding: 4px 24px 14px; max-height: 70vh; overflow: auto; }
dialog .pie { padding: 12px 24px 20px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--superficie-2); }

/* paleta de órdenes (Ctrl+K) */
dialog.paleta { width: min(620px, calc(100vw - 24px)); margin-top: 12vh; border-radius: 22px; }
.paleta .entrada { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--linea); }
.paleta .entrada svg { width: 20px; height: 20px; stroke: var(--terracota); }
.paleta .entrada input { border: 0; box-shadow: none; padding: 6px 0; font-size: 1.05rem; background: transparent; }
.paleta ul { list-style: none; margin: 0; padding: 8px; max-height: 52vh; overflow: auto; }
.paleta li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; cursor: pointer; }
.paleta li svg { width: 18px; height: 18px; stroke: var(--tinta-suave); flex-shrink: 0; }
.paleta li.sel { background: var(--terracota-suave); }
.paleta li.sel svg { stroke: var(--terracota); }
.paleta li small { margin-left: auto; }
.paleta .grupo-p { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--tinta-suave); font-weight: 800; padding: 8px 12px 4px; cursor: default; }
.paleta .pista { padding: 10px 18px; border-top: 1px solid var(--linea); font-size: .78rem; color: var(--tinta-suave); display: flex; gap: 14px; }

/* menú desplegable */
.desplegable { position: fixed; z-index: 200; background: var(--superficie); border: 1px solid var(--linea); border-radius: 16px; box-shadow: var(--sombra-3); padding: 6px; min-width: 230px; animation: aparece .15s ease; }
.desplegable button { width: 100%; justify-content: flex-start; background: transparent; border: 0; color: var(--tinta); border-radius: 10px; font-weight: 600; padding: 9px 12px; }
.desplegable button:hover { background: var(--superficie-2); color: var(--terracota); }
.desplegable button svg { stroke: var(--tinta-suave); }
.desplegable hr { border: 0; border-top: 1px solid var(--linea); margin: 6px 4px; }

.tostada {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 999; display: flex; align-items: center; gap: 10px;
  background: var(--tinta); color: var(--fondo); padding: 11px 18px; border-radius: 999px; font-weight: 700; box-shadow: var(--sombra-3);
  max-width: calc(100vw - 32px); animation: sube .25s cubic-bezier(.2,.7,.2,1);
}
.tostada.error { background: var(--error); color: #fff; }
@keyframes sube { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

.barra-progreso { height: 8px; background: var(--superficie-2); border-radius: 999px; overflow: hidden; }
.barra-progreso span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--olivo), #7E8B66); }

.esqueleto { border-radius: var(--radio); background: linear-gradient(90deg, var(--superficie-2) 0%, var(--superficie) 50%, var(--superficie-2) 100%); background-size: 200% 100%; animation: brillo 1.2s infinite linear; }
@keyframes brillo { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* kanban de captación */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.columna-k { background: var(--superficie-2); border-radius: 22px 22px 16px 16px; padding: 12px; min-height: 180px; border: 1px solid transparent; transition: border-color .15s, background .15s; }
.columna-k.encima { border-color: var(--terracota); background: var(--terracota-suave); }
.columna-k .cab-k { display: flex; align-items: center; gap: 8px; padding: 2px 4px 10px; font-weight: 800; font-size: .85rem; }
.columna-k .cab-k .punto { width: 10px; height: 10px; border-radius: 50%; }
.columna-k .cab-k small { margin-left: auto; font-weight: 800; }
.tarjeta-k { background: var(--superficie); border: 1px solid var(--linea); border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; cursor: grab; box-shadow: var(--sombra-1); transition: box-shadow .15s, transform .15s; }
.tarjeta-k:hover { box-shadow: var(--sombra-2); }
.tarjeta-k.arrastrando { opacity: .5; transform: rotate(2deg); }
.tarjeta-k b { display: block; font-size: .88rem; }
.tarjeta-k small { display: block; font-size: .76rem; }

/* calendario */
.calendario { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.calendario .dia-s { text-align: center; font-size: .72rem; font-weight: 800; color: var(--tinta-suave); text-transform: uppercase; letter-spacing: .08em; padding-bottom: 4px; }
.calendario .dia { min-height: 110px; background: var(--superficie); border: 1px solid var(--linea); border-radius: 14px; padding: 6px; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.calendario .dia.fuera { opacity: .45; }
.calendario .dia.hoy { border-color: var(--terracota); box-shadow: 0 0 0 3px var(--terracota-suave); }
.calendario .num { font-weight: 800; font-size: .8rem; }
.calendario .dia.hoy .num { color: var(--terracota); }
.calendario .ev { font-size: .7rem; font-weight: 700; padding: 2px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--superficie-2); }
.ev.cola { background: var(--terracota-suave); color: var(--terracota-osc); }
.ev.interior, .ev.exterior { background: var(--olivo-suave); color: var(--olivo); }
.ev.retirar { background: var(--aviso-suave); color: var(--aviso); }
.ev.expositor { background: color-mix(in srgb, var(--albaicin) 18%, transparent); color: var(--albaicin); }
.ev.pendiente { background: var(--amarillo-suave); }
.ev.hecha { text-decoration: line-through; opacity: .6; }

/* chinchetas del mapa */
.pin { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 2px solid #fff; box-shadow: 0 3px 8px rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; }
.pin span { transform: rotate(45deg); color: #fff; font-weight: 800; font-size: 12px; }
.pin.peq { width: 20px; height: 20px; }

.qr { background: #fff; padding: 10px; border-radius: 14px; display: inline-block; }
.qr img, .qr canvas { display: block; }

.nav-movil, .fab { display: none; }

/* ------------------------------------------------------------- móvil */
@media (max-width: 1100px) {
  .b-3 { grid-column: span 6; } .b-4, .b-5, .b-7, .b-8 { grid-column: span 12; } .b-6 { grid-column: span 12; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .lateral { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-102%); transition: transform .25s ease; box-shadow: var(--sombra-3); }
  .lateral.abierto { transform: none; }
  .app.plegado { --ancho-menu: 248px; }
  .barra { padding: 0 14px; height: 60px; }
  .buscar-global .texto, .buscar-global kbd { display: none; }
  .buscar-global { width: 40px; padding: 0; justify-content: center; }
  .chip-usuario .textos, .barra .crear .texto { display: none; }
  .barra .crear { padding: 9px 12px; }
  main { padding: 18px 16px 110px; }
  .form2 { grid-template-columns: 1fr; }
  .mapa.alto { height: 440px; }
  .b-3 { grid-column: span 6; }
  .heroe { padding: 22px; border-radius: 24px; }
  .lista > li { flex-wrap: wrap; }
  .lista > li > .columna { width: 100%; align-items: flex-start !important; }
  .lista > li > .columna .fila { justify-content: flex-start !important; }
  .titulo-seccion .buscador { max-width: none; flex: 1 1 100%; }
  .cifras { grid-template-columns: 1fr 1fr; }
  .calendario .dia { min-height: 64px; }
  .calendario .ev { font-size: 0; height: 6px; padding: 0; }
  dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 28px 28px 0 0; max-height: 92vh; }
  dialog[open] { animation: hoja .28s cubic-bezier(.2,.7,.2,1); }
  @keyframes hoja { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
  dialog .contenido { max-height: 66vh; }
  dialog.paleta { margin-top: 6vh; border-radius: 22px; width: calc(100vw - 20px); }
  .nav-movil {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 60; justify-content: space-around;
    background: color-mix(in srgb, var(--superficie) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--linea); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .nav-movil a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; color: var(--tinta-suave); text-decoration: none; font-weight: 800; padding: 4px 8px; border-radius: 12px; }
  .nav-movil a svg { width: 23px; height: 23px; stroke: currentColor; }
  .nav-movil a.activo { color: var(--terracota); }
  .fab { display: grid; place-items: center; position: fixed; right: 18px; bottom: calc(78px + env(safe-area-inset-bottom)); z-index: 61; width: 58px; height: 58px; border-radius: 22px 22px 22px 8px; padding: 0; box-shadow: 0 12px 28px -8px var(--terracota); }
  .fab svg { width: 26px; height: 26px; }
}
@media (max-width: 520px) { .b-3 { grid-column: span 12; } .heroe .silueta { width: 90%; opacity: .14; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

@media print {
  .lateral, .barra, .nav-movil, .fab, .no-imprimir { display: none !important; }
  .app { display: block; }
  body { background: #fff; } body::before { display: none; }
}

/* botón de menú solo en el móvil */
.barra #abrirMenu { display: none; }
@media (max-width: 900px) { .barra #abrirMenu { display: inline-flex; } }

/* celebración al ganar un cliente */
.confeti { position: fixed; inset: 0; pointer-events: none; z-index: 1000; overflow: hidden; }
.confeti i { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px; animation: caer linear forwards; }
@keyframes caer { to { transform: translate(var(--x), 105vh) rotate(var(--giro)); opacity: .9; } }

/* el logo es terracota oscuro: en modo oscuro se aclara para que se lea */
:root[data-tema="oscuro"] .lateral .marca img.logo { filter: brightness(1.75) saturate(1.1); }
@media (prefers-color-scheme: dark) { :root:not([data-tema="claro"]) .lateral .marca img.logo { filter: brightness(1.75) saturate(1.1); } }
@media (max-width: 900px) { .barra .crear { display: none !important; } }

/* ------------------------------------------------- contraseñas (caja fuerte) */
.caja-cerrada { max-width: 520px; margin: 24px auto; text-align: center; }
.caja-cerrada .candado { width: 64px; height: 64px; margin: 4px auto 10px; border-radius: 50%; display: grid; place-items: center; background: var(--terracota-suave); color: var(--terracota-osc); }
.caja-cerrada .candado .ico { width: 30px; height: 30px; stroke: currentColor; }
.caja-cerrada form { margin-top: 14px; }
.ficha-clave { align-items: center; }
.acciones-clave { gap: 6px; justify-content: flex-end; }
.acciones-clave .ico { width: 16px; height: 16px; stroke: currentColor; vertical-align: -3px; }
.acciones-clave button span { margin-left: 4px; }
.secreto { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; word-break: break-all; user-select: all; letter-spacing: .02em; }
.secreto.grande { font-size: 1.15rem; }
@media (max-width: 640px) {
  .ficha-clave { flex-wrap: wrap; }
  .acciones-clave { width: 100%; justify-content: flex-start; }
  .acciones-clave button span { display: none; }
}

/* error de una sección, con botón para reintentar */
.aviso-error { display: flex; gap: 12px; align-items: center; }
.aviso-error .ico { width: 22px; height: 22px; stroke: var(--error); }

/* arranque sin conexión */
.sin-conexion { max-width: 520px; margin: 32px auto; text-align: center; }
.sin-conexion > .ico { width: 48px; height: 48px; stroke: var(--terracota); margin: 4px auto 8px; display: block; }

/* tareas automáticas */
.autos .tarjeta.auto { display: flex; flex-direction: column; gap: 6px; transition: border-color .2s, box-shadow .2s; }
.autos .tarjeta.auto p { margin: 0; font-size: .88rem; }
.autos .tarjeta.auto.encendida { border-color: color-mix(in srgb, var(--olivo) 45%, var(--linea)); box-shadow: 0 0 0 3px var(--olivo-suave); }
.autos .estado-auto { margin-top: auto; padding-top: 6px; }
.icono-auto { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--terracota-suave); color: var(--terracota-osc); flex-shrink: 0; }
.encendida .icono-auto { background: var(--olivo-suave); color: var(--olivo); }
.icono-auto .ico { width: 20px; height: 20px; stroke: currentColor; }
.interruptor { position: relative; width: 46px; height: 26px; margin: 0; flex-shrink: 0; cursor: pointer; }
.interruptor input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.interruptor span { position: absolute; inset: 0; border-radius: 999px; background: var(--linea); transition: background .2s; }
.interruptor span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s cubic-bezier(.2,.7,.2,1); }
.interruptor input:checked + span { background: var(--olivo); }
.interruptor input:checked + span::after { transform: translateX(20px); }
.interruptor input:focus-visible + span { outline: 2px solid var(--terracota-viva); outline-offset: 2px; }
.rejilla.autos { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.autos .form2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
.autos .form2 .ancho { grid-column: 1 / -1; }
.autos h2 { font-size: 1.08rem; }

/* ---------------------------------------------------- remates nazaríes */
/* Remate bajo el título de cada sección: dos hilos y una estrella de ocho. */
:root { --remate: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='14' viewBox='0 0 88 14'%3E%3Cg fill='none' stroke='%23000' stroke-width='1.3'%3E%3Cpath d='M0 7h34M54 7h34'/%3E%3Cpath d='M44.0 0.8L42.3 2.9L39.6 2.6L39.9 5.3L37.8 7.0L39.9 8.7L39.6 11.4L42.3 11.1L44.0 13.2L45.7 11.1L48.4 11.4L48.1 8.7L50.2 7.0L48.1 5.3L48.4 2.6L45.7 2.9z'/%3E%3Ccircle cx='44' cy='7' r='1.6' fill='%23000'/%3E%3C/g%3E%3C/svg%3E"); }
.titulo-seccion > div:first-child > h1::after {
  content: ""; display: block; width: 88px; height: 14px; margin-top: 8px; background: var(--oro);
  -webkit-mask: var(--remate) center / contain no-repeat; mask: var(--remate) center / contain no-repeat; opacity: .9;
}
/* La lacería en blanco sobre la cabecera de Inicio, apagándose hacia la izquierda */
.heroe::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; background: #fff; opacity: .13;
  -webkit-mask: var(--laceria) 0 0 / 120px 120px repeat, linear-gradient(100deg, transparent 25%, #000 85%);
  -webkit-mask-composite: source-in;
  mask: var(--laceria) 0 0 / 120px 120px repeat, linear-gradient(100deg, transparent 25%, #000 85%);
  mask-composite: intersect;
}
.heroe > * { position: relative; }
.heroe .silueta { position: absolute; }
.vacio svg { opacity: .45; stroke-width: 1.3; }
