/* ==========================================================================
   Soporte ECINSA · estilos
   ========================================================================== */
:root {
  --fondo: #f3f5fb;
  --panel: #ffffff;
  --panel-2: #f8f9fd;
  --borde: #e4e7f0;
  --texto: #18203a;
  --suave: #69718c;
  --primario: #4f46e5;
  --primario-2: #7c3aed;
  --primario-suave: #eef0ff;
  --primario-texto: #ffffff;
  --ok: #0f9f6e;
  --ok-suave: #e6f7f0;
  --mal: #dc2b4a;
  --mal-suave: #fdecef;
  --aviso: #c27803;
  --aviso-suave: #fff5e0;
  --info: #2563eb;
  --info-suave: #e8f0ff;
  --chip: #eef0f6;
  --lateral: #0f1426;
  --lateral-2: #1a2140;
  --lateral-texto: #c7cbe0;
  --sombra: 0 1px 2px rgba(20, 28, 60, .06), 0 4px 16px rgba(20, 28, 60, .06);
  --sombra-alta: 0 12px 40px rgba(20, 28, 60, .16);
  --radio: 14px;
  --radio-p: 10px;
  --fuente: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #0b0f1e;
    --panel: #141a2e;
    --panel-2: #10162a;
    --borde: #262e4a;
    --texto: #e7e9f3;
    --suave: #9aa1bd;
    --primario: #818cf8;
    --primario-2: #a78bfa;
    --primario-suave: #1f2450;
    --primario-texto: #0b0f1e;
    --ok: #34d399;
    --ok-suave: #0f2a22;
    --mal: #fb7185;
    --mal-suave: #33141c;
    --aviso: #fbbf24;
    --aviso-suave: #2e230d;
    --info: #60a5fa;
    --info-suave: #142542;
    --chip: #1e2540;
    --lateral: #070a16;
    --lateral-2: #12182e;
    --sombra: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    --sombra-alta: 0 12px 40px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.5 var(--fuente); background: var(--fondo); color: var(--texto); -webkit-font-smoothing: antialiased; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
a { color: var(--primario); }
code { font: 12px ui-monospace, 'Cascadia Code', Consolas, monospace; word-break: break-all; background: var(--chip); padding: 1px 5px; border-radius: 5px; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
h4 { font-size: 13px; font-weight: 650; display: flex; align-items: center; gap: 6px; margin: 16px 0 6px; color: var(--suave); text-transform: uppercase; letter-spacing: .04em; }

/* ----- barra de carga ----- */
body::before {
  content: ''; position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 50; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--primario), var(--primario-2), transparent);
  background-size: 50% 100%; background-repeat: no-repeat; opacity: 0; transition: opacity .2s;
}
body.cargando::before { opacity: 1; animation: carga 1s linear infinite; }
@keyframes carga { from { background-position: -50% 0; } to { background-position: 150% 0; } }

/* ----- controles ----- */
button, .boton {
  font: inherit; font-weight: 550; border: 1px solid transparent; background: linear-gradient(135deg, var(--primario), var(--primario-2));
  color: #fff; padding: 8px 14px; border-radius: var(--radio-p); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: transform .12s, box-shadow .15s, background .15s, opacity .15s;
  box-shadow: 0 2px 8px rgba(79, 70, 229, .25);
}
button:hover, .boton:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(79, 70, 229, .3); }
button:active, .boton:active { transform: translateY(0); }
button.sec { background: var(--panel); color: var(--texto); border-color: var(--borde); box-shadow: none; }
button.sec:hover { border-color: var(--primario); color: var(--primario); box-shadow: none; }
button.peligro { background: var(--panel); color: var(--mal); border-color: color-mix(in srgb, var(--mal) 35%, var(--borde)); box-shadow: none; }
button.peligro:hover { background: var(--mal-suave); box-shadow: none; }
button.icono { background: transparent; color: var(--suave); border-color: var(--borde); padding: 7px; box-shadow: none; }
button.icono:hover { color: var(--primario); border-color: var(--primario); box-shadow: none; }
button.icono.primario { background: linear-gradient(135deg, var(--primario), var(--primario-2)); color: #fff; border-color: transparent; }
button.enlace { background: none; border: 0; color: var(--primario); padding: 0; box-shadow: none; font-weight: 550; }
button.enlace:hover { transform: none; text-decoration: underline; box-shadow: none; }
button.mini { padding: 2px 9px; font-size: 12px; border-radius: 7px; }
button:disabled { opacity: .45; cursor: not-allowed; transform: none !important; box-shadow: none; }
input, textarea, select {
  font: inherit; width: 100%; padding: 9px 11px; border: 1px solid var(--borde); border-radius: var(--radio-p);
  background: var(--panel); color: var(--texto); transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primario); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primario) 18%, transparent); }
label { display: block; margin: 10px 0; font-weight: 550; font-size: 13px; }
label > input, label > textarea, label > select { margin-top: 5px; font-weight: 400; font-size: 14px; }
label small, .nota { color: var(--suave); font-weight: 400; font-size: 12.5px; }
label.check { display: flex; gap: 10px; align-items: center; }
label.check input { width: auto; margin: 0; }
.interruptor input { position: absolute; opacity: 0; width: 0; }
.interruptor span { width: 38px; height: 22px; border-radius: 99px; background: var(--borde); position: relative; transition: background .2s; flex: none; }
.interruptor span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.interruptor input:checked + span { background: var(--ok); }
.interruptor input:checked + span::after { transform: translateX(16px); }

/* ----- avisos ----- */
#avisos { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 60; max-width: min(420px, calc(100vw - 32px)); }
.aviso {
  padding: 12px 16px 12px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--borde); box-shadow: var(--sombra-alta);
  border-left: 4px solid var(--ok); animation: entra-aviso .3s cubic-bezier(.2, .9, .3, 1.2);
}
.aviso.error { border-left-color: var(--mal); }
@keyframes entra-aviso { from { transform: translateY(12px) scale(.96); opacity: 0; } }

/* ----- acceso ----- */
.entrar { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; position: relative; overflow: hidden;
  background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--primario) 28%, transparent), transparent 60%),
              radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--primario-2) 25%, transparent), transparent 60%), var(--fondo); }
.entrar-caja { width: min(400px, 100%); position: relative; animation: aparece .5s ease; }
.logo-grande { display: flex; align-items: center; gap: 12px; font-size: 24px; justify-content: center; }
.entrar-lema { text-align: center; color: var(--suave); margin: 10px 0 22px; }
.entrar form { padding: 26px; border-radius: 18px; box-shadow: var(--sombra-alta); }
.entrar h2 { margin-bottom: 8px; }
.boton.ancho, button.ancho { width: 100%; margin-top: 12px; padding: 11px; }
.boton-ms { background: var(--panel) !important; color: var(--texto) !important; border-color: var(--borde) !important; box-shadow: none !important; }
.boton-ms .ms { width: 18px; height: 18px; }
.o { display: flex; align-items: center; gap: 10px; color: var(--suave); font-size: 12.5px; margin: 16px 0 4px; }
.o::before, .o::after { content: ''; flex: 1; height: 1px; background: var(--borde); }
.o-enlace { text-align: center; margin: 14px 0 0; font-size: 13px; }
.pie-entrar { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--suave); font-size: 12px; margin-top: 18px; }
.pie-entrar svg { width: 14px; height: 14px; }

/* ----- marca ----- */
.logo-marca { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--primario), var(--primario-2)); box-shadow: 0 4px 14px rgba(79, 70, 229, .4); flex: none; }
.logo-marca svg { width: 20px; height: 20px; stroke-width: 3; }

/* ----- estructura ----- */
.marco { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }
.lateral { background: linear-gradient(180deg, var(--lateral), var(--lateral-2)); color: var(--lateral-texto); padding: 18px 14px;
  display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.logo { display: flex; align-items: center; gap: 11px; padding: 4px 6px; }
.logo b { color: #fff; display: block; font-size: 15px; }
.logo small { color: var(--lateral-texto); opacity: .7; font-size: 12px; }
.lateral nav { display: flex; flex-direction: column; gap: 4px; }
.lateral nav button { background: transparent; color: var(--lateral-texto); box-shadow: none; justify-content: flex-start; gap: 12px; padding: 10px 12px; font-weight: 500; position: relative; }
.lateral nav button:hover { background: rgba(255, 255, 255, .06); color: #fff; transform: none; box-shadow: none; }
.lateral nav button.activo { background: rgba(129, 140, 248, .16); color: #fff; }
.lateral nav button.activo::before { content: ''; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: linear-gradient(var(--primario), var(--primario-2)); }
.contador { margin-left: auto; font-style: normal; font-size: 11.5px; font-weight: 700; min-width: 22px; padding: 1px 7px; border-radius: 99px; background: var(--primario); color: #fff; text-align: center; animation: late 2s ease-in-out infinite; }
@keyframes late { 50% { box-shadow: 0 0 0 5px rgba(129, 140, 248, .18); } }
.lateral-pie { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.estado-ia { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 8px 12px; border-radius: 10px; background: rgba(255, 255, 255, .05); }
.estado-ia .punto { width: 8px; height: 8px; border-radius: 50%; background: var(--suave); }
.estado-ia.activa .punto { background: #34d399; box-shadow: 0 0 0 0 rgba(52, 211, 153, .6); animation: pulso 2s infinite; }
.estado-ia.pausada .punto { background: #fbbf24; }
@keyframes pulso { 70% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }
.yo-caja { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, .05); }
.yo-texto { min-width: 0; flex: 1; }
.yo-texto span { color: #fff; display: block; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yo-texto small { opacity: .6; font-size: 11.5px; }
.yo-caja button.icono { border-color: rgba(255, 255, 255, .12); color: var(--lateral-texto); }
.yo-caja button.icono:hover { color: #fff; border-color: rgba(255, 255, 255, .4); }

main { padding: 26px 28px; min-width: 0; }
.vista { animation: aparece .35s ease; }
@keyframes aparece { from { opacity: 0; transform: translateY(6px); } }
.cabecera-vista { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.cabecera-vista .sub { color: var(--suave); margin: 4px 0 0; }
#fecha-hoy::first-letter { text-transform: uppercase; }

/* ----- avatares ----- */
.avatar { --h: 240; width: 36px; height: 36px; border-radius: 11px; flex: none; display: inline-grid; place-items: center; font-weight: 700; font-size: 13px;
  color: hsl(var(--h) 70% 32%); background: hsl(var(--h) 85% 92%); }
.avatar.grande { width: 48px; height: 48px; border-radius: 14px; font-size: 16px; }
@media (prefers-color-scheme: dark) { .avatar { color: hsl(var(--h) 85% 80%); background: hsl(var(--h) 40% 22%); } }
.lateral .avatar { color: #fff; background: linear-gradient(135deg, var(--primario), var(--primario-2)); }

/* ----- tarjetas ----- */
.tarjeta { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 18px 20px; box-shadow: var(--sombra); }
.tarjeta-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.tarjeta-cab h3 svg { color: var(--primario); }
.tarjetas { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 18px; }
.tarjeta.ancha { grid-column: 1 / -1; }

/* ----- inicio ----- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { --c: var(--primario); --cs: var(--primario-suave); display: flex; align-items: center; gap: 14px; text-align: left; justify-content: flex-start;
  background: var(--panel); color: var(--texto); border: 1px solid var(--borde); border-radius: var(--radio); padding: 16px; box-shadow: var(--sombra); font-weight: 400; }
button.kpi:hover { border-color: var(--c); box-shadow: var(--sombra-alta); }
.kpi > svg { width: 42px; height: 42px; padding: 10px; border-radius: 12px; color: var(--c); background: var(--cs); }
.kpi b { display: block; font-size: 24px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi span { color: var(--suave); font-size: 12.5px; }
.kpi-azul { --c: var(--info); --cs: var(--info-suave); }
.kpi-violeta { --c: var(--primario-2); --cs: var(--primario-suave); }
.kpi-rojo { --c: var(--mal); --cs: var(--mal-suave); }
.kpi-verde { --c: var(--ok); --cs: var(--ok-suave); }
.kpi-ambar { --c: var(--aviso); --cs: var(--aviso-suave); }
.kpi-gris { --c: var(--suave); --cs: var(--chip); }
.rejilla-inicio { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; }
.lista-simple { list-style: none; margin: 0; padding: 0; }
.lista-simple li { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 10px; cursor: pointer; transition: background .15s; }
.lista-simple li:hover { background: var(--panel-2); }
.ls-texto { min-width: 0; flex: 1; }
.ls-texto b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ls-texto span { color: var(--suave); font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ls-lado { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.ls-lado small { color: var(--suave); font-size: 11.5px; }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.checks li svg { width: 22px; height: 22px; padding: 4px; border-radius: 50%; }
.checks li.ok svg { color: var(--ok); background: var(--ok-suave); }
.checks li.mal svg { color: var(--mal); background: var(--mal-suave); }
#estado-servicios li.ok, #usuarios li.ok { color: var(--ok); }
#estado-servicios li.mal, #usuarios li.mal { color: var(--mal); }
#usuarios li { flex-wrap: wrap; border-bottom: 1px solid var(--borde); }
#usuarios li b { color: var(--texto); }
.nota-segura { display: flex; gap: 12px; margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--ok-suave); font-size: 13px; }
.nota-segura svg { color: var(--ok); margin-top: 2px; }

/* ----- listas laterales (bandeja, clientes) ----- */
.dos { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 20px; align-items: start; }
.lista { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra);
  position: sticky; top: 26px; max-height: calc(100vh - 52px); display: flex; flex-direction: column; overflow: hidden; }
.lista-cab { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 10px; }
.lista-cab .nota { display: block; }
.filtros { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 12px; border-bottom: 1px solid var(--borde); }
.filtros button { background: transparent; color: var(--suave); border: 1px solid var(--borde); padding: 4px 11px; font-size: 12.5px; border-radius: 99px; box-shadow: none; font-weight: 500; }
.filtros button:hover { color: var(--primario); border-color: var(--primario); box-shadow: none; transform: none; }
.filtros button.activo { background: var(--primario-suave); color: var(--primario); border-color: transparent; font-weight: 650; }
.buscador { margin: 0 16px 12px; width: auto; }
.lista ul { list-style: none; margin: 0; padding: 6px; overflow: auto; }
.item { display: flex; gap: 12px; padding: 12px; border-radius: 12px; cursor: pointer; transition: background .15s; border: 1px solid transparent; }
.item:hover { background: var(--panel-2); }
.item.sel { background: var(--primario-suave); border-color: color-mix(in srgb, var(--primario) 30%, transparent); }
.item.inactivo { opacity: .55; }
.item.trabajando .avatar { animation: latido 1.2s ease-in-out infinite; }
@keyframes latido { 50% { transform: scale(.9); opacity: .6; } }
.item-cuerpo { min-width: 0; flex: 1; }
.l1 { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.cliente { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cuando { color: var(--suave); font-size: 11.5px; white-space: nowrap; }
.l2 { margin: 1px 0 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.l3 { display: flex; align-items: center; gap: 6px; color: var(--suave); font-size: 12px; min-width: 0; }
.l3 .resumen { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nada { color: var(--suave); padding: 16px; }
.vacio-lista { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 34px 16px; text-align: center; }
.vacio-lista svg { width: 34px; height: 34px; padding: 7px; border-radius: 12px; background: var(--chip); }
.mini-barra { height: 5px; border-radius: 99px; background: var(--chip); overflow: hidden; margin: 2px 0 6px; }
.mini-barra > div { height: 100%; background: var(--ok); border-radius: 99px; }
.mini-barra > div.medio, .barra-horas > div.medio { background: var(--aviso); }
.mini-barra > div.mal, .barra-horas > div.mal { background: var(--mal); }

/* ----- chips de estado ----- */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; background: var(--chip); font-size: 11.5px; font-weight: 600; white-space: nowrap; color: var(--suave); }
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.borrador, .chip.pendiente_revision { color: var(--info); background: var(--info-suave); }
.chip.enviado, .chip.hecha { color: var(--ok); background: var(--ok-suave); }
.chip.error, .chip.fallida, .chip.sin_cliente { color: var(--mal); background: var(--mal-suave); }
.chip.procesando, .chip.pendiente, .chip.omitida, .chip.preparando { color: var(--aviso); background: var(--aviso-suave); }
.chip.procesando::before { animation: latido 1s infinite; }
.prog { color: var(--aviso); }
.ok-texto { color: var(--ok); }
.error-texto { color: var(--mal); }
.aviso-linea { background: var(--aviso-suave); color: var(--aviso); padding: 10px 12px; border-radius: 10px; margin: 8px 0; font-size: 13px; }

/* ----- detalle ----- */
.detalle { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 22px 24px; min-height: 420px; box-shadow: var(--sombra); animation: aparece .3s ease; }
.vacio-ilustracion { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 380px; color: var(--suave); gap: 6px; }
.vacio-ilustracion svg { width: 64px; height: 64px; padding: 16px; border-radius: 20px; color: var(--primario); background: var(--primario-suave); margin-bottom: 8px; }
.vacio-ilustracion p { margin: 0; color: var(--texto); font-weight: 600; font-size: 15px; }
.vacio-ilustracion small { max-width: 340px; }
.cab-fila { display: flex; gap: 14px; align-items: flex-start; }
.cab-texto { min-width: 0; }
.cabecera-correo h2 { font-size: 20px; margin-bottom: 4px; }
.meta { color: var(--suave); font-size: 13px; }
.estado-linea { margin: 12px 0; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.asignar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; padding: 12px 14px; border: 1px dashed var(--borde); border-radius: 12px; margin: 10px 0; background: var(--panel-2); }
.asignar label { margin: 0; min-width: 240px; }
.columnas { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 22px; margin-top: 14px; }
/* Con propuesta: ella ocupa dos tercios (el minmax(0, …) evita que un correo largo se coma el ancho). */
.columnas.con-propuesta { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.col { min-width: 0; }
.col-correo { overflow-wrap: anywhere; }
.col h3 { margin: 0 0 10px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--suave); }
.col-respuesta h3 svg { color: var(--primario-2); }
pre.cuerpo, pre.diagnostico { white-space: pre-wrap; word-wrap: break-word; font: 13.5px/1.55 var(--fuente); background: var(--panel-2); border: 1px solid var(--borde); border-radius: 12px; padding: 14px 16px; max-height: 62vh; overflow: auto; margin: 0; }
.vista-previa { width: 100%; height: 56vh; border: 1px solid var(--borde); border-radius: 12px; background: #fff; }
.editar, .interno { margin: 10px 0; }
.editar summary, .interno summary { cursor: pointer; color: var(--primario); font-weight: 550; padding: 6px 0; }
.editar textarea { font: 12.5px ui-monospace, Consolas, monospace; }
.titulo-capturas svg { color: var(--primario); }
.capturas { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin: 6px 0 12px; }
.captura { border: 1px solid var(--borde); border-radius: 12px; padding: 8px; background: var(--panel-2); transition: transform .15s, box-shadow .15s; }
.captura:hover { transform: translateY(-2px); box-shadow: var(--sombra); }
.captura img { width: 100%; border-radius: 8px; margin-top: 6px; display: block; }
.cap-t { font-size: 12.5px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tiempo { border: 1px solid var(--borde); background: var(--panel-2); border-radius: 12px; padding: 12px 14px; margin: 12px 0; }
.tiempo-cab { display: flex; gap: 10px; align-items: center; }
.tiempo-cab > svg { color: var(--aviso); width: 34px; height: 34px; padding: 7px; border-radius: 10px; background: var(--aviso-suave); }
.tiempo label { margin: 0; flex: 1; }
.tiempo input { max-width: 150px; display: block; }
.tiempo .nota { margin-top: 4px; }
.botones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.barra-envio { position: sticky; bottom: 0; margin: 18px -24px -22px; padding: 14px 24px; background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(10px); border-top: 1px solid var(--borde); border-radius: 0 0 var(--radio) var(--radio); }
.barra-envio .enviar { padding: 10px 18px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--suave); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 8px; border-bottom: 1px solid var(--borde); }
td { padding: 9px 8px; border-bottom: 1px solid var(--borde); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--panel-2); }
.tabla-envoltura { overflow-x: auto; }

/* ----- ficha de cliente ----- */
.ficha-cab { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
form fieldset { border: 1px solid var(--borde); border-radius: var(--radio); margin: 16px 0; padding: 12px 18px 16px; background: var(--panel); }
legend { font-weight: 650; padding: 0 8px; display: flex; align-items: center; gap: 7px; }
legend svg { color: var(--primario); }
.fila { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.fila label { flex: 1; min-width: 170px; }
.fila > button { margin: 10px 0; }
.info { margin: 8px 0; }
.prueba-img { display: block; max-width: 100%; margin-top: 10px; border: 1px solid var(--borde); border-radius: 12px; box-shadow: var(--sombra); }
.barra-acciones { padding-top: 6px; }
#contrato { background: linear-gradient(180deg, var(--primario-suave), var(--panel) 70%); border-color: color-mix(in srgb, var(--primario) 25%, var(--borde)); }
#contrato-resumen p { margin: 4px 0; }
.barra-horas { height: 10px; background: var(--chip); border-radius: 99px; overflow: hidden; margin: 10px 0; }
.barra-horas > div { height: 100%; background: var(--ok); width: 0; border-radius: 99px; transition: width .8s cubic-bezier(.2, .8, .2, 1); }
#contrato-editar { margin: 8px 0; }
#contrato-editar summary { cursor: pointer; color: var(--primario); font-weight: 550; }
#historial code { font-size: 11.5px; }

/* ----- ajustes ----- */
.pausa { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--borde); }

/* ----- pantallas estrechas ----- */
@media (max-width: 1250px) { .columnas { grid-template-columns: 1fr; } .rejilla-inicio { grid-template-columns: 1fr; } }
@media (max-width: 980px) {
  .dos { grid-template-columns: 1fr; }
  .lista { position: static; max-height: 60vh; }
}
@media (max-width: 760px) {
  .marco { grid-template-columns: 1fr; }
  .lateral { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center; padding: 10px 12px; gap: 10px; }
  .logo div, .lateral-pie .estado-ia, .yo-texto { display: none; }
  .lateral nav { flex-direction: row; flex: 1; justify-content: center; gap: 2px; }
  .lateral nav button span { display: none; }
  .lateral nav button.activo::before { display: none; }
  .lateral-pie { margin: 0; }
  .yo-caja { padding: 4px; background: none; }
  .yo-caja .avatar { display: none; }
  main { padding: 16px; }
  .detalle { padding: 16px; }
  .barra-envio { margin: 16px -16px -16px; padding: 12px 16px; }
  h1 { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- buscador de correos (Inicio y Bandeja) ---------- */
.busqueda { display: flex; gap: 8px; margin: 0 0 12px; }
.lista .busqueda { margin: 0 16px 12px; }
.caja-buscar { position: relative; flex: 1 1 60%; min-width: 0; }
.caja-buscar > svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--suave); pointer-events: none; }
.caja-buscar input { padding-left: 34px; }
.busqueda select { flex: 0 1 40%; min-width: 0; }
.busqueda.filtrando input, .busqueda.filtrando select { border-color: var(--primario); }
.sugerencias { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); list-style: none; margin: 0; padding: 5px;
  background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio-p); box-shadow: var(--sombra-alta); max-height: 320px; overflow: auto; }
.sugerencias li { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.sugerencias li:hover, .sugerencias li.marcada { background: var(--primario-suave); }
.sug-texto { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sugerencias small { color: var(--suave); font-size: 11.5px; white-space: nowrap; }
.sug-tipo { flex: none; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--chip); color: var(--suave); }
.sug-tipo.cliente { background: var(--primario-suave); color: var(--primario); }
mark { background: color-mix(in srgb, var(--aviso) 35%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.item .l2.de { color: var(--suave); font-size: 12px; }
.ls-texto small { display: block; color: var(--suave); font-size: 12px; }
@media (max-width: 640px) { .busqueda { flex-direction: column; } .busqueda select { flex-basis: auto; } }
.lista .busqueda { flex-direction: column; gap: 6px; }
.lista .busqueda select { flex-basis: auto; }
.preparador { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; margin: 8px 0; border-radius: var(--radio-p); background: var(--primario-suave); }
.preparador button { flex: none; }
.preparador .nota { margin: 0; }
@media (max-width: 640px) { .preparador { flex-direction: column; } }

/* ---- Incidencias: histórico de correos del hilo ---- */
.chip.nuevo { color: var(--primario); background: var(--primario-suave); }
.chip.en_hilo { color: var(--suave); background: var(--chip); }
.chip.nuevo-chip { color: var(--ok); background: var(--ok-suave); }
.nuevo-texto { color: var(--ok); font-weight: 600; }
ol.hilo { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-height: 70vh; overflow: auto; }
ol.hilo > li { border: 1px solid var(--borde); border-radius: 12px; background: var(--panel); }
ol.hilo > li.propio { background: var(--panel-2); }
ol.hilo > li.nuevo { border-color: var(--ok); }
ol.hilo > li > details > summary { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; list-style: none; }
ol.hilo > li > details > summary::-webkit-details-marker { display: none; }
ol.hilo .hilo-de { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ol.hilo summary small { color: var(--suave); font-size: 12px; white-space: nowrap; }
ol.hilo .hilo-meta { color: var(--suave); font-size: 12px; padding: 0 12px 8px; overflow-wrap: anywhere; }
ol.hilo pre.cuerpo { margin: 0 12px 12px; max-height: 40vh; }
ol.hilo details.citado { margin: 0 12px 12px; }
ol.hilo details.citado summary { cursor: pointer; color: var(--primario); font-size: 12.5px; margin-bottom: 8px; }
ol.hilo details.citado pre.cuerpo { margin: 0; }
.avatar.mini { width: 26px; height: 26px; font-size: 11px; flex: none; }
.col-respuesta button.analizar { margin-top: 8px; }

/* ---- Alta de cliente desde el hub: elegir la base de datos ---- */
button.chip.elegir-bd { border: 1px solid var(--borde); box-shadow: none; padding: 3px 10px; margin: 4px 2px 0 0; cursor: pointer; font: 600 12px var(--fuente); background: var(--chip); color: var(--texto); transform: none; }
button.chip.elegir-bd:hover { border-color: var(--primario); color: var(--primario); box-shadow: none; }
button.chip.elegir-bd.hecha { color: var(--ok); background: var(--ok-suave); border-color: var(--ok); }
#elegir-hub-caja select optgroup { font-weight: 700; }

/* ---- Clientes con varias bases de datos (sociedades) ---- */
.otras-bd { margin: 4px 0 10px; }
.otras-bd label.check { margin: 4px 0; font-weight: 400; align-items: flex-start; }
.otras-bd label.check input { width: auto; margin-top: 3px; }
.otras-bd .es-principal { font-weight: 600; }
.elegir-base { margin: 10px 0; }

/* ---- Ajustes: buzones que se leen ---- */
.lista-buzones { list-style: none; margin: 10px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lista-buzones li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--borde); border-radius: var(--radio-p); background: var(--panel-2); }
.lista-buzones li.mal { border-color: var(--mal); }
.lista-buzones li > div { min-width: 0; overflow-wrap: anywhere; }

/* Dentro del portal de ECINSA (ecinsa.ecinsapp.es) hay un solo menú, el del portal: el lateral de Soporte
   no se pinta (app.js pone la clase en-portal en <html> y le manda al portal su menú). */
.en-portal .marco { grid-template-columns: 1fr; }
.en-portal .lateral { display: none; }

/* ---- Ticketing: servicios, portal, mejoras ---- */
.servicios-lista { display: grid; gap: 10px; }
.servicio { border: 1px solid var(--borde); border-radius: var(--radio-p); padding: 10px 12px; background: var(--panel-2); }
.servicio.marcado { border-color: var(--primario); background: var(--primario-suave); }
.servicio-cab { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.servicio-cab label.check { margin: 0; font-weight: 600; }
.servicio .fila { margin-top: 8px; }
.servicio textarea { width: 100%; min-height: 70px; }
.chip.portal-chip { color: var(--primario); background: var(--primario-suave); }
.chip.mejora-chip { color: var(--aviso); background: var(--aviso-suave); }
.aviso-mejora { margin: 10px 0; padding: 10px 12px; border-radius: var(--radio-p); background: var(--aviso-suave); color: var(--aviso); font-weight: 600; }
.elegir-app { display: flex; gap: 8px; align-items: end; margin: 8px 0; flex-wrap: wrap; }
.hilo-imagenes { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.hilo-imagenes img { max-width: 160px; max-height: 120px; border: 1px solid var(--borde); border-radius: 6px; }
.subir-captura { margin-top: 6px; }

/* Botón «Ver» dentro de los campos de contraseña */
.ver-clave-caja { position: relative; display: block; }
.ver-clave-caja input { width: 100%; padding-right: 84px !important; box-sizing: border-box; }
button.ver-clave { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); padding: 4px 10px; font-size: 12px;
  background: var(--panel-2); color: var(--primario); border: 1px solid var(--borde); box-shadow: none; border-radius: 7px; }
button.ver-clave:hover { transform: translateY(-50%); box-shadow: none; border-color: var(--primario); }

/* ---- Servicios: filas plegables con buscador ---- */
.servicios-barra { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 10px; }
.servicios-barra input[type=search] { flex: 1 1 220px; min-width: 0; padding: 8px 12px; border: 1px solid var(--borde); border-radius: var(--radio-p); background: var(--panel); color: var(--texto); font: inherit; }
.servicios-barra label.check { margin: 0; white-space: nowrap; }
.servicios-lista { gap: 6px; }
.servicio { padding: 0; }
.servicio-cab { padding: 9px 12px; cursor: pointer; border-radius: var(--radio-p); }
.servicio-cab:hover { background: color-mix(in srgb, var(--primario) 6%, transparent); }
.servicio-cab .servicio-url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1 1 120px; }
.servicio-nombre { font-weight: 600; }
button.servicio-abrir { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; font-size: 12px;
  background: transparent; color: var(--suave); border: 1px solid var(--borde); box-shadow: none; border-radius: 7px; }
button.servicio-abrir:hover { transform: none; box-shadow: none; color: var(--primario); border-color: var(--primario); }
button.servicio-abrir svg { width: 14px; height: 14px; transition: transform .15s; }
.servicio.abierto button.servicio-abrir svg { transform: rotate(180deg); }
.servicio-cuerpo { padding: 2px 12px 12px; border-top: 1px solid var(--borde); }
.servicio.inactivo { opacity: .7; }

/* ---- Bloques plegables (fieldsets de la ficha y tarjetas de Ajustes), cerrados por defecto ---- */
.plegable > legend, .plegable > .tarjeta-cab { cursor: pointer; user-select: none; }
.plegable > legend { display: inline-flex; align-items: center; gap: 6px; }
.plegable > legend:hover, .plegable > .tarjeta-cab:hover h3 { color: var(--primario); }
.plegable > legend:focus-visible, .plegable > .tarjeta-cab:focus-visible { outline: 2px solid var(--primario); outline-offset: 2px; border-radius: 6px; }
.flecha-bloque { width: 16px; height: 16px; color: var(--suave); transition: transform .15s; flex: none; }
.plegable > .tarjeta-cab { display: flex; align-items: center; }
.plegable > .tarjeta-cab .flecha-bloque { margin-left: auto; }
.plegable.plegado .flecha-bloque { transform: rotate(-90deg); }
fieldset.plegable.plegado > :not(legend) { display: none !important; }
.tarjeta.plegable.plegado > :not(.tarjeta-cab) { display: none !important; }
fieldset.plegable.plegado { padding-bottom: 4px; }

/* ---- Ficha del cliente: bloques como tarjetas plegables ---- */
#f-cliente fieldset.plegable {
  margin: 10px 0; padding: 0; border: 1px solid var(--borde); border-radius: 12px; background: var(--panel);
  box-shadow: 0 1px 2px rgba(20, 28, 60, .04); overflow: hidden; transition: border-color .15s, box-shadow .15s;
}
#f-cliente fieldset.plegable:hover { border-color: color-mix(in srgb, var(--primario) 35%, var(--borde)); }
#f-cliente fieldset.plegable:not(.plegado) { box-shadow: var(--sombra); border-color: color-mix(in srgb, var(--primario) 30%, var(--borde)); }
/* El título dentro de la tarjeta (float saca la legend del borde del fieldset). */
#f-cliente fieldset.plegable > legend {
  float: left; width: 100%; box-sizing: border-box; margin: 0; padding: 12px 16px;
  display: flex; align-items: center; gap: 12px; font-size: 14.5px; font-weight: 650; color: var(--texto);
}
#f-cliente fieldset.plegable > legend:hover { background: var(--panel-2); color: var(--texto); }
#f-cliente fieldset.plegable:not(.plegado) > legend { border-bottom: 1px solid var(--borde); background: var(--panel-2); }
.bloque-icono { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: var(--primario-suave); color: var(--primario); }
.bloque-icono svg { width: 17px; height: 17px; }
.bloque-resumen { margin-left: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12.5px; font-weight: 500; color: var(--suave); display: inline-flex; align-items: center; gap: 6px; }
.bloque-resumen b { color: var(--texto); font-weight: 650; }
.bloque-resumen:empty { display: none; }
#f-cliente fieldset.plegable > legend .flecha-bloque { margin-left: 4px; width: 18px; height: 18px; }
#f-cliente fieldset.plegable > legend .bloque-resumen:empty + .flecha-bloque { margin-left: auto; }
.bloque-cuerpo { clear: both; padding: 14px 18px 18px; }
#f-cliente fieldset.plegable.plegado > .bloque-cuerpo { display: none; }
.bloque-barra { display: inline-block; width: 70px; height: 6px; border-radius: 99px; background: var(--chip); overflow: hidden; vertical-align: middle; }
.bloque-barra > span { display: block; height: 100%; background: var(--primario); border-radius: 99px; }
.bloque-barra > span.medio { background: var(--aviso); }
.bloque-barra > span.mal { background: var(--mal); }
@media (max-width: 640px) { .bloque-resumen { display: none; } #f-cliente fieldset.plegable > legend .flecha-bloque { margin-left: auto; } }
/* El título del bloque no se parte en dos líneas: si no cabe, se recorta el resumen. */
#f-cliente fieldset.plegable > legend { white-space: nowrap; }
#f-cliente fieldset.plegable > legend .bloque-resumen { flex: 1 1 0; justify-content: flex-end; }
#f-cliente fieldset.plegable > legend .bloque-resumen .chip { flex: none; }

/* ---- Diagnóstico interno con forma ---- */
details.interno > summary small { font-weight: 400; color: var(--suave); }
.diagnostico { font-size: 14px; line-height: 1.6; background: var(--panel); border: 1px solid var(--borde); border-left: 4px solid var(--primario);
  border-radius: 12px; padding: 16px 20px; margin: 10px 0; max-height: 70vh; overflow: auto; }
.diagnostico p { margin: 0 0 10px; }
.diagnostico ol, .diagnostico ul { margin: 0 0 12px; padding-left: 22px; }
.diagnostico li { margin: 3px 0; }
.diagnostico li::marker { color: var(--primario); font-weight: 700; }
.diagnostico code { font-size: 12.5px; background: var(--chip); padding: 1px 6px; border-radius: 5px; }
.dg-titulo { margin: 16px 0 6px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--primario); }
.dg-titulo:first-child, .dg-etiqueta + .dg-titulo { margin-top: 4px; }
.dg-etiqueta { display: inline-block; margin: 0 6px 10px 0; padding: 2px 10px; border-radius: 99px; font-size: 11.5px; font-weight: 600;
  background: var(--primario-suave); color: var(--primario); }
.dg-aviso { margin: 10px 0; padding: 10px 12px; border-radius: 10px; background: var(--aviso-suave); color: var(--texto);
  border: 1px solid color-mix(in srgb, var(--aviso) 40%, transparent); }
.dg-aviso b { color: var(--aviso); margin-right: 4px; }

/* «No imputar» junto al tiempo */
.tiempo-cab { flex-wrap: wrap; }
.no-imputar-caja { align-self: flex-end; margin: 0 0 8px 8px; white-space: nowrap; }
.tiempo.sin-imputar .minutos-input { text-decoration: line-through; opacity: .5; }

/* Comandos del diagnóstico, con botón Copiar */
.dg-codigo { position: relative; margin: 6px 0 10px; }
.dg-codigo pre { margin: 0; padding: 10px 70px 10px 12px; background: #0f1426; color: #e7e9f3; border-radius: 8px; overflow-x: auto;
  font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre; }
.dg-codigo code { background: none; padding: 0; color: inherit; font: inherit; }
button.dg-copiar { position: absolute; top: 6px; right: 6px; padding: 3px 10px; font-size: 11.5px; border-radius: 6px;
  background: #2a3150; color: #e7e9f3; border: 1px solid #3a4268; box-shadow: none; }
button.dg-copiar:hover { transform: none; box-shadow: none; background: #3a4268; }

.diagnostico li > p.dg-detalle { margin: 4px 0 6px; }
.diagnostico ol > li { margin-bottom: 10px; }

/* Web del SLD en la ficha */
.bloque-sld { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--borde); }
.bloque-sld h4 { margin: 0 0 4px; font-size: 13.5px; }
.bloque-sld h4 small { font-weight: 400; color: var(--suave); }

/* ---- Aprobaciones y auditoría ---- */
.aprobaciones { margin-bottom: 18px; border-left: 4px solid var(--mal); }
.lista-aprobaciones { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.lista-aprobaciones li { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px; border: 1px solid var(--borde); border-radius: 10px; background: var(--panel-2); }
.lista-aprobaciones .botones { display: flex; gap: 6px; margin: 0; }
.aprobaciones-incidencia { margin: 10px 0; padding: 10px 12px; border-radius: 10px; background: var(--mal-suave); border: 1px solid color-mix(in srgb, var(--mal) 30%, transparent); }
.filtros-auditoria { align-items: flex-end; flex-wrap: wrap; }
.filtros-auditoria label.check { margin-bottom: 10px; }
#auditoria tr.fila-peticion td { color: var(--suave); font-size: 12.5px; }

/* ---- Chat interno ---- */
.chat-detalle { display: flex; flex-direction: column; min-height: 70vh; }
.chat-cab .nota { margin: 4px 0 10px; }
.chat-todas { margin: 0 14px 8px; }
.chat-mensajes { list-style: none; margin: 0; padding: 6px 2px; flex: 1; overflow: auto; max-height: 62vh; display: flex; flex-direction: column; gap: 12px; }
.chat-mensajes li { max-width: 88%; padding: 10px 14px; border-radius: 14px; }
.chat-persona { align-self: flex-end; background: var(--primario-suave); border: 1px solid color-mix(in srgb, var(--primario) 25%, transparent); }
.chat-asistente { align-self: flex-start; background: var(--panel); border: 1px solid var(--borde); box-shadow: var(--sombra); }
.chat-asistente .chat-texto.diagnostico { border: 0; padding: 0; margin: 0; max-height: none; background: none; }
.chat-quien { font-size: 12px; color: var(--suave); margin-bottom: 4px; }
.chat-espera { align-self: center; font-size: 13px; color: var(--suave); font-style: italic; background: none !important; }
.chat-form { display: flex; gap: 10px; align-items: flex-end; margin-top: 12px; }
.chat-form textarea { flex: 1; resize: vertical; }

/* ---- Contraseñas del cliente ---- */
.cr-grupo { margin: 12px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--primario); }
.cr-lista { border: 1px solid var(--borde); border-radius: 10px; overflow: hidden; }
.cr-fila { padding: 9px 12px; font-size: 13.5px; }
.cr-fila + .cr-fila { border-top: 1px solid var(--borde); }
.cr-fila:hover { background: var(--primario-suave); }
.cr-cab { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cr-nombre { flex: 1 1 180px; }
.cr-datos { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 4px; }
.cr-dato { display: inline-flex; align-items: baseline; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.cr-dato > small { color: var(--suave); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.cr-clave { white-space: nowrap; }
.cr-notas { margin-top: 3px; color: var(--suave); font-size: 12.5px; }
.cr-oculta { letter-spacing: .15em; color: var(--suave); }
.cr-acciones { display: inline-flex; gap: 4px; flex-wrap: wrap; }
#nueva-credencial { margin-top: 10px; }
#nueva-credencial summary { cursor: pointer; color: var(--primario); font-weight: 600; }

/* ---- Puente con monitor (escritorio remoto y alta) ---- */
.mon-fila { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.mon-fila > div, .mon-fila > p { flex: 1 1 260px; margin: 0; }
.mon-mas { margin-top: 10px; }
.mon-mas summary { cursor: pointer; color: var(--suave); font-size: 13px; }

/* ---- Alta en el hub desde la ficha ---- */
.alta-hub, .alta-codigo, .alta-medias { border: 1px solid var(--borde); border-radius: 10px; padding: 12px 14px; margin: 8px 0 12px; background: var(--panel); }
.alta-medias { background: var(--aviso-suave); border-color: transparent; }
.alta-paso { margin: 4px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--primario); font-weight: 700; }
.ah-apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 14px; margin-bottom: 8px; }
.ah-apps label.check { display: flex; gap: 6px; align-items: baseline; font-weight: 500; }
.ac-fila { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.ac-fila > span:first-child { min-width: 150px; color: var(--suave); font-size: 13px; }
.ac-fila a { overflow-wrap: anywhere; }
.ac-codigo { font-size: 20px; letter-spacing: .08em; padding: 4px 10px; background: var(--primario-suave); color: var(--primario); border-radius: 8px; }
.ac-espera { margin: 10px 0 6px; font-size: 13.5px; }
.punto-espera { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--aviso); margin-right: 6px; animation: latido 1.2s ease-in-out infinite; }
@keyframes latido { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .punto-espera { animation: none; } }

/* ---- «+ Nuevo cliente»: ya en el hub / alta nueva en el hub ---- */
.origen-cliente { margin: 0 0 14px; }
.origen-botones { padding: 0 0 10px; border-bottom: none; }
.origen-botones button { font-size: 13.5px; padding: 6px 14px; }
#f-cliente.modo-alta > :not(.ficha-cab):not(.origen-cliente) { display: none !important; }

/* Entrada: logo de ECINSA (solo Microsoft; usuario y contraseña solo en emergencia) */
.logo-grande.logo-ecinsa { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.logo-grande.logo-ecinsa img { height: 44px; width: auto; max-width: 100%; }
.logo-grande.logo-ecinsa span { font-size: 13px; font-weight: 600; letter-spacing: .32em; text-transform: uppercase; color: var(--suave); }
#entrar-clave { display: flex; flex-direction: column; gap: inherit; }
#entrar-clave[hidden] { display: none; }
@media (prefers-color-scheme: dark) { .logo-grande.logo-ecinsa img { background: #fff; padding: 8px 14px; border-radius: 10px; } }

/* Tickets del portal en la web interna: urgencia, resuelto por el cliente, seguimiento de mejoras, archivos */
.chip.urgente-chip { color: #fff; background: var(--mal); }
.datos-ticket { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.seguimiento-mejora { flex-basis: 100%; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--aviso) 35%, var(--borde)); background: var(--aviso-suave); border-radius: var(--radio-p); }
.seguimiento-mejora .fila { margin-top: 8px; }
.hilo-imagenes video { max-width: 320px; max-height: 220px; border-radius: 6px; background: #000; }
.hilo-docs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.hilo-docs a.chip { text-decoration: none; color: var(--primario); }
.aviso-portal-cliente { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--borde); }

/* Revisar en 2 minutos, tareas de ECINSA, turno, aprobar desde el aviso y «Cómo vamos» */
.para-revisar { display: grid; gap: 0; padding: 4px 16px; margin: 8px 0 14px; border: 1px solid var(--borde); border-radius: var(--radio-p); background: var(--panel-2); font-size: 14.5px; line-height: 1.55; }
.para-revisar > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 14px; align-items: baseline; padding: 10px 0; }
.para-revisar > div + div { border-top: 1px solid var(--borde); }
.para-revisar span { overflow-wrap: anywhere; }
/* Estrecho: la etiqueta encima del texto, que así se lee en líneas largas. */
@media (max-width: 1500px) { .para-revisar > div { grid-template-columns: 1fr; gap: 2px; } }
.para-revisar b { color: var(--suave); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.para-revisar .pr-tarea span { color: var(--aviso); font-weight: 600; }
.para-revisar .pr-acciones { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; grid-template-columns: none; }
.para-revisar .pr-acciones label { margin: 0; }
.chip.tarea-chip { color: var(--aviso); background: var(--aviso-suave); }
.turno-hoy { margin: -6px 0 14px; }
.turno-semana label { min-width: 150px; }
.aprobar-enlace { border: 2px solid var(--primario); margin-bottom: 16px; }
.metricas { margin-bottom: 18px; }
.metricas .tarjeta-cab select { width: auto; padding: 4px 8px; }
.metricas-fila { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.metrica { padding: 12px; border: 1px solid var(--borde); border-radius: var(--radio-p); background: var(--panel-2); display: grid; gap: 2px; }
.metrica b { font-size: 22px; letter-spacing: -.02em; }
.metrica span { color: var(--suave); font-size: 12px; }
.metrica.apagada { opacity: .55; }
.metrica.aviso b { color: var(--aviso); }
.metricas-detalle { margin-top: 12px; }
.metricas-detalle summary { cursor: pointer; color: var(--primario); font-weight: 600; }
.metricas-tablas { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-top: 8px; }
.metricas-tablas table { width: 100%; border-collapse: collapse; font-size: 13px; }
.metricas-tablas th, .metricas-tablas td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--borde); }
.metricas-tablas th { color: var(--suave); font-weight: 600; }

/* Cabecera de la ficha: botones SLD y escritorio remoto a la derecha del nombre */
.ficha-acciones { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.ficha-acciones[hidden] { display: none; }
@media (max-width: 640px) { .ficha-cab { flex-wrap: wrap; } .ficha-acciones { margin-left: 0; width: 100%; justify-content: flex-start; } }

/* Cabecera de la ficha: motor y versión de SAP a la derecha del nombre */
.ficha-titulo { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ficha-sap { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.ficha-sap:empty { display: none; }
.chip.motor-hana { color: #0b6bcb; background: color-mix(in srgb, #0b6bcb 14%, transparent); }
.chip.motor-sql { color: #b4461b; background: color-mix(in srgb, #b4461b 14%, transparent); }

/* ---- «Para revisar»: texto al cliente plegable ---- */
.pr-largo { white-space: pre-line; }
.pr-ver-todo { display: inline; margin-left: 6px; padding: 0; background: none; border: none; box-shadow: none; color: var(--primario); font-weight: 600; font-size: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.pr-ver-todo:hover { background: none; box-shadow: none; transform: none; color: var(--primario-2); }

/* ---- Ejecutar una mejora ---- */
.ejecutar-mejora { margin-top: 14px; padding-top: 12px; border-top: 1px dashed color-mix(in srgb, var(--aviso) 40%, transparent); }
.em-resultado { background: var(--panel); border: 1px solid var(--borde); border-radius: 10px; padding: 10px 14px; margin: 8px 0; }
.em-ficheros { font-size: 12px; overflow-x: auto; background: var(--panel); padding: 8px 10px; border-radius: 8px; }
a.boton { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 9px; border: 1px solid var(--borde); text-decoration: none; font-weight: 600; font-size: 13.5px; color: var(--texto, inherit); }
a.boton:hover { border-color: var(--primario); color: var(--primario); }

/* ---- La sesión de soporte parada con una pregunta ---- */
.sesion-parada { margin: 8px 0; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--mal) 18%, transparent); color: #fff; font-size: 12.5px; display: grid; gap: 6px; }
.sesion-parada b { color: #ffd2d2; }
.sesion-parada span { opacity: .9; overflow-wrap: anywhere; }
.sesion-parada button { justify-self: start; }

.sesion-opciones { display: grid; gap: 6px; }
.sesion-opciones button { text-align: left; white-space: normal; line-height: 1.3; padding: 6px 9px; }
.sesion-opciones small { opacity: .8; }

.em-pasos { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 8px 0 10px; }
.em-pasos li { font-size: 12px; padding: 3px 10px; border-radius: 99px; background: var(--panel); border: 1px solid var(--borde); color: var(--suave); }
.em-pasos li.hecho { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.em-pasos li.actual { color: var(--primario); border-color: var(--primario); font-weight: 650; }

/* ---- Mensaje para el cliente de una mejora hecha ---- */
.em-mensaje { margin: 10px 0; padding: 12px 14px; border-radius: 10px; background: var(--panel); border: 1px solid color-mix(in srgb, var(--ok) 45%, var(--borde)); }
.em-mensaje-texto { white-space: pre-line; margin: 8px 0; line-height: 1.5; }
.aviso-mejora.mejora-hecha { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
button.enviar.resalta { box-shadow: 0 0 0 4px color-mix(in srgb, var(--primario) 35%, transparent); }

/* ---- Asistente de la mejora (6 pasos) ---- */
.em-cab { margin-bottom: 8px; }
.em-paso { margin: 2px 0 8px; font-size: 14.5px; }

.em-cuando { align-items: center; gap: 14px; }
.em-cuando .em-fecha { max-width: 230px; }
.em-programada { padding: 8px 12px; border-radius: 9px; background: var(--primario-suave); color: var(--primario); }

/* =====================================================================
   Pantalla de una MEJORA (web/vista-mejora.js): cabecera, pasos, «ahora»
   y documentos.
   ===================================================================== */
.vm { display: grid; gap: 18px; max-width: 1100px; }
.vm-cab { display: grid; gap: 6px; }
.vm-cab-fila { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vm-cab-fila h2 { margin: 0; font-size: 21px; flex: 1 1 300px; }
.vm-meta { color: var(--suave); font-size: 13.5px; line-height: 1.7; }
.vm-meta b { color: var(--texto); }
.vm-clasica { font-size: 13px; }

/* Los 6 pasos */
.vm-pasos { list-style: none; margin: 0; padding: 14px 10px; display: grid; grid-template-columns: repeat(6, 1fr);
  background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra); }
.vm-p { position: relative; display: grid; justify-items: center; gap: 4px; text-align: center; padding: 0 4px; }
.vm-p + .vm-p::before { content: ''; position: absolute; top: 17px; right: calc(50% + 22px); width: calc(100% - 44px); height: 2px; background: var(--borde); }
.vm-p.hecho + .vm-p::before { background: var(--ok); }
.vm-circ { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: var(--chip); color: var(--suave); }
.vm-p.hecho .vm-circ { background: var(--ok); color: #fff; }
.vm-p.ahora .vm-circ { background: var(--primario); color: #fff; box-shadow: 0 0 0 5px var(--primario-suave); }
.vm-p.ahora.sesion .vm-circ { background: var(--info); box-shadow: 0 0 0 5px var(--info-suave); }
.vm-p-tit { font-weight: 650; font-size: 13.5px; }
.vm-p.luego .vm-p-tit { color: var(--suave); font-weight: 550; }
.vm-p-sub { font-size: 11.5px; color: var(--suave); }
.vm-p.ahora .vm-p-sub { color: var(--primario); font-weight: 600; }
.vm-p.ahora.sesion .vm-p-sub { color: var(--info); }

/* La tarjeta de lo que toca ahora */
.vm-ahora { background: var(--panel); border: 1px solid var(--borde); border-left: 5px solid var(--primario); border-radius: var(--radio); box-shadow: var(--sombra); overflow: hidden; }
.vm-ahora.sesion { border-left-color: var(--info); }
.vm-ahora.fin { border-left-color: var(--ok); }
.vm-ahora-cab { padding: 16px 20px 4px; }
.vm-quien { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--primario); }
.vm-ahora.sesion .vm-quien { color: var(--info); }
.vm-ahora.fin .vm-quien { color: var(--ok); }
.vm-ahora-cab h3 { margin: 4px 0 4px; font-size: 19px; }
.vm-ahora-cab p { margin: 0; color: var(--suave); }
.vm-ahora-cuerpo { padding: 12px 20px 16px; display: grid; gap: 10px; }
.vm-ahora-pie { display: flex; justify-content: flex-end; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 20px; background: var(--fondo); border-top: 1px solid var(--borde); }
.vm-principal { font-size: 15px; padding: 10px 20px; }
.vm-doc { max-height: 420px; overflow: auto; border: 1px solid var(--borde); border-radius: var(--radio-p); padding: 4px 16px; background: var(--fondo); }
.vm-doc-corto { max-height: 260px; }
.vm-cuando { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.vm-cuando .vm-fecha { max-width: 230px; }
.vm-otro summary { cursor: pointer; color: var(--suave); font-size: 13.5px; }
.vm-mensaje { font: inherit; line-height: 1.55; }

/* Documentos */
.vm-docs { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra); }
.vm-pestanas { display: flex; gap: 2px; flex-wrap: wrap; padding: 6px 10px 0; border-bottom: 1px solid var(--borde); }
.vm-pestanas button { background: none; border: 0; border-bottom: 3px solid transparent; border-radius: 0; box-shadow: none; color: var(--suave);
  font-weight: 600; font-size: 13.5px; padding: 10px 12px; }
.vm-pestanas button:hover { color: var(--texto); transform: none; box-shadow: none; }
.vm-pestanas button.activa { color: var(--primario); border-bottom-color: var(--primario); }
.vm-pestana { padding: 14px 20px 18px; }
.vm-pestana .hilo { margin: 0; }
.vm-md { font-size: 14px; }

@media (max-width: 760px) {
  .vm-pasos { grid-template-columns: repeat(3, 1fr); row-gap: 14px; }
  .vm-p:nth-child(4)::before { display: none; }
}
.vm-mensaje, .vm-ahora textarea, .vm-ahora input, .vm-ahora select { font-weight: 400; }
.vm-condicion { min-width: 220px; }
.vm-ahora-pie a.boton, .vm-ahora-pie .sec { background: var(--panel); color: var(--texto); border: 1px solid var(--borde); box-shadow: none; }
.vm-ahora-pie > :first-child:not(.vm-principal) { margin-right: auto; }

/* ---- Quién lleva cada incidencia ---- */
.asignado-chip { background: var(--primario-suave); color: var(--primario); }
.sin-asignar-chip { background: var(--aviso-suave); color: var(--aviso); }
.asignada-linea { white-space: nowrap; }
.asignado-sel { display: inline-block; width: auto; padding: 2px 8px; font-size: 13px; margin-left: 4px; }
.pasos-teams li { margin: 6px 0; line-height: 1.5; }

/* =====================================================================
   Bandeja de incidencias: que se vea todo de un vistazo (sin cortar ni
   barra horizontal).
   ===================================================================== */
.dos { grid-template-columns: minmax(340px, 440px) 1fr; }
.filtros-bandeja { align-items: center; padding-bottom: 10px; }
.filtro-mas { width: auto; padding: 4px 26px 4px 11px; font-size: 12.5px; border-radius: 99px; color: var(--suave); background-position: right 8px center; min-height: 0; height: auto; }
.filtro-mas.activo { background-color: var(--primario-suave); color: var(--primario); border-color: transparent; font-weight: 650; }
#bandeja { overflow-x: hidden; }
#bandeja .item { padding: 11px 12px; }
#bandeja .item + .item { margin-top: 2px; }
#bandeja .l1 .cliente { font-size: 14px; }
#bandeja .num-ticket { color: var(--texto); font-weight: 650; }
#bandeja .l2.asunto { margin: 2px 0 6px; font-size: 13.5px; color: var(--texto); }
#bandeja .l3.etiquetas { flex-wrap: wrap; row-gap: 5px; gap: 5px; }
#bandeja .l3.etiquetas .chip { white-space: nowrap; font-size: 11.5px; }
#bandeja .l4 { margin-top: 6px; color: var(--suave); font-size: 12px; line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
#bandeja .l2.de { margin: 0 0 5px; }
#filtros-bandeja .filtro-mas { width: auto; flex: 0 0 auto; max-width: 150px; display: inline-block; }

/* =====================================================================
   Consultas (antes «Chat»): tipo, cliente y aplicación; tablas y archivos.
   ===================================================================== */
.chat-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 4px; }
.chat-chips:empty { display: none; }
.enlace-chip { text-decoration: none; background: var(--primario-suave); color: var(--primario); font-weight: 650; }
.consulta-nueva { padding: 4px 0 14px; display: grid; gap: 14px; }
.cn-tipos { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.cn-tipos button { display: grid; gap: 4px; text-align: left; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--borde);
  background: var(--panel); color: var(--texto); box-shadow: none; cursor: pointer; font-weight: 400; min-height: 0; height: auto; }
.cn-tipos button b { font-size: 14px; }
.cn-tipos button span { font-size: 12.5px; color: var(--suave); line-height: 1.35; }
.cn-tipos button:hover { border-color: var(--primario); }
.cn-tipos button.sel { border-color: var(--primario); background: var(--primario-suave); }
.cn-tipos button.sel b { color: var(--primario); }
.cn-contexto label { flex: 1; min-width: 200px; }
.cn-ayuda { margin: 0; font-size: 13px; color: var(--suave); line-height: 1.5; padding: 10px 12px; border-radius: 10px; background: var(--fondo-2, rgba(0,0,0,.03)); }
.chip.cn-tipo.datos { background: #e8f0fe; color: #1a56c4; }
.chip.cn-tipo.listado { background: #e7f6ee; color: #1e7a4a; }
.chip.cn-tipo.mejora { background: #fdf0dc; color: #9a5b00; }
.chip.interna-chip { background: #efe9fb; color: #5b3fa8; }
.dg-tabla { overflow-x: auto; margin: 8px 0 12px; border: 1px solid var(--borde); border-radius: 10px; }
.dg-tabla table { border-collapse: collapse; width: 100%; font-size: 13px; }
.dg-tabla th, .dg-tabla td { padding: 6px 10px; border-bottom: 1px solid var(--borde); text-align: left; white-space: nowrap; }
.dg-tabla th { background: var(--fondo-2, rgba(0,0,0,.03)); font-weight: 650; position: sticky; top: 0; }
.dg-tabla tr:last-child td { border-bottom: 0; }
.chat-archivos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.chat-archivo { display: inline-flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; border: 1px solid var(--borde); border-radius: 10px;
  text-decoration: none; color: var(--texto); background: var(--panel); }
.chat-archivo:hover { border-color: var(--primario); }
.chat-archivo .icono-archivo { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; background: #1e7a4a; color: #fff; font-size: 10.5px; font-weight: 700; }
.chat-archivo span:last-child { display: grid; }
.chat-archivo small { color: var(--suave); }
#chat-lista .l3.etiquetas { display: flex; flex-wrap: wrap; gap: 5px; row-gap: 5px; }
#chat-lista .l3.etiquetas .chip { white-space: nowrap; }

/* Consultas: formatos del listado */
.cn-formatos { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; }
.cn-formatos > span { font-weight: 650; font-size: 13px; margin-right: 4px; }
.cn-formatos .check { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1.5px solid var(--borde); border-radius: 99px; cursor: pointer; font-size: 13px; margin: 0; }
.cn-formatos .check:has(input:checked) { border-color: var(--primario); background: var(--primario-suave); color: var(--primario); font-weight: 650; }
.cn-otro-formato { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; font-size: 13px; color: var(--suave); }

.chat-archivo .icono-archivo.ext-pdf { background: #c0392b; }
.chat-archivo .icono-archivo.ext-docx { background: #2b5797; }
.chat-archivo .icono-archivo.ext-csv, .chat-archivo .icono-archivo.ext-txt, .chat-archivo .icono-archivo.ext-json { background: #6b7280; }

/* =====================================================================
   Permisos: lo que no puede usar no se ve (el servidor lo impide igualmente)
   ===================================================================== */
body.sin-credenciales-ver .cr-ver, body.sin-credenciales-ver .cr-copiar { display: none !important; }
body.sin-credenciales-editar .cr-editar, body.sin-credenciales-editar .cr-borrar, body.sin-credenciales-editar .cr-nueva { display: none !important; }
body.sin-incidencias-trabajar .subir-captura { display: none !important; }
.usuario-fila { display: block; }
.usuario-linea { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rol-sel { width: auto; padding: 3px 26px 3px 10px; font-size: 12.5px; border-radius: 99px; min-height: 0; height: auto; }
.permisos-panel { margin: 10px 0 6px 22px; padding: 14px 16px; border: 1px solid var(--borde); border-radius: 12px; background: var(--fondo-2, rgba(0,0,0,.02)); display: grid; gap: 10px; }
.permisos-panel fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 4px; }
.permisos-panel legend { font-weight: 650; font-size: 13px; margin-bottom: 4px; color: var(--texto); }
.permisos-panel .check { font-size: 13px; display: flex; gap: 8px; align-items: flex-start; margin: 0; }
.permisos-panel .check input { margin-top: 2px; }
.permisos-panel, .permisos-panel .check { color: var(--texto); font-weight: 400; }
.permisos-panel .check:has(input:checked) { font-weight: 600; }

/* Historial de contraseñas */
.cr-historial { margin-top: 12px; }
.cr-historial summary { cursor: pointer; font-weight: 650; font-size: 13px; }
.cr-historial-lista { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; font-size: 13px; }
.cr-historial-lista li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* El coste de análisis solo lo ve una persona (el servidor tampoco se lo manda a los demás). */
body:not(.ve-costes) .solo-costes, body:not(.ve-costes) .gasto-incidencia, body:not(.ve-costes) .coste { display: none !important; }

/* =====================================================================
   Indicadores de Inicio: se pulsan y enseñan su detalle
   ===================================================================== */
button.metrica { font: inherit; color: inherit; text-align: left; cursor: pointer; box-shadow: none; min-height: 0; height: auto; transition: border-color .15s, transform .15s, box-shadow .15s; }
button.metrica:hover { border-color: var(--primario); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,.06); }
.metricas-tablas tr.pulsable { cursor: pointer; }
.metricas-tablas tr.pulsable:hover td { background: var(--primario-suave); }
.dialogo-detalle { border: 0; border-radius: 16px; padding: 0; width: min(1100px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 24px 60px rgba(15,23,42,.25); color: var(--texto); background: var(--panel); }
.dialogo-detalle::backdrop { background: rgba(15,23,42,.45); backdrop-filter: blur(2px); }
.dd-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 20px 22px 12px; border-bottom: 1px solid var(--borde); position: sticky; top: 0; background: var(--panel); }
.dd-cab h2 { margin: 0 0 4px; font-size: 18px; }
.dd-cab .nota { margin: 0; }
.dd-botones { display: flex; gap: 8px; align-items: center; flex: none; }
.dd-tabla { padding: 8px 22px 22px; overflow: auto; max-height: calc(100vh - 170px); }
.dd-tabla table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dd-tabla th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--suave); padding: 8px 10px; border-bottom: 1px solid var(--borde); position: sticky; top: 0; background: var(--panel); }
.dd-tabla td { padding: 8px 10px; border-bottom: 1px solid var(--borde); vertical-align: top; }
.dd-tabla td.t-horas, .dd-tabla td.t-minutos, .dd-tabla td.t-euros, .dd-tabla td.t-numero, .dd-tabla th.t-horas, .dd-tabla th.t-minutos, .dd-tabla th.t-euros, .dd-tabla th.t-numero { text-align: right; white-space: nowrap; }
.dd-tabla td.t-fecha, .dd-tabla td.t-ticket { white-space: nowrap; }
.dd-tabla td.t-ticket { font-weight: 650; color: var(--primario); }
.dd-tabla tr[data-enlace] { cursor: pointer; }
.dd-tabla tr[data-enlace]:hover td, .dd-tabla tr[data-enlace]:focus td { background: var(--primario-suave); }

/* =====================================================================
   Modo tarjeta: Ajustes y ficha del cliente como cuadrícula de tarjetas.
   Cerradas: icono, título y una línea de qué hay dentro. Abierta: a todo
   lo ancho (las demás se cierran).
   ===================================================================== */
/* ---- Ajustes ---- */
#v-ajustes .tarjetas { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
#v-ajustes .tarjeta.plegable, #v-ajustes .tarjeta.plegable.ancha { grid-column: auto; }
#v-ajustes .tarjeta.plegable:not(.plegado) { grid-column: 1 / -1; }
#v-ajustes .tarjeta.plegable.plegado { padding: 0; transition: border-color .15s, transform .15s, box-shadow .15s; }
#v-ajustes .tarjeta.plegable.plegado:hover { border-color: color-mix(in srgb, var(--primario) 45%, var(--borde)); transform: translateY(-2px); box-shadow: 0 10px 24px rgba(20, 28, 60, .08); }
#v-ajustes .tarjeta.plegado > .tarjeta-cab { position: relative; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 8px;
  margin: 0; padding: 18px 40px 18px 18px; min-height: 132px; height: 100%; box-sizing: border-box; }
#v-ajustes .tarjeta.plegado > .tarjeta-cab h3 { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin: 0; font-size: 15px; line-height: 1.3; }
#v-ajustes .tarjeta.plegado > .tarjeta-cab h3 .nota { display: none; }
#v-ajustes .tarjeta > .tarjeta-cab h3 > svg { width: 38px; height: 38px; padding: 9px; box-sizing: border-box; border-radius: 11px; background: var(--primario-suave); flex: none; }
#v-ajustes .tarjeta:not(.plegado) > .tarjeta-cab h3 > svg { width: 30px; height: 30px; padding: 6px; border-radius: 9px; }
#v-ajustes .tarjeta.plegado > .tarjeta-cab .flecha-bloque { position: absolute; top: 20px; right: 16px; margin: 0; }
#v-ajustes .tarjeta.plegado > .tarjeta-cab > :not(h3):not(.tarjeta-desc):not(.flecha-bloque) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.tarjeta-desc { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--suave); font-weight: 400; }
#v-ajustes .tarjeta:not(.plegado) .tarjeta-desc { flex-basis: 100%; order: 5; margin-top: -4px; }
#v-ajustes .tarjeta:not(.plegado) > .tarjeta-cab { flex-wrap: wrap; }

/* ---- Ficha del cliente ---- */
.rejilla-bloques { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 12px; margin: 12px 0 14px; }
#f-cliente .rejilla-bloques > fieldset.plegable { margin: 0; }
#f-cliente .rejilla-bloques > fieldset.plegable:not(.plegado) { grid-column: 1 / -1; }
#f-cliente .rejilla-bloques > fieldset.plegable.plegado { transition: border-color .15s, transform .15s, box-shadow .15s; }
#f-cliente .rejilla-bloques > fieldset.plegable.plegado:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(20, 28, 60, .08); }
#f-cliente .rejilla-bloques > fieldset.plegable.plegado > legend { flex-wrap: wrap; white-space: normal; align-items: center; align-content: flex-start;
  gap: 10px 12px; padding: 16px; min-height: 124px; }
#f-cliente .rejilla-bloques > fieldset.plegable.plegado > legend:hover { background: transparent; }
#f-cliente .rejilla-bloques > fieldset.plegable.plegado > legend .bloque-icono { width: 38px; height: 38px; border-radius: 11px; }
#f-cliente .rejilla-bloques > fieldset.plegable.plegado > legend .bloque-icono svg { width: 19px; height: 19px; }
#f-cliente .rejilla-bloques > fieldset.plegable.plegado > legend .bloque-titulo { flex: 1 1 0; min-width: 0; font-size: 14.5px; line-height: 1.3; }
#f-cliente .rejilla-bloques > fieldset.plegable.plegado > legend .flecha-bloque { order: 2; margin-left: auto; }
#f-cliente .rejilla-bloques > fieldset.plegable.plegado > legend .bloque-resumen { order: 3; flex: 1 1 100%; margin: 0; justify-content: flex-start;
  white-space: normal; display: flex; flex-wrap: wrap; gap: 6px; font-size: 12.5px; }
#f-cliente .rejilla-bloques > fieldset.plegable.plegado > legend .bloque-resumen:empty { display: none; }
@media (max-width: 640px) {
  #f-cliente .rejilla-bloques > fieldset.plegable.plegado > legend .bloque-resumen { display: flex; }
  .rejilla-bloques, #v-ajustes .tarjetas { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 420px) { .rejilla-bloques, #v-ajustes .tarjetas { grid-template-columns: 1fr; } }
/* Sin huecos al abrir una tarjeta del medio: las demás rellenan el sitio. */
.rejilla-bloques, #v-ajustes .tarjetas { grid-auto-flow: row dense; }

/* Las rutas de carpetas del servidor solo las ve una persona (el servidor tampoco se las manda a los demás). */
body:not(.ve-rutas) .solo-rutas { display: none !important; }

/* Registro de actividad: qué ha hecho, destacado; el detalle, más suave. */
#auditoria .aud-cuando { white-space: nowrap; }
#auditoria .aud-que { font-weight: 600; min-width: 220px; }
#auditoria .aud-detalle { color: var(--suave); font-size: 13px; overflow-wrap: anywhere; }
#auditoria .aud-origen { white-space: nowrap; }
.aud-resumen { margin: 4px 0 14px; border: 1px solid var(--borde); border-radius: var(--radio-p); background: var(--panel-2); padding: 8px 14px; }
.aud-resumen summary { cursor: pointer; color: var(--primario); font-weight: 600; padding: 4px 0; }
.aud-resumen-tablas { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 10px 0 6px; }
.aud-mini { width: 100%; font-size: 13.5px; }
.aud-mini th:last-child, .aud-mini td:last-child { text-align: right; width: 80px; }
.aud-mini tbody tr[data-filtro] { cursor: pointer; }
.aud-mini tbody tr[data-filtro]:hover td { background: var(--panel); }

/* Ficha · cómo hacer que el hub lea las bases de datos (CompanyDB) */
.bd-ayuda:empty { display: none; }
.bd-ayuda { margin: -4px 0 12px; }
.bd-ayuda .bd-pasos { margin: 8px 0; padding-left: 20px; font-size: 13.5px; line-height: 1.55; }
.bd-ayuda .bd-pasos li { margin-bottom: 6px; }
.bd-ayuda pre { margin: 6px 0; padding: 8px 12px; background: var(--panel-2); border: 1px solid var(--borde); border-radius: 8px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }

.interes { margin-bottom: 18px; border-left: 4px solid var(--ambar, #e4a924); }

/* Texto con formato de los tickets del portal (web/formato-texto.js) */
.cuerpo-ft { font: 13.5px/1.55 var(--fuente); background: var(--panel-2); border: 1px solid var(--borde); border-radius: 12px; padding: 14px 16px; max-height: 62vh; overflow: auto; overflow-wrap: anywhere; }
ol.hilo .cuerpo-ft { margin: 0 12px 12px; max-height: 40vh; }
.ft p { margin: 0 0 .6em; }
.ft p:last-child, .ft ul:last-child, .ft ol:last-child { margin-bottom: 0; }
.ft ul, .ft ol { margin: 0 0 .6em; padding-left: 1.4em; }
.ft .ft-grande { font-size: 1.25em; font-weight: 700; margin: .3em 0 .4em; }
.ft .ft-peque { font-size: .85em; color: var(--suave); margin: 0 0 .4em; }
.ft .ft-img { font-size: .9em; color: var(--suave); font-style: italic; }
