/* ==========================================================================
   Text panels of the shared editor (P5, decision D-3; artboards D3A, D3Atype, D3Time, D3Kbd).
   Title, Subtitle and Time label are one flat panel: header with Show, Text, Font, Size,
   Weight | Align, Color. Markup: `_text_category` in pages/new_content/editor_workspace_components.py;
   the colour row and the sliders come from assets/editor_sheets.js. The keyboard composer's name
   row (`#editor-composer-name`) is owned by assets/editor_quick_controls.js. Scoped to the text
   categories; the 102 px composer geometry of zzzzzzzzzzz_editor_categories.css is not touched.
   ========================================================================== */
#editor-workspace-root :is([data-category="title"], [data-category="subtitle"], [data-category="time-label"]) {
  --sp-text-field-h: 44px;
}
/* Header: element name left, "Show" + switch right (48 px, D3A). */
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-panel-title { font: 700 17px/22px var(--sp-font-display); color: var(--sp-text); }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-panel-show { display: flex; align-items: center; gap: 10px; margin: 0; font: 500 13px/16px var(--sp-font-ui); color: var(--sp-text-2); }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-panel-show .mantine-Switch-root, #editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-panel-show .mantine-Switch-body { display: flex; margin: 0; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-panel-show .mantine-Switch-track { width: 44px; min-width: 44px; height: 26px; border-radius: 13px; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-panel-show .mantine-Switch-thumb { width: 20px; height: 20px; }
/* The panel's own rows: 44 px fields, 8 px apart, like D3A. */
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-editor-category-panel.sp-editor-tool-group[data-category="title"], #editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-editor-category-panel.sp-editor-tool-group[data-category="subtitle"], #editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-editor-category-panel.sp-editor-tool-group[data-category="time-label"] { gap: 8px; }
/* Text field: one line is 44 px, a longer title grows the textarea (autosize). */
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body :is([data-category="title"], [data-category="subtitle"], [data-category="time-label"]) :is(.mantine-Textarea-input, .mantine-TextInput-input) {
  min-height: 44px !important; padding: 11px 12px !important; border-radius: 10px !important; font: 500 14.5px/20px var(--sp-font-ui) !important;
}
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body :is([data-category="title"], [data-category="subtitle"], [data-category="time-label"]) .mantine-TextInput-input { height: 44px !important; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body :is([data-category="title"], [data-category="subtitle"], [data-category="time-label"]) .mantine-Textarea-root { margin: 0; }
/* Font picker: the closed field spans the panel (list = bottom sheet, P4). */
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-font > *, #editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-field > *, #editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-color > * { flex: 1 1 auto; min-width: 0; max-width: none; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-font .mantine-Select-root { width: 100%; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-font .mantine-Select-input { height: 44px !important; min-height: 44px !important; min-width: 0 !important; padding: 0 36px 0 12px !important; font: 500 14.5px/20px var(--sp-font-ui) !important; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-font .mantine-Select-section { width: 36px; color: var(--sp-text-2); }
/* Pairs: two rows side by side (Weight | Align, Prefix | Format). */
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-editor-pair { display: flex; gap: 8px; align-items: stretch; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-editor-pair > .sp-editor-row { flex: 1 1 0; min-width: 0; display: block; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-style-pair > .sp-editor-row:first-child { flex: 0 0 176px; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-style-pair .mantine-SegmentedControl-root { width: 100%; height: 40px; padding: 3px; border-radius: 10px; border: 1px solid var(--sp-border-strong); background: var(--sp-surface); }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-style-pair .mantine-SegmentedControl-indicator { border-radius: 8px !important; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-style-pair .mantine-SegmentedControl-label { height: 32px !important; padding: 0 4px !important; display: flex; align-items: center; justify-content: center; font: 500 13px/32px var(--sp-font-ui) !important; border-radius: 8px !important; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-style-pair .mantine-SegmentedControl-control[data-active] .mantine-SegmentedControl-label { color: var(--sp-text) !important; }
/* Alignment: three line glyphs instead of words (the words stay for assistive tech). */
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-style-pair [id^="editor-sec-align-"] .mantine-SegmentedControl-label { font-size: 0 !important; position: relative; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-style-pair [id^="editor-sec-align-"] .mantine-SegmentedControl-innerLabel { display: none; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-style-pair [id^="editor-sec-align-"] .mantine-SegmentedControl-label::after {
  content: ''; width: 20px; height: 20px; background: currentColor; -webkit-mask: var(--sp-align-glyph) center / contain no-repeat; mask: var(--sp-align-glyph) center / contain no-repeat;
}
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-style-pair [id^="editor-sec-align-"] .mantine-SegmentedControl-control:has(> input[value="left"]) { --sp-align-glyph: 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='1.8' stroke-linecap='round'><path d='M4 7h16M4 12h10M4 17h13'/></svg>"); }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-style-pair [id^="editor-sec-align-"] .mantine-SegmentedControl-control:has(> input[value="center"]) { --sp-align-glyph: 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='1.8' stroke-linecap='round'><path d='M4 7h16M7 12h10M5.5 17h13'/></svg>"); }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-style-pair [id^="editor-sec-align-"] .mantine-SegmentedControl-control:has(> input[value="right"]) { --sp-align-glyph: 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='1.8' stroke-linecap='round'><path d='M4 7h16M10 12h10M7 17h13'/></svg>"); }
/* Time label: Prefix | Format are bordered 44 px fields with the name inside (D3Time). */
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-editor-inline { display: flex !important; align-items: center; gap: 8px; height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--sp-border-strong); background: var(--sp-surface); }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-editor-inline:focus-within { border-color: var(--sp-accent); }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-editor-inline > .sp-editor-row-label { flex: none; font: 500 12.5px/16px var(--sp-font-ui); color: var(--sp-text-2); }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-editor-inline > :last-child { flex: 1 1 auto; min-width: 0; max-width: none; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-editor-inline :is(.mantine-TextInput-input, .mantine-Select-input) { height: 42px !important; min-height: 0 !important; min-width: 0 !important; padding: 0 !important; border: 0 !important; background: transparent !important; font: 500 14.5px/20px var(--sp-font-ui) !important; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-editor-inline .mantine-Select-input { padding-right: 20px !important; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-editor-inline .mantine-Select-section { width: 20px; color: var(--sp-text-2); }
/* The field already shows focus with its own accent border; the input's focus outline would draw a second, inner one. */
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-editor-inline :is(.mantine-TextInput-input, .mantine-Select-input):focus { outline: 0 !important; box-shadow: none !important; }
/* Prefix and Format stack: "Format  2,025" needs more than half the panel to be read in full (and its list as wide as the field). */
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-frame-label-pair { flex-direction: column; }
/* Stacked, the pair's "equal shares" (`flex: 1 1 0`) would run down the column and replace each field's 44 px with
   the row's 40 px minimum, so the 44 px input would overhang its own border (also in the keyboard composer). */
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-frame-label-pair > .sp-editor-row { flex: none; }
/* Colour row: hex chip + quick swatches + "+" (D3A). The real input stays mounted and hidden. */
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-color .sp-color-field { gap: 8px; justify-content: flex-start; height: 40px; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-color .sp-color-field > .sp-color-trigger { flex: 0 0 auto; min-height: 0; height: 40px; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-color .sp-color-trigger .sp-sheet-icon { display: none; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-color .sp-color-chip { height: 36px; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-color .sp-color-chip .sp-color-value { font: 700 12px/16px var(--sp-font-mono); letter-spacing: 0; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-color-quick { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-color-quick .sp-color-swatch { flex: 1 1 0; width: auto; min-width: 22px; max-width: 28px; height: 40px; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-color-quick .sp-color-swatch::before { width: 100%; height: auto; aspect-ratio: 1; left: 0; margin: 0; transform: translateY(-50%); }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-color-quick .sp-color-more {
  position: relative; flex: 0 0 28px; width: 28px; height: 40px; margin: 0; padding: 0; border: 0; background: none; color: var(--sp-text-2); cursor: pointer;
}
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-color-quick .sp-color-more::before { content: ''; position: absolute; left: 0; top: 6px; width: 28px; height: 28px; box-sizing: border-box; border-radius: 50%; border: 1.5px dashed #6E6A63; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-color-quick .sp-color-more .sp-sheet-icon { position: absolute; left: 6px; top: 12px; width: 16px; height: 16px; }
.sp-sheet-icon--plus { --sp-sheet-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='1.8' stroke-linecap='round'><path d='M12 5v14M5 12h14'/></svg>"); }
/* The header starts right under the grip (the generic 16 px panel padding is for panels with a subtab row),
   and the first field follows it without a gap (D3A: head 48, fields 8 apart). */
#editor-workspace-root #editor-tool-content > .sp-editor-panel-slot:not(#editor-panel-text):is([data-group="title"], [data-group="subtitle"], [data-group="time-label"]) { padding-top: 0; margin-top: -6px; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-panel-head { margin-bottom: -8px; }
/* Size row (D3A): 13/500 muted label, slider, 48 px value box. */
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-editor-row--size > .sp-editor-row-label { font: 500 13px/16px var(--sp-font-ui) !important; color: var(--sp-text-2) !important; min-width: 36px; }
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-editor-row--size .sp-slider-field .mantine-NumberInput-root { width: 48px !important; }

/* ==========================================================================
   Keyboard composer for flat panels (D3Atype, D3Kbd). 102 px as before: 1 border + 40 name row + 6 gap +
   44 field + 11 bottom padding. A panel with a subtab row keeps that row (Chart, Background); a flat
   panel gets the name row "TITLE • Text" instead. Any field of any row is shown first: only the row with
   focus stays, its label hides, a pair shows just the focused half over the full width.
   ========================================================================== */
.sp-editor-composer-name { display: none; }
#editor-workspace-root[data-keyboard="true"] #editor-composer-name {
  display: flex; align-items: center; gap: 8px; flex: none; height: 40px; padding: 0 4px; user-select: none; -webkit-user-select: none;
}
#editor-workspace-root[data-keyboard="true"] .sp-editor-sheet-body:has(.sp-editor-panel-slot:not([hidden]) .sp-editor-subtabs) #editor-composer-name,
#editor-workspace-root[data-keyboard="true"][data-color-sheet="open"] #editor-composer-name { display: none; }
.sp-editor-composer-name small { font: 700 10.5px/14px var(--sp-font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--sp-text-2); }
.sp-editor-composer-name i { width: 3px; height: 3px; border-radius: 50%; background: var(--sp-text-3); }
.sp-editor-composer-name b { font: 600 14px/20px var(--sp-font-ui); color: var(--sp-text); }
/* The first row sits 6 px under the name row (a subtab body brings its own 6 px). */
#editor-workspace-root[data-keyboard="true"] .sp-editor-sheet-body:not(:has(.sp-editor-panel-slot:not([hidden]) .sp-editor-subtabs)) > #editor-tool-content > .sp-editor-panel-slot:not(#editor-panel-text):not([hidden]) { margin-top: 6px; padding-top: 0; }
#editor-workspace-root[data-keyboard="true"] .sp-editor-sheet-body .sp-editor-category-panel { gap: 0; }
/* Any field, shown first: at every level between the sheet body and the focused field, every sibling that does not
   hold the focus hides (rows, cards, labels, captions, switches, headings). The name / subtab row and the colour
   sheet's own composer name are the only things that stay. Replaces per-structure hide lists (F-09). */
#editor-workspace-root[data-keyboard="true"] #editor-tools.sp-editor-sheet .sp-editor-sheet-body :has(:focus) > :not(:has(:focus)):not(:focus):not(.sp-editor-subtabs):not(#editor-composer-name):not(.sp-color-composer-name) { display: none !important; }
#editor-workspace-root[data-keyboard="true"] .sp-editor-pair { display: block; }
#editor-workspace-root[data-keyboard="true"] .sp-editor-pair > .sp-editor-row { display: block; width: 100%; }
#editor-workspace-root[data-keyboard="true"] #editor-tools.sp-editor-sheet .sp-editor-inline { display: flex !important; height: 44px; border-color: var(--sp-accent); }
/* A numeric / text row with focus: label and slider hide, the field alone stays. */
#editor-workspace-root[data-keyboard="true"] .sp-editor-row:focus-within > :not(:focus-within) { display: none; }
/* Disclosure bodies lose their indent rule and padding while one of their fields is the composer's field. */
#editor-workspace-root[data-keyboard="true"] #editor-tools.sp-editor-sheet .sp-editor-sheet-body :is(.sp-editor-sub, .sp-editor-more-block) { padding: 0 !important; margin: 0 !important; border: 0 !important; }

/* Desktop rail panel (340-400 px): the sheet name is already in the panel head, so the panel's own title goes; the colour row wraps. */
@media (min-width: 768px), (min-width: 600px) and (min-aspect-ratio: 10/13) {
  #editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-panel-title { display: none; }
  #editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-panel-head:has(.sp-text-panel-show) { justify-content: flex-start; min-height: 32px; margin-bottom: -2px; }
  #editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-color .sp-color-field { flex-wrap: wrap; height: auto; row-gap: 0; }
  #editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-text-color .sp-color-quick { flex: 1 0 100%; }
}
#editor-workspace-root #editor-tools.sp-editor-sheet .sp-editor-sheet-body .sp-color-quick { padding: 0 2px; }
/* A card's own top margin (Mantine `mt`) must not push the field down inside the 102 px composer. */
#editor-workspace-root[data-keyboard="true"] #editor-tools.sp-editor-sheet .sp-editor-sheet-body :has(:focus):not(.sp-editor-panel-slot):not(.sp-editor-subtab-body):not(.sp-editor-sheet-body) { margin-top: 0 !important; }
