/* Report fitting reserves both fixed site bars, the measured heading and
   Microsoft's own controls. A wide, short window puts the heading alongside
   the canvas so the report can use that extra vertical space. */
.report-viewer {
  --frame-height: calc(100dvh - var(--mast-height) - var(--dock-height) - 32px - var(--powerbi-controls));
  --head-space: 85px;
}
.report-viewer .embed:not(:fullscreen) {
  width: min(100%, max(1px, calc((var(--frame-height) - var(--head-space)) * 16 / 9)));
  margin-inline: auto;
}
.report-viewer .embed.wide:not(:fullscreen) { width: 100%; }
.model-jump { color: var(--aqua); text-decoration: underline; text-underline-offset: 4px; font-weight: 600; }
.model-jump { display: inline-block; }
/* Keep the tool names and native report visible together on short phones. */
@media (max-width: 539px) and (max-height: 650px) {
  .report-viewer .report-kind, .report-viewer .project-tools .meta {
    position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden;
  }
  .report-viewer .viewer-head { margin-bottom: 6px; gap: 6px; }
  .report-viewer .report-heading h2 { font-size: 21px; line-height: 1.03; margin: 0; }
  .report-viewer .project-tools { margin-top: 5px; }
  .report-viewer .actions .button { min-height: 44px; padding: 4px 2px; }
}
@media (min-width: 821px), (min-width: 540px) and (max-height: 510px) {
  .dashboard-section { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); grid-template-rows: auto auto 1fr; align-items: start; gap: 0 16px; }
  .dashboard-section .viewer-head { grid-column: 1; grid-row: 1; display: grid; gap: 14px; margin-bottom: 0; }
  .dashboard-section .actions { justify-content: start; flex-wrap: wrap; }
  .dashboard-section .report-guide { grid-column: 1; grid-row: 3; }
  .dashboard-section .pan { grid-column: 1; grid-row: 2; }
  .dashboard-section .embed:not(:fullscreen), .dashboard-section .hm-chart { grid-column: 2; grid-row: 1/4; justify-self: start; margin: 0; min-width: 0; }
  .dashboard-section .embed:not(:fullscreen) { width: min(100%, max(1px, calc(var(--frame-height) * 16 / 9))); }
  .dashboard-section .embed.wide:not(:fullscreen) { width: 100%; }
}
/* Use the opening's actual column boundary at every side-by-side width.
   Only the report width is capped when a short window limits its height. */
@media (min-width: 821px) {
  .evidence-area:has(> :is(.dashboard-section,.notebook-view)) {
    display: grid; padding-inline: 0;
    grid-template-columns: var(--content-start) [copy] minmax(0, calc(var(--intro-column) - var(--content-start))) [scene] minmax(0, 1fr) [end] max(var(--frame-inset), clamp(24px, 2.6vw, 64px));
  }
  .evidence-area:has(> :is(.dashboard-section,.notebook-view)) > * { grid-column: copy / end; }
  .dashboard-section, .notebook-view { display: grid; grid-template-columns: subgrid; column-gap: 0; }
  .dashboard-section .viewer-head, .dashboard-section .report-guide { margin-inline-end: var(--copy-padding); max-width: 52ch; }
}
@media (max-height: 510px) and (min-width: 540px) and (max-width: 760px) {
  .report-viewer .actions { display: flex; }
}
.notebook-view { align-items: start; }
.notebook-guide { min-width: 0; }
.notebook-index { margin-top: 20px; border-top: 1px solid var(--border); }
.notebook-index details { border-top: 1px solid var(--border); margin: 0; }
.notebook-index summary { padding-block: 9px; font: 600 18px var(--pixel); color: var(--ink); cursor: pointer; }
.notebook-index ol { list-style: none; padding: 0; margin: 10px 0 16px; }
.notebook-index ol a { display: block; padding: 5px 0; color: var(--body); font-size: 14px; }
.notebook-index a:hover { color: var(--moon); text-decoration: underline; }
.notebook-index .resource-links { display: flex; gap: 6px 14px; }
.notebook-index .resource-links a { padding: 0; min-height: 30px; border: 0; background: none; color: var(--aqua); font: 600 14px "Segoe UI",sans-serif; box-shadow: none; }
.notebook-paper {
  --paper-inset: clamp(12px,1.4vw,24px);
  min-width: 0; background: var(--deep); border: 1px solid var(--border);
  padding: 0 var(--paper-inset) var(--paper-inset);
}
.notebook-file {
  margin: 0 calc(-1 * var(--paper-inset)) var(--paper-inset);
  padding: 9px var(--paper-inset); overflow-wrap: anywhere;
  border-bottom: 1px solid var(--border); background: var(--panel);
  font: 12px/1.5 var(--mono); color: var(--aqua);
}
@media (min-width: 821px) {
  .notebook-guide {
    position: sticky; top: calc(var(--mast-height) + 12px);
    max-height: calc(100dvh - var(--mast-height) - var(--dock-height) - 24px); overflow: auto;
    margin-inline-end: var(--copy-padding); max-width: 52ch;
  }
}
.nb-markdown h3 { margin: 28px 0 8px; font: 600 clamp(23px,2.1vw,33px)/1.12 var(--pixel); color: var(--moon); }
.notebook-paper > :first-child h3 { margin-top: 0; }
.nb-markdown p, .nb-markdown ul { max-width: 80ch; line-height: 1.65; color: var(--body); }
.nb-markdown code { font: .9em var(--mono); color: #d2eee6; }
.nb-markdown a { text-decoration: underline; text-underline-offset: 3px; color: var(--aqua); }
.notebook-paper .cell { border: 1px solid var(--border); border-left: 3px solid #9b8299; background: #232131; padding: 14px 16px; }
.saved-result { border-top: 1px solid #53485d; padding-top: 13px; }
.saved-result .meta { color: var(--aqua); }
.output-scroll { overflow: auto; margin-top: 8px; max-width: 100%; }
.output-scroll table { font: 13px/1.5 var(--mono); border-collapse: collapse; color: var(--ink); white-space: nowrap; }
.output-scroll th, .output-scroll td { padding: 5px 10px; text-align: right; border-bottom: 1px solid #4b4256; }
.output-scroll th { background: #343040; color: var(--aqua); }
.output-scroll p { font: 12px var(--mono); }
@media(max-width:820px) {
  .evidence-area:has(> .notebook-view) { padding-inline: clamp(12px,2vw,20px); }
  .notebook-guide { margin-bottom: 16px; }
  .notebook-index { margin-top: 12px; }
}
