/* Core Market palette and layout. This theme does not affect the app shell. */
html body #analyticsPage.market-analytics-pending > :not(.market-analytics-loading) {
  visibility: hidden !important;
}

html body #analyticsPage.market-analytics-pending {
  position: relative;
  min-block-size: 70vh;
}

.market-analytics-loading {
  position: absolute;
  inset: 36px 0 auto;
  margin: 0;
  text-align: center;
  font-weight: 650;
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics {
  --market-bg: #c8d5e5;
  --market-surface: #dee7f2;
  --market-surface-high: #f3f7fc;
  --market-border: #a8bfd8;
  --market-ink: #1d3857;
  --market-muted: #3e5876;
  --market-blue: #285eac;
  --market-green: #205940;
  --market-amber: #70501e;
  background: var(--market-bg) !important;
  color: var(--market-ink);
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .analytics-filters,
html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .analytics-chart,
html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .analytics-watch-panel {
  background: linear-gradient(145deg, var(--market-surface-high), var(--market-surface) 63%) !important;
  border: 1px solid var(--market-border) !important;
  border-radius: 16px !important;
  box-shadow: 0 3px 12px #1d385709 !important;
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .analytics-kpi-grid {
  gap: 14px !important;
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics #analyticsKpis .analytics-kpi {
  --market-card-accent: var(--market-ink);
  position: relative;
  isolation: isolate;
  display: flex !important;
  align-items: flex-start !important;
  min-height: 126px !important;
  padding: 16px 18px !important;
  color: var(--market-ink) !important;
  background: var(--market-surface) !important;
  border: 1px solid var(--market-border) !important;
  border-inline-start: 3px solid #8ca9cb !important;
  border-radius: 14px !important;
  box-shadow: 0 2px 8px #1d385709 !important;
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics #analyticsKpis .analytics-kpi.primary {
  --market-card-accent: var(--market-blue);
  background: #bfd5ef !important;
  border-inline-start-color: var(--market-blue) !important;
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics #analyticsKpis .analytics-kpi.profit {
  --market-card-accent: var(--market-green);
  background: #cce3d8 !important;
  border-color: #99c6b1 !important;
  border-inline-start-color: #438968 !important;
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics #analyticsKpis .analytics-kpi:is(.warn, .discount) {
  --market-card-accent: var(--market-amber);
  background: #ece1ca !important;
  border-color: #d4b481 !important;
  border-inline-start-color: #af8240 !important;
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics #analyticsKpis .analytics-kpi strong {
  color: var(--market-card-accent) !important;
  font-size: clamp(23px, 2.6vw, 34px) !important;
  line-height: 1.25 !important;
  margin-block: 5px 8px !important;
  direction: inherit;
  text-align: start;
}

html:root body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics #analyticsKpis .kpi-icon {
  display: none !important;
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics #analyticsKpis .analytics-kpi :is(span, small),
html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .analytics-chart .analytics-hint,
html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .chart-label-strip {
  color: var(--market-muted) !important;
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics #analyticsKpis .analytics-kpi > div:has(strong) {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
}

html:root body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .analytics-kpi:has(.market-kpi-trend) {
  position: relative;
}

html:root body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .market-kpi-trend {
  position: absolute;
  inset-inline-end: 14px;
  inset-block-start: 43px;
  width: min(30%, 90px);
  color: var(--market-card-accent, #81b9fb);
  pointer-events: none;
}

.market-kpi-trend polyline {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

html:root body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .analytics-executive-grid:has(.market-weekday-panel) {
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr) !important;
  gap: 14px !important;
}

html:root body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .analytics-executive-grid:has(.market-weekday-panel) .analytics-side-stack {
  grid-column: 1 / -1;
}

html:root body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .analytics-side-stack .insight-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .analytics-chart-head h2,
html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .analytics-section-heading h2 {
  color: var(--market-ink) !important;
  font-size: clamp(16px, 1.6vw, 21px) !important;
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .dashboard-header {
  color: var(--market-ink) !important;
  background: var(--market-surface) !important;
  border-color: var(--market-border) !important;
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .dashboard-header :is(h1, p),
html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .analytics-chart :is(.value-label, .donut-total, .donut-caption) {
  color: var(--market-ink) !important;
  fill: var(--market-ink) !important;
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .analytics-section-nav {
  background: #bdcce0 !important;
  border-radius: 12px !important;
  padding: 6px !important;
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .analytics-section-nav button,
html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .analytics-filters :is(select, input, .analytics-range-buttons button:not(.active)) {
  color: var(--market-ink) !important;
  background: var(--market-surface) !important;
  border-color: var(--market-border) !important;
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .analytics-filters :is(.analytics-range-buttons .active, #refreshAnalyticsButton) {
  color: #fff !important;
  background: var(--market-blue) !important;
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .analytics-section-nav button.business-section-current {
  color: #fff !important;
  background: var(--market-blue) !important;
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .analytics-chart :is(.insight-strip article, .analytics-branch-list article, .comparison-card, .analytics-insight-card, .analytics-cash-flow article, .analytics-audit-detail) {
  color: var(--market-ink) !important;
  background: #cfdeee !important;
  border-color: var(--market-border) !important;
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .analytics-chart :is(.insight-strip, .analytics-branch-list, .comparison-card, .analytics-insight-card, .analytics-cash-flow, .analytics-audit-detail, .analytics-legend, .analytics-bars, .empty-state) :is(strong, b, span, small, em, summary) {
  color: var(--market-ink) !important;
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .analytics-svg {
  color: var(--market-blue) !important;
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .analytics-section-nav button:focus-visible,
html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .analytics-filters :is(button, select, input):focus-visible {
  outline: 3px solid var(--market-blue);
  outline-offset: 2px;
}

.market-weekdays {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(36px, 1fr);
  gap: 8px;
  padding: 0;
  margin: 10px 0 0;
  list-style: none;
}

.market-weekdays li {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 140px 1fr;
  gap: 8px;
  text-align: center;
  align-items: center;
}

.market-day-value {
  grid-row: 1;
  font-size: 13px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.market-day-track {
  grid-row: 2;
  position: relative;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(to top, #a8bfd866 0 1px, transparent 1px 25%);
}

.market-day-track::after {
  content: '';
  position: absolute;
  inset: auto 0 var(--baseline);
  border-top: 1px solid #7192b8;
}

.market-day-track i {
  position: absolute;
  inset: auto 16% var(--start);
  height: var(--height);
  background: linear-gradient(to top, #285eac, #6894ce);
  border-radius: 6px 6px 2px 2px;
}

.market-day-track i.market-negative {
  background: linear-gradient(to top, #bc9559, #966728);
  border-radius: 2px 2px 6px 6px;
}

.market-day-label {
  grid-row: 3;
  font-size: 11px;
  color: var(--market-muted, inherit);
  overflow-wrap: anywhere;
}

/* Put the operating metrics and both trends on the first screen. */
html:root body #analyticsPage.market-analytics .market-secondary-kpis {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

html:root body #analyticsPage.market-analytics .market-secondary-kpis .analytics-kpi {
  min-height: 94px !important;
  padding: 12px 15px !important;
  margin: 0 !important;
}

html:root body #analyticsPage.market-analytics .market-secondary-kpis .analytics-kpi strong {
  font-size: 23px !important;
  line-height: 1.3 !important;
}

html:root body #analyticsPage.market-analytics .market-secondary-kpis .kpi-icon {
  display: none !important;
}

html:root body #analyticsPage.market-analytics .market-secondary-kpis .analytics-kpi small {
  overflow-wrap: anywhere;
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics {
  --market-surface-high: #fbfdff;
  --market-border: #adc3db;
  row-gap: 8px !important;
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics > .dashboard-header {
  position: relative;
  padding: 16px 22px !important;
  overflow: hidden;
  background: radial-gradient(ellipse at 12% 115%, #b9d3f2, transparent 58%),
    linear-gradient(112deg, #eaf1f9, #dce8f6) !important;
  box-shadow: inset 0 1px #ffffffa8;
  border: 1px solid var(--market-border) !important;
  border-radius: 18px !important;
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics > .dashboard-header h1 {
  font-size: clamp(20px, 2.4vw, 32px) !important;
  letter-spacing: normal;
}

html:root body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics #analyticsKpis .analytics-kpi {
  min-height: 112px !important;
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics #analyticsKpis .analytics-kpi {
  background-image: linear-gradient(145deg, #ffffff62, transparent 70%) !important;
  border-radius: 16px !important;
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .market-secondary-kpis .analytics-kpi {
  background: #e5edf7 !important;
  border: 1px solid var(--market-border) !important;
  border-radius: 14px !important;
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .market-secondary-kpis .analytics-kpi:is(.warn, .discount) {
  background: #eee3ce !important;
  border-color: #d4b481 !important;
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .market-secondary-kpis .analytics-kpi :is(span, strong, small) {
  color: var(--market-ink) !important;
}

html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .market-secondary-kpis .analytics-kpi:is(.warn, .discount) strong {
  color: var(--market-amber) !important;
}

html:root body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .analytics-executive-grid > .analytics-chart {
  min-height: 278px !important;
  padding: 20px !important;
}

html:root body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .analytics-executive-grid .main-chart .analytics-svg {
  max-height: 190px !important;
}

@media (max-width: 1080px) {
  html:root body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .analytics-executive-grid:has(.market-weekday-panel) {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

@media (max-width: 700px) {
  html:root body #analyticsPage.market-analytics .market-secondary-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  html:root body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics .analytics-side-stack .insight-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics #analyticsKpis .analytics-kpi {
    min-height: 110px !important;
    padding: 12px !important;
  }
  .market-weekdays { gap: 4px; grid-auto-columns: minmax(0, 1fr); }
  .market-kpi-trend { display: none; }
}

@media print {
  html:root:not([data-pos-theme=dark]) body #analyticsPage#analyticsPage.executive-dashboard.analytics-organized.market-analytics { background: white !important; }
}

.market-insight-panel { --insight-blue: #3478cb; --insight-amber: #a87126; }
[data-pos-theme=dark] .market-insight-panel { --insight-blue: #7ab9ff; --insight-amber: #e7ad5d; }
.market-insight-hint, .market-insight-panel small { font-size: .83rem; margin-block: 0 12px; }
.market-insight-svg { width: 100%; max-height: 290px; display: block; direction: ltr; }
.market-insight-svg text { fill: currentColor; font-size: 11px; }
.market-insight-svg .market-gridline { stroke: currentColor; opacity: .19; }
.market-series-0, .market-series-1 { fill: none; stroke-width: 2.5; }
.market-series-0 { stroke: var(--insight-blue); }
.market-series-1 { stroke: var(--insight-amber); stroke-dasharray: 5 4; }
.market-point-0 { fill: var(--insight-blue); }
.market-point-1 { fill: var(--insight-amber); }
.market-insight-legend { display: flex; flex-wrap: wrap; gap: 10px 20px; font-size: .82rem; }
.market-insight-legend span::before { content: '●'; color: var(--insight-blue); margin-inline-end: 6px; }
.market-insight-legend span + span::before { color: var(--insight-amber); }
.market-insight-table { overflow-x: auto; }
.market-insight-table table { width: 100%; border-collapse: separate; border-spacing: 3px; }
.market-insight-table th, .market-insight-table td {
  padding: 7px;
  text-align: start;
  white-space: nowrap;
  font-size: .81rem;
}
.market-insight-table tbody tr { background: color-mix(in srgb, var(--insight-blue) 7%, transparent); }
.market-insight-table .market-heatmap th, .market-insight-table .market-heatmap td { padding: 4px; text-align: center; }
.market-heatmap td {
  min-width: 26px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--insight-blue) calc(var(--heat) * .55), transparent);
}

.market-heatmap td.market-heat-peak {
  outline: 1px solid var(--insight-blue);
  outline-offset: -1px;
  font-weight: 750;
}

.market-peak-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--insight-blue) 12%, transparent);
  font-size: .83rem;
}

.market-data-details { margin-block-start: 12px; }
.market-data-details summary {
  width: fit-content;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--insight-blue) 55%, transparent);
  font-size: .82rem;
  font-weight: 650;
}
.market-data-details summary:focus-visible { outline: 2px solid var(--insight-blue); outline-offset: 2px; }
.market-data-details .market-insight-table { margin-block-start: 8px; max-height: 320px; }
