.analytics-page {
  --an-ink: #142942; --an-muted: #617288; --an-line: #dfe9ed; --an-blue: #1769cc;
  --an-green: #177b65; --an-surface: rgba(255,255,255,.94); --an-radius: 18px;
  margin: 0; color: var(--an-ink); font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: radial-gradient(ellipse at 0 0, #e7f1ff, transparent 55%), radial-gradient(ellipse at 100% 15%, #e6f7ef, transparent 45%), #f5f8fa;
  min-height: 100vh;
}
.analytics-page *, .analytics-page *::before, .analytics-page *::after { box-sizing: border-box; }
.analytics-page .dev-header { background: rgba(255,255,255,.9); border-bottom: 1px solid var(--an-line); box-shadow: none; }
.analytics-page #dataname { color: var(--an-ink); overflow: hidden; text-overflow: ellipsis; }
.analytics-wrapper { max-width: 1400px; margin: 34px auto 64px; padding: 0 28px; }
.an-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.an-eyebrow { color: var(--an-green); font-size: 10px; font-weight: 750; letter-spacing: .15em; margin: 0 0 9px; }
.an-heading h1 { font-size: clamp(26px, 3vw, 40px); line-height: 1.15; letter-spacing: -.045em; margin: 0 0 10px; font-weight: 650; }
.an-subhead, .an-muted { font-size: 13px; line-height: 1.65; color: var(--an-muted); margin: 8px 0 16px; }
.an-subhead { font-size: 14px; margin: 0; }
.an-card { padding: 24px; background: var(--an-surface); border: 1px solid var(--an-line); border-radius: var(--an-radius); box-shadow: 0 4px 24px rgba(27,57,79,.035); min-width: 0; }
.an-card h2 { font-size: 20px; font-weight: 650; letter-spacing: -.035em; line-height: 1.25; margin: 0 0 10px; }
.an-button, .an-text-button, .an-suggestions button {
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; min-height: 42px; border-radius: 10px;
}
.an-button { border: 1px solid transparent; background: var(--an-blue); color: white; padding: 10px 16px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; }
.an-button .material-symbols-outlined { font-size: 19px; }
.an-button-secondary { border-color: #d0dde6; background: white; color: var(--an-ink); }
.an-text-button { padding: 8px 12px; border: 0; background: transparent; color: var(--an-blue); }
.an-button:hover:not(:disabled) { filter: brightness(.94); }
.an-text-button:hover:not(:disabled) { background: #edf4fb; }
.analytics-page button:disabled { opacity: .5; cursor: not-allowed; }
.analytics-page :focus-visible { outline: 3px solid #6fa9df; outline-offset: 3px; }
.an-filter-card { padding: 18px 22px; }
.an-filter-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.an-filter-row label { flex: 1 1 135px; }
.analytics-wrapper label { display: grid; gap: 7px; color: #526479; font-size: 11px; font-weight: 650; }
.analytics-wrapper input, .analytics-wrapper select, .analytics-wrapper textarea {
  border: 1px solid #d9e3e9; border-radius: 9px; padding: 10px 12px; color: var(--an-ink);
  background: white; font: inherit; font-size: 13px; line-height: 1.45; width: 100%; min-width: 0; min-height: 42px;
}
.analytics-wrapper textarea { resize: vertical; margin: 8px 0; }
.an-advanced { margin-top: 14px; color: var(--an-muted); font-size: 12px; }
.an-advanced summary { cursor: pointer; padding: 5px 0; }
.an-advanced[open] summary { margin-bottom: 12px; }
.an-status-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 11px; color: var(--an-muted); margin: 14px 2px; min-height: 18px; }
.an-status-row p { margin: 0; }
.an-error { color: #b32932 !important; }
.an-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.an-metric { border: 1px solid var(--an-line); border-radius: 15px; background: white; padding: 20px 22px; display: grid; gap: 8px; }
.an-metric-label { color: #53677b; font-size: 12px; font-weight: 600; }
.an-metric strong { font-size: clamp(28px, 3vw, 38px); font-weight: 650; letter-spacing: -.05em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.an-metric small { font-size: 11px; color: var(--an-muted); line-height: 1.5; }
.an-metric-accent { background: linear-gradient(125deg, #edf9f3, #f7fcfa); border-color: #cce7dc; }
.an-metric-accent strong { color: var(--an-green); }
.an-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; align-items: start; }
.an-main-column { display: grid; gap: 22px; min-width: 0; }
.an-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.an-section-heading h2 { margin-bottom: 0; }
.an-badge { color: #526779; font-size: 10px; font-weight: 650; padding: 6px 9px; border-radius: 7px; background: #eef3f6; white-space: nowrap; }
.an-chart { min-height: 170px; height: 170px; display: flex; align-items: flex-end; gap: 4px; margin-top: 24px; padding-top: 12px; border-bottom: 1px solid var(--an-line); background: repeating-linear-gradient(to top, transparent 0, transparent 41px, #edf2f6 42px, transparent 43px); }
.an-chart-bar { min-width: 0; flex: 1; height: var(--bar-height); background: linear-gradient(to top, #458ed1, #7cbae0); border-radius: 4px 4px 0 0; min-height: 1px; }
.an-chart-bar:hover { background: #2077c4; }
.an-chart-axis { display: flex; justify-content: space-between; color: var(--an-muted); font-size: 10px; margin-top: 8px; }
.an-empty { color: var(--an-muted); padding: 28px 14px; text-align: center; font-size: 13px; line-height: 1.7; width: 100%; }
.an-event-controls { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(120px, .7fr) minmax(120px, .7fr); gap: 9px; margin: 18px 0 12px; }
.an-type-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.an-type-chip { display: flex; gap: 7px; align-items: center; border: 1px solid #e5edf1; padding: 5px 8px; border-radius: 7px; color: var(--an-muted); font-size: 10px; }
.an-type-chip strong { color: var(--an-ink); }
.an-table-wrap { overflow-x: auto; }
.an-table { width: 100%; border-collapse: collapse; font-size: 12px; text-align: left; }
.an-table th { padding: 11px 9px; background: #f5f8fa; color: #718092; font-weight: 600; font-size: 10px; white-space: nowrap; border-bottom: 1px solid var(--an-line); }
.an-table td { padding: 15px 9px; border-bottom: 1px solid #e9eff2; vertical-align: top; font-variant-numeric: tabular-nums; }
.an-table tr:last-child td { border-bottom: 0; }
.an-events-table td:first-child { min-width: 150px; width: 40%; overflow-wrap: anywhere; }
.an-events-table td:last-child { color: var(--an-muted); font-size: 10px; min-width: 100px; }
.an-event-detail summary { cursor: pointer; line-height: 1.5; font-weight: 650; }
.an-event-detail small { display: block; color: var(--an-muted); font-size: 10px; margin: 6px 0 0 15px; }
.an-event-detail ul { padding: 8px 0 0 15px; margin: 0; font-size: 10px; font-weight: normal; color: var(--an-muted); list-style: none; }
.an-event-detail li { padding: 4px 0; overflow-wrap: anywhere; }
.an-reach { min-width: 62px; }
.an-reach-track { background: #e8f2ee; height: 4px; border-radius: 5px; margin-top: 8px; }
.an-reach-fill { height: 100%; background: #3a9e82; border-radius: inherit; }
.an-pagination { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--an-muted); font-size: 11px; margin-top: 12px; }
.an-pagination > div { display: flex; gap: 3px; }
.an-footnote { color: var(--an-muted); font-size: 10px; line-height: 1.65; margin: 12px 0 0; }
.an-breakdown-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; }
.an-breakdown-row { margin: 16px 0; }
.an-breakdown-label { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.an-breakdown-label span:first-child { min-width: 0; overflow-wrap: anywhere; }
.an-breakdown-label span:last-child { flex-shrink: 0; color: var(--an-muted); font-size: 11px; }
.an-breakdown-track { height: 5px; background: #edf3f6; border-radius: 5px; margin-top: 8px; overflow: hidden; }
.an-breakdown-fill { height: 100%; background: #7eaecf; border-radius: inherit; }
.an-assistant { background: linear-gradient(155deg, #f2fbf7, white 65%); border-color: #cce3d9; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); column-gap: 32px; align-items: start; margin-bottom: 24px; }
.an-assistant-overview, .an-assistant-compose { min-width: 0; }
.an-assistant-overview .an-budget-box { margin-bottom: 0; }
.an-assistant > .an-assistant-status, .an-assistant > .an-answer { grid-column: 1 / -1; }
.an-assistant-icon { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; background: #ddf0e6; color: var(--an-green); border-radius: 12px; margin-bottom: 18px; }
.an-assistant h2 { font-size: 26px; letter-spacing: -.04em; }
.an-budget-box { background: rgba(255,255,255,.85); border: 1px solid #dbe9e1; border-radius: 12px; padding: 13px; margin: 20px 0; }
.an-budget-box > div:first-child { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; }
.an-budget-box a { color: var(--an-green); }
.an-budget-box p { color: var(--an-muted); font-size: 11px; line-height: 1.5; margin: 9px 0; }
.an-budget-track { height: 5px; background: #e5efea; border-radius: 5px; overflow: hidden; }
#assistant-budget-fill { height: 100%; width: 0; background: #3b9678; }
.an-suggestions { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 16px; }
.an-suggestions button { font-size: 10px; font-weight: 500; color: #476c60; border: 1px solid #d6e6dd; background: white; min-height: 32px; padding: 5px 9px; border-radius: 7px; }
.an-assistant-submit { background: #177b65; width: 100%; }
.an-assistant-status { font-size: 12px; line-height: 1.6; color: var(--an-green); margin: 16px 0 0; }
.an-answer { margin-top: 20px; padding-top: 18px; border-top: 1px solid #d6e6dd; }
#assistant-result-meta { font-size: 10px; color: var(--an-muted); line-height: 1.7; margin: 0 0 12px; }
#assistant-answer { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.8; }
.an-stale { font-size: 11px; line-height: 1.6; color: #866617; background: #fff8dc; padding: 10px; border-radius: 8px; }
.an-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.analytics-page [hidden] { display: none !important; }
@media (prefers-reduced-motion: no-preference) { .an-heading, .an-metrics { animation: an-arrive .35s ease-out; } @keyframes an-arrive { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } } }
@media (max-width: 1100px) { .an-layout { gap: 16px; } .an-card { padding: 19px; } .an-event-controls { grid-template-columns: 1fr 1fr; } .an-search-label { grid-column: 1 / -1; } .an-breakdown-grid { grid-template-columns: 1fr; } }
@media (max-width: 860px) { .an-layout { grid-template-columns: 1fr; } .an-assistant { grid-template-columns: minmax(0, 1fr); gap: 20px; } .an-assistant > .an-assistant-status, .an-assistant > .an-answer { margin-top: 0; } .an-breakdown-grid { grid-template-columns: 1fr 1fr; } .an-metrics { gap: 10px; } .an-metric { padding: 16px; } }
@media (max-width: 600px) {
  .analytics-wrapper { padding: 0 14px; margin-top: 22px; } .an-heading { align-items: flex-start; gap: 12px; flex-direction: column; }
  .an-card { padding: 17px; } .an-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } .an-filter-row { gap: 10px; }
  .an-filter-row label { flex-basis: calc(50% - 10px); } .an-filter-row > button { flex: 1; } .an-status-row { align-items: flex-start; flex-direction: column; gap: 5px; }
  .an-breakdown-grid { grid-template-columns: 1fr; } .an-chart { gap: 2px; height: 145px; min-height: 145px; }
  .an-events-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .an-events-table, .an-events-table tbody, .an-events-table tr { display: block; width: 100%; }
  .an-events-table tr { border: 1px solid var(--an-line); border-radius: 11px; padding: 13px; margin: 10px 0; }
  .an-events-table td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 0; border: 0; width: 100%; min-width: 0; font-size: 12px; }
  .an-events-table td:first-child { display: block; width: 100%; min-width: 0; padding-bottom: 12px; margin-bottom: 5px; border-bottom: 1px solid #edf2f5; }
  .an-events-table td:not(:first-child)::before { content: attr(data-label); color: var(--an-muted); font-size: 11px; }
  .an-reach { width: 80px; text-align: right; } .an-pagination { flex-wrap: wrap; }
}
