:root{
  --radius: 14px;
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #101828;
  --muted: #667085;
  --border: #e4e7ec;
  --brand: #046298;
  --brand_02: #009cde;
  --wa: #25d366;
}

*{box-sizing:border-box;}
html,body{height:100%; margin:0; font-family: system-ui,-apple-system,Segoe UI,Roboto,Arial; color:var(--text);} 

/* Layout */
.dc-page{min-height:100%; background:var(--bg); display:flex; align-items:center; justify-content:center; padding:18px;}
.dc-shell{
  width: 420px; max-width: 100%;
  height: min(720px, calc(100vh - 36px));
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 18px 55px rgba(0,0,0,.14);
  overflow:hidden;
  display:flex;
  flex-direction:column;
}

/* Header */
.dc-header{
  background: linear-gradient(135deg, var(--brand), var(--brand_02));
  color:#fff;
  padding: 12px 14px;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 12px;
}
.dc-headerLeft{min-width:0;}
.dc-header .title{font-weight:600; font-size:14px; letter-spacing:.2px; text-transform: uppercase;}
.dc-header .sub{font-weight:400; font-size:12px; opacity:.9;}
.dc-headerRight{display:flex; align-items:center; gap:10px;}

.dc-hbtn{
  width:34px;
  height:34px;
  border-radius:999px;
  border:0;
  cursor:pointer;
  background: rgba(255,255,255,.18);
  color:#fff;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.dc-hbtn:hover{background: rgba(255,255,255,.28);} 
.dc-hbtn:focus{outline: 3px solid rgba(255,255,255,.35); outline-offset: 2px;}
.dc-hicon{width:18px; height:18px; display:block;}

/* Body (mensagens) */
.dc-body{
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 14px;
  display:flex;
  flex-direction:column;
  line-height: 1.4;
  /* 2 camadas: cor + tile */
  background-image:
    linear-gradient(rgba(246,247,249,0.97), rgba(246,247,249,0.97)),
    url("../images/bg.jpg");
  background-repeat: repeat, repeat;
  background-size: auto, 600px 317px;
  background-position: 0 0, top left;
}

/* Spacer opcional para “subir” o conteúdo quando poucas mensagens */
.dc-spacer{flex: 1 0 auto; min-height: 0;}

/* Bolhas */
.dc-bubble{
  width: fit-content;
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 16px;
  margin: 10px 0;
  box-shadow: 0 0px 8px rgba(0,0,0,.10);
  border: 1px solid rgba(16,24,40,.06);
  white-space: normal;
  word-break: break-word;
}
.dc-bubble *{line-height: inherit;}

.dc-bubble.dc-bot{
  align-self:flex-start;
  background: #ffffff;
  color: #000000;
  border-top-left-radius: 2px;
}

.dc-bubble.dc-user{
  align-self:flex-end;
  margin-left:auto;
  background: var(--brand_02);
  color:#ffffff;
  border-top-right-radius: 2px;
  font-weight: 600;
  box-shadow: 0 0px 8px rgba(0,0,0,.20);
}

/* Empilhamento (cantinhos) */
.dc-bubble.dc-stack-prev{margin-top:-5px;}

.dc-bubble.dc-bot.dc-stack-next{border-bottom-left-radius: 2px;}
.dc-bubble.dc-bot.dc-stack-prev{border-top-left-radius: 2px;}

.dc-bubble.dc-user.dc-stack-next{border-bottom-right-radius: 8px;}
.dc-bubble.dc-user.dc-stack-prev{border-top-right-radius: 8px;}

/* Ações (botões sob a bolha) */
.dc-actions{display:flex; flex-wrap:wrap; gap:8px; margin:0 0 4px 0;}

.dc-btn{
  border: 1px solid var(--border);
  background:#fff;
  border-radius: 12px;
  padding: 10px 12px;
  cursor:pointer;
  text-align:left;
  font-weight:700;
  font-size: 14px;
  display:inline-flex;
  align-items:center;
  justify-content:flex-start;
  gap:8px;
  box-shadow: 0 0px 8px rgba(0,0,0,.10);
}
.dc-btn:hover{color:#fff; background: var(--brand_02);} 

/* estado desabilitado (JS desativa após clique) */
.dc-btn:disabled,
.dc-btn[disabled]{
  opacity:.55;
  cursor:not-allowed;
  filter: grayscale(.2);
  box-shadow: none;
}

/* Botão “Voltar ao menu anterior” */
.dc-btn-voltar{
  border: 1px solid #5fc4ff;
  background: #c5eeff;
  border-radius: 12px;
  padding: 10px 12px;
  cursor:pointer;
  text-align:left;
  font-weight:700;
  font-size: 14px;
  color: var(--text);
  display:inline-flex;
  align-items:center;
  gap:8px;
}
.dc-btn-voltar:hover{color:#fff; background: var(--brand);} 

/* Link com cara de botão/bubble */
.dc-link-bubble{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(16,24,40,.08);
  background: #c5eeff;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
}
.dc-link-bubble:hover{color:#fff; background: var(--brand);} 

.dc-link-bubble .dc-link-ico{width:18px; height:18px; flex:0 0 auto;}
.dc-link-bubble .dc-link-ico path{fill: currentColor;}

/* Botão WhatsApp (verde) */
.dc-btn.dc-btn-whats{
  padding: 10px 18px;
  border-radius: 12px;
  border: none;
  background: var(--wa);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 0px 8px rgba(37, 211, 102, 0.40);
  transition: filter .1s ease, transform .1s ease, box-shadow .1s ease;
}
.dc-btn.dc-btn-whats:hover{filter: brightness(1.05); box-shadow: 0 0px 8px rgba(37, 211, 102, 0.45);} 
.dc-btn.dc-btn-whats:active{transform: translateY(0); box-shadow: 0 0px 8px rgba(37, 211, 102, 0.35);} 
.dc-btn.dc-btn-whats .wa-icon{width:18px; height:18px; fill:#ffffff;}

/* Composer */
#dcFooter{
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 10px 14px;
}

.dc-inputrow, .dc-inputRow{display:flex; gap:8px; margin:0;}

.dc-input{
  flex:1;
  border:1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size:14px;
  outline:none;
}
.dc-invalid{border-color:#f04438 !important;}

.dc-send{
  border:0;
  border-radius:12px;
  padding: 0 14px;
  cursor:pointer;
  background: var(--brand_02);
  color:#fff;
  font-weight:800;
}
.dc-send:disabled{opacity:.6; cursor:not-allowed;}

/* Campo desativado (quando há botões ativos) */
.dc-disabled-row{opacity:.65;}
.dc-disabled-row .dc-input{background:#f2f4f7; cursor:not-allowed;}

/* Pills (se usadas) */
.dc-pill{
  font-size:11px;
  font-weight:800;
  color:#fff;
  background: rgba(255,255,255,.22);
  padding: 4px 8px;
  border-radius: 999px;
}

/* Fullscreen (standalone) */
html.dw-fullscreen, body.dw-fullscreen{
  width:100%;
  height:100%;
  margin:0 !important;
  padding:0 !important;
  overflow:hidden !important;
}
body.dw-fullscreen .dc-page{padding:0 !important; align-items:stretch !important; justify-content:stretch !important;}
body.dw-fullscreen .dc-shell{width:100vw !important; height:100vh !important; max-width:none !important; border-radius:0 !important; box-shadow:none !important; border:0 !important;}
body.dw-fullscreen #dcBackLink{display:none !important;}

/* Embed (iframe/widget) */
html.dw-embed, body.dw-embed{height:100% !important; margin:0 !important;}
body.dw-embed .dc-page{height:100vh !important; min-height:100vh !important; padding:0 !important; align-items:stretch !important; justify-content:stretch !important;}
body.dw-embed .dc-shell{width:100% !important; height:100vh !important; max-width:none !important; max-height:none !important; display:flex !important; flex-direction:column !important;}
body.dw-embed .dc-body{flex:1 1 auto !important; min-height:0 !important;}
body.dw-embed #dcFooter{z-index:20 !important;}

/* Mobile */
@media (max-width: 480px){
  .dc-shell{width:100%;}
  .dc-bubble{max-width: calc(100vw - 32px);}
}


/* Rich content (cards) */
.dc-rich-title{font-weight:900; margin-bottom:8px;}
.dc-rich-list{margin:0; padding-left:18px;}
.dc-rich-list li{margin:6px 0;}
.dc-rich-card, .dc-rich-card *{line-height:1.5;}


/* Ações: manter botões principais na 1ª linha e botões de retorno (Recomeçar / Voltar) sempre na 2ª */
.dc-actions{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.dc-actions-row{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
}
.dc-actions-row--secondary{
  margin-top:2px;
}
