/* Shared source screens and retained preview workspace. */
#compare-shell.sp-data-shell { position: relative; padding: 0; min-width: 0; }
#compare-shell.sp-data-shell .cmp-container { display: flex; flex-direction: column; max-width: none; padding: 0; gap: 0; min-height: 0; }
.sp-data-shell .sp-data-icon-button {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border: 0; background: transparent; color: var(--sp-text-2); border-radius: 8px; padding: 8px; cursor: pointer;
}
.sp-data-shell .sp-data-icon-button:hover { color: var(--sp-text); background: var(--sp-surface); }
.sp-data-shell .sp-data-icon-button:focus-visible { outline: 2px solid var(--sp-accent); outline-offset: 2px; }
.sp-data-shell .sp-data-icon-button > span { display: block; width: 20px; height: 20px; background: currentColor; }
.sp-data-panel-icon { mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Cpath d='M9 3v18m7-12-3 3 3 3'/%3E%3C/svg%3E") center/contain no-repeat; }
[aria-expanded='false'] > .sp-data-panel-icon { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Cpath d='M9 3v18m4-12 3 3-3 3'/%3E%3C/svg%3E"); }
.sp-data-back-icon { mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m12 5-7 7 7 7M5 12h14'/%3E%3C/svg%3E") center/contain no-repeat; }
#editor-data-collapse { display: none; }
#editor-filters-dock { display: none; }
.sp-data-shell[data-panel-collapsed='true'] #editor-data-collapse { left: 4px; }
.sp-data-grid { display: grid; grid-template-columns: minmax(0,1fr); width: 100%; min-height: 0; }
.sp-data-panel { background: var(--sp-bg); width: 100%; max-width: 680px; margin-inline: auto; min-width: 0; padding: 16px; box-sizing: border-box; }
.sp-data-main { grid-column: 1; min-width: 0; padding: 12px 16px; }
.sp-data-shell[data-panel-page='data'] #editor-data-comparison,
.sp-data-shell[data-panel-page='comparison'] #editor-data-menu,
.sp-data-shell[data-panel-collapsed='true'] .sp-data-panel { display: none; }
.sp-data-shell[data-panel-collapsed='true'] .sp-data-grid { grid-template-columns: minmax(0,1fr); }
/* Source selection and results are separate screens, sharing retained inputs. */
.sp-data-shell[data-panel-collapsed='false'][data-source-form=''] .sp-data-main,
.sp-data-shell:not([data-source-form='']) .sp-data-panel { display: none; }
body:where([data-sp-has~="data-panel-data-open"]):not(.sp-s):not(.sp-s):not(.sp-s) #editor-workspace-root { visibility: hidden; pointer-events: none; }
@media (max-width: 599px), (max-width: 767px) and (max-aspect-ratio: 10/13) {
  body:where([data-sp-has~="data-panel-open"]):not(.sp-s):not(.sp-s) #editor-workspace-root { visibility: hidden; pointer-events: none; }
}
/* Outrank the retained workspace anchor's viewport lock while source screens are open. */
#app-page-container:has(#compare-shell.sp-data-shell[data-panel-collapsed='false']) { height: auto; overflow: visible; }
.sp-data-screen-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.sp-data-screen-heading h2 { margin: 0; font: 600 18px/24px var(--sp-font-ui); }
/* The heading names Explore's open phone menu instead of "Filters" (zzzzzzzz_explore_panels.css). */
.sp-data-screen-heading .sp-data-title-menu { display: none; }
.sp-data-filter-close { margin-left: auto; min-height: 44px; padding: 8px 16px; border: 1px solid var(--sp-border); border-radius: 8px; background: transparent; color: var(--sp-text); font: 600 14px/20px var(--sp-font-ui); cursor: pointer; }
.sp-data-filter-close:hover { background: var(--sp-surface); }
.sp-data-filter-close:focus-visible { outline: 2px solid var(--sp-accent); outline-offset: 2px; }
.sp-data-source-link { display: block; padding: 12px 0; margin-top: 12px; border: 0; background: transparent; color: var(--sp-text-2); font: 400 13px/20px var(--sp-font-ui); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.sp-data-source-link--icon { display: flex; align-items: center; gap: 6px; }
.sp-data-source-link:focus-visible { outline: 2px solid var(--sp-accent); outline-offset: 3px; }
#compare-shell.sp-data-shell[data-panel-page='comparison'] #editor-data-return-post { display: none; }
#compare-shell.sp-data-shell #cmp-setup { position: static; display: block; height: auto; padding: 12px 0 0; border: 0; overflow: visible; background: transparent; }
#compare-shell.sp-data-shell .cmp-setup-card { position: static; max-height: none; min-height: 0; max-width: none; width: 100%; padding: 0; margin: 0; border: 0; background: transparent; box-shadow: none; overflow: visible; transform: none; }
#compare-shell.sp-data-shell .cmp-setup-head, #compare-shell.sp-data-shell .cmp-setup-scrim { display: none; }
#compare-shell.sp-data-shell .cmp-setup-cta { position: sticky; bottom: 0; width: 100%; margin-top: 16px; }
#compare-shell.sp-data-shell .cmp-head { margin: 0 0 12px; padding: 0; }
#compare-shell.sp-data-shell .cmp-head::before { display: none; }
/* A studio-origin document without Explore's stage box (manual rows, a saved question) keeps its own chrome. An upload
   carries the stage box (data-document-chrome), so the Explore header shows for it; its NBA filter summary row stays out. */
.sp-data-shell[data-document-origin='studio']:not([data-document-chrome='explore']) .cmp-head { display: none; }
.sp-data-shell[data-document-origin='studio'] #cmp-summary-row { display: none; }
/* An open upload shows only the Create post row of the comparison preview (its chart is the editor's, not the
   comparison card); the row's "More actions" would export the NBA comparison. */
.sp-data-shell[data-document-source='upload'] #cmp-preview { display: block !important; }
.sp-data-shell[data-document-source='upload'] #cmp-preview > :not(.cmp-cta-wrap),
.sp-data-shell[data-document-source='upload'] .cmp-more-actions { display: none !important; }
/* `data-kinds` on the toolbar (and on its portaled chart type menu, whose items are found by id: a callback owns their
   className) lists the chart kinds the current source can show (the NBA comparison's, or an
   upload's documentContext.presentation.chart_kinds); the other kinds' chips and menu items are hidden. */
:is(#cmp-view-wrap, .cmp-presentation-view)[data-kinds]:not([data-kinds~='line']) :is(.cmp-view-chip--line, [id*='cmp-view-option'][id*='"line"']),
:is(#cmp-view-wrap, .cmp-presentation-view)[data-kinds]:not([data-kinds~='bar']) :is(.cmp-view-chip--bar, [id*='cmp-view-option'][id*='"bar"']),
:is(#cmp-view-wrap, .cmp-presentation-view)[data-kinds]:not([data-kinds~='vertical']) :is(.cmp-view-chip--vertical, [id*='cmp-view-option'][id*='"vertical"']),
:is(#cmp-view-wrap, .cmp-presentation-view)[data-kinds]:not([data-kinds~='scatter']) :is(.cmp-view-chip--scatter, [id*='cmp-view-option'][id*='"scatter"']),
:is(#cmp-view-wrap, .cmp-presentation-view)[data-kinds]:not([data-kinds~='ranking']) :is(.cmp-view-chip--ranking, [id*='cmp-view-option'][id*='"ranking"']) { display: none !important; }
#compare-shell.sp-data-shell .cmp-preview { margin: 0; padding: 0; }
#compare-shell.sp-data-shell .cmp-cta-wrap { margin: 8px 0 0; padding: 0; gap: 8px; justify-content: center; }
#compare-shell.sp-data-shell .cmp-cta { min-height: 36px; padding: 8px 16px; font-size: 13px; }
#compare-shell.sp-data-shell .cmp-legend { display: none; }
#compare-shell.sp-data-shell .cmp-preview:not(.cmp-preview--ranking) .cmp-results { display: none; }
#compare-shell.sp-data-shell .cmp-views--table .cmp-results { display: none; }
#compare-shell.sp-data-shell .cmp-preview--ranking .cmp-results { width: 100%; max-width: 480px; margin-inline: auto; }
.sp-data-shell:not([data-has-document='true']) #editor-workspace-anchor { display: none; }
.sp-data-shell:has(.cmp-views--table) #editor-workspace-anchor { display: none; }
/* A ranking keeps its card page in Browse; the shell is placed around the card only in design. */
body:not(:where([data-sp-has~="editor-design"]):not(#sp-s):not(.sp-s)) .sp-data-shell:has(.cmp-preview--ranking) #editor-workspace-anchor { display: none; }
.sp-data-shell[data-has-document='true'] #cmp-empty, .sp-data-shell[data-has-document='true'] #cmp-start { display: none !important; }
/* New comparison over a retained document starts from a clean stage: the previous
   document stays mounted (Cancel and Continue restore it) but none of it shows
   while the new selection is made; the first-run placeholder shows instead. */
#compare-shell.sp-data-shell[data-new-comparison='true'] :is(#editor-workspace-anchor, .cmp-head, .cmp-preview, .cmp-cta-wrap, #cmp-empty) { display: none !important; }
body:where([data-sp-has~="explore-new-comparison"]):not(#sp-s):not(.sp-s):not(.sp-s) #editor-workspace-root { visibility: hidden; pointer-events: none; }
@media (min-width: 768px), (min-width: 600px) and (min-aspect-ratio: 10/13) { #compare-shell.sp-data-shell[data-new-comparison='true'] #cmp-start { display: grid !important; } }
.sp-data-shell .sp-studio-entry { min-height: 0; padding: 0; background: transparent; }
.sp-data-shell .sp-entry-column { width: 100%; max-width: none; padding: 0; margin: 0; gap: 16px; }
.sp-comparison-new { padding: 10px 14px; border: 1px solid var(--sp-border, #303238); border-radius: 10px; background: transparent; color: inherit; cursor: pointer; text-align: left; }
.sp-comparison-new:hover { background: #202126; }
.sp-comparison-new[hidden] { display: none; }
.sp-data-shell .sp-entry-close { display: none; }
.sp-data-shell .sp-entry-head { display: block; }
.sp-data-shell .sp-entry-title { font-size: 23px; line-height: 1.2; }
.sp-data-shell .sp-entry-kind-row { display: block; order: 3; }
.sp-data-shell .sp-entry-kind { width: 100%; min-height: 40px; padding: 10px; }
.sp-data-shell .sp-entry-kind-sub { display: none; }
.sp-data-shell .sp-entry-segment, .sp-data-shell .sp-entry-chip-row { display: flex; flex-wrap: wrap; gap: 6px; overflow: visible; }
.sp-data-shell .sp-entry-seg { min-width: 0; padding: 8px; font-size: 12px; }
.sp-data-shell .sp-entry-new { padding: 14px; min-height: 68px; }
.sp-data-shell .sp-entry-new-sub { font-size: 12px; }
.sp-data-shell .sp-entry-card { min-width: 0; }
.sp-data-shell .sp-entry-card-title, .sp-data-shell .sp-entry-card-sub { white-space: normal; overflow-wrap: anywhere; }
.sp-data-shell #editor-data-form { display: none; max-width: 900px; margin: 0 auto; }
.sp-data-shell #editor-data-form-close { margin-bottom: 16px; }
.sp-data-shell[data-source-form='manual'] #editor-data-form,
.sp-data-shell[data-source-form='upload'] #editor-data-form,
.sp-data-shell[data-source-form='question'] #editor-data-form { display: block; }
.sp-data-shell #editor-data-question-form { display: none; }
.sp-data-shell[data-source-form='question'] #editor-intake-root { display: none; }
.sp-data-shell[data-source-form='question'] #editor-data-question-form { display: block; }
.sp-data-shell #editor-intake-root > a, .sp-data-shell #editor-intake-back { display: none; }
.sp-data-shell:not([data-source-form='']) #editor-data-result { display: none; }
body:where([data-sp-has~="data-source-form-set"]):not(.sp-s):not(.sp-s) #editor-workspace-root { visibility: hidden; pointer-events: none; }
body:where([data-sp-has~="data-shell"]):not(.sp-s) #editor-exit-dialog[open] { visibility: visible; pointer-events: auto; }
/* The retained Graph is hidden, never removed, while a large source form is open. */
body:where([data-sp-has~="data-shell"]):not(.sp-s) .sp-editor-host.is-placed[data-origin='studio'] { padding: 0; }
/* Comparison filters stay beside the retained canvas on desktop. The
   collapsed flag still owns the separate filter screen on smaller devices. */
@media (min-width: 768px), (min-width: 600px) and (min-aspect-ratio: 10/13) {
  #compare-shell.sp-data-shell[data-panel-page='comparison'][data-source-form=''] .sp-data-grid {
    grid-template-columns: 304px minmax(0,1fr);
    align-items: start;
  }
  /* Filters begin where the header ends: the header runs across this column to the left edge (owner 2026-11-28;
     both lengths are measured by assets/explore_workspace.js, the header's own rule is in zzzzz_explore_workspace.css). */
  #compare-shell.sp-data-shell[data-panel-page='comparison'][data-source-form=''] .sp-data-panel {
    display: block; grid-column: 1; grid-row: 1; margin: var(--sp-data-head-offset,0px) 0 0; max-width: none;
    height: calc(100dvh - var(--sp-header-h,0px) - var(--sp-data-head-offset,0px)); overflow-y: auto;
    overscroll-behavior: contain; scrollbar-width: thin;
    border-right: 1px solid var(--sp-border);
  }
  #compare-shell.sp-data-shell[data-panel-page='comparison'][data-source-form=''] .sp-data-main {
    display: block; grid-column: 2; grid-row: 1;
  }
  #app-page-container:has(#compare-shell.sp-data-shell[data-panel-page='comparison'][data-source-form='']) {
    height: calc(100dvh - var(--sp-header-h,0px)); overflow: hidden;
  }
  #compare-shell.sp-data-shell[data-panel-page='comparison'] .sp-data-filter-close { display: none; }
  @media (max-width: 767px) {
    #compare-shell.sp-data-shell[data-panel-page='comparison'][data-source-form=''] .sp-data-panel { height: calc(100dvh - var(--sp-header-h,0px) - 56px - env(safe-area-inset-bottom,0px) - var(--sp-data-head-offset,0px)); }
    #app-page-container:has(#compare-shell.sp-data-shell[data-panel-page='comparison'][data-source-form='']) { height: calc(100dvh - var(--sp-header-h,0px) - 56px - env(safe-area-inset-bottom,0px)); }
  }
  #compare-shell.sp-data-shell[data-panel-page='comparison'][data-source-form=''] #editor-filters-dock { display: inline-flex; margin-left: auto; flex: none; }
  /* Collapsed sidebar: a strip that keeps only the toggle (state: data-filters-dock, editor_data_panel.js). */
  #compare-shell.sp-data-shell[data-panel-page='comparison'][data-source-form=''][data-filters-dock='rail'] .sp-data-panel { padding: 16px 6px; overflow: hidden; }
  #compare-shell.sp-data-shell[data-filters-dock='rail'] .sp-data-panel > :not(#editor-data-comparison),
  #compare-shell.sp-data-shell[data-filters-dock='rail'] #editor-data-comparison > :not(.sp-data-screen-heading),
  #compare-shell.sp-data-shell[data-filters-dock='rail'] .sp-data-screen-heading > :not(#editor-filters-dock) { display: none !important; }
  #compare-shell.sp-data-shell[data-filters-dock='rail'] #editor-filters-dock { margin: 0; }
  /* The 272 px panel (explore menus plan 3.8): the four-column rows of the form take two columns, the metric
     categories stack, Compared by and the Games choices go two by two; the shooting table keeps its rows with a
     narrower name column. */
  #compare-shell.sp-data-shell :is(.cmp-metric-quick, .cmp-metric-group--wide .cmp-metric-chips, .cmp-axis-grid, .cmp-period-grid) { grid-template-columns: repeat(2,minmax(0,1fr)); }
  #compare-shell.sp-data-shell .cmp-metric-groups { grid-template-columns: minmax(0,1fr); }
  #compare-shell.sp-data-shell .cmp-axis-grid .mantine-Chip-label { padding: 0 2px; }
  #compare-shell.sp-data-shell .cmp-axis-grid .mantine-Chip-label > span:not(.mantine-Chip-iconWrapper) { gap: 3px; }
  #compare-shell.sp-data-shell .cmp-metric-table { grid-template-columns: 76px repeat(3,minmax(0,1fr)); column-gap: 6px; }
}
/* Create post on desktop (layout 2, owner 2026-11-24): Filters a little wider, 272 -> 304 (Browse keeps 272,
   assets/zzzzz_explore_workspace.css), and the sticky Apply button stands on a solid foot of the panel's own
   colour, so rows no longer show under and around it (under the Home look: zzzzzzzzzzzzzzzzzzzz_explore_home_look.css). */
@media (min-width: 1100px) {
  body:where([data-sp-has~="editor-explore-design"]):not(#sp-s):not(.sp-s):not(.sp-s) #compare-shell.sp-data-shell[data-panel-page='comparison'][data-source-form='']:not([data-filters-dock='rail']) .sp-data-grid { grid-template-columns: 304px minmax(0,1fr); }
  body:where([data-sp-has~="editor-explore-design"]):not(#sp-s):not(.sp-s):not(.sp-s) #compare-shell.sp-data-shell .cmp-setup-cta { box-shadow: 0 -12px 0 0 var(--sp-bg), 0 16px 0 0 var(--sp-bg); }
}
@media (max-width: 599px), (max-width: 767px) and (max-aspect-ratio: 10/13) {
  .sp-data-grid { display: flex; flex-direction: column; }
  .sp-data-main { padding: 12px; }
  .sp-data-panel { height: auto; overflow: visible; border-right: 0; padding: 12px; }
  .sp-data-shell[data-has-document='true'] .sp-data-main { order: -1; }
  .sp-data-shell[data-panel-collapsed='true'] .sp-data-panel { display: none; }
  #editor-data-collapse { display: none; }
  #compare-shell.sp-data-shell .cmp-setup-card { padding-bottom: 18px; }
  .sp-data-shell .sp-entry-segment { flex-wrap: wrap; }
}
