:root {
  --purple: #5A2D91;
  --purple-light: #7B4FC0;
  --purple-dark: #3d1f65;
  --orange: #F06423;
  --green: #25D366;
  --green-dark: #128C7E;
  --bg: #f0f2f5;
  --sidebar-bg: #1a1a2e;
  --sidebar-text: #c5c6d0;
  --sidebar-hover: rgba(255,255,255,0.08);
  --white: #ffffff;
  --gray-100: #f8f9fa;
  --gray-200: #e9ecef;
  --gray-400: #ced4da;
  --gray-600: #6c757d;
  --gray-800: #343a40;
  --danger: #dc3545;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --radius: 12px;
  --font: 'Inter', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: var(--font); background: var(--bg); color: var(--gray-800); font-size: 14px; }
a { text-decoration: none; color: inherit; }
input, select, textarea, button { font-family: var(--font); font-size: 14px; outline: none; }

/* ====== LOGIN ====== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--purple-dark), var(--purple));
}
.login-card {
  background: var(--white);
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  justify-content: center;
}
.login-logo i { font-size: 36px; color: var(--green); }
.login-logo span { font-size: 24px; font-weight: 700; color: var(--purple); }
.login-card h2 { text-align: center; margin-bottom: 28px; color: var(--gray-800); font-size: 18px; font-weight: 600; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; color: var(--gray-800); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  transition: border-color 0.2s;
  background: var(--gray-100);
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: var(--purple);
  background: var(--white);
}
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.alert-error { background: #fff0f0; color: var(--danger); border: 1px solid #ffcdd2; }

/* ====== BUTTONS ====== */
.btn-primary {
  background: var(--purple);
  color: var(--white);
  border: none;
  padding: 12px 24px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s, transform 0.1s;
}
.btn-primary:hover { background: var(--purple-light); }
.btn-primary:active { transform: scale(0.98); }
.btn-full { width: 100%; }
.btn-secondary {
  background: var(--gray-200);
  color: var(--gray-800);
  border: none;
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
}
.btn-secondary:hover { background: var(--gray-400); }
.btn-danger {
  background: var(--danger);
  color: var(--white);
  border: none;
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
}
.btn-icon {
  background: none;
  border: 1.5px solid var(--gray-400);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--gray-600);
  transition: all 0.2s;
}
.btn-icon:hover { border-color: var(--purple); color: var(--purple); }
.btn-icon.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-icon.btn-danger:hover { background: var(--danger); color: var(--white); }

/* ====== APP LAYOUT ====== */
.app-layout {
  display: grid;
  grid-template-columns: 300px 1fr 280px;
  height: 100vh;
  overflow: hidden;
}

/* ====== SIDEBAR ====== */
.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid rgba(255,255,255,0.05);
}
.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.brand i { font-size: 24px; color: var(--green); }
.brand span { font-size: 18px; font-weight: 700; color: var(--white); }
.agent-info { display: flex; align-items: center; gap: 10px; }
.agent-avatar {
  width: 36px; height: 36px;
  background: var(--purple);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--white);
  font-size: 15px;
  flex-shrink: 0;
}
.agent-details { flex: 1; min-width: 0; }
.agent-name { display: block; font-weight: 600; color: var(--white); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-select {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--sidebar-text);
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 12px;
  width: 100%;
  margin-top: 3px;
}
.sidebar-section { flex: 1; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.section-title {
  padding: 12px 16px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.4);
  display: flex;
  align-items: center;
  gap: 6px;
}
.badge {
  background: var(--orange);
  color: var(--white);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
  margin-left: auto;
}
.badge-green { background: var(--green-dark); }
.conversation-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
}
.conversation-list::-webkit-scrollbar { width: 4px; }
.conversation-list::-webkit-scrollbar-track { background: transparent; }
.conversation-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.conv-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 2px;
}
.conv-item:hover, .conv-item.active { background: var(--sidebar-hover); }
.conv-item.active { background: rgba(90,45,145,0.4); }
.conv-avatar {
  width: 38px; height: 38px;
  background: var(--purple);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--white);
  font-size: 15px;
  flex-shrink: 0;
}
.conv-avatar-green { background: var(--green-dark); }
.conv-avatar-large { width: 44px; height: 44px; font-size: 18px; }
.conv-info { flex: 1; min-width: 0; }
.conv-name { font-size: 13px; font-weight: 600; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-preview { font-size: 12px; color: rgba(255,255,255,0.4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.conv-time { font-size: 11px; color: rgba(255,255,255,0.3); }
.unread-badge { background: var(--green); color: var(--white); border-radius: 10px; padding: 1px 6px; font-size: 11px; font-weight: 700; }
.btn-assign {
  background: var(--orange);
  border: none;
  color: var(--white);
  border-radius: 6px;
  width: 28px; height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.15s;
}
.btn-assign:hover { background: #d4561f; }
.empty-state { text-align: center; padding: 20px; color: rgba(255,255,255,0.2); font-size: 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty-state i { font-size: 20px; }
.btn-new-conv {
  background: var(--orange);
  border: none;
  color: var(--white);
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  margin-left: 8px;
  transition: background 0.15s;
}
.btn-new-conv:hover { background: #d4561f; }

/* ====== MODAL ====== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-box {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--purple);
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-header h3 i { color: var(--green); font-size: 20px; }
.modal-close {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--gray-600);
  cursor: pointer;
  padding: 4px;
}
.modal-close:hover { color: var(--danger); }
.contact-suggestions {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 100;
  max-height: 220px;
  overflow-y: auto;
  margin-top: 4px;
}
.suggestion-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.suggestion-item:hover { background: var(--gray-100); }
.suggestion-avatar {
  width: 34px; height: 34px;
  background: var(--purple);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--white); font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.suggestion-name { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.suggestion-phone { font-size: 12px; color: var(--gray-600); }

/* ====== SIDEBAR TABS ====== */
.sidebar-tabs {
  display: flex;
  padding: 8px 8px 0;
  gap: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-tab {
  flex: 1;
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  padding: 8px 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.sidebar-tab.active {
  color: var(--white);
  border-bottom-color: var(--orange);
}
.sidebar-tab-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.sidebar-tab-content.hidden { display: none; }

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s;
}
.sidebar-link:hover { background: var(--sidebar-hover); color: var(--white); }
.sidebar-link-danger:hover { background: rgba(220,53,69,0.15); color: var(--danger); }

/* ====== CHAT AREA ====== */
.chat-area {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
.chat-header {
  background: var(--white);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
  z-index: 1;
}
.chat-contact { display: flex; align-items: center; gap: 12px; }
.contact-name { font-weight: 700; font-size: 16px; }
.contact-phone { font-size: 12px; color: var(--gray-600); }
.chat-actions { display: flex; gap: 8px; }
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23000000' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.messages-container::-webkit-scrollbar { width: 5px; }
.messages-container::-webkit-scrollbar-thumb { background: var(--gray-400); border-radius: 3px; }

.message { display: flex; margin-bottom: 4px; }
.message-contact { justify-content: flex-start; }
.message-agent { justify-content: flex-end; }
.message-system { justify-content: center; }
.system-message {
  background: rgba(0,0,0,0.05);
  color: var(--gray-600);
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 12px;
  font-style: italic;
}
.message-bubble {
  max-width: 65%;
  padding: 10px 14px;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  position: relative;
}
.message-contact .message-bubble {
  background: var(--white);
  border-bottom-left-radius: 4px;
}
.message-agent .message-bubble {
  background: #dcf8c6;
  border-bottom-right-radius: 4px;
}
.message-sender { font-size: 11px; font-weight: 700; color: var(--purple); margin-bottom: 4px; }
.message-text { font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.message-time { font-size: 11px; color: var(--gray-600); text-align: right; margin-top: 4px; display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
/* ====== QUICK REPLIES ====== */
.qr-popup {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
  max-height: 280px;
  overflow-y: auto;
  z-index: 50;
}
.qr-popup-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.15s;
}
.qr-popup-item:last-child { border-bottom: none; }
.qr-popup-item:hover { background: #f3eeff; }
.qr-popup-title { font-size: 13px; font-weight: 700; color: var(--purple); margin-bottom: 3px; }
.qr-popup-title i { color: var(--orange); margin-right: 4px; }
.qr-popup-preview { font-size: 12px; color: var(--gray-600); }

/* Quick replies settings */
.quick-replies-list { display: flex; flex-direction: column; gap: 10px; }
.qr-item {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
}
.qr-info { flex: 1; min-width: 0; }
.qr-title { font-size: 14px; font-weight: 700; color: var(--purple); margin-bottom: 4px; }
.qr-title i { color: var(--orange); margin-right: 6px; }
.qr-content { font-size: 13px; color: var(--gray-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qr-actions { display: flex; gap: 6px; flex-shrink: 0; }
.empty-card {
  text-align: center;
  padding: 48px 20px;
  background: var(--white);
  border-radius: var(--radius);
  color: var(--gray-400);
  box-shadow: var(--shadow);
}
.empty-card i { font-size: 36px; margin-bottom: 12px; display: block; }
.empty-card p { font-size: 15px; font-weight: 600; color: var(--gray-600); }
.empty-card small { font-size: 13px; }

.msg-image { max-width: 260px; max-height: 260px; border-radius: 8px; display: block; cursor: pointer; }
.msg-sticker { max-width: 160px; max-height: 160px; display: block; background: transparent; }
.msg-video { max-width: 260px; border-radius: 8px; display: block; }
.msg-audio { width: 220px; margin: 4px 0; }
.msg-document { display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,0.06); border-radius: 8px; padding: 10px 14px; color: var(--purple); font-weight: 600; text-decoration: none; }
.msg-document:hover { background: rgba(0,0,0,0.1); }
.message-caption { font-size: 13px; margin-top: 6px; color: var(--gray-800); }

.chat-input-area {
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  padding: 16px 24px;
  position: relative;
}
.chat-tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.tab-btn {
  background: none;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-600);
  transition: all 0.15s;
}
.tab-btn.active { background: var(--purple); color: var(--white); border-color: var(--purple); }
.tab-content.hidden { display: none; }
.input-row { display: flex; gap: 10px; align-items: flex-end; }
.input-row textarea {
  flex: 1;
  padding: 12px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: 12px;
  resize: none;
  transition: border-color 0.2s;
  background: var(--gray-100);
  line-height: 1.5;
}
.input-row textarea:focus { border-color: var(--purple); background: var(--white); }
.btn-attach {
  background: none;
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  width: 40px; height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--gray-600);
  font-size: 16px;
  flex-shrink: 0;
  transition: all 0.2s;
}
.btn-attach:hover { border-color: var(--purple); color: var(--purple); }
.attach-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--gray-100);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--gray-800);
}
.attach-preview span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-remove-attach {
  background: none;
  border: none;
  color: var(--gray-600);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
}
.btn-remove-attach:hover { color: var(--danger); }
.btn-send {
  background: var(--purple);
  border: none;
  color: var(--white);
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
  transition: background 0.2s;
}
.btn-send:hover { background: var(--purple-light); }
.btn-send.btn-note { background: var(--orange); }
.btn-send.btn-note:hover { background: #d4561f; }

.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
  gap: 12px;
}
.chat-empty i { font-size: 64px; color: var(--green); opacity: 0.4; }
.chat-empty h3 { font-size: 20px; color: var(--gray-600); }
.chat-empty p { color: var(--gray-400); }

/* ====== INFO PANEL ====== */
.info-panel {
  background: var(--white);
  border-left: 1px solid var(--gray-200);
  overflow-y: auto;
  padding: 0;
}
.info-panel::-webkit-scrollbar { width: 4px; }
.info-panel::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 2px; }
.info-section {
  padding: 20px;
  border-bottom: 1px solid var(--gray-100);
}
.info-section h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-600);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--gray-100);
}
.info-row label { color: var(--gray-600); font-weight: 500; }
.info-row span { color: var(--gray-800); font-weight: 600; text-align: right; }
.transfer-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 6px 0;
  color: var(--gray-600);
}
.transfer-item i { color: var(--orange); }
.note-item {
  background: #fffde7;
  border-left: 3px solid var(--orange);
  border-radius: 0 8px 8px 0;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.note-author { font-size: 11px; font-weight: 700; color: var(--orange); margin-bottom: 4px; }
.note-content { font-size: 13px; line-height: 1.4; }
.note-time { font-size: 11px; color: var(--gray-600); margin-top: 4px; }
.empty-text { font-size: 12px; color: var(--gray-400); font-style: italic; }
.btn-edit-contact {
  background: none;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  width: 24px; height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--gray-600);
  font-size: 11px;
  margin-left: auto;
  transition: all 0.15s;
}
.btn-edit-contact:hover { border-color: var(--purple); color: var(--purple); }
.agent-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-100);
}
.agent-mini-avatar {
  width: 30px; height: 30px;
  background: var(--purple);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--white); font-weight: 700; font-size: 12px;
  flex-shrink: 0;
}
.btn-transfer-agent {
  background: var(--purple);
  color: var(--white);
  border: none;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  margin-left: auto;
  transition: background 0.15s;
}
.btn-transfer-agent:hover { background: var(--purple-light); }
.btn-transfer-sector {
  background: var(--orange);
  color: var(--white);
  border: none;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  margin-left: auto;
}
.btn-transfer-sector:hover { background: #d4561f; }
.transfer-subtitle {
  font-size: 11px;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 6px 0;
}

/* ====== STATUS DOTS ====== */
.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-online { background: var(--green); }
.status-busy { background: var(--orange); }
.status-offline { background: var(--gray-400); }

/* ====== ADMIN ====== */
.admin-page { max-width: 1100px; margin: 0 auto; padding: 32px 24px; }
.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.admin-header h2 { font-size: 22px; font-weight: 700; color: var(--purple); display: flex; align-items: center; gap: 10px; }
.admin-grid { display: grid; grid-template-columns: 360px 1fr; gap: 24px; align-items: start; }
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card h3 { font-size: 16px; font-weight: 700; margin-bottom: 20px; color: var(--gray-800); }
.table { width: 100%; border-collapse: collapse; }
.table th { padding: 10px 12px; text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; color: var(--gray-600); border-bottom: 2px solid var(--gray-200); }
.table td { padding: 12px 12px; border-bottom: 1px solid var(--gray-100); font-size: 13px; }
.badge-role { padding: 3px 10px; border-radius: 100px; font-size: 11px; font-weight: 600; }
.badge-role-admin { background: #ede7f6; color: var(--purple); }
.badge-role-supervisor { background: #e3f2fd; color: #1565c0; }
.badge-role-agent { background: var(--gray-100); color: var(--gray-600); }
.mt-2 { margin-top: 12px; }

/* ====== SETTINGS ====== */
.settings-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100vh;
  overflow: hidden;
}
.settings-nav {
  background: var(--sidebar-bg);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.settings-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.settings-brand i { font-size: 22px; color: var(--green); }
.settings-brand span { font-size: 17px; font-weight: 700; color: var(--white); }
.settings-back {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,0.4);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 12px;
  transition: all 0.15s;
}
.settings-back:hover { background: var(--sidebar-hover); color: var(--white); }
.settings-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s;
}
.settings-link:hover, .settings-link.active {
  background: rgba(90,45,145,0.4);
  color: var(--white);
}
.settings-content {
  overflow-y: auto;
  padding: 36px 40px;
  background: var(--bg);
}
.settings-section { max-width: 860px; }
.settings-section.hidden { display: none; }
.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--gray-200);
}
.settings-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--purple);
  display: flex;
  align-items: center;
  gap: 10px;
}
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.agent-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
}
.agent-card-avatar {
  width: 44px; height: 44px;
  background: var(--purple);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px; color: var(--white);
  flex-shrink: 0;
}
.agent-card-info { flex: 1; min-width: 0; }
.agent-card-name { font-weight: 700; font-size: 14px; color: var(--gray-800); }
.agent-card-email { font-size: 12px; color: var(--gray-600); margin: 2px 0 6px; }
.agent-card-meta { display: flex; align-items: center; gap: 6px; }
.agent-card-status { font-size: 11px; color: var(--gray-600); }
.agent-card-actions { flex-shrink: 0; }
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 8px 10px;
}
.checkbox-item input { width: auto; }
.sector-create-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}
.sector-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sector-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--gray-200);
  background: var(--white);
}
.sector-name-input {
  flex: 1;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 8px 10px;
}
.sector-actions {
  display: flex;
  gap: 8px;
}

.qr-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.qr-filters {
  display: flex;
  align-items: center;
  gap: 10px;
}
.qr-filters input,
.qr-filters select {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 220px;
}
.qr-table-wrap {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 16px;
  overflow: hidden;
}
.qr-table {
  width: 100%;
  border-collapse: collapse;
}
.qr-table th {
  text-align: left;
  font-size: 12px;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-200);
}
.qr-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.qr-row:last-child td { border-bottom: none; }
.qr-name { font-weight: 700; color: var(--gray-800); }
.qr-text {
  color: var(--gray-800);
  max-width: 340px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qr-dept { color: var(--gray-600); }
.qr-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #ede7f6;
  color: var(--purple);
}
.qr-col-actions { width: 120px; }
.qr-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.wa-status-card, .profile-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  max-width: 500px;
}
.profile-avatar {
  width: 72px; height: 72px;
  background: var(--purple);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: var(--white);
  margin: 0 auto 24px;
}
.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }

/* ====== WHATSAPP STATUS ====== */
.whatsapp-card { max-width: 500px; margin: 0 auto; text-align: center; }
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-radius: 100px;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 24px;
}
.status-indicator i { font-size: 28px; }
.status-connected { background: #e8f5e9; color: var(--green-dark); }
.status-qr_pending { background: #fff8e1; color: #f57f17; }
.status-disconnected { background: var(--gray-100); color: var(--gray-600); }
.wa-actions { display: flex; justify-content: center; gap: 12px; }
