/* ------------------------------------------------------------------ */
/* Tokens — Axis Aceleradora design system (see /root/projects/axis-site/design.md) */
/* ------------------------------------------------------------------ */
.viz-root {
  color-scheme: light;

  /* brand */
  --ax-orange: #f04801;
  --ax-orange-light: #ff6a2b;
  --ax-orange-dark: #c03800;
  --ax-orange-tint: #fff0eb;
  --ax-navy: #020035;
  --ax-purple: #2100b2;
  --ax-purple-tint: #eee8ff;
  --ax-cream: #efecf0;
  --ax-success: #0f6e56;

  --surface-1: #ffffff;
  --surface-2: #ffffff;
  --page-plane: #f9f8fa;
  --text-primary: var(--ax-navy);
  --text-secondary: #5f5a68;
  --text-muted: #9b96a2;
  --gridline: #e2dfe5;
  --baseline: #c8c4cd;
  --border: #e2dfe5;
  --series-meta: var(--ax-purple);    /* dados analíticos */
  --series-google: var(--ax-orange);  /* métrica-chave */
  --series-meta-wash: rgba(33, 0, 178, 0.1);
  --series-google-wash: rgba(240, 72, 1, 0.1);
  --shadow-card: none;
  --shadow-card-hover: none;

  --font-display: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 12px;
  --radius-pill: 9999px;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .viz-root {
    color-scheme: dark;
    --surface-1: #0c0a24;
    --surface-2: #100e2c;
    --page-plane: #08061c;
    --text-primary: var(--ax-cream);
    --text-secondary: rgba(239, 236, 240, 0.72);
    --text-muted: rgba(239, 236, 240, 0.46);
    --gridline: rgba(255, 255, 255, 0.1);
    --baseline: rgba(255, 255, 255, 0.2);
    --border: rgba(255, 255, 255, 0.12);
    --series-meta: #8c74ff;
    --series-google: var(--ax-orange-light);
    --series-meta-wash: rgba(140, 116, 255, 0.16);
    --series-google-wash: rgba(255, 106, 43, 0.16);
  }
}
:root[data-theme="dark"] .viz-root {
  color-scheme: dark;
  --surface-1: #0c0a24;
  --surface-2: #100e2c;
  --page-plane: #08061c;
  --text-primary: var(--ax-cream);
  --text-secondary: rgba(239, 236, 240, 0.72);
  --text-muted: rgba(239, 236, 240, 0.46);
  --gridline: rgba(255, 255, 255, 0.1);
  --baseline: rgba(255, 255, 255, 0.2);
  --border: rgba(255, 255, 255, 0.12);
  --series-meta: #8c74ff;
  --series-google: var(--ax-orange-light);
  --series-meta-wash: rgba(140, 116, 255, 0.16);
  --series-google-wash: rgba(255, 106, 43, 0.16);
}

/* ------------------------------------------------------------------ */
/* Base                                                                */
/* ------------------------------------------------------------------ */
* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page-plane);
  color: var(--text-primary);
  font-family: var(--font-body);
  padding: clamp(1.25rem, 1rem + 2vw, 3rem) clamp(1.25rem, 1rem + 3vw, 4rem);
}

.main { max-width: 1180px; margin: 0 auto; transition: opacity 200ms ease; }
.main.is-loading { opacity: 0.55; }

/* ------------------------------------------------------------------ */
/* Header — asymmetric, editorial scale                                */
/* ------------------------------------------------------------------ */
.page-header {
  max-width: 1180px;
  margin: 0 auto clamp(1.5rem, 1rem + 2vw, 2.5rem);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ax-orange);
  margin-bottom: 0.5rem;
}

.eyebrow::before {
  content: "";
  display: inline-block;
  width: 20px;
  height: 2px;
  background: var(--ax-orange);
  flex-shrink: 0;
}

.page-header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 1.5rem + 2vw, 2.9rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.subtitle {
  margin: 0.35rem 0 0;
  color: var(--text-secondary);
  font-size: 1rem;
}

.page-header__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
}

.as-of {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.refresh-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.refresh-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ax-success);
  box-shadow: 0 0 0 0 rgba(15, 110, 86, 0.5);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(15, 110, 86, 0.35); }
  50% { box-shadow: 0 0 0 5px rgba(15, 110, 86, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .refresh-dot { animation: none; }
}

/* ------------------------------------------------------------------ */
/* Filter row                                                          */
/* ------------------------------------------------------------------ */
.filter-row {
  max-width: 1180px;
  margin: 0 auto 1.75rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}


/* ------------------------------------------------------------------ */
/* Date picker — GA4-style: single trigger, presets + custom range     */
/* ------------------------------------------------------------------ */
.date-picker__backdrop {
  position: fixed;
  inset: 0;
  z-index: 15;
  background: rgba(2, 0, 53, 0.45);
  backdrop-filter: blur(1px);
}
.date-picker__backdrop[hidden] { display: none; }

.date-picker { position: relative; display: inline-block; z-index: 16; }

.date-picker__trigger {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text-primary);
  font: inherit;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 0.85rem 0.5rem 0.75rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.date-picker__trigger:hover { border-color: var(--ax-navy); }
.date-picker__trigger:focus-visible { outline: 2px solid var(--ax-orange); outline-offset: 2px; }
.date-picker__trigger[aria-expanded="true"] {
  border-color: var(--ax-orange);
  background: var(--series-google-wash);
}

.date-picker__icon { color: var(--text-muted); flex-shrink: 0; }
.date-picker__trigger[aria-expanded="true"] .date-picker__icon { color: var(--ax-orange); }
.date-picker__chevron { color: var(--text-muted); flex-shrink: 0; transition: transform 150ms ease; }
.date-picker__trigger[aria-expanded="true"] .date-picker__chevron { transform: rotate(180deg); }

.date-picker__panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  z-index: 20;
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 56px -20px rgba(2, 0, 53, 0.32);
  overflow: hidden;
  min-width: 460px;
}
.date-picker__panel[hidden] { display: none; }

.date-picker__presets {
  list-style: none;
  margin: 0;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  width: 168px;
  border-right: 1px solid var(--gridline);
  background: var(--page-plane);
}

.date-picker__presets button {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.date-picker__presets button:hover { background: var(--surface-2); color: var(--text-primary); }
.date-picker__presets button:focus-visible { outline: 2px solid var(--ax-orange); outline-offset: -2px; }
.date-picker__presets button.is-selected {
  background: var(--ax-navy);
  color: var(--ax-cream);
  font-weight: 700;
}

.date-picker__custom {
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 240px;
}

.date-picker__custom-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ax-orange);
}

.date-picker__field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.date-picker__field label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.date-picker__field input[type="date"] {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--page-plane);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.6rem;
  outline: none;
  cursor: pointer;
  color-scheme: inherit;
  width: 100%;
}
.date-picker__field input[type="date"]:focus-visible {
  border-color: var(--ax-orange);
  box-shadow: 0 0 0 3px var(--series-google-wash);
}

.date-picker__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.date-picker__btn {
  appearance: none;
  border: none;
  font: inherit;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 120ms ease, transform 100ms ease, border-color 120ms ease;
}
.date-picker__btn:active { transform: scale(0.97); }
.date-picker__btn:focus-visible { outline: 2px solid var(--ax-navy); outline-offset: 2px; }

.date-picker__btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}
.date-picker__btn--ghost:hover { border-color: var(--ax-navy); color: var(--text-primary); }

.date-picker__btn--primary { background: var(--ax-orange); color: #fff; }
.date-picker__btn--primary:hover { background: var(--ax-orange-dark); }

@media (max-width: 560px) {
  .date-picker__panel { flex-direction: column; min-width: 260px; }
  .date-picker__presets { width: 100%; border-right: none; border-bottom: 1px solid var(--gridline); flex-direction: row; flex-wrap: wrap; }
}

/* ------------------------------------------------------------------ */
/* Stat tiles — bento row                                              */
/* ------------------------------------------------------------------ */
.stat-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 720px) {
  .stat-row { grid-template-columns: 1fr; }
}

.stat-tile {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: border-color 150ms ease, transform 200ms ease;
}

.stat-tile:hover { border-color: var(--ax-navy); transform: translateY(-2px); }

.stat-tile--total {
  background: var(--ax-navy);
  color: var(--ax-cream);
  border-color: var(--ax-navy);
}
.stat-tile--total:hover { border-color: var(--ax-orange); }
.stat-tile--total .stat-tile__label { color: rgba(239, 236, 240, 0.65); }

.stat-tile__swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  position: absolute;
  top: 1.4rem;
  right: 1.5rem;
}
.stat-tile__swatch--meta { background: var(--series-meta); }
.stat-tile__swatch--google { background: var(--series-google); }

.stat-tile__label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-tile__value {
  font-family: var(--font-mono);
  font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.3rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: proportional-nums;
}

/* ------------------------------------------------------------------ */
/* Chart card                                                          */
/* ------------------------------------------------------------------ */
.chart-card, .table-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  transition: border-color 150ms ease;
}
.chart-card:hover, .table-card:hover { border-color: var(--baseline); }

.chart-card__header, .table-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.chart-card__header h2, .table-card__header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.legend {
  list-style: none;
  display: flex;
  gap: 1.1rem;
  margin: 0;
  padding: 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.legend li { display: flex; align-items: center; gap: 0.4rem; }

.legend__key {
  display: inline-block;
  width: 14px;
  height: 2px;
  border-radius: 1px;
}
.legend__key--meta { background: var(--series-meta); }
.legend__key--google { background: var(--series-google); }

.chart-wrap { position: relative; }

.chart { width: 100%; height: 260px; display: block; overflow: visible; }

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--ax-navy);
  color: var(--ax-cream);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  box-shadow: 0 8px 20px -8px rgba(2, 0, 53, 0.35);
  transform: translate(-50%, calc(-100% - 10px));
  white-space: nowrap;
  z-index: 5;
}

.chart-tooltip__date {
  font-weight: 700;
  margin-bottom: 0.3rem;
  color: rgba(255, 255, 255, 0.7);
}

.chart-tooltip__row { display: flex; align-items: center; gap: 0.4rem; }
.chart-tooltip__row + .chart-tooltip__row { margin-top: 0.15rem; }
.chart-tooltip__key { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.chart-tooltip__value { font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-tooltip__label { color: rgba(255, 255, 255, 0.65); }

/* ------------------------------------------------------------------ */
/* Table                                                               */
/* ------------------------------------------------------------------ */
.table-view-toggle {
  appearance: none;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--ax-navy);
  font: inherit;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
.table-view-toggle:hover { background: var(--series-google-wash); border-color: var(--ax-orange); }
.table-view-toggle:focus-visible { outline: 2px solid var(--ax-orange); outline-offset: 2px; }

.table-scroll { overflow-x: auto; }

.client-table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 0.9rem; }

.client-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0 0.6rem 0.6rem;
  border-bottom: 1px solid var(--gridline);
}

.client-table th.num, .client-table td.num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.client-table td {
  padding: 0.7rem 0.6rem;
  border-bottom: 1px solid var(--gridline);
}

.client-table tbody tr { transition: background 120ms ease; }
.client-table tbody tr:hover { background: var(--series-google-wash); }
.client-table tbody tr:last-child td { border-bottom: none; }

.client-table tr.is-unattributed { color: var(--text-muted); font-style: italic; }

.client-name { font-family: var(--font-display); font-weight: 700; color: var(--text-primary); }
.is-unattributed .client-name { font-weight: 600; color: var(--text-muted); }

.share-col { width: 160px; }

.share-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--gridline);
  min-width: 100px;
}
.share-bar__meta { background: var(--series-meta); }
.share-bar__google { background: var(--series-google); }

.empty-row td {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 0;
}

.client-table tbody tr.hidden-row { display: none; }

.data-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 62ch;
  line-height: 1.5;
}

.data-note code {
  background: var(--gridline);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.78em;
}

/* ------------------------------------------------------------------ */
/* Chart SVG internals                                                 */
/* ------------------------------------------------------------------ */
.chart-grid { stroke: var(--gridline); stroke-width: 1; }
.chart-baseline { stroke: var(--baseline); stroke-width: 1; }

.chart-axis-label {
  fill: var(--text-muted);
  font-size: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
.chart-axis-label--x { text-anchor: middle; }

.chart-line { stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart-line--meta { stroke: var(--series-meta); }
.chart-line--google { stroke: var(--series-google); }

.chart-crosshair { stroke: var(--baseline); stroke-width: 1; }

.chart-dot { stroke: var(--surface-2); stroke-width: 2; }
.chart-dot--meta { fill: var(--series-meta); }
.chart-dot--google { fill: var(--series-google); }

.chart-tooltip__key--meta { background: var(--series-meta); }
.chart-tooltip__key--google { background: var(--series-google); }

/* ------------------------------------------------------------------ */
/* Login screen                                                        */
/* ------------------------------------------------------------------ */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl, 16px);
  box-shadow: 0 20px 48px -20px rgba(2, 0, 53, 0.18);
  padding: 2.5rem 2.25rem;
  max-width: 380px;
  width: 100%;
  text-align: center;
}

.login-card .eyebrow { justify-content: center; }

.login-card h1 {
  margin: 0.4rem 0 0.6rem;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.login-card .subtitle {
  margin: 0 0 1.75rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  background: var(--ax-orange);
  color: #fff;
  text-decoration: none;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  transition: transform 100ms ease, background 120ms ease;
}

.google-btn:hover { background: var(--ax-orange-dark); }
.google-btn:active { transform: scale(0.97); }
.google-btn:focus-visible { outline: 2px solid var(--ax-navy); outline-offset: 2px; }
.google-btn svg { background: #fff; border-radius: var(--radius-sm); padding: 2px; flex-shrink: 0; }

/* ------------------------------------------------------------------ */
/* User chip (dashboard header)                                        */
/* ------------------------------------------------------------------ */
.user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.user-chip img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
}

.user-chip__email {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.user-chip__logout {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.user-chip__logout:hover { color: var(--text-primary); }
