/* Analytics: a reading hierarchy, with live charts and existing data bindings. */
.analytics-workspace { --an-gap: 16px; }
.an-report { margin-bottom: 18px; }
.an-report-header, .an-report-controls { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.an-report-header h2 { margin: 9px 0; font-size: clamp(24px, 3vw, 36px); text-wrap: balance; }
.an-report-header p, .an-history-caption { color: var(--text-muted); font-size: 12px; }
.an-report-controls { flex-wrap: wrap; margin-top: 18px; }
.an-periods { display: flex; flex-wrap: wrap; gap: 5px; }
.an-periods button { min-height: 44px; padding: 8px 14px; border: 0; border-radius: 9px; background: var(--surface-2); color: var(--text-muted); transition: background-color .15s, color .15s, transform .15s; }
.an-periods button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.an-periods button:active { transform: scale(.96); }
.an-periods button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.an-date-label { display: grid; gap: 5px; color: var(--text-muted); font-size: 11px; }
.an-date-label input { min-height: 44px; }
.an-report-status { font-size: 12px; line-height: 1.6; color: var(--text-muted); margin: 16px 0; }
.an-report-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; font-variant-numeric: tabular-nums; }
.an-report-cards article { display: flex; flex-direction: column; gap: 12px; padding: 24px; border-radius: 12px; background: var(--surface-2); min-width: 0; }
.an-report-cards article > span:first-child { font-size: 13px; }
.an-report-cards strong { font-size: clamp(26px, 3.2vw, 44px); line-height: 1.2; overflow-wrap: anywhere; letter-spacing: -.03em; }
.an-report-cards small { font-size: 11px; line-height: 1.6; color: var(--text-muted); }
.an-report-cards .an-report-money { grid-column: 1 / -1; background: #f3b744; color: #201a10; text-align: center; padding: 28px; }
.an-report-money strong { font-size: clamp(36px, 5vw, 64px); }
.an-report-money small { color: #514022; }
.an-report-details { margin-top: 18px; font-size: 12px; line-height: 1.75; color: var(--text-muted); }
.an-report-details summary { min-height: 44px; padding: 10px 0; cursor: pointer; color: var(--text); }
.an-report-details li { margin-bottom: 8px; }
.an-report-table { max-height: 390px; margin-top: 12px; font-variant-numeric: tabular-nums; }
.an-report-table th, .an-report-table td { white-space: nowrap; text-align: right; }
.an-report-table th:first-child, .an-report-table td:first-child { text-align: left; }
.an-report[aria-busy="true"] .an-report-cards { opacity: .5; }
@media (max-width: 600px) {
    .an-report-cards { grid-template-columns: 1fr; }
    .an-report-cards article { padding: 18px; }
    .an-report-controls { align-items: stretch; }
    .an-date-label { width: 100%; }
    .an-periods { width: 100%; }
    .an-periods button { flex: 1 0 28%; }
}
@media (prefers-reduced-motion: reduce) { .an-periods button { transition: none; } }
.an-jump-nav { display: flex; gap: 3px; padding: 4px; border-radius: 10px; background: var(--surface-2); overflow-x: auto; max-width: 100%; }
.an-jump-nav button { border: 0; background: transparent; cursor: pointer; display: flex; align-items: center; min-height: 36px; padding: 0 12px; color: var(--text-muted); border-radius: 7px; font-size: 11px; white-space: nowrap; transition: background-color .15s, color .15s; }
.an-jump-nav button:hover, .an-jump-nav button:focus-visible { color: var(--accent-2); background: var(--accent-soft); }
.an-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.an-summary-item { display: flex; flex-direction: column; gap: 8px; padding: 18px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-1); min-width: 0; }
.an-kicker { color: var(--text-muted); font-size: 11px; line-height: 1.5; display: flex; align-items: center; gap: 7px; }
.an-summary-item > strong { font-size: 29px; line-height: 1.15; font-weight: 600; letter-spacing: -.035em; overflow-wrap: anywhere; }
.an-summary-hint { font-size: 10px; color: var(--text-dim); margin-top: auto; }
.an-summary-accent { background: linear-gradient(145deg, #292531, var(--surface)); box-shadow: inset 0 0 0 1px var(--accent-line); }
.an-summary-accent > strong { color: var(--accent-2); }
.an-section-heading { display: flex; justify-content: space-between; align-items: end; gap: 14px; margin: 29px 0 14px; scroll-margin-top: 80px; }
.an-section-index { display: block; color: var(--text-dim); font-size: 9px; letter-spacing: .11em; margin-bottom: 6px; }
.an-section-heading h2 { margin: 0; font-size: 17px; font-weight: 550; letter-spacing: -.02em; }
.an-section-heading > span { color: var(--text-dim); font-size: 11px; }
.an-panel { min-width: 0; padding: 20px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-1); }
.an-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.an-panel-head h3 { margin: 0; font-size: 13px; font-weight: 550; letter-spacing: -.01em; }
.an-panel-head > span, .an-panel-head > i { font-size: 11px; color: var(--text-dim); }
.an-acquisition-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(260px, 1fr); gap: var(--an-gap); }
.an-funnel { display: grid; gap: 15px; }
.an-funnel-step { display: flex; gap: 13px; align-items: start; }
.an-step-index { flex: 0 0 24px; padding-top: 2px; font-size: 10px; color: var(--text-dim); font-family: var(--font-mono); }
.an-funnel-detail { flex: 1; min-width: 0; }
.an-funnel-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--text-muted); }
.an-funnel-row strong { font-size: 16px; color: var(--text); font-weight: 500; letter-spacing: -.02em; }
.an-funnel-track { height: 7px; overflow: hidden; border-radius: 5px; background: var(--surface-3); margin-top: 7px; }
.an-funnel-track > span { display: block; height: 100%; max-width: 100%; width: 0; border-radius: inherit; background: var(--accent); }
.an-funnel-origin > span { width: 100%; background: #555a70; }
.an-funnel-step:nth-child(2) .an-funnel-track > span { background: #9184d9; }
.an-funnel-step:nth-child(3) .an-funnel-track > span { background: #ad8ab5; }
.an-funnel-step:nth-child(5) .an-funnel-track > span { background: var(--success); }
.an-funnel-percentage { display: block; color: var(--text-dim); font-size: 10px; margin-top: 5px; }
.an-context-stack { display: grid; grid-template-rows: 1fr 1fr; gap: var(--an-gap); }
.an-context-value { display: block; font-size: 33px; letter-spacing: -.04em; font-weight: 550; margin: 12px 0 8px; }
.an-context-caption { color: var(--text-dim); font-size: 11px; }
.an-referral-panel .an-panel-head { margin-bottom: 24px; }
.an-plan-list { margin: 0; }
.an-plan-list > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; }
.an-plan-list > div + div { border-top: 1px solid var(--border); }
.an-plan-list dt { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 12px; font-weight: 400; }
.an-plan-list dd { margin: 0; font-size: 24px; font-weight: 500; letter-spacing: -.025em; }
.an-plan-dot { width: 7px; height: 7px; border-radius: 2px; background: var(--accent); }
.an-plan-list > div + div .an-plan-dot { background: var(--info); }
.an-finance-grid { display: grid; grid-template-columns: minmax(0, 2.15fr) minmax(230px, 1fr); gap: var(--an-gap); margin-bottom: var(--an-gap); }
.an-profit-panel { display: flex; flex-direction: column; background: linear-gradient(145deg, #232731, var(--surface)); }
.an-profit-panel > strong { font-size: clamp(27px, 2.5vw, 37px); font-weight: 550; letter-spacing: -.04em; margin: 27px 0 8px; overflow-wrap: anywhere; }
.an-profit-note { margin-top: auto; padding-top: 22px; display: flex; align-items: start; gap: 8px; color: var(--text-dim); font-size: 11px; line-height: 1.7; }
.an-profit-note > i { flex: 0 0 auto; }
.an-chart { height: 240px; position: relative; min-width: 0; }
.an-chart-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--an-gap); margin-bottom: var(--an-gap); }
.an-flow-chart, .an-cohort-chart { margin-bottom: var(--an-gap); }
.an-flow-chart .an-chart { height: 290px; }
.an-cohort-chart .an-chart { height: 270px; }
.an-forecast-panel { padding: 0; overflow: hidden; margin-bottom: 20px; }
.an-forecast-panel .an-panel-head { margin: 0; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.an-forecast-panel .table { font-size: 12px; }
.an-forecast-panel .table td:first-child, .an-forecast-panel .table th:first-child { text-align: left; }
@media (max-width: 1199.98px) {
    .an-summary-item { padding: 15px; }
    .an-summary-item > strong { font-size: 26px; }
    .an-acquisition-grid { grid-template-columns: minmax(0, 1.4fr) minmax(240px, 1fr); }
    .an-finance-grid { grid-template-columns: minmax(0, 1.7fr) minmax(220px, 1fr); }
}
@media (max-width: 767.98px) {
    .analytics-workspace { --an-gap: 12px; }
    .an-jump-nav { width: 100%; }
    .an-jump-nav button { min-height: 44px; flex: 1; justify-content: center; padding-inline: 9px; }
    .an-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .an-summary-item > strong { font-size: 25px; }
    .an-summary-hint { line-height: 1.5; }
    .an-section-heading { align-items: start; margin-top: 25px; }
    .an-section-heading > span { font-size: 10px; max-width: 105px; text-align: right; }
    .an-section-heading h2 { font-size: 16px; }
    .an-acquisition-grid, .an-finance-grid, .an-chart-pair { grid-template-columns: minmax(0, 1fr); }
    .an-panel { padding: 17px; }
    .an-context-stack { grid-template-rows: none; }
    .an-referral-panel .an-panel-head { margin-bottom: 18px; }
    .an-profit-panel > strong { margin-top: 18px; }
    .an-chart, .an-flow-chart .an-chart, .an-cohort-chart .an-chart { height: 245px; }
    .an-forecast-panel { padding: 0; }
}
