/**
 * Estilos do painel de conexao WhatsApp dentro do /phone.
 * Mantem QR, cooldown e passos em um modulo visual separado.
 * Evita reabrir a tela antiga e preserva a interface compacta.
 */
.whatsapp-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
  gap: .9rem;
  margin-top: .9rem;
}

.whatsapp-targets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .9rem;
  margin-top: .9rem;
}

.whatsapp-box {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  padding: .95rem;
}

.whatsapp-head {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: flex-start;
}

.wa-info-panel {
  margin-top: .9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(148, 163, 184, .06);
  overflow: hidden;
}

.wa-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  padding: .6rem .85rem;
  font-size: .9rem;
}

.wa-info-row + .wa-info-row {
  border-top: 1px solid var(--line);
}

.wa-info-row span {
  color: var(--muted);
}

.wa-info-row strong {
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}

.wa-info-row strong.ok {
  color: #166534;
}

.wa-info-row strong.off {
  color: #991b1b;
}

.wa-note-box,
.wa-help-box {
  display: grid;
  gap: .45rem;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: #fff;
  padding: .85rem;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.45;
}

.wa-help-box {
  margin-top: .9rem;
  font-size: .82rem;
}

.wa-note-line code,
.wa-help-box code {
  font-family: inherit;
  font-weight: 700;
  color: var(--text);
}

.qr-box {
  margin-top: .9rem;
  display: grid;
  gap: .9rem;
}

.qr-frame {
  width: min(100%, 320px);
  min-height: 320px;
  margin: 0 auto;
  border-radius: 18px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr-placeholder {
  color: var(--muted);
  text-align: center;
  font-size: .9rem;
  line-height: 1.45;
}

.wa-actions-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .6rem;
}

.wa-btn {
  border-radius: 10px;
  padding: .6rem .5rem;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  transition: filter .15s ease, background .15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-btn:hover:not(:disabled) {
  filter: brightness(.96);
}

.wa-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.wa-btn-primary {
  background: #25d366;
  border-color: #1fae55;
  color: #fff;
}

.wa-btn-ghost {
  background: #fff;
}

.wa-btn-danger {
  background: #fff;
  border-color: #fca5a5;
  color: #b91c1c;
}

.wa-btn-danger:hover:not(:disabled) {
  background: #fef2f2;
}

.cooldown-box {
  display: none;
  gap: .5rem;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: #fff;
  padding: .85rem;
}

.cooldown-box.visible {
  display: grid;
}

.cooldown-title {
  font-weight: 700;
}

.cooldown-copy {
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.45;
}

.cooldown-track {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(148, 163, 184, .2);
}

.cooldown-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #25d366, #86efac);
  transition: width .25s ease;
}

.whatsapp-steps {
  display: grid;
  gap: .75rem;
  margin-top: .9rem;
}

.whatsapp-step {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: .7rem;
  align-items: start;
}

.whatsapp-step span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 700;
}

.whatsapp-step p {
  color: var(--muted);
  line-height: 1.45;
}

.badge.open {
  background: #dcfce7;
  color: #166534;
}

.badge.connecting {
  background: #fef3c7;
  color: #92400e;
}

.badge.stale {
  background: #fee2e2;
  color: #991b1b;
}

@media (max-width: 960px) {
  .whatsapp-layout {
    grid-template-columns: 1fr;
  }

  .whatsapp-targets {
    grid-template-columns: 1fr;
  }

  .wa-actions-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
