:root{
  --qdw-border:#e7e7e7;
  --qdw-text:#1f2937;
  --qdw-muted:#6b7280;
  --qdw-bg:#ffffff;
  --qdw-shadow:0 20px 50px rgba(0,0,0,.18);
  --qdw-radius:14px;
  --qdw-primary:#6d28d9;
}

/* BOTÃO ABRIR */
.qdw-pantonec-open {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    border: 2px solid var(--qdw-border);
    background: #4c0047;
    padding: 12px 18px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 800;
    color: #fff;
}
.qdw-pantonec-open:hover{ border-color:#cfcfcf; }

.qdw-pantonec-wrap{ margin:14px 0; }

/* SELECIONADAS */
.qdw-pantonec-selected{
  margin-top:12px;
  border:1px solid var(--qdw-border);
  border-radius:14px;
  padding:12px;
  background:#fafafa;
}
.qdw-pantonec-selected-head{ display:flex; flex-direction:column; gap:2px; margin-bottom:10px; }
.qdw-pantonec-selected-sub{ color:var(--qdw-muted); font-size:12px; }
.qdw-pantonec-selected-empty{ color:var(--qdw-muted); font-size:13px; padding:10px; }

.qdw-pantonec-selected-group{
  font-weight:900;
  margin: 12px 6px 8px;
  color:#111;
  font-size:13px;
}

.qdw-pantonec-selected-row{
  display:flex;
  gap:12px;
  padding:10px;
  border-radius:12px;
  background:#fff;
  border:1px solid var(--qdw-border);
  margin-bottom:10px;
}
.qdw-pantonec-selected-swatch{ display:flex; align-items:center; gap:10px; min-width:70px; }
.qdw-pantonec-selected-chip{
  width:34px; height:34px; border-radius:10px; border:1px solid rgba(0,0,0,.08);
}
.qdw-pantonec-selected-4holes{
  width:34px; height:34px; border-radius:999px; border:1px solid rgba(0,0,0,.10);
  position:relative;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.25);
  overflow:hidden; /* evita “estourar” */
}
.qdw-pantonec-selected-4holes::before{
  content:"";
  position:absolute;
  inset:0;
  background:
    radial-gradient(circle at 25% 25%, rgba(255,255,255,.98) 0 18%, transparent 19%),
    radial-gradient(circle at 75% 25%, rgba(255,255,255,.98) 0 18%, transparent 19%),
    radial-gradient(circle at 25% 75%, rgba(255,255,255,.98) 0 18%, transparent 19%),
    radial-gradient(circle at 75% 75%, rgba(255,255,255,.98) 0 18%, transparent 19%);
  opacity:.95;
}

.qdw-pantonec-selected-meta{ flex:1; min-width:0; }
.qdw-pantonec-selected-name{ font-weight:900; color:var(--qdw-text); }
.qdw-pantonec-selected-code{ font-weight:600; color:var(--qdw-muted); margin-left:6px; }
.qdw-pantonec-selected-controls{ display:flex; flex-wrap:wrap; gap:10px; margin-top:6px; align-items:center; }
.qdw-pantonec-selected-controls label{ font-size:13px; color:var(--qdw-text); display:flex; gap:8px; align-items:center; }
.qdw-pantonec-selected-controls select{ padding:6px 8px; border-radius:10px; border:1px solid var(--qdw-border); background:#fff; }
.qdw-pantonec-remove{
background: #ff0000;
    border: 1px solid var(--qdw-border);
    padding: 6px 10px;
    border-radius: 10px;
    cursor: pointer!important;
    color: #ffffff;
}
.qdw-pantonec-remove:hover{ border-color:#cfcfcf; }

/* MODAL */
.qdw-pantonec-modal{ display:none; position:fixed; inset:0; z-index:99999; }
.qdw-pantonec-modal.is-open{ display:block; }
.qdw-pantonec-backdrop{ position:absolute; inset:0; background:rgba(0,0,0,.55); }

.qdw-pantonec-panel{
  position:relative;
  width:min(980px, calc(100vw - 24px));
  max-height:calc(100vh - 24px);
  margin:12px auto;
  background:#fff;
  border-radius:18px;
  box-shadow:var(--qdw-shadow);
  overflow:hidden;
}
.qdw-pantonec-head{
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 18px;
  border-bottom:1px solid var(--qdw-border);
}
.qdw-pantonec-title{ font-size:18px; font-weight:900; color:var(--qdw-text); }

.qdw-pantonec-close{
  width:38px; height:38px; border-radius:12px;
  border:1px solid #ff3b5c;
  background:#fff;
  color:#ff3b5c;
  font-size:22px;
  line-height:1;
  cursor:pointer;
}

.qdw-pantonec-search{ padding:14px 18px; border-bottom:1px solid var(--qdw-border); }
.qdw-pantonec-search input{
  width:100%;
  padding:12px 14px;
  border:2px solid #111;
  border-radius:10px;
  outline:none;
}

.qdw-pantonec-body{
  display:grid;
  grid-template-columns: 1fr 360px;
  gap:14px;
  padding:14px 18px 18px;
}

.qdw-pantonec-left{
  display:flex;
  flex-direction:column;
  gap:12px;
  min-width:0;
}

/* GRUPOS (abas) */
.qdw-pantonec-groups{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  padding:10px;
  border:1px solid var(--qdw-border);
  border-radius:14px;
  background:#fff;
}
.qdw-pantonec-group{
  appearance:none;
  -webkit-appearance:none;
  border:1px solid var(--qdw-border);
  background:#fff;
  border-radius:10px;
  padding:8px 12px;
  font-weight:800;
  cursor:pointer;
}
.qdw-pantonec-group.is-active{
  border-color:#111;
  box-shadow:0 0 0 2px rgba(0,0,0,.10);
}

/* LISTA EM GRADE */
.qdw-pantonec-list{
  border:1px solid var(--qdw-border);
  border-radius:14px;
  overflow:auto;
  max-height:520px;
  background:#fafafa;

  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap:14px;
  padding:14px;
  align-content:start;
}

/* TILE (RESET TOTAL DO BUTTON) */
.qdw-pantonec-item{
  appearance:none !important;
  -webkit-appearance:none !important;

  box-sizing:border-box !important;
  border:2px solid #ff3b8b !important;
  background:var(--swatch, #fff) !important;

  border-radius:16px !important;
  height:120px !important;
  padding:10px !important;
  margin:0 !important;

  display:flex !important;
  align-items:flex-end !important;
  justify-content:flex-start !important;

  cursor:pointer !important;
  overflow:hidden !important;

  text-align:left !important;
  line-height:1.1 !important;

  /* sem hover “levantando” */
  transform:none !important;
  box-shadow:none !important;
  transition:none !important;
}
.qdw-pantonec-item:hover{
  background:var(--swatch, #fff) !important;
  transform:none !important;
  box-shadow:none !important;
}
.qdw-pantonec-item.is-active{
  border-color:#111 !important;
  box-shadow:0 0 0 2px rgba(0,0,0,.15) !important;
}

/* LABEL */
.qdw-pantonec-tile-label{
  width:100%;
  padding:8px 10px;
  border-radius:14px;
  background: rgba(255,255,255,.82);
  border:1px solid rgba(0,0,0,.08);
  backdrop-filter: blur(2px);
}
.qdw-pantonec-tile-name{
  display:block;
  font-weight:900;
  font-size:13px;
  color:#111;
}
.qdw-pantonec-tile-code{
  display:block;
  margin-top:3px;
  font-size:11px;
  color: rgba(0,0,0,.65);
}

/* CHIP 4 FUROS (decorativo no canto) */
.qdw-pantonec-chip{
  position:absolute;
  top:10px;
  right:10px;
  width:30px;
  height:30px;
  border-radius:999px;
  border:1px solid rgba(0,0,0,.18);
  background: rgba(255,255,255,.55);
  box-shadow:
    inset 0 2px 4px rgba(255,255,255,.35),
    inset 0 -2px 4px rgba(0,0,0,.12),
    0 4px 10px rgba(0,0,0,.08);
  overflow:hidden; /* impede “furos” estourarem */
}
.qdw-pantonec-chip::before{
  content:"";
  position:absolute;
  inset:0;
  background:
    radial-gradient(circle at 28% 28%, #fff 0 14%, transparent 15%),
    radial-gradient(circle at 72% 28%, #fff 0 14%, transparent 15%),
    radial-gradient(circle at 28% 72%, #fff 0 14%, transparent 15%),
    radial-gradient(circle at 72% 72%, #fff 0 14%, transparent 15%);
  opacity:.95;
}

/* TOOLTIP (hover só mostra tooltip; sem alterar cor) */
.qdw-pantonec-item::after{
  content: attr(data-tip);
  position:absolute;
  left:10px;
  right:10px;
  top:10px;
  padding:8px 10px;
  border-radius:12px;
  background: rgba(17,17,17,.88);
  color:#fff;
  font-size:12px;
  line-height:1.2;
  opacity:0;
  transform: translateY(-4px);
  transition:.15s ease;
  pointer-events:none;
}
.qdw-pantonec-item:hover::after{
  opacity:1;
  transform: translateY(0);
}

/* PREVIEW DIREITA */
.qdw-pantonec-preview-card{
  border:1px solid var(--qdw-border);
  border-radius:14px;
  overflow:hidden;
  background:#fff;
}
.qdw-pantonec-swatch{
  height:200px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:#fff;
  border-bottom:1px solid var(--qdw-border);
  position:relative;
}

.qdw-pantonec-4holes{
  width:110px;
  height:110px;
  border-radius:999px;
  border:1px solid rgba(0,0,0,.18);
  overflow:hidden; /* essencial */
  box-shadow:
    inset 0 3px 6px rgba(255,255,255,.4),
    inset 0 -4px 6px rgba(0,0,0,.2),
    0 12px 24px rgba(0,0,0,.18);
}
.qdw-pantonec-4holes::before{
  content:"";
  position:absolute;
  inset:0;
  background:
    radial-gradient(circle at 25% 25%, rgba(255,255,255,.98) 0 18%, transparent 19%),
    radial-gradient(circle at 75% 25%, rgba(255,255,255,.98) 0 18%, transparent 19%),
    radial-gradient(circle at 25% 75%, rgba(255,255,255,.98) 0 18%, transparent 19%),
    radial-gradient(circle at 75% 75%, rgba(255,255,255,.98) 0 18%, transparent 19%);
  opacity:.95;
}

.qdw-pantonec-preview-meta{ padding:12px; }
.qdw-pantonec-preview-name{ font-weight:900; color:var(--qdw-text); font-size:16px; margin-bottom:4px; }
.qdw-pantonec-preview-code{ color:var(--qdw-muted); font-size:12px; }
.qdw-pantonec-actions{ display:flex; gap:10px; margin-top:12px; flex-wrap:wrap; }

.qdw-pantonec-btn{
  border:1px solid var(--qdw-border);
  background:#fff;
  border-radius:12px;
  padding:10px 12px;
  cursor:pointer;
  font-weight:800;
}
.qdw-pantonec-btn-primary{
  border-color:rgba(255,59,139,.55);
  background:rgba(255,59,139,.08);
  color:#c2185b;
}
.qdw-pantonec-btn:disabled{ opacity:.45; cursor:not-allowed; }

.qdw-pantonec-hint{
  margin-top:10px;
  color:var(--qdw-muted);
  font-size:12px;
  line-height:1.4;
}

.qdw-pantonec-empty{
  color:var(--qdw-muted);
  padding:12px;
}

/* RESPONSIVO */
@media (max-width: 860px){
  .qdw-pantonec-body{ grid-template-columns: 1fr; }
  .qdw-pantonec-panel{ width:calc(100vw - 16px); margin:8px auto; }
  .qdw-pantonec-list{ max-height:340px; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap:10px; }
  .qdw-pantonec-item{ height:105px !important; }
  .qdw-pantonec-swatch{ height:160px; }
}

/* =========================================
   FIX PREVIEW DIREITA (BOTÃO 4 FUROS)
   - impede vazamento
   - furos no tamanho correto
   - layout mais limpo
========================================= */

/* a área da amostra precisa cortar tudo que sair pra fora */
.qdw-pantonec-swatch{
  overflow: hidden !important;
  border-radius: 14px !important;
  position: relative !important;
}

/* botão central (o "4 furos") */
.qdw-pantonec-4holes{
  width: 120px !important;
  height: 120px !important;
  border-radius: 999px !important;
  position: relative !important;
  overflow: hidden !important; /* corta os furos dentro do botão */
  border: 1px solid rgba(0,0,0,.16) !important;

  /* botão com volume suave */
  box-shadow:
    inset 0 3px 7px rgba(255,255,255,.45),
    inset 0 -6px 10px rgba(0,0,0,.18),
    0 14px 28px rgba(0,0,0,.14) !important;
}

/* 4 furos (AGORA dentro do botão, sem estourar) */
.qdw-pantonec-4holes::before{
  content:"";
  position:absolute;
  inset:0;
  background:
    radial-gradient(circle at 32% 32%, rgba(255,255,255,.96) 0 14%, transparent 15%),
    radial-gradient(circle at 68% 32%, rgba(255,255,255,.96) 0 14%, transparent 15%),
    radial-gradient(circle at 32% 68%, rgba(255,255,255,.96) 0 14%, transparent 15%),
    radial-gradient(circle at 68% 68%, rgba(255,255,255,.96) 0 14%, transparent 15%);
  opacity:.95;
  pointer-events:none;
}

/* miolo do botão (bem discreto) */
.qdw-pantonec-4holes::after{
  content:"";
  position:absolute;
  left:50%;
  top:50%;
  width: 46px;
  height: 46px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: rgba(255,255,255,.18);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.10);
  pointer-events:none;
}

/* botões do card (lado direito) mais “redondos” e alinhados */
.qdw-pantonec-actions{
  gap: 12px !important;
}

.qdw-pantonec-actions .qdw-pantonec-btn{
  border-radius: 12px !important;
  padding: 10px 16px !important;
  min-height: 42px;
}
@media (max-width: 860px){
  .qdw-pantonec-4holes{
    width: 96px !important;
    height: 96px !important;
  }
}
/* some o mini "chip" que está vazando nos cards da grade */
.qdw-pantonec-list .qdw-pantonec-chip{
  display: none !important;
}
/* prende o chip dentro do card */
.qdw-pantonec-item{
  position: relative !important;
  overflow: hidden !important;
}

.qdw-pantonec-chip{
  position: absolute !important;
  top: 10px !important;
  right: 10px !important;
  z-index: 2 !important;
}

#qdwPantoneModal.is-open{
  position: fixed !important;
  inset: 0 !important;
  z-index: 999999 !important;
  pointer-events: auto !important;
}
#qdwPantoneModal.is-open *{
  pointer-events: auto !important;
}
/* Garantia: modal fechado não bloqueia cliques */
#qdwPantoneModal[aria-hidden="true"],
#qdwPantoneModal[aria-hidden="true"] * {
  pointer-events: none !important;
}

#qdwPantoneModal[aria-hidden="true"] {
  display: none !important;
}

/* Quando abre, volta a funcionar */
#qdwPantoneModal.is-open {
  display: block !important;
  pointer-events: auto !important;
}
#qdwPantoneModal.is-open * {
  pointer-events: auto !important;
}
/* Se existir apenas 1 grupo (ex: Geral), esconda a faixa de grupos */
#qdwPantoneGroups:has(.qdw-pantonec-group:only-child) {
  display: none !important;
}

/* Modal ocupa quase tela toda no mobile */
@media (max-width: 768px) {
  .qdw-pantonec-panel{
    height: min(92vh, 760px);
    max-height: 92vh;
    width: calc(100vw - 24px);
    border-radius: 16px;
    overflow: hidden;
  }

  /* Header mais compacto */
  .qdw-pantonec-head{
    padding: 12px 14px;
  }
  .qdw-pantonec-title{
    font-size: 16px;
    line-height: 1.2;
  }
  .qdw-pantonec-close{
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  /* Busca mais compacta */
  .qdw-pantonec-search{
    padding: 10px 14px;
  }
  #qdwPantoneSearch{
    height: 40px;
    border-radius: 12px;
  }

  /* Corpo vira layout vertical e a lista domina a tela */
  .qdw-pantonec-body{
    display: flex;
    flex-direction: column;
    height: calc(92vh - 54px - 60px); /* header + search (aprox) */
    padding: 0 14px 14px;
    gap: 10px;
  }

  .qdw-pantonec-left{
    flex: 1 1 auto;
    min-height: 0; /* importante pro scroll funcionar */
  }

  /* Lista ocupa tudo que sobrar e scrolla */
  #qdwPantoneList{
    height: 100%;
    max-height: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 14px;
  }

  /* Preview pode virar “compacto” no mobile (opcional) */
  .qdw-pantonec-preview{
    display: none; /* ganha espaço. Se quiser manter, comento abaixo como */
  }
}

.qdw-pantonec-selected-row--visual .qdw-pantonec-selected-meta{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}

.qdw-pantonec-selected-controls--visual{
  margin-top:0;
  justify-content:flex-end;
}

.qdw-pantonec-selected-row--visual .qdw-pantonec-remove{
  min-width:96px;
}

@media (max-width: 768px){
  .qdw-pantonec-selected-row--visual .qdw-pantonec-selected-meta{
    display:block;
  }

  .qdw-pantonec-selected-controls--visual{
    margin-top:8px;
    justify-content:flex-start;
  }
}

.qdw-pantonec-item {
  background: var(--pantone-color, #f3f3f3) !important;
  border: 2px solid #ff4f93;
  border-radius: 18px;
  min-height: 118px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.qdw-pantonec-item-top {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  min-height: 28px;
  margin-bottom: 8px;
}

.qdw-pantonec-mini-select {
  border: 1px solid #ff4f93;
  background: rgba(255,255,255,.92);
  color: #ff4f93;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
  cursor: pointer;
  width: auto;
  min-width: 0;
  white-space: nowrap;
}

.qdw-pantonec-mini-select:hover {
  background: #ff4f93;
  color: #fff;
}

.qdw-pantonec-item.is-active {
  box-shadow: 0 0 0 3px #222 inset;
}

.qdw-pantonec-tile-label {
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 14px;
  padding: 10px 12px;
  display: block;
  text-align: left;
}

.qdw-pantonec-tile-name {
  display: block;
  font-weight: 700;
  color: #222;
  line-height: 1.05;
  word-break: break-word;
}

.qdw-pantonec-tile-code {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #666;
}