:root {
  --bg-primary: #0b0f19;
  --bg-surface: #111827;
  --bg-card: #1f2937;
  --bg-card-hover: #283548;
  --border-color: #374151;
  --border-highlight: #4f46e5;
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --accent-blue: #3b82f6;
  --accent-indigo: #6366f1;
  --accent-purple: #8b5cf6;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --badge-client: #1e3a5f;
  --badge-client-text: #60a5fa;
  --badge-seller: #134e4a;
  --badge-seller-text: #34d399;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Barra Superior */
header {
  background: linear-gradient(180deg, #131c2e 0%, var(--bg-surface) 100%);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 24px;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-purple));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 16px;
  color: white;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}

.logo-text h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-text span {
  font-size: 12px;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-blue));
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-primary:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: #4b5563;
}

/* Barra de Fases da Call */
.phases-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  background: rgba(17, 24, 39, 0.7);
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(55, 65, 81, 0.5);
}

.phase-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px;
  border-radius: 6px;
  background: rgba(31, 41, 55, 0.4);
  border: 1px solid transparent;
  transition: all 0.3s ease;
}

.phase-item .phase-num {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

.phase-item .phase-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.phase-item.active {
  background: rgba(79, 70, 229, 0.2);
  border-color: var(--accent-indigo);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.25);
}

.phase-item.active .phase-num {
  color: #a5b4fc;
}

.phase-item.active .phase-name {
  color: #e0e7ff;
}

/* Layout Principal */
main {
  flex: 1;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
  padding: 18px 24px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

/* Coluna de Chat */
.chat-container {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  height: calc(100vh - 210px);
}

.chat-header {
  padding: 12px 18px;
  background: rgba(31, 41, 55, 0.5);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header-title {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-green);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px var(--accent-green);
}

.chat-messages {
  flex: 1;
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message-bubble {
  max-width: 78%;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-bubble.client {
  align-self: flex-start;
}

.message-bubble.seller {
  align-self: flex-end;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.message-bubble.client .message-meta {
  justify-content: flex-start;
}

.message-bubble.seller .message-meta {
  justify-content: flex-end;
}

.role-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
}

.role-badge.client {
  background: var(--badge-client);
  color: var(--badge-client-text);
  border: 1px solid rgba(96, 165, 250, 0.3);
}

.role-badge.seller {
  background: var(--badge-seller);
  color: var(--badge-seller-text);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.message-time {
  font-size: 11px;
  color: var(--text-muted);
}

.message-text {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
}

.message-bubble.client .message-text {
  background: #1e293b;
  color: #f1f5f9;
  border-top-left-radius: 2px;
  border: 1px solid #334155;
}

.message-bubble.seller .message-text {
  background: #1e3a47;
  color: #ecfeff;
  border-top-right-radius: 2px;
  border: 1px solid #164e63;
}

/* Área de Input do Chat */
.chat-input-area {
  padding: 14px 18px;
  background: rgba(31, 41, 55, 0.4);
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.speaker-selector {
  display: flex;
  align-items: center;
  gap: 12px;
}

.speaker-selector span {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.speaker-options {
  display: flex;
  background: var(--bg-card);
  padding: 2px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.speaker-btn {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.speaker-btn.active.client-btn {
  background: var(--accent-blue);
  color: white;
}

.speaker-btn.active.seller-btn {
  background: var(--accent-green);
  color: white;
}

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

.input-box {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.input-box:focus {
  border-color: var(--accent-indigo);
}

.send-btn {
  background: var(--accent-indigo);
  color: white;
  border: none;
  padding: 0 18px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.send-btn:hover {
  background: #4f46e5;
}

/* Coluna do Copiloto (Direita) */
.copilot-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: calc(100vh - 210px);
  overflow-y: auto;
}

/* Card Ativo de Quebra de Objeção */
.card-active-objection {
  background: linear-gradient(145deg, #1e1b4b 0%, #172554 100%);
  border: 2px solid #6366f1;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.25);
  animation: slideIn 0.3s ease-out;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.card-header-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.badge-objection-title {
  background: #f43f5e;
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-metrics {
  display: flex;
  gap: 6px;
}

.metric-pill {
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.12);
  color: #e0e7ff;
  padding: 3px 8px;
  border-radius: 6px;
}

.card-objection-name {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
}

.card-argument-label {
  font-size: 11px;
  color: #a5b4fc;
  font-weight: 600;
  text-transform: uppercase;
}

.card-argument-text {
  font-size: 14px;
  line-height: 1.55;
  color: #f1f5f9;
  background: rgba(0, 0, 0, 0.3);
  padding: 12px 14px;
  border-radius: 8px;
  border-left: 3px solid #38bdf8;
}

.card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-use-response {
  background: linear-gradient(135deg, var(--accent-green), #059669);
  color: white;
  border: none;
  padding: 9px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.15s, opacity 0.15s;
}

.btn-use-response:hover {
  transform: translateY(-1px);
  opacity: 0.95;
}

/* Card de Estado Vazio / Sem Objeção */
.card-empty-state {
  background: var(--bg-surface);
  border: 1px dashed var(--border-color);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.card-empty-state .icon {
  font-size: 28px;
}

.card-waiting-state {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 12px;
  padding: 14px 18px;
  color: #fbbf24;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Histórico de Objeções */
.history-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-card);
  border-radius: 6px;
  font-size: 12px;
  border-left: 3px solid var(--accent-indigo);
}

.history-item-name {
  font-weight: 600;
  color: var(--text-main);
}

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

/* Rodapé / Footer de Métricas */
footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.metrics-group {
  display: flex;
  align-items: center;
  gap: 24px;
}

.metric-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.metric-value {
  color: var(--text-main);
  font-weight: 600;
}

.engine-badge {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.engine-badge.jev {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.4);
}

.engine-badge.fallback {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

/* Modal de Objeções */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 90%;
  max-width: 780px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.modal-header {
  padding: 16px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 700;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.objection-list-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.objection-edit-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.objection-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.objection-title-input {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 4px 8px;
  width: 60%;
}

.btn-remove-obj {
  color: var(--accent-rose);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 12px;
}

.field-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.field-textarea {
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 6px 10px;
  color: var(--text-main);
  font-size: 13px;
  resize: vertical;
  min-height: 48px;
  font-family: inherit;
}

.modal-footer {
  padding: 14px 20px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Estilos do Gerador IA e Avisos LGPD */
.notice-lgpd {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 12px;
  color: #c7d2fe;
  line-height: 1.5;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.drop-zone {
  border: 2px dashed #4b5563;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  background: rgba(17, 24, 39, 0.5);
  cursor: pointer;
  transition: all 0.2s;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent-indigo);
  background: rgba(99, 102, 241, 0.08);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: #8b5cf6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.proposed-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s;
}

.proposed-card:hover {
  border-color: #6366f1;
}

.proposed-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.proposed-card-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.badge-source {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
}

.badge-source.text {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-source.infer {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.evidence-box {
  background: rgba(0, 0, 0, 0.35);
  border-left: 2px solid #10b981;
  padding: 6px 10px;
  font-size: 11px;
  color: #94a3b8;
  border-radius: 0 4px 4px 0;
  font-style: italic;
}
