/* Painel Disparos WD — estilo simples e direto */

:root {
  --primary: #00865A;       /* verde WD */
  --primary-dark: #006645;
  --warning: #FFB800;
  --danger: #DC2626;
  --bg: #F8FAFC;
  --card: #FFFFFF;
  --border: #E2E8F0;
  --text: #0F172A;
  --text-muted: #64748B;
  --shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ============ LOGIN ============ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #00865A 0%, #004D33 100%);
  padding: 16px;
}

.login-card {
  background: white;
  padding: 40px 32px;
  border-radius: 16px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.login-card h1 {
  margin: 0 0 4px;
  font-size: 22px;
  color: var(--primary);
  text-align: center;
}

.login-card .subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 14px;
}

/* ============ FORM ============ */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 14px;
}

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], textarea, select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  background: white;
  transition: border-color 0.15s;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
}

/* ============ BUTTONS ============ */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: white;
  width: 100%;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: #94A3B8; cursor: not-allowed; }

.btn-secondary {
  background: white;
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 8px 16px;
}
.btn-ghost:hover { color: var(--text); }

/* ============ ALERTS ============ */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}
.alert-error {
  background: #FEE2E2;
  color: #991B1B;
  border: 1px solid #FCA5A5;
}
.alert-warning {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FCD34D;
}
.alert-info {
  background: #DBEAFE;
  color: #1E40AF;
  border: 1px solid #93C5FD;
}
.alert-success {
  background: #D1FAE5;
  color: #065F46;
  border: 1px solid #6EE7B7;
}

/* ============ LAYOUT APP ============ */
.app-header {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}

.app-header .brand {
  font-weight: 700;
  color: var(--primary);
  font-size: 18px;
}

.app-header .user-info {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  color: var(--text-muted);
}

.app-header .user-info form { margin: 0; }

.app-container {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* ============ CARDS ============ */
.cap-banner {
  background: white;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow);
}

.cap-banner.ok { border-color: #6EE7B7; background: #F0FDF4; }
.cap-banner.warn { border-color: #FCD34D; background: #FFFBEB; }
.cap-banner.block { border-color: #FCA5A5; background: #FEF2F2; }

.cap-banner .cap-line {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
}
.cap-banner .cap-sub {
  font-size: 13px;
  color: var(--text-muted);
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin: 24px 0 12px;
}

/* ============ ACTION CARDS (dashboard) ============ */
.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.action-card {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-decoration: none;
  color: inherit;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.action-card:hover:not(.disabled) {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 134, 90, 0.15);
}

.action-card.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.action-card .icon {
  font-size: 48px;
  margin-bottom: 12px;
}
.action-card .title {
  font-weight: 700;
  font-size: 17px;
  margin-bottom: 6px;
}
.action-card .desc {
  font-size: 13px;
  color: var(--text-muted);
}
.action-card .badge {
  display: inline-block;
  margin-top: 12px;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  background: #FEF3C7;
  color: #92400E;
  font-weight: 600;
}

/* ============ TABLE (histórico) ============ */
.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-item {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
}

.list-item .tipo-icon {
  font-size: 24px;
}

.list-item .info {
  flex: 1;
  min-width: 0;
}

.list-item .title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 2px;
}

.list-item .meta {
  font-size: 12px;
  color: var(--text-muted);
}

.list-item .status-badge {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
}

.status-concluido { background: #D1FAE5; color: #065F46; }
.status-enviando { background: #DBEAFE; color: #1E40AF; }
.status-pendente { background: #FEF3C7; color: #92400E; }
.status-aguardando_aprovacao { background: #FEF3C7; color: #92400E; }
.status-falhou, .status-rejeitado { background: #FEE2E2; color: #991B1B; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }

/* ============ FORMS (multi-section) ============ */
.muted { color: var(--text-muted); }
.small { font-size: 12px; }

.form-section {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.form-section h3 {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--primary);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.form-section h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--text-muted);
}

.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.row > .field { flex: 1; min-width: 140px; }

.checkbox-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.radio-card {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  background: white;
  font-size: 14px;
  transition: all 0.15s;
}

.radio-card:hover { border-color: var(--primary); }

.radio-card input[type="radio"]:checked + span {
  font-weight: 700;
  color: var(--primary);
}

.radio-card:has(input:checked) {
  border-color: var(--primary);
  background: #F0FDF4;
}

/* ============ AUDIT BANNER (anti-ban no preview) ============ */
.audit-banner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: white;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.audit-banner.audit-ok { background: #F0FDF4; border-color: #86EFAC; }
.audit-banner.audit-warn { background: #FFFBEB; border-color: #FCD34D; }
.audit-banner.audit-bad { background: #FEF2F2; border-color: #FCA5A5; }
.audit-cell {
  text-align: center;
  padding: 6px;
}
.audit-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.audit-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}
.audit-target {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============ PREVIEW SPLIT (bolha + textarea lado a lado) ============ */
.preview-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.preview-side {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.preview-side h3 {
  margin: 0 0 10px;
  font-size: 12px !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: none !important;
  padding-bottom: 0 !important;
}
.preview-side textarea {
  resize: vertical;
}
@media (max-width: 820px) {
  .preview-split { grid-template-columns: 1fr; }
  .audit-banner { grid-template-columns: repeat(2, 1fr); }
}

/* ============ PREVIEW (WhatsApp bubble) ============ */
.preview-calc {
  background: #FEF3C7;
  border: 1px solid #FCD34D;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.whatsapp-preview {
  background: #E5DDD5;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(0, 0, 0, 0.04) 1px, transparent 1px),
    radial-gradient(circle at 80% 60%, rgba(0, 0, 0, 0.04) 1px, transparent 1px);
  background-size: 30px 30px;
  padding: 24px;
  border-radius: 8px;
  display: flex;
  justify-content: flex-end;
}

.wa-bubble {
  background: #DCF8C6;
  padding: 10px 14px;
  border-radius: 8px;
  max-width: 380px;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
}

details summary {
  cursor: pointer;
  padding: 12px 0;
  color: var(--primary);
}

.info-list {
  margin: 0;
  padding-left: 20px;
}
.info-list li { margin-bottom: 6px; }

/* ============ PROGRESSO ============ */
.progress-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stat {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat strong {
  display: block;
  font-size: 28px;
  margin-bottom: 4px;
}
.stat span {
  font-size: 12px;
  color: var(--text-muted);
}
.stat.ok strong { color: #059669; }
.stat.fail strong { color: var(--danger); }
.stat.pend strong { color: #D97706; }

.progress-bar-wrap {
  background: #E2E8F0;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 24px;
}
.progress-bar {
  background: linear-gradient(90deg, var(--primary), #34D399);
  height: 100%;
  transition: width 0.5s ease-out;
}

.grupos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.grupo-item {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  transition: all 0.2s;
}

.grupo-item.status-sucesso { background: #F0FDF4; border-color: #6EE7B7; }
.grupo-item.status-falha   { background: #FEF2F2; border-color: #FCA5A5; }
.grupo-item.status-pendente {
  background: #FFFBEB;
  border-color: #FCD34D;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

.grupo-status-icon { font-size: 22px; line-height: 1; }
.grupo-info { flex: 1; min-width: 0; }
.grupo-nome { font-weight: 700; font-size: 14px; }
.grupo-meta { font-size: 11px; color: var(--text-muted); }
.grupo-erro {
  font-size: 11px;
  color: var(--danger);
  margin-top: 4px;
  word-break: break-word;
}

/* ============ MOBILE ============ */
@media (max-width: 640px) {
  .app-container { padding: 16px 12px; }
  .action-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .action-card { padding: 16px 12px; }
  .action-card .icon { font-size: 36px; }
  .action-card .title { font-size: 14px; }
  .action-card .desc { font-size: 11px; }
}
