/* ds-allow-hardcode ds-ok: component sizes of the picker; the swatches are palette data. */
/* OA Chart: colour picker (color-picker.js). Chrome uses the chart tokens (--cp-*) with plain fallbacks so it also works outside the chart page; the palette swatches themselves are data. */
.cpk-btn { position: relative; display: inline-grid; place-items: center; flex: none; box-sizing: border-box; width: 34px; height: 30px; padding: 3px; border: 1px solid var(--cp-line, ButtonBorder); border-radius: 8px; background: var(--cp-bg, Canvas); cursor: pointer; vertical-align: middle; }
.cpk-btn:hover { border-color: var(--cp-muted, GrayText); }
.cpk-btn[aria-expanded="true"] { border-color: var(--cp-brand, Highlight); box-shadow: 0 0 0 2px color-mix(in srgb, var(--cp-brand, Highlight) 22%, transparent); }
.cpk-btn:focus-visible, .cpk-cell:focus-visible, .cpk-act:focus-visible, .cpk-rec:focus-visible { outline: 2px solid var(--cp-brand, Highlight); outline-offset: 2px; }
.cpk-sw { position: relative; display: block; width: 100%; height: 100%; overflow: hidden; border-radius: 5px; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cp-ink, CanvasText) 18%, transparent);
  background: repeating-conic-gradient(color-mix(in srgb, var(--cp-ink, CanvasText) 16%, transparent) 0 25%, transparent 0 50%) 0 0 / 8px 8px; }
.cpk-sw::before { content: ""; position: absolute; inset: 0; background: var(--cpk-c, transparent); opacity: var(--cpk-a, 1); }
.cpk-sw[data-none]::before { background: linear-gradient(to top left, transparent calc(50% - 1px), var(--cp-down, red) calc(50% - 1px), var(--cp-down, red) calc(50% + 1px), transparent calc(50% + 1px)); opacity: 1; }
.cpk-sw[data-auto]::after { content: "A"; position: absolute; inset: auto 0 0 auto; padding: 0 3px; font: 700 8px/12px system-ui, sans-serif; color: var(--cp-ink, CanvasText); background: color-mix(in srgb, var(--cp-bg, Canvas) 80%, transparent); border-radius: 3px 0 0 0; }

.cpk { position: fixed; z-index: 2000; box-sizing: border-box; width: min(284px, calc(100vw - 16px)); max-height: calc(100vh - 16px); overflow: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px;
  background: var(--cp-bg, Canvas); color: var(--cp-ink, CanvasText); border: 1px solid var(--cp-line, ButtonBorder); border-radius: 12px; box-shadow: var(--cp-shadow, 0 8px 28px rgba(0, 0, 0, .25)); font: 12.5px/1.4 "IBM Plex Sans Arabic", system-ui, sans-serif; text-align: start; }
.cpk:focus { outline: none; }
.cpk-grid { display: flex; flex-direction: column; gap: 2px; }
.cpk-row { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 2px; }
.cpk-row[data-greys] { margin-bottom: 6px; }
.cpk-cell { position: relative; box-sizing: border-box; min-width: 0; aspect-ratio: 1; min-height: 20px; padding: 0; border: 1px solid color-mix(in srgb, var(--cp-ink, CanvasText) 14%, transparent); border-radius: 4px; background: var(--cpk-c); cursor: pointer; }
.cpk-cell:hover { outline: 2px solid color-mix(in srgb, var(--cp-ink, CanvasText) 55%, transparent); outline-offset: 1px; z-index: 1; }
.cpk-cell[aria-selected="true"] { outline: 2px solid var(--cp-brand, Highlight); outline-offset: 1px; z-index: 1; }
.cpk-cell[aria-selected="true"]::after { content: ""; position: absolute; left: 50%; top: 46%; width: 9px; height: 5px; margin: -4px 0 0 -5px; border-left: 2px solid var(--cpk-on, #000); border-bottom: 2px solid var(--cpk-on, #000); transform: rotate(-45deg); }
.cpk-act { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 10px; border: 1px solid var(--cp-line, ButtonBorder); border-radius: 8px; background: var(--cp-surface, Canvas); color: inherit; font: inherit; cursor: pointer; }
.cpk-act:hover { background: var(--cp-surface-2, Canvas); }
.cpk-act[aria-pressed="true"] { border-color: var(--cp-brand, Highlight); color: var(--cp-brand, Highlight); }
.cpk-nsw { width: 18px; height: 18px; border-radius: 4px; border: 1px solid var(--cp-line, ButtonBorder); background: linear-gradient(to top left, transparent calc(50% - 1px), var(--cp-down, red) calc(50% - 1px), var(--cp-down, red) calc(50% + 1px), transparent calc(50% + 1px)); }
.cpk-sec { display: flex; flex-direction: column; gap: 6px; }
.cpk-alpha { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.cpk-lbl { color: var(--cp-muted, GrayText); font-size: 11.5px; font-weight: 600; }
.cpk-alpha .cpk-lbl { grid-column: auto; }
.cpk-range { width: 100%; min-width: 0; height: 18px; margin: 0; accent-color: var(--cp-brand, Highlight); cursor: pointer; }
.cpk-pct { display: inline-flex; align-items: center; gap: 2px; direction: ltr; }
.cpk-pct i { font-style: normal; color: var(--cp-muted, GrayText); }
.cpk-num, .cpk-hex { box-sizing: border-box; height: 32px; padding: 0 8px; border: 1px solid var(--cp-line, ButtonBorder); border-radius: 8px; background: var(--cp-bg, Canvas); color: inherit; font: 12.5px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.cpk-num { width: 54px; text-align: end; }
.cpk-hex { flex: 1; min-width: 0; }
.cpk-hex[aria-invalid="true"] { border-color: var(--cp-down, red); }
.cpk-hex:focus-visible, .cpk-num:focus-visible, .cpk-range:focus-visible, .cpk-native:focus-visible { outline: 2px solid var(--cp-brand, Highlight); outline-offset: 1px; }
.cpk-err { min-height: 0; color: var(--cp-down, red); font-size: 11.5px; }
.cpk-err:empty { display: none; }
.cpk-cust-row { display: flex; gap: 8px; align-items: center; }
.cpk-native { flex: none; width: 36px; height: 32px; padding: 2px; border: 1px solid var(--cp-line, ButtonBorder); border-radius: 8px; background: var(--cp-bg, Canvas); cursor: pointer; }
.cpk-recent { display: flex; flex-wrap: wrap; gap: 2px; min-height: 24px; align-items: center; }
.cpk-empty { color: var(--cp-muted, GrayText); font-size: 11.5px; }
.cpk-rec { position: relative; box-sizing: border-box; width: 24px; height: 24px; padding: 0; overflow: hidden; border: 1px solid color-mix(in srgb, var(--cp-ink, CanvasText) 18%, transparent); border-radius: 6px; cursor: pointer;
  background: repeating-conic-gradient(color-mix(in srgb, var(--cp-ink, CanvasText) 16%, transparent) 0 25%, transparent 0 50%) 0 0 / 8px 8px; }
.cpk-rec i { position: absolute; inset: 0; background: var(--cpk-c); opacity: var(--cpk-a, 1); }
.cpk-rec:hover { outline: 2px solid color-mix(in srgb, var(--cp-ink, CanvasText) 55%, transparent); outline-offset: 1px; }
.cpk-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (pointer: coarse) {
  .cpk { width: min(484px, calc(100vw - 16px)); }
  .cpk-btn { min-width: 44px; min-height: 44px; }
  .cpk-cell { min-height: 44px; }
  .cpk-act, .cpk-num, .cpk-hex, .cpk-native { min-height: 44px; }
  .cpk-rec { width: 44px; height: 44px; }
  .cpk-range { height: 32px; }
}
@media (pointer: coarse) and (max-width: 520px) { .cpk-cell { min-height: 0; } }
@media (prefers-reduced-motion: no-preference) { .cpk { animation: cpk-in .12s ease-out; } @keyframes cpk-in { from { opacity: 0; transform: translateY(-3px); } } }
