/* Creators Packs components. Shared building blocks, named cp-*, built only from tokens.css.
   Product-specific layout lives in each product (Creator Console: app/app.css, named cc-*).

   Contents: streak · header · section · card · button · icon button · tool · segmented control ·
   toggle · select · input · row · dot · badge · kbd · empty state · status line · tooltip */

/* ---------- Streak: the Creators Packs signature (four slanted colour bars) ----------
   Everything that shows the streak shares this one drawing. It is declared on each element (not as
   a :root value) so an element can set its own --cp-streak-bar thickness. */
.cp-streak, .cp-section__title::before, .cp-button--primary::before {
  background:
    linear-gradient(90deg, transparent, var(--cp-brand-red)) 0 0 / 100% var(--cp-streak-bar) no-repeat,
    linear-gradient(90deg, transparent, var(--cp-brand-blue)) 0 33.3% / 100% var(--cp-streak-bar) no-repeat,
    linear-gradient(90deg, transparent, var(--cp-brand-yellow)) 0 66.6% / 100% var(--cp-streak-bar) no-repeat,
    linear-gradient(90deg, transparent, var(--cp-brand-green)) 0 100% / 100% var(--cp-streak-bar) no-repeat;
  transform: var(--cp-streak-skew);
}
.cp-streak { display: inline-block; flex: none; width: 14px; height: 9px; }

/* ---------- Header: product logo, compact ---------- */
.cp-header {
  display: flex; align-items: center; gap: var(--cp-space-sm);
  padding: var(--cp-space-sm) var(--cp-gutter);
  border-bottom: var(--cp-border-width) solid var(--cp-border);
  background: var(--cp-bg);
}
.cp-header__brand { flex: 1 1 auto; min-width: 0; line-height: 0; }
/* The logo carries its own glow, so it sits on the plain background. Width-led so it scales down in
   thin panels without cropping. */
.cp-header__logo { width: 100%; max-width: 172px; height: auto; }
.cp-header__actions { display: flex; align-items: center; gap: var(--cp-space-2xs); flex: none; }

/* ---------- Section: a heading with the streak mark, then content ---------- */
.cp-section { display: flex; flex-direction: column; gap: var(--cp-space-sm); min-width: 0; }
.cp-section__head { display: flex; align-items: center; justify-content: space-between; gap: var(--cp-space-sm); min-height: 18px; }
/* In a tight row the heading keeps its room and the side note gives way first. */
/* A block (not flex) so a heading too long for a thin panel ends in "…". */
.cp-section__title {
  display: block; min-width: 0; flex: 0 0 auto; max-width: 100%; padding-left: 2px;
  font-size: var(--cp-heading-size); font-weight: var(--cp-weight-heavy); font-style: italic; line-height: 18px;
  text-transform: uppercase; letter-spacing: var(--cp-tracking-caps); color: var(--cp-text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cp-section__title::before { content: ""; display: inline-block; width: 14px; height: 9px; margin-right: 7px; vertical-align: -0.5px; }
.cp-section__aside {
  flex: 0 1 auto; min-width: 0; color: var(--cp-text-secondary); font-size: var(--cp-text-xs);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- Card ---------- */
.cp-card {
  background: var(--cp-surface);
  border: var(--cp-border-width) solid var(--cp-border);
  border-radius: var(--cp-radius-lg);
  padding: var(--cp-space-sm) var(--cp-space-md);
  min-width: 0;
}

/* ---------- Button ---------- */
.cp-button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--cp-space-sm);
  min-width: 0; height: var(--cp-control-height-md); padding: 0 12px;
  background: var(--cp-surface-raised); color: var(--cp-text-primary);
  border: var(--cp-border-width) solid var(--cp-border); border-radius: var(--cp-radius-md);
  font-size: var(--cp-text-md); font-weight: var(--cp-weight-semibold); white-space: nowrap;
  transition: background-color var(--cp-duration-fast), border-color var(--cp-duration-fast);
}
.cp-button:hover:not(:disabled) { background: var(--cp-surface-hover); border-color: var(--cp-border-strong); }
.cp-button:active:not(:disabled) { background: var(--cp-surface-pressed); }
.cp-button:disabled { color: var(--cp-text-disabled); background: var(--cp-surface); }
.cp-button--sm { height: var(--cp-control-height-sm); padding: 0 10px; font-size: var(--cp-text-sm); }
.cp-button--block { display: flex; width: 100%; }
.cp-button--ghost { background: transparent; border-color: transparent; color: var(--cp-text-secondary); }
.cp-button--ghost:hover:not(:disabled) { background: var(--cp-surface-raised); border-color: transparent; color: var(--cp-text-primary); }
/* Selected (a toggle button that is on, the current choice): yellow. */
.cp-button[aria-pressed="true"] {
  color: var(--cp-text-primary); background: var(--cp-accent-soft); border-color: var(--cp-accent-line);
}
/* Primary: the TextFX main-action button — glossy white with the slanted streak. Use once per view. */
.cp-button--primary {
  position: relative; overflow: hidden; padding-left: 32px;
  background: var(--cp-primary-fill); color: var(--cp-primary-ink); border-color: var(--cp-primary-border);
  font-weight: var(--cp-weight-heavy); font-style: italic; letter-spacing: 0.01em;
  box-shadow: var(--cp-primary-shadow);
}
.cp-button--primary::before {
  content: ""; position: absolute; left: 9px; top: 50%; width: 17px; height: 12px;
  --cp-streak-bar: 2px; transform: translateY(-50%) var(--cp-streak-skew);
}
.cp-button--primary:hover:not(:disabled) {
  background: var(--cp-primary-fill); border-color: var(--cp-primary-border); filter: brightness(1.05);
}
.cp-button--primary:disabled { filter: grayscale(1); opacity: var(--cp-disabled-opacity); color: var(--cp-primary-ink); }

/* ---------- Icon button (header actions, dismiss) ---------- */
.cp-icon-button {
  display: inline-grid; place-items: center; flex: none;
  width: var(--cp-control-height-sm); height: var(--cp-control-height-sm); padding: 0;
  background: transparent; color: var(--cp-text-secondary);
  border: var(--cp-border-width) solid transparent; border-radius: var(--cp-radius-sm);
  transition: background-color var(--cp-duration-fast), color var(--cp-duration-fast);
}
.cp-icon-button:hover:not(:disabled) { background: var(--cp-surface-raised); color: var(--cp-text-primary); }
.cp-icon-button[aria-pressed="true"], .cp-icon-button[aria-expanded="true"] { color: var(--cp-accent); background: var(--cp-accent-soft); }
.cp-icon-button:disabled { color: var(--cp-text-disabled); }
.cp-icon-button--xs { width: var(--cp-control-height-xs); height: var(--cp-control-height-xs); border-radius: var(--cp-radius-xs); }
.cp-icon-button svg { width: var(--cp-icon-md); height: var(--cp-icon-md); }
.cp-icon-button--xs svg { width: var(--cp-icon-sm); height: var(--cp-icon-sm); }

/* ---------- Tool button: icon over a short label ----------
   States: default · hover (lighter) · running (yellow, with a thin moving bar) · disabled (dim).
   Errors never colour the button; they go to the status line. */
.cp-tool {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  min-width: var(--cp-tool-min-width); height: var(--cp-tool-height); padding: 6px 4px;
  background: var(--cp-surface-raised); color: var(--cp-text-primary);
  border: var(--cp-border-width) solid var(--cp-border); border-radius: var(--cp-radius-md);
  transition: background-color var(--cp-duration-fast), border-color var(--cp-duration-fast), color var(--cp-duration-fast);
}
.cp-tool__icon { width: var(--cp-icon-lg); height: var(--cp-icon-lg); flex: none; }
.cp-tool__label {
  max-width: 100%; font-size: var(--cp-text-xs); font-weight: var(--cp-weight-semibold); line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cp-tool:hover:not(:disabled):not([aria-disabled="true"]) { background: var(--cp-surface-hover); border-color: var(--cp-border-strong); }
.cp-tool:active:not(:disabled):not([aria-disabled="true"]) { background: var(--cp-surface-pressed); }
.cp-tool[data-state="running"] { border-color: var(--cp-accent-line); background: var(--cp-accent-soft); cursor: progress; }
.cp-tool[data-state="running"] .cp-tool__icon { color: var(--cp-accent); }
.cp-tool[data-state="running"]::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 40%;
  background: var(--cp-accent); animation: cp-running 1s ease-in-out infinite alternate;
}
.cp-tool:disabled, .cp-tool[aria-disabled="true"] { color: var(--cp-text-disabled); background: var(--cp-surface); cursor: not-allowed; }
@keyframes cp-running { from { transform: translateX(-10%); } to { transform: translateX(160%); } }

/* ---------- Segmented control (TextFX .seg): one choice out of a few ----------
   The chosen segment is lifted and underlined in yellow. --cp-seg-columns switches it to a grid so a
   long control can wrap into rows instead of scrolling sideways. */
.cp-seg {
  display: flex; gap: var(--cp-space-2xs); min-width: 0;
  padding: var(--cp-space-2xs);
  background: var(--cp-surface-raised); border: var(--cp-border-width) solid var(--cp-border); border-radius: var(--cp-radius-md);
}
.cp-seg--grid { display: grid; grid-template-columns: repeat(var(--cp-seg-columns, 3), minmax(0, 1fr)); }
.cp-seg__item {
  display: flex; align-items: center; justify-content: center; gap: 5px; flex: 1; min-width: 0;
  min-height: var(--cp-control-height-sm); padding: 4px 6px;
  background: none; border: 0; border-radius: var(--cp-radius-sm);
  color: var(--cp-text-secondary); font-size: var(--cp-text-sm); white-space: nowrap;
  transition: background-color var(--cp-duration-fast), color var(--cp-duration-fast);
}
.cp-seg__item svg { width: var(--cp-icon-sm); height: var(--cp-icon-sm); flex: none; }
.cp-seg__item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cp-seg__item:hover:not(:disabled) { color: var(--cp-text-primary); background: var(--cp-surface-hover); }
.cp-seg__item[aria-checked="true"], .cp-seg__item[aria-selected="true"] {
  background: var(--cp-surface); color: var(--cp-text-primary); font-weight: var(--cp-weight-semibold);
  box-shadow: inset 0 -2px 0 var(--cp-accent);
}
.cp-seg__item:focus-visible { box-shadow: var(--cp-focus-ring); }
.cp-seg__item:disabled { opacity: var(--cp-disabled-opacity); }
/* The uppercase, heavier variant (TextFX's mode switcher) for top-level navigation. */
.cp-seg--caps .cp-seg__item { font-size: var(--cp-text-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }

/* ---------- Toggle (switch) ----------
   <label class="cp-toggle"><input type="checkbox" role="switch"><span class="cp-toggle__track"></span> Label</label> */
.cp-toggle { display: inline-flex; align-items: center; gap: var(--cp-space-sm); min-width: 0; cursor: pointer; }
.cp-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.cp-toggle__track {
  position: relative; flex: none; width: 28px; height: 16px; border-radius: var(--cp-radius-pill);
  background: var(--cp-surface-hover); border: var(--cp-border-width) solid var(--cp-border-strong);
  transition: background-color var(--cp-duration-fast), border-color var(--cp-duration-fast);
}
.cp-toggle__track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--cp-text-secondary); transition: transform var(--cp-duration-fast), background-color var(--cp-duration-fast);
}
.cp-toggle input:checked + .cp-toggle__track { background: var(--cp-accent); border-color: var(--cp-accent); }
.cp-toggle input:checked + .cp-toggle__track::after { transform: translateX(12px); background: var(--cp-accent-ink); }
.cp-toggle input:focus-visible + .cp-toggle__track { box-shadow: var(--cp-focus-ring); }
.cp-toggle input:disabled + .cp-toggle__track { opacity: var(--cp-disabled-opacity); }
.cp-toggle:has(input:disabled) { cursor: not-allowed; color: var(--cp-text-disabled); }

/* ---------- Select ---------- <span class="cp-select"><select>…</select></span>
   Keeps the width of its longest choice; in a tight row the label beside it truncates instead. */
.cp-select { position: relative; display: inline-flex; flex: 0 0 auto; max-width: 100%; }
.cp-select select {
  appearance: none; -webkit-appearance: none; width: 100%; max-width: 100%;
  height: var(--cp-control-height-sm); padding: 0 24px 0 8px;
  background: var(--cp-bg); color: var(--cp-text-primary);
  border: var(--cp-border-width) solid var(--cp-border); border-radius: var(--cp-radius-md);
  font-size: var(--cp-text-sm);
}
.cp-select select:hover:not(:disabled) { border-color: var(--cp-border-strong); }
.cp-select select:focus-visible { border-color: var(--cp-accent); box-shadow: none; }
.cp-select::after {
  content: ""; position: absolute; right: 10px; top: 50%; width: 5px; height: 5px; margin-top: -4px; pointer-events: none;
  border-right: 1.5px solid var(--cp-text-secondary); border-bottom: 1.5px solid var(--cp-text-secondary); transform: rotate(45deg);
}

/* ---------- Input ---------- */
.cp-input {
  width: 100%; min-width: 0; height: var(--cp-control-height-sm); padding: 0 8px;
  background: var(--cp-bg); color: var(--cp-text-primary);
  border: var(--cp-border-width) solid var(--cp-border); border-radius: var(--cp-radius-md);
  font-size: var(--cp-text-sm);
}
.cp-input:hover:not(:disabled) { border-color: var(--cp-border-strong); }
.cp-input:focus-visible { border-color: var(--cp-accent); box-shadow: none; }
.cp-input::placeholder { color: var(--cp-text-disabled); }
.cp-input--mono { font-family: var(--cp-font-mono); font-weight: 700; font-size: var(--cp-text-xs); text-align: right; }

/* ---------- Row: label on the left, value or control on the right ---------- */
.cp-rows { display: flex; flex-direction: column; }
.cp-row { display: flex; align-items: center; gap: var(--cp-space-sm); min-height: 28px; min-width: 0; }
.cp-rows > .cp-row + .cp-row { border-top: var(--cp-border-width) solid var(--cp-border); }
.cp-row__icon { flex: none; width: var(--cp-icon-md); height: var(--cp-icon-md); color: var(--cp-text-secondary); }
/* When space runs out the value gives way long before the label does. */
.cp-row__label { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-row__value { flex: 0 20 auto; min-width: 0; max-width: 60%; color: var(--cp-text-secondary); font-size: var(--cp-text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Dot: on (yellow) / off (hollow) ---------- */
.cp-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--cp-text-disabled); }
.cp-dot[data-on="true"] { background: var(--cp-accent); border-color: var(--cp-accent); }

/* ---------- Badge ---------- */
.cp-badge {
  display: inline-flex; align-items: center; flex: none; height: 16px; padding: 0 6px;
  border-radius: var(--cp-radius-pill); background: var(--cp-surface-hover); color: var(--cp-text-secondary);
  font-size: var(--cp-text-2xs); font-weight: var(--cp-weight-heavy); letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap;
}
.cp-badge--accent { background: var(--cp-accent-soft); color: var(--cp-accent); }

/* ---------- Keyboard key (TextFX kbd) ---------- */
.cp-kbd {
  display: inline-block; padding: 0 5px; border-radius: var(--cp-radius-xs);
  background: var(--cp-surface-raised); border: var(--cp-border-width) solid var(--cp-border-strong);
  font: 700 var(--cp-text-2xs) / 1.6 var(--cp-font-mono); color: var(--cp-text-primary);
}

/* ---------- Empty state: what's missing and what to do about it ---------- */
.cp-empty {
  display: flex; flex-direction: column; align-items: center; gap: var(--cp-space-sm);
  padding: var(--cp-space-lg) var(--cp-space-md); text-align: center;
}
.cp-empty__icon {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--cp-surface-raised); color: var(--cp-text-secondary);
}
.cp-empty__icon svg { width: var(--cp-icon-lg); height: var(--cp-icon-lg); }
.cp-empty__title { font-weight: var(--cp-weight-semibold); }
.cp-empty__body { max-width: 260px; color: var(--cp-text-secondary); font-size: var(--cp-text-sm); }

/* ---------- Status line: short, non-blocking feedback at the bottom of the panel ----------
   Idle, it shows the streak and a quiet "Ready"; a message replaces that for a few seconds. */
.cp-status {
  display: flex; align-items: center; gap: var(--cp-space-sm);
  min-height: 32px; padding: 5px var(--cp-space-sm) 5px var(--cp-gutter);
  background: var(--cp-surface); border-top: var(--cp-border-width) solid var(--cp-border);
  font-size: var(--cp-text-sm); box-shadow: var(--cp-shadow-bar);
}
.cp-status__idle { display: flex; align-items: center; gap: var(--cp-space-sm); flex: 1; min-width: 0; color: var(--cp-text-secondary); }
.cp-status__version { margin-left: auto; padding-right: var(--cp-space-xs); font: 700 var(--cp-text-2xs) var(--cp-font-mono); color: var(--cp-text-disabled); white-space: nowrap; }
.cp-status__message { display: flex; align-items: center; gap: var(--cp-space-sm); flex: 1; min-width: 0; animation: cp-status-in var(--cp-duration-medium) ease-out; }
.cp-status__icon { flex: none; width: var(--cp-icon-md); height: var(--cp-icon-md); }
.cp-status__text {
  flex: 1; min-width: 0; line-height: 1.3;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.cp-status[data-type="success"] .cp-status__icon { color: var(--cp-success); }
.cp-status[data-type="info"] .cp-status__icon { color: var(--cp-info); }
.cp-status[data-type="warning"] .cp-status__icon { color: var(--cp-warning); }
.cp-status[data-type="error"] .cp-status__icon { color: var(--cp-error); }
.cp-status__message--ask { flex-wrap: wrap; row-gap: var(--cp-space-xs); }
/* A question is shown in full, with its buttons on the line below. */
.cp-status__message--ask { align-items: flex-start; }
.cp-status__message--ask .cp-status__text { flex: 1 1 calc(100% - 30px); display: block; -webkit-line-clamp: unset; overflow: visible; }
.cp-status__actions { display: flex; gap: var(--cp-space-xs); margin-left: auto; }
.cp-status__actions .cp-button:not(.cp-button--ghost) { border-color: var(--cp-accent-line); }
@keyframes cp-status-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ---------- Menu: a few preset values plus the user's own (menu.js) ----------
   One row of four, down to the narrowest panel. The last value used is marked yellow. */
.cp-menu {
  position: fixed; z-index: var(--cp-z-menu); top: 0; left: 0;
  width: min(200px, calc(100vw - 12px)); padding: var(--cp-space-xs);
  display: flex; flex-direction: column; gap: var(--cp-space-xs);
  background: var(--cp-surface-raised); border: var(--cp-border-width) solid var(--cp-border-strong);
  border-radius: var(--cp-radius-md); box-shadow: var(--cp-shadow-pop);
  animation: cp-tooltip-in var(--cp-duration-fast) ease-out;
}
.cp-menu__choices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--cp-space-xs); }
.cp-menu__choice {
  height: var(--cp-control-height-md); min-width: 0; padding: 0 2px;
  background: var(--cp-surface); color: var(--cp-text-primary);
  border: var(--cp-border-width) solid var(--cp-border); border-radius: var(--cp-radius-md);
  font-family: var(--cp-font-mono); font-size: var(--cp-text-xs); font-weight: 700; white-space: nowrap;
  transition: background-color var(--cp-duration-fast), border-color var(--cp-duration-fast);
}
/* Choices that are words (Reset ▸ Motion / Scale / …) need room: two to a row in the text face, and with an
   odd number the first — the broadest choice — takes a row to itself. */
.cp-menu__choices--words { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cp-menu__choices--words .cp-menu__choice { font-family: var(--cp-font); font-size: var(--cp-text-sm); font-weight: var(--cp-weight-medium, 600); padding: 0 6px; overflow: hidden; text-overflow: ellipsis; }
.cp-menu__choices--words .cp-menu__choice:first-child:nth-last-child(odd) { grid-column: 1 / -1; }
.cp-menu__choice:hover { background: var(--cp-surface-hover); border-color: var(--cp-border-strong); }
.cp-menu__choice:active { background: var(--cp-surface-pressed); }
.cp-menu__choice[aria-pressed="true"] { border-color: var(--cp-accent-line); background: var(--cp-accent-soft); color: var(--cp-accent); }
.cp-menu__custom { display: flex; align-items: center; gap: var(--cp-space-xs); }
.cp-menu__input { flex: 1 1 auto; -moz-appearance: textfield; }
.cp-menu__input::-webkit-inner-spin-button, .cp-menu__input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.cp-menu__input[aria-invalid="true"] { border-color: var(--cp-error); }
.cp-menu__suffix { flex: none; color: var(--cp-text-secondary); font-family: var(--cp-font-mono); font-size: var(--cp-text-xs); font-weight: 700; }
.cp-menu__custom .cp-button { flex: none; }
.cp-menu__heading { font-size: var(--cp-text-xs); font-weight: var(--cp-weight-heavy); font-style: italic; letter-spacing: var(--cp-tracking-caps); text-transform: uppercase; color: var(--cp-text-primary); padding: 2px 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-menu__apply { border-color: var(--cp-accent-line); }
.cp-menu__extra { display: flex; align-items: center; gap: var(--cp-space-sm); min-width: 0; }
.cp-menu__extra-label { flex: none; color: var(--cp-text-secondary); font-size: var(--cp-text-xs); font-weight: var(--cp-weight-semibold); }
.cp-menu__extra .cp-select { flex: 1 1 auto; min-width: 0; }
.cp-menu__extra .cp-select select { width: 100%; }

/* ---------- Tooltip: drawn by the panel (Premiere web views can't be trusted with title tooltips) ---------- */
.cp-tooltip {
  position: fixed; z-index: var(--cp-z-tooltip); top: 0; left: 0;
  max-width: min(240px, calc(100vw - 2 * var(--cp-space-sm)));
  padding: 7px 9px; pointer-events: none;
  background: var(--cp-surface-raised); color: var(--cp-text-primary);
  border: var(--cp-border-width) solid var(--cp-border-strong); border-radius: var(--cp-radius-md);
  box-shadow: var(--cp-shadow-pop); font-size: var(--cp-text-sm); line-height: 1.35;
  animation: cp-tooltip-in var(--cp-duration-fast) ease-out;
}
.cp-tooltip__title {
  display: block; margin-bottom: 2px;
  font-size: var(--cp-text-xs); font-weight: var(--cp-weight-heavy); font-style: italic;
  letter-spacing: var(--cp-tracking-caps); text-transform: uppercase;
}
.cp-tooltip__title:only-child { margin-bottom: 0; }
.cp-tooltip__body { color: var(--cp-text-secondary); }
.cp-tooltip__keys { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; padding-top: 6px; border-top: var(--cp-border-width) solid var(--cp-border-strong); }
.cp-tooltip__key { display: flex; align-items: baseline; gap: var(--cp-space-sm); color: var(--cp-text-secondary); }
.cp-tooltip__key .cp-kbd { flex: none; }
@keyframes cp-tooltip-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Swatch: a user's colour (labels), never a theme colour ----------
   Colour comes from --swatch, set per element. A thin inner ring keeps dark colours visible on the
   dark panel. */
.cp-swatch {
  display: inline-block; flex: none; width: 12px; height: 12px; border-radius: 50%;
  background: var(--swatch, var(--cp-text-disabled));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}
.cp-swatch--lg { width: 18px; height: 18px; }
.cp-swatch-button {
  flex: none; width: 22px; height: 22px; padding: 0; border-radius: 50%;
  background: var(--swatch); border: 2px solid var(--cp-surface); box-shadow: 0 0 0 1px var(--cp-border-strong);
}
.cp-swatch-button:hover { box-shadow: 0 0 0 1px var(--cp-text-secondary); }
.cp-swatch-button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--cp-accent); }

/* ---------- Label button: a swatch and a name, one click ----------
   Selection and running still use the yellow treatment; the label's own colour only fills the swatch. */
.cp-tool .cp-swatch { width: 14px; height: 14px; }
.cp-label-chip {
  display: flex; align-items: center; gap: var(--cp-space-sm); min-width: 0; min-height: 30px; padding: 4px 10px;
  background: var(--cp-surface-raised); color: var(--cp-text-primary);
  border: var(--cp-border-width) solid var(--cp-border); border-radius: var(--cp-radius-md);
  font-size: var(--cp-text-sm); font-weight: var(--cp-weight-semibold); text-align: left;
  transition: background-color var(--cp-duration-fast), border-color var(--cp-duration-fast);
}
.cp-label-chip > span:not(.cp-swatch) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-label-chip:hover:not([aria-disabled="true"]) { background: var(--cp-surface-hover); border-color: var(--cp-border-strong); }
.cp-label-chip[data-state="running"] { border-color: var(--cp-accent-line); background: var(--cp-accent-soft); cursor: progress; }
.cp-label-chip[aria-disabled="true"] { color: var(--cp-text-disabled); }
.cp-label-chip[aria-pressed="true"] { border-color: var(--cp-accent-line); box-shadow: inset 3px 0 0 var(--cp-accent); }

/* ---------- Colour picker ---------- */
.cp-picker { display: flex; flex-direction: column; gap: var(--cp-space-md); min-width: 0; }
.cp-picker__sv {
  position: relative; height: 128px; border-radius: var(--cp-radius-md); cursor: crosshair; touch-action: none;
  /* White to the colour across, then down to black. The hue itself is set by the script. */
  background-image: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.cp-picker__hue {
  position: relative; height: 12px; border-radius: var(--cp-radius-pill); cursor: pointer; touch-action: none;
  /* The hue spectrum: data, not theme colours. */
  background: linear-gradient(to right, #f00 0%, #ff0 16.67%, #0f0 33.33%, #0ff 50%, #00f 66.67%, #f0f 83.33%, #f00 100%);
}
.cp-picker__thumb {
  position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; pointer-events: none;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.45);
}
.cp-picker__thumb--hue { top: 50%; }
.cp-picker__sv:focus-visible, .cp-picker__hue:focus-visible { box-shadow: var(--cp-focus-ring); }
.cp-picker__values { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--cp-space-sm); align-items: end; }
.cp-picker__preview { width: 40px; height: 40px; border-radius: var(--cp-radius-md); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); grid-row: span 2; align-self: stretch; height: auto; min-height: 40px; }
.cp-picker__field { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: var(--cp-text-2xs); font-weight: var(--cp-weight-heavy); letter-spacing: 0.06em; color: var(--cp-text-secondary); }
.cp-picker__field .cp-input { text-align: left; }
.cp-picker__rgb { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--cp-space-xs); min-width: 0; }
.cp-picker__rgb .cp-input { padding: 0 4px; -moz-appearance: textfield; }
.cp-picker__rgb .cp-input::-webkit-inner-spin-button, .cp-picker__rgb .cp-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.cp-input[aria-invalid="true"] { border-color: var(--cp-error); }
.cp-picker__recent { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cp-space-sm); min-height: 22px; }
.cp-picker__recent:empty { display: none; }
.cp-picker__recent-label { font-size: var(--cp-text-2xs); font-weight: var(--cp-weight-heavy); letter-spacing: 0.06em; text-transform: uppercase; color: var(--cp-text-secondary); }
/* Very thin panels: the preview sits above the fields instead of beside them. */
@media (max-width: 219px) {
  .cp-picker__values { grid-template-columns: minmax(0, 1fr); }
  .cp-picker__preview { grid-row: auto; height: 24px; min-height: 24px; width: 100%; }
}

/* ---------- Interaction states: yellow, everywhere ----------
   A tile or preset answers in the accent: tinted edge and icon on hover, a lit edge when pressed.
   Colour on a control always means something (tokens.css): yellow = interaction, green = it worked,
   red = it didn't, or it's destructive. */
.cp-tool:hover:not(:disabled):not([aria-disabled="true"]), .cc-preset:hover:not([aria-disabled="true"]), .cp-label-chip:hover:not([aria-disabled="true"]) { border-color: var(--cp-accent-line); }
.cp-tool:hover:not(:disabled):not([aria-disabled="true"]) .cp-tool__icon { color: var(--cp-accent); }
.cp-tool:active:not(:disabled):not([aria-disabled="true"]), .cc-preset:active:not([aria-disabled="true"]) {
  background: var(--cp-accent-soft); box-shadow: inset 3px 0 0 var(--cp-accent), 0 0 12px color-mix(in srgb, var(--cp-accent) 28%, transparent);
}
.cc-nav .cp-seg__item[aria-checked="true"] svg, .cc-nav .cp-seg__item:hover svg { color: var(--cp-accent); }
.cc-nav .cp-seg__item:hover:not([aria-checked="true"]) { box-shadow: inset 0 -2px 0 var(--cp-accent-line); }
/* The open dropdown: edge bar, tint, soft glow. */
.cc-acc__group[open] { border-color: var(--cp-accent-line); box-shadow: inset 3px 0 0 var(--cp-accent), 0 0 12px color-mix(in srgb, var(--cp-accent) 18%, transparent); }
.cc-acc__group[open] > .cc-acc__head { background: var(--cp-accent-soft); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.cc-acc__group[open] > .cc-acc__body { padding-top: var(--cp-space-sm); }

/* A menu that asks for a line of text (a new sequence's name): the field on its own line, the button under it. */
.cp-menu__custom--text { flex-direction: column; align-items: stretch; gap: 6px; }
.cp-menu__custom--text .cp-menu__text { width: 100%; min-width: 140px; text-align: left; }

/* An overflow menu: one action per line, left-aligned; a destructive one in red. */
.cp-menu__choices--list { grid-template-columns: 1fr; }
.cp-menu__choices--list .cp-menu__choice { justify-content: flex-start; text-align: left; padding: 0 8px; }
.cp-menu__choice--danger { color: var(--cp-danger, #e0504a); }
.cp-menu__choice--danger:hover { border-color: var(--cp-danger, #e0504a); }
