/* Tableros nativos: misma disposición que los tableros Power BI originales
   (panel de filtros lateral, encabezado, navegación por páginas, grilla de gráficos) */
.tn {
    --tn-texto: #252423;
    --tn-texto-2: #605E5C;
    --tn-pizarra: #374756;
    --tn-navy: #0F1934;
    --tn-lavanda: #DADCF7;
    --tn-lateral: #EDEDED;
    --tn-lienzo: #F9F9F9;
    --tn-borde: #E1DFDD;
    font-family: "Segoe UI", Rubik, sans-serif;
    color: var(--tn-texto);
}

/* El sitio agrega padding a la primera <section> de main: no aplica dentro del tablero */
main .tn section:first-of-type { padding-top: 0; }

/* ─── Estructura ─── */
.tn-app {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    background: var(--tn-lienzo);
    border: 1px solid var(--tn-borde);
}
.tn-side { background: var(--tn-lateral); display: flex; flex-direction: column; }
.tn-side__logo { height: 70px; display: flex; align-items: center; justify-content: center; background: #fff; padding: 0 12px; }
.tn-side__logo img { width: 100%; height: auto; max-width: 176px; }
.tn-side__panel {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-size: 14px; font-weight: 600; color: var(--tn-texto);
    padding: 10px 8px 8px;
    border-bottom: 1px solid var(--tn-pizarra);
    margin: 0 0 6px;
}
.tn-side__icono { display: inline-flex; color: var(--tn-texto-2); }
.tn-side__filtros { display: flex; flex-direction: column; gap: 14px; padding: 6px 8px 16px; }
.tn-side__filtro { display: flex; flex-direction: column; gap: 6px; }
.tn-side__label { font-size: 14px; font-weight: 600; color: var(--tn-texto); }
.tn-side__selector { display: flex; flex-direction: column; gap: 10px; margin-top: 40px; }
.tn-side__subtitulo {
    font-size: 14px; font-weight: 600; text-align: center;
    padding-bottom: 6px; border-bottom: 1px solid var(--tn-pizarra); margin: 0 -8px 4px;
}
.tn-side__boton {
    appearance: none; border: 0; border-radius: 4px;
    background: var(--tn-lavanda); color: var(--tn-texto);
    font: inherit; font-size: 13px; line-height: 1.3;
    padding: 12px 10px; min-height: 48px;
    white-space: pre-line; cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    transition: background-color 0.15s;
}
.tn-side__boton:hover { background: #cbcef3; }
.tn-side__boton[aria-pressed="true"] { background: var(--tn-navy); color: #fff; }

.tn-main { display: flex; flex-direction: column; min-width: 0; }
.tn-head {
    background: var(--tn-pizarra); color: #fff;
    height: 70px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 12px 0 20px; gap: 16px;
}
.tn-head__titulo { font-family: inherit; font-size: 26px; font-weight: 400; margin: 0; color: #fff; }
.tn-head__ultimo { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.tn-head__ultimo strong { font-size: 16px; font-weight: 600; }
.tn-head__ultimo span { font-size: 11px; opacity: 0.9; }

.tn-nav { display: grid; grid-template-columns: repeat(var(--tn-paginas, 4), minmax(0, 1fr)); gap: 16px; padding: 10px 28px 12px; }
.tn-nav__btn {
    appearance: none; border: 0; border-radius: 10px;
    background: var(--tn-lavanda); color: var(--tn-texto);
    font: inherit; font-size: 14px; min-height: 52px; padding: 6px 10px;
    cursor: pointer;
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.12);
    transition: background-color 0.15s;
}
.tn-nav__btn:hover { background: #cbcef3; }
.tn-nav__btn[aria-selected="true"] { background: var(--tn-navy); color: #fff; }

/* Filtros superiores (paneles oscuros) */
.tn-top { display: flex; gap: 12px; padding: 0 14px 8px; }
.tn-top[hidden] { display: none; }
.tn-top__filtro {
    background: var(--tn-pizarra); color: #fff;
    padding: 6px 8px 8px; display: flex; flex-direction: column; gap: 4px;
    flex: 0 0 200px; min-width: 0;
}
.tn-top__filtro--ancho { flex: 1 1 auto; }
.tn-top__label { font-size: 13px; font-weight: 600; }

/* Controles */
.tn-select, .tn-dd__btn {
    width: 100%;
    font: inherit; font-size: 13px; color: var(--tn-texto);
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%23252423' stroke-width='1.3'/%3E%3C/svg%3E") no-repeat right 8px center;
    border: 1px solid #c8c6c4; border-radius: 0;
    padding: 5px 28px 5px 6px; min-height: 32px;
    appearance: none; text-align: left; cursor: pointer;
}
.tn-dd { position: relative; }
.tn-dd__panel {
    position: absolute; z-index: 20; top: 100%; left: 0; right: 0;
    background: #fff; border: 1px solid #c8c6c4; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    max-height: 320px; overflow: auto; padding: 4px 0; color: var(--tn-texto);
}
.tn-dd__buscar { width: calc(100% - 12px); margin: 4px 6px 6px; font: inherit; font-size: 13px; padding: 5px 6px; border: 1px solid #c8c6c4; }
.tn-dd__item { display: flex; align-items: center; gap: 8px; padding: 5px 10px; font-size: 13px; cursor: pointer; }
.tn-dd__item:hover { background: #f3f2f1; }
.tn-dd__item input { accent-color: var(--tn-navy); }

.tn-rango__cajas { display: flex; gap: 8px; }
.tn-año { width: 50%; font: inherit; font-size: 13px; border: 1px solid #c8c6c4; padding: 4px 6px; background: #fff; -moz-appearance: textfield; }
.tn-año::-webkit-inner-spin-button { -webkit-appearance: none; }
.tn-rango__slider { position: relative; height: 28px; margin: 4px 6px 0; }
.tn-rango__slider input {
    position: absolute; inset: 0; width: 100%; margin: 0;
    appearance: none; background: none; pointer-events: none;
}
.tn-rango__slider::before { content: ""; position: absolute; left: 0; right: 0; top: 13px; height: 2px; background: #8a8886; }
.tn-rango__slider input::-webkit-slider-thumb {
    appearance: none; pointer-events: auto; width: 22px; height: 22px; border-radius: 50%;
    background: #fff; border: 2px solid #605E5C; cursor: pointer; position: relative; z-index: 2;
}
.tn-rango__slider input::-moz-range-thumb {
    pointer-events: auto; width: 18px; height: 18px; border-radius: 50%;
    background: #fff; border: 2px solid #605E5C; cursor: pointer;
}

/* ─── Contenido ─── */
.tn-contenido { padding: 0 14px 14px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.tn-grilla { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tn-card { background: #fff; padding: 6px 8px 4px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); }
.tn-card__titulo {
    font-family: inherit; font-size: 15px; font-weight: 600; text-align: center; color: var(--tn-texto);
    margin: 0 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--tn-pizarra);
}
.tn-card__sub { font-size: 13px; text-align: center; color: var(--tn-texto); margin: -2px 0 6px; padding-bottom: 6px; border-bottom: 1px solid var(--tn-pizarra); }
.tn-card__titulo:has(+ .tn-card__sub) { border-bottom: 0; padding-bottom: 0; margin-bottom: 4px; }
.tn-grafico { width: 100%; }
.tn-card--alta { flex: 1; display: flex; flex-direction: column; }
.tn-scroll { max-height: 440px; overflow-y: auto; }
.tn-eje-x { text-align: center; font-size: 12px; color: var(--tn-texto-2); margin: 2px 0 0; }
.tn-leyenda-html { display: flex; justify-content: center; gap: 14px; font-size: 12px; color: var(--tn-texto-2); margin-bottom: 6px; }
.tn-leyenda-html span { display: inline-flex; align-items: center; gap: 5px; }
.tn-leyenda-html b { width: 2px; height: 12px; display: inline-block; }
.tn-leyenda-html__ref { color: #F33B47; font-weight: 600; }
.tn-leyenda-html i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.tn-como-leer { font-size: 13px; line-height: 1.45; margin: 4px 4px 0; color: var(--tn-texto); }
#tablero-inflacion .tn-como-leer strong { font-size: inherit; font-weight: 700; }

/* Tooltip */
.tn-tt { font-family: "Segoe UI", Rubik, sans-serif; min-width: 170px; }
.tn-tt__t { font-size: 12px; color: #605E5C; margin-bottom: 4px; }
.tn-tt__fila { display: flex; align-items: center; gap: 8px; font-size: 12px; line-height: 1.7; }
.tn-tt__fila span:nth-child(2) { flex: 1; }
.tn-tt__fila strong { font-weight: 600; }
.tn-tt__key { width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* ─── Debajo del tablero ─── */
.tn-resumen { font-size: 15px; margin: 0 0 12px; }
.tn-fuente { font-family: Rubik, sans-serif; font-size: 13px; color: var(--tn-texto-2); margin: 10px 0 0; }

.tn-ficha { max-width: 860px; margin: 16px 0 48px; }
.tn-ficha dt { font-weight: 500; color: var(--primary, #2B2B2B); margin-top: 16px; }
.tn-ficha dd { margin: 4px 0 0; line-height: 1.55; }

/* ─── Pantallas chicas: el panel lateral pasa arriba ─── */
@media (max-width: 991px) {
    .tn-app { grid-template-columns: 1fr; min-height: 0; }
    .tn-main { display: contents; }
    .tn-head { order: 1; }
    .tn-nav { order: 2; }
    .tn-side { order: 3; }
    .tn-top { order: 4; padding-top: 8px; }
    .tn-contenido { order: 5; padding-top: 8px; }
    .tn-side__logo { display: none; }
    .tn-side__panel { justify-content: flex-start; padding: 10px 12px 8px; }
    .tn-side__filtros { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 6px 12px 14px; }
    .tn-side__filtro { flex: 1 1 200px; }
    .tn-side__selector { flex: 1 1 100%; flex-direction: row; flex-wrap: wrap; margin-top: 4px; }
    .tn-side__subtitulo { flex: 1 1 100%; text-align: left; margin: 0; border: 0; }
    .tn-side__selector .tn-side__boton { flex: 1 1 160px; }
    .tn-grilla { grid-template-columns: 1fr; }
    .tn-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 10px 14px; }
}
@media (max-width: 575px) {
    .tn-head { height: auto; padding: 12px; flex-wrap: wrap; }
    .tn-head__titulo { font-size: 21px; }
    .tn-top { flex-direction: column; }
    .tn-top__filtro { flex: 1 1 auto; }
    .tn-contenido { padding: 0 8px 8px; }
}
@media (prefers-reduced-motion: reduce) {
    .tn-nav__btn, .tn-side__boton { transition: none; }
}
