/* analytics: owned by one work stream; merged into v2.css later. */
.an-page {
  --an-surface: rgba(255, 255, 255, 0.9);
  --an-sunken: rgba(11, 16, 48, 0.035);
  --an-line: rgba(11, 16, 48, 0.07);
  --an-text: #0b1030;
  --an-muted: rgba(11, 16, 48, 0.55);
  --an-accent: #2f52ff;
  --an-accent-soft: rgba(47, 82, 255, 0.12);
  --an-accent-gradient: linear-gradient(135deg, #5a7cff, #2f52ff 52%, #3a34e0);
  --an-ok: #1d7a52;
  --an-ok-soft: rgba(29, 122, 82, 0.12);
  --an-danger: #c23a3a;
  --an-danger-soft: rgba(214, 69, 69, 0.12);
  --an-warn: #a35a00;
  --an-warn-soft: rgba(214, 128, 20, 0.14);
  --an-shadow:
    inset 0 0 0 1px rgba(11, 16, 48, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 24px 48px -16px rgba(20, 30, 90, 0.14);
}
.an-page .app-main {
  display: flex;
  flex-direction: column;
  padding-block: 22px;
  overflow: hidden;
}
.an-page .app-page-title {
  margin-bottom: 12px;
}
.an-page .app-page-title > span {
  margin-bottom: 5px;
}
.an-page .app-page-title h3 {
  font-size: 24px;
}
.an-page .analytics-pills {
  flex: none;
  margin-bottom: 10px;
}
.an-page .analytics-pills button[aria-pressed="true"],
.an-halls .app-pill[aria-pressed="true"] {
  color: var(--an-accent);
}
.an-page .date-filter {
  flex: none;
  align-items: center;
  padding: 6px 6px 6px 14px;
  margin-bottom: 12px;
}
.an-page .date-filter button[aria-pressed="true"] {
  background: var(--an-accent-gradient);
  border-color: transparent;
  box-shadow: 0 8px 18px -10px rgba(47, 82, 255, 0.7);
}
.an-views {
  flex: 1;
  min-height: 0;
  color: var(--an-text);
}
.an-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  min-height: 0;
}
/* Sectioned views flow like the standalone marketing window's .app-main. */
.an-view:is(.an-overview, .an-marketing) {
  gap: 0;
  height: auto;
}
.an-views .overview-grid {
  gap: 12px;
}
.an-views .overview-grid .app-kpi,
.an-mini,
.an-card {
  background: var(--an-surface);
  border: 0;
  box-shadow: var(--an-shadow);
}
.an-views .overview-grid .app-kpi {
  display: flex;
  flex-direction: column;
  padding: 16px 18px;
  border-radius: 22px;
}
.an-views .overview-grid .kpi-label {
  justify-content: flex-start;
  gap: 8px;
  color: var(--an-text);
  font-size: 11px;
  font-weight: 500;
}
.an-kpi-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--an-accent-soft);
  color: var(--an-accent);
}
.an-views .overview-grid .an-kpi-icon .app-icon {
  width: 13px;
  height: 13px;
  color: currentColor;
}
.an-views .overview-grid .an-info {
  width: 12px;
  height: 12px;
  color: var(--an-muted);
}
.an-views .overview-grid .kpi-value {
  margin-top: 14px;
  font-size: clamp(24px, 2.5vw, 36px);
  font-weight: 300;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.an-views .overview-grid .kpi-value small {
  color: var(--an-muted);
  letter-spacing: 0;
}
.an-chips {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-top: 12px;
}
.an-chips small {
  padding: 3px 8px;
  border-radius: 10px;
  background: var(--an-accent-soft);
  color: var(--an-accent);
  font-size: 9px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.an-chips span {
  white-space: nowrap;
}
.an-deltas {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--an-line);
}
.an-delta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 9px;
  color: var(--an-muted);
  white-space: nowrap;
}
.an-delta b {
  display: inline-flex;
  align-items: center;
  flex: none;
  padding: 2px 7px 2px 6px;
  border-radius: 999px;
  background: var(--an-ok-soft);
  color: var(--an-ok);
  font-size: 9px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.an-delta b::before {
  content: "↗\2009+";
}
.an-delta.is-down b {
  background: var(--an-danger-soft);
  color: var(--an-danger);
}
.an-delta.is-down b::before {
  content: "↘\2009−";
}
.an-delta small {
  margin-left: auto;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}
.an-minis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  flex: none;
}
.an-minis-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.an-mini {
  min-width: 0;
  padding: 12px 14px;
  border-radius: 18px;
}
.an-mini > span {
  font-size: 10px;
  color: var(--an-muted);
}
.an-mini strong {
  display: flex;
  align-items: baseline;
  gap: 3px;
  margin-top: 6px;
  font-size: 22px;
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.an-mini strong small {
  font-size: 0.55em;
  color: var(--an-muted);
}
.an-mini p {
  margin: 6px 0 0;
  font-size: 9px;
  line-height: 1.35;
  color: var(--an-muted);
}
.an-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  flex: 1;
  min-height: 0;
}
.an-split-wide {
  grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
}
.an-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 14px 16px;
  border-radius: 20px;
}
.an-card h5 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 500;
}
.an-card h6 {
  margin: auto 0 8px;
  padding-top: 12px;
  font-size: 10px;
  font-weight: 500;
  color: var(--an-muted);
}
.an-flat {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 8px;
}
.an-card > .an-flat:not(h6 + .an-flat) {
  margin-top: auto;
}
.an-flat > div {
  display: grid;
  gap: 3px;
  padding: 9px 11px;
  border-radius: 14px;
  background: var(--an-sunken);
  box-shadow: inset 0 0 0 1px var(--an-line);
}
.an-flat > div > span {
  font-size: 9px;
  color: var(--an-muted);
}
.an-flat b {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.an-note {
  margin: auto 0 0;
  padding-top: 10px;
  font-size: 9px;
  line-height: 1.4;
  color: var(--an-muted);
}
.an-bar {
  position: relative;
  display: block;
  height: 8px;
  border-radius: 999px;
  background: var(--an-sunken);
  overflow: hidden;
}
.an-bar i,
.an-ret i {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--w) * 100%);
  border-radius: inherit;
  background: var(--an-accent-gradient);
  transition: width 0.7s var(--ease);
}
.an-bars {
  display: grid;
}
.an-bar-row {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) 42px 22px;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--an-line);
  font-size: 10px;
}
.an-bar-row:last-child {
  border-bottom: 0;
}
.an-bar-row > b {
  font-weight: 500;
  white-space: nowrap;
}
.an-bar-row > small {
  text-align: right;
  color: var(--an-muted);
}
.an-bar-row > span:first-child small {
  display: block;
  font-size: 8px;
  color: var(--an-muted);
}
.an-staff .an-bar-row {
  grid-template-columns: 82px minmax(0, 1fr) 34px;
}
.an-feed {
  display: grid;
  gap: 8px;
}
.an-review {
  padding: 9px 12px;
  border-radius: 14px;
  background: var(--an-sunken);
  box-shadow: inset 0 0 0 1px var(--an-line);
}
.an-stars {
  font-size: 10px;
  letter-spacing: 1px;
  color: #f5a524;
}
.an-stars > span {
  color: rgba(11, 16, 48, 0.14);
}
.an-review p {
  margin: 3px 0 2px;
  font-size: 10px;
  line-height: 1.35;
}
.an-review small {
  font-size: 8px;
  color: var(--an-muted);
}
.an-review em {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--an-warn-soft);
  color: var(--an-warn);
  font-size: 8px;
  font-style: normal;
  font-weight: 600;
}
.an-halls {
  display: flex;
  gap: 6px;
  flex: none;
  overflow-x: auto;
  scrollbar-width: none;
}
.an-halls .app-pill[aria-pressed="true"] {
  background: #fff;
  box-shadow:
    0 0 0 1px rgba(47, 82, 255, 0.22),
    0 4px 10px -6px rgba(47, 82, 255, 0.5);
}
.an-table-card {
  padding: 6px 4px 4px;
  overflow: auto;
}
.an-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.an-table th {
  padding: 8px 10px;
  border-bottom: 1px solid var(--an-line);
  color: var(--an-muted);
  font-size: 9px;
  font-weight: 500;
  text-align: right;
  white-space: nowrap;
}
.an-table td {
  padding: 5px 10px;
  border-bottom: 1px solid var(--an-line);
  text-align: right;
  white-space: nowrap;
}
.an-table-card tbody td {
  height: 40px;
}
.an-table tbody tr:last-child td {
  border-bottom: 0;
}
.an-table tfoot td {
  padding-block: 9px;
  border-top: 1px solid var(--an-line);
  border-bottom: 0;
  font-weight: 500;
}
.an-table tfoot td:first-child {
  padding-left: 42px;
}
.an-table th:first-child,
.an-table td:first-child {
  text-align: left;
}
.an-table td:first-child > span:last-child {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
}
.an-table td:first-child b {
  font-weight: 500;
}
.an-table td small {
  font-size: 8px;
  color: var(--an-muted);
}
.an-table .an-delta {
  justify-content: flex-end;
}
.an-avatar {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--an-accent-soft);
  color: var(--an-accent);
  font-size: 10px;
  font-weight: 600;
  vertical-align: middle;
}
.an-ret {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 5px;
  margin-right: 6px;
  border-radius: 999px;
  background: var(--an-sunken);
  overflow: hidden;
  vertical-align: middle;
}
.an-ret i {
  background: linear-gradient(135deg, #3fc189, #1d8a5c);
}
.an-hall-bars {
  display: grid;
  grid-auto-rows: minmax(0, 1fr);
  flex: 1;
  max-height: 260px;
}
.an-hall-bar {
  display: grid;
  align-content: center;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--an-line);
  font-size: 10px;
  transition: opacity 0.3s;
}
.an-hall-bar:last-child {
  border-bottom: 0;
}
.an-hall-bar small {
  display: block;
  margin-top: 2px;
  font-size: 8px;
  color: var(--an-muted);
}
.an-hall-bar > b {
  font-weight: 500;
  white-space: nowrap;
}
.an-hall-bar .an-bar {
  grid-column: 1 / -1;
}
.an-hall-bar.is-dim {
  opacity: 0.35;
}
.an-ladder {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  flex: 1;
  min-height: 120px;
}
.an-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 0;
  text-align: center;
}
.an-step b {
  font-size: 12px;
  font-weight: 500;
}
.an-step small {
  font-size: 9px;
  color: var(--an-muted);
}
.an-col {
  position: relative;
  flex: 1;
  width: 100%;
  max-width: 58px;
  border-radius: 12px;
  background: var(--an-sunken);
  overflow: hidden;
}
.an-col i {
  position: absolute;
  inset: auto 0 0;
  height: calc(var(--w) * 100%);
  border-radius: inherit;
  background: var(--an-accent-gradient);
  transition: height 0.7s var(--ease);
}
.an-stack {
  display: flex;
  gap: 3px;
  height: 14px;
  margin: 4px 0 12px;
}
.an-stack i {
  flex: var(--w) 1 0%;
  border-radius: 999px;
  transition: flex-grow 0.7s var(--ease);
}
.an-stack .is-regular,
.an-legend .is-regular i {
  background: var(--an-accent);
}
.an-stack .is-new,
.an-legend .is-new i {
  background: #8fa3ff;
}
.an-stack .is-sleep,
.an-legend .is-sleep i {
  background: #f2b84b;
}
.an-stack .is-lost,
.an-legend .is-lost i {
  background: rgba(11, 16, 48, 0.16);
}
.an-legend {
  display: grid;
}
.an-legend > span {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--an-line);
  font-size: 10px;
}
.an-legend > span:last-child {
  border-bottom: 0;
}
.an-legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.an-legend b {
  margin-left: auto;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.an-heat {
  display: grid;
  grid-template-columns: 18px repeat(12, minmax(0, 1fr));
  grid-auto-rows: minmax(14px, 1fr);
  gap: 3px;
  flex: 1;
  min-height: 0;
  font-size: 8px;
  color: var(--an-muted);
}
.an-heat > span {
  display: grid;
  place-items: center;
}
.an-heat > i {
  border-radius: 5px;
  background: color-mix(
    in srgb,
    #2f52ff calc((var(--l) - 0.35) * 150%),
    #eef1fa
  );
}
.an-heat-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
  font-size: 8px;
  color: var(--an-muted);
}
.an-heat-legend i {
  width: 72px;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #eef1fa, #2f52ff);
}
.is-drawing .an-view:not([hidden]) .an-bar i,
.is-drawing .an-view:not([hidden]) .an-ret i {
  animation: an-grow 0.9s var(--ease) backwards;
}
.is-drawing .an-view:not([hidden]) .an-col i {
  animation: an-rise 0.9s var(--ease) backwards;
}
.is-drawing .an-view:not([hidden]) .an-heat > i {
  animation: an-fade 0.7s var(--ease) backwards;
}
@keyframes an-grow {
  from {
    width: 0;
  }
}
@keyframes an-rise {
  from {
    height: 0;
  }
}
@keyframes an-fade {
  from {
    opacity: 0;
  }
}
@media (max-width: 1100px) {
  .an-page .app-main {
    padding-block: 18px;
  }
  .an-views .overview-grid .app-kpi {
    padding: 14px;
  }
  .an-table-card th:nth-child(4),
  .an-table-card td:nth-child(4) {
    display: none;
  }
  .an-table-card .an-ret {
    display: none;
  }
  .an-table th,
  .an-table td {
    padding-inline: 7px;
  }
}
@media (max-width: 767px) {
  .an-page .app-main {
    overflow: visible;
  }
  .an-page .date-filter {
    padding: 10px 12px;
  }
  .an-views {
    display: flex;
    flex-direction: column;
  }
  .an-view {
    flex: 1;
    height: auto;
  }
  .an-views .overview-grid {
    gap: 10px;
  }
  .an-views .overview-grid .app-kpi {
    padding: 13px 12px;
    border-radius: 18px;
  }
  .an-views .overview-grid .kpi-value {
    font-size: 20px;
    margin-top: 12px;
  }
  .an-chips small {
    font-size: 7.5px;
    padding-inline: 6px;
  }
  .an-deltas {
    gap: 7px;
    margin-top: 10px;
  }
  .an-delta {
    flex-wrap: wrap;
    gap: 3px 5px;
    font-size: 8px;
  }
  .an-delta small {
    display: block;
    flex-basis: 100%;
    margin-left: 0;
    font-size: 8px;
  }
  .an-table .an-delta small,
  .an-mini .an-delta small {
    display: none;
  }
  .an-minis,
  .an-minis-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .an-minis-3 .an-mini:first-child {
    grid-column: 1 / -1;
  }
  .an-split,
  .an-split-wide {
    grid-template-columns: minmax(0, 1fr);
  }
  .an-table tfoot td:first-child {
    padding-left: 6px;
  }
  .an-flat {
    grid-auto-flow: row;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .an-card h6,
  .an-card > .an-flat,
  .an-card > .an-note {
    display: none;
  }
  .an-review:nth-child(n + 3) {
    display: none;
  }
  .an-table-card th:nth-child(3),
  .an-table-card td:nth-child(3),
  .an-table-card th:nth-child(5),
  .an-table-card td:nth-child(5) {
    display: none;
  }
  .an-table th,
  .an-table td {
    padding-inline: 6px;
  }
  .an-avatar {
    display: none;
  }
  .an-heat {
    grid-auto-rows: 18px;
  }
  .an-heat > span:nth-child(-n + 13):nth-child(odd) {
    visibility: hidden;
  }
}

/* Dark theme of the analytics window inside the dark #dashboard band. */
.an-page.is-dark {
  --an-surface: linear-gradient(180deg, #111630f2, #0b0f22f2);
  --an-sunken: rgba(255, 255, 255, 0.04);
  --an-line: rgba(255, 255, 255, 0.08);
  --an-text: #eef1ff;
  --an-muted: #98a4c2;
  --an-accent: #8fa6ff;
  --an-accent-soft: rgba(62, 96, 255, 0.24);
  --an-accent-gradient: linear-gradient(135deg, #7c96ff, #3e60ff 52%, #2f3fd8);
  --an-ok: #5fdcae;
  --an-ok-soft: rgba(47, 207, 154, 0.16);
  --an-danger: #ff949e;
  --an-danger-soft: rgba(255, 107, 122, 0.18);
  --an-warn: #f5bd63;
  --an-warn-soft: rgba(245, 165, 36, 0.16);
  --an-shadow:
    inset 0 0 0 1px rgba(150, 170, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 24px 48px -18px rgba(0, 0, 10, 0.6);
}
.an-page.is-dark .an-stars > span,
.is-dark .an-stack .is-lost,
.is-dark .an-legend .is-lost i {
  color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.14);
}
.is-dark .an-halls .app-pill[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.12);
  box-shadow:
    0 0 0 1px rgba(124, 150, 255, 0.4),
    0 4px 10px -6px rgba(0, 0, 10, 0.8);
}
.is-dark .an-heat > i {
  background: color-mix(
    in srgb,
    #6f8bff calc((var(--l) - 0.35) * 150%),
    #141a34
  );
}
.is-dark .an-heat-legend i {
  background: linear-gradient(90deg, #141a34, #6f8bff);
}
.is-dark .an-ret i {
  background: linear-gradient(135deg, #58e0a4, #1d8a5c);
}
