/* ==========================================
   GreenCRM — Design System
   Green Theme
   ========================================== */

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

/* ─── CSS Variables ──────────────────────────────────────────────── */
:root {
  /* Primary Green Palette */
  --primary:        hsl(161, 100%, 33%);
  --primary-light:  hsl(161, 70%,  95%);
  --primary-mid:    hsl(161, 60%,  85%);
  --primary-dark:   hsl(161, 100%, 22%);
  /* Button green — the redesigned pages' solid Figma colour, used by every
     .btn-primary so all pages share one button colour. */
  --btn-primary:       #0b7a50;
  --btn-primary-hover: #096943;
  --primary-glow:   hsla(161, 100%, 33%, 0.15);

  /* Accent */
  --accent:         hsl(145, 63%, 49%);
  --accent-light:   hsl(145, 63%, 92%);

  /* Sidebar (dark — also used by the login card). Light nav overrides these on .sidebar. */
  --sidebar-bg:     hsl(210, 25%, 10%);
  --sidebar-hover:  hsl(210, 20%, 16%);
  --sidebar-active: hsla(161, 100%, 33%, 0.18);
  --sidebar-text:   hsl(210, 15%, 65%);
  --sidebar-text-active: hsl(161, 80%, 70%);

  /* Page */
  --bg-page:        #f6f8f7;
  --bg-card:        #ffffff;
  --bg-input:       hsl(210, 20%, 98%);

  /* Text */
  --text-primary:   hsl(210, 20%, 14%);
  --text-secondary: hsl(210, 10%, 45%);
  --text-muted:     hsl(210, 8%, 62%);

  /* Borders */
  --border:         hsl(210, 15%, 88%);
  --border-focus:   var(--primary);

  /* Status Colors */
  --success:        hsl(142, 71%, 45%);
  --warning:        hsl(38, 92%, 50%);
  --danger:         hsl(0, 84%, 60%);
  --info:           hsl(207, 90%, 54%);

  --success-bg:     hsl(142, 71%, 95%);
  --warning-bg:     hsl(38, 92%, 95%);
  --danger-bg:      hsl(0, 84%, 95%);
  --info-bg:        hsl(207, 90%, 95%);

  /* Layout */
  --sidebar-width:  248px;
  --topbar-height:  60px;

  /* Shadows */
  --shadow-sm:  0 1px 3px hsla(210, 20%, 14%, 0.08);
  --shadow-md:  0 4px 16px hsla(210, 20%, 14%, 0.12);
  --shadow-lg:  0 8px 32px hsla(210, 20%, 14%, 0.16);
  --shadow-glow: 0 0 24px hsla(161, 100%, 33%, 0.25);

  /* Radius */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Reset & Base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ─── Typography ─────────────────────────────────────────────────── */
h1 { font-size: 1.75rem; font-weight: 700; color: var(--text-primary); }
h2 { font-size: 1.375rem; font-weight: 600; }
h3 { font-size: 1.125rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }
p  { color: var(--text-secondary); }

/* ─── App Layout ─────────────────────────────────────────────────── */
#app { display: flex; height: 100vh; overflow: hidden; color-scheme: light; }

.sidebar {
  --sidebar-bg:     #fbfcfc;
  --sidebar-hover:  hsl(150, 12%, 93%);
  --sidebar-active: hsl(150, 40%, 92%);
  --sidebar-text:   hsl(210, 10%, 38%);
  --sidebar-text-active: hsl(160, 45%, 18%);
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  overflow: hidden;
  z-index: 100;
  transition: width var(--transition-slow);
}

.sidebar-more::-webkit-scrollbar { width: 4px; }
.sidebar-more::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
  text-decoration: none !important;
  flex-shrink: 0;
}
.sidebar-logo-home { display:flex; flex-shrink:0; text-decoration:none !important; }

.sidebar-logo .logo-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  box-shadow: var(--shadow-glow);
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  line-height: 1.15;
}
.sidebar-brand-name {
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.sidebar-brand-org {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0;
}
.sidebar-brand-name { text-decoration:none; }
.sidebar-workspace-select {
  width: 100%;
  max-width: 190px;
  border: 0;
  padding: 1px 18px 1px 0;
  background: transparent;
  color: var(--text-muted);
  font-family:inherit;
  font-size:0.68rem;
  font-weight:500;
  line-height:1.3;
  cursor: pointer;
  outline-offset: 2px;
}
.sidebar-workspace-switch {
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  padding:0 16px 10px 60px;
  border-bottom:1px solid var(--border);
}
.sidebar-workspace-switch[hidden], .sidebar-workspace-select[hidden] { display:none; }
.sidebar-workspace-switch input {
  min-width:0;
  flex:1 1 130px;
  height:30px;
  padding:5px 8px;
  border:1px solid var(--border);
  border-radius:6px;
  background:var(--surface);
  color:var(--text-primary);
  font:inherit;
  font-size:0.72rem;
}
.sidebar-workspace-switch button {
  border:0;
  border-radius:6px;
  padding:0 9px;
  background:var(--primary);
  color:#fff;
  font-family:inherit;
  font-size:0.72rem;
  font-weight:600;
  cursor:pointer;
}
#sidebar-workspace-switch-error { flex-basis:100%; color:var(--danger, #b42318); font-size:0.7rem; }

.sidebar-search-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px 8px;
  flex-shrink: 0;
}
.sidebar-search {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
}
.sidebar-search .search-icon {
  position: absolute;
  left: 8px;
  color: var(--text-muted);
  font-size: 0.95rem;
  pointer-events: none;
}
.sidebar-search input {
  width: 100%;
  height: 32px;
  padding: 0 52px 0 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.8rem;
}
.sidebar-search input:focus {
  outline: none;
  border-color: var(--primary);
}
.sidebar-search-kbd {
  position: absolute;
  right: 8px;
  font-size: 0.65rem;
  font-family: inherit;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  pointer-events: none;
}
.sidebar-search-add {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.05rem;
}
.sidebar-search-add:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-light);
}

.sidebar-section { padding: 4px 0; }
.sidebar-section-pinned {
  padding: 8px 0 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  flex-shrink: 0;
}
.sidebar-pin-empty {
  padding: 10px 18px;
  font-size: 0.75rem;
  color: var(--sidebar-text);
  opacity: 0.55;
  line-height: 1.35;
}
.sidebar-item .nav-pin-btn {
  margin-left: auto;
  opacity: 0;
  color: var(--sidebar-text);
  padding: 2px 4px;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}
.sidebar-item:hover .nav-pin-btn,
.sidebar-item .nav-pin-btn.is-pinned {
  opacity: 0.85;
}
.sidebar-item .nav-pin-btn:hover {
  opacity: 1;
  color: var(--primary);
  background: var(--primary-light);
}
.sidebar-item .nav-pin-btn.is-pinned {
  color: var(--sidebar-text-active);
}
.sidebar-section-pinned .sidebar-item .nav-pin-btn {
  opacity: 0;
}
.sidebar-section-pinned .sidebar-item:hover .nav-pin-btn {
  opacity: 1;
}
.timeline-icon.user-avatar {
  padding: 0;
  overflow: hidden;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.75rem;
}
.timeline-icon.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.timeline-actor {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.prop-inline-edit {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.prop-inline-edit .form-control {
  font-size: 0.82rem;
  padding: 5px 8px;
  min-width: 140px;
  flex: 1;
}
.sidebar-section-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sidebar-text);
  opacity: 0.55;
  padding: 8px 18px 4px;
}

/* Collapsible section headers (HubSpot-style accordion) */
.sidebar-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 14px 8px 18px;
  border: none;
  background: transparent;
  color: var(--sidebar-text);
  cursor: pointer;
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
}
.sidebar-section-toggle:hover {
  background: var(--sidebar-hover);
  color: var(--text-primary);
}
.sidebar-section-toggle:focus-visible {
  outline: 2px solid hsla(161, 100%, 33%, 0.55);
  outline-offset: -2px;
}
.sidebar-section-label-text {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.7;
}
.sidebar-section-toggle:hover .sidebar-section-label-text { opacity: 1; }
.sidebar-section-chevron {
  font-size: 1rem;
  opacity: 0.55;
  transition: transform 0.18s ease;
}
.sidebar-section.collapsed .sidebar-section-chevron {
  transform: rotate(-90deg);
}
.sidebar-section-body {
  overflow: hidden;
}
.sidebar-section.collapsed .sidebar-section-body {
  display: none;
}
.sidebar-section.has-active:not(.sidebar-section-pinned) > .sidebar-section-toggle {
  color: var(--sidebar-text-active);
}
.sidebar-section.has-active:not(.sidebar-section-pinned) > .sidebar-section-toggle .sidebar-section-label-text {
  opacity: 1;
  color: var(--sidebar-text-active);
}

/* Nav sections sit in the sidebar itself (mock), not a More… flyout. */
.sidebar-more {
  position: relative;
  margin-top: 0;
  padding: 0 0 8px;
  border-top: none;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.sidebar-more-trigger,
.sidebar-more-panel-header {
  display: none;
}
.sidebar-more-trigger .sidebar-more-label { flex: 1; }
.sidebar-more-chevron { display: none; }
.sidebar-more-panel {
  position: static;
  width: auto;
  max-width: none;
  height: auto;
  max-height: none;
  background: transparent;
  border: none;
  box-shadow: none;
  overflow: visible;
  padding: 0;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
}
.sidebar-more-panel .sidebar-section { padding: 2px 0; }
.sidebar-more-panel .sidebar-item { padding-left: 18px; }
.sidebar-more-panel .sidebar-section:not(:has(.sidebar-item:not([hidden]))) {
  display: none;
}
.sidebar-more-close { display: none; }

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: var(--sidebar-text);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 0;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  position: relative;
  text-decoration: none !important;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.sidebar-item.sidebar-more-trigger { display: none !important; }

.sidebar-item:hover {
  background: var(--sidebar-hover);
  color: var(--text-primary);
}

.sidebar-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 3px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

.sidebar-item .icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  opacity: 0.85;
}

.sidebar-item .badge {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.sidebar-footer {
  margin-top: 0;
  flex-shrink: 0;
  padding: 8px 10px 14px;
  border-top: 1px solid var(--border);
}
.sidebar-footer .sidebar-item { padding: 8px 10px; border-radius: 8px; width: auto; }
.sidebar-footer .notification-dot {
  position: static;
  margin-left: auto;
  flex-shrink: 0;
}
.sidebar-report {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 2px 0 8px;
  padding: 6px 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  border-radius: 8px;
}
.sidebar-report:hover { background: var(--sidebar-hover); color: var(--text-primary); }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

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

.sidebar-user .user-info .name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.sidebar-user .user-info .role { font-size: 0.72rem; color: var(--sidebar-text); }

/* ─── Main Content ───────────────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Topbar ─────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title { font-weight: 600; font-size: 1rem; color: var(--text-primary); }

.hs-mirror-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 24px;
  background: hsl(243, 75%, 95%);
  color: #312e81;
  font-size: 0.82rem;
  border-bottom: 1px solid hsl(243, 60%, 85%);
  flex-shrink: 0;
}
.hs-mirror-banner span { flex: 1; }
.hs-mirror-banner button {
  padding: 4px 10px;
  border: 1px solid hsl(243, 60%, 70%);
  border-radius: 6px;
  background: #fff;
  color: #312e81;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.hs-mirror-banner button:hover { background: hsl(243, 75%, 95%); }

@media (min-width: 769px) {
  #app.on-dashboard .topbar,
  #app.hide-topbar .topbar { display: none; }
}

.topbar-search {
  flex: 1;
  max-width: 380px;
  margin-left: auto;
  position: relative;
}

.topbar-search input {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  padding: 7px 16px 7px 36px;
  font-size: 0.875rem;
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.topbar-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.topbar-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: none;
  overflow: hidden;
}

.search-results.visible { display: block; }
.search-section-header {
  padding: 8px 14px 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.search-result-item {
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: background var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}
.search-result-item:hover { background: var(--primary-light); }

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

.topbar-btn {
  width: 36px;
  height: 36px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.95rem;
  position: relative;
}

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

.notification-dot {
  display: none;
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid #fff;
  animation: pulse-dot 2s infinite;
}

/* ─── Page Content ───────────────────────────────────────────────── */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 28px 40px;
}

.page-content::-webkit-scrollbar { width: 6px; }
.page-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ─── Page Header ────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header-left h1 { font-size: 1.5rem; display: flex; align-items: center; gap: 8px; }
.page-header-left h1 .mdi { font-size: 1.35rem; color: var(--primary); }
.page-header-left p { font-size: 0.875rem; color: var(--text-muted); margin-top: 2px; }
.card-header h3 .mdi { margin-right: 6px; opacity: 0.85; }
.btn .mdi { font-size: 1.05em; vertical-align: -0.1em; }
.modal-close .mdi { font-size: 1.25rem; line-height: 1; }
.page-header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ─── Cards ──────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition);
}

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

.card-header h3 { font-size: 0.95rem; }
.card-body { padding: 20px; }

/* ─── Stat Cards ─────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

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

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-card .stat-icon {
  width: 44px;
  height: 44px;
  background: var(--primary-light);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 14px;
  color: var(--primary);
}

.stat-card .stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-card .stat-change {
  font-size: 0.78rem;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 3px;
  font-weight: 500;
}

.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ─── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none !important;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--btn-primary);
  color: #fff;
}
.btn-primary:hover { background: var(--btn-primary-hover); color: #fff; }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-input); border-color: var(--btn-primary); color: var(--btn-primary); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: hsl(0, 84%, 52%); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}
.btn-ghost:hover { background: var(--primary-light); color: var(--btn-primary); }

.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-lg { padding: 11px 24px; font-size: 0.95rem; }
.btn-icon { padding: 8px; }

/* ─── Form Controls ──────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 13px;
  font-size: 0.875rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: #fff;
}

.form-control::placeholder { color: var(--text-muted); }

textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2390a0b7' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

/* ─── Tables ─────────────────────────────────────────────────────── */
.table-wrapper {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

.table-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.filter-select {
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  font-size: 0.8rem;
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
}
.filter-select:focus { border-color: var(--primary); }

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead th {
  background: hsl(210, 14%, 97%);
  padding: 11px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--primary-light); }

tbody td {
  padding: 12px 16px;
  color: var(--text-primary);
  vertical-align: middle;
}

.table-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.table-empty .empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.table-empty p { font-size: 0.9rem; }

/* ─── Pagination ─────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

.pagination-info { font-size: 0.8rem; color: var(--text-muted); }

.pagination-controls { display: flex; gap: 4px; }

.page-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-secondary);
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── Badges / Tags ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-green   { background: var(--success-bg); color: hsl(142, 60%, 30%); }
.badge-blue    { background: var(--info-bg); color: hsl(207, 70%, 35%); }
.badge-yellow  { background: var(--warning-bg); color: hsl(38, 80%, 35%); }
.badge-orange  { background: hsl(30, 100%, 94%); color: hsl(25, 80%, 35%); }
.badge-red     { background: var(--danger-bg); color: hsl(0, 70%, 45%); }
.badge-gray    { background: hsl(210, 10%, 92%); color: var(--text-secondary); }
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }

/* ─── Saved View Tabs ────────────────────────────────────────────── */
.view-tab {
  padding: 8px 18px;
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -2px;
  transition: color var(--transition), border-color var(--transition);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.view-tab:hover { color: var(--primary); background: var(--primary-light); }
.view-tab.active { color: var(--primary); border-bottom-color: var(--primary); background: transparent; }

/* ─── Detail Grid (contact/deal/company detail pages) ────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 960px) {
  .detail-grid { grid-template-columns: 1fr; }
}

/* ─── Item List Row ──────────────────────────────────────────────── */
.item-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
  transition: background var(--transition);
}
.item-list-row:last-child { border-bottom: none; }
.item-list-row:hover { background: var(--primary-light); }

/* ─── Modal ──────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: hsla(210, 20%, 8%, 0.55);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

/* pointer-events enabled immediately — prevents click blocking during transition */
.modal-overlay.visible { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.15s ease;
}

.modal-overlay.visible .modal { transform: scale(1) translateY(0); }
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 960px; }

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

.modal-header h3 { font-size: 1rem; }

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }

.modal-body { padding: 24px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ─── Toast Notifications ────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 380px;
  transform: translateX(120%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.875rem;
}

.toast.show { transform: translateX(0); }

.toast-icon { font-size: 1.1rem; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--success); }
.toast.error   .toast-icon { color: var(--danger); }
.toast.info    .toast-icon { color: var(--info); }
.toast.warning .toast-icon { color: var(--warning); }

.toast-content { flex: 1; }
.toast-title { font-weight: 600; color: var(--text-primary); }
.toast-msg { font-size: 0.8rem; color: var(--text-muted); }

/* ─── Kanban Board ───────────────────────────────────────────────── */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: calc(100vh - 200px);
}

.kanban-board::-webkit-scrollbar { height: 6px; }
.kanban-board::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.kanban-column {
  flex-shrink: 0;
  width: 280px;
  background: hsl(210, 14%, 95%);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--border);
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.kanban-column-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.kanban-count {
  background: var(--border);
  border-radius: var(--radius-full);
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.kanban-amount {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.kanban-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: var(--primary-mid); }

.kanban-card-dragging { opacity: 0.5; transform: rotate(2deg) !important; }
.kanban-column.drag-over { border-color: var(--primary); background: var(--primary-light); }

.kanban-card-title { font-weight: 600; font-size: 0.875rem; margin-bottom: 6px; }
.kanban-card-amount { font-size: 1rem; font-weight: 700; color: var(--primary-dark); margin-bottom: 8px; }
.kanban-card-meta { display: flex; align-items: center; justify-content: space-between; }
.kanban-card-meta .meta-item { font-size: 0.75rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }

/* ─── Chart Containers ───────────────────────────────────────────── */
.chart-container {
  position: relative;
  width: 100%;
  height: 260px;
}

canvas.chart { width: 100% !important; }

/* ─── Tabs ───────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}

.tab-btn {
  padding: 10px 20px;
  border: none;
  background: none;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: color var(--transition);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ─── Loading ────────────────────────────────────────────────────── */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: hsla(0, 0%, 100%, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: inherit;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--bg-input) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
  height: 16px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ─── Detail View ────────────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 380px 1fr; gap: 24px; align-items: start; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

.property-list { display: flex; flex-direction: column; gap: 0; }
.property-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.property-item:last-child { border-bottom: none; }
.property-key { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; flex-shrink: 0; }
.property-val { font-size: 0.875rem; color: var(--text-primary); text-align: right; word-break: break-word; }
.property-val.link { color: var(--primary); cursor: pointer; }
.property-val.link:hover { text-decoration: underline; }

/* ─── Timeline (Activities) ──────────────────────────────────────── */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.timeline-item:last-child { border-bottom: none; }

.timeline-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.timeline-icon.call { background: var(--info-bg); color: var(--info); }
.timeline-icon.email { background: var(--primary-light); color: var(--primary); }
.timeline-icon.note { background: var(--warning-bg); color: var(--warning); }
.timeline-icon.task { background: var(--success-bg); color: var(--success); }
.timeline-icon.meeting { background: hsl(270, 60%, 95%); color: hsl(270, 60%, 50%); }

.timeline-body { flex: 1; }
.timeline-title { font-weight: 600; font-size: 0.875rem; margin-bottom: 2px; }
.timeline-text { font-size: 0.8rem; color: var(--text-secondary); }
.timeline-time { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }

/* ─── Workflow Builder ───────────────────────────────────────────── */
.workflow-step {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
  transition: border-color var(--transition);
}
.workflow-step:hover { border-color: var(--primary); }

.workflow-connector {
  width: 2px;
  height: 24px;
  background: var(--border);
  margin: 0 auto;
}

/* ─── Chat Widget ────────────────────────────────────────────────── */
.chat-window {
  display: flex;
  flex-direction: column;
  height: 500px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-page);
}

.chat-message {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  line-height: 1.5;
}

.chat-message.agent {
  background: var(--primary);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-message.visitor {
  background: var(--bg-card);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}

/* ─── Responsive ─────────────────────────────────────────────────── */
.menu-toggle { display: none; }
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 90;
}
@media (max-width: 768px) {
  .menu-toggle { display: inline-flex; }
  .sidebar {
    width: 0;
    position: fixed;
    z-index: 100;
    height: 100vh;
    overflow: hidden;
    transition: width .2s ease;
  }
  .sidebar.open {
    width: var(--sidebar-width);
    overflow: hidden;
    box-shadow: 4px 0 24px rgba(0,0,0,.35);
  }
  .sidebar-backdrop.visible { display: block; }
  .page-content { padding: 20px 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr !important; }
  .topbar-search { display: none; }

  /* Sections stay visible in the scrolling sidebar on mobile. */
  .sidebar-more-panel {
    position: static;
    width: 100%;
    max-width: none;
    height: auto;
    max-height: none;
    padding: 0;
    border: none;
    box-shadow: none;
    background: transparent;
    transform: none;
    overflow: visible;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  .sidebar-more-close,
  .sidebar-more-trigger { display: none; }
}

/* ─── Auth Pages ─────────────────────────────────────────────────── */
/* ─── Auth (redesigned from UI-UX-Images/Login mockups) ─────────────
   Light, flat, minimal — deliberately NOT the app's dark glass-card
   style used elsewhere. Reuses .form-control / .btn-primary /
   .btn-secondary as-is (rung 2: already in the codebase). */
.auth-page {
  min-height: 100vh;
  background: hsl(150, 8%, 97%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto; /* a short viewport must scroll the card, never clip it */
}

.auth-card {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 384px;
  box-shadow: var(--shadow-md);
  overflow: hidden; /* clips .auth-footer-strip to the card's rounded corners */
}

.auth-card-body { padding: 32px 32px 28px; }

.auth-badge {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 20px;
}
.auth-badge.brand { background: var(--primary); color: #fff; }
.auth-badge.info   { background: var(--primary-light); color: var(--primary); font-size: 18px; }

.auth-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.auth-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.auth-card .form-label { display: flex; align-items: baseline; justify-content: space-between; }
.auth-card .form-label a { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); }
.auth-card .form-label a:hover { text-decoration: underline; }
.auth-password-input { position: relative; }
.auth-password-input .form-control { padding-right: 42px; }
.auth-password-toggle { position: absolute; top: 50%; right: 9px; width: 28px; height: 28px; transform: translateY(-50%); display: grid; place-items: center; border: 0; border-radius: 4px; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 18px; }
.auth-password-toggle:hover { background: var(--bg-secondary); color: var(--text-primary); }
.auth-password-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.auth-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 20px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.auth-check-row input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.auth-error-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: hsl(0, 100%, 97%);
  color: hsl(0, 70%, 45%);
  border: 1px solid hsl(0, 90%, 90%);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 0.83rem;
  margin-bottom: 18px;
}
.auth-error-banner .mdi { font-size: 1rem; flex-shrink: 0; }

.auth-footer-strip {
  background: var(--bg-input, hsl(210, 20%, 98%));
  border-top: 1px solid var(--border);
  padding: 14px 32px;
  text-align: center;
  font-size: 0.83rem;
  color: var(--text-secondary);
}
.auth-footer-strip a { font-weight: 600; color: var(--text-primary); }
.auth-footer-strip a:hover { text-decoration: underline; }

.auth-caption {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 14px;
}
.auth-step-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 6px;
}
.auth-card.wide { max-width: 440px; }
.auth-module-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
}
.auth-module-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.auth-module-row .seats { color: var(--text-muted); font-weight: 400; }
.auth-module-row.full { opacity: 0.5; cursor: not-allowed; }
.auth-alt-link { text-align: center; margin-top: 12px; font-size: 0.85rem; }
.auth-alt-link a { color: var(--text-secondary); text-decoration: none; }
.auth-alt-link a:hover { text-decoration: underline; }

.auth-bottom-links {
  display: flex;
  gap: 20px;
  margin-top: 24px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.auth-bottom-links a { color: inherit; }
.auth-bottom-links a:hover { color: var(--text-secondary); }

/* Check-your-email info box */
.auth-info-box {
  background: var(--bg-input, hsl(210, 20%, 98%));
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 20px;
}
.auth-info-box ul { list-style: none; margin: 0; padding: 0; }
.auth-info-box li {
  position: relative;
  padding-left: 14px;
  font-size: 0.83rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.auth-info-box li + li { margin-top: 8px; }
.auth-info-box li::before {
  content: '';
  position: absolute;
  left: 0; top: 7px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--text-muted);
}

/* Password strength meter (Set a new password) */
.auth-strength-bars { display: flex; gap: 4px; margin-top: 8px; }
.auth-strength-bars span { flex: 1; height: 4px; border-radius: var(--radius-full); background: var(--border); }
.auth-strength-bars.weak   span:nth-child(1) { background: var(--danger); }
.auth-strength-bars.medium span:nth-child(-n+2) { background: var(--warning); }
.auth-strength-bars.strong span { background: var(--success); }

.auth-strength-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  margin: 6px 0 16px;
}
.auth-strength-row .label { font-weight: 600; }
.auth-strength-row .label.weak   { color: var(--danger); }
.auth-strength-row .label.medium { color: var(--warning); }
.auth-strength-row .label.strong { color: var(--success); }
.auth-strength-row .eta { color: var(--text-muted); }

.auth-checklist { list-style: none; margin: 0 0 20px; padding: 0; }
.auth-checklist li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.83rem;
  color: var(--text-secondary);
  padding: 3px 0;
}
.auth-checklist .mdi { font-size: 0.95rem; color: var(--border); flex-shrink: 0; }
.auth-checklist li.met .mdi { color: var(--success); }
.auth-checklist .eta-note { margin-left: auto; font-size: 0.75rem; color: var(--text-muted); }

/* Accept-invite screen */
.auth-invite-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input, hsl(210, 20%, 98%));
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 16px;
}
.auth-invite-card .name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.auth-invite-card .meta { font-size: 0.78rem; color: var(--text-muted); }

.auth-role-pill {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-input, hsl(210, 20%, 98%));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  margin-bottom: 14px;
}

.auth-caps-label { font-size: 0.83rem; color: var(--text-primary); margin-bottom: 8px; }
.auth-caps-list { list-style: none; margin: 0 0 20px; padding: 0; }
.auth-caps-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.83rem;
  color: var(--text-secondary);
  padding: 3px 0;
}
.auth-caps-list .mdi { font-size: 0.95rem; color: var(--success); margin-top: 2px; flex-shrink: 0; }

/* ─── Avatar Initials ─────────────────────────────────────────────── */
.avatar-sm {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 0.7rem; font-weight: 700; flex-shrink: 0;
}

/* ─── Empty State ────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; line-height: 1; }
.empty-state .empty-icon .mdi { font-size: inherit; }
.empty-state h3 { font-size: 1rem; margin-bottom: 6px; color: var(--text-secondary); }
.empty-state p { font-size: 0.875rem; max-width: 320px; }

/* ─── Progress Bar ───────────────────────────────────────────────── */
.progress-bar-container { background: var(--border); border-radius: var(--radius-full); height: 6px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: var(--radius-full); transition: width 0.5s ease; }

/* ─── Scrollable list in modals ─────────────────────────────────── */
.item-list { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; }
.item-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  border: 1px solid var(--border);
  transition: border-color var(--transition);
}
.item-list-row:hover { border-color: var(--primary); }

/* Utility classes */
.text-primary { color: var(--primary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-100 { width: 100%; }
.hidden { display: none !important; }

/* ─── Google Sign-In Button ─────────────────────────────────────── */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px 20px;
  background: #fff;
  color: #3c4043;
  border: 1.5px solid #dadce0;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none !important;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.btn-google:hover {
  background: #f8f9fa;
  border-color: #bdc1c6;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  transform: translateY(-1px);
  text-decoration: none !important;
}

.btn-google:active { transform: scale(0.98); }

/* ─── Auth Divider ───────────────────────────────────────────────── */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: hsla(210, 15%, 50%, 0.3);
}

.auth-divider span {
  font-size: 0.78rem;
  color: var(--sidebar-text);
  white-space: nowrap;
  padding: 0 4px;
}

/* ─── Tabs (Settings page) ───────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 0;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 10px 18px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.tab-btn:hover { color: var(--primary); background: var(--primary-light); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-btn .mdi { margin-right: 6px; font-size: 1rem; vertical-align: -0.1em; }

/* ─── Notification dot animation ─────────────────────────────────── */
#notif-dot {
  display: none;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(1.3); }
}

/* ─── Typing dots (KB chat) ──────────────────────────────────────── */
.typing-dots span {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-secondary);
  margin: 0 2px;
  animation: typing-bounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40%           { transform: translateY(-6px); opacity: 1; }
}

/* ─── Streaming cursor (KB chat LLM stream) ─────────────────────── */
.stream-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--text-secondary);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cursor-blink 0.75s step-end infinite;
}

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}
