/* Portal de tableros · estilo de la intranet Telcos (barra blanca, riel de íconos, paneles redondeados) */
:root {
  --azul: #1B2350;
  --azul2: #2B3470;
  --naranja: #F28C28;
  --fondo: #F4F5F7;
  --panel: #FFFFFF;
  --texto: #2B2B33;
  --gris: #6B6E7B;
  --linea: #E6E7EC;
  --suave: #F1F2F6;
  --barra: 64px;
  --riel: 76px;
  --menu: 290px;
  --radio: 18px;
  --fuente: 'Lexend', 'Segoe UI', Tahoma, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: var(--fuente); color: var(--texto); background: var(--fondo); }
body { overflow: hidden; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* barra superior */
.barra-sup { position: fixed; top: 0; left: 0; right: 0; height: var(--barra); background: var(--panel); display: flex; align-items: center; gap: 14px; padding: 0 22px; z-index: 50; box-shadow: 0 1px 0 var(--linea); }
.marca { text-decoration: none; display: flex; align-items: center; }
.logo-t { font-family: var(--fuente); font-weight: 500; font-size: 30px; letter-spacing: -0.5px; color: var(--azul); line-height: 1; }
.logo-e { color: var(--naranja); }
.separador { width: 1px; height: 26px; background: var(--linea); }
#titulo { font-size: 15px; font-weight: 500; color: var(--azul); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
#acciones { display: flex; align-items: center; gap: 8px; }
#actualizado { font-size: 12px; color: var(--gris); white-space: nowrap; margin-right: 4px; }
.pildora { background: var(--azul); color: #fff; border: 1px solid var(--azul); border-radius: 999px; padding: 7px 14px; font-family: var(--fuente); font-size: 12.5px; cursor: pointer; white-space: nowrap; transition: background .15s; }
.pildora:hover { background: var(--azul2); }
.pildora.clara { background: #fff; color: var(--azul); border-color: var(--linea); }
.pildora.clara:hover { background: var(--suave); }
.icono-btn { display: none; background: none; border: 0; color: var(--azul); padding: 6px; border-radius: 10px; cursor: pointer; }
.icono-btn:hover { background: var(--suave); }

/* riel de íconos */
#riel { position: fixed; top: calc(var(--barra) + 14px); left: 14px; bottom: 14px; width: calc(var(--riel) - 14px); background: var(--panel); border-radius: var(--radio); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 0; z-index: 45; box-shadow: 0 1px 3px rgba(20, 24, 60, .06); }
.riel-btn { width: 52px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 0 7px; border: 0; background: none; color: var(--azul); border-radius: 14px; cursor: pointer; font-family: var(--fuente); font-size: 10.5px; text-decoration: none; transition: background .15s; }
.riel-btn:hover, .riel-btn.activo, body.menu-abierto #riel-tableros { background: var(--suave); }

/* panel de tableros (se despliega al pasar el mouse por el ícono de tres rayas) */
#menu { position: fixed; top: calc(var(--barra) + 14px); left: calc(var(--riel) + 8px); bottom: 14px; width: var(--menu); background: var(--panel); border-radius: var(--radio); overflow-y: auto; z-index: 46; padding: 14px 10px;
  box-shadow: 0 12px 32px rgba(20, 24, 60, .16); opacity: 0; transform: translateX(-18px) scale(.98); pointer-events: none; transition: opacity .22s ease, transform .26s cubic-bezier(.2, .8, .2, 1); }
body.menu-abierto #menu { opacity: 1; transform: none; pointer-events: auto; }
.menu-tit { padding: 4px 10px 12px; font-size: 15px; font-weight: 500; color: var(--azul); }
.menu-item { display: flex; gap: 12px; align-items: center; padding: 10px 10px; text-decoration: none; color: var(--texto); border-radius: 12px; margin-bottom: 2px; transition: background .12s; }
.menu-item:hover { background: var(--suave); }
.menu-item.activo { background: #E9ECF7; }
.menu-item.activo .menu-txt b { color: var(--azul); }
.menu-icono { width: 34px; height: 34px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--suave); color: var(--azul); }
.menu-item.activo .menu-icono { background: var(--azul); color: #fff; }
.menu-icono svg { width: 19px; height: 19px; }
.menu-txt { display: flex; flex-direction: column; min-width: 0; }
.menu-txt b { font-weight: 500; font-size: 13.5px; }
.menu-txt small { color: var(--gris); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 300; }
#velo { position: fixed; inset: var(--barra) 0 0 0; background: rgba(20, 24, 60, .18); z-index: 44; opacity: 0; pointer-events: none; transition: opacity .2s; }
body.menu-abierto #velo { opacity: 1; }

/* zona principal: panel blanco redondeado */
#principal { position: fixed; top: calc(var(--barra) + 14px); left: calc(var(--riel) + 14px); right: 14px; bottom: 14px; display: flex; flex-direction: column; background: var(--panel); border-radius: var(--radio); overflow: hidden; box-shadow: 0 1px 3px rgba(20, 24, 60, .06); }
#pestanas { display: flex; gap: 2px; padding: 8px 12px 0; background: var(--panel); border-bottom: 1px solid var(--linea); overflow-x: auto; flex: none; scrollbar-width: thin; align-items: flex-end; }
#pestanas:empty { display: none; }
.pestana { border: 0; background: none; padding: 8px 14px 10px; font-size: 13px; color: var(--gris); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; font-family: var(--fuente); }
.pestana:hover { color: var(--azul); }
.pestana.activa { color: var(--azul); border-bottom-color: var(--naranja); font-weight: 500; }
#desplazador { flex: 1; overflow: auto; position: relative; background: #EEF0F4; }
#contenido { position: relative; width: 100%; min-height: 100%; }

/* lienzo de página */
.lienzo { position: absolute; top: 0; transform-origin: 0 0; overflow: hidden; }
.fondo-pagina { position: absolute; inset: 0; background-repeat: no-repeat; background-position: center top; pointer-events: none; }
.vis { position: absolute; display: flex; flex-direction: column; overflow: hidden; }
.vtitulo { padding: 4px 8px 0; line-height: 1.25; flex: none; overflow: hidden; }
.vcuerpo { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.grafico { position: absolute; inset: 2px 4px 4px 4px; }
.verror { color: #A4262C; font-size: 12px; padding: 8px; }
.con-seleccion { outline: 2px solid rgba(242,140,40,.6); }

/* tarjeta */
.tarjeta { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 6px; }
.tvalor { line-height: 1.1; white-space: nowrap; }
.tetiqueta { margin-top: 2px; line-height: 1.2; }
.multitarjeta { overflow: auto; padding: 6px 10px; }
.mtfila { padding: 4px 0; border-left: 3px solid #118DFF; padding-left: 8px; margin-bottom: 6px; }
.mtetiqueta { color: var(--gris); font-size: 12px; }

/* texto */
.texto { padding: 4px 6px; overflow: hidden; line-height: 1.3; }
.tparrafo { min-height: 1em; }
.imagen { width: 100%; height: 100%; display: block; }

/* botones / navegador */
.boton .vcuerpo { display: flex; align-items: center; justify-content: center; }
.boton-texto { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; height: 100%; text-align: center; }
.boton-icono { line-height: 1; }
.boton:hover { filter: brightness(.95); }
.navegador { display: flex; gap: 6px; align-items: stretch; justify-content: center; padding: 4px; }
.navboton { flex: 1; cursor: pointer; padding: 4px 8px; font-family: inherit; }
.navboton:hover { filter: brightness(.94); }

/* segmentadores */
.segmentador { display: flex; flex-direction: column; padding: 2px 8px 6px; min-height: 0; }
.seg-titulo { line-height: 1.3; margin-bottom: 4px; flex: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg-desplegable { display: flex; align-items: center; justify-content: space-between; width: 100%; background: #fff; border: 1px solid #C8C6C4; border-radius: 3px; padding: 4px 8px; cursor: pointer; font-family: inherit; color: var(--texto); text-align: left; }
.seg-resumen { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg-flecha { margin-left: 6px; color: var(--gris); }
.seg-lista { overflow-y: auto; min-height: 0; flex: 1; }
.seg-item { display: flex; align-items: center; gap: 6px; padding: 2px 0; cursor: pointer; line-height: 1.3; }
.seg-item input { margin: 0; flex: none; }
.seg-mosaico { display: flex; flex-wrap: wrap; gap: 4px; align-content: flex-start; }
.seg-boton { border: 1px solid #C8C6C4; background: #fff; border-radius: 3px; padding: 4px 10px; cursor: pointer; font-family: inherit; }
.seg-boton.activo { background: #252423; color: #fff; }
.seg-rango { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.seg-rango input { flex: 1; min-width: 0; border: 1px solid #C8C6C4; border-radius: 3px; padding: 3px 4px; font-family: inherit; }
.panel-flotante { position: fixed; z-index: 100; background: #fff; border: 1px solid #C8C6C4; box-shadow: 0 6px 18px rgba(0,0,0,.18); border-radius: 4px; padding: 6px; max-height: 60vh; display: flex; flex-direction: column; max-width: 90vw; }
.panel-flotante .seg-buscar { border: 1px solid #C8C6C4; border-radius: 3px; padding: 5px 8px; margin-bottom: 6px; font-family: inherit; font-size: 13px; }
.panel-flotante .seg-lista { max-height: 50vh; }
.panel-flotante .seg-item { font-size: 13px !important; padding: 4px 2px; }
.seg-todo { border-bottom: 1px solid var(--linea); margin-bottom: 2px; }

/* tablas */
.tabla-cont { overflow: auto; }
.tabla { border-collapse: collapse; width: 100%; font-family: 'Segoe UI', Arial, sans-serif; }
.tabla th { position: sticky; top: 0; background: #fff; font-weight: 600; text-align: left; padding: 4px 6px; border-bottom: 2px solid #C8C6C4; z-index: 1; vertical-align: bottom; }
.tabla td { padding: 3px 6px; border-bottom: 1px solid #EDEBE9; white-space: nowrap; }
.tabla tbody tr:nth-child(even) { background: #FAF9F8; }
.tabla tbody tr:hover { background: #F3F2F1; }
.tabla .num { text-align: right; }
.tabla tfoot td { position: sticky; bottom: 0; background: #fff; font-weight: 700; border-top: 2px solid #C8C6C4; }
.tabla td.nota { white-space: normal; color: var(--gris); font-style: italic; text-align: center; }
.matriz .encfila { font-weight: 400; }
.matriz tr.nivel0 .encfila { font-weight: 600; }
.expandir { cursor: pointer; color: var(--gris); margin-right: 4px; user-select: none; }


/* portada */
.portada { max-width: 1120px; margin: 0 auto; padding: 30px 22px 40px; }
.portada h1 { margin: 0 0 6px; color: var(--azul); font-size: 24px; font-weight: 500; }
.portada .sub { margin: 0 0 24px; color: var(--gris); font-weight: 300; }
.tarjetas { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.tarjeta-tablero { display: block; background: #fff; border-radius: var(--radio); padding: 18px; text-decoration: none; color: var(--texto); border: 1px solid var(--linea); transition: transform .12s, box-shadow .12s, border-color .12s; }
.tarjeta-tablero:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(20, 24, 60, .10); border-color: transparent; }
.tt-icono { width: 42px; height: 42px; border-radius: 12px; background: var(--suave); color: var(--azul); display: flex; align-items: center; justify-content: center; }
.tt-nombre { font-weight: 500; font-size: 15.5px; color: var(--azul); margin: 12px 0 4px; }
.tt-desc { font-size: 12.5px; color: var(--gris); min-height: 34px; font-weight: 300; }
.tt-fecha { font-size: 11px; color: var(--gris); margin-top: 10px; display: inline-block; background: var(--suave); padding: 3px 9px; border-radius: 999px; }

.cargando { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 80px 20px; color: var(--gris); }
.cargando .barra { width: 260px; height: 6px; background: #ddd; border-radius: 3px; overflow: hidden; }
.cargando .barra div { height: 100%; width: 5%; background: var(--naranja); transition: width .15s; }
.cargando.error { color: #A4262C; }

/* tableros con enlace de Power BI */
.marco-pbi { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
#pestanas .modo { margin-left: auto; display: flex; gap: 6px; padding: 0 0 8px 16px; align-items: center; }
.modo-btn { border: 1px solid var(--linea) !important; border-radius: 999px; padding: 6px 13px !important; color: var(--azul) !important; text-decoration: none; font-size: 12px !important; background: #fff; }
.modo-btn:hover { background: var(--suave); }
.modo-btn:disabled { opacity: .4; cursor: default; }

/* celular / pantallas angostas: sin riel; el ícono de tres rayas va en la barra */
@media (max-width: 900px) {
  #riel { display: none; }
  .icono-btn { display: block; }
  #principal { left: 8px; right: 8px; top: calc(var(--barra) + 8px); bottom: 8px; border-radius: 14px; }
  #menu { left: 8px; top: calc(var(--barra) + 8px); bottom: 8px; width: min(var(--menu), calc(100vw - 16px)); }
  body.menu-abierto #velo { pointer-events: auto; }
  #actualizado, .separador { display: none; }
  .barra-sup { padding: 0 10px; gap: 8px; }
  .logo-t { font-size: 24px; }
  #titulo { font-size: 13px; }
  .pildora { padding: 6px 10px; font-size: 11.5px; }
}
@media (max-width: 560px) {
  #btn-atras { display: none; }
}
.menu-grupo { padding: 14px 10px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--gris); font-weight: 500; }
.portada-grupo { margin: 26px 0 12px; font-size: 13px; font-weight: 500; color: var(--gris); text-transform: uppercase; letter-spacing: .07em; }
.portada-grupo:first-of-type { margin-top: 4px; }
