/* Reporting › Attribution Report (public/attribution-report.js). Colours come
   from the theme variables, so Midnight and Daylight restyle it for free. */

.ar { display: flex; flex-direction: column; gap: 16px; transition: opacity .15s; }
.ar.busy .ar-kpis, .ar.busy .ar-panel { opacity: .6; }
.ar-events.busy .ar-events-body { opacity: .55; }
.ar-title { margin: 4px 0 0; font-size: 22px; font-weight: 600; }
.ar-muted { color: var(--muted); }
.ar-loading { padding: 40px 16px; text-align: center; color: var(--muted); }
.ar-empty { padding: 56px 16px; text-align: center; font-size: 15px; font-weight: 600; color: var(--muted); }
.ar-error { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px; border: 1px solid var(--red); border-radius: var(--radius); color: var(--red); }

/* ----- buttons, fields ----- */
.ar-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 13.5px; line-height: 1.3; }
.ar-btn:hover:not(:disabled) { background: var(--hover); }
.ar-btn:focus-visible, .ar-range-btn:focus-visible, .ar-day:focus-visible, .ar-tab:focus-visible, .ar-multi-field:focus-visible, .ar-switch:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ar-btn:disabled { opacity: .5; cursor: not-allowed; }
.ar-btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.ar-btn.primary:hover:not(:disabled) { background: var(--brand); filter: brightness(1.08); }
.ar-model.on { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.ar-icon-btn { padding: 8px; }
.ar-select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 13.5px; }
.ar-input { width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 13.5px; }
.ar-field-label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.ar-link { color: var(--brand); display: inline-flex; align-items: center; }
.ar-link:hover { text-decoration: underline; }
.ar-badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.ar-badge[hidden] { display: none; }

/* ----- toolbar and date range ----- */
.ar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ar-toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ar-sep { width: 1px; height: 28px; background: var(--line); }
.ar-range { position: relative; }
.ar-range-btn { display: inline-flex; align-items: center; gap: 14px; padding: 8px 14px; min-width: 300px; justify-content: space-between; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 14px; }
.ar-range-btn[aria-expanded="true"], .ar-range-btn:hover { border-color: var(--brand); }
.ar-range-date { min-width: 84px; }
.ar-cal { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; padding: 14px 16px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 12px 32px rgba(16, 24, 40, .18); }
.ar-cal[hidden] { display: none; }
.ar-months { display: flex; gap: 28px; }
.ar-month { width: 252px; }
.ar-month-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.ar-month-title { flex: 1; text-align: center; font-weight: 600; }
.ar-nav { display: inline-flex; padding: 4px; border: 0; border-radius: 6px; background: none; color: var(--muted); }
.ar-nav:hover { background: var(--hover); color: var(--text); }
.ar-nav-gap { width: 48px; }
.ar-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; }
.ar-dow { padding: 4px 0 6px; text-align: center; font-size: 12px; color: var(--muted); }
.ar-day { height: 34px; border: 0; background: none; color: var(--brand); font-size: 13.5px; border-radius: 0; }
.ar-day.out { color: var(--dim); opacity: .55; cursor: default; }
.ar-day:hover:not(:disabled) { background: var(--hover); }
.ar-day.mid { background: var(--brand-soft); }
.ar-day.today { font-weight: 700; text-decoration: underline; }
.ar-day.edge { background: var(--brand); color: #fff; }
.ar-day.edge.start { border-radius: 17px 0 0 17px; }
.ar-day.edge.end { border-radius: 0 17px 17px 0; }
.ar-day.edge.start.end { border-radius: 17px; }
.ar-cal-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.ar-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.ar-chip { padding: 5px 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); font-size: 12.5px; }
.ar-chip:hover { border-color: var(--brand); color: var(--brand); }

/* ----- headline numbers ----- */
.ar-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; transition: opacity .15s; }
.ar-kpi { padding: 22px 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.ar-kpi-ico { display: inline-flex; padding: 12px; margin-bottom: 14px; border-radius: 50%; background: var(--hover); color: var(--text); }
.ar-kpi-label { font-size: 16px; color: var(--muted); }
.ar-kpi-value { margin-top: 4px; font-size: 32px; font-weight: 600; line-height: 1.2; }

/* ----- tabs ----- */
.ar-tabs, .ar-subtabs { display: flex; gap: 28px; border-bottom: 1px solid var(--line); }
.ar-subtabs { margin-bottom: 18px; }
.ar-tab { padding: 10px 2px 11px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; color: var(--text); font-weight: 600; font-size: 14px; }
.ar-tab:hover { color: var(--brand); }
.ar-tab.on { color: var(--brand); border-bottom-color: var(--brand); }
.ar-panel { display: flex; flex-direction: column; gap: 16px; transition: opacity .15s; }

/* ----- cards ----- */
.ar-card { padding: 20px 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.ar-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.ar-card-title { margin: 0; font-size: 17px; font-weight: 600; }
.ar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ar-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ar-grid2 .ar-card-title { margin-bottom: 12px; }
.ar-split { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(0, 2fr); gap: 24px; align-items: start; }
.ar-scroll { overflow: auto; }
.ar-scroll.tall { max-height: 560px; }
.ar-table th { white-space: nowrap; position: sticky; top: 0; background: var(--surface); }
.ar-table td { vertical-align: top; }

/* ----- charts ----- */
.ar-chart { position: relative; }
.ar-chart svg { display: block; width: 100%; height: auto; }
.ar-chart-note { position: absolute; inset: 0 0 38px 64px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 600; pointer-events: none; }
.ar-grid-line { stroke: var(--line); stroke-width: 1; }
.ar-axis { fill: var(--muted); font-size: 12px; }
.ar-bar { fill: var(--brand); }
.ar-bar:hover { filter: brightness(1.15); }
.ar-hbars { display: flex; flex-direction: column; gap: 10px; }
.ar-hbar { display: grid; grid-template-columns: minmax(110px, 190px) 1fr minmax(84px, auto); gap: 12px; align-items: center; font-size: 13.5px; }
.ar-hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-hbar-track { height: 12px; border-radius: 6px; background: var(--hover); overflow: hidden; }
.ar-hbar-fill { height: 100%; border-radius: 6px; background: var(--brand); }
.ar-hbar-val { text-align: right; font-variant-numeric: tabular-nums; }
.ar-hbar-pct { color: var(--muted); }

/* ----- opportunities ----- */
.ar-opps { display: flex; flex-direction: column; gap: 16px; }
.ar-opps-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ar-multi-wrap { flex: 0 1 380px; min-width: 240px; }
.ar-multi { position: relative; }
.ar-multi-field { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; width: 100%; min-height: 42px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); text-align: left; }
.ar-multi-field > .ico:last-child { margin-left: auto; }
.ar-chip-sel { padding: 3px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--hover); font-size: 13.5px; }
.ar-switch-wrap { display: flex; align-items: center; gap: 10px; }
.ar-switch { position: relative; width: 44px; height: 24px; padding: 0; border: 0; border-radius: 12px; background: var(--dim); transition: background .15s; }
.ar-switch[aria-checked="true"] { background: var(--brand); }
.ar-switch-knob { position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.ar-switch[aria-checked="true"] .ar-switch-knob { transform: translateX(20px); }
.ar-pipes { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0; }
.ar-pipe { padding: 4px 24px 8px; min-width: 0; }
.ar-pipe + .ar-pipe { border-left: 1px solid var(--line); }
.ar-pipe:first-child { padding-left: 0; }
.ar-pipe-sum { margin: 2px 0 16px; font-size: 13px; color: var(--muted); }

/* ----- menus ----- */
.ar-pop-wrap { position: relative; }
.ar-menu { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; min-width: 100%; max-height: 380px; overflow: auto; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 12px 32px rgba(16, 24, 40, .18); }
.ar-menu[hidden] { display: none; }
.ar-menu.right { left: auto; right: 0; min-width: 200px; }
.ar-menu.wide { width: 320px; padding: 14px; }
.ar-menu-empty { padding: 8px; color: var(--muted); }
.ar-menu-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.ar-check { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; font-size: 13.5px; cursor: pointer; }
.ar-check:hover { background: var(--hover); }
.ar-fieldset { margin: 12px 0 0; padding: 0; border: 0; }
.ar-fieldset legend { padding: 0; font-size: 13px; font-weight: 600; color: var(--muted); }

/* ----- session events ----- */
.ar-events-table td, .ar-events-table th { padding: 12px 10px; }
.ar-c-type, .ar-c-source { min-width: 90px; }
.ar-c-referrer { max-width: 190px; }
.ar-ref { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; }
.ar-c-createdAt { white-space: nowrap; }
.ar-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.ar-pager-btns { display: flex; gap: 8px; align-items: center; }

@media (max-width: 860px) {
  .ar-kpis, .ar-grid2, .ar-split { grid-template-columns: 1fr; }
  .ar-months { flex-direction: column; gap: 12px; }
  .ar-month:nth-child(2) .ar-month-head { margin-top: 0; }
  .ar-cal { max-width: calc(100vw - 32px); }
  .ar-range-btn { min-width: 0; width: 100%; }
  .ar-range { width: 100%; }
  .ar-pipe, .ar-pipe:first-child { padding-left: 0; padding-right: 0; }
  .ar-pipe + .ar-pipe { border-left: 0; border-top: 1px solid var(--line); padding-top: 16px; margin-top: 8px; }
  .ar-hbar { grid-template-columns: minmax(90px, 130px) 1fr minmax(70px, auto); }
}
@media (prefers-reduced-motion: reduce) { .ar, .ar-kpis, .ar-panel, .ar-switch, .ar-switch-knob { transition: none; } }
