/* ---------- Analítica (modules/analytics.js) ---------- */
.an-tabs { margin-bottom: 16px; }
.an-tabs .an-lock { width: 12px; height: 12px; color: var(--text3); }
.an-period { flex-wrap: wrap; justify-content: flex-end; }
.an-period.is-off { opacity: .4; pointer-events: none; }
.an-custom { display: inline-flex; align-items: center; gap: 6px; color: var(--text3); font-size: 13px; }
.an-custom input { width: 150px; }
.an-pane .dash-main + .dash-grid, .an-pane .dash-grid + .an-card { margin-top: 16px; }
.an-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.an-card { overflow: hidden; margin-top: 16px; }
.an-card-pad { padding: 18px 20px; }
.an-card-pad h3 { margin: 0 0 6px; font-size: 15px; font-weight: 600; letter-spacing: -0.015em; }
.an-text { margin: 0 0 14px; color: var(--text2); font-size: 13px; line-height: 1.5; max-width: 62ch; }
.an-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.an-row .field { min-width: 220px; }
.an-reports { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.an-empty { padding: 28px 20px; color: var(--text2); font-size: 13px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.an-plot-skel { height: 190px; border-radius: 8px; background: var(--hover); animation: skel 1.2s ease-in-out infinite; }
.an-foot { padding: 10px 20px 14px; border-top: 1px solid var(--border); color: var(--text3); font-size: 12px; line-height: 1.45; }
.an-foot-page { border: 0; padding: 12px 2px 0; }
.an-note { color: var(--text3); font-size: 12px; margin-left: 4px; }
.link-btn { all: unset; cursor: pointer; color: var(--text2); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--border-strong); }
.link-btn:hover { color: var(--text); }
.link-btn:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: 3px; }

/* ranked rows: small bases are grey, never coloured as a result */
.an-rank.is-small .dash-rank-v, .an-rank.is-small .dash-rank-name { color: var(--text3); }
.an-rank.is-small .dash-rank-bar i { background: var(--text3); opacity: .35; }
.an-rank .dash-rank-bar i.warn { background: var(--amber); }
.an-rank .dash-rank-bar i.neg { background: var(--red); }

/* charts */
.dash-plot .an-bar { fill: var(--text); opacity: .78; }
.dash-plot .an-bar.muted { opacity: .28; }
.dash-plot .an-hover { fill: var(--hover-strong); opacity: .6; }
.dash-plot .an-ref { stroke: var(--signal); stroke-width: 1.5; stroke-dasharray: 5 4; }
.dash-plot .an-ref-l { fill: var(--signal-text, var(--signal)); font-size: 11px; font-family: var(--font-mono); }
.dash-plot .an-dot { fill: var(--text); stroke: var(--surface); stroke-width: 1.5; }
.dash-plot .an-dot.hollow { fill: var(--surface); stroke: var(--text); stroke-width: 1.5; }
.dash-legend .an-bar-key { width: 10px; height: 10px; border: 0; border-radius: 2px; background: var(--text); opacity: .78; }
.dash-legend .an-bar-key.muted { opacity: .28; }
.dash-legend .an-ref-key { border-top: 2px dashed var(--signal); }
.dash-legend .an-dot-key { width: 9px; height: 9px; border: 0; border-radius: 50%; background: var(--text); }
.dash-legend .an-dot-key.hollow { background: transparent; box-shadow: inset 0 0 0 1.5px var(--text); }
.dash-tip i.hollow { width: 8px; height: 8px; border: 1.5px solid var(--text); border-radius: 50%; }
.an-legend-row { align-items: center; flex-wrap: wrap; }
.an-filter { margin-left: auto; min-width: 200px; }

/* inline settings */
.an-inline { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; padding: 12px 20px 14px; border-top: 1px solid var(--border); background: var(--surface-2, var(--hover)); }
.an-inline .field { width: 160px; }

/* customers who are lapsing */
.an-lapse { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 20px; border-top: 1px solid var(--border); }
.an-lapse b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-lapse span { display: block; color: var(--text3); font-size: 12.5px; }
.an-lapse-v { text-align: right; font-variant-numeric: tabular-nums; }
.an-lapse-v b { color: var(--amber); }
.chip-warn { background: var(--amber-soft); color: var(--amber); }

.an-table td, .an-table th { white-space: nowrap; }
.an-table td:first-child { white-space: normal; }
.an-up { color: var(--green); }
.an-down { color: var(--red); }
.an-more { margin: 10px 20px 14px; }
.an-short td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
.an-weeks { display: inline-block; width: 44px; height: 3px; border-radius: 3px; background: var(--hover-strong); vertical-align: middle; margin-right: 8px; }
.an-weeks i { display: block; height: 100%; border-radius: 3px; background: var(--green); opacity: .6; }
.an-short .an-weeks i { background: var(--amber); opacity: .9; }

@media (max-width: 1100px) {
  .an-grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .an-reports { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .an-period { justify-content: flex-start; width: 100%; }
  .an-custom input { width: 130px; }
  .an-filter { margin-left: 0; width: 100%; }
  .an-inline .field { width: calc(50% - 5px); }
}
