/* Thynk Chat Dashboard — Matching Website Design */

* { box-sizing: border-box; margin: 0; padding: 0; font-family: inherit; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f8fafc;
  color: #0f172a;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ============ LAYOUT ============ */
.layout { display: flex; min-height: 100vh; }

.main-content {
  flex: 1;
  margin-left: 280px;
  padding: 40px 48px;
  min-height: 100vh;
}

/* ============ SIDEBAR ============ */
.sidebar {
  width: 280px;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

/* Logo */
.sidebar-logo {
  padding: 20px 24px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.sidebar-logo-icon {
  width: 40px;
  height: 40px;
  background: #2563eb;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.03em;
}

/* Navigation */
.sidebar-nav {
  padding: 8px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  min-height: 0;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: #64748b;
  transition: all 0.2s ease;
  cursor: pointer;
}

.sidebar-nav-item:hover {
  background: #f1f5f9;
  color: #334155;
}

.sidebar-nav-item.active {
  background: #eff6ff;
  color: #2563eb;
  font-weight: 600;
}

.sidebar-nav-item .nav-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Kill any cached ::before from old CSS */
.sidebar-nav-item::before,
.sidebar-nav-item.active::before {
  display: none !important;
  content: none !important;
}

/* Section labels */
.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 18px 4px;
}

/* Collapsible section toggle */
.sidebar-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s;
  margin: 0 16px;
}

.sidebar-section-toggle:hover {
  background: #f1f5f9;
  color: #334155;
}

.sidebar-section-toggle.open {
  color: #334155;
}

.sidebar-section-toggle-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sidebar-chevron {
  transition: transform 0.2s;
  opacity: 0.5;
}

.sidebar-chevron.open {
  transform: rotate(180deg);
}

/* Sub items (collapsed by default) */
.sidebar-sub {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
  padding: 0 16px 0 32px;
}

.sidebar-sub.open {
  max-height: 200px;
}

.sidebar-sub-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  transition: all 0.2s;
  cursor: pointer;
}

.sidebar-sub-item:hover {
  background: #f1f5f9;
  color: #334155;
}

.sidebar-sub-item.active {
  background: #eff6ff;
  color: #2563eb;
  font-weight: 600;
}

/* Footer */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid #e2e8f0;
  margin-top: auto;
}

/* User menu dropdown */
.sidebar-user-menu { position: relative; }

.sidebar-user-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.sidebar-user-trigger:hover { background: #f1f5f9; }

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #dbeafe;
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-email {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-chevron {
  color: #94a3b8;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.sidebar-user-dropdown {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  overflow: hidden;
  z-index: 200;
}

.sidebar-user-dropdown.open {
  display: block;
  animation: dropdownIn 0.15s ease;
}

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

.sidebar-dropdown-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.sidebar-dropdown-divider { height: 1px; background: #f1f5f9; }

.sidebar-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: background 0.15s;
}

.sidebar-dropdown-item:hover { background: #f8fafc; }
.sidebar-dropdown-item svg { width: 18px; height: 18px; color: #94a3b8; }

.sidebar-dropdown-signout { color: #dc2626; }
.sidebar-dropdown-signout:hover { background: #fef2f2; }
.sidebar-dropdown-signout svg { color: #dc2626; }

/* Mobile */
.mobile-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 99; }
.sidebar-overlay.visible { display: block; }

@media (max-width: 768px) {
  .mobile-toggle { display: flex; }
  .sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 80px 20px 32px; }
}

/* ============ PAGE HEADER ============ */
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 22px; font-weight: 600; color: #0f172a; letter-spacing: -0.01em; }
.page-header p { font-size: 14px; color: #94a3b8; margin-top: 4px; }

/* ============ STAT CARDS ============ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border-radius: 10px;
  padding: 20px 24px;
  border: 1px solid #e2e8f0;
}

.stat-card-label {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.stat-card-value {
  font-size: 28px;
  font-weight: 600;
  color: #0f172a;
  letter-spacing: -0.02em;
  line-height: 1;
}

.stat-card-trend {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  margin-top: 10px;
  padding: 3px 10px;
  border-radius: 20px;
}

.stat-card-trend.up { color: #059669; background: #d1fae5; }
.stat-card-trend.down { color: #dc2626; background: #fee2e2; }

@media (max-width: 1200px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .stats-grid { grid-template-columns: 1fr; } }

/* ============ CARDS ============ */
.card {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  border: 1px solid #e2e8f0;
  margin-bottom: 20px;
  width: 100%;
}

.card-full {
  min-height: calc(100vh - 200px);
}

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

.card-title { font-size: 15px; font-weight: 600; color: #0f172a; }

.grid-2 {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* ============ EMPTY STATE ============ */
.empty-state { text-align: center; padding: 56px 20px; color: #94a3b8; }
.empty-state-icon { margin: 0 auto 16px; width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; color: #cbd5e1; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: #475569; margin-bottom: 6px; }
.empty-state p { font-size: 14px; color: #94a3b8; }

/* ============ TABLES ============ */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; font-size: 11px; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.06em; padding: 14px 16px; border-bottom: 1px solid #e2e8f0; }
tbody td { padding: 16px; font-size: 14px; border-bottom: 1px solid #f1f5f9; color: #334155; }
tbody tr:hover { background: #f8fafc; }
tbody tr.clickable { cursor: pointer; }

/* ============ BADGES ============ */
.badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; }
.badge-hot { background: #fee2e2; color: #dc2626; }
.badge-warm { background: #fef3c7; color: #d97706; }
.badge-cold { background: #dbeafe; color: #2563eb; }
.badge-primary { background: #dbeafe; color: #2563eb; }
.badge-success { background: #d1fae5; color: #059669; }
.badge-warning { background: #fef3c7; color: #d97706; }
.badge-neutral { background: #f1f5f9; color: #64748b; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; box-shadow: 0 4px 12px rgba(37,99,235,0.3); }
.btn-secondary { background: #f1f5f9; color: #334155; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-success { background: #059669; color: #fff; }
.btn-success:hover { background: #047857; }
.btn-ghost { background: transparent; color: #64748b; padding: 8px 12px; }
.btn-ghost:hover { background: #f1f5f9; color: #0f172a; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-group { display: flex; gap: 10px; }

/* ============ FORMS ============ */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 14px; font-weight: 600; color: #334155; margin-bottom: 8px; }

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  color: #0f172a;
  background: #fff;
  transition: all 0.2s;
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-input::placeholder { color: #94a3b8; }
.form-textarea { resize: vertical; min-height: 100px; }
.form-hint { font-size: 12px; color: #94a3b8; margin-top: 6px; }

.range-slider { width: 100%; accent-color: #2563eb; height: 6px; }
.range-labels { display: flex; justify-content: space-between; font-size: 12px; color: #94a3b8; margin-top: 4px; }

.color-picker-group { display: flex; align-items: center; gap: 12px; }
.color-picker-group input[type="color"] { width: 44px; height: 44px; border: 1px solid #e2e8f0; border-radius: 10px; cursor: pointer; padding: 2px; }

.filter-bar { display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.filter-bar .form-input, .filter-bar .form-select { width: auto; min-width: 200px; padding: 10px 14px; font-size: 14px; }
.search-input-wrapper { position: relative; flex: 1; min-width: 220px; }
.search-input-wrapper .form-input { padding-left: 40px; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #94a3b8; }

/* ============ LOGIN ============ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  padding: 20px;
}

.login-container { width: 100%; max-width: 440px; }

.login-logo { text-align: center; margin-bottom: 36px; }

.login-logo-icon {
  width: 60px;
  height: 60px;
  background: #2563eb;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin-bottom: 20px;
}

.login-logo h1 { font-size: 24px; font-weight: 800; color: #0f172a; letter-spacing: -0.03em; }
.login-logo p { font-size: 15px; color: #94a3b8; margin-top: 4px; }

.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 36px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 24px rgba(0,0,0,0.04);
}

.login-card h2 { font-size: 20px; font-weight: 700; color: #0f172a; margin-bottom: 28px; text-align: center; }

.login-error { background: #fef2f2; color: #dc2626; padding: 12px 16px; border-radius: 12px; font-size: 14px; margin-bottom: 20px; display: none; border: 1px solid #fecaca; }
.login-error.visible { display: block; }

.login-toggle { text-align: center; margin-top: 24px; font-size: 14px; color: #94a3b8; }
.login-toggle a { color: #2563eb; font-weight: 600; cursor: pointer; }
.login-toggle a:hover { text-decoration: underline; }

/* ============ ONBOARDING ============ */
.onboarding-page { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; background: #f8fafc; padding: 60px 20px; }
.onboarding-container { width: 100%; max-width: 740px; }
.onboarding-header { text-align: center; margin-bottom: 36px; }
.onboarding-header h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; }
.onboarding-header p { font-size: 15px; color: #94a3b8; margin-top: 8px; }

.progress-steps { display: flex; align-items: center; justify-content: center; margin-bottom: 36px; }
.progress-step { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: #94a3b8; }
.progress-step.active { color: #2563eb; }
.progress-step.completed { color: #059669; }
.progress-step-number { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; background: #f1f5f9; color: #94a3b8; }
.progress-step.active .progress-step-number { background: #2563eb; color: #fff; }
.progress-step.completed .progress-step-number { background: #059669; color: #fff; }
.progress-line { width: 40px; height: 2px; background: #e2e8f0; margin: 0 8px; }
.progress-line.completed { background: #059669; }

.onboarding-card { background: #fff; border-radius: 20px; padding: 36px; border: 1px solid #e2e8f0; }
.onboarding-card h2 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.onboarding-card > p { font-size: 15px; color: #94a3b8; margin-bottom: 28px; }
.onboarding-actions { display: flex; justify-content: space-between; margin-top: 32px; padding-top: 24px; border-top: 1px solid #e2e8f0; }

.crawl-preview { background: #f8fafc; border-radius: 14px; padding: 24px; margin-top: 24px; border: 1px solid #e2e8f0; }
.crawl-preview-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid #e2e8f0; font-size: 14px; }
.crawl-preview-item:last-of-type { border-bottom: none; }
.crawl-preview-label { color: #94a3b8; font-weight: 500; }
.crawl-preview-value { color: #0f172a; font-weight: 600; }
.crawl-confirm-btns { display: flex; gap: 10px; margin-top: 20px; }

/* Widget Preview */
.widget-preview-frame { margin: 24px 0; display: flex; justify-content: center; gap: 24px; align-items: flex-end; }
.widget-preview-chat { width: 300px; border-radius: 20px; overflow: hidden; box-shadow: 0 8px 32px rgba(0,0,0,0.12); }
.widget-preview-header { padding: 16px 20px; color: #fff; font-size: 15px; font-weight: 600; display: flex; align-items: center; }
.widget-preview-messages { background: #fff; padding: 24px; min-height: 120px; }
.widget-preview-msg { background: #f1f5f9; padding: 12px 16px; border-radius: 14px; font-size: 14px; color: #334155; }
.widget-preview-bubble { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,0.15); }

.embed-code { background: #0f172a; border-radius: 14px; padding: 20px 24px; position: relative; overflow-x: auto; }
.embed-code code { color: #7dd3fc; font-size: 13px; font-family: 'Fira Code', 'Cascadia Code', monospace; white-space: pre; }
.copy-btn { position: absolute; top: 12px; right: 12px; background: rgba(255,255,255,0.1); color: #fff; border: none; border-radius: 8px; padding: 6px 14px; font-size: 12px; cursor: pointer; font-weight: 500; }
.copy-btn:hover { background: rgba(255,255,255,0.2); }

/* ============ CONVERSATIONS ============ */
.conversation-item { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-bottom: 1px solid #f1f5f9; cursor: pointer; transition: background 0.15s; border-radius: 12px; margin: 0 -8px; }
.conversation-item:hover { background: #f8fafc; }
.conversation-avatar { width: 42px; height: 42px; border-radius: 50%; background: #dbeafe; color: #2563eb; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; flex-shrink: 0; }
.conversation-info { flex: 1; min-width: 0; }
.conversation-info h4 { font-size: 14px; font-weight: 600; color: #0f172a; }
.conversation-info p { font-size: 13px; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============ PAGINATION ============ */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 24px 0; }
.pagination button { width: 38px; height: 38px; border-radius: 10px; border: 1px solid #e2e8f0; background: #fff; cursor: pointer; font-size: 14px; font-weight: 500; transition: all 0.15s; }
.pagination button:hover { background: #f1f5f9; }
.pagination button.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============ TOASTS ============ */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 10000; display: flex; flex-direction: column; gap: 10px; }
.toast { padding: 14px 22px; border-radius: 14px; font-size: 14px; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,0.1); animation: toastIn 0.3s ease; cursor: pointer; max-width: 380px; }
.toast-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.toast-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.toast-warning { background: #fef3c7; color: #854d0e; border: 1px solid #fde68a; }
.toast-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.toast.removing { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px); } }

/* ============ MODALS ============ */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.5); display: flex; align-items: center; justify-content: center; z-index: 9999; padding: 20px; backdrop-filter: blur(4px); }
.modal-overlay.hidden { display: none; }
.modal-content { background: #fff; border-radius: 20px; max-width: 680px; width: 100%; max-height: 85vh; overflow-y: auto; padding: 36px; box-shadow: 0 24px 64px rgba(0,0,0,0.15); }

/* ============ LOADING ============ */
.loading-overlay { position: fixed; inset: 0; background: rgba(255,255,255,0.8); display: flex; align-items: center; justify-content: center; z-index: 9998; backdrop-filter: blur(2px); }
.loading-overlay.hidden { display: none; }
.spinner { width: 36px; height: 36px; border: 3px solid #e2e8f0; border-top-color: #2563eb; border-radius: 50%; animation: spin 0.7s linear infinite; }
.spinner-sm { display: inline-block; width: 18px; height: 18px; border: 2px solid #e2e8f0; border-top-color: #2563eb; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-inline { text-align: center; padding: 48px; color: #94a3b8; font-size: 15px; }

/* ============ ANIMATIONS ============ */
.fade-in { animation: fadeIn 0.3s ease; }
.slide-up { animation: slideUp 0.35s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* ============ ANALYTICS ============ */
.date-range-selector { display: flex; gap: 6px; margin-bottom: 28px; }
.date-range-selector button { padding: 8px 20px; border-radius: 10px; border: 1px solid #e2e8f0; background: #fff; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.date-range-selector button.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.date-range-selector button:hover:not(.active) { background: #f1f5f9; }

/* ============ SETTINGS ============ */
.settings-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 32px;
  align-items: start;
}

@media (max-width: 1100px) { .settings-layout { grid-template-columns: 1fr; } }

.settings-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.settings-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 20px;
}

/* Brand DNA Grid */
.brand-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

@media (max-width: 900px) { .brand-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .brand-grid { grid-template-columns: 1fr; } }

.brand-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 28px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.brand-card:hover {
  border-color: #2563eb;
  box-shadow: 0 4px 16px rgba(37,99,235,0.08);
}

.brand-card-tall {
  grid-row: span 2;
  display: flex;
  flex-direction: column;
}

.brand-card-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
}

.brand-card-tall .brand-card-content {
  min-height: 160px;
}

.brand-card-label {
  font-size: 14px;
  font-weight: 600;
  color: #94a3b8;
  margin-top: 16px;
}

.brand-card-edit {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  background: #f1f5f9;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  opacity: 0;
  transition: opacity 0.2s;
}

.brand-card:hover .brand-card-edit { opacity: 1; }

.position-mini-preview {
  width: 80px;
  height: 56px;
  background: #f1f5f9;
  border-radius: 10px;
  position: relative;
  border: 1px solid #e2e8f0;
}

.position-mini-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #2563eb;
  border-radius: 50%;
}

/* Editor two-column layout */
.editor-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 32px;
  align-items: start;
}

@media (max-width: 1100px) { .editor-layout { grid-template-columns: 1fr; } }

.editor-forms { display: flex; flex-direction: column; gap: 0; }
.editor-preview { }

/* Settings two-column layout */
.settings-two-col {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 28px;
  align-items: start;
}

@media (max-width: 1100px) { .settings-two-col { grid-template-columns: 1fr; } }

.settings-forms { display: flex; flex-direction: column; gap: 0; }
.settings-preview { }

.settings-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 20px;
}

.settings-card h3 {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f1f5f9;
}

/* Color field: color picker + text input side by side */
/* Data rows (structured crawl data) */
.data-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 14px;
}

.data-row:last-of-type { border-bottom: none; }

.data-label {
  color: #94a3b8;
  font-weight: 500;
  min-width: 100px;
}

.data-value {
  color: #0f172a;
  font-weight: 500;
  text-align: right;
}

/* Logo upload area */
.logo-upload-area {
  width: 100%;
  min-height: 80px;
  background: #f8fafc;
  border: 2px dashed #e2e8f0;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: border-color 0.2s;
}

.logo-upload-area:hover { border-color: #94a3b8; }

.logo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 500;
}

/* Color blocks grid (vibiz style) */
.color-block-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
}

.color-block {
  position: relative;
  aspect-ratio: 1;
  border-radius: 16px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 10px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.color-block:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.color-block-hex {
  font-size: 11px;
  font-weight: 600;
  font-family: monospace;
  opacity: 0.8;
  pointer-events: none;
}

/* Color block editor (Chat Editor) */
.color-block-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.color-block-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.color-block-swatch {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: transform 0.15s;
}

.color-block-swatch:hover {
  transform: scale(1.05);
}

.color-hex-input {
  width: 80px;
  text-align: center;
  font-family: monospace;
  font-size: 12px;
  padding: 4px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  color: #64748b;
  outline: none;
}

.color-hex-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
}

.color-remove-btn {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  line-height: 1;
}

.color-remove-btn:hover {
  color: #dc2626;
}

/* Custom color picker */
.cp-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 9998;
}

.cp-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  width: 320px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  z-index: 9999;
}

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

.cp-preview { display: none; }

.cp-hex-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.cp-hex-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-family: monospace;
  font-size: 14px;
  outline: none;
}

.cp-hex-input:focus {
  border-color: #2563eb;
}

.cp-presets {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}

.cp-preset {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.1s;
}

.cp-preset:hover {
  transform: scale(1.15);
}

.cp-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.color-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-field input[type="color"] {
  width: 44px;
  height: 44px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  cursor: pointer;
  padding: 2px;
  flex-shrink: 0;
}

.color-field .form-input {
  flex: 1;
}

/* Position grid */
.position-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

@media (max-width: 600px) { .position-grid { grid-template-columns: repeat(2, 1fr); } }

.position-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  text-align: center;
}

.position-opt:hover { border-color: #94a3b8; }
.position-opt.active { border-color: #2563eb; background: #eff6ff; color: #2563eb; }
.position-opt input { display: none; }

/* Install tabs */
.install-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 20px;
}

.install-tab {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}

.install-tab:hover {
  color: #334155;
}

.install-tab.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

.install-step {
  padding: 4px 0;
}

.install-step ol {
  padding-left: 20px;
}

.pos-preview {
  width: 60px;
  height: 40px;
  background: #f1f5f9;
  border-radius: 8px;
  position: relative;
  border: 1px solid #e2e8f0;
}

.pos-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #2563eb;
  border-radius: 50%;
}

.settings-section h3 {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f1f5f9;
}

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } }

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

@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

.position-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.position-option {
  padding: 12px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.position-option:hover { background: #f8fafc; border-color: #cbd5e1; }
.position-option.active { background: #eff6ff; border-color: #2563eb; color: #2563eb; font-weight: 600; }

/* ============ CONVERSION FUNNEL ============ */
.funnel-visual {
  padding: 24px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.funnel-step-visual {
  display: flex;
  align-items: center;
  gap: 14px;
}

.funnel-step-label {
  min-width: 95px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  text-align: right;
  flex-shrink: 0;
}

.funnel-bar-track {
  flex: 1;
  background: #f1f5f9;
  border-radius: 8px;
  height: 38px;
  overflow: hidden;
}

.funnel-bar-fill {
  height: 100%;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 14px;
  transition: width 0.6s ease;
  min-width: fit-content;
}

.funnel-bar-fill.funnel-bar-1 {
  background: linear-gradient(135deg, #1e40af, #2563eb);
}

.funnel-bar-fill.funnel-bar-2 {
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
}

.funnel-bar-fill.funnel-bar-3 {
  background: linear-gradient(135deg, #93c5fd, #bfdbfe);
}

.funnel-bar-value {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.funnel-bar-fill.funnel-bar-3 .funnel-bar-value {
  color: #1e3a5f;
}

/* ============ APPOINTMENT CARD (Lead Detail) ============ */
.appointment-card {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
}

.appointment-card h4 {
  font-size: 14px;
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.appointment-card .appt-detail {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
}

.appointment-card .appt-detail-label {
  color: #64748b;
  font-weight: 500;
}

.appointment-card .appt-detail-value {
  color: #0f172a;
  font-weight: 600;
}

/* ============ CRAWLED CHUNKS VIEWER ============ */
.chunk-group {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
  background: #fff;
}

.chunk-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.chunk-item {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s ease;
}

.chunk-item:last-child {
  border-bottom: none;
}

.chunk-item:hover {
  background: #fafbfd;
}

.chunk-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.chunk-preview {
  font-size: 13px;
  color: #64748b;
  line-height: 1.6;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.chunk-type-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
  text-transform: capitalize;
  letter-spacing: 0.02em;
}

.chunk-type-general {
  background: #f1f5f9;
  color: #475569;
}

.chunk-type-property {
  background: #eff6ff;
  color: #2563eb;
}

.chunk-type-service {
  background: #f0fdf4;
  color: #16a34a;
}

.chunk-type-about {
  background: #fefce8;
  color: #a16207;
}

.chunk-type-faq {
  background: #fdf4ff;
  color: #9333ea;
}

.chunk-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

.chunk-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 4px 10px;
}

/* ============ CALENDAR / AGENDA PAGE ============ */

.calendar-page-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1100px) {
  .calendar-page-layout {
    grid-template-columns: 1fr;
  }
}

.calendar-left-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.calendar-right-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.calendar-card {
  padding: 24px;
}

.calendar-section-title {
  font-size: 16px;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 16px;
}

/* Calendar header - month navigation */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.calendar-month-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
}

/* Calendar grid */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-day-header {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 0 12px;
}

.calendar-day {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  background: #fff;
  border: 1px solid transparent;
  min-height: 44px;
}

.calendar-day:hover:not(.empty) {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.calendar-day.empty {
  cursor: default;
  background: transparent;
}

.calendar-day-number {
  font-size: 14px;
  font-weight: 500;
  color: #334155;
  line-height: 1;
}

/* Today */
.calendar-day.today {
  border: 2px solid #2563eb;
  background: #eff6ff;
}

.calendar-day.today .calendar-day-number {
  color: #2563eb;
  font-weight: 700;
}

/* Selected */
.calendar-day.selected {
  background: #2563eb;
  border-color: #2563eb;
}

.calendar-day.selected .calendar-day-number {
  color: #fff;
  font-weight: 700;
}

.calendar-day.selected .calendar-dot {
  background: #fff;
}

/* Unavailable */
.calendar-day.unavailable {
  background: #f8fafc;
}

.calendar-day.unavailable .calendar-day-number {
  color: #cbd5e1;
}

.calendar-day.unavailable:hover {
  background: #f1f5f9;
}

/* Appointment dot */
.calendar-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2563eb;
  margin-top: 4px;
}

.calendar-day.has-appointment .calendar-day-number {
  font-weight: 600;
}

/* Appointment list items */
.appointment-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin-bottom: 10px;
  background: #fff;
  transition: box-shadow 0.15s;
}

.appointment-list-item:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.appointment-item-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.appointment-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #dbeafe;
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.appointment-info {
  min-width: 0;
}

.appointment-name {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.appointment-contact {
  font-size: 13px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.appointment-reason {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
}

.appointment-item-right {
  text-align: right;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.appointment-time {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
}

.appointment-date {
  font-size: 12px;
  color: #94a3b8;
}

/* Availability grid (in calendar page) */
.availability-day {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
}

.availability-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  min-width: 110px;
}

.availability-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #2563eb;
  cursor: pointer;
}

.availability-day-label {
  font-weight: 600;
  font-size: 14px;
  color: #0f172a;
}

.availability-times {
  display: flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 480px) {
  .availability-day {
    flex-direction: column;
    align-items: flex-start;
  }
  .appointment-list-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .appointment-item-right {
    align-items: flex-start;
    text-align: left;
  }
}
