/* /admin analytics dashboard. Same visual language as the public site
   (main.css / custom.css): dark #02050a base, brand green #16A34A with the
   yellow #ffc226 accent, Plus Jakarta Sans, Monday Pro brand word, photo
   page header with the green corner shape. Everything is scoped to .ad. */

.ad {
  --ad-bg: #02050a;
  --ad-surface: #0b0f15;
  --ad-surface-2: #11151c;
  --ad-border: #1e2228;
  --ad-border-strong: #2d343e;
  --ad-ink: #ffffff;
  --ad-ink-2: #b0b2b7;
  --ad-muted: #8a8e94;
  --ad-primary: #16a34a;
  --ad-primary-hover: #15803d;
  --ad-primary-ink: #4ade80;
  --ad-primary-soft: rgba(22, 163, 74, .12);
  --ad-primary-line: rgba(74, 222, 128, .4);
  --ad-accent: #ffc226;
  --ad-danger: #f87171;
  --ad-danger-soft: rgba(248, 113, 113, .12);
  --ad-track: #1a1f26;
  --ad-grid: #1b2027;
  --ad-shadow: 0 24px 48px -24px rgba(0, 0, 0, .6);
  --ad-glow: 0 0 0 1px rgba(22, 163, 74, .55), 0 18px 40px -18px rgba(22, 163, 74, .45);
  --ad-heat0: #12171e;
  --ad-heat1: #0f3b22;
  --ad-heat2: #126a35;
  --ad-heat3: #16a34a;
  --ad-heat4: #4ade80;
  /* Chart palette: brand green and yellow first, then calm supporting hues. */
  --ad-c1: #16a34a;
  --ad-c2: #ffc226;
  --ad-c3: #60a5fa;
  --ad-c4: #a78bfa;
  --ad-c5: #2dd4bf;
  --ad-c6: #fb7185;
  --ad-c7: #8a8e94;
  --ad-side-w: 264px;
  --ad-radius: 10px;
  --ad-radius-sm: 6px;
  --ad-ease: cubic-bezier(.2, .7, .2, 1);
  --ad-font: var(--rr-ff-body, 'Plus Jakarta Sans', sans-serif);

  display: block;
  min-height: 100vh;
  background: var(--ad-bg);
  color: var(--ad-ink-2);
  font-family: var(--ad-font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

[data-theme=light] .ad {
  --ad-bg: #f2f3f4;
  --ad-surface: #ffffff;
  --ad-surface-2: #f8f8f8;
  --ad-border: #e4e4e4;
  --ad-border-strong: #d4d6d9;
  --ad-ink: #11151c;
  --ad-ink-2: #4b5563;
  --ad-muted: #5f6672;
  --ad-primary-ink: #15803d;
  --ad-primary-soft: rgba(22, 163, 74, .1);
  --ad-primary-line: rgba(22, 163, 74, .35);
  --ad-danger: #dc2626;
  --ad-danger-soft: rgba(220, 38, 38, .08);
  --ad-track: #eceef0;
  --ad-grid: #e8eaed;
  --ad-shadow: 0 20px 40px -24px rgba(17, 21, 28, .18);
  --ad-glow: 0 0 0 1px rgba(22, 163, 74, .5), 0 18px 40px -20px rgba(22, 163, 74, .35);
  --ad-heat0: #eef0f2;
  --ad-heat1: #c6ebd3;
  --ad-heat2: #7fd19e;
  --ad-heat3: #22a55a;
  --ad-heat4: #12703a;
  --ad-c2: #d99a00;
  --ad-c3: #3b82f6;
  --ad-c4: #8b5cf6;
  --ad-c5: #0d9488;
  --ad-c6: #e11d48;
  --ad-c7: #8a8e94;
}

/* Page chrome from the public layout that the dashboard doesn't use. */
html:has(.ad) { scroll-padding-top: 96px }
html:has(.ad) body { background: var(--ad-page-bg, #02050a) }
[data-theme=light]:has(.ad) body { background: #f2f3f4 }
body:has(.ad) #smooth-content { padding-top: 0 }
body:has(.ad) .xe-wa-fab, body:has(.ad) #xtro-ai-chat-widget, body:has(.ad) #scroll-top, body:has(.ad) #scroll-percentage { display: none !important }

/* Reset the template's global heading / paragraph / list styles. */
.ad h1, .ad h2, .ad h3, .ad h4 { color: var(--ad-ink); font-family: var(--ad-font); margin: 0; letter-spacing: -.01em }
.ad p { color: inherit; margin: 0; line-height: 1.6 }
.ad ul, .ad ol { list-style: none; margin: 0; padding: 0 }
.ad a { color: inherit; text-decoration: none; transition: color .16s ease }
.ad button { font-family: inherit; cursor: pointer }
.ad button:disabled { cursor: not-allowed }
.ad code { font-size: .9em; padding: 1px 6px; border-radius: 4px; background: var(--ad-surface-2); border: 1px solid var(--ad-border); color: var(--ad-ink) }
.ad :focus-visible { outline: 2px solid var(--ad-primary-ink); outline-offset: 2px }
.ad-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0 }
.ad-defs { position: absolute; width: 0; height: 0; overflow: hidden }
.ad-container { width: 100%; max-width: 1312px; margin: 0 auto; padding: 0 32px }

/* ---------- Header ---------- */
.ad-header {
  --hd-ink: #fff; --hd-ink-2: rgba(255, 255, 255, .72); --hd-line: rgba(255, 255, 255, .16);
  position: fixed; inset: 0 0 auto; z-index: 50;
  border-bottom: 1px solid transparent;
  transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.ad-header.is-solid { background: rgba(2, 5, 10, .92); border-bottom-color: #1e2228; backdrop-filter: saturate(140%) blur(10px) }
[data-theme=light] .ad-header.is-solid { --hd-ink: #11151c; --hd-ink-2: #4b5563; --hd-line: #e4e4e4; background: rgba(255, 255, 255, .94); border-bottom-color: #e4e4e4; box-shadow: 0 8px 24px -16px rgba(17, 21, 28, .25) }
.ad-header-inner { display: flex; align-items: center; gap: 32px; height: 88px; transition: height .2s ease }
.ad-header.is-solid .ad-header-inner { height: 72px }
.ad-logo { display: inline-flex; flex-shrink: 0 }
.ad-logo img, .ad-footer-brand img { height: 40px; width: auto; display: block }
.ad-logo-green { display: none !important }
[data-theme=light] .ad-header.is-solid .ad-logo-white, [data-theme=light] .ad-footer .ad-logo-white { display: none !important }
[data-theme=light] .ad-header.is-solid .ad-logo-green, [data-theme=light] .ad-footer .ad-logo-green { display: block !important }

.ad-header-right { display: flex; align-items: center; gap: 16px; margin-left: auto }
/* Square icon button; the dark variant sits on the photo header. */
.ad-icon-btn { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; padding: 0; border: 1px solid var(--ad-border-strong); border-radius: 0; background: transparent; color: var(--ad-ink); font-size: 15px; transition: border-color .16s ease, background-color .16s ease, color .16s ease }
.ad-icon-btn:hover { border-color: var(--ad-primary); background: var(--ad-primary); color: #fff }
.ad-icon-btn-dark { width: 44px; height: 44px; border-color: var(--hd-line); color: var(--hd-ink) }
.ad-back { display: inline-flex; align-items: center; gap: 8px; color: var(--hd-ink) !important; font-size: 14px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase }
.ad-back:hover { color: var(--ad-primary) !important }

/* ---------- Hero (site page header) ---------- */
.ad-hero { position: relative; z-index: 1; overflow: hidden; background: #02050a url("../img/bg-img/page-header-bg.jpg") center / cover no-repeat; color: #b0b2b7 }
.ad-hero-overlay { position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(2, 5, 10, .86) 0%, rgba(2, 5, 10, .8) 60%, rgba(2, 5, 10, .9) 100%) }
.ad-hero-shape { position: absolute; left: 0; bottom: 0; z-index: -1; width: 200px; height: auto; pointer-events: none }
.ad-hero-inner { padding: 176px 32px 72px }
.ad-hero-full .ad-hero-inner { min-height: 100vh; display: flex; align-items: center; padding-top: 128px; padding-bottom: 64px }
.ad-crumb { display: flex; align-items: center; gap: 12px; margin-bottom: 16px !important; font-size: 14px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #fff }
.ad-crumb a { color: #b0b2b7 }
.ad-crumb a:hover { color: var(--ad-primary) }
.ad-crumb i { font-size: 11px; color: var(--ad-primary) }
.ad .ad-title { position: relative; z-index: 1; display: inline-block; color: #fff; font-size: clamp(36px, 5.2vw, 60px); font-weight: 600; line-height: 1.15; letter-spacing: -.02em }
.ad-brand { position: relative; display: inline-block; padding: 0 12px 0 4px; font-family: "Monday Pro", var(--ad-font); font-weight: 400; letter-spacing: 0 }
.ad-brand::before { content: ""; position: absolute; inset: 15% 0 9% 0; z-index: -1; background: linear-gradient(270deg, #16a34a 0%, transparent 100%); opacity: .95 }
.ad-hero-sub { max-width: 620px; text-wrap: pretty; margin-top: 16px !important; color: #b0b2b7; font-size: 17px; line-height: 1.65 !important }
.ad-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 40px }
.ad-range, .ad-tabs { display: inline-flex; flex-wrap: wrap; border: 1px solid rgba(255, 255, 255, .14); background: rgba(2, 5, 10, .55) }
.ad-range button, .ad-tabs button { min-height: 48px; padding: 0 24px; border: 0; background: transparent; color: #fff; font-size: 14px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; transition: background-color .16s ease, color .16s ease }
.ad-range button + button, .ad-tabs button + button { border-left: 1px solid rgba(255, 255, 255, .1) }
.ad-range button:hover { background: rgba(22, 163, 74, .18) }
.ad-range button.is-active, .ad-tabs button.is-active { background: var(--ad-primary); color: #fff }
.ad-updated { display: inline-flex; align-items: center; gap: 8px; color: #b0b2b7; font-size: 14px }
.ad-updated i { color: var(--ad-primary) }

/* Buttons (square like the site's "Get A Free Quote") */
.ad-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 24px; border: 1px solid transparent; border-radius: 0; font-size: 15px; font-weight: 700; line-height: 1; white-space: nowrap; transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease }
.ad-btn:active:not(:disabled) { transform: translateY(1px) }
.ad-btn:disabled { opacity: .6 }
.ad-btn-primary { background: var(--ad-primary); color: #fff !important }
.ad-btn-primary:hover:not(:disabled) { background: var(--ad-primary-hover) }
.ad-btn-outline { border-color: rgba(255, 255, 255, .22); background: rgba(2, 5, 10, .4); color: #fff }
.ad-btn-outline:hover:not(:disabled) { border-color: var(--ad-primary); color: #fff; background: rgba(22, 163, 74, .18) }
.ad-body .ad-btn-outline, .ad-filterbar .ad-btn-outline { border-color: var(--ad-border-strong); background: transparent; color: var(--ad-ink) }
.ad-body .ad-btn-outline:hover:not(:disabled), .ad-filterbar .ad-btn-outline:hover:not(:disabled) { border-color: var(--ad-primary); background: var(--ad-primary-soft); color: var(--ad-ink) }
.ad-btn-sm { min-height: 36px; padding: 0 16px; font-size: 13px }
.ad-btn-block { width: 100% }
.ad-btn-ghost { background: transparent; color: #b0b2b7 }
.ad-btn-ghost:hover:not(:disabled) { color: #fff; background: rgba(255, 255, 255, .06) }
.ad-body .ad-btn-ghost, .ad-filterbar .ad-btn-ghost { color: var(--ad-ink-2) }
.ad-body .ad-btn-ghost:hover:not(:disabled), .ad-filterbar .ad-btn-ghost:hover:not(:disabled) { color: var(--ad-ink); background: var(--ad-surface-2) }
.ad-btn-ghost:disabled { opacity: .45 }

/* Custom range in the hero (always dark). */
.ad-range-custom { display: inline-flex; align-items: center; justify-content: center; gap: 8px }
.ad-range-custom i { color: var(--ad-accent); font-size: 13px; transition: color .16s ease }
.ad-range-custom.is-active i { color: #fff }
.ad-custom { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; max-width: 760px; margin-top: 16px; padding: 20px 24px; background: rgba(2, 5, 10, .72); border: 1px solid rgba(255, 255, 255, .14); border-left: 3px solid var(--ad-primary); animation: ad-drop .18s var(--ad-ease) }
.ad-date { display: grid; gap: 6px; flex: 1 1 180px }
.ad-date label { color: #b0b2b7; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase }
.ad-date input { min-height: 48px; padding: 0 14px; border: 1px solid rgba(255, 255, 255, .2); border-radius: 0; background: rgba(255, 255, 255, .04); color: #fff; font: inherit; font-size: 15px; color-scheme: dark; transition: border-color .16s ease }
.ad-date input:hover { border-color: rgba(255, 255, 255, .36) }
.ad-date input:focus-visible { outline: 2px solid var(--ad-primary-ink); outline-offset: 0; border-color: var(--ad-primary) }
.ad-date input[aria-invalid=true] { border-color: #f87171 }
.ad-date-arrow { align-self: center; margin-top: 22px; color: #8a8e94 }
.ad-custom-actions { display: flex; gap: 8px }
.ad .ad-custom-note { flex-basis: 100%; margin: 0; color: #8a8e94; font-size: 13px; line-height: 1.5 }
.ad .ad-custom-note.ad-error { color: #f87171 !important }

/* ---------- Filter bar (sticky under the header) ---------- */
html:has(.ad-filterbar) { scroll-padding-top: 96px }
.ad-filterbar { position: sticky; top: 0; z-index: 40; background: var(--ad-surface); border-bottom: 1px solid var(--ad-border); box-shadow: 0 12px 24px -20px rgba(0, 0, 0, .6) }
[data-theme=light] .ad-filterbar { box-shadow: 0 12px 24px -20px rgba(17, 21, 28, .3) }
.ad-filterbar-row { display: flex; align-items: center; gap: 24px; min-height: 76px; padding: 12px 0 }
.ad-period { display: flex; align-items: center; gap: 12px; flex-shrink: 0; padding-right: 24px; border-right: 1px solid var(--ad-border) }
.ad-period strong { display: block; color: var(--ad-ink); font-size: 14px; font-weight: 700; line-height: 1.3; white-space: nowrap }
.ad-period span:not(.ad-badge) { display: block; color: var(--ad-muted); font-size: 12px; line-height: 1.4; white-space: nowrap }
.ad-badge-sm { width: 36px; height: 36px; font-size: 14px }
.ad-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1; min-width: 0 }
.ad-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 280px; min-height: 36px; padding: 0 4px 0 12px; background: var(--ad-primary-soft); border: 1px solid var(--ad-primary-line); color: var(--ad-ink); font-size: 13px; font-weight: 600; animation: ad-drop .16s var(--ad-ease) }
.ad-chip > i { color: var(--ad-primary-ink); font-size: 12px }
.ad-chip > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: none }
.ad-chip small { margin-right: 6px; color: var(--ad-muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase }
.ad-chip button { display: grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0; padding: 0; border: 0; background: transparent; color: var(--ad-ink-2); font-size: 12px; transition: background-color .16s ease, color .16s ease }
.ad-chip button:hover { background: var(--ad-primary); color: #fff }
.ad-chip-all { display: inline-flex; align-items: center; gap: 8px; color: var(--ad-muted); font-size: 13px; font-weight: 600 }
.ad-chip-all i { color: var(--ad-primary-ink) }
.ad-filterbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0 }
.ad-count { display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--ad-accent); color: #02050a; font-size: 11px; font-weight: 800 }
.ad-chevron { font-size: 11px; transition: transform .18s var(--ad-ease) }
.ad-filterbar.is-open .ad-chevron { transform: rotate(180deg) }
.ad-filter-panel { max-height: calc(100vh - 170px); overflow-y: auto; overscroll-behavior: contain; padding: 8px 0 24px; border-top: 1px dashed var(--ad-border-strong); animation: ad-drop .18s var(--ad-ease) }
.ad-filter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 24px; padding-top: 16px }
.ad-select-field { display: grid; gap: 6px; min-width: 0 }
.ad-select-field label { display: flex; align-items: center; gap: 8px; color: var(--ad-muted); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase }
.ad-select-field label i { width: 14px; color: var(--ad-primary-ink); font-size: 12px; text-align: center }
.ad-select { position: relative }
.ad-select select { width: 100%; min-height: 44px; padding: 0 40px 0 14px; border: 1px solid var(--ad-border-strong); border-radius: 0; background: var(--ad-surface-2); color: var(--ad-ink); font: inherit; font-size: 14px; font-weight: 500; text-overflow: ellipsis; -webkit-appearance: none; appearance: none; cursor: pointer; transition: border-color .16s ease, background-color .16s ease }
.ad-select select:hover { border-color: var(--ad-muted) }
.ad-select select:focus-visible { outline: 2px solid var(--ad-primary-ink); outline-offset: 0; border-color: var(--ad-primary) }
.ad-select select option { background: var(--ad-surface); color: var(--ad-ink) }
.ad-select > i { position: absolute; top: 50%; right: 14px; transform: translateY(-50%); color: var(--ad-muted); font-size: 11px; pointer-events: none }
.ad-select-field.is-set select { border-color: var(--ad-primary); background: var(--ad-primary-soft) }
.ad-select-field.is-set .ad-select > i { color: var(--ad-primary-ink) }
.ad-filter-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-top: 20px }
.ad .ad-filter-foot p { display: flex; gap: 8px; max-width: 760px; margin: 0; color: var(--ad-muted); font-size: 13px; line-height: 1.5 }
.ad-filter-foot p i { margin-top: 3px; color: var(--ad-accent) }
.ad-filter-foot > div { display: flex; gap: 8px }
.ad-notice { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 16px 20px; margin-top: 24px; background: rgba(255, 194, 38, .08); border: 1px solid rgba(255, 194, 38, .3); border-left: 3px solid var(--ad-accent); color: var(--ad-ink-2); font-size: 14px }
.ad-notice > i { color: var(--ad-accent) }
.ad-notice > span { flex: 1 1 240px }
.ad-notice strong { color: var(--ad-ink) }

/* Drill-down: click a report row to filter the whole dashboard by it. */
.ad-drill { display: inline-grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0; padding: 0; border: 1px solid transparent; background: transparent; color: var(--ad-muted); font-size: 11px; opacity: 0; transition: opacity .16s ease, background-color .16s ease, color .16s ease, border-color .16s ease }
li:hover > .ad-drill, tr:hover .ad-drill, .ad-drill:focus-visible, .ad-drill.is-on { opacity: 1 }
.ad-drill:hover { border-color: var(--ad-primary-line); background: var(--ad-primary-soft); color: var(--ad-primary-ink) }
.ad-drill.is-on { border-color: var(--ad-primary); background: var(--ad-primary); color: #fff }
.ad-drill.is-on:hover { background: var(--ad-primary-hover); color: #fff }
@media (hover: none) { .ad-drill { opacity: .7 } }
.ad-source-name .ad-drill { margin-left: auto }
.ad-path-row { display: flex; align-items: flex-start; gap: 8px }
.ad-path-row .ad-path { flex: 1; min-width: 0 }
.ad-path-row .ad-drill { margin-top: -6px }
.ad-rank li.is-filtered .ad-rank-label > span, .ad-device-list li.is-filtered .ad-device-name { color: var(--ad-primary-ink) }
.ad-table tbody tr.is-filtered { background: var(--ad-primary-soft) }
.ad-table tbody tr.is-filtered > th { box-shadow: inset 3px 0 0 var(--ad-primary) }
.ad-spin { animation: ad-spin .9s linear infinite }

/* ---------- Login ---------- */
.ad-gate-grid { width: 100%; display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 64px; align-items: center }
.ad-gate-points { display: grid; gap: 16px; margin-top: 40px !important; max-width: 520px }
.ad-gate-points li { display: flex; align-items: center; gap: 16px; padding: 16px; border: 1px solid rgba(255, 255, 255, .08); background: rgba(17, 21, 28, .55) }
.ad-gate-points div { display: flex; flex-direction: column; line-height: 1.45 }
.ad-gate-points strong { color: #fff; font-size: 16px; font-weight: 700 }
.ad-gate-points span:not(.ad-badge) { color: #b0b2b7; font-size: 14px }
.ad-gate-card { position: relative; padding: 48px 40px 40px; background: var(--ad-surface); border: 1px solid var(--ad-border); box-shadow: var(--ad-shadow) }
.ad-gate-card::before { content: ""; position: absolute; inset: -1px -1px auto; height: 3px; background: linear-gradient(90deg, var(--ad-primary), transparent) }
.ad-gate-card h2 { font-size: 28px; font-weight: 700; line-height: 1.25 }
.ad-gate-intro { margin-top: 8px !important; color: var(--ad-ink-2) }
.ad-form { display: grid; gap: 8px; margin-top: 32px }
.ad-form label { color: var(--ad-ink); font-size: 14px; font-weight: 600 }
.ad-field { position: relative; display: flex; align-items: center }
.ad-field-icon { position: absolute; left: 16px; color: var(--ad-muted); font-size: 14px; pointer-events: none }
.ad-field input { width: 100%; height: 56px; padding: 0 56px 0 44px; border: 1px solid var(--ad-border-strong); border-radius: 0; background: var(--ad-surface-2); color: var(--ad-ink); font: 500 16px var(--ad-font); transition: border-color .16s ease, box-shadow .16s ease }
.ad-field input:hover { border-color: var(--ad-muted) }
.ad-field input:focus { outline: none; border-color: var(--ad-primary); box-shadow: 0 0 0 3px rgba(22, 163, 74, .25) }
.ad-field input[aria-invalid=true] { border-color: var(--ad-danger) }
.ad-reveal { position: absolute; right: 6px; width: 44px; height: 44px; border: 0; background: transparent; color: var(--ad-muted); font-size: 15px; transition: color .16s ease }
.ad-reveal:hover { color: var(--ad-ink) }
.ad-error { display: flex; align-items: center; gap: 8px; color: var(--ad-danger) !important; font-size: 14px; font-weight: 500 }
.ad-form .ad-btn { margin-top: 16px; min-height: 56px; font-size: 16px }
.ad-gate-foot { display: flex; align-items: center; gap: 8px; margin-top: 24px !important; padding-top: 24px; border-top: 1px solid var(--ad-border); color: var(--ad-muted); font-size: 13px }
.ad-gate-foot i { color: var(--ad-primary) }
.ad-checking { text-align: center; padding: 24px 0 }
.ad-checking h2 { margin-top: 24px }
.ad-checking p { margin-top: 8px !important; color: var(--ad-ink-2) }

/* ---------- Sections ---------- */
.ad-body { position: relative; padding: 32px 0 96px; background: var(--ad-bg) }
.ad-section { padding-top: 64px }
.ad-sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 32px }
.ad-sec-head > p { max-width: 400px; color: var(--ad-ink-2); text-align: right; text-wrap: balance }
.ad-sub-heading { position: relative; display: inline-block; margin-bottom: 12px; padding: 0 50px; color: var(--ad-primary-ink); font-size: 14px; font-weight: 700; letter-spacing: .04em; line-height: 1.5; text-transform: uppercase }
.ad-sub-heading::before, .ad-sub-heading::after { content: ""; position: absolute; top: 50%; width: 37px; height: 10px; transform: translateY(-50%) }
.ad-sub-heading::before { left: 0; background: linear-gradient(270deg, var(--ad-primary-line) 0%, transparent 100%) }
.ad-sub-heading::after { right: 0; background: linear-gradient(90deg, var(--ad-primary-line) 0%, transparent 100%) }
.ad-gate-card .ad-sub-heading { padding-left: 0 }
.ad-gate-card .ad-sub-heading::before { display: none }
.ad .ad-sec-title { display: block; font-size: clamp(28px, 3.4vw, 44px); font-weight: 700; line-height: 1.15; letter-spacing: -.02em }

/* ---------- KPI cards ---------- */
.ad-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px }
.ad-kpi { position: relative; overflow: hidden; display: flex; flex-direction: column; min-height: 176px; padding: 20px 20px 0; background: var(--ad-surface); border: 1px solid var(--ad-border); transition: border-color .2s ease, box-shadow .2s ease, transform .2s var(--ad-ease) }
.ad-kpi:hover { border-color: transparent; box-shadow: var(--ad-glow); transform: translateY(-2px) }
.ad-kpi-top { display: flex; align-items: center; gap: 10px; min-width: 0 }
.ad .ad-kpi-top h3 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ad-ink-2); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase }
.ad-kpi-top .ad-badge-sm { width: 32px; height: 32px; font-size: 13px }
.ad-kpi .ad-delta { flex-shrink: 0; padding: 2px 8px; font-size: 12px }
.ad-kpi .ad-kpi-value { margin-top: 16px; font-size: 32px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.ad-kpi .ad-kpi-note { margin-top: 6px !important; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.ad-kpi .ad-kpi-spark { width: calc(100% + 40px); height: 44px; margin: auto -20px 0; padding-top: 12px }
.ad-kpi .ad-meter { height: 6px; margin: auto 0 20px; }
.ad-badge { width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; background: var(--ad-primary-soft); border: 1px solid rgba(22, 163, 74, .35); color: var(--ad-primary-ink); font-size: 17px; transition: background-color .2s ease, color .2s ease }
.ad-kpi:hover .ad-badge, .ad-panel:hover .ad-panel-head .ad-badge { background: var(--ad-primary); color: #fff }
.ad-kpi-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 24px }
.ad-kpi-value { color: var(--ad-ink); font-size: 44px; font-weight: 700; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums }
.ad-delta { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 100px; font-size: 13px; font-weight: 700; background: var(--ad-surface-2); color: var(--ad-ink-2); border: 1px solid var(--ad-border) }
.ad-delta[data-dir=up] { background: var(--ad-primary-soft); color: var(--ad-primary-ink); border-color: rgba(22, 163, 74, .3) }
.ad-delta[data-dir=down] { background: var(--ad-danger-soft); color: var(--ad-danger); border-color: rgba(248, 113, 113, .3) }
.ad-kpi-note { margin-top: 12px !important; color: var(--ad-muted); font-size: 14px; line-height: 1.5 !important }
.ad-kpi-prev { color: var(--ad-ink-2) }
.ad-kpi-spark { display: block; width: calc(100% + 56px); height: 56px; margin: auto -28px -28px; padding-top: 16px }
.ad-spark-line { fill: none; stroke: var(--ad-primary); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round }
.ad-meter { height: 8px; margin-top: auto; background: var(--ad-track); overflow: hidden }
.ad-meter span { display: block; height: 100%; background: linear-gradient(90deg, rgba(22, 163, 74, .4), var(--ad-primary)) }
.ad-kpi-insight { display: flex; align-items: center; gap: 8px; margin-top: auto !important; padding-top: 16px; border-top: 1px dashed var(--ad-border-strong); color: var(--ad-ink) !important; font-size: 14px; font-weight: 600 }
.ad-kpi-insight i { color: var(--ad-accent) }
.ad-kpi.ad-skeleton { padding-bottom: 20px }
.ad-skeleton { gap: 16px }
.ad-skeleton span { display: block; height: 14px; width: 40%; background: var(--ad-surface-2); animation: ad-pulse 1.4s ease-in-out infinite }
.ad-skeleton span:nth-child(2) { height: 32px; width: 55%; margin-top: 8px }
.ad-skeleton span:nth-child(3) { width: 80% }
.ad-updating { opacity: .55; transition: opacity .2s ease }

/* ---------- Panels ---------- */
.ad-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px }
.ad-span-3 { grid-column: span 3 } .ad-span-4 { grid-column: span 4 } .ad-span-5 { grid-column: span 5 } .ad-span-6 { grid-column: span 6 }
.ad-span-7 { grid-column: span 7 } .ad-span-8 { grid-column: span 8 } .ad-span-12 { grid-column: 1 / -1 }
.ad-grid + .ad-grid { margin-top: 24px }
.ad-panel { position: relative; min-width: 0; display: flex; flex-direction: column; padding: 24px; background: var(--ad-surface); border: 1px solid var(--ad-border); transition: border-color .2s ease }
.ad-panel:hover { border-color: var(--ad-border-strong) }
.ad-panel-head { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; margin-bottom: 20px }
.ad-panel-head > div:not(.ad-tabs):not(.ad-legend) { flex: 1 1 180px; min-width: 0 }
.ad .ad-panel-head h2, .ad-panel-head h3 { font-size: 18px; font-weight: 700; line-height: 1.3 }
.ad-panel-head p a { color: var(--ad-primary-ink); font-weight: 600 }
.ad-panel-link { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; margin-top: auto; padding-top: 20px; color: var(--ad-primary-ink) !important; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase }
.ad-panel-link i { font-size: 11px; transition: transform .16s var(--ad-ease) }
.ad-panel-link:hover { color: var(--ad-ink) !important }
.ad-panel-link:hover i { transform: translateX(3px) }
.ad-footnote { display: flex; gap: 8px; margin-top: 24px !important; color: var(--ad-muted); font-size: 13px; line-height: 1.5 !important }
.ad-footnote i { margin-top: 3px; color: var(--ad-accent) }
.ad-muted { color: var(--ad-muted) }
.ad-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; text-transform: none !important }
.ad-cap { text-transform: capitalize }
.ad-skel-grid { margin-top: 0 }
.ad-skeleton-panel { min-height: 360px; animation: ad-pulse 1.4s ease-in-out infinite }
.ad-empty-sm { padding: 16px 0 }
.ad-empty-tall { min-height: 240px; justify-content: center }
.ad-panel-head p { color: var(--ad-muted); font-size: 14px; line-height: 1.5 }
.ad-panel-foot { margin-top: auto !important; padding-top: 16px; color: var(--ad-muted); font-size: 13px; line-height: 1.5 !important }
.ad-text-link { display: inline-flex; align-items: center; gap: 6px; color: var(--ad-primary-ink) !important; font-size: 14px; font-weight: 700 }
.ad-text-link:hover { color: var(--ad-ink) !important }
.ad-tabs { border-color: var(--ad-border-strong); background: var(--ad-surface-2) }
.ad-tabs button { min-height: 40px; padding: 0 16px; font-size: 13px; color: var(--ad-ink-2) }
.ad-tabs button + button { border-left-color: var(--ad-border-strong) }
.ad-tabs button:hover:not(.is-active) { color: var(--ad-ink); background: var(--ad-primary-soft) }
.ad-empty { display: flex; align-items: center; gap: 12px; padding: 32px 0; color: var(--ad-muted) }
.ad-empty > i { color: var(--ad-primary-ink); font-size: 18px }
.ad-empty-box { align-items: flex-start; padding: 24px; background: var(--ad-surface-2); border: 1px dashed var(--ad-border-strong) }
.ad-empty-box strong { display: block; color: var(--ad-ink); margin-bottom: 4px }
.ad-empty-box p { font-size: 14px; color: var(--ad-ink-2) }
.ad-alert, .ad-inline-error { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 16px 20px; margin-top: 24px; background: var(--ad-danger-soft); border: 1px solid rgba(248, 113, 113, .35); border-left: 3px solid var(--ad-danger); color: var(--ad-ink) }
.ad-alert > i { color: var(--ad-danger) }
.ad-alert span { flex: 1 1 200px }
.ad-inline-error { margin-top: 16px; font-size: 14px }
.ad-stale { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; color: var(--ad-muted); font-size: 13px }
.ad-stale > i { color: var(--ad-c2) }
.ad-stale button { padding: 0; background: none; border: 0; color: var(--ad-primary-ink); font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer }
.ad-stale button:hover { color: var(--ad-ink) }
.ad-stale button:focus-visible { outline: 2px solid var(--ad-primary); outline-offset: 2px }
.ad-stale-top { margin: 0 0 24px }

/* Trend chart */
.ad-chart-meta { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 16px }
.ad-chart-total { display: flex; align-items: baseline; gap: 10px }
.ad-chart-total strong { color: var(--ad-ink); font-size: 36px; font-weight: 700; line-height: 1; letter-spacing: -.02em }
.ad-chart-total span { color: var(--ad-muted); font-size: 14px }
.ad-legend { display: flex; flex-wrap: wrap; gap: 20px; color: var(--ad-ink-2); font-size: 13px; font-weight: 600 }
.ad-legend span, .ad-readout span { display: inline-flex; align-items: center; gap: 8px }
.ad-legend-inline { margin: -8px 0 16px }
.ad-key-cur, .ad-key-prev { display: inline-block; width: 20px; height: 3px; background: var(--ad-primary) }
.ad-key-prev { background: repeating-linear-gradient(90deg, var(--ad-accent) 0 5px, transparent 5px 8px) }
.ad-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50% }
.ad-legend i.is-dashed { width: 18px; height: 3px; border-radius: 0; background: repeating-linear-gradient(90deg, currentColor 0 5px, transparent 5px 8px) !important; color: var(--ad-c7) }
.ad-legend .ad-key-cur, .ad-legend .ad-key-prev, .ad-legend .ad-key-muted, .ad-legend .ad-key-alt { width: 18px; height: 3px; border-radius: 0 }
.ad-key-muted { display: inline-block; background: var(--ad-border-strong) !important }
.ad-key-alt { display: inline-block; background: var(--ad-c2) !important }
.ad-legend-foot { margin-top: 16px }
.ad-chart-total-sm { margin-bottom: 8px }
.ad-chart-total-sm strong { font-size: 28px }
.ad-live-value-lg { margin-bottom: 24px }
.ad-live-value-lg strong { font-size: 88px }

/* Line and bar charts (charts.ts) */
.ad-lc, .ad-bc { display: grid; grid-template-columns: 40px minmax(0, 1fr) }
.ad-lc-y { position: relative }
.ad-lc-y span, .ad-lc-x span { position: absolute; color: var(--ad-muted); font-size: 11px; font-weight: 600; line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums }
.ad-lc-y span { right: 10px; transform: translateY(-50%) }
.ad-lc-plot { min-width: 0 }
.ad-lc-area { position: relative }
.ad-lc-area svg { display: block; width: 100%; height: 100%; overflow: visible }
.ad-lc-x { position: relative; height: 28px }
.ad-lc-x span { top: 12px; transform: translateX(-50%) }
.ad-lc-x span[data-anchor=start] { transform: none }
.ad-lc-x span[data-anchor=end] { transform: translateX(-100%) }
.ad-gridline { stroke: var(--ad-grid); stroke-width: 1; vector-effect: non-scaling-stroke }
.ad-lc-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke }
.ad-lc-line.is-dashed { stroke-width: 1.5; stroke-dasharray: 5 4; opacity: .85 }
.ad-crosshair { stroke: var(--ad-border-strong); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke }
.ad-lc-dot { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border: 3px solid var(--ad-c1); border-radius: 50%; background: var(--ad-surface); pointer-events: none }
.ad-lc-hit { position: absolute; inset: 0; cursor: crosshair; outline: none }
.ad-lc-hit:focus-visible { box-shadow: inset 0 0 0 2px var(--ad-primary-line) }
.ad-tip { position: absolute; top: 0; z-index: 3; min-width: 160px; padding: 10px 12px; margin-left: 12px; background: var(--ad-surface-2); border: 1px solid var(--ad-border-strong); box-shadow: var(--ad-shadow); color: var(--ad-ink-2); font-size: 12px; pointer-events: none; animation: ad-drop .12s var(--ad-ease) }
.ad-tip.is-right { transform: translateX(calc(-100% - 24px)) }
.ad-tip strong { display: block; margin-bottom: 6px; color: var(--ad-ink); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase }
.ad-tip span { display: flex; align-items: center; gap: 8px; white-space: nowrap; line-height: 1.7 }
.ad-tip i { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0 }
.ad-tip i.is-dashed { width: 12px; height: 2px; border-radius: 0 }
.ad-tip b { margin-left: auto; padding-left: 16px; color: var(--ad-ink); font-variant-numeric: tabular-nums }
.ad-bc-grid { position: absolute; inset: 0; pointer-events: none }
.ad-bc-grid i { position: absolute; left: 0; right: 0; height: 1px; background: var(--ad-grid) }
.ad-bc-bars { position: absolute; inset: 0; display: flex; align-items: stretch; gap: 3px }
.ad-bc-slot { position: relative; flex: 1; min-width: 0; display: flex; align-items: flex-end; justify-content: center; gap: 2px; cursor: default }
.ad-bc-slot::before { content: ""; position: absolute; inset: 0 -1px; background: var(--ad-primary-soft); opacity: 0; transition: opacity .12s ease }
.ad-bc-slot.is-active::before { opacity: 1 }
.ad-bc-cur, .ad-bc-prev { position: relative; flex: 1; max-width: 28px; min-height: 2px; transition: height .4s var(--ad-ease) }
.ad-bc-prev { opacity: .45 }
.ad-bc-cur.is-zero { background: var(--ad-track) !important }
.ad-bc.is-dense .ad-bc-bars { gap: 1px }
.ad-bc.is-dense .ad-bc-slot { gap: 0 }

/* Donut */
.ad-dn { position: relative; flex-shrink: 0 }
.ad-dn svg { display: block; width: 100%; height: 100%; transform: rotate(-90deg) }
.ad-dn-track { fill: none; stroke: var(--ad-track); stroke-width: 14 }
.ad-dn-arc { fill: none; stroke-width: 14; cursor: pointer; transition: opacity .16s ease, stroke-width .16s ease }
.ad-dn-arc:hover { stroke-width: 17 }
.ad-dn-arc.is-dim { opacity: .3 }
.ad-dn-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; text-align: center }
.ad-dn-center strong { color: var(--ad-ink); font-size: 26px; font-weight: 700; line-height: 1; letter-spacing: -.02em }
.ad-dn-center span { max-width: 70%; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ad-muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase }
.ad-donut-row { display: flex; align-items: center; gap: 24px }
.ad-donut-row .ad-legend-list { flex: 1; min-width: 0 }
.ad-donut-col { display: flex; flex-direction: column; align-items: center; gap: 24px }
.ad-donut-col > :not(ad-donut) { width: 100% }
.ad-legend-list { display: grid; gap: 2px }
.ad-legend-list li { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 4px 0; border-bottom: 1px solid var(--ad-border); font-size: 14px }
.ad-legend-list li:last-child { border-bottom: 0 }
.ad-legend-list li > i { width: 10px; height: 10px; flex-shrink: 0; border-radius: 50% }
.ad-legend-list li > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ad-ink); font-weight: 600 }
.ad-legend-list small { color: var(--ad-muted); font-size: 12px; white-space: nowrap }
.ad-legend-list strong { color: var(--ad-ink); font-variant-numeric: tabular-nums }
.ad-legend-list li.is-filtered > span { color: var(--ad-primary-ink) }
.ad-li-icon { width: 16px; margin-right: 8px; color: var(--ad-muted); font-size: 13px; text-align: center }

/* Details tables */
.ad-details { margin-top: 16px }
.ad-details summary { display: inline-flex; align-items: center; gap: 8px; color: var(--ad-ink-2); font-size: 13px; font-weight: 600; cursor: pointer; list-style: none }
.ad-details summary::-webkit-details-marker { display: none }
.ad-details summary::before { content: "+"; display: grid; place-items: center; width: 18px; height: 18px; border: 1px solid var(--ad-border-strong); color: var(--ad-primary-ink); font-size: 13px; line-height: 1 }
.ad-details[open] summary::before { content: "−" }
.ad-details summary:hover { color: var(--ad-ink) }
.ad-details .ad-table-scroll { max-height: 280px; margin-top: 12px; border: 1px solid var(--ad-border) }
.ad-table-scroll { overflow: auto; -webkit-overflow-scrolling: touch }
.ad-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums }
.ad-table caption { caption-side: top; padding: 8px 12px; text-align: left; color: var(--ad-muted); font-size: 12px }
.ad-table th, .ad-table td { padding: 12px; border-bottom: 1px solid var(--ad-border); text-align: right; white-space: nowrap }
.ad-table th:first-child { text-align: left }
.ad-table thead th { position: sticky; top: 0; background: var(--ad-surface); color: var(--ad-muted); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase }
.ad-table tbody th { color: var(--ad-ink); font-weight: 600 }
.ad-table td { color: var(--ad-ink-2) }
.ad-table tbody tr { transition: background-color .16s ease }
.ad-table tbody tr:hover { background: var(--ad-surface-2) }
.ad-table tbody tr:last-child > * { border-bottom: 0 }
.ad-sources tbody th, .ad-pages tbody th { width: 100%; min-width: 220px; white-space: normal }
.ad-strong { color: var(--ad-primary-ink) !important; font-weight: 700 }
.ad-sources thead .fa-whatsapp { font-size: 15px; color: var(--ad-primary-ink) }
.ad-source-name { display: flex; align-items: center; gap: 8px; margin-bottom: 8px }
.ad-tag { padding: 2px 8px; border: 1px solid var(--ad-border-strong); color: var(--ad-muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase }
.ad-path { display: block; margin-bottom: 8px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; word-break: break-all }
.ad-track { display: block; height: 6px; background: var(--ad-track); overflow: hidden }
.ad-track > span { display: block; height: 100%; background: var(--ad-primary); transition: width .4s var(--ad-ease) }
.ad-track-alt > span, .ad-track-c3 > span { background: var(--ad-c3) }
.ad-track-c1 > span { background: var(--ad-c1) } .ad-track-c2 > span { background: var(--ad-c2) }
.ad-track-c4 > span { background: var(--ad-c4) } .ad-track-c5 > span { background: var(--ad-c5) }
.ad-track-xs { height: 3px; margin-top: 8px; max-width: 320px }
.ad-table-wrap { overflow-x: auto; margin: 0 -24px; -webkit-overflow-scrolling: touch }
.ad-table-wrap .ad-table th:first-child { padding-left: 24px }
.ad-table-wrap .ad-table th:last-child, .ad-table-wrap .ad-table td:last-child { padding-right: 24px }
.ad-table tbody th { width: 100%; min-width: 200px; white-space: normal }
.ad-table .ad-num { text-align: right }
.ad-cell-main { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; word-break: break-word }
.ad-cell-main small { color: var(--ad-muted); font-size: 12px; font-weight: 500 }
.ad-cell-action { width: 40px; padding-left: 0 !important }
.ad-lead-pill { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 100px; background: var(--ad-primary-soft); border: 1px solid var(--ad-primary-line); color: var(--ad-primary-ink); font-size: 12px; font-style: normal; font-weight: 700 }
.ad-table .ad-lead-pill { margin-left: 0 }

/* Live */
.ad-live-tag { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border: 1px solid rgba(22, 163, 74, .4); color: var(--ad-primary-ink); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase }
.ad-pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ad-primary); box-shadow: 0 0 0 0 rgba(22, 163, 74, .6); animation: ad-beat 1.8s ease-out infinite }
.ad-live-value { display: flex; align-items: baseline; gap: 12px }
.ad-live-value strong { color: var(--ad-ink); font-size: 72px; font-weight: 700; line-height: 1; letter-spacing: -.04em }
.ad-live-value span { color: var(--ad-ink-2); font-weight: 600 }
.ad-live .ad-live-value { margin-bottom: 16px }
.ad-live .ad-live-value strong { font-size: 56px }
.ad-mini-list { margin-top: 16px }
.ad .ad-mini-list h3 { margin-bottom: 8px; color: var(--ad-muted); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase }
.ad-mini-list div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--ad-border); font-size: 14px }
.ad-mini-list div:last-child { border-bottom: 0 }
.ad-mini-list span { display: inline-flex; align-items: center; gap: 10px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ad-ink) }
.ad-mini-list span i { color: var(--ad-primary-ink); font-size: 12px }
.ad-mini-list strong { color: var(--ad-ink) }

/* Heatmap */
.ad-heat-wrap { overflow-x: auto; padding-bottom: 4px }
.ad-heat { width: 100%; min-width: 640px; border-collapse: separate; border-spacing: 3px; table-layout: fixed }
.ad-heat th { padding: 0; color: var(--ad-muted); font-size: 11px; font-weight: 600; text-align: left; line-height: 1.6 }
.ad-heat thead th:first-child { width: 40px }
.ad-heat tbody th { color: var(--ad-ink-2); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase }
.ad-heat td { height: 24px; padding: 0; border-radius: 3px; background: var(--ad-heat0); transition: box-shadow .14s ease }
.ad-heat td:hover { box-shadow: 0 0 0 2px var(--ad-primary-ink) }
.ad-heat-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; margin-top: 16px }
.ad .ad-heat-foot p { color: var(--ad-ink-2); font-size: 13px }
.ad-heat-foot p i { margin-right: 6px; color: var(--ad-accent) }
.ad-heat-foot strong { color: var(--ad-ink) }
.ad-heat-scale { display: inline-flex; align-items: center; gap: 4px; color: var(--ad-muted); font-size: 12px; font-weight: 600 }
.ad-heat-scale i { width: 14px; height: 14px; border-radius: 3px; background: var(--ad-heat0) }
.ad-heat-scale span:first-child { margin-right: 4px } .ad-heat-scale span:last-child { margin-left: 4px }
.ad [data-level="1"] { background: var(--ad-heat1) !important } .ad [data-level="2"] { background: var(--ad-heat2) !important }
.ad [data-level="3"] { background: var(--ad-heat3) !important } .ad [data-level="4"] { background: var(--ad-heat4) !important }

/* Devices */
.ad-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px }
.ad-tile { display: grid; gap: 2px; width: 100%; padding: 12px 16px; background: var(--ad-surface-2); border: 1px solid var(--ad-border); color: var(--ad-ink-2); text-align: left; font: inherit; transition: border-color .16s ease, background-color .16s ease }
.ad-tile:hover { border-color: var(--ad-primary-line) }
.ad-tile.is-on { border-color: var(--ad-primary); background: var(--ad-primary-soft) }
.ad-tile span { display: flex; align-items: center; gap: 8px; color: var(--ad-muted); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase }
.ad-tile span i { width: 8px; height: 8px; border-radius: 50% }
.ad-tile strong { color: var(--ad-ink); font-size: 22px; font-weight: 700; line-height: 1.3 }
.ad-tile small { color: var(--ad-muted); font-size: 12px }

/* Stat stack (realtime) */
.ad-stat-stack { display: grid; gap: 16px; min-width: 0 }
.ad-stat { display: flex; align-items: center; gap: 16px; padding: 20px; background: var(--ad-surface); border: 1px solid var(--ad-border); transition: border-color .2s ease }
.ad-stat:hover { border-color: var(--ad-border-strong) }
.ad-stat > div { display: flex; flex-direction: column; min-width: 0; line-height: 1.35 }
.ad .ad-stat h3 { color: var(--ad-muted); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase }
.ad-stat strong { color: var(--ad-ink); font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums }
.ad-stat strong small { color: var(--ad-muted); font-size: 14px; font-weight: 600 }
.ad-stat span:not(.ad-badge) { color: var(--ad-ink-2); font-size: 13px }

/* Horizontal bars: current against previous (channels, events) */
.ad-hbars { display: grid; gap: 16px }
.ad-hbars li { display: grid; gap: 6px }
.ad-hbars-label { display: flex; align-items: center; gap: 12px; min-height: 28px; font-size: 14px }
.ad-hbars-label > span { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ad-ink); font-weight: 600 }
.ad-hbars-label > span i { width: 10px; height: 10px; flex-shrink: 0; border-radius: 50% }
.ad-hbars-label strong { color: var(--ad-ink); font-variant-numeric: tabular-nums }
.ad-hbars li.is-filtered .ad-hbars-label > span { color: var(--ad-primary-ink) }
.ad-hbars li:hover .ad-drill { opacity: 1 }
.ad-hbars-track { display: block; height: 10px; background: var(--ad-track); overflow: hidden }
.ad-hbars-track > span { display: block; height: 100%; background: var(--ad-primary); transition: width .4s var(--ad-ease) }
.ad-hbars-prev { height: 4px }
.ad-hbars-prev > span { background: var(--ad-border-strong) }
.ad-hbars small { color: var(--ad-muted); font-size: 12px }
.ad-hbars-compact { gap: 14px }
.ad-hbars-compact .ad-hbars-track { height: 6px }
.ad-change { min-width: 48px; color: var(--ad-muted); font-size: 12px; font-style: normal; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums }
.ad-change[data-dir=up] { color: var(--ad-primary-ink) }
.ad-change[data-dir=down] { color: var(--ad-danger) }

/* Funnel */
.ad-funnel { display: grid; gap: 16px }
.ad-funnel li { display: grid; gap: 6px }
.ad-funnel-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px }
.ad-funnel-label span { display: inline-flex; align-items: center; gap: 10px; color: var(--ad-ink); font-weight: 600 }
.ad-funnel-label span i { width: 16px; color: var(--ad-primary-ink); text-align: center }
.ad-funnel-label strong { color: var(--ad-ink); font-variant-numeric: tabular-nums }
.ad-funnel-bar { display: block; height: 14px; background: var(--ad-track) }
.ad-funnel-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--ad-primary), rgba(22, 163, 74, .55)); transition: width .4s var(--ad-ease) }
.ad-funnel li:nth-child(3) .ad-funnel-bar span { background: var(--ad-c2) }
.ad-funnel li:nth-child(4) .ad-funnel-bar span { background: var(--ad-c5) }
.ad-funnel small { color: var(--ad-muted); font-size: 12px }

/* Stacked lead bar: WhatsApp share in green, the rest in yellow */
.ad-stack { display: flex; height: 8px; min-width: 4px; background: var(--ad-c2); transition: width .4s var(--ad-ease) }
.ad-stack-wa { display: block; height: 100%; background: var(--ad-c1) }
.ad-stack-other { flex: 1 }

/* Ranked lists (cities, bio links) and events */
.ad-rank { display: grid; gap: 4px }
.ad-rank li { display: flex; align-items: center; gap: 16px; padding: 10px 0 }
.ad-rank-n { width: 32px; flex-shrink: 0; color: transparent; -webkit-text-stroke: 1px var(--ad-muted); font-size: 22px; font-weight: 800; line-height: 1 }
.ad-rank li:first-child .ad-rank-n { -webkit-text-stroke-color: var(--ad-primary-ink) }
.ad-rank-main { flex: 1; min-width: 0 }
.ad-rank-label { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px }
.ad-rank-label > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ad-ink); font-size: 14px; font-weight: 600; text-transform: capitalize }
.ad-rank-label small { margin-left: 8px; color: var(--ad-muted); font-size: 13px; font-weight: 500 }
.ad-rank-label .ad-plain { text-transform: none }
.ad-rank-label strong { flex-shrink: 0; color: var(--ad-ink); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums }
.ad-rank-tight li { padding: 6px 0 }
.ad-rank-tight .ad-rank-n { width: 24px; font-size: 16px }
.ad-rank-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 48px }
.ad-rank-label strong .ad-lead-pill { margin-left: 8px }

/* Footer */
.ad-footer { border-top: 1px solid var(--ad-border); background: var(--ad-surface) }
.ad-footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 32px; padding-top: 24px; padding-bottom: 24px }
.ad .ad-footer-inner p { max-width: 720px; color: var(--ad-muted); font-size: 13px; line-height: 1.6 }
.ad-footer-inner span { flex-shrink: 0; color: var(--ad-muted); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase }

/* ---------- App shell: sidebar + main ---------- */
.ad-side { position: fixed; inset: 0 auto 0 0; z-index: 60; display: flex; flex-direction: column; width: var(--ad-side-w); background: var(--ad-surface); border-right: 1px solid var(--ad-border) }
.ad-side-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 76px; padding: 0 24px; border-bottom: 1px solid var(--ad-border) }
.ad-side .ad-logo img { height: 34px }
[data-theme=light] .ad-side .ad-logo-white { display: none !important }
[data-theme=light] .ad-side .ad-logo-green { display: block !important }
.ad-side-close { display: none !important }
.ad-side-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 24px 16px; scrollbar-width: thin }
.ad .ad-side-label { margin: 0 0 8px; padding: 0 12px; color: var(--ad-muted); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase }
.ad-side-nav { display: grid; gap: 4px }
.ad-side-nav + .ad-side-label { margin-top: 32px }
.ad-side-nav a { position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; color: var(--ad-ink-2); font-size: 14px; font-weight: 600; transition: background-color .16s ease, color .16s ease }
.ad-side-nav a:hover { background: var(--ad-surface-2); color: var(--ad-ink) }
.ad-side-nav a.is-active { background: var(--ad-primary-soft); color: var(--ad-ink) }
.ad-side-nav a.is-active::before { content: ""; position: absolute; inset: 8px auto 8px 0; width: 3px; background: var(--ad-primary) }
.ad-side-icon { display: grid; place-items: center; width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%; border: 1px solid var(--ad-border-strong); color: var(--ad-muted); font-size: 12px; transition: background-color .16s ease, border-color .16s ease, color .16s ease }
.ad-side-nav a:hover .ad-side-icon { border-color: var(--ad-primary-line); color: var(--ad-primary-ink) }
.ad-side-nav a.is-active .ad-side-icon { border-color: var(--ad-primary); background: var(--ad-primary); color: #fff }
.ad-side-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.ad-side-ext { color: var(--ad-muted); font-size: 11px }
.ad-side-live { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border: 1px solid var(--ad-primary-line); color: var(--ad-primary-ink); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums }
.ad-side-live .ad-pulse { width: 6px; height: 6px }
.ad-side-foot { display: grid; gap: 16px; padding: 20px 24px 24px; border-top: 1px solid var(--ad-border) }
.ad-side-prop { display: flex; align-items: center; gap: 12px; min-width: 0 }
.ad-side-prop > div { display: flex; flex-direction: column; min-width: 0; line-height: 1.35 }
.ad-side-prop strong { color: var(--ad-ink); font-size: 13px; font-weight: 700 }
.ad-side-prop span:not(.ad-badge) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ad-muted); font-size: 12px }
.ad-side-actions { display: flex; gap: 8px }
.ad-side-actions .ad-signout { flex: 1; border-color: var(--ad-border-strong); background: transparent; color: var(--ad-ink) }
.ad-side-actions .ad-signout:hover:not(:disabled) { border-color: var(--ad-danger); background: var(--ad-danger-soft); color: var(--ad-ink) }
.ad-scrim { position: fixed; inset: 0; z-index: 55; background: rgba(2, 5, 10, .6); backdrop-filter: blur(2px); animation: ad-fade .18s ease }
.ad-main { min-width: 0; margin-left: var(--ad-side-w) }
.ad-app .ad-container { max-width: 1360px }
.ad-menu { display: none !important }
.ad-app .ad-filterbar-row { min-height: 72px }

/* Compact photo page header for each dashboard page */
.ad-pagehead { position: relative; z-index: 1; overflow: hidden; background: #02050a url("../img/bg-img/page-header-bg.jpg") center / cover no-repeat; color: #b0b2b7 }
.ad-pagehead .ad-hero-shape { width: 150px }
.ad-pagehead-inner { padding-top: 48px; padding-bottom: 40px }
.ad-pagehead .ad-crumb { margin-bottom: 12px !important; font-size: 13px }
.ad-pagehead .ad-title { font-size: clamp(30px, 3.4vw, 44px) }
.ad-pagehead .ad-hero-sub { margin-top: 12px !important; font-size: 16px }
.ad-pagehead .ad-toolbar { margin-top: 28px }
.ad-pagehead .ad-range button { min-height: 44px; padding: 0 20px; font-size: 13px }
.ad-pagehead .ad-btn { min-height: 46px }
.ad-live-tag-hero { padding: 8px 16px; border-color: rgba(74, 222, 128, .5); background: rgba(2, 5, 10, .55); color: #4ade80 }
.ad-view { animation: ad-fade .2s ease }
.ad-body .ad-alert, .ad-body .ad-notice { margin: 0 0 24px }

/* Loader */
.ad-loader { display: inline-block; width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--ad-border-strong); border-top-color: var(--ad-primary); animation: ad-spin .8s linear infinite }
.ad-loader-sm { width: 18px; height: 18px; border-width: 2px }

@keyframes ad-spin { to { transform: rotate(360deg) } }
@keyframes ad-drop { from { opacity: 0; transform: translateY(-4px) } }
@keyframes ad-pulse { 50% { opacity: .45 } }
@keyframes ad-beat { 0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .6) } 100% { box-shadow: 0 0 0 10px rgba(22, 163, 74, 0) } }
@keyframes ad-fade { from { opacity: 0 } }

/* ---------- Responsive ---------- */
@media (max-width: 1399px) {
  .ad-span-3 { grid-column: span 6 }
  .ad-filterbar-row { flex-wrap: wrap; gap: 12px 16px }
  .ad-chips { order: 3; flex-basis: 100% }
  .ad-filterbar-actions { margin-left: auto }
  .ad-period { padding-right: 0; border-right: 0 }
}
@media (max-width: 1199px) {
  .ad { --ad-side-w: 232px }
  .ad-span-4, .ad-span-5, .ad-span-6, .ad-span-7, .ad-span-8 { grid-column: 1 / -1 }
  .ad-stat-stack { grid-template-columns: repeat(2, minmax(0, 1fr)) }
  .ad-donut-col { flex-direction: row; align-items: center }
  .ad-donut-col > :not(ad-donut) { flex: 1; width: auto }
}
@media (max-width: 991px) {
  /* Sidebar becomes a drawer opened from the menu button. */
  .ad-main { margin-left: 0 }
  .ad-side { width: min(300px, 86vw); transform: translateX(-100%); visibility: hidden; transition: transform .22s var(--ad-ease), visibility 0s linear .22s; box-shadow: none }
  .ad-side.is-open { transform: none; visibility: visible; transition: transform .22s var(--ad-ease); box-shadow: 24px 0 48px -24px rgba(0, 0, 0, .6) }
  .ad-side-close, .ad-menu { display: grid !important }
  .ad-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) }
  .ad-gate-grid { grid-template-columns: 1fr; gap: 40px }
  .ad-gate-points { display: none }
  .ad-hero-full .ad-hero-inner { min-height: auto; padding-top: 136px }
  .ad-footer-inner { flex-direction: column; align-items: flex-start; gap: 12px }
  .ad-rank-cols { grid-template-columns: 1fr }
  .ad-range { display: grid; grid-template-columns: repeat(4, 1fr); width: 100% }
  .ad-range .ad-range-custom { grid-column: span 2; border-left: 1px solid rgba(255, 255, 255, .1) }
  .ad-range button:nth-child(n + 5) { border-top: 1px solid rgba(255, 255, 255, .1) }
  .ad-range button:nth-child(4n + 1) { border-left: 0 }
  .ad-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) }
}
@media (max-width: 767px) {
  .ad-container, .ad-hero-inner { padding-left: 16px; padding-right: 16px }
  .ad-header-inner { height: 68px; gap: 12px }
  .ad-logo img { height: 32px }
  .ad-header-right { gap: 10px }
  .ad-hide-sm { display: none }
  .ad-icon-btn-dark { width: 40px; height: 40px; font-size: 14px }
  .ad-back { font-size: 12px }
  .ad-pagehead-inner { padding-top: 32px; padding-bottom: 28px }
  .ad-pagehead .ad-hero-sub { font-size: 14px }
  .ad-pagehead .ad-toolbar { margin-top: 20px }
  .ad-pagehead .ad-range button { padding: 0 8px; font-size: 12px }
  .ad-pagehead .ad-hero-shape { width: 90px }
  .ad-hero-inner { padding-top: 120px; padding-bottom: 48px }
  .ad-hero-shape { width: 120px }
  .ad-hero-sub { font-size: 15px }
  .ad-toolbar { margin-top: 32px; gap: 12px }
  .ad-range button { padding: 0 8px; font-size: 12px }
  .ad-toolbar .ad-btn { flex: 1 }
  .ad-custom { padding: 16px; gap: 12px }
  .ad-date { flex-basis: calc(50% - 6px) }
  .ad-date-arrow { display: none }
  .ad-custom-actions { flex-basis: 100% }
  .ad-custom-actions .ad-btn { flex: 1 }
  html:has(.ad-filterbar) { scroll-padding-top: 140px }
  .ad-app .ad-filterbar-row { min-height: 0; gap: 10px 12px; padding: 10px 0 }
  .ad-period { gap: 10px; min-width: 0; flex: 1 }
  .ad-period > div { min-width: 0 }
  .ad-period strong, .ad-period span:not(.ad-badge) { overflow: hidden; text-overflow: ellipsis }
  .ad-period .ad-badge-sm { display: none }
  .ad-filterbar-actions { margin-left: 0 }
  .ad-filterbar-actions .ad-btn-ghost { display: none }
  .ad-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none }
  .ad-chips::-webkit-scrollbar { display: none }
  .ad-chip { flex-shrink: 0; max-width: 240px }
  .ad-filter-panel { max-height: calc(100vh - 220px); overflow-y: auto; padding-bottom: 16px }
  .ad-filter-grid { grid-template-columns: 1fr; gap: 12px }
  .ad-filter-foot > div { width: 100% }
  .ad-filter-foot .ad-btn { flex: 1 }
  .ad-section { padding-top: 48px }
  .ad-sec-head { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 24px }
  .ad-sec-head > p { text-align: left }
  .ad-kpis { gap: 12px; margin-bottom: 16px }
  .ad-kpi { min-height: 148px; padding: 16px 16px 0 }
  .ad-kpi-top { flex-wrap: wrap; gap: 8px }
  .ad .ad-kpi-top h3 { flex-basis: 100%; white-space: normal; font-size: 11px; letter-spacing: .06em; line-height: 1.35 }
  .ad-kpi-top .ad-badge-sm { display: none }
  .ad-kpi .ad-kpi-value { margin-top: 12px; font-size: 24px }
  .ad-kpi .ad-kpi-note { font-size: 12px; white-space: normal }
  .ad-kpi .ad-kpi-spark { width: calc(100% + 32px); margin: auto -16px 0 }
  .ad-kpi .ad-meter { margin-bottom: 16px }
  .ad-grid { gap: 16px }
  .ad-grid + .ad-grid { margin-top: 16px }
  .ad-panel { padding: 20px }
  .ad-table-wrap { margin: 0 -20px }
  .ad-table-wrap .ad-table th:first-child { padding-left: 20px }
  .ad-table-wrap .ad-table th:last-child, .ad-table-wrap .ad-table td:last-child { padding-right: 20px }
  .ad-table th, .ad-table td { padding: 10px 8px }
  .ad-table tbody th { min-width: 150px }
  .ad-panel-head .ad-tabs { width: 100% }
  .ad-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)) }
  .ad-tabs button { padding: 0 8px }
  .ad-lc, .ad-bc { grid-template-columns: 32px minmax(0, 1fr) }
  .ad-donut-row, .ad-donut-col { flex-direction: column; align-items: stretch }
  .ad-donut-row ad-donut, .ad-donut-col ad-donut { align-self: center }
  .ad-stat-stack { grid-template-columns: 1fr 1fr; gap: 12px }
  .ad-stat { flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px }
  .ad-stat strong { font-size: 22px }
  .ad-live-value-lg strong { font-size: 64px }
  .ad-chart-total strong { font-size: 28px }
  .ad-hbars-label { gap: 8px }
  .ad-gate-card { padding: 32px 20px 24px }
  .ad-gate-card h2 { font-size: 24px }
}

@media (prefers-reduced-motion: reduce) {
  html:has(.ad) { scroll-behavior: auto }
  .ad *, .ad *::before, .ad *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important }
}
@media (forced-colors: active) {
  .ad-kpi, .ad-panel, .ad-stat, .ad-side, .ad-gate-card, .ad-heat td, .ad-track, .ad-hbars-track { border: 1px solid CanvasText }
  .ad-track > span, .ad-meter span, .ad-hbars-track > span, .ad-funnel-bar span, .ad-bc-cur, .ad-heat td[data-level]:not([data-level="0"]) { background: Highlight !important; forced-color-adjust: none }
  .ad-range button.is-active, .ad-tabs button.is-active, .ad-drill.is-on, .ad-tile.is-on, .ad-side-nav a.is-active { outline: 2px solid Highlight }
  .ad-drill { opacity: 1 }
  .ad-chip, .ad-select select, .ad-date input { border: 1px solid CanvasText }
  .ad-rank-n { -webkit-text-stroke: 0; color: CanvasText }
}
