/* ==========================================================================
   LUMINA ESTÉTICA AI — DESIGN SYSTEM PREMIUM (Dark Velvet Rose & Champagne)
   ========================================================================== */

:root {
  /* Paleta Primária Luxo */
  --bg-main: #0B0E14;
  --bg-sidebar: #07090D;
  --bg-card: rgba(18, 23, 33, 0.75);
  --bg-card-hover: rgba(28, 35, 48, 0.85);
  --bg-card-solid: #131822;
  --bg-input: rgba(14, 18, 26, 0.9);
  
  /* Acentos de Luxo */
  --gold-primary: #D4AF37;
  --gold-light: #F3E5AB;
  --gold-dark: #997A15;
  --gold-gradient: linear-gradient(135deg, #E6C280 0%, #D4AF37 50%, #AA8010 100%);
  --gold-glow: rgba(212, 175, 55, 0.25);

  --rose-primary: #E0A899;
  --rose-light: #F4D5CC;
  --rose-dark: #B87B6C;
  --rose-gradient: linear-gradient(135deg, #F4D5CC 0%, #E0A899 50%, #B87B6C 100%);

  /* Status Colors */
  --status-online: #10B981;
  --status-alert: #F59E0B;
  --status-danger: #EF4444;
  --status-cyan: #06B6D4;

  /* Bordas e Vidro */
  --border-subtle: rgba(212, 175, 55, 0.15);
  --border-active: rgba(212, 175, 55, 0.45);
  --glass-blur: blur(16px);
  --shadow-lux: 0 10px 30px -5px rgba(0, 0, 0, 0.6), 0 0 20px 0 rgba(212, 175, 55, 0.08);

  /* Tipografia */
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-brand: 'Cinzel', serif;

  /* Textos */
  --text-main: #F3F4F6;
  --text-muted: #9CA3AF;
  --text-dim: #6B7280;
}

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

body.dark-theme {
  font-family: var(--font-main);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(224, 168, 153, 0.03) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(212, 175, 55, 0.04) 0%, transparent 50%);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ================= TEMA CLARO (LIGHT THEME LUXO) ================= */
body.light-theme {
  --bg-main: #F8F5F0;
  --bg-sidebar: #FFFFFF;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: #FFFFFF;
  --bg-card-solid: #FFFFFF;
  --bg-input: #FDFBF8;

  --gold-primary: #B88A14;
  --gold-light: #7A5B07;
  --gold-dark: #5A4302;
  --gold-gradient: linear-gradient(135deg, #ECC87A 0%, #D4AF37 50%, #B88A14 100%);
  --gold-glow: rgba(184, 138, 20, 0.15);

  --rose-primary: #C57E6E;
  --rose-light: #8E4A3B;
  --rose-dark: #6C3225;
  --rose-gradient: linear-gradient(135deg, #F9DDD6 0%, #E0A899 50%, #C57E6E 100%);

  --border-subtle: rgba(184, 138, 20, 0.16);
  --border-active: rgba(184, 138, 20, 0.45);
  --shadow-lux: 0 10px 30px -5px rgba(184, 138, 20, 0.1), 0 4px 15px rgba(0, 0, 0, 0.04);

  --text-main: #1C222C;
  --text-muted: #576274;
  --text-dim: #8B95A5;

  font-family: var(--font-main);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(224, 168, 153, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(212, 175, 55, 0.08) 0%, transparent 50%);
  transition: background-color 0.3s ease, color 0.3s ease;
}

body.light-theme .top-header {
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid var(--border-subtle);
}

body.light-theme .chat-bubble.incoming {
  background: #EAE6DF;
  color: #1A202C;
}

body.light-theme .chat-window-header,
body.light-theme .chat-input-bar {
  background: rgba(255, 255, 255, 0.9);
}

body.light-theme .timeline-slot {
  background: #FFFFFF;
}

body.light-theme .apt-compact-item,
body.light-theme .log-item {
  background: #FFFFFF;
  border-color: rgba(0, 0, 0, 0.06);
}

/* Botão de Alternância de Tema */
.btn-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-theme-toggle:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--gold-primary);
  transform: translateY(-1px);
}

.btn-theme-toggle i {
  font-size: 0.95rem;
  color: var(--gold-primary);
  transition: transform 0.3s ease;
}

body.light-theme .btn-theme-toggle {
  background: #FFFFFF;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* ================= APP LAYOUT ================= */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ================= SIDEBAR ================= */
.sidebar {
  width: 280px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  flex-shrink: 0;
  z-index: 20;
}

.brand-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px 20px 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-sidebar-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
}

.sidebar-brand-svg {
  width: 100%;
  max-width: 240px;
  height: auto;
  max-height: 85px;
  object-fit: contain;
  transition: all 0.3s ease;
}

/* Cor da logo no Tema Escuro: Dourado / Branco Iluminado */
body.dark-theme .sidebar-brand-svg,
body.dark-theme .login-brand-logo,
.dark-theme .login-brand-logo {
  filter: brightness(0) invert(1) drop-shadow(0 2px 14px rgba(212, 175, 55, 0.45));
}

/* Cor da logo no Tema Claro: Escuro / Contraste Intenso Luxo */
body.light-theme .sidebar-brand-svg,
body.light-theme .login-brand-logo,
.light-theme .login-brand-logo {
  filter: brightness(0.12) drop-shadow(0 2px 8px rgba(0, 0, 0, 0.15));
}

.sidebar-brand-svg:hover,
.login-brand-logo:hover {
  transform: scale(1.03);
}
/* Mini Persona Badge na Sidebar */
.persona-badge-mini {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  padding: 10px 14px;
  background: rgba(224, 168, 153, 0.07);
  border: 1px solid rgba(224, 168, 153, 0.2);
  border-radius: 14px;
}

.avatar-ring {
  position: relative;
  width: 40px;
  height: 40px;
}

.persona-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--rose-primary);
}

.status-dot-online {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: var(--status-online);
  border-radius: 50%;
  border: 2px solid var(--bg-sidebar);
}

.persona-mini-info {
  display: flex;
  flex-direction: column;
}

.persona-mini-info strong {
  font-size: 0.9rem;
  color: var(--text-main);
}

.persona-mini-info span {
  font-size: 0.75rem;
  color: var(--rose-primary);
}

/* Menu de Navegação */
.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
  position: relative;
}

.nav-item:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
  color: var(--gold-light);
  background: rgba(212, 175, 55, 0.1);
  border-color: rgba(212, 175, 55, 0.3);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.nav-item.active i {
  color: var(--gold-primary);
}

.nav-item i {
  font-size: 1.1rem;
  width: 20px;
}

.badge-count {
  margin-left: auto;
  background: rgba(212, 175, 55, 0.2);
  color: var(--gold-light);
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-alert-pulse {
  margin-left: auto;
  background: var(--status-alert);
  color: #000;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  animation: pulse-glow 1.5s infinite;
}

@keyframes pulse-glow {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.connection-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.78rem;
}

.connection-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-alert);
}

.connection-pill.connected .dot {
  background: var(--status-online);
}

.btn-icon-soft {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon-soft:hover {
  color: var(--gold-light);
  border-color: var(--gold-primary);
}

/* ================= MAIN CONTENT & HEADER ================= */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.top-header {
  height: 76px;
  padding: 0 32px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(11, 14, 20, 0.8);
  backdrop-filter: var(--glass-blur);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
}

.header-title-area h1 {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-main);
}

.header-title-area p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

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

.ai-toggle-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 30px;
}

.ai-toggle-label {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Switch Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #374151;
  transition: .3s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background: var(--gold-gradient);
}

input:checked + .slider:before {
  transform: translateX(20px);
  background-color: #111;
}

/* ================= BOTÕES & COMPONENTES GLOBAIS ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary-gold {
  background: var(--gold-gradient);
  color: #111;
  box-shadow: 0 4px 18px rgba(212, 175, 55, 0.35);
}

.btn-primary-gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(212, 175, 55, 0.5);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--gold-primary);
  color: var(--gold-light);
}

.btn-gold-outline {
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid var(--gold-primary);
  color: var(--gold-light);
}

.btn-gold-outline:hover {
  background: var(--gold-primary);
  color: #000;
}

.btn-danger-outline {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #FCA5A5;
}

.btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.2);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
  border-radius: 8px;
}

.btn-xs {
  padding: 4px 10px;
  font-size: 0.74rem;
  border-radius: 6px;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-pill.bg-gold {
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold-light);
  border: 1px solid rgba(212, 175, 55, 0.3);
}

.badge-pill.bg-dark-gold {
  background: rgba(212, 175, 55, 0.1);
  color: var(--gold-light);
}

.glass-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow-lux);
}

.gold-text { color: var(--gold-primary); }
.rose-text { color: var(--rose-primary); }

/* ================= TABS CONTAINER ================= */
.tabs-container {
  flex: 1;
  padding: 28px 32px;
  overflow-y: auto;
  position: relative;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease forwards;
}

.tab-pane.active {
  display: block;
}

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

/* ================= DASHBOARD STYLES ================= */
.alert-banner-attention {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.15), rgba(220, 38, 38, 0.1));
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 16px;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.15);
}

.banner-icon-pulse {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--status-alert);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  animation: pulse-glow 1.5s infinite;
}

.banner-content {
  flex: 1;
}

.banner-content strong {
  font-size: 0.96rem;
  color: #FBBF24;
}

.banner-content p {
  font-size: 0.82rem;
  color: #E5E7EB;
  margin-top: 2px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 20px;
  transition: transform 0.2s, border-color 0.2s;
}

.metric-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-active);
}

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

.metric-title {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.metric-icon-box {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.metric-icon-box.gold { background: rgba(212, 175, 55, 0.15); color: var(--gold-light); }
.metric-icon-box.rose { background: rgba(224, 168, 153, 0.15); color: var(--rose-primary); }
.metric-icon-box.alert { background: rgba(245, 158, 11, 0.15); color: #FBBF24; }
.metric-icon-box.cyan { background: rgba(6, 182, 212, 0.15); color: #67E8F9; }

.metric-value {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.metric-footer {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.dashboard-split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

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

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

.card-title h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--status-online);
  font-weight: 600;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-online);
  animation: pulse-glow 1.5s infinite;
}

.appointments-list-compact {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 380px;
  overflow-y: auto;
}

.apt-compact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  transition: all 0.2s;
}

.apt-compact-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-subtle);
}

.apt-time-badge {
  font-weight: 700;
  color: var(--gold-light);
  font-size: 0.9rem;
  min-width: 90px;
}

.apt-client-meta strong {
  display: block;
  font-size: 0.88rem;
}

.apt-client-meta span {
  font-size: 0.75rem;
  color: var(--rose-primary);
}

.empty-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--text-dim);
  text-align: center;
  gap: 8px;
}

.empty-placeholder i {
  font-size: 2rem;
  opacity: 0.4;
}

.activity-log-feed {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
}

.log-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.02);
}

.log-time {
  color: var(--text-dim);
  font-size: 0.72rem;
  white-space: nowrap;
}

.log-item.info .log-msg { color: var(--text-main); }
.log-item.success .log-msg { color: #34D399; }
.log-item.warn .log-msg { color: #FBBF24; }
.log-item.error .log-msg { color: #F87171; }

/* ================= AGENDA & TIMELINE STYLES ================= */
.agenda-layout-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
}

.agenda-sidebar-control {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.agenda-date-picker-box label {
  display: block;
  font-size: 0.84rem;
  margin-bottom: 8px;
  font-weight: 600;
}

.custom-date-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-main);
  font-family: inherit;
  outline: none;
}

.date-quick-nav {
  display: flex;
  gap: 8px;
}

.date-quick-nav button {
  flex: 1;
}

.divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 4px 0;
}

.agenda-filter-status h4 {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill-btn {
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.pill-btn.active {
  background: var(--gold-gradient);
  color: #000;
  font-weight: 600;
}

.agenda-summary-box {
  background: rgba(255, 255, 255, 0.02);
  padding: 12px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
}

.agenda-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.agenda-current-date-info h2 {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  color: var(--text-main);
}

.schedule-timeline-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 580px;
  overflow-y: auto;
  padding-right: 6px;
}

.timeline-slot {
  display: grid;
  grid-template-columns: 80px 1fr 120px;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  transition: all 0.2s;
}

.timeline-slot.free {
  border-left: 3px solid #10B981;
}

.timeline-slot.occupied {
  border-left: 3px solid var(--gold-primary);
  background: rgba(212, 175, 55, 0.04);
}

.timeline-slot.lunch {
  border-left: 3px solid #6B7280;
  opacity: 0.6;
}

.slot-time-col {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--gold-light);
}

.slot-info-col strong {
  display: block;
  font-size: 0.9rem;
}

.slot-info-col span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.slot-actions-col {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

/* ================= PROCEDIMENTOS / SERVICES ================= */
.section-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.search-filter-box {
  position: relative;
  flex: 1;
  max-width: 460px;
}

.search-filter-box .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
}

.search-filter-box input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  color: var(--text-main);
  outline: none;
  font-family: inherit;
}

.search-filter-box input:focus {
  border-color: var(--gold-primary);
}

.services-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.service-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.service-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-active);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(212, 175, 55, 0.1);
}

.service-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.service-category-tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(224, 168, 153, 0.15);
  color: var(--rose-primary);
  font-weight: 600;
}

.service-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.service-description {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 18px;
  flex: 1;
}

.service-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.service-duration-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--gold-light);
  font-weight: 600;
}

.service-price-tag {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.service-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

/* ================= CHAT COPILOTO & HANDOFF STYLES ================= */
.chat-copilot-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  height: calc(100vh - 140px);
}

.chat-contacts-sidebar {
  display: flex;
  flex-direction: column;
  padding: 16px;
  height: 100%;
}

.chat-search-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.search-input-wrap {
  position: relative;
}

.search-input-wrap i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
}

.search-input-wrap input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-main);
  outline: none;
  font-size: 0.82rem;
}

.chat-filter-tabs {
  display: flex;
  gap: 6px;
}

.chat-filter-btn {
  flex: 1;
  padding: 6px;
  font-size: 0.78rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.chat-filter-btn.active {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--gold-primary);
  color: var(--gold-light);
  font-weight: 600;
}

.badge-mini {
  background: var(--status-alert);
  color: #000;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 0.68rem;
  font-weight: 700;
}

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

.chat-contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  background: transparent;
  border: 1px solid transparent;
  position: relative;
}

.chat-contact-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.chat-contact-item.active {
  background: rgba(212, 175, 55, 0.08);
  border-color: rgba(212, 175, 55, 0.3);
}

.chat-contact-item.needs-attention {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.06);
}

.contact-avatar-box {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2D3748, #1A202C);
  color: var(--gold-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.contact-info-meta {
  flex: 1;
  min-width: 0;
}

.contact-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.contact-top-row strong {
  font-size: 0.85rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-top-row .time {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.contact-last-msg {
  font-size: 0.76rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attention-badge-indicator {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-alert);
  box-shadow: 0 0 8px var(--status-alert);
}

/* ================= CHAT COPILOTO & HANDOFF STYLES (WhatsApp Pixel-Perfect) ================= */
.chat-copilot-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  height: calc(100vh - 130px);
  min-height: 500px;
}

.chat-contacts-sidebar {
  display: flex;
  flex-direction: column;
  padding: 14px;
  height: 100%;
  overflow: hidden;
}

.chat-search-box {
  margin-bottom: 12px;
}

.chat-filter-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.chat-filter-btn {
  flex: 1;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
  white-space: nowrap;
}

.chat-filter-btn.active {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--gold-primary);
  color: var(--gold-light);
}

.chat-contacts-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 2px;
}

.chat-contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.chat-contact-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

.chat-contact-item.active {
  background: rgba(212, 175, 55, 0.1);
  border-color: rgba(212, 175, 55, 0.4);
}

.chat-contact-item.needs-attention {
  border-left: 4px solid var(--status-alert);
}

.contact-avatar-box {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2A3245 0%, #171C28 100%);
  border: 1px solid rgba(224, 168, 153, 0.3);
  color: var(--rose-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.contact-info-meta {
  flex: 1;
  min-width: 0;
}

.contact-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}

.contact-top-row strong {
  font-size: 0.86rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.contact-top-row .time {
  font-size: 0.68rem;
  color: var(--text-dim);
  flex-shrink: 0;
}

.contact-last-msg {
  font-size: 0.76rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
  line-height: 1.3;
}

.attention-badge-indicator {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-alert);
  box-shadow: 0 0 8px var(--status-alert);
}

/* Janela Principal de Conversa */
.chat-main-window {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
  overflow: hidden;
  border-radius: 20px;
}

.chat-window-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.chat-client-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.client-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gold-gradient);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.client-details {
  min-width: 0;
  flex: 1;
}

.client-details h3 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 0 2px 0;
}

.client-details span {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.chat-header-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-attention-toggle {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #FBBF24;
}

.btn-ai-toggle {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.btn-ai-toggle.paused {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #FCA5A5;
}

.chat-alert-banner {
  padding: 8px 14px;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.2), rgba(212, 175, 55, 0.1));
  border-bottom: 1px solid rgba(245, 158, 11, 0.3);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  color: #FBBF24;
  flex-shrink: 0;
}

.chat-alert-banner .banner-text {
  min-width: 0;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag-discreet {
  margin-left: auto;
  font-size: 0.68rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 8px;
  border-radius: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.chat-messages-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(rgba(224, 168, 153, 0.035) 1px, transparent 0),
    radial-gradient(rgba(212, 175, 55, 0.035) 1px, transparent 0);
  background-size: 20px 20px;
}

/* Balões WhatsApp */
.chat-bubble {
  max-width: 78%;
  min-width: 100px;
  padding: 6px 10px 4px 10px;
  font-size: 0.88rem;
  line-height: 1.38;
  position: relative;
  word-break: break-word;
  overflow-wrap: anywhere;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  animation: fadeIn 0.15s ease-out;
}

/* Balão Recebido (Cliente) */
.chat-bubble.incoming {
  align-self: flex-start;
  background: #202C33;
  color: #E9EDEF;
  border-radius: 0px 8px 8px 8px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

body.light-theme .chat-bubble.incoming {
  background: #FFFFFF;
  color: #111B21;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

/* Balão Enviado (Adriana / IA) */
.chat-bubble.outgoing {
  align-self: flex-end;
  background: #005C4B;
  color: #E9EDEF;
  border-radius: 8px 0px 8px 8px;
  border: 1px solid rgba(0, 92, 75, 0.4);
}

body.light-theme .chat-bubble.outgoing {
  background: #D9FDD3;
  color: #111B21;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.chat-bubble .bubble-sender {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  margin-bottom: 2px;
  color: var(--gold-light);
}

body.light-theme .chat-bubble.incoming .bubble-sender {
  color: #128C7E;
}

body.light-theme .chat-bubble.outgoing .bubble-sender {
  color: #075E54;
}

.chat-bubble .bubble-text {
  font-size: 0.88rem;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.chat-bubble .bubble-time {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  font-size: 0.65rem;
  margin-top: 2px;
  margin-left: 8px;
  float: right;
  color: rgba(233, 237, 239, 0.6);
}

body.light-theme .chat-bubble .bubble-time {
  color: #667781;
}

.chat-bubble.outgoing .bubble-time::after {
  content: '✓✓';
  color: #53BDEB;
  font-size: 0.7rem;
  font-weight: bold;
  letter-spacing: -2px;
  margin-left: 2px;
}

/* Botão de Apagar Mensagem */
.chat-bubble .btn-delete-msg {
  position: absolute;
  top: 3px;
  right: 3px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: #FCA5A5;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
}

.chat-bubble:hover .btn-delete-msg {
  opacity: 1;
  pointer-events: auto;
}

.chat-bubble .btn-delete-msg:hover {
  background: rgba(239, 68, 68, 0.9);
  color: #FFF;
  transform: scale(1.1);
}

/* Botão Voltar Mobile */
.btn-chat-back-mobile {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 1.1rem;
  padding: 4px 8px 4px 0;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Área de Input do Chat Estilo WhatsApp */
.chat-input-bar {
  padding: 8px 12px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.quick-replies-tray {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.quick-replies-tray::-webkit-scrollbar {
  display: none;
}

.quick-chip {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 4px 10px;
  font-size: 0.72rem;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.quick-chip:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--gold-primary);
  color: var(--gold-light);
}

.chat-input-wrapper {
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px 6px 4px 12px;
  border-radius: 24px;
  border: 1px solid var(--border-subtle);
}

.chat-input-wrapper textarea {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 8px 4px;
  background: transparent;
  border: none;
  color: var(--text-main);
  outline: none;
  font-family: inherit;
  font-size: 0.86rem;
  line-height: 1.3;
  resize: none;
}

.btn-send-msg {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 50% !important;
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9rem;
}

.btn-send-msg span {
  display: none;
}

/* ================= PERSONA & SANDBOX STYLES ================= */
.persona-settings-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
}

.form-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-main);
  outline: none;
  font-family: inherit;
  font-size: 0.88rem;
}

.form-control:focus {
  border-color: var(--gold-primary);
}

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

.working-days-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.day-checkbox-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.day-checkbox-card:hover {
  border-color: var(--gold-primary);
  color: var(--text-main);
}

.day-checkbox-card input {
  accent-color: var(--gold-primary);
}

.prompt-editor {
  font-family: 'Consolas', monospace;
  font-size: 0.82rem;
  line-height: 1.45;
}

.hint-text {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 4px;
  display: block;
}

.sandbox-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 8px 0 16px 0;
}

.sandbox-chat-box {
  height: 380px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.chat-msg {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.84rem;
  line-height: 1.4;
}

.chat-msg.user {
  align-self: flex-end;
  background: #2D3748;
  color: #FFF;
}

.chat-msg.ai {
  align-self: flex-start;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.25);
  color: var(--gold-light);
}

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

.sandbox-input-row input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-main);
  outline: none;
}

/* ================= WHATSAPP CONNECTION TAB ================= */
.whatsapp-connection-card {
  max-width: 680px;
  margin: 0 auto;
}

.wa-status-box {
  display: flex;
  align-items: center;
  gap: 32px;
}

.wa-qr-frame {
  width: 240px;
  height: 240px;
  background: #FFF;
  border-radius: 16px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

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

.qr-placeholder {
  color: #666;
  text-align: center;
  font-size: 0.85rem;
}

.qr-placeholder i {
  font-size: 2rem;
  margin-bottom: 8px;
  color: var(--gold-primary);
}

.wa-info-details {
  flex: 1;
}

.badge-status-large {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 20px;
  background: rgba(245, 158, 11, 0.15);
  color: #FBBF24;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.badge-status-large .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
}

.wa-info-details h3 {
  font-size: 1.2rem;
  margin-bottom: 6px;
}

.wa-info-details p {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 20px;
}

.wa-actions-group {
  display: flex;
  gap: 10px;
}

/* ================= MODAIS ================= */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-header h3 {
  font-size: 1.15rem;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.86rem;
}

.checkbox-label input {
  width: 18px;
  height: 18px;
  accent-color: var(--gold-primary);
}

.w-100 { width: 100%; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }
.mt-4 { margin-top: 20px; }

/* ================= BARRA DE NAVEGAÇÃO INFERIOR MOBILE (WhatsApp Style) ================= */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 62px;
  background: var(--bg-sidebar);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  z-index: 90;
  justify-content: space-around;
  align-items: center;
  padding: 0 4px;
}

.mob-nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 12px;
  transition: all 0.2s ease;
  flex: 1;
}

.mob-nav-item i {
  font-size: 1.25rem;
  transition: transform 0.2s ease;
}

.mob-nav-item.active {
  color: var(--gold-primary);
  font-weight: 700;
}

.mob-nav-item.active i {
  transform: translateY(-2px);
}

.mob-nav-item .mob-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 16px);
  background: var(--status-alert);
  color: #000;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  box-shadow: 0 0 6px var(--status-alert);
}

/* ================= RESPONSIVIDADE & MOBILE ================= */
@media (max-width: 1024px) {
  .dashboard-split-grid, .agenda-layout-grid, .persona-settings-grid {
    grid-template-columns: 1fr;
  }
  .chat-copilot-container {
    grid-template-columns: 280px 1fr;
  }
}

@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
    padding-bottom: 64px; /* Espaço para a bottom nav fixa */
    min-height: 100vh;
  }

  /* Oculta sidebar desktop no celular */
  .sidebar {
    display: none !important;
  }

  /* Exibe barra inferior estilo WhatsApp no celular */
  .mobile-bottom-nav {
    display: flex !important;
  }

  /* Cabeçalho superior mobile compacto e limpo */
  .top-header {
    height: auto;
    min-height: 56px;
    padding: 10px 14px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--bg-card);
  }

  .header-title-area h1 {
    font-size: 1.1rem;
    margin: 0;
  }

  .header-title-area p {
    display: none !important; /* Remove subtítulo para não empurrar ou estourar a tela */
  }

  .header-actions {
    gap: 8px;
  }

  .quick-clinic-status,
  .ai-toggle-box,
  #btnHeaderNewAppointment {
    display: none !important; /* Ações secundárias simplificadas no header mobile */
  }

  .main-content {
    padding: 0;
    height: calc(100vh - 62px);
  }

  .tabs-container {
    padding: 10px;
    height: 100%;
    overflow-y: auto;
  }

  /* --- CHAT COPILOTO NATIVO WHATSAPP MOBILE --- */
  #tab-chats {
    padding: 0 !important;
    height: 100%;
  }

  .chat-copilot-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    position: relative;
    overflow: hidden;
    gap: 0;
  }

  .chat-contacts-sidebar {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 12px;
    background: var(--bg-main);
    border: none;
    border-radius: 0;
  }

  /* Janela de Conversa Aberta no Mobile (Tela Cheia Nativa WhatsApp) */
  .chat-main-window {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background: var(--bg-main) !important;
    border-radius: 0 !important;
    border: none !important;
    flex-direction: column;
  }

  /* Quando uma conversa está aberta no mobile */
  .chat-copilot-container.mobile-chat-open .chat-main-window {
    display: flex !important;
  }

  .chat-window-header {
    height: 58px;
    padding: 0 10px;
    background: var(--bg-sidebar) !important;
    border-bottom: 1px solid var(--border-subtle);
    border-radius: 0 !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    z-index: 1000;
  }

  .btn-chat-back-mobile {
    display: flex !important;
    font-size: 1.25rem;
    color: var(--text-main);
    padding: 8px 10px 8px 4px;
  }

  .chat-client-info {
    gap: 8px;
    min-width: 0;
    flex: 1;
  }

  .chat-client-info .client-avatar {
    width: 38px;
    height: 38px;
    font-size: 0.9rem;
    flex-shrink: 0;
  }

  .client-details {
    min-width: 0;
    flex: 1;
  }

  .client-details h3 {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
  }

  .client-details span {
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chat-header-controls {
    gap: 4px;
    flex-shrink: 0;
  }

  .chat-header-controls .btn {
    padding: 6px 8px;
    font-size: 0.74rem;
    border-radius: 8px;
  }

  .chat-header-controls .btn span {
    display: none; /* Mantém apenas ícones elegantes no topo mobile */
  }

  .chat-messages-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px;
    background-size: 20px 20px;
  }

  .chat-bubble {
    max-width: 86%;
    font-size: 0.86rem;
  }

  .chat-input-bar {
    padding: 8px 10px 10px 10px;
    background: var(--bg-sidebar) !important;
    border-top: 1px solid var(--border-subtle);
    border-radius: 0 !important;
    flex-shrink: 0;
  }

  .quick-chip {
    font-size: 0.72rem;
    padding: 4px 10px;
  }

  /* Grids Mobile */
  .dashboard-metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .metric-card {
    padding: 12px 10px;
  }

  .metric-value {
    font-size: 1.3rem;
  }

  .services-cards-grid {
    grid-template-columns: 1fr;
  }
}

/* ================= DIAS SEM ATENDIMENTO (BLOQUEIO DE AGENDA) ================= */
.agenda-block-action {
  margin-top: 12px;
}

.btn-outline-danger {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #EF4444;
  transition: all 0.2s ease;
}

.btn-outline-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #EF4444;
  color: #F87171;
}

.btn-outline-success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #10B981;
  transition: all 0.2s ease;
}

.btn-outline-success:hover {
  background: rgba(16, 185, 129, 0.22);
  border-color: #10B981;
  color: #34D399;
}

.day-blocked-alert-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12) 0%, rgba(220, 38, 38, 0.05) 100%);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 18px rgba(239, 68, 68, 0.1);
}

.blocked-card-icon {
  font-size: 2rem;
  color: #EF4444;
  flex-shrink: 0;
}

.blocked-card-content {
  flex: 1;
}

.blocked-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.badge-blocked-pill {
  background: #EF4444;
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.blocked-card-desc {
  font-size: 0.88rem;
  color: var(--text-main);
  margin-bottom: 6px;
}

.blocked-card-ai-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.18);
  padding: 6px 10px;
  border-radius: 8px;
}

.badge-pill.bg-blocked {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #EF4444 !important;
  border: 1px solid rgba(239, 68, 68, 0.4) !important;
}

.quick-block-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 16px 0;
}

.quick-block-chips .chip-opt {
  font-size: 0.76rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-block-chips .chip-opt:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--gold-primary);
  color: var(--gold-primary);
}


/* ==========================================================================
   BIBLIOTECA DE MÍDIA — fotos, vídeos e áudios que a IA envia às clientes
   ========================================================================== */

.midia-intro {
  display: flex; flex-wrap: wrap; gap: 24px; align-items: center;
  justify-content: space-between; padding: 22px 26px; margin-bottom: 22px;
}
.midia-intro-text { flex: 1 1 320px; }
.midia-intro-text h3 {
  font-family: var(--font-serif); font-size: 1.25rem; color: var(--gold-light);
  margin-bottom: 6px; display: flex; align-items: center; gap: 10px;
}
.midia-intro-text p { color: var(--text-muted); font-size: 0.92rem; line-height: 1.6; max-width: 62ch; }

.midia-stats { display: flex; gap: 14px; flex-wrap: wrap; }
.midia-stat {
  background: var(--bg-input); border: 1px solid var(--border-subtle);
  border-radius: 14px; padding: 12px 18px; min-width: 92px; text-align: center;
}
.midia-stat strong { display: block; font-size: 1.5rem; color: var(--gold-primary); line-height: 1.1; }
.midia-stat span { font-size: 0.72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; }

.midia-filtros { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-filtro {
  background: var(--bg-input); border: 1px solid var(--border-subtle); color: var(--text-muted);
  padding: 9px 16px; border-radius: 999px; cursor: pointer; font-size: 0.85rem;
  font-family: var(--font-main); display: inline-flex; align-items: center; gap: 7px;
  transition: all 0.2s ease;
}
.chip-filtro:hover { border-color: var(--border-active); color: var(--text-main); }
.chip-filtro.active { background: var(--gold-gradient); color: #1A1206; border-color: transparent; font-weight: 600; }

.midia-dropzone {
  border: 2px dashed var(--border-subtle); border-radius: 18px;
  padding: 34px 20px; text-align: center; cursor: pointer; margin-bottom: 22px;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  transition: all 0.25s ease; background: rgba(212, 175, 55, 0.03);
}
.midia-dropzone:hover, .midia-dropzone.arrastando {
  border-color: var(--gold-primary); background: rgba(212, 175, 55, 0.09);
}
.midia-dropzone i { font-size: 2rem; color: var(--gold-primary); margin-bottom: 4px; }
.midia-dropzone strong { color: var(--text-main); font-size: 1rem; }
.midia-dropzone span { color: var(--text-dim); font-size: 0.82rem; }

.midia-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px;
}
.midia-card {
  background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 16px;
  overflow: hidden; backdrop-filter: var(--glass-blur); transition: all 0.25s ease;
  display: flex; flex-direction: column;
}
.midia-card:hover { transform: translateY(-3px); border-color: var(--border-active); box-shadow: var(--shadow-lux); }
.midia-card.inativa { opacity: 0.45; }

.midia-preview {
  height: 155px; background: var(--bg-sidebar); display: flex; align-items: center;
  justify-content: center; position: relative; overflow: hidden;
}
.midia-preview img, .midia-preview video { width: 100%; height: 100%; object-fit: cover; }
.midia-preview .icone-audio { font-size: 2.6rem; color: var(--rose-primary); }
.midia-badge-tipo {
  position: absolute; top: 9px; left: 9px; background: rgba(0,0,0,0.72);
  color: var(--gold-light); font-size: 0.68rem; padding: 4px 9px; border-radius: 7px;
  text-transform: uppercase; letter-spacing: 0.05em; backdrop-filter: blur(4px);
}
.midia-badge-envios {
  position: absolute; top: 9px; right: 9px; background: rgba(16, 185, 129, 0.88);
  color: #04281D; font-size: 0.68rem; padding: 4px 9px; border-radius: 7px; font-weight: 700;
}

.midia-corpo { padding: 13px 15px; flex: 1; display: flex; flex-direction: column; gap: 7px; }
.midia-titulo { font-weight: 600; font-size: 0.93rem; color: var(--text-main); line-height: 1.35; }
.midia-vinculos { display: flex; flex-wrap: wrap; gap: 5px; }
.midia-tag {
  background: rgba(224, 168, 153, 0.14); color: var(--rose-light);
  font-size: 0.7rem; padding: 3px 9px; border-radius: 6px;
}
.midia-tag.sem-vinculo { background: rgba(245, 158, 11, 0.16); color: var(--status-alert); }
.midia-acoes { display: flex; gap: 7px; padding: 0 15px 14px; }
.midia-acoes button {
  flex: 1; background: var(--bg-input); border: 1px solid var(--border-subtle);
  color: var(--text-muted); padding: 8px; border-radius: 9px; cursor: pointer;
  font-size: 0.8rem; transition: all 0.2s ease; font-family: var(--font-main);
}
.midia-acoes button:hover { color: var(--text-main); border-color: var(--border-active); }
.midia-acoes button.perigo:hover { color: var(--status-danger); border-color: var(--status-danger); }

.midia-vazio { text-align: center; padding: 56px 20px; color: var(--text-dim); }
.midia-vazio i { font-size: 3rem; margin-bottom: 14px; display: block; color: var(--border-subtle); }
.midia-vazio p { max-width: 46ch; margin: 0 auto; line-height: 1.6; }

.midia-progresso {
  height: 5px; background: var(--bg-input); border-radius: 999px;
  overflow: hidden; margin-bottom: 18px; display: none;
}
.midia-progresso.ativo { display: block; }
.midia-progresso-barra { height: 100%; width: 0; background: var(--gold-gradient); transition: width 0.3s ease; }

@media (max-width: 640px) {
  .midia-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .midia-preview { height: 115px; }
  .midia-intro { padding: 18px; }
}

.checkbox-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px;
  max-height: 190px; overflow-y: auto; padding: 10px;
  background: var(--bg-input); border: 1px solid var(--border-subtle); border-radius: 12px;
}
.checkbox-linha {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  padding: 7px 9px; border-radius: 8px; font-size: 0.85rem; color: var(--text-muted);
  transition: background 0.18s ease;
}
.checkbox-linha:hover { background: rgba(212, 175, 55, 0.08); color: var(--text-main); }
.checkbox-linha input { accent-color: var(--gold-primary); width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; }
.form-group label small { color: var(--text-dim); font-weight: 400; font-size: 0.76rem; }

/* Campos do modal de mídia ocupando a largura toda */
#modalMidia .modal-content { max-width: 620px; width: 94%; }
#modalMidia .form-group { margin-bottom: 16px; }
#modalMidia .form-group > label { display: block; margin-bottom: 7px; font-size: 0.88rem; color: var(--text-main); }
#modalMidia input[type="text"],
#modalMidia textarea {
  width: 100%; display: block; background: var(--bg-input); color: var(--text-main);
  border: 1px solid var(--border-subtle); border-radius: 10px; padding: 11px 13px;
  font-family: var(--font-main); font-size: 0.9rem; resize: vertical;
}
#modalMidia input[type="text"]:focus,
#modalMidia textarea:focus { outline: none; border-color: var(--gold-primary); }
#modalMidia .modal-body { padding: 20px 24px; max-height: 68vh; overflow-y: auto; }
