/* ═══════════ TOKENS ═══════════ */
:root {
  --bg:          #0d0d0f;
  --bg2:         #141417;
  --bg3:         #1c1c21;
  --border:      #2a2a32;
  --border-h:    #3d3d4a;
  --rose:        #e8478b;
  --rose-dim:    #b83468;
  --rose-glow:   rgba(232,71,139,0.18);
  --rose-subtle: rgba(232,71,139,0.07);
  --text:        #eeedf2;
  --text-2:      #9898a8;
  --text-3:      #5a5a6a;
  --green:       #25d366;
  --red:         #e84747;
  --radius:      12px;
  --radius-lg:   18px;
  --shadow:      0 4px 24px rgba(0,0,0,0.4);
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --transition:  0.2s cubic-bezier(0.4,0,0.2,1);
}

/* ═══════════ RESET ═══════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 300;
  line-height: 1.6;
  min-height: 100vh;
}

/* ═══════════ MODULE WRAPPER ═══════════ */
.wa-module {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ═══════════ NAV TABS ═══════════ */
.wa-nav {
  display: flex;
  gap: 4px;
  margin-bottom: 2rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  width: fit-content;
}
.wa-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.04em;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}
.wa-tab .tab-icon { font-size: 10px; color: var(--text-3); }
.wa-tab:hover { color: var(--text); background: var(--bg3); }
.wa-tab.active {
  background: var(--rose-subtle);
  color: var(--rose);
  border: 1px solid rgba(232,71,139,0.2);
}
.wa-tab.active .tab-icon { color: var(--rose); }

/* ═══════════ SECTIONS ═══════════ */
.wa-section { display: none; flex-direction: column; gap: 1.25rem; }
.wa-section.active { display: flex; animation: fadeUp 0.3s ease; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════ CARD ═══════════ */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: var(--shadow);
  transition: border-color var(--transition);
}
.card:hover { border-color: var(--border-h); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.card-header h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--text);
}
.badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--rose-subtle);
  color: var(--rose);
  border: 1px solid rgba(232,71,139,0.2);
  letter-spacing: 0.05em;
}

/* ═══════════ INPUTS ═══════════ */
.input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 300;
  padding: 10px 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}
.input:focus {
  border-color: var(--rose-dim);
  box-shadow: 0 0 0 3px var(--rose-glow);
}
.input::placeholder { color: var(--text-3); }
.textarea { resize: vertical; min-height: 80px; }
select.input { cursor: pointer; }

.field-label {
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ═══════════ BUTTONS ═══════════ */
.btn-primary {
  background: linear-gradient(135deg, var(--rose-dim), var(--rose));
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 10px 22px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 12px rgba(232,71,139,0.3);
  white-space: nowrap;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(232,71,139,0.45);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 20px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-ghost:hover {
  border-color: var(--rose-dim);
  color: var(--rose);
  background: var(--rose-subtle);
}
.btn-ghost:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.btn-icon:hover { border-color: var(--rose-dim); color: var(--rose); }

.btn-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

/* ═══════════ CLONE TABS ═══════════ */
.clone-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.clone-tab {
  padding: 7px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  font-family: var(--font-body);
  font-size: 12.5px;
  cursor: pointer;
  transition: var(--transition);
}
.clone-tab:hover { border-color: var(--border-h); color: var(--text); }
.clone-tab.active {
  background: var(--rose-subtle);
  border-color: rgba(232,71,139,0.3);
  color: var(--rose);
}
.clone-panel { display: none; flex-direction: column; gap: 0.75rem; }
.clone-panel.active { display: flex; }

/* ═══════════ RECORDER ═══════════ */
.recorder-ui {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.rec-orb {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border);
  transition: var(--transition);
  flex-shrink: 0;
}
.rec-orb.recording {
  background: var(--rose);
  border-color: var(--rose);
  box-shadow: 0 0 20px var(--rose-glow);
  animation: pulse-orb 1s ease-in-out infinite;
}
@keyframes pulse-orb {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.12); }
}
.rec-info { display: flex; flex-direction: column; }
.rec-info span:first-child { font-size: 13px; color: var(--text-2); }
.rec-info #rec-timer { font-size: 22px; font-family: var(--font-display); color: var(--text); font-weight: 300; }

.rec-controls { display: flex; gap: 0.75rem; }

.form-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}
.form-row .input { flex: 1; min-width: 160px; }

/* ═══════════ DROPZONE ═══════════ */
.dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1.5px dashed var(--border-h);
  border-radius: var(--radius);
  background: var(--bg3);
  padding: 2rem;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-2);
  line-height: 1.7;
}
.dropzone:hover {
  border-color: var(--rose-dim);
  background: var(--rose-subtle);
  color: var(--rose);
}
.dropzone small { color: var(--text-3); font-size: 11px; }
.file-chosen {
  font-size: 12px;
  color: var(--rose);
  background: var(--rose-subtle);
  border: 1px solid rgba(232,71,139,0.2);
  border-radius: 6px;
  padding: 4px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* ═══════════ VOICE GALLERY ═══════════ */
.voice-gallery, .audio-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.voice-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 200px;
  transition: var(--transition);
}
.voice-card:hover { border-color: var(--rose-dim); }
.voice-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rose-dim), var(--rose));
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.voice-meta { flex: 1; }
.voice-meta strong { display: block; font-size: 13px; font-weight: 500; }
.voice-meta small { color: var(--text-3); font-size: 11px; }
.voice-actions { display: flex; gap: 4px; }
.btn-tiny {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-2);
  font-size: 12px;
  padding: 4px 8px;
  cursor: pointer;
  transition: var(--transition);
}
.btn-tiny:hover { border-color: var(--rose-dim); color: var(--rose); }

.audio-item {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 220px;
}
.audio-item small { color: var(--text-3); font-size: 11px; }
.audio-item audio { width: 100%; height: 32px; }

/* ═══════════ SLIDER ═══════════ */
.slider-group { display: flex; flex-direction: column; gap: 0.5rem; }
.slider-val {
  font-size: 13px;
  font-family: var(--font-display);
  color: var(--rose);
  font-weight: 400;
}
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(to right, var(--rose) 0%, var(--rose) var(--pct, 50%), var(--bg3) var(--pct, 50%));
  outline: none;
  cursor: pointer;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--rose);
  box-shadow: 0 0 8px var(--rose-glow);
  transition: transform 0.15s;
}
.slider::-webkit-slider-thumb:hover { transform: scale(1.2); }

/* ═══════════ MODE TOGGLE ═══════════ */
.mode-toggle {
  display: flex;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  gap: 3px;
}
.mode-btn {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  font-family: var(--font-body);
  font-size: 12.5px;
  cursor: pointer;
  transition: var(--transition);
}
.mode-btn.active {
  background: var(--rose-subtle);
  color: var(--rose);
  border: 1px solid rgba(232,71,139,0.2);
}

/* ═══════════ CAMPAGNE LAYOUT ═══════════ */
.campagne-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 860px) {
  .campagne-layout { grid-template-columns: 1fr; }
}
.campagne-form { display: flex; flex-direction: column; gap: 1.25rem; }

/* Campagne list items */
.campagne-item {
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: var(--transition);
}
.campagne-item:last-child { border-bottom: none; }
.campagne-item:hover { background: var(--rose-subtle); margin: 0 -1.5rem; padding-left: 1.5rem; padding-right: 1.5rem; border-radius: 8px; }
.c-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.c-dot.pending  { background: var(--text-3); }
.c-dot.running  { background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse-orb 1s infinite; }
.c-dot.done     { background: var(--rose); }
.c-dot.failed   { background: var(--red); }
.c-meta { flex: 1; }
.c-meta strong { display: block; font-size: 13px; font-weight: 500; }
.c-meta small { color: var(--text-3); font-size: 11px; }
.c-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 500;
  letter-spacing: 0.05em;
}
.c-badge.simple      { background: rgba(148,148,200,0.12); color: #9898a8; }
.c-badge.interaction { background: var(--rose-subtle); color: var(--rose); border: 1px solid rgba(232,71,139,0.2); }

/* Preview box */
.preview-box {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-2);
  white-space: pre-wrap;
  max-height: 300px;
  overflow-y: auto;
}

/* ═══════════ SESSION ═══════════ */
.session-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 760px) { .session-layout { grid-template-columns: 1fr; } }

.session-card { align-items: center; text-align: center; }
.session-status-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 13px;
  color: var(--text-2);
}
.dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--text-3);
  transition: var(--transition);
}
.dot.connected { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot.loading   { background: #f0a500; animation: pulse-orb 0.8s infinite; }

.qr-zone { width: 180px; height: 180px; }
.qr-placeholder {
  width: 100%; height: 100%;
  border: 1.5px dashed var(--border-h);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  font-size: 12px;
}
.qr-zone img { width: 100%; height: 100%; border-radius: var(--radius); }
.qr-zone canvas { border-radius: var(--radius); }

/* Numbers list */
.number-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.number-row:last-child { border-bottom: none; }
.num-phone { flex: 1; font-size: 13px; font-family: monospace; color: var(--text); }
.num-status {
  font-size: 10px;
  padding: 2px 9px;
  border-radius: 99px;
  font-weight: 500;
  letter-spacing: 0.05em;
}
.num-status.available  { background: rgba(37,211,102,0.1); color: var(--green); }
.num-status.reserved   { background: rgba(240,165,0,0.1); color: #f0a500; }
.num-status.in_use     { background: var(--rose-subtle); color: var(--rose); }
.num-status.retired    { background: rgba(90,90,106,0.15); color: var(--text-3); }

/* ═══════════ MISC ═══════════ */
.status-line {
  font-size: 12.5px;
  color: var(--text-2);
  min-height: 1.2em;
  transition: color var(--transition);
}
.status-line.ok    { color: var(--green); }
.status-line.error { color: var(--red); }

.empty-state {
  color: var(--text-3);
  font-size: 13px;
  padding: 1rem 0;
  font-style: italic;
}

/* ═══════════ TOAST ═══════════ */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--bg3);
  border: 1px solid var(--border-h);
  color: var(--text);
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 13px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 999;
  max-width: 320px;
}
.toast.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.toast.success { border-color: var(--green); }
.toast.error   { border-color: var(--red); }
.toast.rose    { border-color: var(--rose); }

/* ═══════════ SCROLLBAR ═══════════ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-h); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }