/*
  Plain dashboard skin for live + overview pages.
  Scoped overrides only; keeps app behavior intact while simplifying visuals.
*/

#overviewTab,
.tm-live-page {
  --tm-vanilla-bg: #f5f7fb;
  --tm-vanilla-surface: #ffffff;
  --tm-vanilla-surface-soft: #f8fafc;
  --tm-vanilla-border: #dbe3ee;
  --tm-vanilla-border-strong: #c9d4e1;
  --tm-vanilla-text: #182433;
  --tm-vanilla-muted: #5f6b7a;
  --tm-vanilla-faint: #8c97a7;
  --tm-vanilla-accent: #0f6ee8;
  --tm-vanilla-accent-soft: #e8f1ff;
  --tm-vanilla-good: #17803d;
  --tm-vanilla-bad: #c0362c;
  --tm-vanilla-warn: #b25f00;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--tm-vanilla-text);
}

#overviewTab .container-fluid,
.tm-live-page {
  background: linear-gradient(180deg, var(--tm-vanilla-bg) 0%, #ffffff 100%);
}

#overviewTab .tmgs-getstarted,
.tm-live-page .tm-card,
.tm-live-page .tm-kpi,
.tm-live-page .tm-od,
.tm-live-page .tm-insights-drawer__panel,
#overviewTab .tmv2-panel,
#overviewTab .overview-platform-dist,
#overviewTab .tm-cost-breakdown,
#overviewTab .tm-kpi-card,
#overviewTab .tm-demo-tour-cta {
  background: var(--tm-vanilla-surface);
  border: 1px solid var(--tm-vanilla-border);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

#overviewTab .tm-dashboard-tab-inner,
.tm-live-page {
  padding-inline: 0;
}

#overviewTab .tmgs-getstarted {
  margin: 0 0 18px 0;
  padding: 18px;
}

#overviewTab .tmgs-card {
  display: grid;
  gap: 12px;
  max-width: 640px;
}

#overviewTab .tmgs-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--tm-vanilla-accent);
  background: var(--tm-vanilla-accent-soft);
}

#overviewTab .tmgs-title,
#overviewTab .tmgs-desc,
#overviewTab .tmgs-steps,
#overviewTab .tmgs-cta {
  margin: 0;
}

#overviewTab .tmgs-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

#overviewTab .tmgs-desc {
  color: var(--tm-vanilla-muted);
  line-height: 1.55;
  font-size: 14px;
}

#overviewTab .tmgs-steps {
  list-style: none;
  padding: 0;
  counter-reset: tmgs;
  display: grid;
  gap: 8px;
}

#overviewTab .tmgs-steps li {
  counter-increment: tmgs;
  position: relative;
  padding-left: 28px;
  font-size: 13.5px;
  color: #334155;
}

#overviewTab .tmgs-steps li::before {
  content: counter(tmgs);
  position: absolute;
  left: 0;
  top: -1px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border: 1px solid var(--tm-vanilla-border);
  color: var(--tm-vanilla-accent);
  font-size: 11px;
  font-weight: 700;
}

#overviewTab .tmgs-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 11px;
  background: var(--tm-vanilla-accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  width: fit-content;
}

#overviewTab .tmgs-cta:hover {
  filter: brightness(0.98);
}

#overviewTab .dashboard-shell,
#overviewTab .overview-dash-v2,
#overviewTab .overview-kpi-section {
  background: transparent;
}

#overviewTab .tm-kpi-grid {
  display: grid;
  gap: 12px;
}

#overviewTab .tm-kpi-grid--primary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 768px) {
  #overviewTab .tm-kpi-grid--primary {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

#overviewTab .tm-kpi-card {
  padding: 16px;
  min-height: 108px;
}

#overviewTab .tm-kpi-card--hero {
  background: linear-gradient(180deg, #f8fbff 0%, #eef5ff 100%);
  border-color: #cfe0ff;
}

#overviewTab .tm-kpi-card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

#overviewTab .tm-kpi-card__label {
  color: var(--tm-vanilla-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
  font-weight: 700;
}

#overviewTab .tm-kpi-card__value {
  font-size: 24px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.03em;
}

#overviewTab .tm-kpi-card__delta {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#overviewTab .tm-kpi-card__delta-badge,
.tm-live-page .tm-kpi__delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  background: #f1f5f9;
  color: #334155;
}

#overviewTab .tm-kpi-card__delta-badge--up,
.tm-live-page .tm-kpi__delta--up {
  background: #dcfce7;
  color: var(--tm-vanilla-good);
}

#overviewTab .tm-kpi-card__delta-badge--down,
.tm-live-page .tm-kpi__delta--down {
  background: #fee2e2;
  color: var(--tm-vanilla-bad);
}

#overviewTab .tm-kpi-card__delta-badge--flat,
.tm-live-page .tm-kpi__delta--flat {
  background: #eef2f7;
  color: #475569;
}

#overviewTab .overview-charts-row,
#overviewTab .overview-cost-row,
#overviewTab .overview-first-row {
  margin-top: 14px;
}

#overviewTab .overview-platform-dist,
#overviewTab .tm-cost-breakdown,
#overviewTab .tmv2-panel {
  padding: 16px;
}

#overviewTab .overview-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

#overviewTab .overview-section-head__title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

#overviewTab .platform-dist-head-icon,
#overviewTab .tm-cost-breakdown__head-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--tm-vanilla-accent-soft);
  color: var(--tm-vanilla-accent);
  flex: none;
}

#overviewTab .platform-dist-body {
  display: grid;
  gap: 14px;
}

#overviewTab .platform-dist-chart-wrap {
  min-height: 240px;
}

#overviewTab .platform-dist-legend {
  display: grid;
  gap: 8px;
}

/* PR-B (2026-06-10): Orders also gets the dashboard right safe padding so
   cards / pagination don't kiss the right edge on mobile. */
#mainContent.main-content:has(.tm-page),
#mainContent.main-content:has(#overviewTab),
#mainContent.main-content:has(#analyticsTab),
#mainContent.main-content:has(#ordersTab) {
  padding-right: max(var(--tmv2-page-pad-x, 16px), calc(env(safe-area-inset-right, 0px) + 22px));
}

.tm-live-page {
  padding: 0;
}

/* PR-B (2026-06-10) + PR-B-2 (2026-06-10): compact live header.
   PR-B padding-only edit cut just -4px on mobile; PR-B-2 reduces stat
   card dimensions and pill heights to deliver the substantive ≥15% cut. */
.tm-live-page .tm-live-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 6px 0;
  min-width: 0;
  min-height: 0;
}

.tm-live-page .tm-live-pulseline,
.tm-live-page .tm-live-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.tm-live-page .tm-live-stat,
.tm-live-page .tm-live-status,
.tm-live-page .tm-live-select,
.tm-live-page .tm-btn {
  border: 1px solid var(--tm-vanilla-border);
  border-radius: 11px;
  background: var(--tm-vanilla-surface);
}

.tm-live-page .tm-live-stat {
  display: grid;
  gap: 2px;
  padding: 4px 8px;
  min-width: 110px;
}

.tm-live-page .tm-live-stat__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tm-vanilla-faint);
  font-weight: 700;
}

.tm-live-page .tm-live-stat__value {
  font-size: 13px;
  font-weight: 700;
  color: var(--tm-vanilla-text);
}

.tm-live-page .tm-live-status,
.tm-live-page .tm-live-select,
.tm-live-page .tm-btn {
  padding: 4px 8px;
}

.tm-live-page .tm-live-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tm-live-page .tm-live-select {
  min-height: 28px;
}

.tm-live-page .tm-kpi-row {
  display: block !important;
  min-height: 0;
}

.tm-live-page .tm-live-kpi-grid {
  display: grid !important;
  grid-template-columns: 1.45fr repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: -2px;
}

.tm-live-page .tm-live-kpi-grid .kpi-card {
  min-height: 168px;
}

.tm-live-page .tm-live-kpi-grid .kpi-card.accent {
  grid-column: auto;
}

.tm-live-page .tm-live-kpi-grid .kpi-value {
  font-size: clamp(20px, 1.55vw, 26px);
}

.tm-live-page .tm-live-kpi-grid .kpi-vs {
  white-space: nowrap;
}

.tm-live-page .tm-live-kpi-grid .kpi-chart {
  height: 56px;
}

.tm-live-page .tm-live-header__row {
  min-width: 0;
  flex: 0 0 auto;
}

.tm-live-page .tm-live-controls {
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.tm-live-page .tm-live-status__text,
.tm-live-page .tm-live-btn-label,
.tm-live-page .tm-live-select {
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .tm-live-page .tm-live-header {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .tm-live-page .tm-live-pulseline,
  .tm-live-page .tm-live-controls {
    gap: 8px;
  }

  .tm-live-page .tm-live-header__row,
  .tm-live-page .tm-live-controls {
    justify-content: flex-start;
  }
}

@media (max-width: 1100px) {
  .tm-live-page .tm-kpi-row {
    display: block !important;
  }

  .tm-live-page .tm-live-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tm-live-page .tm-live-kpi-grid .kpi-card.accent {
    grid-column: span 2;
  }
}

@media (max-width: 640px) {
  .tm-live-page .tm-kpi-row {
    display: block !important;
  }

  .tm-live-page .tm-live-kpi-grid {
    grid-template-columns: 1fr;
  }

  .tm-live-page .tm-live-kpi-grid .kpi-card.accent {
    grid-column: auto;
  }

  .tm-live-page .tm-live-controls {
    flex-wrap: wrap;
  }
}

.tm-live-page .tm-skel {
  background: #e7edf5 !important;
  border-radius: 6px !important;
}

.tm-live-page .tm-live-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
}

@media (min-width: 1100px) {
  .tm-live-page .tm-live-main-grid {
    grid-template-columns: minmax(320px, 360px) minmax(0, 1fr);
    gap: 20px;
  }
  .tm-live-page .tm-live-main-grid__sidebar {
    position: sticky;
    top: 16px;
    align-self: start;
    max-height: calc(100vh - 32px);
    overflow: auto;
  }
}

.tm-live-page .tm-card,
.tm-live-page .tm-action-insights,
.tm-live-page .tm-insights-drawer__panel,
.tm-live-page .tm-od {
  border-radius: 14px;
}

.tm-live-page .tm-card__header,
.tm-live-page .tm-insights-drawer__header,
.tm-live-page .tm-od__head {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--tm-vanilla-border);
}

.tm-live-page .tm-chip,
.tm-live-page .tm-insights-quick__a {
  border: 1px solid var(--tm-vanilla-border);
  background: var(--tm-vanilla-surface);
  border-radius: 999px;
}

.tm-live-page .tm-insights-quick__a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  color: var(--tm-vanilla-text);
  text-decoration: none;
}

.tm-live-page .tm-insights-quick__a:hover {
  border-color: var(--tm-vanilla-border-strong);
}

.tm-live-page .tm-od {
  width: min(460px, calc(100vw - 24px));
}

.tm-live-page .tm-od__head,
.tm-live-page .tm-od__body {
  padding: 16px;
}

.tm-live-page .tm-od__title {
  font-size: 16px;
  font-weight: 700;
}

html.dark-mode #overviewTab,
html.dark-mode .tm-live-page,
[data-theme="dark"] #overviewTab,
[data-theme="dark"] .tm-live-page {
  --tm-vanilla-bg: #0f141a;
  --tm-vanilla-surface: #111822;
  --tm-vanilla-surface-soft: #141d29;
  --tm-vanilla-border: #243041;
  --tm-vanilla-border-strong: #314155;
  --tm-vanilla-text: #f3f7fb;
  --tm-vanilla-muted: #a9b4c2;
  --tm-vanilla-faint: #8d99aa;
  --tm-vanilla-accent-soft: #173252;
}

html.dark-mode #overviewTab .tm-kpi-card--hero,
[data-theme="dark"] #overviewTab .tm-kpi-card--hero,
html.dark-mode .tm-live-page .tm-kpi.tm-kpi--hero,
[data-theme="dark"] .tm-live-page .tm-kpi.tm-kpi--hero {
  background: linear-gradient(180deg, #142235 0%, #102033 100%) !important;
  border-color: #20324b !important;
}
