:root {
  color-scheme: dark;
  --bg: #05070b;
  --bg-soft: #080b11;
  --panel: #0e1219;
  --panel-2: #111722;
  --panel-3: #151d2a;
  --border: #263040;
  --border-soft: #1d2633;
  --text: #f5f7fb;
  --muted: #9ba5b6;
  --soft: #c6ccd7;
  --blue: #2674ed;
  --blue-2: #6aa6ff;
  --control-highlight: rgba(39, 110, 241, 0.2);
  --control-highlight-strong: rgba(39, 110, 241, 0.34);
  --green: #35d48a;
  --amber: #f6b84a;
  --red: #ff5a67;
  --pink: #ed269c;
  --radius: 8px;
  --desktop-nav-height: 66px;
  --mobile-nav-height: 64px;
  --page-max-width: 1600px;
  --page-gutter: clamp(16px, 2.4vw, 34px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  scrollbar-color: #2f2f2f transparent;
  scrollbar-width: auto;
}

::-webkit-scrollbar,
*::-webkit-scrollbar {
  width: 20px;
  height: 20px;
}

::-webkit-scrollbar-track,
*::-webkit-scrollbar-track {
  border: 0;
  background: transparent;
  box-shadow: none;
}

::-webkit-scrollbar-thumb,
*::-webkit-scrollbar-thumb {
  border: 0;
  border-radius: 999px;
  background: #2f2f2f;
  box-shadow: none;
}

::-webkit-scrollbar-corner,
*::-webkit-scrollbar-corner {
  background: transparent;
}

html {
  min-height: 100%;
  background: var(--bg);
  user-select: none;
}

body {
  min-height: 100%;
  max-width: var(--page-max-width);
  margin: 0 auto;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Roboto", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

button:focus,
button:focus-visible,
button:active {
  outline: 0;
}

button::-moz-focus-inner {
  border: 0;
}

a:focus-visible {
  outline: 0;
  background: var(--control-highlight);
}

.cookie-consent {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  z-index: 160;
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

.cookie-consent[hidden] {
  display: none;
}

.cookie-consent.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.cookie-card {
  position: relative;
  display: grid;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 15px;
  background: radial-gradient(circle at 16% 0%, rgba(38, 116, 237, 0.2), transparent 34%), radial-gradient(circle at 86% 100%, rgba(237, 38, 156, 0.17), transparent 30%), var(--panel);
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.46);
  padding: 20px;
}

.cookie-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 46px;
}

.cookie-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.cookie-card h2 {
  margin: 0;
  color: var(--text);
  font-size: 1.2rem;
  line-height: 1.1;
}

.cookie-card p {
  margin: 0;
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.7;
}

.cookie-close {
  position: absolute;
  top: 24px;
  right: 20px;
  width: 38px;
  height: 38px;
  border: 0;
  background: transparent;
}

.cookie-close::before,
.cookie-close::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 34px;
  height: 3px;
  border-radius: 999px;
  background: #fff;
  content: "";
}

.cookie-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.cookie-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.cookie-preferences {
  display: none;
  gap: 12px;
}

.cookie-consent.is-customizing {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cookie-consent.is-customizing .cookie-preferences {
  display: grid;
}

.cookie-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(5, 7, 11, 0.72);
  padding: 15px;
}

.cookie-option span {
  display: grid;
  gap: 4px;
}

.cookie-option strong {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.2;
}

.cookie-option small {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.cookie-option input {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  accent-color: var(--blue);
}

.cookie-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.cookie-button {
  min-height: 56px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  font-weight: 800;
  line-height: 1;
  transition:
    transform 0.2s ease,
    background 0.2s ease;
}

.cookie-button:hover {
  transform: translateY(-2px);
}

.cookie-button-primary {
  background: linear-gradient(90deg, var(--blue), var(--pink));
}

.cookie-button-secondary {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--panel-3);
}

@media (min-width: 721px) {
  .cookie-consent {
    right: 24px;
    bottom: 24px;
    left: auto;
    width: min(360px, calc(100% - 48px));
  }

  .cookie-header {
    gap: 24px;
    padding-right: 44px;
  }

  .cookie-close {
    right: 24px;
    width: 32px;
    height: 32px;
  }

  .cookie-close::before,
  .cookie-close::after {
    width: 28px;
  }
}

.topbar {
  position: fixed;
  inset: 0 0 auto;
  left: max(0px, calc((100vw - var(--page-max-width)) / 2));
  right: max(0px, calc((100vw - var(--page-max-width)) / 2));
  z-index: 120;
  background: #010102bd;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--desktop-nav-height);
  padding: 12px var(--page-gutter);
}

.demo-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  margin-left: 10px;
}

.demo-brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  object-fit: contain;
}

.demo-brand-text {
  display: inline-flex;
  align-items: baseline;
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
}

.demo-brand-text strong {
  color: #08aaa9;
  font-weight: 800;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.brand-text {
  display: inline-flex;
  align-items: baseline;
  color: var(--text);
  font-family: Roboto, sans-serif;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.brand-text strong {
  color: #08aaa9;
  font-weight: 800;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--soft);
  padding: 0 15px;
  white-space: nowrap;
}

.chip.primary {
  color: #fff;
  font-weight: 800;
  width: 100px;
}

#dateChip {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.refresh-note {
  max-width: 240px;
  margin-left: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.refresh-note::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 8px;
  border-radius: 50%;
  background: var(--green);
}

.filter-icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
}

.filter-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.filter-icon-close,
#controlToggle.is-open .filter-icon-funnel {
  display: none;
}

#controlToggle.is-open .filter-icon-close {
  display: inline-flex;
}

.dashboard,
.site-footer {
  transition: opacity 0.2s ease;
}

.dashboard {
  width: 100%;
  min-width: 0;
  padding: calc(var(--desktop-nav-height) + 26px) var(--page-gutter) 42px;
}

body.has-open-filters .dashboard,
body.has-open-filters .site-footer {
  opacity: 0.5;
}

.control-drawer {
  position: fixed;
  top: var(--desktop-nav-height);
  left: max(0px, calc((100vw - var(--page-max-width)) / 2));
  right: max(0px, calc((100vw - var(--page-max-width)) / 2));
  z-index: 118;
  display: none;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  max-height: calc(100dvh - var(--desktop-nav-height) - 10px);
  margin: 0;
  overflow: visible;
  border-bottom: 0;
  border-top: 0;
  background: var(--panel);
  padding: 18px;
  opacity: 1;
  pointer-events: auto;
  transform: none;
  transition: none;
  visibility: visible;
  will-change: auto;
}

.control-drawer.open {
  display: grid;
  background: var(--bg-soft);
  transition: none;
}

.control-grid {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(132px, 1fr));
  gap: 10px;
}

.control-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
}

.control-field > span {
  text-align: center;
}

.control-field span,
.multi-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.multi-label {
  font-size: 11px;
  letter-spacing: 0.09em;
}

.custom-select {
  position: relative;
  min-width: 0;
}

.custom-select-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: 5px;
  background: #0a0f17;
  color: var(--text);
  padding: 0 10px 0 12px;
  text-align: left;
}

.custom-select-button:hover {
  background: #0d1420;
}

.custom-select-button:focus-visible,
.custom-select.is-open .custom-select-button {
  color: #fff;
}

.custom-select-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-caret {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 8px;
  color: var(--blue-2);
  font-size: 13px;
  line-height: 1;
  transition: none;
}

.custom-select.is-open .custom-select-caret {
  transform: rotate(180deg);
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  right: 0;
  z-index: 90;
  display: none;
  max-height: none;
  overflow: visible;
  border: 0;
  border-radius: 14px;
  background: #171e29;
  padding: 7px;
  scrollbar-width: none;
}

.custom-select.is-open .custom-select-menu {
  display: grid;
  gap: 6px;
  animation: none;
}

.custom-select-menu::-webkit-scrollbar {
  display: none;
}

#yearSelect .custom-select-menu {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#monthSelect .custom-select-menu {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#yearSelect .custom-select-option,
#monthSelect .custom-select-option {
  display: grid;
  min-height: 38px;
  place-items: center;
  padding: 8px 6px;
  text-align: center;
}

#yearSelect .custom-select-option:first-child,
#monthSelect .custom-select-option:first-child {
  grid-column: 1 / -1;
}

.custom-select-option {
  min-height: 36px;
  border: 0;
  border-radius: 10px;
  color: var(--soft);
  cursor: pointer;
  padding: 8px 9px;
  transition: none;
}

.custom-select-option:hover {
  background: var(--control-highlight-strong);
  color: #fff;
}

.custom-select-option.is-selected {
  background: var(--control-highlight);
  color: #fff;
}

.filter-groups {
  display: grid;
  grid-column: span 2;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 0;
}

.dropdown-filter-row {
  align-items: start;
  position: relative;
  z-index: 40;
}

.multi-select {
  position: relative;
  min-width: 0;
}

.multi-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  border: 0;
  border-radius: 15px;
  background: var(--panel-2);
  color: var(--text);
  padding: 10px 13px;
  text-align: left;
}

.multi-toggle:hover {
  background: var(--panel-3);
}

.multi-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.multi-copy strong {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multi-caret {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 11px;
  background: #0a1019;
  color: var(--blue-2);
  transition: none;
}

.multi-select.open .multi-caret {
  transform: rotate(180deg);
}

.multi-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 80;
  display: none;
  max-height: none;
  overflow: visible;
  border: 0;
  border-radius: 16px;
  background: #171e29;
  padding: 11px;
  scrollbar-width: none;
}

.filter-groups .multi-menu::-webkit-scrollbar {
  display: none;
}

.multi-select.open .multi-menu {
  display: block;
  animation: none;
}

.multi-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 9px;
  padding: 0 2px;
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.multi-menu-head small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}

.checks,
.multi-menu .checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.check-pill {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: 13px;
  color: var(--soft);
  padding: 10px 11px;
  user-select: none;
  transition: none;
}

.check-pill:hover {
  background: rgba(16, 24, 37, 0.95);
}

.check-pill:focus-within,
.check-pill:active {
  background: var(--control-highlight);
  color: #fff;
}

.check-pill input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.check-pill input:focus,
.check-pill input:focus-visible {
  outline: 0;
}

.check-pill span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-actions {
  display: grid;
  grid-column: span 2;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-self: end;
  gap: 10px;
  margin-top: 0;
}

.ghost-button,
.danger-button {
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: #192a48;
  color: var(--soft);
  padding: 0 13px;
  font-weight: 500;
}

.drawer-actions button {
  width: 100%;
  min-height: 58px;
}

.danger-button {
  background: rgba(255, 90, 103, 0.08);
  color: #ffd0d4;
}

.ghost-button:hover,
.ghost-button:focus-visible,
.ghost-button:active {
  background: var(--control-highlight);
  color: #fff;
}

.danger-button:hover,
.danger-button:focus-visible,
.danger-button:active {
  background: rgba(255, 90, 103, 0.2);
  color: #fff;
}

.section-dark {
  background-color: var(--bg);
}

.site-footer {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 65px 0;
  text-align: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 18px;
  color: var(--muted);
  font-size: 13px;
}

.footer-links a,
.footer-links button {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover,
.footer-links a:focus-visible,
.footer-links button:hover,
.footer-links button:focus-visible {
  color: var(--text);
}

.footer-links button {
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.copyright {
  color: var(--text);
  text-align: center;
}

.metric-grid,
.content-grid,
.ai-command-row {
  display: grid;
  gap: 14px;
}

.metric-grid {
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  margin-bottom: 14px;
}

.metric-card,
.panel,
.ai-hero-card,
.ai-side-card,
.ai-wide-card {
  border-radius: var(--radius);
  background: var(--panel);
}

.metric-card {
  position: relative;
  min-height: 132px;
  overflow: hidden;
  padding: 17px;
}

.metric-card > :not(.metric-bg) {
  position: relative;
  z-index: 1;
}

.metric-bg {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 70px;
  height: 70px;
  color: var(--accent);
  opacity: 0.2;
  pointer-events: none;
}

.metric-bg svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.metric-top {
  display: flex;
  align-items: center;
}

.metric-label {
  color: var(--soft);
  font-size: 16px;
  font-weight: 800;
}

.metric-value {
  margin: 15px 0 8px;
  font-size: clamp(24px, 2vw, 31px);
  font-weight: 700;
  line-height: 1.1;
}

.metric-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.metric-change {
  color: var(--green);
  font-weight: 800;
}

.metric-change.bad {
  color: var(--red);
}

.metric-change.down {
  color: var(--amber);
}

.content-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-areas:
    "trend trend trend trend trend trend marketing marketing marketing marketing marketing marketing"
    "channel channel channel channel anomaly anomaly anomaly anomaly anomaly anomaly anomaly anomaly"
    "customer customer customer customer product product product product drivers drivers drivers drivers";
}

.panel {
  position: relative;
  min-height: 300px;
  overflow: hidden;
}

.panel:has(.custom-select.is-open) {
  overflow: visible;
  z-index: 20;
}

.panel:has(> .chart-host) {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.trend-panel {
  grid-area: trend;
}

.channel-panel {
  grid-area: channel;
}

.customer-panel {
  grid-area: customer;
}

.marketing-panel {
  grid-area: marketing;
}

.product-performance-panel {
  grid-area: product;
}

.panel-heading {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 18px 8px;
}

.panel-heading.compact {
  padding-bottom: 0;
}

.panel-heading.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 14px;
  row-gap: 4px;
}

.panel-heading.split > div:first-child {
  display: contents;
}

.panel-heading.split h2 {
  grid-column: 1;
  grid-row: 1;
}

.panel-heading.split p {
  grid-column: 1 / -1;
  grid-row: 2;
}

.panel-heading.split .summary-pill {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  margin-left: 0;
}

.panel-title-select {
  display: grid;
  grid-column: 1;
  grid-row: 1;
  width: min(220px, 100%);
  min-width: 0;
  gap: 6px;
}

.panel-title-select .custom-select-button {
  height: 38px;
  background: #0b1018;
  font-weight: 800;
}

.panel-title-select .custom-select-button:hover {
  background: #0d1420;
}

.product-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 180px);
  align-items: center;
}

.product-heading > div:first-child {
  min-width: 0;
}

.panel-side-select {
  display: grid;
  width: 100%;
  min-width: 0;
  justify-self: end;
  gap: 6px;
}

.panel-side-select .custom-select-button {
  height: 38px;
  background: #0b1018;
  font-weight: 800;
}

.panel-side-select .custom-select-button:hover {
  background: #0d1420;
}

.panel-heading h2,
.ai-hero-top h2,
.ai-side-heading h2 {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
  margin: 9px 0;
}

.panel-heading p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  text-transform: capitalize;
}

.summary-pill {
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: #0b1018;
  color: var(--soft);
  font-size: 12px;
  padding: 8px 14px;
  white-space: nowrap;
  margin-left: auto;
}

.summary-pill b {
  color: var(--green);
}

.product-bars {
  display: grid;
  gap: 13px;
  padding: 14px 18px 18px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(80px, 140px) minmax(100px, 1fr) 62px;
  align-items: center;
  gap: 10px;
}

.bar-label {
  overflow: hidden;
  color: var(--soft);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 110px;
}

.bar-track {
  position: relative;
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #1b2330;
}

.bar-fill {
  min-width: 3px;
  height: 100%;
  border-radius: inherit;
}

.bar-value {
  color: var(--text);
  font-size: 14px;
  text-align: right;
  width: 50px;
}

.chart-host {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-self: stretch;
  gap: 10px;
  width: 100%;
  min-width: 0;
  height: clamp(300px, 24vw, 320px);
  margin-bottom: 25px;
  overflow: hidden;
}

.chart-host.marketing {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 8px;
}

.chart-svg {
  display: block;
  width: 100%;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

.chart-hover-item {
  outline: 0;
}

.chart-hit-zone {
  fill: transparent;
  cursor: crosshair;
  pointer-events: all;
}

.chart-guide,
.chart-focus-point,
.chart-focus-bar,
.chart-callout {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease;
}

.chart-hover-item:hover .chart-guide,
.chart-hover-item:hover .chart-focus-point,
.chart-hover-item:hover .chart-focus-bar,
.chart-hover-item:hover .chart-callout,
.chart-hover-item:focus .chart-guide,
.chart-hover-item:focus .chart-focus-point,
.chart-hover-item:focus .chart-focus-bar,
.chart-hover-item:focus .chart-callout {
  opacity: 1;
}

.chart-guide {
  stroke: #d7e3f4;
  stroke-dasharray: 3 5;
  stroke-width: 1;
}

.chart-focus-point {
  stroke: #05070b;
  stroke-width: 2;
}

.chart-focus-bar {
  fill: transparent;
  stroke: #edf4ff;
  stroke-width: 1.5;
}

.chart-callout-bg {
  fill: #0b1018;
  stroke: #344154;
  stroke-width: 1;
}

.chart-callout text {
  font-size: 11px;
  letter-spacing: 0;
}

.chart-callout-title {
  fill: var(--text);
  font-weight: 800;
}

.chart-callout-text {
  fill: #cbd5e1;
}

.chart-grid {
  stroke: #273344;
  stroke-width: 1;
}

.axis-text {
  fill: #9fa9b9;
  font-size: 11px;
}

.chart-title {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  min-width: 0;
  flex-wrap: wrap;
  color: var(--soft);
  font-size: 11px;
  line-height: 1.2;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}

.chart-legend-mark {
  display: inline-block;
  width: 18px;
  height: 5px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--legend-color);
}

.chart-legend-line {
  height: 0;
  border-top: 2px solid var(--legend-color);
}

.chart-legend-dashed {
  background: none;
  border-top: 2px dashed var(--legend-color);
}

.chart-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.marketing-label-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px 10px;
  min-width: 0;
  overflow: hidden;
  padding: 0 30px;
}

.marketing-label-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.marketing-label-item span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.marketing-label-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--dot);
}

.pie-layout {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
}

.pie-host {
  display: grid;
  min-height: 300px;
  place-items: center;
}

.pie-slice {
  cursor: pointer;
  outline: 0;
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.16s ease;
}

.pie-slice:hover,
.pie-slice:focus {
  transform: scale(1.055);
}

.pie-slice-label {
  fill: #fff;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.02em;
  pointer-events: none;
  text-shadow: 0 0 2px #000;
}

.pie-slice-percent {
  font-size: 18px;
  font-weight: 900;
}

.pie-center-title {
  fill: var(--text);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

.stack-list {
  display: grid;
  gap: 10px;
  padding: 13px 18px 18px;
}

.stack-item,
.forecast-card,
.ai-signal,
.plan-item,
.insight-chip {
  border: 1px solid var(--border-soft);
  border-radius: 15px;
  background: rgba(5, 9, 16, 0.66);
}

.stack-item {
  display: grid;
  grid-template-columns: 1fr;
  align-content: center;
  padding: 30px;
}

.stack-title {
  margin-bottom: 3px;
  font-size: 1.1rem;
  font-weight: 800;
  text-transform: capitalize;
}

.stack-kicker {
  color: var(--soft);
  font-size: 13px;
  font-weight: 700;
  text-transform: capitalize;
}

.stack-text {
  font-size: 1.2rem;
  font-weight: 900;
  margin-top: 12px;
  color: var(--amber);
}

.driver-table {
  padding: 12px 18px 18px;
}

.driver-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--soft);
  font-size: 13px;
  padding: 12px 0;
}

.driver-row:first-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.driver-row:last-child {
  border-bottom: 0;
}

.impact {
  color: var(--green);
  font-weight: 800;
}

.impact.negative {
  color: var(--red);
}

.anomaly-panel {
  display: flex;
  min-height: 300px;
  flex-direction: column;
}

.anomaly-panel .panel-heading {
  flex: 0 0 auto;
}

.anomaly-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
}

.anomaly-grid .stack-item {
  height: 100%;
  position: relative;
  overflow: hidden;
}

.anomaly-grid .stack-item::after {
  content: attr(data-icon);
  position: absolute;
  right: 20px;
  bottom: 5px;
  color: var(--blue-2);
  font-size: 92px;
  font-weight: 900;
  line-height: 1;
  opacity: 0.1;
  pointer-events: none;
}

.anomaly-grid .tone-pink::after {
  color: #ff7db5;
  opacity: 0.13;
}

.anomaly-grid .tone-green::after {
  color: var(--green);
  opacity: 0.12;
}

.anomaly-grid .stack-item > * {
  position: relative;
  z-index: 1;
}

.anomaly-panel {
  grid-area: anomaly;
}

.revenue-drivers-panel {
  grid-area: drivers;
}

.ai-command-row {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-areas: "verdict verdict verdict verdict verdict verdict verdict verdict forecast forecast forecast forecast" "plan plan plan plan plan plan insights insights insights insights insights insights";
  align-items: stretch;
  margin-top: 14px;
}

.ai-hero-card,
.ai-side-card,
.ai-wide-card {
  min-height: 245px;
  overflow: hidden;
  padding: 19px;
}

.ai-hero-card {
  display: flex;
  flex-direction: column;
  grid-area: verdict;
}

.ai-forecast-card {
  grid-area: forecast;
  display: flex;
  flex-direction: column;
}

.ai-plan-card {
  grid-area: plan;
}

.ai-wide-card {
  grid-area: insights;
}

.ai-hero-top,
.ai-side-heading {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.ai-status-pill,
.ai-side-heading span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  background: #0b1018;
  color: var(--soft);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 14px;
  white-space: nowrap;
  border: 1px solid var(--border-soft);
}

.ai-status-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.ai-rationale {
  position: relative;
  z-index: 1;
  margin: 18px 0 0;
  color: #cdd6e5;
}

.ai-signal-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  flex: 1;
  gap: 10px;
  margin-top: 18px;
  min-height: 0;
}

.ai-signal {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.ai-signal span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.ai-signal strong {
  display: block;
  font-size: 1.4rem;
  margin: 4px 0 2px;
}

.ai-signal em {
  display: block;
  margin-top: 2px;
  color: var(--green);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.forecast-list {
  display: grid;
  gap: 12px;
  padding: 13px 18px 18px;
}

.compact-forecast {
  position: relative;
  z-index: 1;
  flex: 1;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  min-height: 0;
  padding: 14px 0 0;
}

.forecast-card {
  display: flex;
  min-height: 130px;
  flex-direction: column;
  justify-content: space-between;
  padding: 13px;
  max-height: 130px;
}

.forecast-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.forecast-label {
  color: var(--muted);
  font-size: 12px;
}

.forecast-value {
  font-size: 25px;
  font-weight: 800;
}

.forecast-change {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.sparkline {
  display: grid;
  flex: 1;
  min-height: 44px;
  margin-top: 8px;
}

.plan-list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.plan-item {
  padding: 12px 13px;
}

.plan-item-top,
.insight-chip-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 15px;
  font-weight: 500;
}

.plan-dot,
.insight-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.plan-dot {
  background: var(--blue);
}

.insight-chips {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}

.insight-chip {
  padding: 12px 13px;
}

.insight-dot {
  background: var(--dot);
}

.plan-item p,
.insight-chip p {
  margin: 0;
  color: var(--muted);
  margin-left: 20px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 120px;
  height: 100%;
  color: var(--muted);
  text-align: center;
}

@media (hover: none) and (pointer: coarse) {
  .custom-select-button:hover {
    background: #0a0f17;
  }

  .multi-toggle:hover {
    background: var(--panel-2);
  }
}

/* Tablet layout, tuned for 720px and covering widths up to desktop. */
@media (max-width: 1024px) {
  :root {
    --page-gutter: 8px;
  }

  .top-actions {
    justify-content: flex-end;
    min-height: var(--mobile-nav-height);
    padding: 10px 12px;
  }

  .demo-brand {
    gap: 8px;
  }

  .demo-brand-mark {
    width: 36px;
    height: 36px;
  }

  .demo-brand-text {
    font-size: 24px;
  }

  #dateChip {
    max-width: clamp(112px, 22vw, 260px);
  }

  .dashboard {
    padding-top: calc(var(--mobile-nav-height) + 16px);
    padding-bottom: 24px;
  }

  .control-drawer {
    top: var(--mobile-nav-height);
    right: 0;
    bottom: auto;
    left: 0;
    z-index: 118;
    width: auto;
    height: auto;
    max-height: calc(100dvh - var(--mobile-nav-height) - 10px);
    overflow: visible;
    border: 0;
    border-radius: 0;
    padding: 16px 14px;
    transform: none;
  }

  .control-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
    margin-top: 12px;
  }

  .control-grid .control-field:nth-child(n + 3) {
    grid-column: auto;
  }

  .filter-groups {
    grid-column: span 4;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 0;
  }

  .multi-copy strong {
    white-space: normal;
  }

  .drawer-actions {
    grid-column: span 4;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .drawer-actions button {
    width: 100%;
    min-height: 30px;
  }

  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .metric-card {
    min-height: 116px;
    padding: 14px;
  }

  .metric-bg {
    right: 5px;
    bottom: 5px;
    width: 70px;
    height: 70px;
    opacity: 0.1;
  }

  .metric-label {
    font-size: 14px;
    line-height: 1;
  }

  .metric-value {
    margin-top: 12px;
    font-size: clamp(18px, 7vw, 24px);
  }

  .metric-foot {
    gap: 6px;
    font-size: 12px;
  }

  .content-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "trend trend"
      "marketing marketing"
      "channel customer"
      "product product"
      "anomaly anomaly"
      "drivers drivers";
    gap: 10px;
  }

  .ai-command-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .panel,
  .anomaly-panel,
  .revenue-drivers-panel {
    min-height: auto;
  }

  .pie-layout {
    grid-template-columns: 1fr;
  }

  .product-bars {
    gap: 12px;
  }

  .bar-row {
    grid-template-columns: 110px 1fr 50px;
  }

  .ai-signal {
    padding: 30px 0;
  }

  .ai-command-row {
    grid-template-areas:
      "verdict"
      "forecast"
      "plan"
      "insights";
  }

  .ai-hero-card,
  .ai-side-card,
  .ai-wide-card {
    min-height: auto;
    padding: 16px;
  }

  .compact-forecast {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
  }

  .ai-signal-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .anomaly-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: auto;
  }

  .anomaly-grid .stack-item {
    height: auto;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand-text {
    font-size: 1.5rem;
  }
}

/* Mobile layout: less than 500px. */
@media (max-width: 499px) {
  :root {
    --mobile-nav-height: 72px;
  }

  body {
    font-size: 13px;
  }

  .dashboard {
    padding-top: calc(var(--mobile-nav-height) + 14px);
    padding-bottom: 18px;
  }

  .top-actions {
    min-height: var(--mobile-nav-height);
  }

  .top-actions .chip:not(#controlToggle),
  .top-actions .refresh-note {
    display: none;
  }

  #controlToggle {
    width: 48px;
    min-width: 48px;
    height: 48px;
    border-radius: 16px;
    padding: 0;
  }

  #controlToggle .filter-toggle-text {
    display: none;
  }

  .control-drawer {
    top: var(--mobile-nav-height);
    right: 0;
    bottom: auto;
    left: 0;
    z-index: 130;
    width: auto;
    height: auto;
    max-height: calc(100dvh - var(--mobile-nav-height) - 10px);
    overflow: visible;
    border: 0;
    border-radius: 0;
    padding: 16px 12px;
    transform: none;
    grid-template-columns: 1fr;
  }

  .control-drawer,
  .control-drawer.open {
    transition: none;
  }

  .control-drawer {
    background: var(--panel);
    will-change: auto;
  }

  .multi-select.open {
    z-index: 160;
  }

  .control-grid,
  .filter-groups,
  .drawer-actions {
    grid-column: 1;
  }

  .control-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .control-grid .control-field:nth-child(n + 3) {
    grid-column: 1 / -1;
  }

  .filter-groups {
    grid-template-columns: 1fr;
  }

  #yearSelect .custom-select-menu,
  #monthSelect .custom-select-menu {
    width: calc(200% + 10px);
  }

  #yearSelect .custom-select-menu {
    right: auto;
    left: 0;
  }

  #monthSelect .custom-select-menu {
    right: 0;
    left: auto;
  }

  .product-heading {
    grid-template-columns: 1fr 1fr;
  }

  .panel-side-select {
    width: min(220px, 100%);
    justify-self: stretch;
  }

  .custom-select.is-open .custom-select-menu,
  .multi-select.open .multi-menu {
    animation: none;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "trend"
      "marketing"
      "channel"
      "customer"
      "product"
      "anomaly"
      "drivers";
  }

  .metric-card {
    min-height: 116px;
    padding: 20px 14px;
  }

  .summary-pill,
  .ai-status-pill,
  .ai-side-heading span {
    white-space: normal;
  }

  .compact-forecast {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }

  .chart-host {
    height: 220px;
  }

  .chart-host.marketing {
    height: 260px;
  }

  .marketing-label-item {
    font-size: 10px;
  }

  .axis-text {
    font-size: 10px;
  }

  .ai-rationale {
    font-size: 13px;
    text-align: justify;
    line-height: 1.5;
    letter-spacing: -0.005rem;
  }

  .ai-signal-grid {
    grid-template-columns: 1fr;
  }

  .anomaly-grid {
    grid-template-columns: 1fr;
  }

  .stack-text {
    font-size: 1.1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
