/* =============================================
   CLINICA CRM — Raya Studio Style
   Dark Sidebar · Lavender BG · White Cards · Violet Accent
   Font: Outfit (Google Fonts)
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* ─── DESIGN TOKENS ──────────────────────────── */
:root {
  /* Sidebar */
  --sb-bg:         #13122B;
  --sb-hover:      #1E1D3A;
  --sb-active:     #252446;
  --sb-border:     rgba(255,255,255,.06);
  --sb-text:       rgba(255,255,255,.52);
  --sb-text-active:#FFFFFF;
  --sb-icon:       rgba(255,255,255,.4);
  --sb-icon-active:#FFFFFF;

  /* App surfaces */
  --bg:            #EDEDF5;
  --surface:       #FFFFFF;
  --surface2:      #F6F6FA;
  --surface3:      #EFEFF6;
  --border:        #E4E4EE;
  --border2:       #D0D0E0;

  /* Brand */
  --violet:        #6C5CE7;
  --violet-h:      #5A4BD1;
  --violet-light:  #EEF0FF;
  --violet-pale:   #F5F5FF;
  --violet-glow:   rgba(108,92,231,.18);

  /* Text */
  --text:          #1A192E;
  --text-muted:    #6E6D85;
  --text-dim:      #AEADC2;

  /* Status palette (vivid but refined) */
  --c-novo:        #3B82F6;
  --c-novo-bg:     #EFF6FF;
  --c-novo-soft:   rgba(59,130,246,.12);
  --c-conv:        #F59E0B;
  --c-conv-bg:     #FFFBEB;
  --c-conv-soft:   rgba(245,158,11,.12);
  --c-agend:       #8B5CF6;
  --c-agend-bg:    #F5F3FF;
  --c-agend-soft:  rgba(139,92,246,.12);
  --c-real:        #10B981;
  --c-real-bg:     #ECFDF5;
  --c-real-soft:   rgba(16,185,129,.12);
  --c-cancel:      #EF4444;
  --c-cancel-bg:   #FEF2F2;
  --c-cancel-soft: rgba(239,68,68,.12);

  /* Geometry */
  --r:     12px;
  --r-sm:   8px;
  --r-xs:   5px;
  --r-pill: 999px;

  /* Shadows */
  --sh-xs:  0 1px 3px rgba(19,18,43,.05);
  --sh-sm:  0 2px 8px rgba(19,18,43,.07), 0 1px 2px rgba(19,18,43,.04);
  --sh:     0 4px 20px rgba(19,18,43,.09), 0 1px 4px rgba(19,18,43,.05);
  --sh-lg:  0 12px 40px rgba(19,18,43,.13), 0 3px 10px rgba(19,18,43,.06);
  --sh-modal: 0 24px 64px rgba(19,18,43,.22), 0 6px 20px rgba(19,18,43,.10);

  /* Type */
  --font: 'Outfit', system-ui, sans-serif;
  --sb-w: 220px;
}

/* ─── RESET ──────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  letter-spacing: -.01em;
}
a { color: var(--violet); text-decoration: none; }
small {
  font-size: 11.5px; color: var(--text-muted);
  display: block; margin-top: 5px; line-height: 1.5;
}
small a { color: var(--violet); }
strong { font-weight: 600; }

#app { display: flex; height: 100vh; }

/* =============================================
   SIDEBAR — dark navy
   ============================================= */
#sidebar {
  width: var(--sb-w);
  min-width: var(--sb-w);
  background: var(--sb-bg);
  display: flex;
  flex-direction: column;
  z-index: 100;
  padding: 0;
}

/* logo area */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--sb-border);
}

.logo-icon {
  width: 36px; height: 36px;
  background: var(--violet);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(108,92,231,.4);
}

.logo-info { display: flex; flex-direction: column; overflow: hidden; }
.logo-name {
  font-size: 13.5px; font-weight: 700;
  color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.logo-sub {
  font-size: 10px; color: var(--sb-text);
  font-weight: 500; margin-top: 1px;
}

/* nav */
.nav-list { list-style: none; padding: 10px 10px; flex: 1; }
.nav-list li + li { margin-top: 2px; }

.nav-btn {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border: none;
  background: transparent;
  color: var(--sb-text);
  font-size: 13px; font-weight: 500; font-family: var(--font);
  cursor: pointer;
  border-radius: var(--r-sm);
  transition: background .14s, color .14s;
  text-align: left;
}

.nav-btn svg {
  width: 17px; height: 17px;
  stroke: currentColor; fill: none;
  stroke-width: 1.75;
  flex-shrink: 0;
  opacity: .65;
  transition: opacity .14s;
}

.nav-btn:hover {
  background: var(--sb-hover);
  color: rgba(255,255,255,.8);
}
.nav-btn:hover svg { opacity: 1; }

.nav-btn.active {
  background: var(--sb-active);
  color: var(--sb-text-active);
  font-weight: 600;
}
.nav-btn.active svg {
  stroke: #fff;
  opacity: 1;
}

/* sidebar footer */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--sb-border);
}

.followup-indicator {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; color: var(--sb-text); font-weight: 500;
}

.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--c-real); flex-shrink: 0;
}
.dot.pulse { animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .4; transform: scale(.75); }
}

/* =============================================
   MAIN CONTENT
   ============================================= */
#main {
  flex: 1;
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* ─── TOPBAR ─────────────────────────────────── */
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  box-shadow: var(--sh-xs);
  gap: 16px;
}

#page-title {
  font-size: 15px; font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* =============================================
   BUTTONS
   ============================================= */
.btn-primary {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--violet);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  padding: 8px 18px;
  font-size: 13px; font-weight: 600; font-family: var(--font);
  cursor: pointer;
  transition: background .15s, box-shadow .15s, transform .1s;
  box-shadow: 0 3px 12px var(--violet-glow);
  letter-spacing: -.01em;
}
.btn-primary svg { stroke: #fff; fill: none; }
.btn-primary:hover { background: var(--violet-h); box-shadow: 0 5px 18px var(--violet-glow); }
.btn-primary:active { transform: scale(.97); }

.btn-outline {
  display: inline-flex; align-items: center; gap: 7px;
  background: transparent;
  border: 1.5px solid var(--border2);
  color: var(--text-muted);
  border-radius: var(--r-sm);
  padding: 7px 16px;
  font-size: 13px; font-weight: 500; font-family: var(--font);
  cursor: pointer;
  transition: border-color .12s, color .12s, background .12s;
}
.btn-outline:hover {
  border-color: var(--violet);
  color: var(--violet);
  background: var(--violet-pale);
}

.btn-sm { padding: 6px 12px; font-size: 12px; }

/* =============================================
   PAGES
   ============================================= */
.page { display: none; flex: 1; overflow-y: auto; padding: 24px; }
.page.active { display: flex; flex-direction: column; }

/* =============================================
   DASHBOARD
   ============================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 16px 14px;
  cursor: pointer;
  transition: box-shadow .15s, transform .12s, border-color .12s;
  box-shadow: var(--sh-xs);
  display: flex; flex-direction: column; gap: 12px;
}
.stat-card:hover {
  box-shadow: var(--sh);
  transform: translateY(-2px);
  border-color: var(--border2);
}

.stat-icon {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.stat-icon.all    { background: var(--surface3); color: var(--text-muted); }
.stat-icon.novo   { background: var(--c-novo-soft);   color: var(--c-novo); }
.stat-icon.conv   { background: var(--c-conv-soft);   color: var(--c-conv); }
.stat-icon.agend  { background: var(--c-agend-soft);  color: var(--c-agend); }
.stat-icon.real   { background: var(--c-real-soft);   color: var(--c-real); }
.stat-icon.cancel { background: var(--c-cancel-soft); color: var(--c-cancel); }

.stat-info { display: flex; flex-direction: column; }
.stat-num {
  font-size: 26px; font-weight: 800;
  color: var(--text);
  line-height: 1;
  letter-spacing: -.04em;
}
.stat-label {
  font-size: 11.5px; font-weight: 500;
  color: var(--text-muted);
  margin-top: 4px;
}

.dash-row {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 14px; flex: 1;
}

.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  box-shadow: var(--sh-xs);
  display: flex; flex-direction: column; gap: 14px;
}

.dash-card h3 {
  font-size: 12px; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
}

.followup-list { display: flex; flex-direction: column; gap: 5px; }

.followup-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .1s, border-color .1s;
}
.followup-item:hover {
  background: var(--surface2);
  border-color: var(--border);
}

.fi-name { font-size: 13px; font-weight: 600; color: var(--text); }
.fi-time { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.fi-badge {
  margin-left: auto; flex-shrink: 0;
  font-size: 10.5px; font-weight: 700;
  padding: 2px 9px; border-radius: var(--r-pill);
}

/* =============================================
   KANBAN
   ============================================= */
#page-kanban { padding: 16px; overflow: hidden; }
#page-kanban.active {
  display: block;
  height: calc(100vh - 56px);
}

.kanban-board {
  display: flex; gap: 10px;
  height: 100%;
  overflow-x: auto;
  padding-bottom: 8px;
}

.kanban-col {
  display: flex; flex-direction: column;
  width: 258px; min-width: 258px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}

.col-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px 11px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}

.col-dot {
  width: 8px; height: 8px;
  border-radius: 50%; flex-shrink: 0;
}
.col-header.novo   .col-dot { background: var(--c-novo); }
.col-header.conv   .col-dot { background: var(--c-conv); }
.col-header.agend  .col-dot { background: var(--c-agend); }
.col-header.real   .col-dot { background: var(--c-real); }
.col-header.cancel .col-dot { background: var(--c-cancel); }

.col-title {
  flex: 1;
  font-size: 12px; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.col-count {
  background: var(--surface3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px; font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--r-pill);
}

.col-cards {
  flex: 1; overflow-y: auto;
  padding: 8px;
  display: flex; flex-direction: column; gap: 7px;
  min-height: 48px;
}
.col-cards.sortable-over {
  background: var(--violet-pale);
  outline: 2px dashed rgba(108,92,231,.2);
  outline-offset: -4px;
  border-radius: var(--r-sm);
}

.btn-add-card {
  width: 100%;
  padding: 9px;
  border: none; background: transparent;
  color: var(--text-dim);
  font-size: 12px; font-weight: 500; font-family: var(--font);
  cursor: pointer;
  transition: color .12s, background .12s;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.btn-add-card:hover { color: var(--violet); background: var(--violet-pale); }

/* ─── LEAD CARDS ─────────────────────────────── */
.lead-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 11px 12px;
  cursor: grab;
  transition: box-shadow .15s, border-color .15s, transform .1s;
  box-shadow: var(--sh-xs);
  user-select: none;
}
.lead-card:hover {
  border-color: var(--border2);
  box-shadow: var(--sh-sm);
  transform: translateY(-1px);
}
.lead-card.sortable-ghost { opacity: .3; transform: rotate(2deg); }
.lead-card.sortable-chosen {
  cursor: grabbing;
  box-shadow: var(--sh);
  border-color: var(--violet);
  transform: scale(1.02) rotate(.5deg);
}

.card-top {
  display: flex; align-items: flex-start; gap: 9px;
  margin-bottom: 8px;
}

.card-avatar {
  width: 30px; height: 30px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700; color: #fff;
}

.card-info { flex: 1; min-width: 0; }
.card-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-phone { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.card-tag {
  font-size: 10.5px; font-weight: 500;
  padding: 2px 7px; border-radius: var(--r-pill);
  background: var(--surface3); border: 1px solid var(--border);
  color: var(--text-muted);
}

.card-footer { display: flex; align-items: center; justify-content: space-between; }
.card-time { font-size: 10.5px; color: var(--text-dim); font-weight: 500; }

.card-followup-badge {
  display: flex; align-items: center; gap: 3px;
  background: var(--c-cancel-bg); color: var(--c-cancel);
  font-size: 10.5px; font-weight: 700;
  padding: 2px 8px; border-radius: var(--r-pill);
  border: 1px solid rgba(239,68,68,.15);
}

/* =============================================
   CONVERSATIONS
   ============================================= */
#page-conversations { padding: 0; overflow: hidden; }
#page-conversations.active {
  display: flex; flex-direction: column;
  height: calc(100vh - 56px);
}

.chat-layout { display: flex; flex: 1; overflow: hidden; }

.chat-sidebar {
  width: 268px; min-width: 268px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}

.chat-sidebar-header {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.input-search {
  width: 100%;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px; font-family: var(--font);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input-search:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px var(--violet-glow);
  background: var(--surface);
}
.input-search::placeholder { color: var(--text-dim); }

.conv-list {
  flex: 1; overflow-y: auto;
  padding: 6px;
  display: flex; flex-direction: column; gap: 1px;
}

.conv-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .1s;
  border: 1px solid transparent;
}
.conv-item:hover { background: var(--surface2); }
.conv-item.active {
  background: var(--violet-light);
  border-color: rgba(108,92,231,.14);
}

.conv-avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
}

.conv-info { flex: 1; min-width: 0; }
.conv-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv-last {
  font-size: 11px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
}
.conv-time { font-size: 10.5px; color: var(--text-dim); flex-shrink: 0; }

.chat-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.chat-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  box-shadow: var(--sh-xs);
}

.chat-avatar {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--surface3);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; flex-shrink: 0;
}

.chat-lead-name { font-size: 14px; font-weight: 700; color: var(--text); }
.chat-lead-phone { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.chat-header-actions { margin-left: auto; }

.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 20px 24px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--bg);
}

.chat-empty {
  margin: auto; color: var(--text-dim);
  font-size: 13px; font-weight: 500; text-align: center;
}

.msg-bubble { max-width: 68%; display: flex; flex-direction: column; }
.msg-bubble.sent   { align-self: flex-end; align-items: flex-end; }
.msg-bubble.recv,
.msg-bubble.ai     { align-self: flex-start; align-items: flex-start; }

.msg-ai-badge {
  font-size: 10.5px; font-weight: 700;
  color: var(--violet); margin-bottom: 3px;
}

.msg-text {
  padding: 10px 14px; border-radius: 14px;
  font-size: 13px; line-height: 1.55;
  word-break: break-word; white-space: pre-wrap;
}
.msg-bubble.sent .msg-text {
  background: var(--violet); color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 10px var(--violet-glow);
}
.msg-bubble.recv .msg-text {
  background: var(--surface); color: var(--text);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
  box-shadow: var(--sh-xs);
}
.msg-bubble.ai .msg-text {
  background: var(--violet-light); color: var(--text);
  border: 1px solid rgba(108,92,231,.14);
  border-bottom-left-radius: 4px;
}

.msg-time { font-size: 10.5px; color: var(--text-dim); margin-top: 4px; font-weight: 500; }

.chat-input-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.ai-toggle {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--text-muted); flex-shrink: 0;
}

.chat-text-input {
  flex: 1;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  padding: 9px 14px;
  font-size: 13px; font-family: var(--font);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.chat-text-input:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px var(--violet-glow);
  background: var(--surface);
}
.chat-text-input:disabled { opacity: .45; cursor: not-allowed; }
.chat-text-input::placeholder { color: var(--text-dim); }

.btn-send {
  width: 38px; height: 38px;
  border-radius: var(--r-sm);
  background: var(--violet); border: none; color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .1s;
  flex-shrink: 0;
  box-shadow: 0 2px 10px var(--violet-glow);
}
.btn-send svg { stroke: #fff; fill: none; }
.btn-send:hover { background: var(--violet-h); }
.btn-send:active { transform: scale(.94); }
.btn-send:disabled { opacity: .3; cursor: not-allowed; pointer-events: none; }

/* =============================================
   AGENDA
   ============================================= */
.agenda-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}

.agenda-filters { display: flex; gap: 5px; }

.btn-filter {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--r-sm);
  padding: 6px 14px;
  font-size: 12.5px; font-weight: 500; font-family: var(--font);
  cursor: pointer;
  transition: all .12s;
}
.btn-filter:hover { border-color: var(--violet); color: var(--violet); }
.btn-filter.active {
  background: var(--violet); color: #fff;
  border-color: var(--violet);
  box-shadow: 0 2px 10px var(--violet-glow);
  font-weight: 600;
}

.agenda-list { display: flex; flex-direction: column; gap: 8px; }

.appt-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 18px;
  transition: box-shadow .15s, border-color .15s, transform .1s;
  cursor: pointer;
  box-shadow: var(--sh-xs);
}
.appt-card:hover {
  box-shadow: var(--sh);
  border-color: var(--border2);
  transform: translateY(-1px);
}

.appt-date-block {
  display: flex; flex-direction: column; align-items: center;
  background: var(--violet-light);
  border: 1px solid rgba(108,92,231,.14);
  border-radius: var(--r-sm);
  padding: 8px 12px; min-width: 52px; text-align: center;
}
.appt-day   { font-size: 22px; font-weight: 800; color: var(--violet); line-height: 1; }
.appt-month { font-size: 10.5px; font-weight: 700; color: var(--violet); text-transform: uppercase; letter-spacing: .06em; opacity: .7; }

.appt-info { flex: 1; }
.appt-name      { font-size: 14px; font-weight: 700; color: var(--text); }
.appt-specialty { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.appt-time      { font-size: 12px; color: var(--c-agend); font-weight: 600; margin-top: 3px; }

.appt-actions { display: flex; gap: 7px; }

/* =============================================
   CONFIG
   ============================================= */
.config-layout { display: flex; gap: 16px; flex: 1; min-height: 0; }

.config-tabs {
  list-style: none;
  display: flex; flex-direction: column; gap: 2px;
  width: 182px; flex-shrink: 0;
}

.config-tab {
  width: 100%; text-align: left;
  padding: 9px 14px;
  border: none; background: transparent;
  color: var(--text-muted);
  font-size: 13px; font-weight: 500; font-family: var(--font);
  cursor: pointer; border-radius: var(--r-sm);
  transition: background .1s, color .1s;
}
.config-tab:hover { background: var(--surface3); color: var(--text); }
.config-tab.active {
  background: var(--violet-light);
  color: var(--violet); font-weight: 600;
}

.config-content { flex: 1; overflow-y: auto; }
.config-panel { display: none; }
.config-panel.active { display: block; }
.config-panel h2 {
  font-size: 18px; font-weight: 800;
  letter-spacing: -.03em;
  margin-bottom: 20px; color: var(--text);
}

.api-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px; margin-bottom: 14px;
  box-shadow: var(--sh-xs);
}
.api-section h3 { font-size: 13px; font-weight: 700; margin-bottom: 14px; color: var(--text); }

/* ─── FORMS ──────────────────────────────────── */
.form-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 14px; margin-bottom: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label {
  font-size: 12px; font-weight: 600;
  color: var(--text-muted); letter-spacing: .01em;
}

.input-field {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  padding: 9px 12px;
  font-size: 13px; font-family: var(--font); font-weight: 400;
  outline: none; width: 100%;
  transition: border-color .15s, box-shadow .15s, background .12s;
}
.input-field:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px var(--violet-glow);
  background: var(--surface);
}
.input-field:hover:not(:focus) { border-color: var(--border2); }
.input-field::placeholder { color: var(--text-dim); }
.input-field option { background: var(--surface); color: var(--text); }
textarea.input-field { resize: vertical; line-height: 1.55; }
.btn-save { margin-top: 4px; }

/* ─── LIST EDITOR ─────────────────────────────── */
.list-editor { display: flex; flex-direction: column; gap: 14px; }
.list-add-row { display: flex; gap: 9px; }
.list-add-row .input-field { flex: 1; }

.tag-list { display: flex; flex-wrap: wrap; gap: 7px; }
.tag-item {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-pill);
  padding: 5px 12px 5px 13px;
  font-size: 12.5px; font-weight: 500; color: var(--text);
  box-shadow: var(--sh-xs);
}
.tag-remove {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 15px; line-height: 1; padding: 0;
  transition: color .12s; display: flex; align-items: center;
}
.tag-remove:hover { color: var(--c-cancel); }

/* ─── TOGGLE ──────────────────────────────────── */
.toggle-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.toggle-label { position: relative; cursor: pointer; flex-shrink: 0; }
.toggle-label input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
  display: block; width: 40px; height: 22px;
  background: var(--border2); border-radius: var(--r-pill);
  transition: background .2s; position: relative;
}
.toggle-track::after {
  content: ''; position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.2);
  transition: transform .2s;
}
.toggle-label input:checked + .toggle-track { background: var(--violet); }
.toggle-label input:checked + .toggle-track::after { transform: translateX(18px); }

/* ─── CHECKBOXES ──────────────────────────────── */
.checkbox-group { display: flex; flex-direction: column; gap: 10px; }
.checkbox-group label {
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; font-weight: 500; color: var(--text); cursor: pointer;
}
.checkbox-group input[type=checkbox] { accent-color: var(--violet); width: 15px; height: 15px; }

/* ─── INFO BOX ────────────────────────────────── */
.info-box {
  background: var(--violet-light);
  border: 1px solid rgba(108,92,231,.15);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-size: 12.5px; color: var(--text-muted); line-height: 1.6;
}
.info-box strong { color: var(--violet); }

/* =============================================
   MODALS
   ============================================= */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(19,18,43,.55);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--sh-modal);
  display: flex; flex-direction: column;
  max-height: 90vh; overflow: hidden;
  width: 100%;
  animation: slideUp .22s cubic-bezier(.32,.72,0,1);
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-lead { max-width: 820px; }
.modal-sm   { max-width: 460px; }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h2 {
  font-size: 16px; font-weight: 800;
  letter-spacing: -.025em; color: var(--text);
}

.modal-close {
  background: var(--surface2); border: 1px solid var(--border);
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--text-muted);
  cursor: pointer; transition: background .12s, color .12s; line-height: 1;
}
.modal-close:hover { background: var(--c-cancel-bg); color: var(--c-cancel); }

.modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface2);
}

/* ─── LEAD DETAIL ─────────────────────────────── */
.lead-detail-layout {
  display: grid; grid-template-columns: 1fr 196px; gap: 20px;
}
.lead-detail-side { display: flex; flex-direction: column; gap: 12px; }

.lead-info-card {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 18px;
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; text-align: center;
}

.lead-avatar-big {
  width: 64px; height: 64px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
}

.lead-meta {
  font-size: 11.5px; color: var(--text-muted);
  line-height: 2.1; width: 100%; text-align: left;
}

.lead-actions-panel { display: flex; flex-direction: column; gap: 7px; }
.btn-action {
  width: 100%; padding: 9px 12px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text-muted);
  font-size: 12.5px; font-weight: 500; font-family: var(--font);
  cursor: pointer; transition: all .12s; text-align: left;
  box-shadow: var(--sh-xs);
}
.btn-action:hover { background: var(--surface2); border-color: var(--border2); }
.btn-action.btn-whatsapp:hover { border-color: rgba(16,185,129,.3); color: var(--c-real); background: var(--c-real-bg); }
.btn-action.btn-calendar:hover { border-color: rgba(139,92,246,.25); color: var(--c-agend); background: var(--c-agend-bg); }
.btn-action.btn-danger:hover   { border-color: rgba(239,68,68,.25); color: var(--c-cancel); background: var(--c-cancel-bg); }

/* =============================================
   TOAST
   ============================================= */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--r); padding: 12px 18px;
  font-size: 13px; font-weight: 500;
  box-shadow: var(--sh-lg);
  opacity: 0; transform: translateY(8px) scale(.97);
  transition: all .22s cubic-bezier(.32,.72,0,1);
  pointer-events: none; max-width: 300px; color: var(--text);
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast.success { border-left: 3px solid var(--c-real); }
.toast.error   { border-left: 3px solid var(--c-cancel); }
.toast.info    { border-left: 3px solid var(--c-agend); }

/* =============================================
   EMPTY STATE
   ============================================= */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  padding: 28px 16px; color: var(--text-dim);
  font-size: 12px; font-weight: 500; text-align: center; gap: 8px;
}
.empty-state .empty-icon { font-size: 28px; opacity: .4; }

/* =============================================
   SCROLLBARS
   ============================================= */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--violet); }

/* ─── ADMIN INFO / LOGOUT ─────────────────────── */
.admin-info {
  margin-top: 10px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.admin-email {
  font-size: 10.5px; color: var(--sb-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1;
}
.btn-logout {
  display: inline-flex; align-items: center; gap: 5px;
  background: transparent; border: 1px solid rgba(255,255,255,.12);
  color: var(--sb-text); border-radius: var(--r-xs);
  padding: 4px 9px; font-size: 11.5px; font-family: var(--font);
  cursor: pointer; transition: background .12s, color .12s;
  white-space: nowrap; flex-shrink: 0;
}
.btn-logout:hover { background: rgba(239,68,68,.15); color: #fca5a5; border-color: rgba(239,68,68,.3); }

/* ─── FOCUS ───────────────────────────────────── */
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
