/* ==========================================================================
   Chart category per kind (P6, decisions D-6 and D-7; artboards D6Lines, D6Labels, D6Axes, D7Bars, D7Names, D7Values,
   D7Photos). Markup: pages/new_content/editor_chart_panels.py; delegates (segments, pad) and the kind switch:
   assets/editor_chart_panels.js; the "- value +" stepper and sliders: assets/editor_sheets.js.
   Scoped to the Chart panel (the colour-row rules also serve the Style panel's Customize view, P7). The 102 px keyboard composer of zzzzzzzzzzz_editor_categories.css / the text panels is not
   touched: a panel with a subtab row keeps that row while typing.
   ========================================================================== */
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body [data-category="chart"] { --cp-gap: 8px; --cp-field: 38px; gap: var(--cp-gap); }
#editor-workspace-root:not([data-keyboard="true"]) [data-category="chart"] .sp-editor-subtab-body { gap: var(--cp-gap); padding-top: 9px; }
#editor-workspace-root [data-category="chart"] .sp-editor-row { min-height: var(--cp-field); }
#editor-workspace-root [data-category="chart"] .sp-editor-row > .sp-editor-row-label { font: 500 13px/16px var(--sp-font-ui); color: var(--sp-text-2); }
/* Switch rows are headings: "Show labels", "Dots on points", "Show names". */
#editor-workspace-root [data-category="chart"] .sp-editor-row--head > .sp-editor-row-label { font: 500 14px/18px var(--sp-font-ui); color: var(--sp-text); }
#editor-workspace-root [data-category="chart"] .sp-editor-row--head { min-height: 38px; }
#editor-workspace-root [data-category="chart"] .sp-editor-row--head .mantine-Switch-track { width: 44px; min-width: 44px; height: 26px; border-radius: 13px; }
#editor-workspace-root [data-category="chart"] .sp-editor-row--head .mantine-Switch-thumb { width: 20px; height: 20px; }
/* A row under a switch is indented by a thin rule ("Dot size"). */
#editor-workspace-root #editor-tools.sp-editor-sheet [data-category="chart"] .sp-editor-row--sub { margin-left: 4px !important; padding-left: 14px !important; border-left: 2px solid var(--sp-border-strong) !important; }
/* Name and unit of the sliders (D6Lines Thickness): label left, slider, 48 px value box. */
#editor-workspace-root [data-category="chart"] .sp-editor-row--size > .sp-editor-row-label { min-width: 72px; }
#editor-workspace-root [data-category="chart"] .sp-editor-row--size .sp-slider-field .mantine-NumberInput-root { width: 48px !important; }
#editor-workspace-root:not([data-keyboard="true"]) #editor-tools.sp-editor-sheet [data-category="chart"] .sp-slider-field .mantine-NumberInput-input { height: 33px !important; min-height: 0 !important; font: 600 14px/20px var(--sp-font-ui) !important; }
/* A wrapper div around a slider (`style-line-width-wrap`, `style-logo-gap-wrap`) fills the row like the slider itself. */
#editor-workspace-root [data-category="chart"] .sp-editor-row > :last-child:has(> .sp-slider-field) { flex: 1 1 0; max-width: none; min-width: 0; }
/* The row of such a wrapper keeps its name as narrow as the other slider rows (the shared rule needs the slider as a direct child), and a row
   whose wrapper a gate hides leaves with it ("Up / down" exists on the inset-picture layout only). */
#editor-workspace-root #editor-tools.sp-editor-sheet [data-category="chart"] .sp-editor-row--size > .sp-editor-row-label { flex: 0 0 auto; }
#editor-workspace-root [data-category="chart"] .sp-editor-row--size:has(> [style*="display: none"]) { display: none; }
#editor-workspace-root #editor-tools.sp-editor-sheet [data-category="chart"] .sp-editor-subtab-body[data-subtab="pictures"] .sp-editor-row--size > .sp-editor-row-label { min-width: 76px; }
/* A name above a full-width control (Fill between lines). */
#editor-workspace-root [data-category="chart"] .sp-editor-row--stacked { flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 6px; }
#editor-workspace-root [data-category="chart"] .sp-editor-row--stacked > :last-child { max-width: none; width: 100%; flex: none; }
#editor-workspace-root [data-category="chart"] .sp-editor-row--stacked > .sp-editor-row-label { flex: none; min-height: 0; height: auto; }
#editor-workspace-root [data-category="chart"] .sp-editor-row--stacked > .sp-editor-row-label { font: 500 13px/16px var(--sp-font-ui); }
/* The controls' own Mantine labels / descriptions are replaced by the row (`_plain`), also when a gate projects one back. */
#editor-workspace-root [data-category="chart"] .sp-editor-row :is(.mantine-InputWrapper-label, .mantine-InputWrapper-description) { display: none; }

/* ---- Segments: Mantine SegmentedControl rows and delegates look the same (D6Lines Colors, D6Labels Content / Lines) ---- */
#editor-workspace-root [data-category="chart"] .sp-editor-row:is(.sp-editor-row--segments, .sp-editor-row--delegate) > :last-child { flex: 1 1 0; max-width: none; min-width: 0; }
#editor-workspace-root [data-category="chart"] .sp-editor-row:is(.sp-editor-row--segments, .sp-editor-row--delegate) { gap: 16px; }
#editor-workspace-root [data-category="chart"] .sp-editor-row:is(.sp-editor-row--segments, .sp-editor-row--delegate) > .sp-editor-row-label { flex: 0 0 72px; min-width: 0; }
#editor-workspace-root [data-category="chart"] .sp-editor-row--stacked .mantine-SegmentedControl-root,
#editor-workspace-root [data-category="chart"] .sp-delegate--segment, #editor-workspace-root [data-category="chart"] .sp-editor-row--segments .mantine-SegmentedControl-root {
  display: flex; box-sizing: border-box; width: 100%; height: 37px; padding: 3px; gap: 0; border-radius: 12px; border: 1px solid var(--sp-border-strong); background: transparent;
}
#editor-workspace-root [data-category="chart"] .mantine-SegmentedControl-indicator { border-radius: 9px !important; background: var(--sp-chip) !important; box-shadow: none !important; }
#editor-workspace-root [data-category="chart"] .mantine-SegmentedControl-label { height: 31px !important; padding: 0 6px !important; display: flex; align-items: center; justify-content: center; border-radius: 9px !important; font: 500 12.5px/31px var(--sp-font-ui) !important; color: var(--sp-text-2) !important; white-space: nowrap; }
#editor-workspace-root [data-category="chart"] .mantine-SegmentedControl-control[data-active] .mantine-SegmentedControl-label { color: var(--sp-text) !important; }
#editor-workspace-root [data-category="chart"] .sp-delegate-option {
  flex: 1 1 0; min-width: 0; height: 31px; padding: 0 6px; border: 0; border-radius: 9px; background: transparent; color: var(--sp-text-2); font: 500 12.5px/31px var(--sp-font-ui); white-space: nowrap; cursor: pointer;
}
#editor-workspace-root [data-category="chart"] .sp-delegate--segment .sp-delegate-option[aria-pressed="true"] { background: var(--sp-chip); color: var(--sp-text); }
#editor-workspace-root [data-category="chart"] .sp-delegate[data-disabled] { opacity: .45; }
#editor-workspace-root [data-category="chart"] .sp-delegate[data-disabled] .sp-delegate-option { cursor: default; }

/* ---- Label position pad (D6Labels): 3 x 3 cells, the chosen one filled; the centre is the data point ---- */
#editor-workspace-root [data-category="chart"] .sp-editor-row--pad { align-items: flex-start; }
#editor-workspace-root [data-category="chart"] .sp-editor-row--pad > .sp-editor-row-label { align-self: center; }
#editor-workspace-root [data-category="chart"] .sp-pad-wrap { flex: none; }
#editor-workspace-root [data-category="chart"] .sp-delegate--pad { display: grid; grid-template-columns: repeat(3, 26px); grid-auto-rows: 26px; gap: 4px; }
#editor-workspace-root [data-category="chart"] .sp-delegate--pad .sp-delegate-option { flex: none; width: 26px; height: 26px; padding: 0; border: 1px solid var(--sp-border-strong); border-radius: 6px; background: transparent; }
#editor-workspace-root [data-category="chart"] .sp-delegate--pad .sp-delegate-option[aria-pressed="true"] { background: var(--sp-accent); border-color: var(--sp-accent); }
#editor-workspace-root [data-category="chart"] .sp-delegate--pad .sp-delegate-center { position: relative; box-sizing: border-box; width: 26px; height: 26px; border: 1px dashed #6E6A63; border-radius: 6px; }
#editor-workspace-root [data-category="chart"] .sp-delegate--pad .sp-delegate-center::after { content: ''; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--sp-text-2); }

/* ---- Stepper: "- value +" (D7Bars At least, D7Names Max length, D7Values Decimals) ---- */
#editor-workspace-root [data-category="chart"] .sp-editor-row--stepper > :last-child { flex: 1 1 0; max-width: none; min-width: 0; }
#editor-workspace-root [data-category="chart"] .sp-editor-row--stepper { gap: 16px; }
#editor-workspace-root [data-category="chart"] .sp-editor-row--stepper > .sp-editor-row-label { flex: 0 0 72px; }
#editor-workspace-root .sp-stepper-field { position: relative; display: flex; align-items: center; box-sizing: border-box; width: 100%; height: 37px; border-radius: 12px; border: 1px solid var(--sp-border-strong); background: transparent; }
#editor-workspace-root .sp-stepper-field:focus-within { border-color: var(--sp-accent); }
#editor-workspace-root .sp-stepper-field .mantine-NumberInput-root { flex: 1 1 auto; min-width: 0; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-stepper-field .mantine-NumberInput-input { height: 35px !important; min-height: 0 !important; padding: 0 !important; border: 0 !important; background: transparent !important; text-align: center !important; font: 600 14px/22px var(--sp-font-ui) !important; }
#editor-workspace-root .sp-stepper-button { flex: none; width: 44px; height: 35px; padding: 0; border: 0; background: transparent; color: var(--sp-text-2); font: 500 20px/1 var(--sp-font-ui); cursor: pointer; }
#editor-workspace-root .sp-stepper-button:disabled { opacity: .35; cursor: default; }
/* 0 means Auto (D7Bars): the word replaces the digit until the field is edited. */
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-stepper-field[data-zero-label]:not(:focus-within) .mantine-NumberInput-input { color: transparent !important; -webkit-text-fill-color: transparent !important; }
#editor-workspace-root .sp-stepper-field[data-zero-label]:not(:focus-within)::after { content: attr(data-zero-label); position: absolute; left: 44px; right: 44px; top: 0; height: 35px; display: flex; align-items: center; justify-content: center; pointer-events: none; font: 600 14px/22px var(--sp-font-ui); color: var(--sp-text); }

/* ---- Colour row: the swatch row of the text panels, name left (D6Labels Color, D6Axes Color, D7Names Color) ---- */
#editor-workspace-root :is([data-category="chart"], .sp-style-view) .sp-editor-row--color > :last-child { flex: 1 1 0; max-width: none; min-width: 0; }
#editor-workspace-root :is([data-category="chart"], .sp-style-view) .sp-editor-row--color > .sp-editor-row-label { flex: 0 0 72px; }
#editor-workspace-root :is([data-category="chart"], .sp-style-view) .sp-editor-row--color .sp-color-field { gap: 6px; justify-content: flex-start; height: 38px; }
#editor-workspace-root :is([data-category="chart"], .sp-style-view) .sp-editor-row--color .sp-color-trigger { flex: 0 0 auto; min-height: 0; height: 38px; }
#editor-workspace-root :is([data-category="chart"], .sp-style-view) .sp-editor-row--color .sp-color-trigger .sp-sheet-icon, #editor-workspace-root :is([data-category="chart"], .sp-style-view) .sp-editor-row--color .sp-color-trigger .sp-color-value { display: none; }
#editor-workspace-root :is([data-category="chart"], .sp-style-view) .sp-editor-row--color .sp-color-chip { height: 36px; padding: 0 6px; }
#editor-workspace-root :is([data-category="chart"], .sp-style-view) .sp-editor-row--color .sp-color-quick { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; min-width: 0; }
#editor-workspace-root :is([data-category="chart"], .sp-style-view) .sp-editor-row--color .sp-color-quick .sp-color-swatch { flex: 1 1 0; width: auto; min-width: 22px; max-width: 28px; height: 38px; }
#editor-workspace-root :is([data-category="chart"], .sp-style-view) .sp-editor-row--color .sp-color-quick .sp-color-swatch::before { width: 100%; height: auto; aspect-ratio: 1; left: 0; margin: 0; transform: translateY(-50%); }
#editor-workspace-root :is([data-category="chart"], .sp-style-view) .sp-editor-row--color .sp-color-quick .sp-color-more { position: relative; flex: 0 0 28px; width: 28px; height: 38px; margin: 0; padding: 0; border: 0; background: none; color: var(--sp-text-2); cursor: pointer; }
#editor-workspace-root :is([data-category="chart"], .sp-style-view) .sp-editor-row--color .sp-color-quick .sp-color-more::before { content: ''; position: absolute; left: 0; top: 5px; width: 28px; height: 28px; box-sizing: border-box; border-radius: 50%; border: 1.5px dashed #6E6A63; }
#editor-workspace-root :is([data-category="chart"], .sp-style-view) .sp-editor-row--color .sp-color-quick .sp-color-more .sp-sheet-icon { position: absolute; left: 6px; top: 12px; width: 16px; height: 16px; }

/* ---- Axes (D6Axes): section name, Tick labels switch, bare "Axis title" field ---- */
#editor-workspace-root [data-category="chart"] .sp-editor-section-title { margin: 0; font: 600 10.5px/15px var(--sp-font-mono); letter-spacing: .1em; }
#editor-workspace-root [data-category="chart"] .sp-chart-axis-block { display: flex; flex-direction: column; gap: 6px; }
#editor-workspace-root [data-category="chart"] #editor-chart-axes-x-wrap { margin-top: -2px !important; }
#editor-workspace-root [data-category="chart"] .sp-editor-subtab-body > .sp-chart-axis-block { margin-top: 1px !important; }
#editor-workspace-root [data-category="chart"] .sp-chart-axis-title > * { flex: 1 1 auto; max-width: none; width: 100%; }
#editor-workspace-root [data-category="chart"] .sp-chart-axis-title .mantine-TextInput-input { height: 40px !important; min-height: 0 !important; padding: 0 14px !important; border-radius: 12px !important; border: 1px solid var(--sp-border-strong) !important; background: var(--sp-surface) !important; font: 500 15px/20px var(--sp-font-ui) !important; }
#editor-workspace-root [data-category="chart"] .sp-chart-axis-title .mantine-TextInput-input::placeholder { color: var(--sp-text-3); }

/* ---- More ... disclosures at the end of a tab (D6Labels More options, D6Axes More axis settings) ---- */
#editor-workspace-root [data-category="chart"] .sp-editor-more { height: 38px; min-height: 38px; margin-top: 0; border-top: 0; padding-top: 0; padding-bottom: 0; font: 500 14px/18px var(--sp-font-ui); color: var(--sp-text-2); }

/* ---- Bar (D7Bars, D7Values) ---- */
#editor-workspace-root [data-category="chart"] .sp-bar-layout-field > * { flex: 1 1 auto; max-width: none; width: 100%; }
#editor-workspace-root [data-category="chart"] .sp-bar-layout-field .mantine-Select-input { height: 43px !important; min-height: 0 !important; padding: 0 40px 0 14px !important; border-radius: 12px !important; border: 1px solid var(--sp-border-strong) !important; background: var(--sp-surface) !important; font: 500 15px/20px var(--sp-font-ui) !important; }
#editor-workspace-root [data-category="chart"] .sp-editor-row--top { align-items: flex-start; }
#editor-workspace-root [data-category="chart"] .sp-editor-row--top > .sp-editor-row-label { line-height: 40px; }
#editor-workspace-root [data-category="chart"] .sp-bar-show, #editor-workspace-root [data-category="chart"] .sp-bar-position { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
#editor-workspace-root [data-category="chart"] .sp-bar-show .sp-editor-caption, #editor-workspace-root [data-category="chart"] .sp-bar-position .sp-editor-caption { margin: 0; font: 400 13px/18px var(--sp-font-ui); color: var(--sp-text-2); }
#editor-workspace-root [data-category="chart"] .sp-bar-top-custom { display: none; }
#editor-workspace-root [data-category="chart"] .sp-bar-show[data-custom="true"] .sp-bar-top-custom { display: block; }
#editor-workspace-root [data-category="chart"] .sp-bar-show:not([data-custom="true"]) .sp-delegate [data-delegate-value="custom"][aria-pressed="false"] { opacity: 1; }
#editor-workspace-root [data-category="chart"] .sp-bar-top-custom .sp-stepper-field { width: 100%; }

/* Icons of the Bar tabs (the Line tabs reuse the existing set). */
.sp-editor-icon--names { --sp-editor-icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 19l5-13 5 13M5 14h6M15 19l3.5-9 3.5 9M16.5 16h4'/></svg>"); }
.sp-editor-icon--values { --sp-editor-icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M9 4L7 20M17 4l-2 16M4 9h16M3 15h16'/></svg>"); }
.sp-editor-icon--photos { --sp-editor-icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='16' rx='3'/><circle cx='9' cy='10' r='2'/><path d='M4 18l5-5 4 4 3-3 4 4'/></svg>"); }

/* ---- Tab row of the Chart panel (D6Lines, D7Bars): equal full-width tabs, 12 px names ---- */
#editor-workspace-root:not([data-keyboard="true"]) [data-category="chart"] .sp-editor-subtabs { padding: 0; gap: 0; margin: 0 -14px; }
#editor-workspace-root:not([data-keyboard="true"]) [data-category="chart"] .sp-editor-subtab { font: 500 12px/14px var(--sp-font-ui); gap: 4px; }
#editor-workspace-root:not([data-keyboard="true"]) [data-category="chart"] .sp-editor-subtab .sp-editor-icon { width: 22px; height: 22px; }
/* Slider rows are as tall as the other rows (the value box is 33 px). */
#editor-workspace-root [data-category="chart"] .sp-editor-row--size { min-height: var(--cp-field); height: var(--cp-field); }
#editor-workspace-root [data-category="chart"] .sp-editor-row--size .sp-slider-field { height: 100%; }
/* The names of the rows win against the Studio row label rules. */
#editor-workspace-root #editor-tools.sp-editor-sheet [data-category="chart"] .sp-editor-row > .sp-editor-row-label { font: 500 13px/16px var(--sp-font-ui) !important; color: var(--sp-text-2) !important; }
#editor-workspace-root #editor-tools.sp-editor-sheet [data-category="chart"] .sp-editor-row--head > .sp-editor-row-label { font: 500 14px/18px var(--sp-font-ui) !important; color: var(--sp-text) !important; }

/* ---- Keyboard composer (the 102 px geometry is untouched): the focused stepper keeps only its box, 44 px ---- */
#editor-workspace-root[data-keyboard="true"] .sp-stepper-field:focus-within { height: 44px; border-color: var(--sp-accent); }
#editor-workspace-root[data-keyboard="true"] #editor-tools.sp-editor-sheet .sp-stepper-field .mantine-NumberInput-input { height: 42px !important; }
#editor-workspace-root[data-keyboard="true"] .sp-stepper-field::after { display: none !important; }
#editor-workspace-root[data-keyboard="true"] [data-category="chart"] .sp-editor-row--stepper, #editor-workspace-root[data-keyboard="true"] [data-category="chart"] .sp-bar-show { display: block; }

/* First switch row sits 2 px higher than the other rows (D6Labels, D7Values) and the pad row hugs the next disclosure. */
#editor-workspace-root:not([data-keyboard="true"]) #editor-tools.sp-editor-sheet [data-category="chart"] .sp-editor-subtab-body > .sp-editor-row--head:first-child { margin-top: -2px !important; }
#editor-workspace-root:not([data-keyboard="true"]) #editor-tools.sp-editor-sheet [data-category="chart"] .sp-editor-row--pad { margin-top: -2px !important; margin-bottom: -2px !important; }
/* The text of a segment sits 1 px above the centre (artboard). */
#editor-workspace-root #editor-tools.sp-editor-sheet [data-category="chart"] .sp-delegate-option { padding-bottom: 4px; line-height: 27px; }
#editor-workspace-root #editor-tools.sp-editor-sheet [data-category="chart"] .mantine-SegmentedControl-label { padding-bottom: 4px !important; }
/* The pill's heading row is a normal row (the shared pill section adds its own spacing). */
#editor-workspace-root #editor-tools.sp-editor-sheet [data-category="chart"] .sp-editor-pill-section > .sp-editor-row:first-child { min-height: 38px; height: 38px; margin-top: -5px !important; }
#editor-workspace-root:not([data-keyboard="true"]) #editor-tools.sp-editor-sheet [data-category="chart"] .sp-editor-subtab-body[data-subtab="pictures"] > :first-child { margin-top: -2px !important; }
#editor-workspace-root [data-category="chart"] .sp-bar-layout-field { min-height: 43px; }
#editor-workspace-root #editor-tools.sp-editor-sheet [data-category="chart"] .sp-editor-row--top > .sp-editor-row-label { line-height: 37px !important; }
#editor-workspace-root [data-category="chart"] .sp-bar-layout-field { margin-bottom: -2px; }
#editor-workspace-root [data-category="chart"] .sp-bar-show, #editor-workspace-root [data-category="chart"] .sp-bar-position { gap: 4px; }
