/* Seção de Personalização de cores — compatível com a tela de Estilo existente. */
.dpw-card,
.dpw-modal {
  --dpw-ink: #24212d;
  --dpw-muted: #767282;
  --dpw-line: #e8e5ed;
  --dpw-purple: #7650bf;
  color: var(--dpw-ink);
  font-family: inherit;
}

.dpw-card {
  margin: 18px 0 22px;
}

.dpw-panel {
  box-sizing: border-box;
  width: 100%;
  padding: 22px;
  border: 1px solid var(--dpw-line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(37, 31, 53, .07);
}

.dpw-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.dpw-eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--dpw-purple);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
}

.dpw-header h2 {
  margin: 0;
  color: var(--dpw-ink);
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -.025em;
}

.dpw-header p {
  max-width: 720px;
  margin: 6px 0 0;
  color: var(--dpw-muted);
  font-size: 13px;
  line-height: 1.5;
}

.dpw-close {
  display: none;
  width: 34px;
  height: 34px;
  border: 1px solid var(--dpw-line);
  border-radius: 10px;
  background: #fff;
  color: #555161;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.dpw-layout {
  display: grid;
  grid-template-columns: minmax(230px, .9fr) minmax(0, 1.5fr);
  gap: 24px;
  align-items: center;
}

.dpw-wheel-column {
  display: grid;
  justify-items: center;
  gap: 13px;
}

.dpw-wheel {
  position: relative;
  width: min(260px, 65vw);
  aspect-ratio: 1;
  border: 1px solid rgba(25, 20, 32, .12);
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(255,255,255,.96) 0%, rgba(255,255,255,.42) 28%, rgba(255,255,255,0) 76%),
    conic-gradient(from 90deg, #ff0000 0deg, #ffff00 60deg, #00ff00 120deg, #00ffff 180deg, #0000ff 240deg, #ff00ff 300deg, #ff0000 360deg);
  box-shadow: 0 9px 25px rgba(44, 34, 65, .14), inset 0 0 0 1px rgba(255,255,255,.72);
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

.dpw-wheel:focus-visible {
  outline: 3px solid rgba(118, 80, 191, .28);
  outline-offset: 4px;
}

.dpw-wheel-marker {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 17px;
  height: 17px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--dpw-current-color, #b58c1c);
  box-shadow: 0 1px 5px rgba(0,0,0,.42);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.dpw-lightness-label {
  display: flex;
  width: min(260px, 65vw);
  align-items: center;
  justify-content: space-between;
  color: #555161;
  font-size: 12px;
  font-weight: 650;
}

.dpw-lightness-label output {
  color: var(--dpw-muted);
  font-variant-numeric: tabular-nums;
}

.dpw-range {
  width: min(260px, 65vw);
  height: 6px;
  accent-color: var(--dpw-purple);
  cursor: pointer;
}

.dpw-options {
  display: grid;
  gap: 15px;
  min-width: 0;
}

.dpw-field > label,
.dpw-presets > span {
  display: block;
  margin-bottom: 7px;
  color: #4d4958;
  font-size: 12px;
  font-weight: 700;
}

.dpw-color-inputs {
  display: flex;
  max-width: 330px;
  align-items: center;
  gap: 9px;
}

.dpw-color-inputs input[type="color"],
.dpw-swatch input[type="color"] {
  width: 40px;
  height: 38px;
  padding: 3px;
  border: 1px solid var(--dpw-line);
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
}

.dpw-color-inputs input[type="text"] {
  width: 132px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--dpw-line);
  border-radius: 9px;
  background: #fff;
  color: #312d3b;
  font: 600 12px ui-monospace, SFMono-Regular, Menlo, monospace;
}

.dpw-field select {
  width: min(100%, 330px);
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--dpw-line);
  border-radius: 9px;
  background: #fff;
  color: #383443;
  font: inherit;
  font-size: 12px;
}

.dpw-presets > div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.dpw-preset {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--dpw-line);
  border-radius: 999px;
  background: #fff;
  color: #514d5b;
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.dpw-preset:hover,
.dpw-preset.is-selected {
  border-color: var(--dpw-purple);
  box-shadow: 0 0 0 3px rgba(118, 80, 191, .1);
  transform: translateY(-1px);
}

.dpw-preset i {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--preset-color);
}

.dpw-palette-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
  color: #4d4958;
  font-size: 12px;
}

.dpw-palette-heading span {
  color: var(--dpw-muted);
  font-size: 10px;
}

.dpw-swatches {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.dpw-swatch {
  display: flex;
  min-width: 0;
  min-height: 54px;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border: 1px solid var(--dpw-line);
  border-radius: 10px;
  background: #fff;
}

.dpw-swatch-chip {
  width: 33px;
  height: 36px;
  flex: 0 0 33px;
  border: 1px solid rgba(30, 25, 40, .1);
  border-radius: 7px;
}

.dpw-swatch > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 3px;
  flex: 1;
}

.dpw-swatch b {
  overflow: hidden;
  color: #555161;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dpw-swatch code {
  color: #8c8794;
  font: 10px ui-monospace, SFMono-Regular, Menlo, monospace;
}

.dpw-swatch input[type="color"] {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  padding: 2px;
  border-radius: 50%;
}

.dpw-preview {
  display: grid;
  grid-template-columns: minmax(130px, .38fr) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-top: 19px;
  padding: 12px;
  border: 1px solid #ece9f0;
  border-radius: 12px;
  background: #faf9fc;
}

.dpw-preview-copy {
  display: grid;
  gap: 4px;
}

.dpw-preview-copy .dpw-eyebrow {
  margin: 0;
  font-size: 9px;
}

.dpw-preview-copy strong {
  color: #35313f;
  font-size: 13px;
}

.dpw-preview-copy small {
  color: var(--dpw-muted);
  font-size: 10px;
  line-height: 1.4;
}

.dpw-preview-surface {
  min-height: 95px;
  padding: 10px 12px;
  border: 1px solid rgba(41, 33, 57, .08);
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.55);
}

.dpw-preview-title {
  color: #403a4b;
  font-size: 10px;
  font-weight: 700;
}

.dpw-preview-bars {
  display: flex;
  height: 49px;
  align-items: end;
  gap: 7px;
  margin-top: 7px;
  border-bottom: 1px solid rgba(75, 65, 91, .18);
}

.dpw-preview-bars i {
  width: 10%;
  min-height: 12px;
  border-radius: 4px 4px 0 0;
}

.dpw-preview-legend {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  color: #6f697a;
  font-size: 8px;
}

.dpw-preview-legend b:first-child::before,
.dpw-preview-legend b:last-child::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--dpw-chart-primary, #b58c1c);
  content: "";
}

.dpw-preview-legend b:last-child::before {
  background: var(--dpw-chart-secondary, #8b5cf6);
}

.dpw-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 17px;
  padding-top: 13px;
  border-top: 1px solid #efedf2;
}

.dpw-status {
  color: #777282;
  font-size: 11px;
  line-height: 1.4;
}

.dpw-footer > div {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.dpw-reset,
.dpw-save {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid #e6e2eb;
  border-radius: 9px;
  background: #fff;
  color: #555161;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.dpw-save {
  border-color: #7650bf;
  background: linear-gradient(135deg, #8c46d2, #c13ca4);
  color: #fff;
  box-shadow: 0 5px 13px rgba(118, 80, 191, .2);
}

.dpw-save:disabled {
  cursor: wait;
  opacity: .66;
}

.dpw-save.is-saved {
  border-color: #15966f;
  background: #15966f;
}

/* A prévia isolada compartilha a mesma roda e mostra o efeito das cores no shell. */
.dpw-open-button {
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 999px;
  padding: 7px 11px;
  background: rgba(255,255,255,.18);
  color: #fff;
  font: inherit;
  font-size: 10px;
  font-weight: 750;
  cursor: pointer;
}

.dpw-open-button:hover {
  background: #fff;
  color: #52276e;
}

.dpw-modal {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 20px;
  background: rgba(18, 14, 27, .58);
  backdrop-filter: blur(5px);
}

.dpw-modal.is-open {
  display: flex;
}

.dpw-modal .dpw-panel {
  width: min(980px, 100%);
  max-height: min(94vh, 900px);
  overflow: auto;
  padding: 24px;
  box-shadow: 0 28px 90px rgba(0,0,0,.28);
}

.dpw-modal .dpw-close {
  display: inline-grid;
  place-items: center;
}

body.dpw-preview-mode {
  background:
    radial-gradient(ellipse at 5% 10%, color-mix(in srgb, var(--dp-dashboard-bg-start, #f6f2e8) 72%, var(--dp-dashboard-chart-primary, #b58c1c)) 0%, transparent 40%),
    radial-gradient(ellipse at 95% 90%, color-mix(in srgb, var(--dp-dashboard-bg-end, #fffdf8) 60%, var(--dp-dashboard-chart-secondary, #8b5cf6)) 0%, transparent 42%),
    linear-gradient(125deg, color-mix(in srgb, var(--dp-dashboard-chart-primary, #b58c1c) 56%, #281c39), var(--dp-dashboard-chart-secondary, #8b5cf6));
}

body.dpw-preview-mode .shell:not(.theme-gold) .sidebar {
  background: linear-gradient(180deg, var(--dp-dashboard-chart-primary, #b58c1c), var(--dp-dashboard-chart-secondary, #8b5cf6)) !important;
}

body.dpw-preview-mode .shell.theme-gold .sidebar {
  background: linear-gradient(180deg, #24252b, #17191f) !important;
}

body.dpw-preview-mode .content {
  background: linear-gradient(135deg, color-mix(in srgb, var(--dp-dashboard-bg-start, #f6f2e8) 64%, #fff), color-mix(in srgb, var(--dp-dashboard-bg-end, #fffdf8) 64%, #fff));
}

body.dpw-preview-mode .bars i,
body.dpw-preview-mode .bar i {
  background: linear-gradient(180deg, var(--dp-dashboard-chart-secondary, #8b5cf6), var(--dp-dashboard-chart-primary, #b58c1c)) !important;
}

body.dpw-preview-mode .lines i {
  color: var(--dp-dashboard-chart-primary, #b58c1c) !important;
}

body.dpw-preview-mode .brand {
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #c6a04a;
  background: #17191f;
}

body.dpw-preview-mode .brand img {
  width: 31px;
  height: 34px;
  object-fit: contain;
}

body.dpw-preview-mode .crest {
  display: grid;
  width: 76px;
  height: 88px;
  place-items: center;
  overflow: hidden;
  border: 2px solid #c6a04a;
  border-radius: 24px 24px 35px 35px;
  background: #17191f;
  color: transparent !important;
}

body.dpw-preview-mode .crest img {
  width: 65px;
  height: 76px;
  object-fit: contain;
}

@media (max-width: 760px) {
  .dpw-panel {
    padding: 16px;
  }

  .dpw-layout {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .dpw-wheel {
    width: min(220px, 62vw);
  }

  .dpw-lightness-label,
  .dpw-range {
    width: min(260px, 74vw);
  }

  .dpw-swatches {
    grid-template-columns: 1fr 1fr;
  }

  .dpw-preview {
    grid-template-columns: 1fr;
  }

  .dpw-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .dpw-footer > div {
    width: 100%;
  }

  .dpw-footer button {
    flex: 1;
  }

  .dpw-modal {
    align-items: flex-start;
    padding: 9px;
  }

  .dpw-modal .dpw-panel {
    max-height: calc(100vh - 18px);
    padding: 15px;
  }
}

@media (max-width: 400px) {
  .dpw-swatches {
    grid-template-columns: 1fr;
  }

  .dpw-header h2 {
    font-size: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dpw-preset {
    transition: none;
  }
}
