/* Conditional formatting + data validation sidebars, and the grid's dropdown chips / arrows / checkboxes
   (static/js/sheets_rules.js). Every class starts with shr-. */

:root { --shr-chip-bg: #e8eaed; --shr-chip-fg: #202124; --shr-flag: #d93025; --shr-swatch-ring: rgba(0, 0, 0, .16); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --shr-chip-bg: #3c4043; --shr-chip-fg: #e8eaed; --shr-flag: #f28b82; --shr-swatch-ring: rgba(255, 255, 255, .24); }
}
:root[data-theme="dark"] { --shr-chip-bg: #3c4043; --shr-chip-fg: #e8eaed; --shr-flag: #f28b82; --shr-swatch-ring: rgba(255, 255, 255, .24); }

.shr-root [hidden], .shr-float [hidden] { display: none !important; }

/* ---------------------------------------------------------------- sidebar shell */
.side-panel.shr-side .body { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.shr-root { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.shr-view { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 20px 24px; }
.shr-foot { flex: none; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 20px;
  border-top: 1px solid var(--border); background: var(--surface); }
.shr-foot .grow { flex: 1; }
.shr-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.shr-label { display: block; margin: 16px 0 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.shr-view > .shr-field:first-child > .shr-label { margin-top: 4px; }
.shr-heading { margin: 20px 0 0; font-size: 14px; font-weight: 600; color: var(--text); }
.shr-hint { margin: 10px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--text-3); }
.shr-error { margin-top: 4px; font-size: 12.5px; color: var(--danger); }
.shr-sub { display: block; font-size: 12.5px; color: var(--text-3); }
.shr-view .input { height: 36px; }
.shr-view textarea.input { height: auto; }
.shr-view .input[aria-invalid="true"] { border-color: var(--danger); }
.shr-view .input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 18%, transparent); }
.shr-view .input:disabled { background: var(--surface-2); color: var(--text-3); cursor: default; }
.shr-msg { min-height: 64px; }

/* ---------------------------------------------------------------- range field */
.shr-range-row { display: flex; align-items: center; gap: 4px; }
.shr-range-row .input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12.5px; }
.shr-view .input.shr-picking { border-color: var(--accent); box-shadow: 0 0 0 3px var(--sel); }
.shr-pick-hint { margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: var(--accent-weak); color: var(--accent);
  font-size: 12.5px; line-height: 1.4; }

/* ---------------------------------------------------------------- dropdown fields, tabs */
.shr-select { display: flex; align-items: center; gap: 8px; width: 100%; height: 36px; padding: 0 8px 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  text-align: left; cursor: pointer; font-size: 13.5px; }
.shr-select:hover { background: var(--surface-2); }
.shr-select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--sel); }
.shr-select:disabled { opacity: .6; cursor: default; background: var(--surface); }
.shr-select-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shr-select .icon { color: var(--text-2); }

.shr-tabs { display: flex; margin: 18px -20px 0; padding: 0 12px; border-bottom: 1px solid var(--border); }
.shr-tab { flex: 1; height: 40px; border: 0; border-bottom: 3px solid transparent; background: none; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.shr-tab:hover { color: var(--text); }
.shr-tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.shr-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px 4px 0 0; }

.shr-values:not(:empty), .shr-criteria:not(:empty) { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.shr-values .shr-hint, .shr-criteria .shr-hint { margin: 0; }
.shr-and { margin: -2px 0; font-size: 12.5px; color: var(--text-2); }

/* ---------------------------------------------------------------- formatting style */
.shr-style { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.shr-preset-btn, .shr-scale-btn { display: flex; align-items: center; gap: 8px; width: 100%; height: 40px; padding: 4px 8px 4px 4px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-2); cursor: pointer; }
.shr-preset-btn:hover, .shr-scale-btn:hover { background: var(--surface-2); }
.shr-preset-btn:focus-visible, .shr-scale-btn:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--sel); }
.shr-preset-btn:disabled, .shr-scale-btn:disabled { opacity: .6; cursor: default; }
.shr-preset-sample { flex: 1; min-width: 0; height: 30px; display: flex; align-items: center; padding: 0 10px; border-radius: 4px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 13px Arial, var(--font);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.shr-fmtbar { display: flex; align-items: center; gap: 2px; width: max-content; max-width: 100%; padding: 3px;
  border: 1px solid var(--border); border-radius: 8px; }
.shr-sep { width: 1px; height: 20px; margin: 0 4px; background: var(--border); }
.shr-colorbtn { position: relative; }
.shr-colorbtn .icon { width: 18px; height: 18px; margin-top: -4px; }
.shr-bar { position: absolute; left: 7px; right: 7px; bottom: 5px; height: 3px; border-radius: 1px; }
.shr-bar.none { box-shadow: inset 0 0 0 1px var(--border-strong); }

/* ---------------------------------------------------------------- colour scale */
.shr-scale-btn { margin-top: 8px; }
.shr-gradient { flex: 1; height: 30px; border-radius: 4px; border: 1px solid var(--border); }
.shr-point-row { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.shr-swatch-btn { display: flex; align-items: center; gap: 2px; height: 36px; padding: 0 4px 0 8px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text-2); cursor: pointer; }
.shr-swatch-btn:hover { background: var(--surface-2); }
.shr-swatch-btn:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--sel); }
.shr-swatch-btn:disabled { opacity: .4; cursor: default; background: var(--surface); }
.shr-swatch-dot { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--shr-swatch-ring); }

/* ---------------------------------------------------------------- popups */
.shr-float { position: fixed; z-index: 1000; max-width: calc(100vw - 16px); padding: 10px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-3); animation: pop .12s ease-out; }
.shr-float-title { margin: 0 2px 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.shr-presets { display: grid; grid-template-columns: repeat(4, 64px); gap: 8px; }
.shr-preset { height: 34px; padding: 0; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface);
  color: var(--text); font: 13px Arial, var(--font); cursor: pointer; }
.shr-preset:hover, .shr-preset:focus-visible, .shr-scale-preset:hover, .shr-scale-preset:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.shr-scale-presets { display: grid; grid-template-columns: repeat(2, 112px); gap: 8px; }
.shr-scale-preset { height: 26px; padding: 0; border: 1px solid var(--border-strong); border-radius: 4px; cursor: pointer; }

.shr-colorpop { display: flex; flex-direction: column; gap: 10px; width: 238px; max-width: 100%; }
.shr-reset { height: 30px; border: 1px solid var(--border-strong); border-radius: 6px; background: transparent; color: var(--text);
  cursor: pointer; font-size: 13px; }
.shr-reset:hover { background: var(--surface-2); }
.shr-reset:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.shr-colors { display: grid; grid-template-columns: repeat(8, 22px); justify-content: space-between; gap: 6px; }
.shr-color { width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 1px solid var(--shr-swatch-ring); cursor: pointer; }
.shr-color:hover { transform: scale(1.12); }
.shr-color.on, .shr-color:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.shr-custom { display: flex; align-items: center; gap: 6px; }
.shr-native-color { flex: none; width: 32px; height: 32px; padding: 2px; border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--surface); cursor: pointer; }
.shr-float .input.shr-hex { flex: 1; min-width: 0; width: auto; height: 32px; padding: 0 8px; font-family: var(--mono); font-size: 12.5px; }
.shr-hex[aria-invalid="true"] { border-color: var(--danger); }

/* ---------------------------------------------------------------- rule lists */
.shr-rules { display: flex; flex-direction: column; margin: 0 -8px; padding: 0; list-style: none; }
.shr-rule { position: relative; display: flex; align-items: center; gap: 2px; padding: 0 4px 0 0; border-radius: 8px; }
.shr-rule:hover, .shr-rule:focus-within { background: var(--surface-2); }
.shr-rule.dragging { z-index: 1; background: var(--surface); box-shadow: var(--shadow-2); }
.shr-handle { flex: none; display: grid; place-items: center; width: 18px; height: 44px; color: var(--text-3); cursor: grab;
  opacity: 0; touch-action: none; }
.shr-handle .icon { fill: currentColor; stroke: none; }
.shr-rule:hover .shr-handle, .shr-rule.dragging .shr-handle { opacity: 1; }
.shr-rule.dragging .shr-handle { cursor: grabbing; }
.shr-rule-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px 4px; border: 0; border-radius: 6px;
  background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
div.shr-rule-main { padding-left: 12px; cursor: default; }
.shr-rule-main:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.shr-swatch, .shr-dvicon { flex: none; display: grid; place-items: center; width: 46px; height: 30px; border-radius: 4px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 13px Arial, var(--font); }
.shr-dvicon { border-color: var(--border); color: var(--text-2); font: 600 12.5px var(--font); }
.shr-dvicon .shr-cb-svg { width: 16px; height: 16px; }
.shr-rule-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.shr-rule-title, .shr-rule-range { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shr-rule-title { font-size: 13.5px; color: var(--text); }
.shr-rule-range { font-size: 12.5px; color: var(--text-2); }
.shr-del { opacity: 0; }
.shr-rule:hover .shr-del, .shr-rule:focus-within .shr-del { opacity: 1; }
@media (hover: none) { .shr-del, .shr-handle { opacity: 1; } }
.shr-mini-chip { display: inline-flex; align-items: center; justify-content: flex-end; width: 30px; height: 16px; padding-right: 2px;
  border-radius: 999px; background: var(--shr-chip-bg); color: var(--shr-chip-fg); }
.shr-mini-chip svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; }
.shr-add { margin-top: 12px; }
.shr-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.shr-actions .shr-add { margin-top: 0; }
.btn.shr-remove-all, .btn.shr-danger { color: var(--danger); }
.btn.shr-remove-all:hover, .btn.shr-danger:hover { background: var(--danger-weak); }
.btn.shr-danger { padding: 0 12px; border-color: transparent; background: transparent; }
.shr-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px 12px 8px; text-align: center; color: var(--text-2); }
.shr-empty .icon { width: 36px; height: 36px; color: var(--text-3); stroke-width: 1.5; }
.shr-empty p { margin: 0; font-size: 13.5px; }

/* ---------------------------------------------------------------- data validation editor */
.shr-items-box, .shr-items { display: flex; flex-direction: column; gap: 6px; }
.shr-item { display: flex; align-items: center; gap: 4px; }
.shr-item .input { flex: 1; min-width: 0; }
.shr-dot { flex: none; display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; cursor: pointer; }
.shr-dot:hover { background: var(--surface-2); }
.shr-dot:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.shr-dot i { width: 18px; height: 18px; border-radius: 50%; background: var(--shr-chip-bg); border: 1px solid var(--shr-swatch-ring); }
.shr-add-item { align-self: flex-start; }
.shr-cb-opts { display: flex; flex-direction: column; gap: 8px; }
.shr-cb-values { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.shr-cb-values .shr-label { margin-top: 2px; }

.shr-adv-toggle { display: inline-flex; align-items: center; gap: 4px; margin-top: 20px; padding: 6px 8px 6px 0; border: 0;
  background: none; color: var(--accent); font-size: 13.5px; font-weight: 600; cursor: pointer; }
.shr-adv-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.shr-adv-toggle .icon { transition: transform .15s; }
.shr-adv-toggle[aria-expanded="true"] .icon { transform: rotate(180deg); }
.shr-adv { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
.shr-fieldset { display: flex; flex-direction: column; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
.shr-fieldset > legend { margin: 8px 0 6px; padding: 0; }
.shr-radio { align-items: flex-start; }
.shr-radio input { margin-top: 3px; }
.shr-styles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.shr-style-opt { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px 8px;
  border: 1px solid var(--border); border-radius: 8px; font-size: 12.5px; cursor: pointer; }
.shr-style-opt:hover { background: var(--surface-2); }
.shr-style-opt input { position: absolute; opacity: 0; pointer-events: none; }
.shr-style-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.shr-style-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.shr-style-prev { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 24px; padding: 0 3px;
  border: 1px solid var(--grid-line); background: var(--surface); color: var(--text); font: 12px Arial, var(--font); font-weight: 400; overflow: hidden; }
.shr-prev-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shr-prev-arrow { display: grid; place-items: center; color: var(--text-2); }
.shr-prev-arrow svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }

/* ---------------------------------------------------------------- dropdown picker */
.shr-float.shr-float-picker { padding: 6px 0; }
.shr-picker { display: flex; flex-direction: column; max-width: 320px; }
.shr-float .input.shr-picker-search { width: auto; height: 32px; margin: 2px 8px 6px; font-size: 13px; }
.shr-picker-list { position: relative; max-height: min(300px, 50vh); margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.shr-picker-opt { display: flex; align-items: center; gap: 6px; min-height: 30px; padding: 4px 12px 4px 8px; cursor: pointer; }
.shr-picker-opt.on { background: var(--surface-2); }
.shr-picker-check { flex: none; display: inline-flex; width: 16px; color: var(--accent); }
.shr-picker-empty { padding: 8px 12px; color: var(--text-3); font-size: 13px; }

/* ---------------------------------------------------------------- chips, arrows and checkboxes (grid + previews) */
.shr-chip { display: inline-flex; align-items: center; gap: 2px; min-width: 0; max-width: 100%; height: 18px; padding: 0 8px;
  border-radius: 999px; background: var(--shr-chip-bg); color: var(--shr-chip-fg); font: 12px/18px Arial, var(--font);
  vertical-align: middle; white-space: nowrap; }
.shr-chip:has(svg) { padding-right: 3px; }
.shr-chip.empty { padding: 0 3px; }
.shr-chip.empty .shr-chip-text { display: none; }
.shr-chip-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.shr-chip svg { flex: none; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.c.shr-dv-cell { overflow: hidden; }
.c.shr-dv-chip { display: flex; align-items: center; padding: 0 3px; }
.c.shr-dv-chip .shr-chip { cursor: pointer; }
.c.shr-dv-check { display: flex; align-items: center; justify-content: center; padding: 0; }
.c.shr-dv-arrow { display: flex; align-items: center; padding-right: 20px; }
.shr-dd-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.shr-dd-arrow { position: absolute; top: 50%; right: 2px; display: grid; place-items: center; width: 16px; height: 16px;
  border-radius: 3px; color: var(--text-2); cursor: pointer; transform: translateY(-50%); }
.shr-dd-arrow:hover { background: color-mix(in srgb, var(--text) 10%, transparent); }
.shr-dd-arrow svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.shr-cb { display: inline-grid; place-items: center; width: 18px; height: 18px; color: inherit; cursor: pointer; }
.shr-cb-svg { width: 16px; height: 16px; overflow: visible; }
.shr-cb-svg rect { fill: none; stroke: currentColor; stroke-width: 1.6; opacity: .75; }
.shr-cb.on .shr-cb-svg rect, .shr-dvicon .shr-cb-svg rect { fill: currentColor; opacity: 1; }
.shr-cb-svg path { fill: none; stroke: var(--shr-cb-tick, var(--surface)); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.shr-flag { position: absolute; top: 0; right: 0; z-index: 1; width: 0; height: 0; border-style: solid; border-width: 0 7px 7px 0;
  border-color: transparent var(--shr-flag) transparent transparent; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .shr-float { animation: none; }
  .shr-adv-toggle .icon { transition: none; }
  .shr-color:hover { transform: none; }
}

/* ---------------------------------------------------------------- Excel presets (static/js/sheets_presets.js, shp-) */
/* the grid's data bars and icons */
.c.shp-has-bar > .ct, .c.shp-has-ic > .ct { position: relative; z-index: 1; }
.shp-bar { position: absolute; top: 2px; bottom: 3px; box-sizing: border-box; border-radius: 1px; pointer-events: none; }
.shp-axis { position: absolute; top: 0; bottom: 1px; width: 0; border-left: 1px dashed #000000; pointer-events: none; }
.c.shp-has-ic { padding-left: 22px; }
.shp-bd { position: absolute; inset: 0; box-sizing: border-box; pointer-events: none; z-index: 2; }
.shp-ic { position: absolute; left: 3px; top: 50%; width: 16px; height: 16px; margin-top: -8px; display: flex; pointer-events: none; }
.shp-ic .shp-svg, .shp-icons .shp-svg { width: 16px; height: 16px; flex: none; }

/* the dialogs: beside the grid, which stays in view (it previews there) */
.shp-dialog { position: fixed; top: 112px; right: 24px; z-index: 950; width: 380px; max-width: calc(100vw - 32px);
  max-height: calc(100vh - 136px); display: flex; flex-direction: column; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-3); animation: pop .14s ease-out; }
.shp-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px 18px; }
.shp-title { flex: 1; margin: 0; font-size: 15px; font-weight: 600; }
.shp-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 18px 8px; }
.shp-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 18px 14px; border-top: 1px solid var(--border); }
.shp-intro { margin: 2px 0 10px; font-size: 13px; color: var(--text-2); }
.shp-row { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.shp-row > .input, .shp-row > select { flex: 1; min-width: 0; }
.shp-cell { display: flex; flex-direction: column; flex: 1; min-width: 90px; }
.shp-cell-narrow { flex: 0 0 96px; min-width: 0; }
.shp-with { align-self: center; font-size: 13px; color: var(--text-2); }
.shp-dialog .input { height: 34px; }
.shp-dialog .input[aria-invalid] { border-color: var(--danger); }
.shp-dialog .input:disabled { background: var(--surface-2); color: var(--text-3); }
.shp-select { padding-right: 6px; }
.shp-style-row select { flex: 1 1 200px; }
.shp-sample { align-self: center; display: inline-flex; align-items: center; height: 26px; padding: 0 8px; border-radius: 4px;
  border: 1px solid var(--border); font: 13px Arial, var(--font); white-space: nowrap; }
.shp-field { display: flex; flex-direction: column; gap: 4px; margin: 10px 0 0; min-width: 0; }
.shp-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.shp-error { margin-top: 3px; font-size: 12px; color: var(--danger); }
.shp-error[hidden], .shp-custom[hidden] { display: none; }
.shp-custom { margin: 6px 0 4px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.shp-flags { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0 2px; }
.shp-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; margin-top: 8px; }
.shp-colors, .shp-two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.shp-colors { grid-template-columns: repeat(3, 1fr); }
.shp-quick { display: flex; gap: 6px; margin: 8px 0 0; }
.shp-quick-color { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--shr-swatch-ring); cursor: pointer; padding: 0; }
.shp-quick-color:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.shp-icons { display: inline-flex; align-items: center; gap: 3px; }
.shp-icon-editor > .shp-icons { margin-top: 8px; }
.shp-icon-rules { margin-top: 8px; }
.shp-icon-row { align-items: center; margin: 6px 0; }
.shp-icon-row > select { flex: 0 0 auto; min-width: 64px; }
.shp-icon-one { flex: none; }
.shp-range { font-family: var(--mono); font-size: 12.5px; }

/* the gallery (menus) */
/* (a menu holding a gallery is as wide as its tiles: the menus' usual 320px would cut the last columns off) */
.menu:has(> .shp-tiles) { max-width: calc(100vw - 16px); min-width: 0 !important; }   /* (and never wider than a phone) */
.menu .shp-tiles { display: grid; grid-template-columns: repeat(var(--shp-cols, 6), auto); gap: 4px; padding: 2px 12px 6px; justify-content: start; }
.menu .menu-item.shp-tile { width: auto; height: auto; min-height: 30px; padding: 4px; justify-content: center; border-radius: 6px;
  border: 1px solid transparent; }
.menu .menu-item.shp-tile:hover, .menu .menu-item.shp-tile:focus { border-color: var(--border-strong); }
.shp-tile-bar { display: block; width: 32px; height: 14px; border: 1px solid transparent; border-radius: 2px; }
.shp-tile-scale { display: block; width: 24px; height: 26px; border-radius: 3px; border: 1px solid var(--border); }
.shp-icon-tiles .shp-tile { min-width: 112px; }
.shr-swatch.shp-swatch-bar { display: inline-flex; align-items: center; padding: 0 3px; background: var(--surface); }
.shr-swatch.shp-swatch-bar i { display: block; width: 70%; height: 60%; border-radius: 1px; }
.shr-swatch.shp-swatch-icons { display: inline-flex; align-items: center; justify-content: center; gap: 1px; }
.shr-swatch.shp-swatch-icons .shp-svg { width: 11px; height: 11px; }
@media (prefers-reduced-motion: reduce) { .shp-dialog { animation: none; } }

/* ---------------------------------------------------------------- Excel's other ready-made tools (sheets_presets.js) */
/* cell styles */
.menu .shp-cs-tiles .menu-item.shp-tile { padding: 3px; min-width: 96px; }
.shp-cs-sample { display: block; width: 100%; box-sizing: border-box; padding: 4px 6px; border: 1px solid var(--border); border-radius: 3px;
  font: 12px Arial, var(--font); color: #1d2129; background: #ffffff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
/* table styles */
.menu .menu-item.shp-tile.shp-ts-tile { padding: 2px; min-height: 0; }
.menu .menu-item.shp-tile.shp-ts-tile.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.shp-thumb { display: block; border: 1px solid var(--border); border-radius: 2px; }
.shp-design { padding: 2px 2px 12px; }
.shp-design .input { height: 32px; }
.shp-design .shp-row { flex-wrap: nowrap; align-items: center; }
.shp-design > .shp-label { display: block; margin: 14px 0 2px; }   /* ("Table style options": a heading of its own) */
.shp-design-style { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; }
.shp-design-thumb { display: inline-flex; }
.shp-design-thumb .shp-thumb { border: 0; }
.shp-design-flags { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.shp-total-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.shp-total-name { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shp-total-row select { flex: 0 0 140px; }
.shp-design-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); }
.toolbar.sh-toolbar .sh-comma { min-width: 14px; text-align: center; font-size: 15px; line-height: 1; }
/* Quick Analysis: the button under a selection and its panel */
.shq-btn { position: absolute; z-index: 6; width: 24px; height: 24px; padding: 2px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); cursor: pointer; }
.shq-btn[hidden] { display: none; }
.shq-btn:hover, .shq-btn:focus-visible { border-color: var(--accent); outline: none; }
.shq-btn .icon { width: 18px; height: 18px; }
.shq-panel { position: fixed; z-index: 960; width: 440px; max-width: calc(100vw - 16px); background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-3); animation: pop .12s ease-out; }
.shq-tabs { display: flex; gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid var(--border); overflow-x: auto; }
.shq-tab { flex: none; padding: 7px 10px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--text-2);
  font: 600 12.5px var(--font); cursor: pointer; }
.shq-tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.shq-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.shq-tiles { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px 8px 6px; }
.shq-tile { width: 76px; padding: 6px 2px; display: flex; flex-direction: column; align-items: center; gap: 4px; border: 1px solid transparent;
  border-radius: 6px; background: none; color: var(--text); font: 11.5px var(--font); text-align: center; cursor: pointer; }
.shq-tile:hover, .shq-tile:focus-visible { border-color: var(--border-strong); background: var(--surface-2); outline: none; }
.shq-ic, .shq-tile .shc-type-icon { width: 28px; height: 28px; }
.shq-label { line-height: 1.2; }
.shq-note { min-height: 18px; padding: 2px 12px 10px; font-size: 12px; color: var(--text-2); }
.shq-chart { margin: 0 10px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.shq-chart[hidden] { display: none; }
.shq-chart svg { display: block; width: 100%; height: auto; }
.shq-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.shq-ghost { position: absolute; z-index: 5; box-sizing: border-box; display: flex; align-items: center; padding: 0 4px; overflow: hidden;
  background: rgba(68, 114, 196, .14); outline: 1px dashed #4472c4; outline-offset: -1px; font: 700 13px Arial, var(--font); color: var(--text);
  pointer-events: none; white-space: nowrap; }
.shq-ghost.n { justify-content: flex-end; }
.shq-ghost .sh-spark { display: block; }
@media (prefers-reduced-motion: reduce) { .shq-panel { animation: none; } }

/* Data validation: "Each row's list depends on another column" (a dependent dropdown, Category then Sub-category) */
.shr-dep { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.shr-dep-body { display: flex; flex-direction: column; gap: 8px; padding-left: 22px; }
.shr-dep-body[hidden] { display: none; }
.shr-dep-row { display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: center; gap: 8px; font-size: 13px; }
.shr-dep-extra { display: flex; flex-direction: column; gap: 8px; }
