/* ============ Reportería avanzada: tableros, gráficos e informes PDF ============ */

/* ---------- Toolbar de tableros ---------- */
.dash-toolbar { margin-bottom: 18px; }
.dash-toolbar .dash-filtros { display: flex; flex-wrap: wrap; gap: 14px; padding: 14px 18px 4px; }
.dash-f { display: flex; flex-direction: column; gap: 4px; }
.dash-f label { font-size: 10.5px; font-weight: 700; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .08em; }
.dash-f select { font-family: var(--font-body); font-size: 13.5px; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 9px; padding: 7px 10px; outline: none; }
.dash-f select:focus { border-color: var(--accent); }
.dash-presets { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 18px 14px; }
.dash-preset { font-family: var(--font-head); font-weight: 600; font-size: 12.5px; color: var(--ink-soft); background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 20px; padding: 5px 14px; cursor: pointer; transition: all .15s; }
.dash-preset:hover { background: var(--accent-soft); color: var(--ink); }
.dash-preset.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.dash-preset.custom { cursor: default; }
.dash-presets .btn { margin-left: auto; }
.dash-widget-picker { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px 16px; border-top: 1px dashed var(--line); margin-top: 2px; padding-top: 12px; }
.dash-wcheck { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 6px 11px; cursor: pointer; user-select: none; }
.dash-wcheck.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.dash-wcheck input { accent-color: var(--accent); margin: 0; }
.rep-kpi-row-6 { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 1100px) { .rep-kpi-row-6 { grid-template-columns: repeat(3, 1fr); } }
.dash-grid .w-full { grid-column: 1 / -1; }

/* ---------- Gráficos SVG ---------- */
.ch-wrap { width: 100%; }
.ch-svg { width: 100%; height: auto; display: block; }
.ch-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 3; }
.ch-tick { font-size: 10.5px; fill: var(--ink-faint); font-family: var(--font-body); }
.ch-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.ch-cursor { stroke: var(--ink-faint); stroke-width: 1; stroke-dasharray: 3 3; }
.ch-dot { stroke: var(--surface); stroke-width: 2; }
.ch-plot { position: relative; }
.ch-tip { position: absolute; top: 6px; transform: translateX(-50%); background: var(--ink); color: var(--bg); font-size: 11.5px; line-height: 1.5; padding: 7px 10px; border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.25); pointer-events: none; white-space: nowrap; z-index: 5; }
.ch-tip b { font-weight: 700; }
.ch-tip-row { display: flex; align-items: center; gap: 6px; }
.ch-tip-row i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.ch-legend { display: flex; flex-wrap: wrap; gap: 16px; padding: 2px 2px 10px; }
.ch-leg-item { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.ch-leg-item i { width: 10px; height: 10px; border-radius: 3px; }
.ch-leg-item b { color: var(--ink); font-family: var(--font-head); }

/* Donut */
.ch-donut { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.ch-donut-svg { position: relative; flex: none; }
.ch-donut-empty { stroke: var(--line); }
.ch-donut-c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.ch-donut-c b { font-family: var(--font-head); font-size: 22px; font-weight: 800; color: var(--ink); }
.ch-donut-c span { font-size: 11px; color: var(--ink-soft); max-width: 90px; }
.ch-donut-leg { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 5px; }
.ch-leg-row { display: grid; grid-template-columns: 12px 1fr auto 38px; align-items: center; gap: 8px; font-size: 13px; cursor: default; transition: opacity .15s; }
.ch-leg-row[data-dim="1"] { opacity: .4; }
.ch-leg-row i { width: 10px; height: 10px; border-radius: 3px; }
.ch-leg-row .lbl { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-leg-row b { font-family: var(--font-head); }
.ch-leg-row .pct { color: var(--ink-faint); font-size: 11.5px; text-align: right; }

/* Heatmap */
.ch-heat-grid { display: grid; gap: 2.5px; align-items: center; }
.ch-heat-col { font-size: 9.5px; color: var(--ink-faint); text-align: center; overflow: visible; white-space: nowrap; }
.ch-heat-row { font-size: 11.5px; font-weight: 600; color: var(--ink-soft); padding-right: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-heat-cell { height: 20px; border-radius: 4px; border: 1px solid var(--line); }
.ch-heat-scale { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 10.5px; color: var(--ink-faint); }
.ch-heat-scale i { width: 110px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-2), var(--accent)); border: 1px solid var(--line); }

/* Funnel */
.ch-funnel { display: flex; flex-direction: column; gap: 7px; }
.ch-fun-row { display: grid; grid-template-columns: 92px 1fr 110px; align-items: center; gap: 10px; }
.ch-fun-lbl { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); text-align: right; }
.ch-fun-track { background: var(--surface-2); border-radius: 7px; height: 26px; overflow: hidden; }
.ch-fun-bar { height: 100%; border-radius: 7px; display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; transition: width .3s; }
.ch-fun-bar b { font-family: var(--font-head); font-size: 12px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.ch-fun-kg { font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* ---------- Informe PDF ---------- */
.inf-layout { display: flex; flex-direction: column; gap: 18px; }
.inf-tipos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 1000px) { .inf-tipos { grid-template-columns: repeat(2, 1fr); } }
.inf-tipo { display: flex; flex-direction: column; gap: 4px; text-align: left; font-family: var(--font-body); background: var(--surface-2); border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 13px; cursor: pointer; transition: all .15s; color: var(--ink-soft); }
.inf-tipo b { font-family: var(--font-head); font-size: 13.5px; color: var(--ink); }
.inf-tipo span { font-size: 11.5px; line-height: 1.45; }
.inf-tipo:hover { border-color: var(--line-strong); }
.inf-tipo.active { border-color: var(--accent); background: var(--accent-soft); }
.inf-tipo.active b { color: var(--accent); }
.inf-conf-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; margin-top: 14px; }
.inf-secs { display: flex; flex-wrap: wrap; gap: 7px; flex: 1; }
.inf-print-btn { margin-left: auto; }
.inf-hint { margin-top: 12px; font-size: 12px; color: var(--ink-soft); background: var(--glacier-soft); border-radius: 9px; padding: 8px 12px; }

/* Hoja del informe: siempre papel blanco, colores fijos */
.inf-sheet { background: #fff; color: #1E332B; width: min(860px, 100%); margin: 0 auto; padding: 46px 54px 34px; border-radius: 6px; border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 13px; line-height: 1.5; }
.inf-head { display: flex; align-items: center; gap: 16px; border-bottom: 3px solid #1E6B52; padding-bottom: 16px; margin-bottom: 20px; }
.inf-head img { width: 52px; height: 52px; border-radius: 50%; }
.inf-head-t b { font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: #1E6B52; }
.inf-head-t h1 { font-family: var(--font-head); font-size: 24px; font-weight: 800; color: #1E332B; letter-spacing: -.01em; margin-top: 2px; }
.inf-head-m { margin-left: auto; display: flex; flex-direction: column; gap: 3px; text-align: right; }
.inf-head-m div { font-size: 11.5px; }
.inf-head-m span { color: #93A29A; text-transform: uppercase; font-size: 9.5px; letter-spacing: .1em; font-weight: 700; margin-right: 7px; }
.inf-head-m b { color: #1E332B; font-weight: 600; }
.inf-h { font-family: var(--font-head); font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #1E6B52; border-bottom: 1.5px solid #E4DCCB; padding-bottom: 5px; margin: 22px 0 10px; }
.inf-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 4px; }
.inf-kpi { border: 1px solid #E4DCCB; border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.inf-kpi b { font-family: var(--font-head); font-size: 23px; font-weight: 800; color: #1E6B52; }
.inf-kpi span { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #5C6F66; }
.inf-kpi small { font-size: 10.5px; color: #93A29A; }
.inf-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.inf-table th { text-align: left; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: #5C6F66; border-bottom: 1.5px solid #CFC5AE; padding: 6px 8px; }
.inf-table td { border-bottom: 1px solid #EFE9DC; padding: 6.5px 8px; color: #1E332B; vertical-align: top; }
.inf-table tr:nth-child(even) td { background: #FBF8F1; }
.inf-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.inf-vacio { font-size: 12px; color: #93A29A; font-style: italic; padding: 8px 2px; }
.inf-bar { display: grid; grid-template-columns: 150px 1fr 150px; align-items: center; gap: 10px; margin-bottom: 6px; font-size: 12px; }
.inf-bar .l { color: #1E332B; font-weight: 600; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inf-bar .t { background: #F3EFE4; border-radius: 5px; height: 15px; overflow: hidden; display: block; }
.inf-bar .t i { display: block; height: 100%; border-radius: 5px; }
.inf-bar .r { color: #5C6F66; font-variant-numeric: tabular-nums; white-space: nowrap; }
.inf-notas { font-size: 12.5px; color: #1E332B; background: #FBF8F1; border: 1px solid #E4DCCB; border-left: 3px solid #1E6B52; border-radius: 8px; padding: 12px 14px; white-space: pre-wrap; }
.inf-foot { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid #E4DCCB; margin-top: 28px; padding-top: 10px; font-size: 10px; color: #93A29A; letter-spacing: .03em; }

/* ---------- Impresión ---------- */
@media print {
  @page { size: A4 portrait; margin: 13mm 12mm; }
  html, body { background: #fff !important; }
  .app-header, .twk-panel, .no-print { display: none !important; }
  .main { padding: 0 !important; max-width: none !important; }
  .inf-layout { gap: 0; }
  .inf-sheet { box-shadow: none !important; border: none !important; border-radius: 0 !important; margin: 0 !important; padding: 0 !important; width: 100% !important; max-width: none !important; }
  .inf-block, .inf-table tr, .inf-kpi, .inf-bar { break-inside: avoid; }
  .inf-sheet, .inf-sheet * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
