:is(#custom-fill, #sh-custom-fill) {
  grid-column: 1 / -1;
  margin-top: 5px;
  min-width: 0;
}

:is(#custom-fill, #sh-custom-fill) .fp-trigger {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 6px;
  min-height: 31px;
  padding: 4px 6px;
  border: 1px solid #d4dcd6;
  border-radius: 5px;
  color: #30433b;
  background-color: #fff;
  font-family: inherit;
  font-weight: 500;
  font-size: 12px;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
}
:is(#custom-fill, #sh-custom-fill) .fp-trigger:hover { background: #f4f7f4; }
.fp-current-chip {
  width: 16px;
  height: 16px;
  flex: none;
  background-color: var(--fp-chip-light);
  border: 1px solid #20272740;
  border-radius: 4px;
}
.fp-current-code {
  margin-inline-start: auto;
  color: #505e57;
  font: 10px/1.2 ui-monospace, Consolas, monospace;
}

.fp-dialog {
  box-sizing: border-box;
  width: min(280px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 16px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid #cbd4cd;
  border-radius: 12px;
  background: #fff;
  color: #202727;
  box-shadow: 0 10px 40px #14271d20;
  font: inherit;
}
.fp-dialog::backdrop { background: #1d2b2524; }
.fp-dialog form { display: grid; gap: 13px; margin: 0; }
.fp-dialog header, .fp-dialog footer { display: flex; align-items: center; }
.fp-dialog header { justify-content: space-between; gap: 10px; }
.fp-dialog h2 { margin: 0; font-size: 16px; line-height: 1.3; font-weight: 620; letter-spacing: -.025em; }
.fp-dialog button { font-family: inherit; cursor: pointer; }
.fp-dialog .fp-close {
  width: 28px;
  height: 28px;
  padding: 0;
  color: #4f5c56;
  background: transparent;
  border: 0;
  border-radius: 4px;
  font: 22px/1 sans-serif;
}
.fp-dialog .fp-close:hover, .fp-dialog .fp-cancel:hover { background: #f0f4f0; }
.fp-palette { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.fp-palette button {
  position: relative;
  min-width: 0;
  height: 26px;
  padding: 0;
  border: 1px solid #24382d2a;
  border-radius: 4px;
}
.fp-palette button[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  left: calc(50% - 5px);
  top: calc(50% - 5px);
  width: 8px;
  height: 4px;
  border: solid currentColor;
  border-width: 0 0 2px 2px;
  transform: rotate(-45deg);
}
.fp-fields { display: grid; grid-template-columns: 74px minmax(0,1fr); align-items: end; gap: 9px; }
.fp-fields label { margin: 0; color: #47554d; font-size: 12px; font-weight: 560; line-height: 1.35; }
.fp-fields input {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 33px;
  margin: 4px 0 0;
  padding: 0 8px;
  color: #202727;
  background: #fff;
  border: 1px solid #afbab2;
  border-radius: 5px;
}
.fp-fields input[type="color"] { padding: 3px; cursor: pointer; }
.fp-fields input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.fp-fields input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 2px; }
.fp-fields input[type="color"]::-moz-color-swatch { border: 0; border-radius: 2px; }
.fp-fields .fp-hex { font: 13px/1 ui-monospace, Consolas, monospace; letter-spacing: .025em; }
.fp-fields input[aria-invalid="true"] { border-color: #a54340; }
.fp-preview {
  display: grid;
  place-items: center;
  min-height: 38px;
  border: 1px solid #24382d26;
  border-radius: 5px;
  background: #f4f5f3;
  color: #566159;
  font: 600 12px/1.2 ui-monospace, Consolas, monospace;
}
.fp-feedback { margin-top: -6px; font-size: 12px; line-height: 1.4; color: #963b38; }
.fp-dialog footer { justify-content: flex-end; gap: 7px; }
.fp-dialog footer button {
  min-height: 32px;
  padding: 4px 13px;
  border: 1px solid #c9d2cb;
  border-radius: 5px;
  color: #34473d;
  background: #fff;
  font-size: 12px;
  font-weight: 560;
}
.fp-dialog .fp-apply { color: #fff; border-color: #176758; background: #176758; }
.fp-dialog .fp-apply:hover:enabled { background: #105548; }
.fp-dialog .fp-apply:disabled { opacity: .45; cursor: default; }
.fp-dialog :is(button, input):focus-visible, :is(#custom-fill, #sh-custom-fill) .fp-trigger:focus-visible {
  outline: 2px solid #176758;
  outline-offset: 2px;
}
@media (pointer: coarse) {
  .fp-palette button { height: 32px; }
  .fp-fields input, .fp-dialog footer button { min-height: 38px; }
}

html[data-theme="dark"] :is(#custom-fill, #sh-custom-fill) .fp-trigger {
  color: var(--theme-text); background: var(--theme-panel); border-color: var(--theme-line);
  &:hover { background: var(--theme-raised); }
  &:focus-visible { outline-color: var(--theme-accent); }
  & .fp-current-code { color: var(--theme-muted); }
  & .fp-current-chip { background-color: var(--fp-chip-dark); border-color: #83928e; }
}
html[data-theme="dark"] .fp-dialog {
  color: var(--theme-text); background: var(--theme-panel); border-color: var(--theme-line);
  box-shadow: 0 10px 32px #0005;
  &::backdrop { background: #050a0eaa; }
  & :is(.fp-close, .fp-fields label) { color: var(--theme-muted); }
  & :is(.fp-close,.fp-cancel):hover { background: var(--theme-raised); }
  & :is(.fp-preview,.fp-palette button) { border-color: #879590; }
  & .fp-fields input { color: var(--theme-text); background: var(--theme-bg); border-color: #829094; }
  & .fp-fields input[aria-invalid="true"] { border-color: #ffada5; }
  & .fp-feedback { color: #ffada5; }
  & .fp-preview { color: var(--theme-muted); background-color: var(--theme-raised); }
  & .fp-cancel { background: var(--theme-panel); border-color: var(--theme-line); color: var(--theme-text); }
  & .fp-apply { background: var(--theme-accent); border-color: var(--theme-accent); color: #102c25; }
  & .fp-apply:hover:enabled { background: #a1e7d4; }
  & :is(button,input):focus-visible { outline-color: var(--theme-accent); }
}
