/* ================================================================
   QUERY HUB  —  PREMIUM CRM  (HubSpot / Pipedrive style)
   ================================================================ */

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

:root {
  --brand:       #7c3aed;
  --brand-dark:  #5b21b6;
  --brand-light: #ede9fe;
  --brand-mid:   #ddd6fe;

  --sb-bg:       #111827;
  --sb-hover:    rgba(255,255,255,.07);
  --sb-active:   rgba(124,58,237,.25);
  --sb-txt:      #9ca3af;
  --sb-txt-h:    #f3f4f6;
  --sb-accent:   #a78bfa;
  --sb-w:        256px;

  --topbar-h:    58px;
  --page-bg:     #f8fafc;
  --surface:     #ffffff;
  --border:      #e5e7eb;
  --border-2:    #f1f5f9;

  --txt:         #111827;
  --txt-2:       #4b5563;
  --txt-3:       #9ca3af;

  --green:  #10b981; --green-bg:  #ecfdf5; --green-bd:  #6ee7b7;
  --red:    #ef4444; --red-bg:    #fef2f2; --red-bd:    #fca5a5;
  --amber:  #f59e0b; --amber-bg:  #fffbeb; --amber-bd:  #fde68a;
  --blue:   #3b82f6; --blue-bg:   #eff6ff; --blue-bd:   #93c5fd;
  --indigo: #6366f1;

  --sh0: 0 1px 2px rgba(0,0,0,.05);
  --sh1: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --sh2: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
  --sh3: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --sh4: 0 20px 25px rgba(0,0,0,.1), 0 10px 10px rgba(0,0,0,.04);

  --r:    8px;
  --r-sm: 6px;
  --r-lg: 12px;
  --r-xl: 16px;
  --t:    .15s ease;

  /* backwards-compat */
  --primary: var(--brand);
  --primary-dark: var(--brand-dark);
  --primary-light: var(--brand-light);
  --primary-mid: var(--brand-mid);
  --text: var(--txt);
  --muted: var(--txt-2);
  --light: var(--txt-3);
  --surface-2: var(--page-bg);
  --success: var(--green);
  --success-light: var(--green-bg);
  --danger: var(--red);
  --danger-light: var(--red-bg);
  --warning: var(--amber);
  --warning-light: var(--amber-bg);
  --info: var(--blue);
  --info-light: var(--blue-bg);
  --bg: var(--page-bg);
  --radius: var(--r);
  --radius-sm: var(--r-sm);
  --shadow-xs: var(--sh0);
  --shadow-sm: var(--sh1);
  --shadow: var(--sh2);
  --shadow-lg: var(--sh3);
  --shadow-xl: var(--sh4);
}

*,*::before,*::after { box-sizing: border-box; }
html { font-size: 14px; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--page-bg);
  color: var(--txt);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
p { margin: 0 0 .5rem; }
p:last-child { margin-bottom: 0; }
h1,h2,h3,h4,h5,h6 { margin: 0; line-height: 1.3; font-weight: 700; }


/* ================================================================
   CRM LAYOUT
   ================================================================ */

.crm-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────── */

.crm-sidebar {
  width: var(--sb-w);
  background: var(--sb-bg);
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--t);
  scrollbar-width: none;
  border-right: 1px solid rgba(255,255,255,.04);
}
.crm-sidebar::-webkit-scrollbar { display: none; }

/* Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 18px;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}

.sidebar-logo-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  display: grid; place-items: center;
  font-size: .95rem; font-weight: 900;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(124,58,237,.4), 0 4px 12px rgba(124,58,237,.35);
}

.sidebar-logo-text strong {
  display: block;
  font-size: .9rem;
  font-weight: 800;
  color: #f9fafb;
  letter-spacing: -.01em;
}
.sidebar-logo-text span {
  display: block;
  font-size: .68rem;
  font-weight: 500;
  color: #4b5563;
  letter-spacing: .03em;
  text-transform: uppercase;
}

/* Nav */
.sidebar-nav {
  padding: 16px 12px 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  padding: 12px 10px 5px;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #374151;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--r);
  color: var(--sb-txt);
  font-size: .845rem;
  font-weight: 500;
  transition: all var(--t);
  text-decoration: none;
  position: relative;
}

.nav-item i {
  width: 18px;
  text-align: center;
  font-size: .8rem;
  flex-shrink: 0;
}
.nav-sub {
  margin-left: 18px;
  padding-left: 14px;
  font-size: .8rem;
  border-left: 2px solid rgba(255,255,255,.12);
  border-radius: 0 var(--r) var(--r) 0;
  margin-top: -4px;
}

.nav-item:hover {
  background: var(--sb-hover);
  color: var(--sb-txt-h);
}

.nav-item.active {
  background: var(--sb-active);
  color: var(--sb-accent);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; height: 60%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--sb-accent);
}

.nav-divider {
  height: 1px;
  background: rgba(255,255,255,.05);
  margin: 6px 2px;
}

.nav-item.nav-logout { color: #f87171; }
.nav-item.nav-logout:hover { background: rgba(239,68,68,.12); color: #fca5a5; }

/* Error tracking section in sidebar */
.sidebar-error-section {
  padding: 8px 0 12px;
  border-top: 1px solid rgba(255,255,255,.06);
  margin-top: auto;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  transition: background .18s;
  border-radius: 0 0 0 0;
}
.sidebar-footer:hover { background: rgba(255,255,255,.04); }
.sf-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: .76rem;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(124,58,237,.3);
}
.sf-name {
  font-size: .78rem;
  font-weight: 600;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 250;
  backdrop-filter: blur(3px);
}


/* ── Main area ──────────────────────────────────────────────── */

.crm-main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sb-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--page-bg);
  overflow-x: hidden;
}

/* Topbar */
.crm-topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--sh0);
  gap: 16px;
}

.topbar-left  { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.sidebar-toggle {
  display: none;
  width: 34px; height: 34px;
  border: none; border-radius: var(--r-sm);
  background: transparent; color: var(--txt-2);
  cursor: pointer; font-size: .9rem;
  align-items: center; justify-content: center;
  transition: background var(--t);
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--page-bg); }

.topbar-breadcrumb {
  display: flex; align-items: center; gap: 5px;
  font-size: .82rem; color: var(--txt-2);
  white-space: nowrap;
}
.topbar-breadcrumb a { color: var(--txt-2); font-weight: 500; }
.topbar-breadcrumb a:hover { color: var(--brand); }
.topbar-breadcrumb .bc-sep { color: var(--txt-3); font-size: .7rem; }
.topbar-breadcrumb .bc-current { color: var(--txt); font-weight: 700; }

/* Knowledge Base / Error Report search mode toggle (reused on home hero + /search page) */
.hero-search-toggle {
  display: flex; gap: 6px; margin-bottom: 16px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 30px; padding: 4px; width: fit-content;
}
.hst-btn {
  padding: 7px 18px; border: none; border-radius: 24px; cursor: pointer;
  font-family: inherit; font-size: .83rem; font-weight: 600;
  background: none; color: var(--txt-3); transition: all .2s; display: flex; align-items: center; gap: 6px;
}
.hst-btn:hover { color: var(--txt); }
.hst-active { background: var(--brand) !important; color: #fff !important; }
#hstErr.hst-active, .hst-btn[id$="Err"].hst-active { background: #f59e0b !important; }

/* Global search */
.topbar-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--page-bg);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  flex: 0 0 220px;
  transition: flex-basis 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
              border-color 0.25s ease,
              box-shadow 0.25s ease,
              background 0.25s ease,
              border-radius 0.3s ease;
}
.topbar-search.ts-expanded {
  flex: 1 1 auto;
  border-color: var(--brand);
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 0 0 4px rgba(124,58,237,.13), 0 2px 12px rgba(124,58,237,.10);
}
.topbar-search-toggle { display: flex; gap: 2px; flex-shrink: 0; }
.tst-btn {
  border: none; background: transparent; color: var(--txt-3);
  width: 22px; height: 22px; border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; transition: all .15s;
}
.tst-btn:hover { color: var(--txt); background: var(--page-bg); }
.tst-btn.tst-active { color: #fff; background: var(--brand); }
#tstErr.tst-active { background: #f59e0b; }
.topbar-search i { transition: color 0.2s ease; }
.topbar-search.ts-expanded i { color: var(--brand); }
.topbar-search i   { color: var(--txt-3); font-size: .8rem; flex-shrink: 0; }
.topbar-search input {
  border: none; background: transparent;
  font-size: .84rem; color: var(--txt);
  font-family: inherit; width: 100%; outline: none;
}
.topbar-search input::placeholder { color: var(--txt-3); }
.topbar-search { position: relative; }
.search-suggestions {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  z-index: 9999;
  overflow: hidden;
  max-height: 360px;
  overflow-y: auto;
}
.sg-group {
  padding: 6px 14px 3px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--txt-3);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.sg-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.sg-item:hover, .sg-item.sg-active { background: var(--bg); }
.sg-text { flex: 1; min-width: 0; }
.sg-label {
  font-size: .83rem;
  color: var(--txt);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sg-label mark {
  background: rgba(124,58,237,.18);
  color: var(--brand);
  border-radius: 2px;
  padding: 0 1px;
}
.sg-sub {
  font-size: .72rem;
  color: var(--txt-3);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sg-footer {
  padding: 7px 14px;
  font-size: .72rem;
  color: var(--txt-3);
  background: var(--bg);
  text-align: center;
  border-top: 1px solid var(--border);
}

/* Topbar icon button */
.topbar-icon-btn {
  width: 34px; height: 34px;
  border-radius: var(--r);
  border: 1.5px solid var(--border);
  background: var(--surface);
  display: grid; place-items: center;
  color: var(--txt-2); font-size: .85rem;
  cursor: pointer; transition: all var(--t);
  text-decoration: none;
}
.topbar-icon-btn:hover {
  background: var(--brand-light);
  color: var(--brand);
  border-color: var(--brand-mid);
}

/* Topbar user chip */
.topbar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 5px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all var(--t);
  background: var(--surface);
}
.topbar-user:hover { border-color: var(--brand-mid); background: var(--brand-light); }

.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: .74rem;
  flex-shrink: 0;
}
.user-name { font-size: .8rem; font-weight: 700; color: var(--txt); }

/* Content area */
.crm-content { flex: 1; min-width: 0; padding: 26px 28px 40px; }


/* ================================================================
   PAGE HEADER
   ================================================================ */

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

.page-header h1 {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--txt);
  letter-spacing: -.02em;
}
.page-subtitle  { font-size: .82rem; color: var(--txt-2); margin-top: 3px; }
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Breadcrumbs */
.breadcrumbs {
  display: flex; align-items: center; gap: 5px;
  font-size: .78rem; color: var(--txt-2); margin-bottom: 16px;
}
.breadcrumbs a { color: var(--txt-2); }
.breadcrumbs a:hover { color: var(--brand); }
.breadcrumbs .sep { color: var(--txt-3); }
.breadcrumbs .current { color: var(--txt); font-weight: 700; }


/* ================================================================
   STAT CARDS
   ================================================================ */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* Each stat card — the gradient is on the wrapper */
.stat-card {
  border-radius: var(--r-lg);
  padding: 22px 22px 18px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--sh2);
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  color: #fff;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

/* Decorative circle */
.stat-card::after {
  content: '';
  position: absolute;
  right: -20px; top: -20px;
  width: 90px; height: 90px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  pointer-events: none;
}

/* Colour variants */
.stat-card,
.stat-card.purple { background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%); }
.stat-card.blue   { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); }
.stat-card.green  { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.stat-card.orange { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.stat-card.teal   { background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%); }
.stat-card.rose   { background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%); }

/* Icon */
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: rgba(255,255,255,.18);
  display: grid; place-items: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  position: relative; z-index: 1;
}
/* also support old inner-class usage: .stat-icon.purple etc. — just ignore colour on icon */
.stat-icon.purple, .stat-icon.blue, .stat-icon.green, .stat-icon.orange { background: rgba(255,255,255,.18); }

.stat-body { position: relative; z-index: 1; flex: 1; min-width: 0; }
.stat-value { font-size: 2rem; font-weight: 900; line-height: 1; letter-spacing: -1.5px; }
.stat-label { font-size: .76rem; font-weight: 600; opacity: .82; margin-top: 3px; letter-spacing: .01em; }
.stat-link  { font-size: .71rem; font-weight: 700; opacity: .72; margin-top: 7px; display: block; }
.stat-link:hover { opacity: 1; color: #fff; }


/* ================================================================
   CARDS
   ================================================================ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  box-shadow: var(--sh1);
  margin-bottom: 18px;
}

.card-accent-left { border-left: 3px solid var(--brand); }

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 8px;
}
.card-header h2 { font-size: .92rem; font-weight: 700; color: var(--txt); margin: 0; }
.card-header h3 { font-size: .88rem; font-weight: 700; color: var(--txt); margin: 0; }
.card h2 { font-size: .92rem; font-weight: 700; color: var(--txt); margin-bottom: 14px; }


/* ================================================================
   BUTTONS
   ================================================================ */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r);
  font-size: .83rem; font-weight: 600;
  border: none; cursor: pointer;
  transition: all var(--t);
  text-decoration: none; white-space: nowrap;
  font-family: inherit; line-height: 1.4;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.1), 0 2px 6px rgba(124,58,237,.25);
}
.btn-primary:hover {
  background: var(--brand-dark);
  color: #fff;
  box-shadow: 0 4px 12px rgba(124,58,237,.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface); color: var(--txt-2);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: var(--page-bg); color: var(--txt); border-color: #d1d5db; }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; transform: translateY(-1px); }

.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; transform: translateY(-1px); }

.btn-link-open {
  background: var(--brand-light); color: var(--brand);
  border: 1.5px solid var(--brand-mid);
}
.btn-link-open:hover { background: var(--brand-mid); color: var(--brand-dark); }

.btn-ghost {
  background: transparent; color: var(--txt-2);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--page-bg); color: var(--txt); }

.btn-full  { width: 100%; }
.btn-sm    { padding: 5px 11px; font-size: .775rem; }
.btn-lg    { padding: 10px 22px; font-size: .92rem; }
.btn-icon  { width: 32px; height: 32px; padding: 0; border-radius: var(--r-sm); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn:active { transform: translateY(0) !important; }


/* ================================================================
   FORMS
   ================================================================ */

.form-group { margin-bottom: 14px; }

.form-group label {
  display: block; margin-bottom: 5px;
  font-size: .8rem; font-weight: 700;
  color: var(--txt); letter-spacing: .01em;
}

.form-group input[type=text],
.form-group input[type=email],
.form-group input[type=password],
.form-group input[type=url],
.form-group input[type=date],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  font-size: .86rem; color: var(--txt);
  background: var(--surface); font-family: inherit;
  transition: border-color var(--t), box-shadow var(--t);
}

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

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

/* Search box */
.search-box { display: flex; gap: 8px; }
.search-box input {
  flex: 1; padding: 8px 12px;
  border: 1.5px solid var(--border); border-radius: var(--r);
  font-size: .86rem; color: var(--txt);
  background: var(--surface); font-family: inherit;
  transition: border-color var(--t), box-shadow var(--t);
}
.search-box input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(124,58,237,.12);
}

/* Quill editor */
.ql-container.ql-snow { border: 1.5px solid var(--border) !important; border-top: none !important; border-radius: 0 0 var(--r) var(--r) !important; }
.ql-toolbar.ql-snow   { border: 1.5px solid var(--border) !important; border-bottom: none !important; border-radius: var(--r) var(--r) 0 0 !important; background: var(--page-bg); }
.ql-editor { min-height: 90px; font-family: 'Inter', sans-serif; font-size: .87rem; }


/* ================================================================
   DOMAIN CARDS
   ================================================================ */

.domain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
}

.domain-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--sh1);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow var(--t), border-color var(--t), transform var(--t);
}
.domain-card:hover {
  box-shadow: var(--sh3);
  border-color: var(--brand-mid);
  transform: translateY(-2px);
}

.domain-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.domain-card-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-light) 0%, var(--brand-mid) 100%);
  display: grid; place-items: center;
  flex-shrink: 0;
  font-size: .9rem;
  color: var(--brand);
  border: 1px solid var(--brand-mid);
}

.domain-card-info h3 {
  font-size: .9rem;
  font-weight: 700;
  color: var(--txt);
  line-height: 1.3;
}

.link-count {
  font-size: .73rem;
  color: var(--txt-3);
  font-weight: 500;
  margin-top: 1px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.domain-card-desc {
  font-size: .81rem;
  color: var(--txt-2);
  line-height: 1.55;
  flex: 1;
}

.domain-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-2);
  margin-top: auto;
}
.domain-actions .btn { font-size: .77rem; padding: 6px 12px; }
.domain-actions .btn-icon { width: 30px; height: 30px; font-size: .75rem; }


/* ================================================================
   LINK ITEMS
   ================================================================ */

.link-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 20px;
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: box-shadow var(--t), border-color var(--t);
  position: relative;
  border-left: 4px solid var(--brand);
}
.link-item:hover { box-shadow: var(--sh2); border-color: var(--brand-mid); }

.link-item-icon {
  width: 38px; height: 38px;
  border-radius: var(--r);
  background: var(--brand-light);
  display: grid; place-items: center;
  flex-shrink: 0;
  color: var(--brand);
  font-size: .85rem;
  border: 1px solid var(--brand-mid);
}

.link-item-body { flex: 1; min-width: 0; }
.link-item-body h3 { font-size: .9rem; font-weight: 700; color: var(--txt); margin-bottom: 3px; }

.link-item-meta {
  font-size: .75rem; color: var(--txt-3);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 4px;
}
.link-item-url {
  font-size: .75rem; color: var(--brand);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 300px; display: block; margin-top: 2px;
}
.link-item-desc { font-size: .8rem; color: var(--txt-2); margin-top: 4px; }

.link-item-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: flex-start; }
.link-item-actions .btn { padding: 5px 10px; font-size: .76rem; }


/* ================================================================
   NOTE ITEMS
   ================================================================ */

.note-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border-2);
}
.note-item:last-child { border-bottom: none; }

.note-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  margin-bottom: 10px;
  box-shadow: var(--sh0);
  transition: box-shadow var(--t);
}
.note-card:hover { box-shadow: var(--sh2); }

.note-tags {
  display: flex; flex-wrap: wrap; gap: 5px;
  margin-top: 8px;
}

.tag-badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  background: var(--brand-light);
  color: var(--brand);
  border: 1px solid var(--brand-mid);
  border-radius: 20px;
  font-size: .7rem; font-weight: 700;
  letter-spacing: .01em;
}

.note-meta {
  font-size: .75rem; color: var(--txt-3);
  margin-top: 8px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.note-actions { display: flex; gap: 6px; margin-top: 8px; }
.note-actions .btn { padding: 4px 10px; font-size: .75rem; }

/* Note content (rich) */
.note-content img { max-width: 100%; border-radius: var(--r-sm); }
.note-content p { margin: .3rem 0; }


/* ================================================================
   STATUS / BADGE
   ================================================================ */

.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: .71rem; font-weight: 700;
  letter-spacing: .02em;
}
.badge-success { background: var(--green-bg);  color: var(--green);  border: 1px solid var(--green-bd); }
.badge-danger  { background: var(--red-bg);    color: var(--red);    border: 1px solid var(--red-bd); }
.badge-warning { background: var(--amber-bg);  color: var(--amber);  border: 1px solid var(--amber-bd); }
.badge-info    { background: var(--blue-bg);   color: var(--blue);   border: 1px solid var(--blue-bd); }
.badge-purple  { background: var(--brand-light); color: var(--brand); border: 1px solid var(--brand-mid); }
.badge-gray    { background: #f3f4f6; color: #6b7280; border: 1px solid #e5e7eb; }


/* ================================================================
   TABLES
   ================================================================ */

.table-wrapper { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--border); }

table { width: 100%; border-collapse: collapse; }
th {
  background: var(--page-bg);
  padding: 10px 14px;
  text-align: left; font-size: .74rem;
  font-weight: 700; color: var(--txt-2);
  text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 11px 14px;
  font-size: .83rem;
  border-bottom: 1px solid var(--border-2);
  color: var(--txt);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }

.table-wrap { overflow-x: auto; overflow-y: auto; max-height: 60vh; border-radius: var(--r-lg); border: 1px solid var(--border); }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table thead th { position: sticky; top: 0; z-index: 2; }
.admin-table th { background: var(--page-bg); padding: 10px 14px; text-align: left; font-size: .73rem; font-weight: 700; color: var(--txt-2); text-transform: uppercase; letter-spacing: .07em; border-bottom: 1px solid var(--border); white-space: nowrap; }
.admin-table td { padding: 10px 14px; font-size: .83rem; border-bottom: 1px solid var(--border-2); color: var(--txt); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #fafafa; }


/* ================================================================
   FLASH MESSAGES
   ================================================================ */

.flash-overlay {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}

.flash-popup {
  display: flex; flex-direction: column; gap: 6px;
}

.flash-message {
  padding: 13px 18px;
  border-radius: var(--r-lg);
  font-size: .84rem; font-weight: 600;
  box-shadow: var(--sh3);
  animation: slideUp .25s ease;
  max-width: 340px;
  display: flex; align-items: center; gap: 8px;
  backdrop-filter: blur(10px);
}

.flash-message::before {
  content: '●';
  font-size: .5rem;
  flex-shrink: 0;
}

.flash-success { background: #fff; color: var(--green); border: 1.5px solid var(--green-bd); border-left: 4px solid var(--green); }
.flash-error, .flash-danger { background: #fff; color: var(--red); border: 1.5px solid var(--red-bd); border-left: 4px solid var(--red); }
.flash-warning { background: #fff; color: var(--amber); border: 1.5px solid var(--amber-bd); border-left: 4px solid var(--amber); }
.flash-info { background: #fff; color: var(--blue); border: 1.5px solid var(--blue-bd); border-left: 4px solid var(--blue); }

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


/* ================================================================
   MODAL
   ================================================================ */

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
  display: flex;
  align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  animation: fadeIn .15s ease;
}

.modal-box {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh4);
  width: 100%; max-width: 460px;
  animation: scaleIn .2s ease;
  overflow: hidden;
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: .95rem; font-weight: 800; color: var(--txt); }
.modal-close {
  width: 30px; height: 30px;
  border: none; background: var(--page-bg);
  border-radius: var(--r-sm); cursor: pointer;
  font-size: 1.1rem; color: var(--txt-2);
  display: grid; place-items: center;
  transition: background var(--t), color var(--t);
}
.modal-close:hover { background: var(--red-bg); color: var(--red); }

.modal-body { padding: 20px 22px 22px; }

@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }


/* ================================================================
   BOTTOM SHEET
   ================================================================ */

.bottom-sheet-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 800;
  backdrop-filter: blur(4px);
  animation: fadeIn .15s ease;
}

.bottom-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--sh4);
  z-index: 801;
  padding: 22px 24px 32px;
  animation: slideUp .25s ease;
  max-height: 85vh;
  overflow-y: auto;
}

.sheet-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 18px;
}

.sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.sheet-header h3 { font-size: .97rem; font-weight: 800; color: var(--txt); }
.sheet-close {
  width: 30px; height: 30px;
  border: none; background: var(--page-bg); border-radius: var(--r-sm);
  cursor: pointer; font-size: 1.1rem; color: var(--txt-2);
  display: grid; place-items: center;
  transition: background var(--t), color var(--t);
}
.sheet-close:hover { background: var(--red-bg); color: var(--red); }


/* ================================================================
   EMPTY STATE
   ================================================================ */

.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--txt-3);
}
.empty-state i { font-size: 3rem; margin-bottom: 16px; display: block; opacity: .4; }
.empty-state h3 { font-size: .97rem; font-weight: 700; color: var(--txt-2); margin-bottom: 6px; }
.empty-state p  { font-size: .83rem; color: var(--txt-3); }


/* ================================================================
   AUTH PAGES  (login / register)
   ================================================================ */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 50%, #e0e7ff 100%);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.auth-page::before, .auth-page::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.auth-page::before {
  width: 500px; height: 500px;
  top: -200px; right: -150px;
  background: radial-gradient(circle, rgba(124,58,237,.12) 0%, transparent 70%);
}
.auth-page::after {
  width: 400px; height: 400px;
  bottom: -160px; left: -120px;
  background: radial-gradient(circle, rgba(79,70,229,.1) 0%, transparent 70%);
}

.auth-card {
  background: var(--surface);
  border: 1px solid rgba(124,58,237,.15);
  border-radius: var(--r-xl);
  padding: 36px 36px 32px;
  width: 100%; max-width: 400px;
  box-shadow: var(--sh4), 0 0 0 1px rgba(124,58,237,.07);
  position: relative; z-index: 1;
  animation: scaleIn .3s ease;
}

.auth-card-logo {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; margin-bottom: 28px;
}

.auth-logo-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  display: grid; place-items: center;
  font-size: 1.35rem; font-weight: 900; color: #fff;
  box-shadow: 0 0 0 3px rgba(124,58,237,.25), 0 8px 20px rgba(124,58,237,.35);
  letter-spacing: -0.5px;
}

.auth-logo-text {
  text-align: center;
}
.auth-logo-text strong {
  display: block; font-size: 1.15rem;
  font-weight: 900; color: var(--txt); letter-spacing: -.02em;
}
.auth-logo-text span {
  font-size: .75rem; color: var(--txt-3);
  font-weight: 500; letter-spacing: .02em;
}

.auth-title  { font-size: 1.2rem; font-weight: 800; color: var(--txt); margin-bottom: 4px; text-align: center; }
.auth-sub    { font-size: .82rem; color: var(--txt-3); text-align: center; margin-bottom: 24px; }

.auth-footer { text-align: center; margin-top: 20px; font-size: .81rem; color: var(--txt-2); }
.auth-footer a { color: var(--brand); font-weight: 600; }

/* Password toggle */
.password-field, .password-wrap { position: relative; }
.password-field input, .password-wrap input { padding-right: 42px; width: 100%; }
.toggle-eye {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--txt-3); font-size: .85rem; padding: 4px;
  transition: color var(--t); line-height: 1;
}
.toggle-eye:hover { color: var(--brand); }


/* ================================================================
   PUBLIC (unauthenticated) PAGES
   ================================================================ */

.public-topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px;
  height: 56px;
}

.public-brand {
  display: flex; align-items: center; gap: 10px;
  font-size: .95rem; font-weight: 900;
  color: var(--txt); text-decoration: none;
  letter-spacing: -.01em;
}
.public-brand-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  display: grid; place-items: center;
  font-size: .85rem; font-weight: 900; color: #fff;
}
.public-nav { display: flex; align-items: center; gap: 8px; }

.hero-section {
  text-align: center;
  padding: 80px 24px 60px;
  background: linear-gradient(180deg, var(--brand-light) 0%, transparent 100%);
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--brand-light); color: var(--brand);
  border: 1px solid var(--brand-mid); border-radius: 20px;
  padding: 5px 14px; font-size: .76rem; font-weight: 700;
  margin-bottom: 20px; letter-spacing: .02em;
}
.hero-title {
  font-size: 3rem; font-weight: 900; color: var(--txt);
  line-height: 1.15; margin-bottom: 16px; letter-spacing: -.04em;
}
.hero-title span { color: var(--brand); }
.hero-subtitle {
  font-size: .97rem; color: var(--txt-2); max-width: 520px;
  margin: 0 auto 28px; line-height: 1.7;
}
.hero-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

.public-container { max-width: 1100px; margin: 0 auto; padding: 0 24px 60px; }

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.feature-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 24px;
  box-shadow: var(--sh1);
  transition: box-shadow var(--t), transform var(--t);
}
.feature-card:hover { box-shadow: var(--sh3); transform: translateY(-2px); }
.feature-icon {
  width: 44px; height: 44px;
  border-radius: 12px; display: grid; place-items: center;
  font-size: 1.1rem; margin-bottom: 14px;
}
.feature-card h3 { font-size: .92rem; font-weight: 700; margin-bottom: 6px; }
.feature-card p  { font-size: .82rem; color: var(--txt-2); line-height: 1.6; }

.how-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
}
.how-step { text-align: center; padding: 16px 12px; }
.how-step-num {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
  font-size: .9rem; font-weight: 900;
  margin: 0 auto 12px;
}
.how-step h4 { font-size: .87rem; font-weight: 700; margin-bottom: 6px; }
.how-step p  { font-size: .8rem; color: var(--txt-2); }


/* ================================================================
   SETTINGS / PROFILE
   ================================================================ */

.profile-card { text-align: center; padding: 28px 24px; }
.profile-avatar {
  width: 68px; height: 68px; border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff; display: grid; place-items: center;
  font-size: 1.8rem; font-weight: 900;
  margin: 0 auto 12px;
  box-shadow: 0 0 0 4px var(--brand-light), 0 8px 20px rgba(124,58,237,.25);
}
.profile-name  { font-size: 1.1rem; font-weight: 800; color: var(--txt); }
.profile-email { font-size: .8rem; color: var(--txt-3); margin-top: 4px; }
.profile-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px; margin-top: 8px;
  font-size: .72rem; font-weight: 700;
}

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .field-grid { grid-template-columns: 1fr; } }

.field-label { font-size: .75rem; font-weight: 700; color: var(--txt-2); letter-spacing: .03em; text-transform: uppercase; margin-bottom: 4px; }
.field-value { font-size: .88rem; font-weight: 600; color: var(--txt); }


/* ================================================================
   SEARCH RESULTS
   ================================================================ */

.search-section { margin-bottom: 20px; }
.search-section-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.search-section-header h3 { font-size: .85rem; font-weight: 800; color: var(--txt); }

.search-result-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r);
  transition: background var(--t);
  text-decoration: none; color: var(--txt);
  margin-bottom: 4px;
}
.search-result-item:hover { background: var(--page-bg); }

.search-result-icon {
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  flex-shrink: 0; font-size: .8rem;
}

.search-result-body { flex: 1; min-width: 0; }
.search-result-title { font-size: .86rem; font-weight: 700; color: var(--txt); margin-bottom: 2px; }
.search-result-sub   { font-size: .76rem; color: var(--txt-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


/* ================================================================
   TABS (Admin panel)
   ================================================================ */

.tabs {
  display: flex; gap: 0; margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
}
.tab-btn {
  padding: 10px 18px;
  background: none; border: none;
  font-size: .845rem; font-weight: 600;
  color: var(--txt-2); cursor: pointer;
  transition: color var(--t);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-family: inherit;
  display: flex; align-items: center; gap: 6px;
}
.tab-btn:hover { color: var(--txt); }
.tab-btn.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }


/* ================================================================
   MOBILE  (responsive)
   ================================================================ */

@media (max-width: 900px) {
  :root { --sb-w: 260px; }

  .crm-sidebar { transform: translateX(-100%); }
  .crm-sidebar.sidebar-open { transform: translateX(0); }
  .sidebar-overlay.active { display: block; }
  .sidebar-toggle { display: flex !important; }
  .crm-main { margin-left: 0; }
  .crm-topbar { padding: 0 16px; }
  .crm-content { padding: 18px 16px 40px; }

  .topbar-search { display: none; }
  .user-name { display: none; }
  .topbar-user { padding: 4px 5px; }

  .domain-grid { grid-template-columns: 1fr; }
  .stat-grid   { grid-template-columns: repeat(2, 1fr); }
  .field-grid  { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  .stat-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 2.1rem; }
  .auth-card  { padding: 26px 22px; }
}


/* ================================================================
   REGISTER PAGE — extra classes
   ================================================================ */

.reg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 480px) { .reg-grid { grid-template-columns: 1fr; } }

.req { color: var(--red); font-weight: 700; }

.field-error {
  font-size: .75rem;
  color: var(--red);
  margin-top: 4px;
  display: none;
}

.pw-strength {
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.pw-strength.is-visible { display: flex; }

.pw-bar {
  flex: 1;
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.strength-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: var(--red);
  transition: width .3s ease, background .3s ease;
}
.strength-text {
  font-size: .72rem;
  font-weight: 700;
  color: var(--red);
  white-space: nowrap;
  min-width: 38px;
}

.pw-checklist {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.pw-checklist li {
  font-size: .74rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pw-checklist li.passed { color: var(--green); }
.pw-checklist li.failed { color: var(--txt-3); }
.pw-checklist .pw-icon { font-size: .7rem; font-weight: 900; width: 12px; text-align: center; }

/* backwards compat alias */
.password-strength { display: none; margin-top: 6px; }
.password-strength.is-visible { display: block; }
.password-checklist { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.password-checklist li { font-size: .74rem; display: flex; align-items: center; gap: 6px; }
.password-checklist li.passed { color: var(--green); }
.password-checklist li.failed { color: var(--txt-3); }
.strength-bar { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; margin-bottom: 4px; }

/* ================================================================
   DASHBOARD HOME — new layout classes
   ================================================================ */

/* Big search bar */
.dash-search-wrap {
  margin-bottom: 22px;
}
.dash-search-form { width: 100%; }
.dash-search-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--r-lg);
  padding: 10px 16px;
  transition: border-color var(--t), box-shadow var(--t);
}
.dash-search-inner:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(124,58,237,.1);
}
.dash-search-inner > i {
  color: var(--txt-3);
  font-size: 1rem;
  flex-shrink: 0;
}
.dash-search-inner input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: .95rem;
  color: var(--txt);
  font-family: inherit;
  outline: none;
}
.dash-search-inner input::placeholder { color: var(--txt-3); }

/* Two-column grid */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}
@media (max-width: 760px) { .dash-grid { grid-template-columns: 1fr; } }

.card-link {
  font-size: .78rem;
  color: var(--brand);
  font-weight: 700;
  white-space: nowrap;
}
.card-link:hover { color: var(--brand-dark); }

/* Domain rows inside card */
.dash-domain-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-2);
}
.dash-domain-row:last-child { border-bottom: none; }

.dash-domain-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--brand-light);
  border: 1px solid var(--brand-mid);
  display: grid; place-items: center;
  color: var(--brand);
  font-size: .8rem;
  flex-shrink: 0;
}
.dash-domain-info { flex: 1; min-width: 0; }
.dash-domain-name {
  display: block;
  font-size: .86rem;
  font-weight: 700;
  color: var(--txt);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-domain-name:hover { color: var(--brand); }
.dash-domain-meta {
  font-size: .72rem;
  color: var(--txt-3);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Note rows inside card */
.dash-note-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-2);
}
.dash-note-row:last-child { border-bottom: none; }
.dash-note-text {
  font-size: .82rem;
  color: var(--txt);
  line-height: 1.5;
}
.dash-note-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}
.dash-note-meta {
  font-size: .72rem;
  color: var(--txt-3);
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Activity log rows */
.dash-log-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-2);
}
.dash-log-row:last-child { border-bottom: none; }
.dash-log-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--brand);
  flex-shrink: 0;
}
.dash-log-body { flex: 1; font-size: .82rem; color: var(--txt); }
.dash-log-action { font-weight: 700; }
.dash-log-by { color: var(--txt-2); margin-left: 4px; }
.dash-log-model { color: var(--txt-3); font-size: .76rem; margin-left: 4px; }
.dash-log-time { font-size: .72rem; color: var(--txt-3); white-space: nowrap; flex-shrink: 0; }

/* Empty state inside card */
.dash-empty {
  text-align: center;
  padding: 28px 16px;
  color: var(--txt-3);
}
.dash-empty i { font-size: 2rem; display: block; margin-bottom: 8px; opacity: .35; }
.dash-empty p { font-size: .82rem; }
.dash-empty a { color: var(--brand); font-weight: 600; }


/* ================================================================
   PUBLIC SEARCH  (home page + search results for non-auth)
   ================================================================ */

.public-search-form {
  margin-top: 28px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.public-search-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: var(--r-xl);
  padding: 10px 16px;
  box-shadow: var(--sh2);
  transition: border-color var(--t), box-shadow var(--t);
}
.public-search-inner:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(124,58,237,.12), var(--sh2);
}
.public-search-inner > i {
  color: var(--txt-3);
  font-size: 1rem;
  flex-shrink: 0;
}
.public-search-inner input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: .97rem;
  color: var(--txt);
  font-family: inherit;
  outline: none;
}
.public-search-inner input::placeholder { color: var(--txt-3); }

.public-search-hint {
  text-align: center;
  font-size: .76rem;
  color: var(--txt-3);
  margin-top: 10px;
}
.public-search-hint a { color: var(--brand); font-weight: 700; }

/* Public search results page wrapper */
.public-search-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.pub-search-header {
  margin-bottom: 20px;
}
.pub-search-header h1 { font-size: 1.4rem; font-weight: 800; color: var(--txt); }
.pub-search-header .page-subtitle { font-size: .82rem; color: var(--txt-2); margin-top: 3px; }


/* ================================================================
   SEARCH RESULT ROWS
   ================================================================ */

.search-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-2);
}
.search-row:last-child { border-bottom: none; }

.search-row-icon {
  width: 38px; height: 38px;
  border-radius: 9px;
  display: grid; place-items: center;
  font-size: .82rem;
  flex-shrink: 0;
}

.search-row-body { flex: 1; min-width: 0; }

.search-row-title {
  font-size: .88rem;
  font-weight: 700;
  color: var(--txt);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-row-sub {
  font-size: .78rem;
  color: var(--txt-2);
  line-height: 1.5;
  margin-top: 2px;
}

.search-row-url {
  display: block;
  font-size: .74rem;
  color: var(--brand);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-row-url:hover { color: var(--brand-dark); }

.search-row-meta {
  font-size: .72rem;
  color: var(--txt-3);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.search-row-actions { flex-shrink: 0; }
.search-row-actions .btn { white-space: nowrap; }


/* ================================================================
   PUBLIC HOME  —  Query Solver Theme
   ================================================================ */

/* Nav */
.qh-nav {
  position: sticky; top: 0; z-index: 200;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 40px; height: 60px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  gap: 20px;
}
.qh-nav-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--txt);
  font-size: .97rem; letter-spacing: -.01em; flex-shrink: 0;
}
.qh-nav-brand strong { font-weight: 900; }
.qh-nav-brand span { font-weight: 400; }
.qh-nav-icon {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  display: grid; place-items: center;
  font-weight: 900; font-size: .9rem; color: #fff; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(124,58,237,.35);
}
.qh-nav-links {
  display: flex; align-items: center; gap: 24px;
  flex: 1; justify-content: center;
}
.qh-nav-links a {
  font-size: .84rem; font-weight: 600; color: var(--txt-2);
  text-decoration: none; transition: color var(--t);
}
.qh-nav-links a:hover { color: var(--brand); }
.qh-nav-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Hero */
.qh-hero {
  position: relative; padding: 72px 40px 60px;
  overflow: hidden;
  background: linear-gradient(160deg, #faf5ff 0%, #f0f4ff 50%, #f8fafc 100%);
  text-align: center;
}
.qh-hero-bg {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 900px 500px at 50% -10%, rgba(124,58,237,.10) 0%, transparent 70%),
    radial-gradient(ellipse 600px 500px at 0% 50%, rgba(124,58,237,.06) 0%, transparent 70%),
    radial-gradient(ellipse 600px 500px at 100% 60%, rgba(79,70,229,.06) 0%, transparent 70%);
}
.qh-hero-content { position: relative; z-index: 1; max-width: 780px; margin: 0 auto; }

/* Database/search themed line-art illustrations filling the empty hero margins */
.qh-hero-art {
  position: absolute; top: 50%; z-index: 0; pointer-events: none;
  width: 320px; height: 460px; opacity: .18;
  animation: qh-art-drift 7s ease-in-out infinite;
}
.qh-hero-art-left  { left: -3%;  transform: translateY(-50%); }
.qh-hero-art-right { right: -3%; transform: translateY(-50%) scaleX(-1); animation-delay: 1.4s; }
@keyframes qh-art-drift {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  50%      { transform: translateY(-54%) translateX(4px); }
}
.qh-hero-art-right { animation-name: qh-art-drift-r; }
@keyframes qh-art-drift-r {
  0%, 100% { transform: translateY(-50%) scaleX(-1) translateX(0); }
  50%      { transform: translateY(-54%) scaleX(-1) translateX(4px); }
}
@media (max-width: 1300px) {
  .qh-hero-art { display: none; }
}

/* "Searching" motion cues inside the illustrations */
.qh-scanline {
  transform-origin: center;
  animation: qh-scan 2.6s ease-in-out infinite;
}
@keyframes qh-scan {
  0%   { transform: translateY(-3px); opacity: 0; }
  15%  { opacity: .8; }
  50%  { transform: translateY(30px); opacity: .8; }
  85%  { opacity: 0; }
  100% { transform: translateY(33px); opacity: 0; }
}
.qh-ping {
  transform-origin: 150px 190px;
  animation: qh-ping-pulse 2.2s ease-out infinite;
}
@keyframes qh-ping-pulse {
  0%   { transform: scale(1);   opacity: .7; }
  100% { transform: scale(1.9); opacity: 0; }
}
.qh-blinkdot {
  animation: qh-blink 2.2s ease-in-out infinite;
}
@keyframes qh-blink {
  0%, 100% { opacity: .3; r: 4; }
  50%      { opacity: 1;  r: 6; }
}
.qh-flowline {
  stroke-dasharray: 4 5;
  animation: qh-flow 1.4s linear infinite;
}
@keyframes qh-flow {
  to { stroke-dashoffset: -18; }
}

.qh-hero-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--brand-light); color: var(--brand);
  border: 1px solid var(--brand-mid); border-radius: 20px;
  padding: 6px 16px; font-size: .76rem; font-weight: 700;
  letter-spacing: .03em; margin-bottom: 22px;
}
.qh-pill-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--brand);
  animation: qh-pulse 2s ease-in-out infinite;
}
@keyframes qh-pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(.7); }
}
.qh-hero-title {
  font-size: 3.2rem; font-weight: 900; color: var(--txt);
  line-height: 1.12; letter-spacing: -.04em; margin-bottom: 18px;
}
.qh-hero-title span { color: var(--brand); }
.qh-hero-sub {
  font-size: 1.05rem; color: var(--txt-2);
  max-width: 600px; margin: 0 auto 32px; line-height: 1.75;
}

/* Hero Search */
.qh-search-form { margin-bottom: 28px; }
.qh-search-box {
  display: flex; align-items: center;
  background: #fff; border: 2px solid var(--border); border-radius: var(--r-xl);
  padding: 12px 10px 12px 22px;
  box-shadow: 0 4px 20px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.05);
  max-width: 640px; margin: 0 auto 10px;
  transition: border-color var(--t), box-shadow var(--t); gap: 10px;
}
.qh-search-box:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(124,58,237,.1), 0 4px 20px rgba(0,0,0,.08);
}
.qh-search-icon { color: var(--txt-3); font-size: 1.1rem; flex-shrink: 0; }
.qh-search-box input {
  flex: 1; border: none; background: transparent;
  font-size: 1.05rem; color: var(--txt); font-family: inherit; outline: none;
}
.qh-search-box input::placeholder { color: var(--txt-3); }
.qh-search-box button {
  background: var(--brand); color: #fff; border: none; border-radius: var(--r-lg);
  padding: 12px 24px; font-size: .92rem; font-weight: 700;
  cursor: pointer; white-space: nowrap; font-family: inherit;
  display: flex; align-items: center; gap: 6px;
  transition: background var(--t), transform var(--t); flex-shrink: 0;
}
.qh-search-box button:hover { background: var(--brand-dark); transform: scale(1.02); }
.qh-search-sub {
  font-size: .74rem; color: var(--txt-3); text-align: center; margin: 0;
}
.qh-search-sub a { color: var(--brand); font-weight: 700; }
.qh-hero-cta { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

/* Hero stat chips */
.qh-hero-stats {
  display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin-top: 48px;
}
.qh-stat-chip {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 12px 18px; box-shadow: var(--sh1);
}
.qh-stat-chip-icon {
  width: 38px; height: 38px; border-radius: 9px;
  display: grid; place-items: center; font-size: .9rem; color: #fff; flex-shrink: 0;
}
.qh-stat-chip-icon.purple { background: linear-gradient(135deg,#7c3aed,#4f46e5); }
.qh-stat-chip-icon.blue   { background: linear-gradient(135deg,#3b82f6,#2563eb); }
.qh-stat-chip-icon.green  { background: linear-gradient(135deg,#10b981,#059669); }
.qh-stat-num { font-size: 1.1rem; font-weight: 900; color: var(--txt); line-height: 1; }
.qh-stat-lbl { font-size: .71rem; color: var(--txt-3); font-weight: 600; margin-top: 2px; }

/* Sections */
.qh-section { padding: 72px 40px; text-align: center; max-width: 1100px; margin: 0 auto; }
.qh-section-alt { background: var(--page-bg); padding: 72px 40px; }
.qh-section-alt > * { max-width: 1100px; margin-left: auto; margin-right: auto; }
.qh-section-label {
  display: inline-block; font-size: .72rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .12em; color: var(--brand); margin-bottom: 12px;
}
.qh-section-title {
  font-size: 2rem; font-weight: 900; color: var(--txt);
  letter-spacing: -.03em; line-height: 1.2; margin-bottom: 44px;
}

/* Feature cards */
.qh-features {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px; text-align: left;
}
.qh-feature-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 24px 22px; box-shadow: var(--sh1);
  transition: box-shadow var(--t), transform var(--t);
}
.qh-feature-card:hover { box-shadow: var(--sh3); transform: translateY(-3px); }
.qh-feature-icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: grid; place-items: center; font-size: 1rem; color: #fff; margin-bottom: 16px;
}
.qh-feature-card h3 { font-size: .92rem; font-weight: 800; color: var(--txt); margin-bottom: 8px; }
.qh-feature-card p  { font-size: .81rem; color: var(--txt-2); line-height: 1.65; margin: 0; }

/* Steps */
.qh-steps {
  display: flex; align-items: flex-start; justify-content: center;
  gap: 6px; flex-wrap: wrap; text-align: center;
}
.qh-step { flex: 1; min-width: 160px; max-width: 220px; padding: 20px 16px; }
.qh-step-num {
  font-size: 2.2rem; font-weight: 900; color: var(--brand-mid); line-height: 1; margin-bottom: 10px;
}
.qh-step-icon {
  width: 52px; height: 52px; border-radius: 14px;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  display: grid; place-items: center; font-size: 1.1rem; color: #fff;
  margin: 0 auto 14px; box-shadow: 0 4px 14px rgba(124,58,237,.3);
}
.qh-step h4 { font-size: .9rem; font-weight: 800; color: var(--txt); margin-bottom: 6px; }
.qh-step p  { font-size: .79rem; color: var(--txt-2); line-height: 1.6; margin: 0; }
.qh-step-arrow { color: var(--brand-mid); font-size: 1.1rem; align-self: center; padding: 0 4px; flex-shrink: 0; }

/* CTA Banner */
.qh-cta-banner {
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 60%, #2563eb 100%);
  padding: 72px 40px; text-align: center; position: relative; overflow: hidden;
}
.qh-cta-banner::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse 600px 300px at 70% 50%, rgba(255,255,255,.07) 0%, transparent 70%);
  pointer-events: none;
}
.qh-cta-content { position: relative; z-index: 1; max-width: 600px; margin: 0 auto; }
.qh-cta-banner h2 { font-size: 2rem; font-weight: 900; color: #fff; letter-spacing: -.03em; margin-bottom: 12px; }
.qh-cta-banner p  { font-size: .92rem; color: rgba(255,255,255,.8); margin-bottom: 28px; }
.qh-cta-btns { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

/* Footer */
.qh-footer {
  padding: 32px 40px; text-align: center; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.qh-footer-brand { display: flex; align-items: center; gap: 8px; }

/* Responsive */
@media (max-width: 760px) {
  .qh-nav { padding: 0 18px; }
  .qh-nav-links { display: none; }
  .qh-hero { padding: 48px 20px 40px; }
  .qh-hero-title { font-size: 2.1rem; }
  .qh-section { padding: 48px 20px; }
  .qh-section-alt { padding: 48px 20px; }
  .qh-cta-banner { padding: 48px 20px; }
  .qh-cta-banner h2 { font-size: 1.5rem; }
  .qh-steps { flex-direction: column; align-items: center; }
  .qh-step-arrow { transform: rotate(90deg); }
  .qh-hero-stats { gap: 10px; }
}

/* ── Toast Notifications (center pop) ──────────────────────────────────────── */
.toast-msg {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px; border-radius: 14px; min-width: 300px; max-width: 420px;
  background: #fff; box-shadow: 0 6px 28px rgba(0,0,0,0.15);
  border-left: 4px solid var(--brand);
  font-size: 0.875rem; font-weight: 500; color: var(--txt);
  animation: toastIn 0.4s cubic-bezier(.22,1,.36,1);
}
@keyframes toastIn {
  from { opacity:0; transform: scale(0.7); }
  to   { opacity:1; transform: scale(1); }
}
.toast-success { border-left-color: #059669; }
.toast-error   { border-left-color: #dc2626; }
.toast-warning { border-left-color: #d97706; }
.toast-info    { border-left-color: #2563eb; }
.toast-icon { font-size: 1.05rem; flex-shrink: 0; }
.toast-success .toast-icon { color: #059669; }
.toast-error   .toast-icon { color: #dc2626; }
.toast-warning .toast-icon { color: #d97706; }
.toast-info    .toast-icon { color: #2563eb; }
.toast-close {
  margin-left: auto; background: none; border: none; cursor: pointer;
  color: var(--txt-3); font-size: 1.1rem; line-height: 1; padding: 0 2px;
}
.toast-close:hover { color: var(--txt); }

/* ── Profile Dropdown ───────────────────────────────────────────────────────── */
.profile-dropdown {
  position: absolute; top: calc(100% + 10px); right: 0;
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.13); min-width: 230px; z-index: 500;
  padding: 6px 0; animation: pdIn 0.18s ease;
}
@keyframes pdIn {
  from { opacity:0; transform: translateY(-6px); }
  to   { opacity:1; transform: translateY(0); }
}
.pd-header { display: flex; gap: 10px; align-items: center; padding: 14px 16px 10px; }
.pd-avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--brand);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; flex-shrink: 0;
}
.pd-name { font-weight: 700; font-size: 0.9rem; color: var(--txt); }
.pd-email { font-size: 0.75rem; color: var(--txt-3); margin-top: 1px; }
.pd-badge { display:inline-block; margin-top:4px; font-size:0.68rem; font-weight:700; padding:2px 8px; border-radius:99px; background:var(--brand-light); color:var(--brand); }
.pd-divider { height: 1px; background: var(--border); margin: 4px 0; }
.pd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; font-size: 0.855rem; color: var(--txt); text-decoration: none;
  transition: background 0.15s; cursor: pointer;
}
.pd-item:hover { background: var(--bg); }
.pd-item i { width: 16px; color: var(--txt-2); font-size: 0.85rem; }
.pd-logout { color: #dc2626; }
.pd-logout i { color: #dc2626; }

/* ── Quill Editor Height Fix ────────────────────────────────────────────────── */
.ql-container { border-bottom-left-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm); }
.ql-toolbar { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.ql-editor { min-height: 120px; max-height: 320px; overflow-y: auto; font-size: 0.9rem; }

/* ── Quill Height Hard Fix ──────────────────────────────────────────────────── */
.ql-editor { min-height: 120px !important; max-height: 260px !important; overflow-y: auto !important; }
.ql-container.ql-snow { max-height: 280px !important; overflow: hidden !important; }

/* ── Sidebar Footer Dropdown (pops UP) ─────────────────────────────────────── */
.sf-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 12px; right: 12px;
  background: #1e1b2e;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 14px;
  box-shadow: 0 -8px 32px rgba(0,0,0,.35);
  padding: 6px 0;
  z-index: 600;
  animation: sfddIn .2s cubic-bezier(.22,1,.36,1);
}
@keyframes sfddIn {
  from { opacity:0; transform: translateY(10px); }
  to   { opacity:1; transform: translateY(0); }
}
.sf-dd-header {
  display: flex; gap: 10px; align-items: center;
  padding: 12px 14px 10px;
}
.sf-dd-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg,#7c3aed,#4f46e5);
  color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: .85rem; flex-shrink: 0;
}
.sf-dd-name  { font-size: .82rem; font-weight: 700; color: #e5e7eb; }
.sf-dd-email { font-size: .7rem; color: #9ca3af; margin-top: 1px; }
.sf-dd-badge {
  display: inline-block; margin-top: 3px;
  font-size: .62rem; font-weight: 700;
  padding: 1px 7px; border-radius: 99px;
  background: rgba(124,58,237,.25); color: #a78bfa;
}
.sf-dd-divider { height: 1px; background: rgba(255,255,255,.07); margin: 4px 0; }
.sf-dd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; font-size: .82rem;
  color: #d1d5db; text-decoration: none;
  transition: background .15s;
}
.sf-dd-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.sf-dd-item i { width: 14px; font-size: .78rem; color: #9ca3af; }
.sf-dd-item:hover i { color: #a78bfa; }
.sf-dd-logout { color: #f87171; }
.sf-dd-logout i { color: #f87171; }
.sf-dd-logout:hover { background: rgba(239,68,68,.1); color: #fca5a5; }
