/* =====================================================
   BeautyCRM - Estilos principales
   ===================================================== */

:root {
  --primary: #7C3AED;
  --primary-dark: #6D28D9;
  --primary-light: #A78BFA;
  --primary-bg: #F5F3FF;
  --secondary: #EC4899;
  --success: #10B981;
  --danger: #EF4444;
  --warning: #F59E0B;
  --info: #3B82F6;

  --bg: #F3F4F6;
  --surface: #FFFFFF;
  --border: #E5E7EB;
  --text: #111827;
  --text-light: #6B7280;
  --text-muted: #9CA3AF;

  --sidebar-width: 260px;
  --sidebar-bg: #FFFFFF;
  --header-height: 70px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.08);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

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

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

html, body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* =====================================================
   LAYOUT
   ===================================================== */
.app-wrapper, .app-container { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: transform 0.3s;
}

.sidebar-brand {
  padding: 20px 24px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.sidebar-brand .logo {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--primary-bg);
  color: var(--primary);
}

.nav-item.active {
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 600;
}

.nav-item .icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.nav-item.active .icon {
  background: var(--primary);
  color: #fff;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-info .name { font-weight: 600; font-size: 14px; color: var(--text); }
.user-info .status { font-size: 12px; color: var(--success); display: flex; align-items: center; gap: 4px; }
.user-info .status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--success); }

/* =====================================================
   MAIN
   ===================================================== */
.main, .main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar .menu-toggle, .topbar .btn-menu {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.topbar .topbar-brand {
  display: none;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 18px;
}

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

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s;
  position: relative;
}

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

.icon-btn .badge-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid #fff;
}

.content {
  padding: 24px;
  flex: 1;
}

/* =====================================================
   PAGE HEADER
   ===================================================== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-header h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}

.page-header p {
  color: var(--text-light);
  font-size: 14px;
  margin-top: 4px;
}

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border-color: var(--primary-dark);
}
.btn-primary:hover { color: #fff; }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 24px; font-size: 16px; }

.btn-block { width: 100%; }

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* =====================================================
   CARDS
   ===================================================== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.card-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.card-body { padding: 20px; }

/* Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 14px;
}

.stat-icon.bg-purple { background: #F5F3FF; color: var(--primary); }
.stat-icon.bg-pink { background: #FCE7F3; color: var(--secondary); }
.stat-icon.bg-green { background: #D1FAE5; color: var(--success); }
.stat-icon.bg-blue { background: #DBEAFE; color: var(--info); }
.stat-icon.bg-yellow { background: #FEF3C7; color: var(--warning); }
.stat-icon.bg-red { background: #FEE2E2; color: var(--danger); }

.stat-card .label {
  color: var(--text-light);
  font-size: 13px;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.stat-card .value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -1px;
}

.stat-card .change {
  font-size: 12px;
  margin-top: 4px;
  color: var(--text-light);
}

/* =====================================================
   TABLE
   ===================================================== */
.table-wrapper {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table thead th {
  background: #F9FAFB;
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.table tbody td {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: 0; }

.table tbody tr:hover { background: #FAFAFB; }

.table .text-right { text-align: right; }
.table .text-center { text-align: center; }

.table-responsive { overflow-x: auto; }

/* =====================================================
   BADGES
   ===================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-blue { background: #DBEAFE; color: #1E40AF; }
.badge-purple { background: #F5F3FF; color: #6D28D9; }
.badge-pink { background: #FCE7F3; color: #BE185D; }
.badge-green { background: #D1FAE5; color: #065F46; }
.badge-yellow { background: #FEF3C7; color: #92400E; }
.badge-red { background: #FEE2E2; color: #991B1B; }
.badge-orange { background: #FED7AA; color: #9A3412; }
.badge-gray { background: #F3F4F6; color: #374151; }

/* =====================================================
   SEARCH BAR
   ===================================================== */
.search-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.search-bar input {
  flex: 1;
  border: 0;
  background: transparent;
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  color: var(--text);
}

.search-bar input::placeholder { color: var(--text-muted); }
.search-bar .icon { color: var(--text-muted); font-size: 18px; }

/* =====================================================
   FORMS
   ===================================================== */
.form-group { margin-bottom: 16px; }

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

.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}

textarea { resize: vertical; min-height: 80px; }

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

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.required { color: var(--danger); }

/* =====================================================
   ALERTS
   ===================================================== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-success { background: #D1FAE5; color: #065F46; border-left: 4px solid var(--success); }
.alert-danger { background: #FEE2E2; color: #991B1B; border-left: 4px solid var(--danger); }
.alert-warning { background: #FEF3C7; color: #92400E; border-left: 4px solid var(--warning); }
.alert-info { background: #DBEAFE; color: #1E40AF; border-left: 4px solid var(--info); }

/* =====================================================
   PROFILE CELL (table)
   ===================================================== */
.profile-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-cell .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FBBF24, #F59E0B);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.profile-cell .avatar.purple { background: linear-gradient(135deg, var(--primary), var(--secondary)); }
.profile-cell .avatar.green { background: linear-gradient(135deg, #10B981, #059669); }
.profile-cell .avatar.blue { background: linear-gradient(135deg, #3B82F6, #1E40AF); }

.profile-cell .info .name { font-weight: 600; color: var(--text); }
.profile-cell .info .meta { font-size: 13px; color: var(--text-light); margin-top: 2px; }
.profile-cell .info .ref { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; margin-top: 2px;}

/* =====================================================
   ACTIONS COLUMN
   ===================================================== */
.action-buttons { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }

.action-btn {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  justify-content: flex-start;
}

.action-btn:hover { background: var(--primary-bg); border-color: var(--primary-light); color: var(--primary); }
.action-btn.edit { color: var(--info); }
.action-btn.invite { color: var(--primary); }
.action-btn.call { color: var(--success); }
.action-btn.delete { color: var(--danger); }
.action-btn.whatsapp { color: #25D366; border-color: #25D366; }

.urgency-overdue { color: var(--danger); font-weight: 600; }
.urgency-today { color: var(--warning); font-weight: 600; }
.urgency-week { color: var(--info); }

/* =====================================================
   FAB - Floating chat button
   ===================================================== */
.fab-chat {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 8px 24px rgba(124,58,237,0.4);
  z-index: 100;
  transition: all 0.3s;
}

.fab-chat:hover { transform: scale(1.05); }

/* =====================================================
   MODAL
   ===================================================== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(17,24,39,0.6);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.show { display: flex; }

.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 { font-size: 17px; font-weight: 600; }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal .close {
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 24px;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal .close:hover { background: var(--bg); }

/* =====================================================
   AUTH
   ===================================================== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #7C3AED 0%, #EC4899 100%);
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo .icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-bottom: 12px;
}

.auth-logo h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -1px;
}

.auth-logo p {
  color: var(--text-light);
  font-size: 14px;
  margin-top: 4px;
}

/* =====================================================
   KANBAN
   ===================================================== */
.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(260px, 1fr));
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 12px;
}

.kanban-col {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 14px;
  min-height: 200px;
}

.kanban-col h4 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-col .count {
  background: #fff;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.kanban-card {
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 8px;
  border-left: 3px solid var(--primary);
  box-shadow: var(--shadow-sm);
}

.kanban-card.overdue { border-left-color: var(--danger); }
.kanban-card.today { border-left-color: var(--warning); }
.kanban-card.week { border-left-color: var(--info); }

.kanban-card .name { font-weight: 600; margin-bottom: 4px; }
.kanban-card .meta { font-size: 12px; color: var(--text-light); margin-bottom: 8px; }
.kanban-card .actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* =====================================================
   TABS
   ===================================================== */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab {
  padding: 10px 18px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  cursor: pointer;
  font-weight: 500;
  color: var(--text-light);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* =====================================================
   TREE - MLM Network
   ===================================================== */
.tree { padding-left: 0; }
.tree ul { padding-left: 28px; }

.tree li {
  list-style: none;
  position: relative;
  padding: 8px 0 8px 18px;
}

.tree li::before {
  content: '';
  position: absolute;
  left: 0; top: 24px;
  width: 14px; height: 1px;
  background: var(--border);
}

.tree li::after {
  content: '';
  position: absolute;
  left: 0; top: 0;
  width: 1px;
  height: 100%;
  background: var(--border);
}

.tree li:last-child::after { height: 24px; }

.tree-node {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.tree-node .role-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
}

/* =====================================================
   AI CHAT
   ===================================================== */
.chat-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  height: calc(100vh - 200px);
  min-height: 500px;
}

.chat-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-y: auto;
}

.chat-main {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
}

.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.chat-input-bar {
  border-top: 1px solid var(--border);
  padding: 16px;
  display: flex;
  gap: 10px;
}

.chat-input-bar input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  outline: none;
}

.message {
  max-width: 80%;
  margin-bottom: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  word-wrap: break-word;
}

.message.user {
  background: var(--primary);
  color: #fff;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.message.bot {
  background: #F3F4F6;
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.doc-item {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.doc-item .title { font-weight: 600; }
.doc-item .meta { font-size: 11px; color: var(--text-muted); }

/* =====================================================
   FUNNEL
   ===================================================== */
.funnel-stage {
  margin-bottom: 8px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* =====================================================
   HEATMAP
   ===================================================== */
.heatmap {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  gap: 4px;
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  background: #F3F4F6;
}

.heatmap-cell.l1 { background: #EDE9FE; }
.heatmap-cell.l2 { background: #C4B5FD; }
.heatmap-cell.l3 { background: #8B5CF6; }
.heatmap-cell.l4 { background: #6D28D9; }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,0.15); }
  .main, .main-wrapper { margin-left: 0; }
  .topbar .topbar-brand { display: flex; }
  .topbar .menu-toggle, .topbar .btn-menu { display: flex; }
  .chat-container { grid-template-columns: 1fr; }
  .chat-sidebar { display: none; }
}

@media (max-width: 640px) {
  .content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 20px; }
  .auth-card { padding: 28px 22px; }
  .kanban { grid-template-columns: 1fr; }
  .table-wrapper { overflow-x: auto; }
  .table { min-width: 700px; }
  .action-buttons { flex-direction: row; }
  .action-btn { padding: 4px 8px; }
}

/* Utilities */
.text-muted { color: var(--text-muted); }
.text-light { color: var(--text-light); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
.hidden { display: none; }

/* === Text color utilities === */
.text-purple { color: var(--primary); }
.text-pink { color: var(--secondary); }
.text-blue { color: #3B82F6; }
.text-green { color: #10B981; }
.text-yellow { color: #F59E0B; }
.text-red { color: #EF4444; }
.text-orange { color: #F97316; }
.text-gray { color: #6B7280; }

/* === Profile detail header === */
.profile-header { display: flex; align-items: center; gap: 16px; }
.profile-avatar-lg {
    width: 64px; height: 64px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white; display: flex; align-items: center; justify-content: center;
    font-size: 24px; font-weight: 700;
}
.profile-meta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 4px; color: var(--text-muted); font-size: 13px; }
.profile-meta i { margin-right: 4px; }
.header-actions { display: flex; gap: 8px; }

/* === Detail / definition lists === */
.detail-list { display: grid; grid-template-columns: 130px 1fr; gap: 8px 16px; margin: 0; }
.detail-list dt { color: var(--text-muted); font-size: 13px; }
.detail-list dd { margin: 0; font-weight: 500; }
.notes-block { margin-top: 16px; padding: 12px; background: #F9FAFB; border-radius: 8px; }
.notes-block p { margin: 8px 0 0; color: var(--text-muted); font-size: 14px; }

/* === Detail grid layout === */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

/* === Dashboard list items === */
.list-clean { list-style: none; padding: 0; margin: 0; }
.list-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #F3F4F6;
}
.list-item:last-child { border-bottom: none; }
.list-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white; display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.list-content { flex: 1; min-width: 0; }
.list-title { font-weight: 600; font-size: 14px; color: var(--text-strong); }
.list-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.list-notes { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-style: italic; }

.empty-state-sm {
    text-align: center; padding: 20px; color: var(--text-muted);
    font-size: 14px;
}
.empty-state-sm i { margin-right: 6px; }

/* === Dashboard grid === */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

/* === Sale items rows === */
.sale-item-row {
    display: grid;
    grid-template-columns: 2fr 80px 120px 40px;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}
.sale-item-row select, .sale-item-row input {
    margin: 0;
}
.btn-remove {
    background: #FEE2E2; color: #DC2626; border: none;
    width: 36px; height: 36px; border-radius: 8px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.sale-total {
    margin-top: 16px; padding: 12px; background: #F9FAFB;
    border-radius: 8px; display: flex; justify-content: space-between;
    align-items: center; font-size: 16px;
}
.sale-total strong { color: var(--primary); font-size: 18px; }

/* === Inline forms in tables === */
.inline-form {
    display: inline-flex; align-items: center; gap: 8px; margin: 0;
}
.inline-form input, .inline-form select {
    margin: 0; padding: 6px 10px;
}
.select-sm {
    font-size: 12px; padding: 4px 8px;
}

/* === Filter tabs === */
.filter-tabs {
    display: flex; gap: 12px; margin: 16px 0;
    flex-wrap: wrap;
}
.filter-tab {
    background: white; padding: 8px 16px; border-radius: 999px;
    font-size: 13px; box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    display: flex; align-items: center; gap: 6px;
}
.filter-tab .dot {
    width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}

/* === Form section === */
.form-section { margin-bottom: 24px; }
.form-section h3 {
    font-size: 15px; font-weight: 600; margin-bottom: 12px;
    color: var(--text-strong); padding-bottom: 8px;
    border-bottom: 1px solid #E5E7EB;
}
.form-hint { color: var(--text-muted); font-size: 12px; }

/* === MLM tree === */
.mlm-tree { padding: 16px; overflow-x: auto; }
.tree-node { margin-bottom: 12px; }
.tree-card {
    display: inline-flex; align-items: center; gap: 12px;
    padding: 10px 16px; border-radius: 12px; color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-width: 200px;
}
.tree-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(255,255,255,0.25); display: flex;
    align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600;
}
.tree-name { font-weight: 600; font-size: 14px; }
.tree-role { font-size: 12px; opacity: 0.9; text-transform: capitalize; }
.tree-children { padding-left: 32px; margin-top: 8px; border-left: 2px dashed #E5E7EB; }
.level-0 .tree-card { background: linear-gradient(135deg, var(--primary), var(--secondary)); }
.level-1 .tree-card { background: linear-gradient(135deg, var(--secondary), #F59E0B); }
.level-2 .tree-card { background: linear-gradient(135deg, #3B82F6, #06B6D4); }

/* === Heatmap === */
.heatmap {
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    gap: 3px; padding: 8px 0;
}
.heat-cell {
    aspect-ratio: 1; border-radius: 3px; min-width: 14px;
}
.heat-0 { background: #F3F4F6; }
.heat-1 { background: #DDD6FE; }
.heat-2 { background: #A78BFA; }
.heat-3 { background: #7C3AED; }
.heat-4 { background: #5B21B6; }
.heatmap-legend {
    display: flex; align-items: center; gap: 4px; margin-top: 8px;
    font-size: 11px; color: var(--text-muted); justify-content: flex-end;
}
.heatmap-legend .heat-cell { width: 14px; height: 14px; }

/* === Funnel === */
.funnel { padding: 8px 0; }
.funnel-stage {
    display: grid; grid-template-columns: 100px 1fr;
    gap: 12px; align-items: center; margin-bottom: 8px;
}
.funnel-label { font-size: 13px; color: var(--text-strong); font-weight: 500; }
.funnel-bar-wrap {
    background: #F3F4F6; height: 28px; border-radius: 6px;
    position: relative; overflow: hidden;
}
.funnel-bar {
    height: 100%; border-radius: 6px;
    transition: width 0.6s ease;
}
.funnel-count {
    position: absolute; right: 12px; top: 50%;
    transform: translateY(-50%); font-weight: 600; font-size: 13px;
    color: var(--text-strong);
}
.close-rate {
    margin-top: 16px; padding: 12px; background: #F0FDF4;
    border-radius: 8px; display: flex; justify-content: space-between;
    align-items: center;
}
.close-rate strong { color: #10B981; font-size: 18px; }

/* === AI chat layout === */
.ai-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 16px;
    height: calc(100vh - 180px);
    min-height: 500px;
}
.ai-sidebar { overflow-y: auto; }
.ai-chat {
    background: white; border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    display: flex; flex-direction: column;
    overflow: hidden;
}
.chat-messages {
    flex: 1; overflow-y: auto; padding: 20px;
    display: flex; flex-direction: column; gap: 16px;
}
.chat-msg { display: flex; gap: 10px; max-width: 85%; }
.msg-bot { align-self: flex-start; }
.msg-user { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.msg-bubble {
    background: #F3F4F6; padding: 10px 14px; border-radius: 12px;
    font-size: 14px; line-height: 1.5;
}
.msg-user .msg-bubble {
    background: var(--primary); color: white;
}
.msg-bubble ul { margin: 8px 0; padding-left: 20px; }
.msg-bubble li { margin: 2px 0; }
.chat-input-form {
    display: flex; padding: 12px; border-top: 1px solid #E5E7EB;
    gap: 8px;
}
.chat-input-form input {
    flex: 1; margin: 0;
}
.chat-input-form button {
    background: var(--primary); color: white; border: none;
    width: 44px; height: 44px; border-radius: 8px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

/* === Upload zone === */
.upload-tabs {
    display: flex; gap: 4px; margin-bottom: 12px;
    background: #F3F4F6; padding: 4px; border-radius: 8px;
}
.tab-btn {
    flex: 1; background: transparent; border: none;
    padding: 8px; font-size: 13px; cursor: pointer;
    border-radius: 6px; font-weight: 500;
}
.tab-btn.active { background: white; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.tab-content { display: none; }
.tab-content.active { display: block; }
.upload-zone {
    border: 2px dashed #D1D5DB; border-radius: 8px;
    padding: 24px; text-align: center; margin-bottom: 12px;
    cursor: pointer;
}
.upload-zone i { font-size: 32px; color: var(--text-muted); }
.upload-zone p { margin: 8px 0; color: var(--text-muted); font-size: 13px; }
.upload-zone input[type=file] {
    width: 100%; margin-top: 8px;
}
.docs-list { margin-top: 12px; }
.doc-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px; border-radius: 6px;
    background: #F9FAFB; margin-bottom: 6px;
}
.doc-item i { color: var(--primary); }
.doc-info { flex: 1; min-width: 0; }
.doc-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta { font-size: 11px; color: var(--text-muted); }

/* === Auth pages === */
.auth-body {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    font-family: 'Inter', -apple-system, sans-serif;
}
.auth-container { width: 100%; max-width: 420px; padding: 16px; }
.auth-card {
    background: white; border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    padding: 32px;
}
.auth-brand { text-align: center; margin-bottom: 24px; }
.brand-icon-lg {
    width: 64px; height: 64px; margin: 0 auto 12px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 16px; color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px;
}
.auth-brand h1 {
    font-size: 28px; font-weight: 700; margin: 0;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.auth-brand p { color: var(--text-muted); font-size: 14px; margin: 4px 0 0; }
.auth-title { font-size: 20px; font-weight: 600; margin: 0 0 16px; text-align: center; }
.auth-subtitle { color: var(--text-muted); font-size: 13px; text-align: center; margin: 0 0 16px; }
.auth-form .form-group { margin-bottom: 14px; }
.auth-links { text-align: center; margin-top: 16px; font-size: 13px; }
.auth-links a { color: var(--primary); text-decoration: none; }
.auth-footer { text-align: center; color: rgba(255,255,255,0.8); font-size: 12px; margin-top: 16px; }

.input-icon { position: relative; }
.input-icon i {
    position: absolute; left: 12px; top: 50%;
    transform: translateY(-50%); color: var(--text-muted);
}
.input-icon input { padding-left: 36px; }
.btn-block { width: 100%; }

/* === Topbar adjustments === */
.topbar-brand {
    display: flex; align-items: center; gap: 8px;
    font-weight: 600; font-size: 16px;
}
.brand-icon-sm {
    width: 28px; height: 28px; border-radius: 6px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white; display: flex; align-items: center; justify-content: center;
}
.topbar-icon {
    width: 36px; height: 36px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); text-decoration: none;
}
.topbar-icon:hover { background: #F3F4F6; }
.topbar-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white; display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px; text-decoration: none;
}

/* === Kanban tweaks === */
.kanban-empty {
    padding: 24px; text-align: center; color: var(--text-muted);
    font-size: 13px;
}
.kanban-card-meta { font-size: 12px; color: var(--text-muted); margin: 4px 0; }
.kanban-card-notes { font-size: 12px; color: var(--text-muted); margin: 4px 0; font-style: italic; }
.kanban-card-actions { display: flex; gap: 4px; margin-top: 8px; align-items: center; }

/* === Search bar === */
.search-bar {
    position: relative; margin-bottom: 16px;
}
.search-bar i {
    position: absolute; left: 14px; top: 50%;
    transform: translateY(-50%); color: var(--text-muted);
}
.search-bar input {
    width: 100%; padding: 10px 14px 10px 40px;
    border: 1px solid #E5E7EB; border-radius: 10px;
    font-size: 14px; background: white;
}

/* === Status dot in user card === */
.status-dot {
    display: inline-block; width: 8px; height: 8px;
    border-radius: 50%; background: #10B981;
    margin-right: 4px;
}

/* === bg-gray for nav-icon === */
.bg-gray { background: linear-gradient(135deg, #6B7280, #4B5563); }

/* === Mobile === */
@media (max-width: 1024px) {
    .ai-layout { grid-template-columns: 1fr; height: auto; }
    .detail-list { grid-template-columns: 1fr; gap: 4px; }
    .detail-list dt { margin-top: 8px; }
    body.sidebar-open { overflow: hidden; }
}
@media (max-width: 640px) {
    .sale-item-row { grid-template-columns: 1fr; }
    .header-actions { flex-direction: column; align-items: stretch; }
    .stats-grid { grid-template-columns: 1fr; }
}

/* =====================================================
   FIXES: aliases for class names used by views
   ===================================================== */

/* data-table = table */
.data-card {
  background: var(--surface);
  border-radius: var(--radius, 12px);
  border: 1px solid var(--border, #E5E7EB);
  overflow: hidden;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.05));
  margin-bottom: 16px;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}
.data-table thead th {
  background: #F9FAFB;
  padding: 14px 18px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  color: var(--text-light, #6B7280);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border, #E5E7EB);
  white-space: nowrap;
}
.data-table tbody td {
  padding: 16px 18px;
  border-bottom: 1px solid #F3F4F6;
  vertical-align: middle;
  font-size: 14px;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #FAFAFB; }
.data-table .text-right { text-align: right; }
.data-table .text-center { text-align: center; }

/* profile-cell aliases */
.profile-cell .profile-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary, #7C3AED), var(--secondary, #EC4899));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  flex-shrink: 0;
}
.profile-cell .profile-info .profile-name { font-weight: 600; color: var(--text, #111827); font-size: 14px; }
.profile-cell .profile-info .profile-phone { font-size: 13px; color: var(--text-light, #6B7280); margin-top: 2px; }
.profile-cell .profile-info .profile-ref { font-size: 12px; color: var(--text-muted, #9CA3AF); display: flex; align-items: center; gap: 4px; margin-top: 2px; }

/* action-buttons row layout (horizontal pills) */
.action-buttons {
  display: flex;
  flex-direction: row;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  text-decoration: none;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: all 0.15s;
}
.btn-action i { font-size: 12px; }
.btn-action-edit {
  background: #EEF2FF;
  color: #4338CA;
  border-color: #C7D2FE;
}
.btn-action-edit:hover { background: #E0E7FF; }
.btn-action-invite {
  background: #FEF3C7;
  color: #92400E;
  border-color: #FDE68A;
}
.btn-action-invite:hover { background: #FDE68A; }
.btn-action-call {
  background: #DBEAFE;
  color: #1E40AF;
  border-color: #BFDBFE;
}
.btn-action-call:hover { background: #BFDBFE; }
.btn-action-wa {
  background: #25D366;
  color: white;
  border-color: #25D366;
  width: 30px;
  height: 30px;
  padding: 0;
  justify-content: center;
}
.btn-action-wa:hover { background: #1FB855; }

/* btn-icon for action icons in tables */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: transparent;
  color: var(--text-light, #6B7280);
  text-decoration: none;
  transition: all 0.15s;
  border: none;
  cursor: pointer;
}
.btn-icon:hover { background: #F3F4F6; color: var(--text, #111827); }
.btn-icon.text-red:hover { background: #FEE2E2; color: #DC2626; }

/* Empty state inside table */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-light, #6B7280);
  font-size: 14px;
}
.empty-state i {
  display: block;
  font-size: 36px;
  color: #D1D5DB;
  margin-bottom: 10px;
}
.empty-state a { color: var(--primary, #7C3AED); text-decoration: none; font-weight: 500; }

/* Page header tweaks */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  color: var(--text, #111827);
}
.page-subtitle {
  font-size: 14px;
  color: var(--text-light, #6B7280);
  margin: 4px 0 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary, #7C3AED), var(--secondary, #EC4899));
  color: white;
}
.btn-primary:hover { opacity: 0.95; box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25); }
.btn-light {
  background: white;
  color: var(--text, #111827);
  border-color: #E5E7EB;
}
.btn-light:hover { background: #F9FAFB; }
.btn-success {
  background: #10B981;
  color: white;
}
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* Badge sizes/colors used in tables */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 12px;
  white-space: nowrap;
}
.badge-purple { background: #EDE9FE; color: #6D28D9; }
.badge-pink { background: #FCE7F3; color: #BE185D; }
.badge-blue { background: #DBEAFE; color: #1E40AF; }
.badge-green { background: #D1FAE5; color: #047857; }
.badge-yellow { background: #FEF3C7; color: #92400E; }
.badge-red { background: #FEE2E2; color: #B91C1C; }
.badge-orange { background: #FFEDD5; color: #9A3412; }
.badge-gray { background: #F3F4F6; color: #4B5563; }

/* Search bar */
.search-bar {
  position: relative;
  margin-bottom: 16px;
  background: white;
  border-radius: 10px;
  border: 1px solid var(--border, #E5E7EB);
}
.search-bar i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light, #6B7280);
}
.search-bar input {
  width: 100%;
  padding: 12px 16px 12px 42px;
  border: none;
  background: transparent;
  font-size: 14px;
  border-radius: 10px;
  outline: none;
}
.search-bar input:focus { box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1); }

/* Next action urgency */
.next-action .action-date { font-size: 14px; font-weight: 500; }
.next-action .urgency-overdue { color: #DC2626; font-size: 12px; font-weight: 600; }
.next-action .urgency-today { color: #F59E0B; font-size: 12px; font-weight: 600; }
.next-action .urgency-soon { color: #3B82F6; font-size: 12px; }
.next-action .urgency-later { color: var(--text-light, #6B7280); font-size: 12px; }

/* Stack action buttons on mobile */
@media (max-width: 768px) {
  .action-buttons { flex-direction: column; align-items: stretch; }
  .btn-action { justify-content: center; }
  .data-table thead { display: none; }
  .data-table tbody td { display: block; padding: 8px 16px; }
  .data-table tbody td:first-child { padding-top: 14px; }
  .data-table tbody td:last-child { padding-bottom: 14px; }
  .data-table tbody tr { display: block; border-bottom: 1px solid #E5E7EB; }
}

/* =====================================================
   SIDEBAR FIXES — match actual HTML class names
   ===================================================== */

/* Tighter, scrollable nav so all items fit */
.sidebar-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 10px;
  min-height: 0;            /* essential for flex+overflow */
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.15);
  border-radius: 3px;
}
.sidebar-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin-bottom: 2px;
  border-radius: 8px;
  color: var(--text, #111827);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s;
}
.sidebar-nav .nav-item:hover { background: rgba(124, 58, 237, 0.06); }
.sidebar-nav .nav-item.active {
  background: rgba(124, 58, 237, 0.10);
  color: var(--primary, #7C3AED);
  font-weight: 600;
}
.sidebar-nav .nav-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 13px;
  flex-shrink: 0;
}
.sidebar-nav .bg-purple { background: linear-gradient(135deg, #7C3AED, #A855F7); }
.sidebar-nav .bg-blue   { background: linear-gradient(135deg, #3B82F6, #2563EB); }
.sidebar-nav .bg-green  { background: linear-gradient(135deg, #10B981, #059669); }
.sidebar-nav .bg-pink   { background: linear-gradient(135deg, #EC4899, #DB2777); }
.sidebar-nav .bg-orange { background: linear-gradient(135deg, #F97316, #EA580C); }
.sidebar-nav .bg-yellow { background: linear-gradient(135deg, #F59E0B, #D97706); }
.sidebar-nav .bg-red    { background: linear-gradient(135deg, #EF4444, #DC2626); }
.sidebar-nav .bg-gray   { background: linear-gradient(135deg, #6B7280, #4B5563); }

/* Sidebar footer with .user-card / .user-name / .user-status */
.sidebar-footer {
  flex-shrink: 0;
  border-top: 1px solid #E5E7EB;
  padding: 12px;
}
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-card .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary, #7C3AED), var(--secondary, #EC4899));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.user-card .user-info { flex: 1; min-width: 0; overflow: hidden; }
.user-card .user-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text, #111827);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-card .user-status {
  font-size: 11px;
  color: #10B981;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}
.user-card .user-status .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10B981;
  display: inline-block;
}

/* Brand at top of sidebar (white text on gradient bg) */
.sidebar-brand {
  flex-shrink: 0;
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--primary, #7C3AED) 0%, var(--secondary, #EC4899) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.sidebar-brand .brand-icon {
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,0.2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.sidebar-brand .brand-text { font-weight: 700; }

/* Ensure sidebar itself stays flex-column with no overflow */
.sidebar {
  width: 240px;
  background: white;
  border-right: 1px solid #E5E7EB;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow: hidden;
}

/* Update main wrapper margin to match new width */
.main, .main-wrapper { margin-left: 240px; }
@media (max-width: 1024px) {
  .main, .main-wrapper { margin-left: 0; }
}

/* =====================================================
   BIRTHDAY CARD with segmented control
   ===================================================== */
.form-group-full { grid-column: 1 / -1; }

.birthday-card {
    background: linear-gradient(135deg, #F5F3FF 0%, #FAF5FF 100%);
    border: 1px solid #E9D5FF;
    border-radius: 12px;
    padding: 18px;
}
.birthday-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6D28D9;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 12px;
}
.birthday-card-title i { font-size: 16px; }

.segmented-control {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    background: #EDE9FE;
    padding: 4px;
    border-radius: 10px;
    margin-bottom: 12px;
}
.seg-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 7px;
    font-weight: 500;
    font-size: 13px;
    color: #6D28D9;
    cursor: pointer;
    transition: all 0.15s;
}
.seg-btn:hover { background: rgba(124, 58, 237, 0.05); }
.seg-btn.active {
    background: var(--primary, #7C3AED);
    color: white;
    box-shadow: 0 2px 6px rgba(124, 58, 237, 0.3);
}
.seg-btn i { font-size: 13px; }

.bday-input { margin-bottom: 6px; }
.bday-input input,
.bday-input select {
    background: white;
    border: 1px solid #DDD6FE;
    border-radius: 8px;
    padding: 11px 14px;
    font-size: 14px;
    width: 100%;
    margin: 0;
}
.bday-input input:focus,
.bday-input select:focus {
    outline: none;
    border-color: var(--primary, #7C3AED);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}
.bday-monthday {
    display: flex;
    gap: 8px;
}
.bday-monthday select {
    flex: 1;
}

.birthday-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #7C3AED;
    font-size: 12px;
    margin: 8px 0 0;
}
.birthday-hint i {
    background: var(--primary, #7C3AED);
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .segmented-control { grid-template-columns: 1fr; }
    .seg-btn { padding: 9px; font-size: 12px; }
}

/* =====================================================
   CITY AUTOCOMPLETE
   ===================================================== */
.city-autocomplete {
    position: relative;
}
.city-suggestions {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    margin-top: 4px;
    max-height: 280px;
    overflow-y: auto;
    z-index: 100;
}
.city-sugg-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #F3F4F6;
    transition: background 0.1s;
}
.city-sugg-item:last-child { border-bottom: none; }
.city-sugg-item:hover,
.city-sugg-item.active {
    background: rgba(124, 58, 237, 0.08);
}
.city-sugg-name {
    font-weight: 500;
    color: #111827;
    font-size: 14px;
}
.city-sugg-dept {
    font-size: 12px;
    color: #6B7280;
    background: #F3F4F6;
    padding: 2px 8px;
    border-radius: 999px;
}

/* readonly department field looks softer */
input[readonly] {
    background: #F9FAFB;
    cursor: default;
    color: #4B5563;
}

/* Scrollbar for suggestions */
.city-suggestions::-webkit-scrollbar { width: 6px; }
.city-suggestions::-webkit-scrollbar-track { background: transparent; }
.city-suggestions::-webkit-scrollbar-thumb {
    background: rgba(124, 58, 237, 0.3);
    border-radius: 3px;
}

/* =====================================================
   ROLE BADGES (sidebar footer)
   ===================================================== */
.role-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-left: 4px;
    vertical-align: middle;
}
.role-badge.role-superadmin {
    background: linear-gradient(135deg, #F59E0B, #EF4444);
    color: white;
    box-shadow: 0 1px 4px rgba(245, 158, 11, 0.4);
}
.role-badge.role-admin    { background: #EDE9FE; color: #6D28D9; }
.role-badge.role-directora{ background: #FCE7F3; color: #BE185D; }
.role-badge.role-asesora  { background: #DBEAFE; color: #1E40AF; }

.user-avatar.avatar-superadmin {
    background: linear-gradient(135deg, #F59E0B, #EF4444);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.3);
    position: relative;
}
.user-avatar.avatar-superadmin::after {
    content: '★';
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: #F59E0B;
    color: white;
    font-size: 9px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* User card in sidebar - allow flex wrapping for badge */
.user-card .user-name {
    white-space: normal;
    line-height: 1.3;
}

/* =====================================================
   SETTINGS - TABS, SWITCHES & FEATURE FLAGS
   ===================================================== */

/* Tabs */
.settings-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    border-bottom: 2px solid #E5E7EB;
    overflow-x: auto;
}
.settings-tab {
    background: transparent;
    border: none;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 500;
    color: #6B7280;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: all 0.15s;
}
.settings-tab:hover { color: #111827; background: #F9FAFB; }
.settings-tab.active {
    color: #7C3AED;
    border-bottom-color: #7C3AED;
    font-weight: 600;
}

/* Superadmin banner */
.superadmin-banner {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(239, 68, 68, 0.08));
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 20px;
}
.superadmin-banner > i {
    font-size: 24px;
    color: #F59E0B;
    flex-shrink: 0;
}
.superadmin-banner strong { color: #92400E; font-size: 14px; }
.superadmin-banner p { margin: 4px 0 0; color: #6B7280; font-size: 13px; line-height: 1.5; }

/* Feature list (global toggles) */
.features-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.feature-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    transition: all 0.2s;
}
.feature-row:hover { border-color: #C4B5FD; background: #FAFAFB; }
.feature-row.flash-saved {
    background: #ECFDF5;
    border-color: #10B981;
}
.feature-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #7C3AED, #EC4899);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.feature-info { flex: 1; min-width: 0; }
.feature-label { font-weight: 600; color: #111827; font-size: 15px; }
.feature-desc { font-size: 12px; color: #6B7280; margin-top: 2px; }

/* iOS-style switch */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #D1D5DB;
    transition: 0.3s;
    border-radius: 999px;
}
.switch .slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.switch input:checked + .slider {
    background: linear-gradient(135deg, #7C3AED, #EC4899);
}
.switch input:checked + .slider::before {
    transform: translateX(22px);
}

/* User features matrix table */
.user-features-table-wrap {
    overflow-x: auto;
    margin-top: 12px;
}
.user-features-table {
    min-width: 800px;
}
.user-features-table thead th {
    font-size: 10px;
    padding: 10px 8px !important;
    text-align: center;
    line-height: 1.2;
}
.user-features-table thead th i {
    font-size: 16px;
    color: #7C3AED;
    display: block;
    margin-bottom: 2px;
}
.user-features-table thead th small {
    font-size: 9px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
}
.user-features-table tbody td {
    padding: 10px 8px !important;
}

.user-feature-toggle {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s;
}
.user-feature-toggle i { font-size: 22px; }
.user-feature-toggle:hover { background: #F3F4F6; transform: scale(1.1); }
.user-feature-toggle.state-inherit i { color: #9CA3AF; }
.user-feature-toggle.state-on i      { color: #10B981; }
.user-feature-toggle.state-off i     { color: #EF4444; }

.user-features-legend {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-top: 16px;
    padding: 12px;
    background: #F9FAFB;
    border-radius: 8px;
    font-size: 12px;
    flex-wrap: wrap;
}
.user-features-legend i { font-size: 16px; vertical-align: middle; margin-right: 4px; }
.user-features-legend .text-green i { color: #10B981; }
.user-features-legend .text-red i   { color: #EF4444; }
.user-features-legend .legend-hint {
    color: #6B7280;
    margin-left: auto;
    font-style: italic;
}

@media (max-width: 768px) {
    .settings-tab { padding: 10px 12px; font-size: 13px; }
    .feature-row { padding: 10px 12px; gap: 10px; }
    .feature-icon { width: 36px; height: 36px; font-size: 16px; }
    .feature-label { font-size: 14px; }
}

/* Delete action button */
.btn-action-delete {
    background: #FEE2E2;
    color: #B91C1C;
    border-color: #FCA5A5;
}
.btn-action-delete:hover { background: #FECACA; }

/* Muted text */
.text-muted { color: #9CA3AF; }

/* =====================================================
   PROFILE PAGE
   ===================================================== */
.profile-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 20px;
    align-items: start;
}
@media (max-width: 1024px) {
    .profile-grid { grid-template-columns: 1fr; }
}

.profile-header-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.05), rgba(236, 72, 153, 0.05));
    border-radius: 12px;
    margin-bottom: 24px;
    border: 1px solid #EDE9FE;
}
.profile-avatar-xl {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7C3AED, #EC4899);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    flex-shrink: 0;
    position: relative;
}
.profile-avatar-xl.avatar-superadmin {
    background: linear-gradient(135deg, #F59E0B, #EF4444);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
}
.profile-avatar-xl.avatar-superadmin::after {
    content: '★';
    position: absolute;
    bottom: -4px;
    right: -4px;
    background: #F59E0B;
    color: white;
    font-size: 12px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid white;
}

.profile-name-big {
    margin: 0;
    font-size: 20px;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.profile-email {
    margin: 6px 0 0;
    color: #6B7280;
    font-size: 14px;
}
.profile-email i { margin-right: 4px; }

.password-card h3 i { color: #F59E0B; }
.section-hint {
    font-size: 13px;
    color: #6B7280;
    margin: -4px 0 16px;
}

/* =====================================================
   PASSWORD STRENGTH INDICATOR
   ===================================================== */
.password-strength {
    margin-top: 10px;
    padding: 10px 12px;
    background: #F9FAFB;
    border-radius: 8px;
    border: 1px solid #E5E7EB;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 4px 12px;
}
.password-strength .req {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #9CA3AF;
    transition: color 0.2s;
}
.password-strength .req i {
    font-size: 14px;
    width: 14px;
    text-align: center;
    color: #D1D5DB;
}
.password-strength .req.valid {
    color: #059669;
}
.password-strength .req.valid i {
    color: #10B981;
}

/* =====================================================
   USER DROPDOWN MENU (topbar)
   ===================================================== */
.user-dropdown { position: relative; }

.user-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: 1px solid transparent;
    padding: 6px 10px 6px 6px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.15s;
}
.user-dropdown-trigger:hover {
    background: #F3F4F6;
    border-color: #E5E7EB;
}
.user-dropdown.open .user-dropdown-trigger {
    background: #F3F4F6;
    border-color: #E5E7EB;
}

.user-dropdown-trigger .topbar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7C3AED, #EC4899);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}
.user-dropdown-trigger .topbar-avatar.avatar-superadmin {
    background: linear-gradient(135deg, #F59E0B, #EF4444);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.3);
}

.topbar-username {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}
.topbar-name {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
}
.topbar-role {
    font-size: 11px;
    color: #6B7280;
}
.topbar-chevron {
    color: #9CA3AF;
    font-size: 11px;
    transition: transform 0.2s;
}
.user-dropdown.open .topbar-chevron {
    transform: rotate(180deg);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 260px;
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.12);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: all 0.18s;
    z-index: 1000;
}
.user-dropdown.open .user-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.05), rgba(236, 72, 153, 0.05));
    border-radius: 8px;
    margin-bottom: 4px;
}
.dropdown-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7C3AED, #EC4899);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.dropdown-avatar.avatar-superadmin {
    background: linear-gradient(135deg, #F59E0B, #EF4444);
}
.dropdown-name {
    font-weight: 600;
    color: #111827;
    font-size: 14px;
    line-height: 1.2;
}
.dropdown-email {
    font-size: 12px;
    color: #6B7280;
    margin-top: 2px;
    word-break: break-all;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: #374151;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    transition: background 0.1s;
}
.dropdown-item:hover {
    background: #F3F4F6;
}
.dropdown-item i {
    width: 18px;
    text-align: center;
    color: #6B7280;
}
.dropdown-item-danger {
    color: #DC2626;
}
.dropdown-item-danger:hover {
    background: #FEE2E2;
}
.dropdown-item-danger i {
    color: #DC2626;
}
.dropdown-divider {
    height: 1px;
    background: #E5E7EB;
    margin: 6px 0;
}

@media (max-width: 768px) {
    .topbar-username { display: none; }
    .topbar-chevron { display: none; }
}

/* =====================================================
   ACTIVATE / DEACTIVATE BUTTONS
   ===================================================== */
.btn-action-deactivate {
    background: #FEF3C7;
    color: #92400E;
    border-color: #FDE68A;
}
.btn-action-deactivate:hover { background: #FDE68A; }

.btn-action-activate {
    background: #D1FAE5;
    color: #065F46;
    border-color: #A7F3D0;
}
.btn-action-activate:hover { background: #A7F3D0; }

/* =====================================================
   MODAL
   ===================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.45);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 9000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}
.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}
body.modal-open { overflow: hidden; }

.modal-card {
    background: white;
    border-radius: 14px;
    width: 100%;
    max-width: 720px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    transform: translateY(12px) scale(0.98);
    transition: transform 0.2s;
}
.modal-overlay.open .modal-card {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    background: #F9FAFB;
    border-bottom: 1px solid #E5E7EB;
}
.modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #111827;
}
.modal-subtitle {
    margin: 4px 0 0;
    font-size: 13px;
    color: #6B7280;
}
.modal-close-x {
    background: transparent;
    border: none;
    color: #9CA3AF;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.15s;
}
.modal-close-x:hover {
    background: #F3F4F6;
    color: #111827;
}

.modal-body {
    padding: 24px;
}
.modal-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
@media (max-width: 600px) {
    .modal-grid-2 { grid-template-columns: 1fr; }
}

.modal-body .form-group { margin-bottom: 0; }
.modal-body .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}
.modal-body .required { color: #EF4444; }
.modal-body input[type="date"],
.modal-body select,
.modal-body textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #D1D5DB;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}
.modal-body input[type="date"]:focus,
.modal-body select:focus,
.modal-body textarea:focus {
    outline: none;
    border-color: #7C3AED;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}
.modal-body textarea {
    resize: vertical;
    min-height: 96px;
    font-family: inherit;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: #F9FAFB;
    border-top: 1px solid #E5E7EB;
}
.btn-text {
    background: transparent;
    border: none;
    color: #6B7280;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
}
.btn-text:hover { background: #F3F4F6; color: #111827; }

/* =====================================================
   TOAST
   ===================================================== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #111827;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 10000;
    max-width: 90%;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast-success { background: #059669; }
.toast-error   { background: #DC2626; }

/* =====================================================
   CALL ACTION BUTTON (already exists but ensure visibility)
   ===================================================== */
.btn-action-call {
    background: #DBEAFE;
    color: #1E40AF;
    border-color: #BFDBFE;
}
.btn-action-call:hover { background: #BFDBFE; }

/* =====================================================
   SUBSCRIPTION - Suscripción
   ===================================================== */
.sub-days-badge {
  background: #F3F4F6; padding: 2px 6px; border-radius: 999px;
  font-size: 11px; font-weight: 700; margin-left: auto;
}
.sub-days-badge.text-green { background: #D1FAE5; color: #065F46; }
.sub-days-badge.text-yellow { background: #FEF3C7; color: #92400E; }
.sub-days-badge.text-red { background: #FEE2E2; color: #991B1B; }

/* === Flash with warning type === */
.flash-warning { background: #FEF3C7; color: #92400E; border-left: 4px solid #F59E0B; }

/* === User dropdown sub-item styling === */
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; color: var(--text);
  font-size: 14px; transition: background 0.15s;
}
.dropdown-item:hover { background: #F3F4F6; }
.dropdown-item i { font-size: 16px; color: var(--text-muted); width: 20px; text-align: center; }
.dropdown-item-danger { color: var(--danger); }
.dropdown-item-danger:hover { background: #FEF2F2; }
.dropdown-header {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 4px;
}
.dropdown-header .dropdown-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
.dropdown-name { font-weight: 600; font-size: 14px; color: var(--text); }
.dropdown-email { font-size: 12px; color: var(--text-muted); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 16px; }

/* === Modal overlay open class === */
.modal-overlay.open { display: flex !important; }
.modal-open { overflow: hidden; }

/* === Toast notifications === */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 12px 24px; border-radius: 8px; color: white;
  font-size: 14px; font-weight: 500; z-index: 9999;
  animation: toastIn 0.3s ease;
}
.toast-success { background: #10B981; }
.toast-error { background: #EF4444; }
.toast-info { background: #3B82F6; }
.toast { opacity: 0; transition: opacity 0.3s; }
.toast.show { opacity: 1; }

/* === bg-orange utility === */
.bg-orange { background: #FED7AA !important; color: #9A3412 !important; }

/* === btn-text === */
.btn-text {
  background: transparent; border: none; color: var(--text-light);
  cursor: pointer; font-size: 14px; font-weight: 500;
  padding: 8px 16px; border-radius: var(--radius-sm);
}
.btn-text:hover { background: #F3F4F6; }
.nav-item-logout {
    color: #ef4444 !important;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: auto;
    padding-top: 12px;
}
.nav-item-logout:hover {
    background: rgba(239,68,68,0.1) !important;
}
.bg-red {
    background: rgba(239,68,68,0.15);
    color: #ef4444;
}
