/* The overview shares the local UI 3 theme, including its dark and high-contrast surfaces. */
.cube-view {
  --cube-pad: var(--xh-card-padding);
  display: grid;
  gap: var(--xh-space-16);
  min-width: 0;
}
.cube-view :is(h1,h2,h3,p,figure,dl,dd,ol,fieldset,legend) { margin: 0; }
.cube-view .cube-head,
.cube-view .cube-heading,
.cube-filter-footer,
.cube-composition-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--xh-space-12);
}
.cube-head h1 { font-size: var(--xh-font-size-page); line-height: var(--xh-line-height-page); }
.cube-head > div:first-child { display: grid; gap: var(--xh-space-4); }
.cube-head-meta a { display: inline-flex; align-items: center; gap: var(--xh-space-4); min-height: var(--xh-touch-target); }
.cube-source-stamp,
.cube-view :is(.panel-note,.cube-basis,.cube-provenance,.cube-row-count,.cube-chart figcaption) {
  color: var(--xh-text-secondary);
  font-size: var(--xh-font-size-meta);
  line-height: var(--xh-line-height-meta);
}
.cube-head time, .cube-view :is(input[type=date],td,dd,time,.period-caption,.cube-chart text) { font-variant-numeric: tabular-nums; }
.cube-view h2 { font-size: var(--xh-font-size-section); line-height: var(--xh-line-height-section); font-weight: var(--xh-font-weight-semibold); }
.cube-view .cube-filters,
.cube-view .cube-section {
  margin: 0; min-width: 0; padding: 0;
  background: var(--xh-surface);
  border: 1px solid var(--xh-border); border-radius: var(--xh-radius);
}
.cube-view .cube-filters { overflow: visible; }
.cube-view .cube-heading {
  padding: var(--xh-space-4) var(--cube-pad);
  border-bottom: 1px solid var(--xh-border);
}
.cube-heading h2, .cube-head-meta a { display: inline-flex; align-items: center; gap: var(--xh-space-8); }
.cube-heading h2 svg, .cube-head-meta svg { color: var(--xh-text-secondary); flex-shrink: 0; }
.cube-period {
  display: grid;
  grid-template-columns: minmax(164px,1fr) minmax(160px,1fr) minmax(210px,1.5fr);
  gap: var(--xh-space-16);
  padding: var(--xh-space-16) var(--cube-pad);
}
.cube-view :is(.cube-period,.cube-axes,.cube-manual)>label {
  display: grid; min-width: 0; gap: var(--xh-space-4);
  color: var(--xh-text-secondary);
  font-size: var(--xh-font-size-meta); line-height: var(--xh-line-height-meta);
  font-weight: var(--xh-font-weight-medium);
}
.cube-view :is(.cube-period,.cube-axes,.cube-manual) :is(input:not([type=radio]),select) {
  display: block; width: 100%; min-width: 0; min-height: var(--xh-control-height); margin: 0;
  border: 1px solid var(--xh-control-border); border-radius: var(--xh-radius);
  background-color: var(--xh-surface); color: var(--xh-text); padding-inline: var(--xh-control-padding-inline);
  font-size: var(--xh-font-size-body); line-height: var(--xh-line-height-body); font-weight: var(--xh-font-weight-regular);
}
.cube-view .cycle-switch {
  display: flex; align-items: stretch; min-width: 0; border: 0; padding: 0;
}
.cube-view .cycle-switch legend {
  padding: 0; margin: 0 0 var(--xh-space-4);
  font-size: var(--xh-font-size-meta); line-height: var(--xh-line-height-meta);
  font-weight: var(--xh-font-weight-medium); color: var(--xh-text-secondary);
}
.cube-view .cycle-switch label { position: relative; flex: 1; display: block; min-width: var(--xh-touch-target); }
.cube-view .cycle-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
.cube-view .cycle-switch span {
  display: flex; justify-content: center; align-items: center; min-height: var(--xh-touch-target);
  border: 1px solid var(--xh-control-border); background: var(--xh-surface); color: var(--xh-text-secondary);
  padding-inline: var(--xh-space-8); font-size: var(--xh-font-size-body); font-weight: var(--xh-font-weight-medium);
}
.cube-view .cycle-switch label+label span { border-left: 0; }
.cube-view .cycle-switch label:first-of-type span { border-radius: var(--xh-radius) 0 0 var(--xh-radius); }
.cube-view .cycle-switch label:last-of-type span { border-radius: 0 var(--xh-radius) var(--xh-radius) 0; }
.cube-view .cycle-switch input:checked + span { background: var(--xh-selected-bg); color: var(--xh-selected-text); font-weight: var(--xh-font-weight-semibold); box-shadow: inset 0 -2px var(--xh-primary); }
.cube-view .cycle-switch input:focus-visible+span { outline: var(--xh-focus-width) solid var(--xh-focus); outline-offset: var(--xh-focus-offset); }
.cube-dimensions {
  display: grid; grid-template-columns: repeat(8,minmax(0,1fr)); gap: var(--xh-space-8);
  align-items: start; padding: 0 var(--cube-pad);
}
.cube-view .cube-picker { position: relative; min-width: 0; border: 0; }
.cube-view .cube-picker>summary {
  position: relative; display: grid; align-content: center;
  min-height: var(--xh-touch-target); min-width: 0; cursor: pointer;
  padding: var(--xh-space-4) var(--xh-space-24) var(--xh-space-4) var(--xh-space-8);
  color: var(--xh-text); background: var(--xh-surface);
  border: 1px solid var(--xh-control-border); border-radius: var(--xh-radius);
  list-style: none;
}
.cube-picker>summary::-webkit-details-marker { display: none; }
.cube-picker>summary::marker { content: ''; }
.cube-view .cube-picker>summary:is(:hover,:active) { background: var(--xh-surface-hover); }
.cube-picker>summary svg { position: absolute; right: var(--xh-space-4); top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--xh-text-secondary); }
.cube-picker[open]>summary svg { transform: translateY(-50%) rotate(180deg); }
.cube-picker>summary :is(strong,span) { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cube-picker>summary strong { color: var(--xh-text-secondary); font-size: var(--xh-font-size-meta); line-height: var(--xh-line-height-meta); font-weight: var(--xh-font-weight-regular); }
.cube-picker>summary span { font-size: var(--xh-font-size-body); font-weight: var(--xh-font-weight-medium); }
.cube-view .cube-picker.is-filtered>summary { background: var(--xh-selected-bg); border-color: var(--xh-primary); }
.cube-picker.is-filtered>summary span { color: var(--xh-selected-text); }
.cube-choices {
  position: absolute; top: calc(100% + var(--xh-space-4)); left: 0; z-index: var(--xh-z-popover);
  width: max(220px,100%); max-width: min(300px,88vw); max-height: 350px; overflow: auto; overscroll-behavior: contain;
  padding: var(--xh-space-8) var(--xh-space-12); background: var(--xh-surface);
  border: 1px solid var(--xh-control-border); border-radius: var(--xh-radius); box-shadow: var(--xh-shadow);
}
.cube-picker:nth-last-child(-n+2) .cube-choices { left: auto; right: 0; }
.cube-options label {
  display: flex; align-items: center; gap: var(--xh-space-8); min-height: var(--xh-touch-target);
  padding-inline: var(--xh-space-4); border-radius: var(--xh-inner-radius); overflow-wrap: anywhere;
  color: var(--xh-text); cursor: pointer; line-height: var(--xh-line-height-body);
}
.cube-options label:hover { background: var(--xh-surface-hover); }
.cube-options input { width: 16px; height: 16px; min-height: 0; margin: 0; accent-color: var(--xh-primary); flex-shrink: 0; }
.cube-picker .cube-manual { display: grid; gap: var(--xh-space-8); margin-top: var(--xh-space-4); padding: var(--xh-space-8) 0 0; border-top: 1px solid var(--xh-border); }
.cube-view .cube-filter-footer { margin-top: var(--xh-space-12); padding: 0 var(--cube-pad) var(--xh-space-16); }
.cube-filter-footer p { flex: 1; }
.cube-stack { min-width: 0; display: grid; gap: var(--xh-space-16); }
.cube-view .cube-section { overflow: hidden; scroll-margin-top: var(--xh-space-16); }
.cube-view .panel-heading {
  display: grid; align-items: start; gap: var(--xh-space-4); margin: 0;
  padding: var(--xh-space-16) var(--cube-pad); border: 0;
}
.cube-view .period-caption {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--xh-space-4) var(--xh-space-16);
  margin: calc(-1 * var(--xh-space-8)) var(--cube-pad) var(--xh-space-16);
  color: var(--xh-text-secondary); font-size: var(--xh-font-size-meta); line-height: var(--xh-line-height-meta);
}
.period-caption strong { color: var(--xh-text); font-weight: var(--xh-font-weight-medium); }
.cube-cards { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 0; background: var(--xh-surface-muted); margin: 0 var(--cube-pad); border: 1px solid var(--xh-border); border-radius: var(--xh-radius); overflow: hidden; }
.cube-card { display: grid; align-content: start; gap: 0; min-width: 0; padding: var(--xh-space-12) var(--xh-space-16); }
.cube-card+.cube-card { border-inline-start: 1px solid var(--xh-border); }
.cube-card[data-measure=value] { background: var(--xh-primary-soft); }
.cube-card dt { display: flex; gap: var(--xh-space-8); align-items: baseline; flex-wrap: wrap; color: var(--xh-text-secondary); font-size: var(--xh-font-size-meta); line-height: var(--xh-line-height-meta); }
.cube-card dt .cube-card-metric { color: var(--xh-text); font-weight: var(--xh-font-weight-medium); }
.cube-card dd {
  display: flex; align-items: center; min-height: var(--xh-touch-target); min-width: 0;
  font-size: var(--xh-font-size-metric); line-height: var(--xh-line-height-metric); font-weight: var(--xh-font-weight-semibold); overflow-wrap: anywhere;
}
.cube-card dd.cube-state-value { font-size: var(--xh-font-size-section); line-height: var(--xh-line-height-section); }
.cube-card dd a { display: inline-flex; align-items: center; min-height: var(--xh-touch-target); min-width: var(--xh-touch-target); font-weight: inherit; color: var(--xh-primary); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.cube-view .cube-basis { padding: var(--xh-space-12) var(--cube-pad) 0; color: var(--xh-text); font-size: var(--xh-font-size-body); line-height: var(--xh-line-height-body); }
.cube-view .cube-provenance { padding: var(--xh-space-4) var(--cube-pad) var(--xh-space-16); }
.cube-view .cube-chart { margin: 0 var(--cube-pad) var(--xh-space-8); padding: 0; min-width: 0; }
.cube-chart svg { display: block; width: 100%; min-width: 460px; max-height: 180px; margin-inline: auto; }
.cube-chart text { fill: var(--xh-text-secondary); font-family: inherit; font-size: var(--xh-font-size-meta); }
.cube-chart text.cube-chart-value { fill: var(--xh-text); }
.cube-chart-baseline { stroke: var(--xh-control-border); }
.cube-series-line, .cube-dot { stroke: var(--xh-chart-primary); stroke-width: 2; }
.cube-dot { fill: var(--xh-chart-primary); }
.cube-dot.cube-partial { stroke: var(--xh-chart-comparison); fill: var(--xh-surface); }
.cube-chart figcaption { padding-top: var(--xh-space-8); }
.cube-periods { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); padding: 0; border: 1px solid var(--xh-border); border-radius: var(--xh-radius); overflow: hidden; list-style: none; }
.cube-periods li { display: grid; gap: var(--xh-space-4); align-content: start; padding: var(--xh-space-8) var(--xh-space-12); min-width: 0; }
.cube-periods li+li { border-left: 1px solid var(--xh-border); }
.cube-periods li:last-child { background: var(--xh-surface-muted); }
.cube-periods time { font-size: var(--xh-font-size-meta); line-height: var(--xh-line-height-meta); color: var(--xh-text-secondary); }
.cube-period-state { font-weight: var(--xh-font-weight-medium); }
.cube-history { border-top: 1px solid var(--xh-border); }
.cube-history>summary, .cube-source-meta>summary { min-height: var(--xh-touch-target); width: fit-content; padding-block: var(--xh-space-12); color: var(--xh-primary); cursor: pointer; font-weight: var(--xh-font-weight-medium); }
.cube-history>summary { padding-inline: var(--cube-pad); }
.cube-comparison-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--xh-space-16); align-items: start; min-width: 0; }
.cube-view .scroll-table { max-width: 100%; min-width: 0; overflow: auto; }
.cube-section :is(th,td) { vertical-align: middle; }
.cube-view .cube-comparison-grid table { width: 100%; min-width: 0; }
.cube-comparison-grid :is(th,td):nth-child(1) { min-width: 64px; }
.cube-comparison-grid :is(th,td):nth-child(2) { min-width: 76px; text-align: right; }
.cube-compare-value { font-weight: var(--xh-font-weight-semibold); }
.cube-bar { position: relative; display: block; height: 4px; width: 100%; margin-bottom: var(--xh-space-8); border-inline-start: 1px solid var(--xh-control-border); }
.cube-bar i { display: block; height: 100%; background: var(--xh-chart-primary); }
.cube-bar.signed { border: 0; }
.cube-bar.signed::before { content: ''; position: absolute; left: 50%; height: 100%; border-inline-start: 1px solid var(--xh-control-border); }
.cube-bar.signed i { position: absolute; left: 50%; }
.cube-bar.negative i { left: auto; right: 50%; }
.cube-view .cube-axes { display: flex; gap: var(--xh-space-8); align-items: flex-end; flex-wrap: wrap; margin: var(--xh-space-8) 0 0; }
.cube-axes label { min-width: 88px; }
.cube-axes button { margin: 0; }
.cube-view .cube-child { background: var(--xh-surface-muted); }
.cube-view .cube-child[hidden] { display: none; }
.cube-view .cube-child td:first-child { padding-inline-start: var(--xh-space-32); }
.cube-row-toggle { margin-inline-start: var(--xh-space-8); }
.cube-view .cube-composition-tools { justify-content: flex-start; gap: var(--xh-space-12); }
.cube-view #cube-composition table { min-width: 750px; }
.cube-view #cube-composition :is(th,td):nth-child(2) { text-align: right; white-space: nowrap; }
.cube-section td a { display: inline-flex; align-items: center; justify-content: start; min-height: var(--xh-touch-target); min-width: var(--xh-touch-target); color: var(--xh-primary); font-weight: var(--xh-font-weight-medium); }
.cube-view td.number-cell a, .cube-compare-value a { justify-content: end; }
.cube-source-meta { margin: 0; }
.cube-source-meta>summary { font-size: var(--xh-font-size-meta); line-height: var(--xh-line-height-meta); }
.cube-source-meta dl { display: grid; gap: var(--xh-space-8); width: min(200px,50vw); padding: var(--xh-space-12); background: var(--xh-surface-muted); border-radius: var(--xh-radius); }
.cube-source-meta dt { color: var(--xh-text-secondary); font-size: var(--xh-font-size-meta); }
.cube-source-meta dd { word-break: break-word; }
.cube-view .empty { margin: 0; padding: var(--xh-space-16) var(--cube-pad) var(--cube-pad); color: var(--xh-text-secondary); }

@media (min-width: 1050px) {
  .cube-view #cube-composition .panel-heading { grid-template-columns: 1fr auto; }
  #cube-composition .panel-heading h2 { grid-area: 1/1; }
  #cube-composition .panel-heading>p { grid-area: 2/1; }
  #cube-composition .cube-composition-tools { grid-column: 2; grid-row: 1/3; align-self: center; }
}
@media (max-width: 1240px) {
  .cube-dimensions { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .cube-picker:nth-child(4) .cube-choices { right: 0; left: auto; }
}
@media (max-width: 950px) {
  .cube-comparison-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .cube-view { --cube-pad: var(--xh-space-16); }
  .cube-period { grid-template-columns: 1fr 1fr; gap: var(--xh-space-8); }
  .cube-period>label:last-child { grid-column: 1/-1; }
  .cube-dimensions { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .cube-picker:nth-child(even) .cube-choices { right: 0; left: auto; }
  .cube-picker:nth-child(odd) .cube-choices { left: 0; right: auto; }
  .cube-choices { width: min(232px,82vw); }
  .cube-cards { grid-template-columns: 1fr 1fr; }
  .cube-card[data-measure=value] { grid-column: 1/-1; border-bottom: 1px solid var(--xh-border); }
  .cube-card:nth-child(2) { border: 0; }
  .cube-periods { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .cube-periods li:nth-child(4) { border-left: 0; }
  .cube-periods li:nth-child(n+4) { border-top: 1px solid var(--xh-border); }
  .cube-view .cube-chart { overflow-x: auto; }
  .cube-view #cube-pivot .scroll-table table { width: max-content; min-width: 100%; }
}
@media (max-width: 420px) {
  .cube-period { grid-template-columns: 1fr; }
  .cube-view .cube-filter-footer { align-items: flex-start; flex-direction: column; }
  .cube-filter-footer button { width: 100%; }
}
.cube-view .cube-heading { min-height: 60px; }
.cube-filter-actions { display: inline-flex; align-items: center; gap: var(--xh-space-8); }
@media (max-width: 380px) {
  .cube-view .cube-heading { gap: var(--xh-space-4); }
  .cube-filter-actions { gap: var(--xh-space-4); }
}
.cube-view .cube-more-filters { display: none; }
.cube-view #cube-composition .pager { margin: 0; padding: var(--xh-space-8) var(--cube-pad); border-top: 1px solid var(--xh-border); }
@media (max-width: 639.98px) {
  .cube-view .cube-head { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 0 var(--xh-space-8); }
  .cube-head > div:first-child { display: contents; }
  .cube-head h1 { grid-column: 1; grid-row: 1; align-self: center; }
  .cube-head .cube-head-meta { grid-column: 2; grid-row: 1; }
  .cube-head .cube-source-stamp { grid-column: 1/-1; grid-row: 2; }
  .cube-view .cube-period { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  .cube-period .cycle-switch { grid-column: 1/-1; }
  .cube-period>label:last-child { grid-column: auto; }
  .cube-view .cube-more-filters { display: flex; gap: var(--xh-space-8); justify-content: space-between; margin: 0 var(--cube-pad) var(--xh-space-12); color: var(--xh-text); }
  .cube-more-filters[aria-expanded=true] svg { transform: rotate(180deg); }
  .cube-filters:not(.business-filters-open) :is(.cube-dimensions,.cube-filter-footer) { display: none; }
}
.cube-period-closure { border-inline-start: 1px solid var(--xh-border); padding-inline-start: var(--xh-space-12); }
