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

/* ─── CSS Variables ─────────────────────────────────────────────────────── */
:root {
  --background: #f0f9ff;
  --foreground: #0c2340;
  --card: #ffffff;
  --card-foreground: #0c2340;
  --primary: #0891b2;
  --primary-hover: #0891b2;
  --primary-foreground: #0c2340;
  --secondary: #e0f2fe;
  --secondary-foreground: #155e75;
  --muted: #f1f9fd;
  --muted-foreground: #64748b;
  --border: #bae6fd;
  --ring: #0891b2;
  --nav-bg: #f8fdff;
  --nav-border: #bae6fd;
  --card-hover: #f0f9ff;
  --card-selected: #e0f7fa;
  --card-selected-border: #0891b2;
  --badge-sharepoint: #6366f1;
  --badge-sharepoint-fg: #3730a3;
  --badge-local: #0891b2;
  --badge-local-fg: #155e75;
  --badge-ext: #7c3aed;
  --badge-ext-fg: #6d28d9;
  --badge-green: #16a34a;
  --badge-green-fg: #bbf7d0;
  --badge-yellow: #d97706;
  --badge-yellow-fg: #fef3c7;
  --badge-red: #dc2626;
  --badge-red-fg: #fee2e2;
  --score-color: #b45309;
  --detail-bg: #f8fbff;
  --keyword-bg: #dcfce7;
  --keyword-fg: #166534;
  --search-bg: #ffffff;
  --danger: #ef4444;
  --top-nav-h: 56px;
  --nav-sidebar-w: 228px;
  --shadow-sm: 0 1px 3px rgba(148,163,184,0.25);
  --shadow-md: 0 4px 16px rgba(148,163,184,0.35);
}

/* ─── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; padding: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--background);
  color: var(--foreground);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }

/* ─── App Shell ─────────────────────────────────────────────────────────── */
.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Top Nav ───────────────────────────────────────────────────────────── */
.top-nav {
  height: var(--top-nav-h);
  min-height: var(--top-nav-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  flex-shrink: 0;
  z-index: 200;
}

.tn-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  text-decoration: none;
  color: var(--foreground);
  margin-right: 6px;
}
.tn-brand-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(59,130,246,0.18);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.tn-brand-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.tn-brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--foreground);
}

.tn-search-form {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  max-width: 760px;
}

.tn-search-wrap {
  flex: 1;
  position: relative;
  min-width: 120px;
}
.tn-search-wrap .icon-search {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-foreground);
  pointer-events: none;
}
.tn-search-input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--search-bg);
  color: var(--foreground);
  padding: 0 32px 0 36px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tn-search-input::placeholder { color: var(--muted-foreground); }
.tn-search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.28);
}
.tn-search-clear {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-foreground);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  background: none;
  border: none;
  padding: 2px;
}
.tn-search-clear:hover { color: var(--foreground); }

.tn-mode {
  display: flex;
  align-items: center;
  background: var(--secondary);
  border-radius: 8px;
  padding: 3px;
  gap: 1px;
  flex-shrink: 0;
}
.tn-mode-opt {
  position: relative;
  flex: 1;
}
.tn-mode-opt input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  margin: 0;
}
.tn-mode-opt span {
  display: block;
  padding: 4px 11px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  user-select: none;
}
.tn-mode-opt input:checked + span {
  background: var(--primary);
  color: #fff;
}

.tn-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  flex-shrink: 0;
}

.tn-filters {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.tn-select {
  height: 34px;
  padding: 0 24px 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--search-bg);
  color: var(--foreground);
  font-size: 12px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b97ad' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color 0.15s;
}
.tn-select:focus { border-color: var(--primary); }

.tn-ctrl-group {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.tn-ctrl-field {
  display: flex;
  align-items: center;
  gap: 5px;
}
.tn-ctrl-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted-foreground);
  white-space: nowrap;
}
.tn-ctrl-input {
  width: 62px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--search-bg);
  color: var(--foreground);
  font-size: 12px;
  padding: 0 8px;
  outline: none;
  transition: border-color 0.15s;
}
.tn-ctrl-input:focus { border-color: var(--primary); }
.tn-ctrl-input::placeholder { color: var(--muted-foreground); }

.tn-score-wrap { display: flex; align-items: center; gap: 5px; }

.tn-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  flex-shrink: 0;
}
.tn-nav-toggle:hover { background: var(--secondary); color: var(--foreground); }

.tn-right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.tn-btn {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.tn-btn:hover { background: var(--secondary); color: var(--foreground); }

.tn-user-trigger {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 10px 0 6px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--secondary);
  color: var(--foreground);
  cursor: pointer;
  transition: background 0.15s;
}
.tn-user-trigger:hover { background: var(--card-hover); }
.tn-user-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  background: #3a455d;
  flex-shrink: 0;
}
.tn-user-name {
  font-size: 12px;
  font-weight: 600;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tn-groups-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(59,130,246,0.18);
  color: #93c5fd;
  font-size: 10px;
  font-weight: 600;
}

/* ─── App Body ──────────────────────────────────────────────────────────── */
.app-body {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

/* ─── Left Navigation Sidebar ───────────────────────────────────────────── */
.nav-sidebar {
  width: var(--nav-sidebar-w);
  flex-shrink: 0;
  background: var(--nav-bg);
  border-right: 1px solid var(--nav-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.25s ease, width 0.25s ease;
}

/* Collapsed state */
.nav-sidebar.is-collapsed {
  width: 52px;
}
.nav-sidebar.is-collapsed .nav-item-label,
.nav-sidebar.is-collapsed .nav-sep,
.nav-sidebar.is-collapsed .nav-collapse-label {
  opacity: 0;
  pointer-events: none;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.nav-sidebar.is-collapsed .nav-item {
  justify-content: center;
  padding: 8px 0;
}
.nav-sidebar.is-collapsed .nav-collapse-row {
  justify-content: center;
  padding: 10px 0;
}

/* Hover to temporarily expand when collapsed (desktop) */
.nav-sidebar.is-collapsed:hover {
  width: var(--nav-sidebar-w);
}
.nav-sidebar.is-collapsed:hover .nav-item-label,
.nav-sidebar.is-collapsed:hover .nav-sep,
.nav-sidebar.is-collapsed:hover .nav-collapse-label {
  opacity: 0.7;
  pointer-events: auto;
  width: auto;
}
.nav-sidebar.is-collapsed:hover .nav-item {
  justify-content: flex-start;
  padding: 8px 10px;
}
.nav-sidebar.is-collapsed:hover .nav-collapse-row {
  justify-content: flex-start;
  padding: 10px 12px 6px;
}

/* Collapse toggle row */
.nav-collapse-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 6px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.nav-collapse-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  opacity: 0.7;
  transition: opacity 0.2s, width 0.25s;
  white-space: nowrap;
  overflow: hidden;
}
.nav-collapse-btn {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  padding: 0;
}
.nav-collapse-btn:hover {
  background: var(--secondary);
  color: var(--foreground);
}
.nav-collapse-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.25s ease;
  flex-shrink: 0;
}
.nav-sidebar.is-collapsed .nav-collapse-icon {
  transform: rotate(180deg);
}

.nav-section {
  padding: 14px 10px 6px;
}
.nav-section-label {
  padding: 0 6px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  opacity: 0.7;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted-foreground);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s, padding 0.25s, justify-content 0.25s;
  cursor: pointer;
  margin-bottom: 1px;
}
.nav-item:hover {
  background: var(--secondary);
  color: var(--foreground);
}
.nav-item.active {
  background: rgba(59,130,246,0.14);
  color: var(--primary);
}
.nav-item-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-item-icon .icon { width: 16px; height: 16px; }
.nav-item-label {
  line-height: 1;
  transition: opacity 0.2s, width 0.25s;
  white-space: nowrap;
  overflow: hidden;
}

.nav-sep {
  height: 1px;
  background: var(--border);
  margin: 10px 10px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

/* ─── Page Main ─────────────────────────────────────────────────────────── */
.page-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  background: var(--background);
}

/* ─── Page Loading Overlay ──────────────────────────────────────────────── */
.page-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(8,12,20,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.page-loading-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}
.page-loading-spinner, .detail-loading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: kb-spin 0.7s linear infinite;
}

/* ─── Page Header (generic page title bar) ──────────────────────────────── */
.page-header {
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  flex-shrink: 0;
}
.page-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.page-title {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  color: var(--foreground);
  line-height: 1.2;
}
.page-subtitle {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 13px;
}
.page-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.page-content {
  padding: 28px 32px;
}

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--primary);
  border-radius: 9px;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }

.btn-secondary {
  border-color: var(--border);
  background: transparent;
  color: var(--muted-foreground);
}
.btn-secondary:hover { background: var(--secondary); color: var(--foreground); border-color: var(--border); }

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted-foreground);
}
.btn-ghost:hover { background: var(--secondary); color: var(--foreground); border-color: transparent; }

.btn-danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #dc2626; border-color: #dc2626; }

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 8px;
}

/* ─── Badges ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}
.badge-default { background: rgba(79,109,245,0.16); color: var(--badge-sharepoint-fg); }
.badge-secondary { background: var(--secondary); color: var(--badge-local-fg); }
.badge-upper { text-transform: uppercase; letter-spacing: 0.04em; }
.badge-ext { background: rgba(121,81,219,0.18); color: var(--badge-ext-fg); }
.badge-score {
  background: rgba(246,196,83,0.12);
  color: var(--score-color);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.badge-green { background: rgba(22,163,74,0.16); color: var(--badge-green-fg); }
.badge-yellow { background: rgba(217,119,6,0.16); color: var(--badge-yellow-fg); }
.badge-red { background: rgba(220,38,38,0.16); color: var(--badge-red-fg); }
.badge-blue { background: rgba(59,130,246,0.16); color: #93c5fd; }

/* ─── Status Dot ────────────────────────────────────────────────────────── */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.status-dot.green { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,0.6); }
.status-dot.yellow { background: #f59e0b; box-shadow: 0 0 6px rgba(245,158,11,0.6); }
.status-dot.red { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,0.6); }
.status-dot.grey { background: #64748b; }

/* ─── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.card-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground);
}
.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Metric Cards (dashboard) ──────────────────────────────────────────── */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.metric-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.15s;
}
.metric-card:hover { border-color: rgba(59,130,246,0.4); }
.metric-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.metric-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.metric-card-icon.blue { background: rgba(59,130,246,0.14); color: var(--primary); }
.metric-card-icon.green { background: rgba(34,197,94,0.12); color: #22c55e; }
.metric-card-icon.purple { background: rgba(139,92,246,0.12); color: #a78bfa; }
.metric-card-icon.orange { background: rgba(249,115,22,0.12); color: #fb923c; }
.metric-card-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--foreground);
  line-height: 1;
}
.metric-card-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
}

/* ─── Dashboard Sections ────────────────────────────────────────────────── */
.dash-section { margin-bottom: 28px; }
.dash-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted-foreground);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 14px;
}
.dash-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.dash-activity-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dash-activity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 9px;
  background: var(--card);
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.dash-activity-row:hover { background: var(--card-hover); border-color: rgba(59,130,246,0.35); }
.dash-activity-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--muted-foreground);
}
.dash-activity-title {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-activity-meta {
  font-size: 11px;
  color: var(--muted-foreground);
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ─── Search Page Layout (3-column) ─────────────────────────────────────── */
.search-page {
  display: flex;
  height: 100%;
  overflow: hidden;
}
.page-main.search-active {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.search-filters-panel {
  width: 260px;
  flex-shrink: 0;
  background: var(--nav-bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sfp-section-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin: 0 0 8px;
}
.sfp-pills {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sfp-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
  cursor: pointer;
  background: none;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}
.sfp-pill:hover { background: var(--secondary); color: var(--foreground); }
.sfp-pill.active {
  background: rgba(59,130,246,0.14);
  color: var(--primary);
  border-color: rgba(59,130,246,0.3);
}
.sfp-count {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--secondary);
  color: var(--muted-foreground);
}

.sfp-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.sfp-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted-foreground);
}
.sfp-input {
  height: 32px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--search-bg);
  color: var(--foreground);
  font-size: 12px;
  padding: 0 10px;
  outline: none;
  transition: border-color 0.15s;
}
.sfp-input:focus { border-color: var(--primary); }
.sfp-input[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
.sfp-input::placeholder { color: var(--muted-foreground); }

.sfp-not-supported {
  font-size: 10px;
  color: var(--muted-foreground);
  opacity: 0.7;
  font-style: italic;
  margin-top: 2px;
}

/* Search results + detail split */
.search-body {
  flex: 1;
  min-width: 0;
  display: flex;
  overflow: hidden;
}

.search-results-panel {
  width: 380px;
  min-width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--nav-bg);
  overflow: hidden;
}
.srp-toolbar {
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.srp-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.srp-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
}
.srp-count em { font-style: normal; color: var(--foreground); font-weight: 600; }
.srp-match-type {
  font-size: 11px;
  font-weight: 500;
  color: var(--primary);
  background: rgba(59,130,246,0.12);
  padding: 2px 8px;
  border-radius: 999px;
}

.srp-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

/* ─── Search Detail Panel ───────────────────────────────────────────────── */
.search-detail-panel {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  background: var(--detail-bg);
}

/* ─── Doc Cards ─────────────────────────────────────────────────────────── */
.document-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.doc-card {
  display: flex;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 9px;
  border: 1px solid transparent;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s;
  background: transparent;
  width: 100%;
}
.doc-card:hover { background: var(--card-hover); border-color: var(--border); }
.doc-card.selected { background: var(--card-selected); border-color: var(--card-selected-border); }
.doc-card-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--muted-foreground);
  background: var(--secondary);
}
.doc-card .icon-globe { color: var(--badge-sharepoint); }
.doc-card-body { min-width: 0; flex: 1; }
.doc-card-title {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
}
.doc-card-summary {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--muted-foreground);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.doc-card-footer {
  margin-top: 7px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.doc-card-date {
  font-size: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--score-color);
}
.doc-card-match {
  font-size: 10px;
  color: var(--muted-foreground);
  font-weight: 500;
}

.doc-card-delete {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.8;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
  padding: 0;
  margin-left: 2px;
}
.doc-card-delete:hover {
  background: rgba(239,68,68,0.12);
  color: var(--danger);
  opacity: 1;
}
.doc-card-delete:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── List states ───────────────────────────────────────────────────────── */
.list-empty {
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted-foreground);
  padding: 24px;
  gap: 8px;
}
.list-empty-icon { opacity: 0.4; }
.list-empty-title { font-size: 14px; font-weight: 600; color: var(--foreground); margin: 0; }
.list-empty-sub { font-size: 12px; margin: 0; max-width: 220px; }

.list-error {
  margin: 8px;
  border: 1px solid rgba(239,68,68,0.35);
  border-radius: 9px;
  background: rgba(239,68,68,0.1);
  color: #fecaca;
  padding: 10px 13px;
  font-size: 12px;
}

/* ─── Skeleton Loaders ──────────────────────────────────────────────────── */
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--card) 25%, var(--card-hover) 50%, var(--card) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.6s infinite;
  border-radius: 6px;
}
.skeleton-card {
  padding: 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--card);
  display: flex;
  gap: 10px;
  margin-bottom: 4px;
}
.skeleton-icon { width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0; }
.skeleton-body { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.skeleton-line { height: 10px; }
.skeleton-line-sm { height: 8px; }
.skeleton-line-lg { height: 14px; }

/* ─── Detail Panel ──────────────────────────────────────────────────────── */
.detail-panel {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px;
}
.detail-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 6px;
}
.detail-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.detail-icon:has(.icon-globe) { background: rgba(79,109,245,0.15); }
.detail-icon .icon-globe { color: var(--badge-sharepoint); }
.detail-title-wrap { min-width: 0; flex: 1; }
.detail-title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  color: var(--foreground);
  line-height: 1.2;
  word-break: break-word;
}
.detail-badges {
  margin-top: 10px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}
.detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.sep {
  height: 1px;
  background: var(--border);
  margin: 22px 0;
}
.detail-section { margin: 0; }
.section-title {
  margin: 0 0 10px;
  color: var(--muted-foreground);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.detail-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.detail-summary.markdown-body {
  color: var(--card-foreground);
  font-size: 14px;
  line-height: 1.65;
}
.detail-metadata { padding: 0; overflow: hidden; }
.meta-row {
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 160px minmax(0,1fr);
  gap: 14px;
  border-bottom: 1px solid var(--border);
}
.meta-row:last-child { border-bottom: 0; }
.meta-label {
  margin-top: 2px;
  color: var(--muted-foreground);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.meta-value { color: var(--foreground); font-size: 13px; word-break: break-word; }
.meta-value a { color: var(--primary); }
.meta-value a:hover { text-decoration: underline; }

.keywords-wrap { display: flex; flex-wrap: wrap; gap: 7px; }
.keyword {
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  background: var(--keyword-bg);
  color: var(--keyword-fg);
  cursor: pointer;
  transition: background 0.12s;
}
.keyword:hover { background: rgba(59,130,246,0.2); color: #93c5fd; }

/* Collapsible JSON */
.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  padding: 13px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: background 0.14s;
}
.collapsible-header:hover { background: var(--card-hover); }
.collapsible-header.is-open { border-radius: 12px 12px 0 0; }
.collapsible-body {
  display: none;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 12px 12px;
  overflow: hidden;
}
.collapsible-body.is-open { display: block; }
.collapsible-chevron {
  width: 16px;
  height: 16px;
  color: var(--muted-foreground);
  transition: transform 0.2s;
}
.collapsible-header.is-open .collapsible-chevron { transform: rotate(180deg); }
pre.json-pre {
  margin: 0;
  padding: 14px 16px;
  background: #0f1520;
  color: #94a3b8;
  font-size: 11.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-x: auto;
  line-height: 1.6;
}

/* Detail placeholder & loading */
.detail-placeholder {
  height: 100%;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  gap: 4px;
}
.placeholder-book { width: 52px; height: 52px; color: #6f7b93; margin-bottom: 8px; }
.placeholder-title { margin: 0 0 6px; color: var(--foreground); font-size: 18px; font-weight: 600; }
.placeholder-sub { margin: 0; max-width: 280px; color: var(--muted-foreground); font-size: 13px; }

.detail-loading {
  min-height: 280px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted-foreground);
}
.detail-loading-text { margin: 0; font-size: 13px; }

.detail-error {
  margin: 28px auto;
  max-width: 420px;
  text-align: center;
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 12px;
  padding: 20px;
  background: rgba(239,68,68,0.08);
}
.detail-error p { margin: 0 0 12px; color: #fecaca; }

#detail-container { height: 100%; transition: opacity 0.14s; }
#detail-container.detail-busy { opacity: 0.65; pointer-events: none; }

/* ─── Markdown body ──────────────────────────────────────────────────────── */
.markdown-body :first-child { margin-top: 0; }
.markdown-body :last-child { margin-bottom: 0; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 {
  color: var(--foreground); font-weight: 600; margin: 1.1em 0 0.45em;
}
.markdown-body h1 { font-size: 20px; }
.markdown-body h2 { font-size: 18px; }
.markdown-body h3 { font-size: 16px; }
.markdown-body p { margin: 0.7em 0; }
.markdown-body ul, .markdown-body ol { margin: 0.7em 0; padding-left: 1.4rem; }
.markdown-body li { margin: 0.25em 0; }
.markdown-body strong { color: var(--foreground); }
.markdown-body code {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--muted);
  color: var(--foreground); /* ensure good contrast on light background */
  font-size: 0.88em;
}
.markdown-body blockquote {
  margin: 0.8em 0; padding: 0.35em 0.9em;
  border-left: 3px solid var(--primary); background: rgba(59,130,246,0.08);
}
.markdown-body a { color: var(--primary); }
.markdown-body a:hover { text-decoration: underline; }

/* ─── Documents Table Page ──────────────────────────────────────────────── */
.docs-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.docs-search-wrap {
  position: relative;
  flex: 1;
  min-width: 180px;
  max-width: 360px;
}
.docs-search-wrap .icon-search {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-foreground);
  pointer-events: none;
}
.docs-search-input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--search-bg);
  color: var(--foreground);
  padding: 0 10px 0 34px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.docs-search-input:focus { border-color: var(--primary); }
.docs-search-input::placeholder { color: var(--muted-foreground); }

.data-table-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-foreground);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--foreground);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr { cursor: pointer; transition: background 0.12s; }
.data-table tbody tr:hover td { background: var(--card-hover); }
.data-table .col-title { max-width: 320px; }
.data-table .col-title .title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
  max-width: 100%;
}
.data-table .col-date {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--muted-foreground);
  white-space: nowrap;
}
.data-table .col-actions {
  width: 80px;
  text-align: center;
  white-space: nowrap;
}
.data-table .col-actions .btn {
  padding: 4px 8px;
  font-size: 12px;
}
.data-table-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted-foreground);
  font-size: 13px;
}

/* ─── Connectors Page ───────────────────────────────────────────────────── */
.connector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}
.connector-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.connector-card:hover { border-color: rgba(59,130,246,0.35); }
.connector-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.connector-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.connector-card-icon.local { background: rgba(59,130,246,0.14); color: var(--primary); }
.connector-card-icon.sharepoint { background: rgba(79,109,245,0.18); color: #7c9cff; }
.connector-card-title-wrap { flex: 1; min-width: 0; }
.connector-card-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--foreground);
}
.connector-card-subtitle { font-size: 12px; color: var(--muted-foreground); margin: 0; }
.connector-card-status {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.connector-card-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.connector-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}
.connector-stat-label { color: var(--muted-foreground); }
.connector-stat-value { font-weight: 500; color: var(--foreground); }
.connector-card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ─── Runs Table ────────────────────────────────────────────────────────── */
.runs-empty {
  padding: 60px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--muted-foreground);
}
.runs-empty-icon { opacity: 0.4; }
.runs-empty-title { font-size: 16px; font-weight: 600; color: var(--foreground); margin: 0; }
.runs-empty-sub { margin: 0; font-size: 13px; max-width: 320px; }

/* ─── Analytics ─────────────────────────────────────────────────────────── */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}
.chart-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.chart-card-header { padding: 16px 20px 12px; border-bottom: 1px solid var(--border); }
.chart-card-title { font-size: 14px; font-weight: 600; color: var(--foreground); margin: 0 0 3px; }
.chart-card-sub { font-size: 12px; color: var(--muted-foreground); margin: 0; }
.chart-card-body { padding: 20px; }
.chart-placeholder {
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,0.01);
}
.chart-placeholder-icon { color: var(--muted-foreground); opacity: 0.35; }
.chart-placeholder-text {
  font-size: 12px;
  color: var(--muted-foreground);
  opacity: 0.7;
  text-align: center;
  max-width: 220px;
}
.source-bar-wrap { display: flex; flex-direction: column; gap: 10px; }
.source-bar-item { display: flex; flex-direction: column; gap: 5px; }
.source-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted-foreground);
}
.source-bar-label strong { color: var(--foreground); }
.source-bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--secondary);
  overflow: hidden;
}
.source-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease;
}
.source-bar-fill.local { background: var(--primary); }
.source-bar-fill.sharepoint { background: #4f6df5; }

/* ─── Admin Page ────────────────────────────────────────────────────────── */
.admin-section { margin-bottom: 28px; }
.admin-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted-foreground);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 14px;
}
.admin-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.admin-row:last-child { border-bottom: 0; }
.admin-row-label { font-size: 13px; font-weight: 500; color: var(--foreground); margin: 0 0 3px; }
.admin-row-desc { font-size: 12px; color: var(--muted-foreground); margin: 0; }
.admin-row-value {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--foreground);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 12px;
  min-width: 80px;
  text-align: center;
}
.admin-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.admin-card-rows { display: flex; flex-direction: column; }

/* ─── Error Banners ─────────────────────────────────────────────────────── */
.error-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid rgba(239,68,68,0.35);
  border-radius: 10px;
  background: rgba(239,68,68,0.1);
  color: #fecaca;
  font-size: 13px;
  margin-bottom: 20px;
}
.error-banner-icon { flex-shrink: 0; color: #ef4444; }
.error-banner-text { flex: 1; }
.error-banner .btn { flex-shrink: 0; }

.info-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid rgba(59,130,246,0.3);
  border-radius: 10px;
  background: rgba(59,130,246,0.08);
  color: #bfdbfe;
  font-size: 13px;
  margin-bottom: 20px;
}

/* ─── User Info Modal ───────────────────────────────────────────────────── */
.user-info-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(8,12,20,0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.user-info-modal {
  width: min(560px, 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  color: var(--foreground);
  position: relative;
  padding: 20px;
  box-shadow: var(--shadow-md);
}
.user-info-close {
  position: absolute;
  right: 12px;
  top: 12px;
  border: 0;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.12s, color 0.12s;
}
.user-info-close:hover { background: var(--secondary); color: var(--foreground); }
.user-info-header { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.user-info-avatar {
  width: 52px; height: 52px; border-radius: 50%; object-fit: cover; background: #3a455d;
}
.user-info-header-text h3 { margin: 0; font-size: 17px; font-weight: 600; }
.user-info-header-text p { margin: 4px 0 0; color: var(--muted-foreground); font-size: 13px; }
.user-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
  font-size: 13px;
}
.user-info-status {
  grid-column: 1 / -1;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
}
.user-info-status.is-info { background: rgba(59,130,246,0.12); color: #bfdbfe; }
.user-info-status.is-error { background: rgba(239,68,68,0.14); color: #fecaca; }
.user-info-grid strong { color: var(--muted-foreground); }

/* ─── Document Detail Modal (Documents page) ─────────────────────────────── */
.doc-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10002;
  background: rgba(8,12,20,0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.doc-modal {
  width: min(960px, 100%);
  max-height: min(80vh, 720px);
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  color: var(--foreground);
  position: relative;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
}
.doc-modal-body {
  padding: 20px;
  overflow-y: auto;
}
.doc-modal-close {
  position: absolute;
  right: 12px;
  top: 12px;
  border: 0;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.12s, color 0.12s;
}
.doc-modal-close:hover { background: var(--secondary); color: var(--foreground); }

/* ─── Confirmation Modal ─────────────────────────────────────────────────── */
.confirm-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10003;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.confirm-modal-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}
.confirm-modal {
  width: min(400px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  position: relative;
}
.confirm-modal-header {
  padding: 20px 20px 8px 20px;
  border-bottom: 1px solid var(--border);
}
.confirm-modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--foreground);
}
.confirm-modal-body {
  padding: 16px 20px;
}
.confirm-modal-message {
  margin: 0;
  font-size: 14px;
  color: var(--muted-foreground);
  line-height: 1.5;
}
.confirm-modal-footer {
  padding: 16px 20px 20px 20px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.confirm-modal-footer .btn {
  min-width: 80px;
}

/* ─── Scrollbars ────────────────────────────────────────────────────────── */
.kb-scrollbar::-webkit-scrollbar { width: 5px; height: 5px; }
.kb-scrollbar::-webkit-scrollbar-track { background: transparent; }
.kb-scrollbar::-webkit-scrollbar-thumb { background: #3a455d; border-radius: 4px; }
.kb-scrollbar::-webkit-scrollbar-thumb:hover { background: #4a5772; }

/* Apply scrollbar style to all scroll containers */
.nav-sidebar, .search-filters-panel, .srp-list, .search-detail-panel,
.page-main, .search-results-panel {
  scrollbar-width: thin;
  scrollbar-color: #3a455d transparent;
}
.nav-sidebar::-webkit-scrollbar,
.search-filters-panel::-webkit-scrollbar,
.srp-list::-webkit-scrollbar,
.search-detail-panel::-webkit-scrollbar,
.page-main::-webkit-scrollbar {
  width: 4px;
}
.nav-sidebar::-webkit-scrollbar-track,
.search-filters-panel::-webkit-scrollbar-track,
.srp-list::-webkit-scrollbar-track,
.search-detail-panel::-webkit-scrollbar-track,
.page-main::-webkit-scrollbar-track { background: transparent; }
.nav-sidebar::-webkit-scrollbar-thumb,
.search-filters-panel::-webkit-scrollbar-thumb,
.srp-list::-webkit-scrollbar-thumb,
.search-detail-panel::-webkit-scrollbar-thumb,
.page-main::-webkit-scrollbar-thumb { background: #3a455d; border-radius: 4px; }

/* ─── Animations ────────────────────────────────────────────────────────── */
@keyframes kb-spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.animate-in { animation: fade-in 0.25s ease; }

/* ─── Copy-toast ────────────────────────────────────────────────────────── */
.copy-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #1e293b;
  border: 1px solid var(--border);
  color: var(--foreground);
  font-size: 13px;
  padding: 8px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
  z-index: 20000;
  white-space: nowrap;
}
.copy-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .tn-ctrl-group { display: none; }
}

@media (max-width: 900px) {
  :root { --nav-sidebar-w: 200px; }
  .tn-filters { display: none; }
  .search-results-panel { width: 300px; }
}

@media (max-width: 767px) {
  :root { --nav-sidebar-w: 228px; }
  .tn-nav-toggle { display: flex; }
  .tn-mode { display: none; }
  .tn-divider { display: none; }

  .app-body { position: relative; }
  .nav-sidebar {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 150;
    transform: translateX(-100%);
    box-shadow: var(--shadow-md);
  }
  .nav-sidebar.is-open { transform: translateX(0); }

  .search-page { flex-direction: column; }
  .search-filters-panel {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 180px;
    padding: 10px 12px;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    overflow: auto;
  }
  .search-body { flex-direction: column; }
  .search-results-panel { width: 100%; border-right: none; border-bottom: 1px solid var(--border); max-height: 50vh; }
  .search-detail-panel { min-height: 300px; }

  .metric-grid { grid-template-columns: 1fr 1fr; }
  .connector-grid { grid-template-columns: 1fr; }
  .analytics-grid { grid-template-columns: 1fr; }

  .page-content { padding: 16px; }
  .page-header { padding: 18px 16px 14px; }
  .detail-panel { padding: 18px; }
  .detail-title { font-size: 22px; }
  .meta-row { grid-template-columns: 1fr; gap: 4px; }
}
