/* ============================================
   YASMIN BEAUTY STUDIO - DASHBOARD
   Dark Mode Premium + Micro-Animations
   ============================================ */

:root {
  /* Dark palette */
  --bg-deep: #0C0C10;
  --bg-base: #111118;
  --bg-surface: #1A1A24;
  --bg-elevated: #22222E;
  --bg-hover: #2A2A38;

  /* Brand — Goiaba */
  --brand-primary: #C9A27E;
  --brand-light: #E2C7A9;
  --brand-dark: #A7805C;
  --brand-glow: rgba(209, 129, 119, 0.15);
  --brand-glow-strong: rgba(209, 129, 119, 0.3);
  --brand-gradient: linear-gradient(135deg, #C9A27E, #E2C7A9);

  /* Accent — Champagne */
  --accent: #E8D5B8;
  --accent-muted: rgba(232, 213, 184, 0.1);

  /* Text */
  --text-primary: #EEECEA;
  --text-secondary: #9896A3;
  --text-muted: #5E5C6B;

  /* Borders */
  --border: rgba(255, 255, 255, 0.06);
  --border-active: rgba(209, 129, 119, 0.3);

  /* Status */
  --success: #4ADE80;
  --success-bg: rgba(74, 222, 128, 0.1);
  --warning: #FACC15;
  --warning-bg: rgba(250, 204, 21, 0.1);
  --danger: #F87171;
  --danger-bg: rgba(248, 113, 113, 0.1);
  --info: #60A5FA;
  --info-bg: rgba(96, 165, 250, 0.1);

  /* Effects */
  --glass-blur: 20px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px var(--brand-glow);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ================= RESET & BASE ================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Animated background gradient */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  right: -30%;
  width: 80%;
  height: 80%;
  background: radial-gradient(circle, var(--brand-glow) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  animation: ambientGlow 20s ease-in-out infinite alternate;
}

@keyframes ambientGlow {
  0% { transform: translate(0, 0) scale(1); opacity: 0.4; }
  50% { transform: translate(-10%, 10%) scale(1.1); opacity: 0.6; }
  100% { transform: translate(5%, -5%) scale(0.9); opacity: 0.3; }
}

/* ================= UTILITY CLASSES ================= */
.glass {
  background: rgba(26, 26, 36, 0.8);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.glass-dark {
  background: rgba(17, 17, 24, 0.95);
  backdrop-filter: blur(var(--glass-blur));
  border-right: 1px solid var(--border);
}

.screen {
  display: none;
  height: 100vh;
  width: 100vw;
  position: relative;
  z-index: 1;
}
.screen.active {
  display: flex;
}

/* ================= BUTTONS ================= */
.btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 600;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.btn:hover::after { opacity: 1; }

.btn.primary {
  background: var(--brand-gradient);
  color: white;
  box-shadow: 0 4px 16px var(--brand-glow);
}
.btn.primary:hover {
  box-shadow: 0 6px 24px var(--brand-glow-strong);
  transform: translateY(-1px);
}
.btn.primary:active { transform: translateY(0); }
.btn.primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn.secondary {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn.secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-active);
}

.btn.danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.2);
}
.btn.danger:hover { background: rgba(248, 113, 113, 0.2); }

.btn.icon-only {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* ================= LOGIN ================= */
#login-screen {
  justify-content: center;
  align-items: center;
  background: var(--bg-deep);
}

.login-card {
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: loginSlideUp 0.6s var(--transition-slow);
}

@keyframes loginSlideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-card .logo {
  margin-bottom: 28px;
}
.login-card .logo img {
  max-width: 140px;
  height: auto;
  filter: brightness(1.1);
}

.login-card h2 {
  margin-bottom: 8px;
  color: var(--brand-light);
  font-size: 22px;
  font-weight: 700;
}
.login-card p {
  color: var(--text-muted);
  margin-bottom: 36px;
  font-size: 14px;
}

.input-group {
  position: relative;
  margin-bottom: 24px;
}
.input-group i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 18px;
  transition: color var(--transition-base);
}
.input-group:focus-within i {
  color: var(--brand-primary);
}
.input-group input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px 14px 48px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: all var(--transition-base);
}
.input-group input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

.login-card .btn.primary {
  width: 100%;
  padding: 14px;
  font-size: 15px;
}

.login-error {
  animation: shake 0.4s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

/* ================= APP LAYOUT ================= */
#app-screen {
  background: var(--bg-deep);
}

.sidebar {
  width: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
  z-index: 10;
  transition: width var(--transition-slow);
}

.brand {
  margin-bottom: 32px;
  padding: 8px;
}
.brand img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: brightness(1.1);
  transition: transform var(--transition-base);
}
.brand img:hover {
  transform: scale(1.1);
}

.nav-links {
  list-style: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  padding: 0 10px;
}

.nav-links li {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 22px;
  transition: all var(--transition-base);
  position: relative;
}

.nav-links li:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.nav-links li.active {
  background: var(--brand-glow);
  color: var(--brand-primary);
}
.nav-links li.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: var(--brand-gradient);
  border-radius: var(--radius-full);
}

/* Tooltip */
.nav-links li[title]::after {
  content: attr(title);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  z-index: 100;
}
.nav-links li[title]:hover::after {
  opacity: 1;
}

.nav-bottom {
  margin-top: auto;
  padding: 0 10px;
}
.nav-bottom button {
  width: 48px;
  height: 48px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-bottom button:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

.content-area {
  flex: 1;
  padding: 20px 24px 20px 16px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tab-content {
  display: none;
  height: 100%;
  animation: tabFadeIn 0.35s ease;
  flex-direction: column;
}
.tab-content.active {
  display: flex;
}

@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================= KPI CARDS ================= */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
  flex-shrink: 0;
}

.kpi-card {
  padding: 20px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--brand-gradient);
  opacity: 0;
  transition: opacity var(--transition-base);
}
.kpi-card:hover {
  border-color: var(--border-active);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}
.kpi-card:hover::before { opacity: 1; }

.kpi-card .kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.kpi-card .kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.kpi-icon.chat { background: var(--info-bg); color: var(--info); }
.kpi-icon.contacts { background: var(--success-bg); color: var(--success); }
.kpi-icon.hot { background: var(--danger-bg); color: var(--danger); }
.kpi-icon.bot { background: var(--brand-glow); color: var(--brand-primary); }

.kpi-card .kpi-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.kpi-card .kpi-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.kpi-card .kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* ================= CHAT ================= */
.chat-layout {
  display: flex;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.conversations-list {
  width: 340px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.conversations-list header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}
.conversations-list header .list-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.conversations-list h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}
.conversations-list .msg-count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 2px 10px;
  border-radius: var(--radius-full);
}

.search-box {
  position: relative;
}
.search-box i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
}
.search-box input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px 10px 38px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: all var(--transition-base);
  font-family: inherit;
}
.search-box input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px var(--brand-glow);
}
.search-box input::placeholder { color: var(--text-muted); }

#contacts-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
}

.contact-item {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  gap: 12px;
  align-items: center;
}
.contact-item:hover {
  background: var(--bg-hover);
}
.contact-item.active {
  background: var(--brand-glow);
  border-left: 3px solid var(--brand-primary);
}

.avatar {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  color: var(--brand-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
  border: 2px solid var(--border);
}

.contact-item.active .avatar {
  border-color: var(--brand-primary);
}

.contact-item-info {
  flex: 1;
  overflow: hidden;
  min-width: 0;
}
.contact-item-info .top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  gap: 8px;
}
.contact-item-info .name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}
.contact-item-info .time {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.contact-item-info .last-msg {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Unread conversation indicator */
.contact-item.unread {
  background: rgba(76, 175, 80, 0.06);
}
.contact-item.unread .name {
  font-weight: 800;
  color: #fff;
}
.contact-item.unread .time {
  color: var(--brand-primary);
  font-weight: 700;
}
.contact-item.unread .last-msg {
  color: var(--text-primary);
  font-weight: 600;
}

.unread-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #4caf50;
  border: 2px solid var(--bg-card);
  animation: pulse-dot 2s ease-in-out infinite;
}


.unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  background: #4caf50;
  color: white;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
  margin-left: auto;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.4); }
  50% { box-shadow: 0 0 0 6px transparent; }
}

/* Chat Window */
.chat-window {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.chat-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(26, 26, 36, 0.6);
  flex-shrink: 0;
}
.contact-info {
  display: flex;
  align-items: center;
  gap: 14px;
}
.contact-info h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}
.contact-info p {
  font-size: 12px;
  color: var(--text-muted);
}
.online-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--success);
  margin-right: 6px;
  animation: pulse 2s ease-in-out infinite;
}

.control-panel {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-badge {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  display: none;
  letter-spacing: 0.3px;
}
.status-badge.bot {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(74, 222, 128, 0.2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.status-badge.human {
  background: var(--brand-glow);
  color: var(--brand-light);
  border: 1px solid var(--border-active);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Messages */
.messages-area {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-deep);
}

.empty-state {
  margin: auto;
  text-align: center;
  color: var(--text-muted);
}
.empty-state i {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.3;
  color: var(--brand-primary);
}
.empty-state p { font-size: 14px; }

.msg-bubble {
  max-width: 65%;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 13.5px;
  line-height: 1.5;
  position: relative;
  animation: msgSlideIn 0.25s ease;
  word-wrap: break-word;
}

@keyframes msgSlideIn {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.msg-bubble.incoming {
  align-self: flex-start;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  color: var(--text-primary);
}

.msg-bubble.outgoing {
  align-self: flex-end;
  background: var(--brand-dark);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px var(--brand-glow);
}
.msg-bubble.operator {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-dark));
  border: none;
}

.msg-time {
  font-size: 10px;
  opacity: 0.6;
  margin-top: 4px;
  text-align: right;
  display: block;
}

/* Chat images */
.chat-image {
  max-width: 280px;
  max-height: 300px;
  border-radius: 8px;
  cursor: pointer;
  display: block;
  margin-bottom: 4px;
  transition: transform 0.2s;
  object-fit: cover;
}
.chat-image:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.image-placeholder {
  font-style: italic;
  opacity: 0.7;
}

.msg-date-divider {
  text-align: center;
  padding: 8px 0;
  font-size: 11px;
  color: var(--text-muted);
  position: relative;
}
.msg-date-divider span {
  background: var(--bg-deep);
  padding: 0 12px;
  position: relative;
  z-index: 1;
}
.msg-date-divider::before {
  content: '';
  position: absolute;
  left: 20%;
  right: 20%;
  top: 50%;
  height: 1px;
  background: var(--border);
}

/* Compose */
.compose-area {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: rgba(26, 26, 36, 0.6);
  flex-shrink: 0;
}
#send-form {
  display: flex;
  gap: 12px;
}
#send-form input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: all var(--transition-base);
}
#send-form input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px var(--brand-glow);
}
#send-form input::placeholder { color: var(--text-muted); }
#send-form input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
#send-form button {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-sm);
  font-size: 18px;
}

/* ================= CRM ================= */
.crm-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.crm-header {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.crm-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}
.crm-header .crm-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 12px;
  font-weight: 400;
}
.filters {
  display: flex;
  gap: 10px;
  align-items: center;
}
.filters select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  outline: none;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-base);
}
.filters select:focus {
  border-color: var(--brand-primary);
}
.filters .search-box {
  width: 200px;
}
.filters .search-box input {
  padding: 8px 12px 8px 36px;
  font-size: 13px;
}

.crm-table-container {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.crm-table {
  width: 100%;
  border-collapse: collapse;
}
.crm-table th {
  text-align: left;
  padding: 14px 20px;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  z-index: 5;
  cursor: pointer;
  transition: color var(--transition-fast);
}
.crm-table th:hover {
  color: var(--brand-primary);
}
.crm-table th .sort-icon {
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.5;
}

.crm-table td {
  padding: 14px 20px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
.crm-table td:first-child {
  color: var(--text-primary);
  font-weight: 500;
}
.crm-table tr.crm-row {
  cursor: pointer;
  transition: background var(--transition-fast);
}
.crm-table tr.crm-row:hover {
  background: var(--bg-hover);
}
.crm-table tr.crm-row.expanded {
  background: var(--brand-glow);
  border-left: 3px solid var(--brand-primary);
}

.crm-chevron {
  font-size: 14px;
  color: var(--text-muted);
  transition: transform 0.3s ease;
  vertical-align: middle;
  margin-left: 6px;
}
.crm-row.expanded .crm-chevron {
  transform: rotate(180deg);
  color: var(--brand-primary);
}

/* Expandable Drawer */
.crm-drawer-row {
  display: none;
}
.crm-drawer-row.open {
  display: table-row;
}
.crm-drawer-row td {
  padding: 0 !important;
  border-top: none !important;
}

.crm-drawer {
  overflow: hidden;
  animation: drawerSlide 0.3s ease-out;
  background: rgba(26, 26, 36, 0.5);
  border-bottom: 2px solid var(--brand-primary);
  padding: 20px 24px;
}

@keyframes drawerSlide {
  from { max-height: 0; opacity: 0; padding: 0 24px; }
  to { max-height: 500px; opacity: 1; padding: 20px 24px; }
}

.drawer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.drawer-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.drawer-field {
  display: flex;
  gap: 8px;
  align-items: center;
}

.drawer-label {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 120px;
}

.drawer-value {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

.drawer-edit {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.drawer-edit .form-group {
  margin-bottom: 0;
}

.drawer-edit label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.drawer-edit select,
.drawer-edit input,
.drawer-edit textarea {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
}

.drawer-edit textarea {
  resize: vertical;
  min-height: 42px;
}

.btn-sm {
  padding: 6px 16px;
  font-size: 12px;
  align-self: flex-start;
}

.drawer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 4px;
}

.verified-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.verified-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--success, #22c55e);
  cursor: pointer;
}

.check-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.verified-badge {
  font-size: 14px;
  margin-left: 6px;
  vertical-align: middle;
}

@media (max-width: 768px) {
  .drawer-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* Badges */
.badge {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.badge.hot { background: var(--danger-bg); color: var(--danger); }
.badge.warm { background: var(--warning-bg); color: var(--warning); }
.badge.cold { background: var(--info-bg); color: var(--info); }

.badge.type-pessoal { background: var(--info-bg); color: var(--info); }
.badge.type-salao { background: rgba(168, 85, 247, 0.1); color: #A855F7; }
.badge.type-distribuidor { background: var(--success-bg); color: var(--success); }

/* ================= STATS TAB ================= */
.stats-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
  overflow-y: auto;
  padding-right: 8px;
}

.stats-header {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.stats-header h2 {
  font-size: 18px;
  font-weight: 700;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.stat-card {
  padding: 24px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border);
}
.stat-card h4 {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chart-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chart-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chart-bar-label {
  width: 100px;
  font-size: 12px;
  color: var(--text-secondary);
  text-align: right;
  flex-shrink: 0;
}
.chart-bar-track {
  flex: 1;
  height: 24px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}
.chart-bar-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  background: var(--brand-gradient);
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.chart-bar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15));
}
.chart-bar-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  width: 40px;
  flex-shrink: 0;
}

.donut-chart {
  display: flex;
  align-items: center;
  gap: 24px;
}
.donut-visual {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}
.donut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.donut-center .donut-total {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}
.donut-center .donut-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

/* ================= MODAL ================= */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 100;
  justify-content: center;
  align-items: center;
}
.modal.active {
  display: flex;
  animation: modalFadeIn 0.2s ease;
}
@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  width: 100%;
  max-width: 480px;
  animation: modalSlideUp 0.3s ease;
  box-shadow: var(--shadow-lg);
}
@keyframes modalSlideUp {
  from { transform: translateY(20px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}
.close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 20px;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.close-modal:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.modal-body {
  padding: 24px;
}
.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.form-group select,
.form-group input,
.form-group textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  outline: none;
  font-family: inherit;
  font-size: 13px;
  transition: all var(--transition-base);
}
.form-group select:focus,
.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px var(--brand-glow);
}
.form-group select option {
  background: var(--bg-surface);
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 28px;
}

/* ================= TOAST NOTIFICATIONS ================= */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 280px;
  animation: toastSlideIn 0.3s ease;
  backdrop-filter: blur(20px);
}
.toast.leaving {
  animation: toastSlideOut 0.3s ease forwards;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }

.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
}

@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes toastSlideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* ================= SCROLLBARS ================= */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.15);
}

/* ================= RESPONSIVE ================= */
@media (max-width: 1200px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .kpi-row { grid-template-columns: 1fr; }
  .chat-layout { flex-direction: column; }
  .conversations-list { width: 100%; max-height: 40vh; }
  .sidebar { width: 56px; }
}

/* ============================================================
   CAMPAIGNS TAB
   ============================================================ */

.campaign-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  flex-wrap: wrap;
  gap: 12px;
}

.campaign-header-actions {
  display: flex;
  gap: 8px;
}

.campaign-usage {
  display: flex;
  align-items: center;
  gap: 12px;
}

.usage-label {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.usage-bar {
  width: 200px;
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
}

.usage-fill {
  height: 100%;
  background: var(--accent, #22c55e);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.usage-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 100px;
}

/* Campaign Cards */
.campaigns-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  padding: 8px 0;
}

.campaign-card {
  background: var(--card-bg, rgba(255,255,255,0.05));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.campaign-card:hover {
  border-color: rgba(255,255,255,0.2);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.campaign-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.campaign-card-header h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.campaign-card-template {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.campaign-card-metrics {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.campaign-card-metrics span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.campaign-progress-bar {
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 12px;
}

.campaign-progress-fill {
  height: 100%;
  background: var(--accent, #22c55e);
  border-radius: 2px;
  transition: width 0.5s ease;
}

.campaign-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.campaign-card-footer small {
  color: var(--text-muted, rgba(255,255,255,0.4));
  font-size: 11px;
}

/* Campaign Panel */
.campaign-panel {
  background: var(--card-bg, rgba(255,255,255,0.05));
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 24px;
  max-width: 700px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.panel-header h3 {
  margin: 0;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-section {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 16px;
  margin: 16px 0;
}

.filter-section h4 {
  margin: 0 0 12px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  cursor: pointer;
}

.preview-count {
  margin-top: 12px;
  padding: 10px 16px;
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.2);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #22c55e;
  display: flex;
  align-items: center;
  gap: 8px;
}

.schedule-options {
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
}

.schedule-options label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  cursor: pointer;
}

/* Campaign Detail */
.campaign-detail {
  max-width: 900px;
}

.detail-metrics {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin: 20px 0;
}

.metric-card {
  background: var(--card-bg, rgba(255,255,255,0.05));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.metric-card.error {
  border-color: rgba(239,68,68,0.3);
}

.metric-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

.metric-card.error .metric-value {
  color: #ef4444;
}

.metric-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.detail-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.progress-bar {
  flex: 1;
  height: 10px;
  background: rgba(255,255,255,0.1);
  border-radius: 5px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #3b82f6);
  border-radius: 5px;
  transition: width 0.5s ease;
}

.detail-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.btn.danger {
  background: rgba(239,68,68,0.15);
  color: #ef4444;
  border: 1px solid rgba(239,68,68,0.3);
}

.btn.danger:hover {
  background: rgba(239,68,68,0.25);
}

/* Recipients Grid */
.recipients-grid {
  max-height: 400px;
  overflow-y: auto;
}

.recipient-row {
  display: grid;
  grid-template-columns: 30px 1fr 150px 150px;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 13px;
  align-items: center;
}

.recipient-row:hover {
  background: rgba(255,255,255,0.03);
}

/* CSV Modal */
.csv-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.csv-modal-content {
  background: var(--bg-secondary, #1e1e2e);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 600px;
}

.csv-dropzone {
  border: 2px dashed rgba(255,255,255,0.2);
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin: 16px 0;
}

.csv-dropzone:hover, .csv-dropzone.dragover {
  border-color: var(--accent, #22c55e);
  background: rgba(34,197,94,0.05);
}

.csv-dropzone i {
  font-size: 48px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.csv-preview-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 12px;
}

.csv-preview-table th {
  background: rgba(255,255,255,0.05);
  padding: 8px;
  text-align: left;
  font-weight: 600;
}

.csv-preview-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.empty-state {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px;
  font-size: 14px;
}

.empty-state i {
  font-size: 48px;
  display: block;
  margin-bottom: 8px;
  opacity: 0.5;
}

@media (max-width: 768px) {
  .campaign-header { flex-direction: column; }
  .detail-metrics { grid-template-columns: repeat(3, 1fr); }
  .filter-grid { grid-template-columns: 1fr; }
  .recipient-row { grid-template-columns: 30px 1fr 120px; }
}

/* =================== INSTAGRAM TAB =================== */
.ig-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-radius: 16px;
  margin-bottom: 20px;
}

.ig-header h2 {
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #E1306C, #F77737, #FCAF45);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.ig-header-actions {
  display: flex;
  gap: 10px;
}

.ig-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-icon.ig-posts { background: linear-gradient(135deg, #E1306C20, #E1306C40); color: #E1306C; }
.kpi-icon.ig-comments { background: linear-gradient(135deg, #F7773720, #F7773740); color: #F77737; }
.kpi-icon.ig-replied { background: linear-gradient(135deg, #22c55e20, #22c55e40); color: #22c55e; }
.kpi-icon.ig-pending { background: linear-gradient(135deg, #FCAF4520, #FCAF4540); color: #FCAF45; }

.ig-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.ig-filter {
  padding: 8px 18px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 24px;
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.ig-filter:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

.ig-filter.active {
  background: linear-gradient(135deg, #E1306C, #F77737);
  color: white;
  border-color: transparent;
}

.ig-table-wrapper {
  border-radius: 16px;
  overflow: hidden;
}

.ig-table {
  width: 100%;
  border-collapse: collapse;
}

.ig-table thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.ig-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.2s;
}

.ig-table tbody tr:hover {
  background: rgba(255,255,255,0.03);
}

.ig-table tbody td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-primary);
  vertical-align: middle;
}

.ig-post-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 200px;
}

.ig-post-thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.ig-post-caption {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}

.ig-user {
  font-weight: 600;
  color: #E1306C !important;
  font-size: 13px;
  white-space: nowrap;
}

.ig-comment-text {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ig-reply-text {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary) !important;
  font-style: italic;
}

.ig-no-reply {
  color: var(--text-muted);
}

.ig-time {
  font-size: 12px;
  color: var(--text-secondary) !important;
  white-space: nowrap;
}

.ig-badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.ig-badge.replied {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.ig-badge.pending {
  background: rgba(252, 175, 69, 0.15);
  color: #FCAF45;
}

.ig-row-replied { opacity: 0.7; }

.ig-loading {
  text-align: center;
  padding: 40px !important;
  color: var(--text-secondary);
  font-size: 14px;
}

.ig-loading .ph-spinner {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
  .ig-header { flex-direction: column; gap: 12px; }
  .ig-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .ig-table-wrapper { overflow-x: auto; }
}
