/* =====================================================================
   SPES Portal - sistema de diseno
   Misma marca que el CRM (azul #45689F / celeste #5B9BD5). Estructura de
   tablero financiero: KPIs arriba, tablas densas y legibles, estados con color.
   ===================================================================== */

:root {
  --azul: #45689F;
  --azul-osc: #34507D;
  --azul-claro: #5B9BD5;
  --celeste-sut: #EAF2FB;

  --texto: #1F2430;
  --texto-sec: #5F6475;
  --texto-ter: #959AAB;
  --borde: #D5DAE5;
  --borde-sut: #E7EAF0;
  --fondo: #F4F6FA;
  --superficie: #FFFFFF;
  --hover: #F6F8FB;

  --verde: #00A35C;   --verde-sut: #E3F6EC;
  --naranja: #E07B00; --naranja-sut: #FFF2E0;
  --rojo: #D83A52;    --rojo-sut: #FCE9EC;
  --morado: #8E4EC6;  --morado-sut: #F3EAFB;
  --info: #0073EA;    --info-sut: #E5F1FD;
  --gris-sut: #EEF0F4;

  --radio-sm: 5px; --radio: 8px; --radio-lg: 12px;
  --sombra-sm: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.06);
  --sombra: 0 6px 20px rgba(16,24,40,.08);
  --sombra-lg: 0 18px 50px rgba(16,24,40,.18);

  --topbar-h: 58px;
  --sidebar-w: 240px;
  --fuente: "Figtree", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--fuente); font-size: 14px; line-height: 1.45; color: var(--texto);
  background: var(--fondo); -webkit-font-smoothing: antialiased;
}
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
p { margin: 0 0 10px; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.sec { color: var(--texto-sec); } .ter { color: var(--texto-ter); }
.pequeno { font-size: 12px; }
.nowrap { white-space: nowrap; }
.oculto { display: none !important; }
.rojo { color: var(--rojo); } .verde { color: var(--verde); } .naranja { color: var(--naranja); }
.fuerte { font-weight: 700; }

/* ---------- Shell ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar-h); z-index: 30;
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
  background: var(--superficie); border-bottom: 1px solid var(--borde-sut);
}
.topbar .marca { display: flex; align-items: center; gap: 10px; width: calc(var(--sidebar-w) - 20px); }
.topbar .marca img { height: 30px; }
.topbar .marca span { font-weight: 700; color: var(--azul-osc); font-size: 15px; }
.topbar .marca small { display: block; font-weight: 500; color: var(--texto-ter); font-size: 11px; margin-top: -2px; }
.topbar .espacio { flex: 1; }
.topbar .busqueda { position: relative; width: 340px; }
.topbar .busqueda input { width: 100%; padding: 8px 12px 8px 34px; border: 1px solid var(--borde); border-radius: 20px; background: var(--fondo); font: inherit; }
.topbar .busqueda input:focus { outline: none; border-color: var(--azul-claro); background: #fff; }
.topbar .busqueda svg { position: absolute; left: 11px; top: 9px; color: var(--texto-ter); }
.estado-sync { font-size: 12px; color: var(--texto-sec); display: flex; align-items: center; gap: 6px; }
.punto { width: 8px; height: 8px; border-radius: 50%; background: var(--verde); display: inline-block; }
.punto.mal { background: var(--rojo); } .punto.viejo { background: var(--naranja); }
.usuario { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--azul); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.usuario .nombre { font-weight: 600; font-size: 13px; line-height: 1.2; }
.usuario .rol { font-size: 11px; color: var(--texto-ter); }
.menu-usuario { position: relative; }
.menu-usuario > button { background: none; border: 0; cursor: pointer; padding: 4px; border-radius: var(--radio); display: flex; align-items: center; gap: 10px; font: inherit; color: inherit; text-align: left; }
.menu-usuario > button:hover { background: var(--hover); }
.desplegable { position: absolute; right: 0; top: 46px; min-width: 200px; background: #fff; border: 1px solid var(--borde-sut); border-radius: var(--radio); box-shadow: var(--sombra); padding: 6px; display: none; }
.desplegable.abierto { display: block; }
.desplegable a, .desplegable button { display: block; width: 100%; padding: 8px 10px; border-radius: var(--radio-sm); color: var(--texto); text-align: left; background: none; border: 0; font: inherit; cursor: pointer; }
.desplegable a:hover, .desplegable button:hover { background: var(--hover); text-decoration: none; }

.sidebar {
  position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: var(--sidebar-w); z-index: 20;
  background: var(--superficie); border-right: 1px solid var(--borde-sut); padding: 14px 10px; overflow-y: auto;
}
.sidebar .grupo { font-size: 11px; font-weight: 700; color: var(--texto-ter); text-transform: uppercase; letter-spacing: .06em; padding: 14px 12px 6px; }
.sidebar a {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin: 1px 0; border-radius: var(--radio);
  color: var(--texto); font-weight: 500;
}
.sidebar a:hover { background: var(--hover); text-decoration: none; }
.sidebar a.activo { background: var(--celeste-sut); color: var(--azul-osc); font-weight: 650; }
.sidebar a svg { flex: none; color: var(--texto-sec); }
.sidebar a.activo svg { color: var(--azul); }
.sidebar .contador { margin-left: auto; background: var(--rojo); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 11px; font-weight: 700; line-height: 18px; }
.sidebar .contador.info { background: var(--info); }
.sidebar .pronto { margin-left: auto; font-size: 10px; color: var(--texto-ter); border: 1px solid var(--borde); border-radius: 8px; padding: 0 6px; }

.contenido { margin-left: var(--sidebar-w); padding: calc(var(--topbar-h) + 22px) 28px 40px; max-width: 1500px; }
.cabecera { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.cabecera .sub { color: var(--texto-sec); margin-top: 4px; }
.cabecera .acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.migas { font-size: 12px; color: var(--texto-ter); margin-bottom: 6px; }
.migas a { color: var(--texto-sec); }

/* ---------- Botones y formularios ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px;
  border-radius: var(--radio); border: 1px solid var(--borde); background: #fff; color: var(--texto);
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; line-height: 1.2;
}
.btn:hover { background: var(--hover); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primario { background: var(--azul); border-color: var(--azul); color: #fff; }
.btn.primario:hover { background: var(--azul-osc); }
.btn.peligro { color: var(--rojo); border-color: #F1C2CA; }
.btn.peligro:hover { background: var(--rojo-sut); }
.btn.exito { background: var(--verde); border-color: var(--verde); color: #fff; }
.btn.exito:hover { filter: brightness(.95); }
.btn.chico { padding: 5px 10px; font-size: 12.5px; }
.btn.fantasma { border-color: transparent; background: transparent; }
.btn.fantasma:hover { background: var(--hover); }

label { display: block; font-weight: 600; font-size: 12.5px; color: var(--texto-sec); margin-bottom: 5px; }
.campo { margin-bottom: 14px; }
.campo .ayuda { font-size: 12px; color: var(--texto-ter); margin-top: 4px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--borde); border-radius: var(--radio); font: inherit; color: var(--texto); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--azul-claro); box-shadow: 0 0 0 3px rgba(91,155,213,.18); }
textarea { min-height: 90px; resize: vertical; }
textarea.codigo { font-family: var(--mono); font-size: 12.5px; min-height: 260px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--texto); font-size: 14px; margin: 0; cursor: pointer; }
.check input { width: 16px; height: 16px; }
.fila { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.fila-2 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.filtros { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filtros input[type=search] { max-width: 300px; }
.filtros select { width: auto; }

/* ---------- Tarjetas / paneles ---------- */
.panel { background: var(--superficie); border: 1px solid var(--borde-sut); border-radius: var(--radio-lg); box-shadow: var(--sombra-sm); }
.panel + .panel { margin-top: 18px; }
.rejilla > .panel + .panel { margin-top: 0; }
.rejilla { align-items: start; }
.panel-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--borde-sut); }
.panel-cab .sub { font-size: 12px; color: var(--texto-ter); font-weight: 400; }
.panel-cuerpo { padding: 16px 18px; }
.panel-cuerpo.sin-padding { padding: 0; }
.rejilla { display: grid; gap: 18px; }
.rejilla.dos { grid-template-columns: 1fr 1fr; }
.rejilla.dos-uno { grid-template-columns: 2fr 1fr; }
.rejilla.uno-dos { grid-template-columns: 1fr 2fr; }
@media (max-width: 1100px) { .rejilla.dos, .rejilla.dos-uno, .rejilla.uno-dos { grid-template-columns: 1fr; } }

.kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--borde-sut); border-radius: var(--radio-lg); padding: 15px 17px; box-shadow: var(--sombra-sm); position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--azul); }
.kpi.rojo::before { background: var(--rojo); } .kpi.verde::before { background: var(--verde); }
.kpi.naranja::before { background: var(--naranja); } .kpi.morado::before { background: var(--morado); }
.kpi .titulo { font-size: 12px; color: var(--texto-sec); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi .valor { font-size: 24px; font-weight: 750; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .detalle { font-size: 12px; color: var(--texto-ter); margin-top: 2px; }
.kpi a.cubre { position: absolute; inset: 0; }

/* ---------- Tablas ---------- */
.tabla-env { overflow-x: auto; }
table.tabla { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tabla th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--texto-sec); font-weight: 650; padding: 10px 12px; background: #FAFBFD; border-bottom: 1px solid var(--borde-sut); white-space: nowrap; }
.tabla th a { color: inherit; }
.tabla td { padding: 10px 12px; border-bottom: 1px solid var(--borde-sut); vertical-align: middle; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla tbody tr:hover td { background: var(--hover); }
.tabla tr.clic { cursor: pointer; }
.tabla tfoot td { font-weight: 700; background: #FAFBFD; border-top: 1px solid var(--borde); }
.tabla .acciones-fila { display: flex; gap: 6px; justify-content: flex-end; }
.tabla td.chk, .tabla th.chk { width: 34px; }
.vacio { padding: 36px 20px; text-align: center; color: var(--texto-ter); }
.vacio svg { display: block; margin: 0 auto 10px; color: var(--borde); }

/* ---------- Etiquetas de estado ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 650; white-space: nowrap; background: var(--gris-sut); color: var(--texto-sec); }
.chip.rojo { background: var(--rojo-sut); color: var(--rojo); }
.chip.verde { background: var(--verde-sut); color: var(--verde); }
.chip.naranja { background: var(--naranja-sut); color: var(--naranja); }
.chip.morado { background: var(--morado-sut); color: var(--morado); }
.chip.info { background: var(--info-sut); color: var(--info); }
.chip.azul { background: var(--celeste-sut); color: var(--azul-osc); }

/* ---------- Avisos ---------- */
.aviso { padding: 11px 14px; border-radius: var(--radio); margin-bottom: 14px; border: 1px solid; display: flex; gap: 10px; align-items: flex-start; }
.aviso.ok { background: var(--verde-sut); border-color: #B4E5CB; color: #0B6B3F; }
.aviso.error { background: var(--rojo-sut); border-color: #F3C1CA; color: #A0243A; }
.aviso.alerta { background: var(--naranja-sut); border-color: #F7D3A3; color: #8A4B00; }
.aviso.info { background: var(--info-sut); border-color: #B9D9FA; color: #0B4F9A; }

/* ---------- Aging ---------- */
.aging { display: grid; gap: 10px; }
.aging .barra-fila { display: grid; grid-template-columns: 96px 1fr 130px; align-items: center; gap: 12px; font-size: 13px; }
.aging .pista { height: 22px; background: var(--gris-sut); border-radius: 6px; overflow: hidden; }
.aging .relleno { height: 100%; border-radius: 6px; min-width: 2px; }
.t0 { background: #5B9BD5; } .t1 { background: #F2B544; } .t2 { background: #E8853A; }
.t3 { background: #DD5F45; } .t4 { background: #C93C54; } .t5 { background: #8E2A3F; }
.barra-apilada { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--gris-sut); }
.barra-apilada > div { height: 100%; }
.leyenda { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--texto-sec); margin-top: 8px; }
.leyenda i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- Linea de tiempo ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--borde-sut); }
.timeline li:last-child { border-bottom: 0; }
.timeline .ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--gris-sut); color: var(--texto-sec); }
.timeline .ico.Correo { background: var(--info-sut); color: var(--info); }
.timeline .ico.PagoDetectado { background: var(--verde-sut); color: var(--verde); }
.timeline .ico.PagoInformado { background: var(--verde-sut); color: var(--verde); }
.timeline .ico.Promesa { background: var(--celeste-sut); color: var(--azul); }
.timeline .ico.Disputa { background: var(--morado-sut); color: var(--morado); }
.timeline .ico.Llamada { background: var(--naranja-sut); color: var(--naranja); }
.timeline .ico.Portal { background: var(--celeste-sut); color: var(--azul); }
.timeline .titulo { font-weight: 600; }
.timeline .meta { font-size: 12px; color: var(--texto-ter); }
.timeline .det { font-size: 13px; color: var(--texto-sec); margin-top: 2px; white-space: pre-line; }

/* ---------- Pestanas ---------- */
.pestanas { display: flex; gap: 2px; border-bottom: 1px solid var(--borde-sut); margin-bottom: 16px; overflow-x: auto; }
.pestanas a, .pestanas button { padding: 10px 14px; color: var(--texto-sec); font-weight: 600; border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; font: inherit; white-space: nowrap; }
.pestanas a:hover, .pestanas button:hover { color: var(--texto); text-decoration: none; }
.pestanas .activo { color: var(--azul-osc); border-bottom-color: var(--azul); }
.pestanas .n { background: var(--gris-sut); border-radius: 10px; padding: 0 7px; font-size: 11px; margin-left: 5px; }
.pestanas .activo .n { background: var(--celeste-sut); }

/* ---------- Ficha de cliente ---------- */
.ficha-cab { display: flex; gap: 18px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.ficha-cab .ident h1 { font-size: 21px; }
.ficha-cab .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.datos { display: grid; grid-template-columns: 130px 1fr; gap: 6px 10px; font-size: 13px; }
.datos dt { color: var(--texto-ter); } .datos dd { margin: 0; font-weight: 500; }
.contacto-fila { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--borde-sut); font-size: 13px; }
.contacto-fila:last-child { border-bottom: 0; }
.contacto-fila .quien { flex: 1; min-width: 0; }
.contacto-fila .quien div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contacto-fila.apagado .quien { opacity: .5; }

/* ---------- Modal ---------- */
.modal-fondo { position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 50; display: none; align-items: flex-start; justify-content: center; padding: 60px 16px; overflow-y: auto; }
.modal-fondo.abierto { display: flex; }
.modal { background: #fff; border-radius: var(--radio-lg); box-shadow: var(--sombra-lg); width: 100%; max-width: 560px; }
.modal.ancho { max-width: 860px; }
.modal-cab { padding: 16px 20px; border-bottom: 1px solid var(--borde-sut); display: flex; justify-content: space-between; align-items: center; }
.modal-cab button { background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--texto-ter); line-height: 1; }
.modal-cuerpo { padding: 18px 20px; }
.modal-pie { padding: 14px 20px; border-top: 1px solid var(--borde-sut); display: flex; justify-content: flex-end; gap: 8px; }

iframe.vista-correo { width: 100%; height: 760px; border: 1px solid var(--borde-sut); border-radius: var(--radio); background: #EEF1F6; }

/* ---------- Login ---------- */
.login-fondo { min-height: 100vh; display: grid; grid-template-columns: minmax(440px, 44%) 1fr; }
.login-lado {
  position: relative; overflow: hidden; color: #fff; padding: 48px 56px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  background: linear-gradient(150deg, #2C4670 0%, #45689F 55%, #5B9BD5 100%);
}
/* Arcos del isotipo, en grande y translucidos: dan cuerpo al panel sin distraer */
.login-lado::before, .login-lado::after {
  content: ""; position: absolute; border-radius: 50%; pointer-events: none;
  border: 1px solid rgba(255,255,255,.14);
}
.login-lado::before { width: 620px; height: 620px; right: -260px; bottom: -240px; background: rgba(255,255,255,.05); }
.login-lado::after { width: 380px; height: 380px; right: -120px; bottom: -110px; background: rgba(255,255,255,.06); }
.login-lado > * { position: relative; z-index: 1; }
.login-marca { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 17px; letter-spacing: .01em; }
.login-isotipo { width: 46px; height: 46px; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.login-isotipo img { width: 32px; height: 32px; }
.login-mensaje { max-width: 520px; }
.login-lado h2 { font-size: 36px; line-height: 1.15; letter-spacing: -.02em; }
.login-mensaje > p { font-size: 16px; opacity: .85; margin: 14px 0 0; }
.login-lado ul { list-style: none; padding: 0; margin: 34px 0 0; display: grid; gap: 18px; }
.login-lado li { display: flex; gap: 14px; align-items: flex-start; font-size: 14.5px; line-height: 1.45; }
.login-lado li b { display: block; font-size: 15px; margin-bottom: 2px; }
.login-ico { flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.18); }
.login-pie { opacity: .7; font-size: 12px; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 48px 40px; background: var(--fondo); }
.login-form form {
  width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--borde-sut); border-radius: 16px;
  box-shadow: var(--sombra); padding: 40px 40px 34px;
}
.login-form img { height: 52px; margin-bottom: 28px; }
.login-form h1 { font-size: 26px; margin-bottom: 4px; }
.login-form input[type=text], .login-form input[type=password] { padding: 11px 13px; font-size: 15px; }
.login-form .btn { width: 100%; padding: 12px; margin-top: 6px; font-size: 15px; }
@media (max-width: 900px) {
  .login-fondo { grid-template-columns: 1fr; }
  .login-lado { display: none; }
  .login-form { padding: 24px 16px; }
  .login-form form { padding: 30px 24px; }
}
/* ---------- Varios ---------- */
.separador { height: 1px; background: var(--borde-sut); margin: 16px 0; }
.lista-simple { list-style: none; margin: 0; padding: 0; }
.lista-simple li { padding: 8px 0; border-bottom: 1px solid var(--borde-sut); display: flex; justify-content: space-between; gap: 10px; }
.lista-simple li:last-child { border-bottom: 0; }
.pre { white-space: pre-line; }
.variables { display: flex; flex-wrap: wrap; gap: 6px; }
.variables code { background: var(--gris-sut); border-radius: 4px; padding: 2px 6px; font-size: 12px; cursor: pointer; }
.variables code:hover { background: var(--celeste-sut); }
.paso { display: grid; grid-template-columns: 70px 1fr auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--borde-sut); }
.paso:last-child { border-bottom: 0; }
.paso .dia { text-align: center; font-weight: 800; font-size: 18px; color: var(--azul-osc); background: var(--celeste-sut); border-radius: var(--radio); padding: 8px 0; }
.paso .dia small { display: block; font-size: 10px; font-weight: 600; color: var(--texto-sec); text-transform: uppercase; }
.paso .dia.post { background: var(--naranja-sut); color: var(--naranja); }
.paso .dia.fin { background: var(--rojo-sut); color: var(--rojo); }
.paginacion { display: flex; gap: 6px; justify-content: flex-end; padding: 12px 16px; align-items: center; font-size: 13px; color: var(--texto-sec); }
.toast { position: fixed; bottom: 24px; right: 24px; background: #1F2430; color: #fff; padding: 11px 16px; border-radius: var(--radio); box-shadow: var(--sombra-lg); z-index: 60; opacity: 0; transform: translateY(10px); transition: .2s; pointer-events: none; }
.toast.visible { opacity: 1; transform: none; }

/* ---------- Celular y tablet: el menu lateral pasa a ser un panel que se abre con el boton ☰ ---------- */
.btn-menu { display: none; background: none; border: 0; padding: 6px; margin-left: -6px; border-radius: var(--radio); color: var(--texto); cursor: pointer; }
.btn-menu:hover { background: var(--hover); }
.velo-menu { display: none; }
@media (max-width: 900px) {
  html, body { overflow-x: hidden; }
  .btn-menu { display: inline-flex; }
  .topbar { gap: 10px; padding: 0 12px; }
  .topbar .marca { width: auto; }
  .topbar .marca small { display: none; }
  .topbar .busqueda, .estado-sync { display: none; }
  .usuario .nombre, .usuario .rol, .usuario br { display: none; }
  .sidebar {
    display: block; width: 280px; z-index: 46; box-shadow: var(--sombra-lg);
    transform: translateX(-105%); transition: transform .22s ease;
  }
  body.menu-abierto .sidebar { transform: none; }
  body.menu-abierto .velo-menu { display: block; position: fixed; inset: 0; top: var(--topbar-h); background: rgba(16,24,40,.4); z-index: 45; }
  body.menu-abierto { overflow: hidden; }
  .contenido { margin-left: 0; padding: calc(var(--topbar-h) + 16px) 14px 30px; }
  .cabecera { align-items: flex-start; }
  .cabecera .acciones { width: 100%; }
  .cabecera .acciones input[type=search] { width: 100% !important; }
  .kpi .valor { font-size: 21px; }
  .fila-2 { grid-template-columns: 1fr; }
  .modal-fondo { padding: 20px 10px; }
  .ficha-cab .acciones { display: flex; flex-wrap: wrap; }
}
@media print {
  .topbar, .sidebar, .acciones, .no-imprimir { display: none !important; }
  .contenido { margin: 0; padding: 0; }
  .panel { box-shadow: none; }
}

.contacto-fila { position: relative; }
.contacto-fila .desplegable { top: 38px; }
.btn[data-desplegar] + .desplegable, .menu-usuario .desplegable { z-index: 40; }

.login-ayuda { margin: 18px 0 0; font-size: 12.5px; color: var(--texto-ter); text-align: center; }

/* ---------- Respuestas de clientes ---------- */
.mensaje-cliente { white-space: pre-wrap; word-break: break-word; font-size: 14.5px; line-height: 1.6; }
.mensaje-cliente.cita { margin-top: 10px; padding: 12px 14px; background: var(--fondo); border-radius: var(--radio); font-size: 13px; color: var(--texto-sec); max-height: 420px; overflow: auto; }
.docs-lista { border: 1px solid var(--borde-sut); border-radius: 8px; padding: 6px 12px; max-height: 220px; overflow: auto; }
.docs-lista .check { padding: 5px 0; }
.timeline .ico.Respuesta { background: var(--naranja-sut); color: var(--naranja); }

/* ---------- Usuarios y roles ---------- */
.copiar { border: 0; background: var(--celeste-sut); color: var(--azul-osc); border-radius: 5px; font-size: 11px; font-weight: 700; padding: 2px 8px; cursor: pointer; margin-left: 8px; font-family: var(--fuente); vertical-align: middle; }
.copiar:hover { background: #d8e8f8; }
.credenciales { max-width: 680px; }
.cred { display: grid; grid-template-columns: 170px 1fr; gap: 12px 16px; margin: 18px 0; font-size: 15px; align-items: center; }
.cred dt { color: var(--texto-sec); }
.cred dd { margin: 0; }
.cred .clave { font-size: 22px; font-weight: 700; letter-spacing: .04em; color: var(--azul-osc); }
.opcion-rol, .permiso { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--borde-sut); border-radius: var(--radio); margin-bottom: 8px; cursor: pointer; font-weight: 400; color: var(--texto); font-size: 14px; }
.opcion-rol:hover, .permiso:hover { background: var(--hover); }
.opcion-rol input, .permiso input { margin-top: 3px; width: 16px; height: 16px; flex: none; }
.opcion-rol small, .permiso small { display: block; color: var(--texto-sec); font-size: 12.5px; margin-top: 2px; line-height: 1.4; }
.opcion-rol:has(input:checked), .permiso:has(input:checked) { border-color: var(--azul-claro); background: var(--celeste-sut); }
.roles { display: grid; gap: 18px; }
.roles .panel + .panel { margin-top: 0; }
.rol-cuerpo { display: grid; grid-template-columns: 1fr 260px; gap: 24px; }
.rol-grupo { font-weight: 700; font-size: 12.5px; color: var(--azul-osc); margin: 10px 0 4px; }
.rol-lista { list-style: none; margin: 0; padding: 0; }
.rol-lista li { display: flex; gap: 8px; padding: 4px 0; font-size: 13.5px; }
.rol-lista li svg { flex: none; margin-top: 3px; color: var(--verde); }
@media (max-width: 900px) { .rol-cuerpo { grid-template-columns: 1fr; } }

/* Los hijos de grillas y filas no se estiran con su contenido: una tabla ancha se desplaza dentro
   de su panel en vez de ensanchar toda la pagina (en el celular dejaba la pagina mas ancha que la pantalla). */
.rejilla > *, .kpis > *, .fila > *, .fila-2 > *, .panel, .panel-cuerpo { min-width: 0; }
.cabecera > div { min-width: 0; }
@media (max-width: 700px) { .tabla .ocultar-movil { display: none; } }
