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

:root {
  --bg-main: #0b0f19;
  --bg-card: #131b2e;
  --bg-card-hover: #1a253f;
  --bg-modal: rgba(15, 23, 42, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #6366f1;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-primary: #6366f1;
  --accent-secondary: #a855f7;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  --accent-glow: rgba(99, 102, 241, 0.35);
  --ai-badge-bg: rgba(168, 85, 247, 0.15);
  --ai-badge-border: rgba(168, 85, 247, 0.3);
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(168, 85, 247, 0.12) 0%, transparent 40%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* Header & Navbar */
.header {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: var(--accent-gradient);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.logo-title {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-badges {
  display: flex;
  gap: 10px;
}

.status-badge {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 10px #10b981;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}

/* Hero Section */
.hero {
  max-width: 900px;
  margin: 60px auto 40px;
  text-align: center;
  padding: 0 20px;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ai-badge-bg);
  border: 1px solid var(--ai-badge-border);
  color: var(--accent-secondary);
  padding: 6px 16px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 20px;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 46px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 18px;
  letter-spacing: -0.02em;
}

.hero-title span {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 720px;
  margin: 0 auto 36px;
}

/* Main Search Trigger Box */
.search-trigger-bar {
  background: rgba(19, 27, 46, 0.7);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  max-width: 760px;
  margin: 0 auto;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-trigger-bar:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 20px 45px -10px var(--accent-glow);
  transform: translateY(-2px);
}

.search-icon-sparkle {
  color: var(--accent-secondary);
}

.search-placeholder {
  flex: 1;
  text-align: left;
  color: var(--text-muted);
  font-size: 16px;
}

.key-shortcut {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Quick Topic Pills */
.topic-pills {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.pill-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pill-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

/* Dashboard Main Layout */
.dashboard-wrapper {

  max-width: 1200px;
  margin: 40px auto 60px;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.dashboard-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

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

.card-icon {
  width: 36px;
  height: 36px;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
}

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

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

.form-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

.form-input:focus {
  border-color: var(--accent-primary);
}

.btn-action {
  width: 100%;
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.btn-action:hover {
  opacity: 0.9;
}

.code-block {
  background: #090d16;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  color: #cbd5e1;
  overflow-x: auto;
  position: relative;
}

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
}

/* AI Command Palette Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(3, 7, 18, 0.75);
  backdrop-filter: blur(12px);
  z-index: 99999;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

#searchModal.modal-overlay {
  align-items: flex-start;
  padding-top: 60px;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  width: 100%;
  max-width: 820px;
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 40px var(--accent-glow);
  overflow: hidden;
  transform: translateY(-20px) scale(0.97);
  transition: transform 0.25s ease;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.modal-overlay.active .modal-container {
  transform: translateY(0) scale(1);
}

.modal-search-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(17, 24, 39, 0.95);
}

.modal-search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 18px;
  font-family: var(--font-body);
  outline: none;
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

/* AI Answer Box */
.ai-answer-box {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 24px;
}

.ai-answer-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-secondary);
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 12px;
}

.ai-answer-content {
  font-size: 14px;
  color: #e2e8f0;
  line-height: 1.7;
}

.ai-sources-list {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.source-chip {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.source-chip:hover {
  background: rgba(99, 102, 241, 0.2);
  color: #fff;
}

/* Search Results Items */
.results-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.result-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  transition: all 0.2s ease;
  text-decoration: none;
  color: inherit;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.result-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent-primary);
}

.result-img {
  width: 90px;
  height: 65px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: #070b14;
}

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


.result-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.result-snippet {
  font-size: 13px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.score-badge {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.modal-footer {
  padding: 14px 24px;
  background: #0d1322;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* Category Filters in Modal */
.category-filter-bar {
  display: flex;
  gap: 8px;
  padding: 10px 24px;
  background: rgba(13, 19, 34, 0.7);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  scrollbar-width: none;
}
.category-filter-bar::-webkit-scrollbar { display: none; }

.cat-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.cat-pill:hover, .cat-pill.active {
  background: var(--accent-gradient);
  color: #fff;
  border-color: transparent;
}

/* Keyword Highlight */
mark {
  background: rgba(234, 179, 8, 0.35);
  color: #fef08a;
  padding: 1px 4px;
  border-radius: 3px;
}

/* Streaming Cursor Animation */
.streaming-cursor {
  display: inline-block;
  width: 6px;
  height: 14px;
  background: var(--accent-secondary);
  margin-left: 4px;
  vertical-align: middle;
  animation: blink 0.8s infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Analytics Panel */
.analytics-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  width: 100%;
}

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

.analytics-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
}

.status-chip {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}

.refresh-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.refresh-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent-primary);
  color: #fff;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 105px;
  min-width: 0;
  transition: border-color 0.2s;
}

.stat-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
}

.stat-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.stat-icon {
  font-size: 14px;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-sub {
  font-size: 11px;
  color: #10b981;
  margin-top: 4px;
}


/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .analytics-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .hero-title { font-size: 32px; }
  .hero-subtitle { font-size: 16px; }
  .modal-overlay { padding-top: 20px; }
  .modal-container { width: 95%; max-height: 90vh; }
  .modal-search-header { padding: 14px 16px; }
  .modal-body { padding: 16px; }
  .category-filter-bar { padding: 8px 16px; }
}

@media (max-width: 600px) {
  .analytics-grid { grid-template-columns: 1fr; }
  .search-trigger-bar { padding: 12px 16px; }
  .search-placeholder { font-size: 14px; }
  .key-shortcut { display: none; }
  .result-img { width: 70px; height: 50px; }
}

/* Toastify Custom UI & Animation */
.toastify {
  border-radius: 12px !important;
  font-family: var(--font-body) !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
  box-shadow: 0 16px 36px -8px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.4) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  padding: 13px 20px !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  line-height: 1.5 !important;
  max-width: 90vw !important;
}

.toastify.on {
  animation: toastifySlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

@keyframes toastifySlideIn {
  0% {
    opacity: 0;
    transform: translateY(-12px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast-close {
  opacity: 0.75;
  padding-left: 12px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.toast-close:hover {
  opacity: 1;
}

/* ====================================================
   SKELETON LOADERS — Topic Pills & Category Filter
   ==================================================== */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton-pill {
  display: inline-block;
  height: 34px;
  border-radius: 20px;
  background: linear-gradient(90deg,
    rgba(255,255,255,0.06) 25%,
    rgba(255,255,255,0.12) 50%,
    rgba(255,255,255,0.06) 75%
  );
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
  pointer-events: none;
}

.skeleton-cat-pill {
  display: inline-block;
  height: 28px;
  border-radius: 14px;
  background: linear-gradient(90deg,
    rgba(255,255,255,0.05) 25%,
    rgba(255,255,255,0.10) 50%,
    rgba(255,255,255,0.05) 75%
  );
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
  pointer-events: none;
}

/* ====================================================
   TENANTS LIST TABLE
   ==================================================== */
.tenants-table-wrapper {
  max-height: 400px;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: rgba(13, 19, 34, 0.4);
}
.tenants-table-wrapper::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.tenants-table-wrapper::-webkit-scrollbar-track {
  background: transparent;
}
.tenants-table-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
}
.tenants-table-wrapper::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.2);
}

.tenants-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.tenants-table thead th {
  position: sticky;
  top: 0;
  background: #111827; /* Solid color to block scrolling rows */
  z-index: 10;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-muted);
  text-align: left;
  padding: 10px 12px;
  font-weight: 500;
  box-shadow: 0 1px 0 var(--border-color); /* ensures border persists while sticky */
}
.tenants-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.05);
  transition: background 0.2s ease;
}
.tenants-table tbody tr:hover {
  background: rgba(255,255,255,0.03);
}
.tenants-table tbody tr:last-child {
  border-bottom: none;
}
.tenants-table td {
  padding: 12px 10px;
}

/* ====================================================
   APP UI UTILITIES & EXTRACTED STYLES
   ==================================================== */
.stat-value-sm {
  font-size: 22px;
}

.card-icon-primary {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
}

.card-icon-emerald {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.card-header-between {
  justify-content: space-between;
  flex-wrap: wrap;
}

.card-header-gap12 {
  gap: 12px;
}

.card-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.card-full-width {
  grid-column: 1 / -1;
}

/* Form Utilities */
.form-group-compact {
  margin-bottom: 12px;
}

.form-group-mb0 {
  margin-bottom: 0;
}

.form-group-bordered {
  margin-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 12px;
}

.form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.form-row-1col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.form-select-custom {
  background: var(--bg-card);
  cursor: pointer;
}

.select-highlight {
  background: var(--bg-card);
  cursor: pointer;
  border-color: var(--accent-primary);
}

.btn-gradient-primary {
  background: linear-gradient(135deg, var(--accent-primary), #6366f1);
  margin-bottom: 12px;
}

.flex-row-gap8 {
  display: flex;
  gap: 8px;
}

.flex-1 {
  flex: 1;
}

.btn-action-auto {
  white-space: nowrap;
  width: auto;
  padding: 0 16px;
}

.source-status {
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-secondary);
}

.doc-count-highlight {
  color: var(--text-primary);
}

/* Drop-in Widget Generator Styles */
.form-label-xs {
  font-size: 11px;
}

.embed-theme-select {
  background: var(--bg-card);
  cursor: pointer;
  padding: 6px 10px;
  font-size: 12px;
}

.embed-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.code-block-pre {
  margin: 0;
}

/* Tenant & Whitelist Registration Form */
.btn-pill-primary {
  padding: 8px 16px;
  font-size: 13px;
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-primary);
  color: #fff;
}

.new-tenant-form {
  display: none;
  background: rgba(0, 0, 0, 0.35);
  border: 1px dashed rgba(99, 102, 241, 0.5);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.new-tenant-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 14px;
  color: var(--accent-secondary);
}

.new-tenant-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.new-tenant-field {
  margin-bottom: 14px;
}

.new-tenant-hint {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  margin-top: 4px;
}

.new-tenant-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-pill-cancel {
  padding: 8px 18px;
}

.btn-pill-logout {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 8px 18px;
  cursor: pointer;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-pill-logout:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fff;
  border-color: #ef4444;
}

.btn-tenant-save {
  width: auto;
  padding: 8px 24px;
}

/* Dynamic Tenants Table & Actions */
.sortable-th {
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.sortable-th:hover {
  background: rgba(99, 102, 241, 0.15) !important;
  color: #fff !important;
}

.sort-icon {
  font-size: 11px;
  margin-left: 5px;
  color: var(--text-muted);
  display: inline-block;
  vertical-align: middle;
  transition: all 0.2s ease;
}

.sortable-th.active-sort {
  color: #818cf8 !important;
}

.sortable-th.active-sort .sort-icon {
  color: #818cf8 !important;
  font-weight: 700;
}

.th-key {
  width: 140px;
  max-width: 140px;
  white-space: nowrap;
}

.th-status {
  min-width: 100px;
  white-space: nowrap;
}

.th-quota {
  min-width: 130px;
  white-space: nowrap;
}

.th-date {
  min-width: 160px;
  white-space: nowrap;
}

.th-actions {
  text-align: right;
}

.tenant-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

.tenant-status-badge.active {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.tenant-status-badge.suspended {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.tenant-suspended-row {
  background: rgba(245, 158, 11, 0.03);
}

.tenant-suspended-row:hover {
  background: rgba(245, 158, 11, 0.06) !important;
}

.tenant-date-col {
  white-space: nowrap;
}

.tenant-date-time {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.tenant-date-icon {
  font-size: 12px;
  opacity: 0.85;
  margin-top: 1px;
}

.tenant-date-stacked {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.2;
}

.tenant-date-day {
  font-size: 12px;
  color: #e2e8f0;
  font-weight: 500;
  white-space: nowrap;
}

.tenant-date-hour {
  font-size: 11px;
  color: #94a3b8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.tenant-empty-text {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
}

.tenant-name-col {
  font-weight: 600;
  color: #fff;
}

.tenant-name-title {
  font-weight: 600;
  color: #fff;
  display: block;
}

.tenant-name-domain {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.tenant-key-col {
  width: 140px;
  max-width: 140px;
  white-space: nowrap;
}

.tenant-key-code {
  font-family: monospace;
  font-size: 11.5px;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: inline-block;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tenant-key-code:hover {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.4);
  color: #fff;
}

.tenant-domain-pill {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  margin-right: 4px;
  display: inline-block;
  margin-bottom: 2px;
}

.tenant-tag-nowhitelist {
  color: #f87171;
}

.tenant-quota-badge {
  color: #10b981;
  font-weight: 500;
}

.tenant-actions-col {
  text-align: right;
  white-space: nowrap;
}

.tenant-actions-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.tenant-actions-row {
  display: flex;
  gap: 6px;
}

.btn-tenant-crawl {
  padding: 4px 8px;
  font-size: 11px;
  background: rgba(99, 102, 241, 0.18);
  color: #818cf8;
  border-color: rgba(99, 102, 241, 0.35);
}

.btn-tenant-embed {
  padding: 4px 8px;
  font-size: 11px;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.3);
}

.btn-tenant-suspend {
  padding: 4px 8px;
  font-size: 11px;
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.35);
}

.btn-tenant-activate {
  padding: 4px 8px;
  font-size: 11px;
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}

.btn-tenant-delete {
  padding: 4px 8px;
  font-size: 11px;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

.tenant-demo-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Real-time Background Ingestion Progress Bar */
.crawl-progress-container {
  display: none;
  margin-top: 8px;
  margin-bottom: 12px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.crawl-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.crawl-progress-status-box {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.crawl-progress-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.crawl-progress-percent {
  font-size: 13px;
  font-weight: 700;
  color: #10b981;
}

.crawl-progress-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  overflow: hidden;
}

.crawl-progress-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #10b981);
  transition: width 0.4s ease;
  border-radius: 6px;
}

.crawl-progress-detail {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  font-family: monospace;
}

/* Modal Search & Content States */
.modal-search-icon {
  color: var(--accent-secondary);
}

.modal-default-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.modal-default-icon {
  margin-bottom: 12px;
  color: var(--accent-primary);
}

.modal-default-text {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
}

.modal-footer-source {
  color: var(--text-primary);
}

.kbd-key {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 12px;
}

.search-empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 30px;
}

.topic-empty-msg {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

.ai-generating-text {
  color: var(--accent-secondary);
}

.ai-error-msg {
  color: #f87171;
}

.md-code {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 5px;
  border-radius: 4px;
  font-family: monospace;
}

.md-list-item {
  margin-left: 16px;
}

.md-paragraph {
  margin-bottom: 8px;
}

.is-hidden {
  display: none;
}

/* Edit Tenant Modal */
.edit-tenant-card {
  max-width: 620px;
  width: 95%;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  padding: 20px 24px;
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 30px rgba(99, 102, 241, 0.25);
  transform: translateY(-20px) scale(0.97);
  transition: transform 0.25s ease;
  box-sizing: border-box;
}

.modal-overlay.active .edit-tenant-card {
  transform: translateY(0) scale(1);
}

.modal-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.edit-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.edit-modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  max-height: calc(100vh - 160px);
  padding-right: 6px;
}

.edit-modal-body::-webkit-scrollbar {
  width: 5px;
}

.edit-modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.edit-tenant-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.edit-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

/* Admin Auth Header Badge & Login Modal */
.admin-auth-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: #a5b4fc;
  cursor: pointer;
  transition: all 0.2s ease;
}

.admin-auth-badge:hover {
  background: rgba(99, 102, 241, 0.28);
  border-color: #818cf8;
  color: #fff;
  transform: translateY(-1px);
}

.admin-auth-badge.unauthenticated {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.auth-lock-icon {
  font-size: 12px;
}

.admin-login-card {
  max-width: 480px;
  width: 92%;
  padding: 26px;
  background: #111827;
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 20px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 35px rgba(99, 102, 241, 0.3);
  transform: translateY(-20px) scale(0.97);
  transition: transform 0.25s ease;
}

.modal-overlay.active .admin-login-card {
  transform: translateY(0) scale(1);
}

.admin-login-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.5;
}

.admin-login-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 6px 0;
  color: var(--text-muted);
  font-size: 11px;
}

.admin-login-divider::before,
.admin-login-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-login-divider span {
  padding: 0 10px;
}

/* Auto-Sync Badges & Buttons */
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.sync-badge.sync-daily {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.sync-badge.sync-hourly {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.sync-badge.sync-weekly {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.sync-badge.sync-disabled {
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.btn-tenant-sync {
  background: rgba(99, 102, 241, 0.15);
  color: #c7d2fe;
  border: 1px solid rgba(99, 102, 241, 0.35);
}

.btn-tenant-sync:hover {
  background: rgba(99, 102, 241, 0.35);
  color: #ffffff;
  border-color: #818cf8;
}

/* Database Status & Backup Management Styles */
.card-icon-indigo {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.db-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 16px 0 20px;
}

.db-metric-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s ease;
}

.db-metric-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(99, 102, 241, 0.3);
}

.db-metric-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.db-metric-value {
  font-size: 16px;
  font-weight: 700;
  color: #f1f5f9;
}

.backups-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 16px 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-backup-restore {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.35);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-backup-restore:hover {
  background: rgba(16, 185, 129, 0.35);
  color: #ffffff;
  border-color: #34d399;
}



