/* Palette studio dialog (palette-studio.js) and the palette swatch menu. */
.palette-actions .palette-studio-button { grid-column: 1 / -1; border-color: #c9d8bd; background: var(--green-soft); color: var(--green); font-weight: 600; }
.palette-actions .palette-studio-button:hover:not(:disabled) { background: #dfe9d6; border-color: #b7c9a8; }

.modal.palette-studio-modal { --modal-width: 1040px; height: min(calc(100dvh - var(--modal-gap)), 860px); }
.modal.palette-studio-modal[open] { display: flex; }
.palette-studio-modal .modal-heading { padding: 18px 22px 10px; }
.palette-studio-modal .modal-heading h2 { margin-top: 4px; font-size: 20px; }
.palette-studio-modal .modal-content { display: flex; flex: 1 1 auto; min-height: 0; padding: 0; }
.ps { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; min-height: 0; }
.ps-tabs { margin: 0 22px 12px; }
.ps-tabs .export-tab { min-height: 38px; }
.ps-main { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 2px 22px 16px; overscroll-behavior: contain; }

.ps-split { display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 22px; align-items: start; }
.ps-split.presets { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.ps-side { display: grid; gap: 9px; align-content: start; }
.ps-side .button.small { justify-content: flex-start; }
.ps-content { display: grid; gap: 12px; align-content: start; min-width: 0; }
.ps .field { margin: 0; gap: 4px; }
.ps .field-label small { font-weight: 500; }
.ps-hint { margin: 0; color: #6c7865; font-size: 11px; line-height: 1.6; }
.ps-meta { color: #8a9680; font-size: 10px; font-variant-numeric: tabular-nums; }
.ps-title { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -.2px; }

.ps-wheel { display: block; width: 236px; height: 236px; margin: 0 auto; border-radius: 50%; cursor: crosshair; touch-action: none; }
.ps-wheel:focus-visible { outline: 2px solid #779d62; outline-offset: 2px; }
.ps-base { display: flex; align-items: center; gap: 8px; }
.ps-chip { display: inline-block; flex: 0 0 auto; width: 26px; height: 26px; border: 1px solid #0000001a; border-radius: 6px; background: var(--swatch, #fff); }
.ps-hex { width: 84px; min-height: 30px; padding: 4px 7px; border: 1px solid #d8e1d0; border-radius: 6px; background: var(--paper); font-size: 12px; font-variant-numeric: tabular-nums; text-transform: uppercase; }
.ps-hex:focus-visible { outline: 2px solid var(--green); outline-offset: 0; }
.ps-mini-palette { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 5px; padding: 2px; }
.ps-mini-palette .swatch { height: 22px; border-radius: 4px; }

.ps-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.ps-chip-button { min-height: 28px; padding: 4px 10px; border: 1px solid #d8e1d0; border-radius: 999px; background: #fff; color: #52664d; font-size: 11px; font-weight: 550; }
.ps-chip-button:hover { background: #f3f6ee; }
.ps-chip-button[aria-checked="true"] { border-color: var(--green); background: var(--green); color: #fff; }
.ps-sliders { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.ps-sliders.single { grid-template-columns: 1fr; margin-top: 4px; }
.ps .field-row { grid-template-columns: minmax(0, 1fr) 46px; }

.ps-rows { display: grid; gap: 7px; }
.ps-row { display: grid; grid-template-columns: 128px minmax(0, 1fr); align-items: center; gap: 10px; transition: opacity .14s; }
.ps-row.off .ps-swatches { opacity: .38; }
.ps-row-head { display: flex; align-items: center; gap: 7px; min-width: 0; color: #52664d; font-size: 11px; font-weight: 600; cursor: pointer; }
.ps-row-head input { flex: 0 0 auto; width: 14px; height: 14px; margin: 0; accent-color: var(--green); }
.ps-row-head small { color: #8a9680; font-weight: 500; }
.ps-swatches { display: flex; gap: 3px; min-width: 0; }
.ps-swatch { position: relative; flex: 1 1 0; min-width: 14px; max-width: 56px; height: 32px; padding: 0; border: 1px solid #0000001a; border-radius: 5px; background: var(--swatch); }
.ps-swatch:hover, .ps-swatch:focus-visible { z-index: 1; outline: 2px solid #536e43; outline-offset: 1px; }
.ps-swatch:hover::after { content: "+"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 15px; font-weight: 700; text-shadow: 0 0 3px #000a; }
.ps-swatch.in-palette::before { content: ""; position: absolute; right: 3px; bottom: 3px; width: 5px; height: 5px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px #0006; }

.ps-preset-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.ps-search { flex: 1 1 200px; min-height: 30px; padding: 4px 9px; border: 1px solid #d8e1d0; border-radius: 7px; background: var(--paper); font-size: 12px; }
.ps-select { min-height: 30px; padding: 3px 7px; border: 1px solid #d8e1d0; border-radius: 7px; background: var(--paper); color: #37503c; font-size: 11px; }
.ps-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 8px; max-height: calc(min(94dvh, 800px) - 270px); overflow-y: auto; padding: 2px 4px 2px 2px; }
.ps-card { display: grid; gap: 6px; padding: 8px 9px; border: 1px solid #dce4d5; border-radius: 9px; background: #fff; text-align: left; }
.ps-card:hover { border-color: #b7c9a8; background: #fbfcf8; }
.ps-card[aria-selected="true"] { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); background: #f6f9f1; }
.ps-card-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12px; }
.ps-card-strip { display: flex; flex-wrap: wrap; height: 22px; overflow: hidden; border-radius: 4px; box-shadow: inset 0 0 0 1px #0000000f; }
.ps-card-strip i { flex: 1 0 6px; min-width: 6px; height: 100%; background: var(--swatch); }
.ps-card small { color: #8a9680; font-size: 10px; }
.ps-preset-detail .ps-row { grid-template-columns: 74px minmax(0, 1fr); }

.ps-stat { margin: 0; color: #52664d; font-size: 12px; }
.ps-strip { height: 22px; }
.ps-strip i { flex: 1 1 0; background: var(--swatch); }
.ps-chart { display: block; width: 100%; height: 130px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.ps-similar-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; margin-top: 4px; }
.ps .ps-inline-slider { display: grid; grid-template-columns: auto 150px 44px; gap: 8px; color: #6c7865; font-size: 11px; }
.ps-pairs { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px; }
.ps-pair { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 11px; color: #52664d; }
.ps-pair .ps-chip { width: 22px; height: 22px; }
.ps-pair span { flex: 1 1 auto; }

.ps-footer { flex: 0 0 auto; padding: 10px 22px 14px; border-top: 1px solid var(--line); background: var(--surface); border-radius: 0 0 13px 13px; }
.ps-footer-row { display: flex; align-items: center; gap: 9px; }
.ps-summary { flex: 1 1 auto; margin: 0; color: #6c7865; font-size: 11px; }
.ps-summary strong { color: var(--ink); }
.ps-footer .maths-error { margin: 0; }
.ps-footer .button { min-height: 34px; }
.ps-confirm { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; margin-bottom: 10px; padding: 10px 12px; border: 1px solid #d3dfc9; border-radius: 10px; background: var(--paper); }
.ps-confirm[hidden] { display: none; }
.ps-compare { display: flex; align-items: center; gap: 8px; color: #8a9680; }
.ps-compare figure { display: grid; gap: 3px; margin: 0; }
.ps-compare canvas { width: 72px; height: 72px; border: 1px solid #dce4d5; border-radius: 6px; image-rendering: pixelated; object-fit: contain; background: #f3f5ef; }
.ps-compare figcaption { color: #8a9680; font-size: 9px; font-weight: 700; letter-spacing: .08em; text-align: center; text-transform: uppercase; }
.ps-confirm-text { margin: 0; color: #52664d; font-size: 11px; line-height: 1.6; }
.ps-confirm-actions { display: flex; gap: 8px; }

.ps-menu-head { display: flex; align-items: center; gap: 8px; padding: 5px 10px 7px; color: #6c7865; font-size: 11px; font-variant-numeric: tabular-nums; }
.ps-menu-head .ps-chip { width: 16px; height: 16px; border-radius: 4px; }

@media (max-width: 860px) {
  .ps-split, .ps-split.presets { grid-template-columns: minmax(0, 1fr); }
  .ps-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ps-row { grid-template-columns: 96px minmax(0, 1fr); }
  .ps-confirm { grid-template-columns: minmax(0, 1fr); }
  .ps-footer-row { flex-wrap: wrap; }
}
