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

/* ════════════════════════════════════════════════════════════════ */
/* ROOT TOKENS                                                      */
/* ════════════════════════════════════════════════════════════════ */
:root {
  --bg-primary:    #F4F5F7;
  --bg-secondary:  #FFFFFF;
  --bg-tertiary:   #F9FAFB;
  --bg-hover:      #F3F4F6;

  --accent-primary:   #FC1825;
  --accent-secondary: #C8101A;
  --accent-light:     #FEE8E9;
  --accent-glow:      rgba(252, 24, 37, 0.1);

  --text-primary:   #0A0A0A;
  --text-secondary: #6B7280;
  --text-muted:     #9CA3AF;

  --border-color: #E5E7EB;
  --border-focus: #FC1825;

  --success:    #10B981;
  --success-bg: #E6F4EA;
  --warning:    #F59E0B;
  --warning-bg: #FEF3C7;
  --danger:     #FC1825;
  --danger-bg:  #FEE8E9;
  --info:       #3B82F6;
  --info-bg:    #EFF6FF;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --header-height: 64px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-premium: 0 4px 20px rgba(0,0,0,0.04);
  --shadow-hover:   0 10px 30px rgba(252,24,37,0.08);

  --transition-smooth: all 0.25s cubic-bezier(0.4,0,0.2,1);
}

/* ════════════════════════════════════════════════════════════════ */
/* RESET & BASE                                                     */
/* ════════════════════════════════════════════════════════════════ */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  min-height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ════════════════════════════════════════════════════════════════ */
/* ANIMATIONS                                                       */
/* ════════════════════════════════════════════════════════════════ */
@keyframes pulse-animation {
  0%,100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.6); }
  50%      { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
}
@keyframes pulse-animation-warning {
  0%,100% { box-shadow: 0 0 0 0 rgba(252,24,37,0.6); }
  50%      { box-shadow: 0 0 0 6px rgba(252,24,37,0); }
}
@keyframes fadeIn {
  from { opacity:0; transform:translateY(8px); }
  to   { opacity:1; transform:translateY(0); }
}
@keyframes spin {
  from { transform:rotate(0deg); }
  to   { transform:rotate(360deg); }
}
@keyframes slideUp {
  from { opacity:0; transform:translateY(24px) scale(0.97); }
  to   { opacity:1; transform:translateY(0) scale(1); }
}
@keyframes tabFadeIn {
  from { opacity:0; transform:translateY(4px); }
  to   { opacity:1; transform:translateY(0); }
}
@keyframes loginSlideUp {
  from { opacity:0; transform:translateY(30px); }
  to   { opacity:1; transform:translateY(0); }
}
@keyframes drawerSlideIn {
  from { transform:translateX(100%); }
  to   { transform:translateX(0); }
}

.spin { animation: spin 0.8s linear infinite; }

/* ════════════════════════════════════════════════════════════════ */
/* LOGIN SCREEN                                                     */
/* ════════════════════════════════════════════════════════════════ */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0d0d0d 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.login-screen.hidden { display:none; }

.login-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 40px 80px rgba(0,0,0,0.4);
  animation: loginSlideUp 0.4s ease-out;
}
.login-logo {
  height: 52px;
  object-fit: contain;
  margin-bottom: 1.5rem;
}
.login-card h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--text-primary);
}
.login-card p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 1.75rem;
}
.login-btn { width:100%; margin-top:0.5rem; }

.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.password-input-wrapper input { padding-right: 2.8rem; }
.btn-toggle-password {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  display: flex;
  align-items: center;
}
.btn-toggle-password:hover { color: var(--text-secondary); }

.error-msg {
  display: none;
  font-size: 0.8rem;
  color: var(--danger);
  margin-top: 0.35rem;
}
.error-msg.show { display: block; }

/* ════════════════════════════════════════════════════════════════ */
/* APP CONTAINER & LAYOUT                                           */
/* ════════════════════════════════════════════════════════════════ */
.app-container { display:flex; flex-direction:column; min-height:100vh; }

/* ════════════════════════════════════════════════════════════════ */
/* TOP BAR / HEADER                                                 */
/* ════════════════════════════════════════════════════════════════ */
.top-bar {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 1.75rem;
  gap: 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 8px rgba(0,0,0,0.04);
}

.brand { flex-shrink: 0; }
.brand-logo-img {
  height: 36px;
  object-fit: contain;
}

/* NAV */
.nav-menu {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex:1;
}
.nav-item button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
  white-space: nowrap;
  font-family: var(--font-sans);
}
.nav-item button svg { width:16px;height:16px;flex-shrink:0; }
.nav-item button:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active button {
  background: var(--accent-light);
  color: var(--accent-primary);
  font-weight: 600;
}

.header-actions { display:flex; align-items:center; gap:0.75rem; margin-left:auto; }

/* Connection Pill */
.connection-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border-radius: 99px;
  border: 1px solid rgba(16,185,129,0.3);
  background: rgba(16,185,129,0.06);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--success);
  white-space: nowrap;
  transition: var(--transition-smooth);
}

/* Pulse dot */
.pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse-animation 2s infinite;
  flex-shrink: 0;
}
.pulse.simulated {
  background: var(--text-muted);
  animation: none;
}

/* Logout button */
.btn-logout {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  display: flex; align-items:center; justify-content:center;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.btn-logout:hover { background: var(--accent-light); color: var(--accent-primary); border-color: var(--accent-primary); }

/* ════════════════════════════════════════════════════════════════ */
/* MAIN CONTENT                                                     */
/* ════════════════════════════════════════════════════════════════ */
.main-wrapper { flex:1; display:flex; overflow:hidden; }
.page-content {
  flex: 1;
  padding: 1.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* VIEW SECTIONS */
.view-section { display:none; flex-direction:column; gap:1.25rem; animation:tabFadeIn 0.25s ease; }
.view-section.active { display:flex; }

/* ════════════════════════════════════════════════════════════════ */
/* STATS GRID                                                       */
/* ════════════════════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.stat-card {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent-primary);
  border-radius: 4px 0 0 4px;
  opacity: 0.8;
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.08), 0 4px 12px -2px rgba(0, 0, 0, 0.03);
}

.stat-card:hover::before {
  width: 6px;
}

/* Custom card themes */
.stat-blue::before { background: linear-gradient(to bottom, #3b82f6, #1d4ed8); }
.stat-green::before { background: linear-gradient(to bottom, #10b981, #047857); }
.stat-purple::before { background: linear-gradient(to bottom, #8b5cf6, #6d28d9); }
.stat-orange::before { background: linear-gradient(to bottom, #f59e0b, #d97706); }

.stat-blue .stat-icon { background: rgba(59, 130, 246, 0.08); }
.stat-blue .stat-icon svg { stroke: #3b82f6; }
.stat-green .stat-icon { background: rgba(16, 185, 129, 0.08); }
.stat-green .stat-icon svg { stroke: #10b981; }
.stat-purple .stat-icon { background: rgba(139, 92, 246, 0.08); }
.stat-purple .stat-icon svg { stroke: #8b5cf6; }
.stat-orange .stat-icon { background: rgba(245, 158, 11, 0.08); }
.stat-orange .stat-icon svg { stroke: #f59e0b; }

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.stat-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
}

.stat-card:hover .stat-icon {
  transform: scale(1.08);
}

.stat-value {
  font-size: 2.15rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.stat-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.stat-trend-up {
  color: var(--success);
  font-weight: 600;
  background: rgba(16, 185, 129, 0.08);
  padding: 0.15rem 0.45rem;
  border-radius: 99px;
  font-size: 0.75rem;
}

.stat-trend-down {
  color: var(--danger);
  font-weight: 600;
  background: rgba(252, 24, 37, 0.08);
  padding: 0.15rem 0.45rem;
  border-radius: 99px;
  font-size: 0.75rem;
}

/* ════════════════════════════════════════════════════════════════ */
/* DASHBOARD ROW                                                    */
/* ════════════════════════════════════════════════════════════════ */
.dashboard-row { display:flex; gap:1.25rem; flex-wrap:wrap; }
.dashboard-row > .panel-card { min-width:0; }

/* ════════════════════════════════════════════════════════════════ */
/* PANEL CARD                                                       */
/* ════════════════════════════════════════════════════════════════ */
.panel-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-premium);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ════════════════════════════════════════════════════════════════ */
/* WORKFLOW STATUS CARDS                                            */
/* ════════════════════════════════════════════════════════════════ */
.workflow-status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.workflow-status-card:hover {
  background: var(--bg-secondary);
  border-color: rgba(252, 24, 37, 0.2);
  box-shadow: 0 4px 12px rgba(252, 24, 37, 0.03);
  transform: translateX(4px);
}
.workflow-status-info { display:flex;flex-direction:column;gap:0.2rem; }
.workflow-status-name { font-size:0.85rem;font-weight:600;color:var(--text-primary); }
.workflow-status-id   { font-size:0.75rem;color:var(--text-muted); }

/* ════════════════════════════════════════════════════════════════ */
/* STATUS DOTS                                                      */
/* ════════════════════════════════════════════════════════════════ */
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
  flex-shrink: 0;
  animation: pulse-animation 2s infinite;
}
.status-dot.simulated  { background: var(--text-muted); animation: none; }
.status-dot.inactive   { background: var(--text-muted); animation: none; }

/* ════════════════════════════════════════════════════════════════ */
/* TIMELINE / RECENT ACTIVITY                                       */
/* ════════════════════════════════════════════════════════════════ */
.lead-timeline { display:flex;flex-direction:column;gap:1rem; }

.timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}
.timeline-badge {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  display: flex; align-items:center; justify-content:center;
  flex-shrink: 0;
}
.timeline-content { display:flex;flex-direction:column;gap:0.2rem;min-width:0; }
.timeline-time  { font-size:0.75rem;color:var(--text-muted); }
.timeline-title { font-size:0.83rem;color:var(--text-secondary);font-weight:500;line-height:1.4; }
.timeline-item.active .timeline-title { color:var(--text-primary); }

/* ════════════════════════════════════════════════════════════════ */
/* BUTTONS                                                          */
/* ════════════════════════════════════════════════════════════════ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  font-family: var(--font-sans);
  white-space: nowrap;
}
.btn-primary:hover   { transform:translateY(-1px); box-shadow:0 6px 20px rgba(252,24,37,0.3); }
.btn-primary:active  { transform:translateY(0); }
.btn-primary:disabled{ opacity:0.65; cursor:not-allowed; transform:none; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  font-family: var(--font-sans);
  white-space: nowrap;
}
.btn-secondary:hover { background:var(--bg-hover); border-color:var(--text-muted); }

.btn-action {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex; align-items:center; justify-content:center;
  cursor: pointer;
  transition: var(--transition-smooth);
  flex-shrink: 0;
}
.btn-action:hover { background:var(--bg-hover); color:var(--text-primary); border-color:var(--text-muted); }

/* ════════════════════════════════════════════════════════════════ */
/* FORM ELEMENTS                                                    */
/* ════════════════════════════════════════════════════════════════ */
.form-group { display:flex;flex-direction:column;gap:0.4rem;margin-bottom:1rem; }
.form-group label { font-size:0.82rem;font-weight:600;color:var(--text-secondary); }

input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea {
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: var(--font-sans);
  transition: var(--transition-smooth);
  outline: none;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  background: var(--bg-secondary);
  box-shadow: 0 0 0 3px rgba(252,24,37,0.08);
}
select { cursor:pointer; appearance:none; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 0.6rem center; background-size:1.2em; padding-right:2rem; }
textarea { resize:vertical; min-height:120px; line-height:1.6; }

.filter-select {
  width: auto;
  min-width: 150px;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-family: var(--font-sans);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 1.2em;
  padding-right: 2rem;
  outline: none;
}
.filter-select:focus { border-color:var(--border-focus); box-shadow:0 0 0 3px rgba(252,24,37,0.08); }

/* ════════════════════════════════════════════════════════════════ */
/* LEADS TABLE                                                      */
/* ════════════════════════════════════════════════════════════════ */
.table-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0 0.85rem;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}
.search-box svg { width:16px;height:16px;color:var(--text-muted);flex-shrink:0; }
.search-box input {
  border: none;
  background: transparent;
  padding: 0.5rem 0;
  outline: none;
  font-size:0.85rem;
  color:var(--text-primary);
  flex:1;
  font-family:var(--font-sans);
}

/* Status Pills */
.status-pills {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: 99px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
  font-family: var(--font-sans);
}
.status-pill:hover { border-color:var(--text-muted); color:var(--text-primary); }
.status-pill.active {
  background: var(--accent-light);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  font-weight: 600;
}
.pill-dot { width:7px;height:7px;border-radius:50%;display:inline-block;flex-shrink:0; }
.pill-count {
  background: var(--bg-hover);
  border-radius: 99px;
  padding: 0.1rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 18px;
  text-align: center;
}
.status-pill.active .pill-count { background:rgba(252,24,37,0.12); color:var(--accent-primary); }

/* Table */
.table-responsive { overflow-x:auto; }
.leads-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.leads-table thead tr {
  border-bottom: 1px solid var(--border-color);
}
.leads-table th {
  padding: 0.65rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.leads-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}
.leads-table tbody tr {
  transition: var(--transition-smooth);
}
.leads-table tbody tr:hover { background:var(--bg-tertiary); }
.leads-table tbody tr:last-child td { border-bottom:none; }

/* User cell */
.user-cell { display:flex;align-items:center;gap:0.75rem; }
.avatar {
  width:36px; height:36px;
  border-radius:50%;
  background:var(--accent-light);
  color:var(--accent-primary);
  display:flex;align-items:center;justify-content:center;
  font-weight:700;font-size:0.9rem;
  flex-shrink:0;
}
.user-info { display:flex;flex-direction:column;gap:0.15rem;min-width:0; }
.user-name  { font-size:0.88rem;font-weight:600;color:var(--text-primary); }
.user-phone { font-size:0.75rem;color:var(--text-muted); }

/* Lead status badge */
.lead-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: 99px;
  white-space: nowrap;
}
.lead-status-dot { width:7px;height:7px;border-radius:50%;flex-shrink:0; }

/* ════════════════════════════════════════════════════════════════ */
/* BADGES                                                           */
/* ════════════════════════════════════════════════════════════════ */
.badge {
  display:inline-flex;align-items:center;gap:0.4rem;
  padding:0.3rem 0.7rem;border-radius:99px;
  font-size:0.78rem;font-weight:600;
}
.badge.success { background:var(--success-bg);color:var(--success); }
.badge.danger  { background:var(--danger-bg); color:var(--danger);  }
.badge.warning { background:var(--warning-bg);color:var(--warning); }
.badge.neutral { background:var(--bg-hover);  color:var(--text-secondary); }

/* ════════════════════════════════════════════════════════════════ */
/* CRM DRAWER                                                       */
/* ════════════════════════════════════════════════════════════════ */
.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  display: flex;
  justify-content: flex-end;
}
.drawer-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  width: min(520px, 95vw);
  height: 100%;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  box-shadow: -20px 0 60px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
}
.drawer-overlay.active .drawer {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.drawer-close {
  width:32px;height:32px;border-radius:var(--radius-sm);
  border:1px solid var(--border-color);background:transparent;
  font-size:1.1rem;cursor:pointer;color:var(--text-secondary);
  display:flex;align-items:center;justify-content:center;
  transition:var(--transition-smooth);flex-shrink:0;
}
.drawer-close:hover { background:var(--bg-hover);color:var(--text-primary); }

.drawer-content {
  flex:1;
  overflow-y:auto;
  padding:1.5rem;
  display:flex;
  flex-direction:column;
  gap:1rem;
}

/* CRM Grid */
.crm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.crm-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
}
.crm-card-title { font-size:0.72rem;font-weight:700;color:var(--text-muted);text-transform:uppercase;letter-spacing:0.05em;margin-bottom:0.3rem; }
.crm-card-value { font-size:0.88rem;font-weight:600;color:var(--text-primary);word-break:break-word; }
.crm-dossier-text { font-size:0.85rem;color:var(--text-secondary);line-height:1.6;margin:0; }

/* ════════════════════════════════════════════════════════════════ */
/* PROMPT EDITOR                                                    */
/* ════════════════════════════════════════════════════════════════ */
.prompt-textarea {
  min-height: 380px;
  font-family: 'Menlo','Consolas','Monaco',monospace;
  font-size: 0.82rem;
  line-height: 1.7;
  resize: vertical;
  white-space: pre-wrap;
  tab-size: 2;
}

.var-badge {
  display: inline-block;
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  user-select: none;
}
.var-badge:hover { background:var(--info);color:#fff; }

/* ════════════════════════════════════════════════════════════════ */
/* SETTINGS                                                         */
/* ════════════════════════════════════════════════════════════════ */
.config-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(300px,1fr)); gap:1.5rem; }
.settings-card { background:var(--bg-tertiary);border:1px solid var(--border-color);border-radius:var(--radius-md);padding:1.5rem; }
.settings-card h3 { font-size:0.9rem;font-weight:700;margin-bottom:1.25rem;color:var(--text-primary); }

/* ════════════════════════════════════════════════════════════════ */
/* TOAST NOTIFICATION                                               */
/* ════════════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--bg-secondary);
  border: 1px solid var(--success);
  border-left: 4px solid var(--success);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.12);
  /* Hidden by default — off screen right + invisible + not clickable */
  transform: translateX(calc(100% + 3rem));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s ease;
  z-index: 2000;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  max-width: 360px;
  word-break: break-word;
}
.toast.show {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}
.toast.danger  { border-color:var(--accent-primary);  border-left-color:var(--accent-primary); }
.toast.warning { border-color:var(--warning);          border-left-color:var(--warning); }
.toast.danger  svg { stroke:var(--accent-primary); }
.toast.warning svg { stroke:var(--warning); }
.toast svg { width:18px;height:18px;stroke:var(--success);fill:none;flex-shrink:0; }

/* SVG Weekly Chart Interactivity */
.chart-bar-group:hover rect.bar-hover-rect {
  fill: rgba(0, 0, 0, 0.025);
}
.chart-bar-group:hover rect:not(.bar-hover-rect) {
  opacity: 0.9;
}
.chart-bar-group .value-label-group {
  opacity: 0;
  transition: opacity 0.2s ease;
}
.chart-bar-group:hover .value-label-group {
  opacity: 1;
}

/* ════════════════════════════════════════════════════════════════ */
/* RESPONSIVE                                                       */
/* ════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .top-bar { padding:0 1rem;gap:0.75rem; }
  .nav-item button span:not(.pill-count) { display:none; }
  .stats-grid { grid-template-columns:1fr 1fr; }
  .dashboard-row { flex-direction:column; }
  .crm-grid { grid-template-columns:1fr; }
  .page-content { padding:1rem; }
  .toast { left:1rem;right:1rem;bottom:1rem;max-width:none; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns:1fr; }
  .status-pills { gap:0.3rem; }
  .status-pill { font-size:0.75rem;padding:0.3rem 0.6rem; }
}
