.legend { position: relative; }
.palette-popover { position: absolute; z-index: 20; top: calc(100% + 15px); right: 0; width: min(360px, calc(100vw - 36px)); color: var(--ink); border: 1px solid #c9beb1; border-radius: 16px; background: #fff; box-shadow: 0 24px 70px rgba(45,32,20,.24); overflow: hidden; text-align: left; }
.palette-popover::before { content: ""; position: absolute; right: 28px; top: -7px; width: 13px; height: 13px; background: #fff; border-left: 1px solid #c9beb1; border-top: 1px solid #c9beb1; transform: rotate(45deg); }
.palette-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 18px 18px 14px; border-bottom: 1px solid #eee7df; }
.palette-head strong, .palette-label { display: block; }
.palette-label { margin-bottom: 3px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.palette-close { position: relative; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: #f3ede6; color: var(--ink); font-size: 21px; line-height: 1; cursor: pointer; }
.palette-body { padding: 16px 18px; }
.spectrum { position: relative; display: flex; align-items: end; width: 100%; height: 82px; padding: 12px; border-radius: 11px; background: linear-gradient(135deg,#fff 0%,transparent 52%),linear-gradient(90deg,#ff6262,#ffe55d,#63dd88,#60bdeb,#b977e9); overflow: hidden; cursor: pointer; }
.native-picker { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.spectrum-copy { position: relative; pointer-events: none; padding: 6px 8px; border-radius: 7px; background: rgba(255,255,255,.86); box-shadow: 0 2px 9px rgba(0,0,0,.1); }
.spectrum-copy small, .spectrum-copy b { display: block; }
.spectrum-copy small { color: var(--muted); font-size: 9px; text-transform: uppercase; }
.spectrum-copy b { font-size: 11px; }
.preset-grid { display: grid; grid-template-columns: repeat(6,1fr); gap: 9px; margin: 15px 0; }
.preset-grid button { aspect-ratio: 1; border: 2px solid white; border-radius: 8px; background: var(--preset); box-shadow: 0 0 0 1px rgba(32,27,24,.2); cursor: pointer; transition: transform .12s; }
.preset-grid button:hover, .preset-grid button:focus { transform: scale(1.12); outline: 2px solid var(--ink); outline-offset: 2px; }
.color-value { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: #faf7f3; }
.preview { width: 25px; height: 25px; flex: none; border: 1px solid #cfc5ba; border-radius: 6px; }
.hex-value { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font: 700 13px ui-monospace,SFMono-Regular,monospace; text-transform: uppercase; }
.palette-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; background: #f7f2ec; border-top: 1px solid #e8dfd5; }
.palette-actions button { border: 0; border-radius: 8px; padding: 9px 13px; font-weight: 800; cursor: pointer; }
.palette-actions .save { background: var(--ink); color: white; }
.palette-actions .cancel { background: #e8e0d7; color: var(--ink); }
@media (max-width: 760px) { .palette-popover { position: fixed; top: 50%; right: auto; left: 50%; transform: translate(-50%,-50%); } .palette-popover::before { display: none; } }
