/* MindForge Brain - Ultra Modern Dark Cyber Aesthetic */
:root {
  --bg-main: #090d16;
  --bg-sidebar: #0f1422;
  --bg-card: #151c2e;
  --bg-card-hover: #1c253d;
  --bg-input: #0c101c;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-active: rgba(56, 189, 248, 0.4);
  
  --text-main: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --primary: #38bdf8;
  --primary-glow: rgba(56, 189, 248, 0.25);
  --accent-purple: #c084fc;
  --accent-green: #34d399;
  --accent-amber: #fbbf24;
  --accent-rose: #f43f5e;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'Fira Code', monospace;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(56, 189, 248, 0.2);
  
  /* Resizable Panel Dimensions */
  --nav-width: 250px;
  --docs-width: 320px;
  --ai-width: 380px;
}

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

/* ==========================================================================
   Ultra-Clean, Thin & Elegant Dark Scrollbars
   ========================================================================== */

/* Universal Firefox thin scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

/* Universal WebKit (Chrome, Edge, Opera, Safari) */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.5);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.35);
}

::-webkit-scrollbar-thumb:active {
  background: rgba(56, 189, 248, 0.8);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

/* Hide bulky Windows native arrow buttons */
::-webkit-scrollbar-button {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Whisper-thin refined scrollbars for panel lists & editors */
.panel-nav-scroll::-webkit-scrollbar,
.docs-cards-scroll::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar,
.doc-reader-body::-webkit-scrollbar,
.doc-editor-pane::-webkit-scrollbar,
.search-dropdown::-webkit-scrollbar,
.upload-preview::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
textarea::-webkit-scrollbar,
pre::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

.panel-nav-scroll::-webkit-scrollbar-thumb,
.docs-cards-scroll::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb,
.doc-reader-body::-webkit-scrollbar-thumb,
.doc-editor-pane::-webkit-scrollbar-thumb,
.search-dropdown::-webkit-scrollbar-thumb,
.upload-preview::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb,
textarea::-webkit-scrollbar-thumb,
pre::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}

.panel-nav-scroll:hover::-webkit-scrollbar-thumb,
.docs-cards-scroll:hover::-webkit-scrollbar-thumb,
.chat-messages:hover::-webkit-scrollbar-thumb,
.doc-reader-body:hover::-webkit-scrollbar-thumb,
.doc-editor-pane:hover::-webkit-scrollbar-thumb,
.search-dropdown:hover::-webkit-scrollbar-thumb,
.upload-preview:hover::-webkit-scrollbar-thumb,
.modal-body:hover::-webkit-scrollbar-thumb,
textarea:hover::-webkit-scrollbar-thumb,
pre:hover::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

.panel-nav-scroll::-webkit-scrollbar-thumb:hover,
.docs-cards-scroll::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover,
.doc-reader-body::-webkit-scrollbar-thumb:hover,
.doc-editor-pane::-webkit-scrollbar-thumb:hover,
.search-dropdown::-webkit-scrollbar-thumb:hover,
.upload-preview::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover,
textarea::-webkit-scrollbar-thumb:hover,
pre::-webkit-scrollbar-thumb:hover {
  background: #38bdf8 !important;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.6) !important;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* Header */
.app-header {
  height: 54px;
  background-color: rgba(15, 20, 34, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  z-index: 100;
  flex-shrink: 0;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #0284c7, #9333ea);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  position: relative;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.35);
}

.brand-icon i {
  width: 22px;
  height: 22px;
}

.pulse-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-md);
  border: 2px solid var(--primary);
  opacity: 0.6;
  animation: pulse-ring-anim 2.5s infinite;
}

@keyframes pulse-ring-anim {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.3); opacity: 0; }
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, #fff, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

.workspace-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 150px;
}

.workspace-switcher select {
  max-width: 190px;
  padding: 7px 28px 7px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-main);
}

.workspace-switcher .btn {
  padding: 7px;
}

.inline-form-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-form-row input { flex: 1; min-width: 120px; }
.inline-form-row select { min-width: 90px; }

.workspace-member-list {
  display: grid;
  gap: 6px;
  margin: 8px 0 18px;
}

.workspace-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

.workspace-member-row small { color: var(--text-secondary); }
.workspace-member-actions { display: flex; align-items: center; gap: 0.5rem; }
.workspace-member-actions select { min-width: 7rem; }

.api-token-panel { margin: 12px 0; }
.api-token-scope-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 12px; margin: 10px 0 14px; }
.api-token-scope-grid label { display: flex; align-items: center; gap: 7px; font-size: 0.76rem; color: var(--text-secondary); }
.api-token-scope-grid input { accent-color: var(--primary); }
.api-token-create-row { flex-wrap: wrap; margin-bottom: 12px; }
.api-token-create-row select { min-width: 110px; }
.api-token-list { display: grid; gap: 7px; margin-top: 10px; }
.api-token-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--bg-card); }
.api-token-row > div { display: grid; gap: 3px; min-width: 0; overflow-wrap: anywhere; }
.api-token-row small { color: var(--text-secondary); font-size: 0.68rem; }
.api-token-row .api-token-revoked { color: #fca5a5; }

@media (max-width: 560px) {
  .api-token-scope-grid { grid-template-columns: 1fr; }
}

.processing-job-list { display: grid; gap: 8px; }
.processing-job-row { padding: 9px 10px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--bg-card); }
.processing-job-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.processing-job-row progress { width: 100%; height: 7px; margin-top: 7px; accent-color: var(--primary); }
.processing-job-error { display: block; margin-top: 6px; color: #fca5a5; overflow-wrap: anywhere; }

@media (max-width: 1050px) {
  .workspace-switcher { min-width: 0; }
  .workspace-switcher select { max-width: 145px; }
}

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

.stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.stat-pill i {
  width: 14px;
  height: 14px;
  color: var(--primary);
}

.ai-pill {
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.08);
  color: #a7f3d0;
}

.ai-pill.inactive {
  border-color: rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.08);
  color: #fde68a;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.status-dot.inactive {
  background-color: #fbbf24;
  box-shadow: 0 0 8px #fbbf24;
}

.header-center {
  flex: 1;
  max-width: 480px;
  position: relative;
  margin: 0 20px;
}

.quick-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 14px;
  transition: all 0.2s ease;
}

.quick-search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}

.quick-search-box i {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.quick-search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 0.85rem;
  width: 100%;
}

.quick-search-box kbd {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.search-dropdown {
  position: absolute;
  top: 45px;
  left: 0;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  max-height: 380px;
  overflow-y: auto;
  z-index: 200;
  padding: 8px;
}

.search-result-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.15s ease;
}

.search-result-item:hover {
  background: var(--bg-card-hover);
}

.search-result-item h5 {
  font-size: 0.88rem;
  color: var(--primary);
  margin-bottom: 4px;
}

.search-result-section {
  display: block;
  margin: 0 0 4px;
  color: var(--text-muted);
  font-size: 0.7rem;
}

.search-result-item p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.2s ease;
}

.btn i {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #fff;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(2, 132, 199, 0.45);
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.btn-icon:hover {
  color: var(--text-main);
  background: var(--bg-card-hover);
}

.btn-danger-icon {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: var(--accent-rose);
  padding: 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.btn-danger-icon:hover {
  background: rgba(244, 63, 94, 0.25);
}

/* ==========================================================================
   Desktop Application Menubar (VS Code / Obsidian Style)
   ========================================================================== */
.app-menubar {
  height: 32px;
  background: #070a12;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 8px;
  font-size: 0.76rem;
  z-index: 250;
  user-select: none;
  flex-shrink: 0;
}

.menubar-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.menubar-brand-icon {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: linear-gradient(135deg, #0284c7, #9333ea);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin-right: 6px;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.3);
}

.menubar-brand-icon i {
  width: 13px;
  height: 13px;
}

.menubar-nav-list {
  display: flex;
  list-style: none;
  gap: 2px;
}

.menubar-item {
  position: relative;
}

.menubar-item-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.77rem;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.menubar-item-btn:hover,
.menubar-item.open .menubar-item-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

/* Menubar Dropdown Menus */
.menubar-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 240px;
  background: #0f1626;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65), 0 0 20px rgba(56, 189, 248, 0.1);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 300;
  backdrop-filter: blur(16px);
  animation: fadeInMenu 0.15s ease;
}

@keyframes fadeInMenu {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.menubar-item.open .menubar-dropdown {
  display: flex;
}

.menu-action {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 4px;
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 0.76rem;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.12s ease;
}

.menu-action:hover {
  background: rgba(56, 189, 248, 0.14);
  color: #38bdf8;
}

.menu-action i {
  width: 14px;
  height: 14px;
  color: #64748b;
  flex-shrink: 0;
}

.menu-action:hover i {
  color: #38bdf8;
}

.menu-action span {
  flex: 1;
}

.menu-action kbd {
  font-size: 0.68rem;
  color: #64748b;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: auto;
  font-family: inherit;
}

.menu-check-action {
  position: relative;
  padding-left: 28px;
}

.menu-check-action .check-icon {
  position: absolute;
  left: 8px;
  width: 12px;
  height: 12px;
  opacity: 0;
  color: #38bdf8;
}

.menu-check-action.checked .check-icon {
  opacity: 1;
}

.menu-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.07);
  margin: 4px 0;
}

.menu-section-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: #64748b;
  padding: 4px 10px 2px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Center App Title */
.menubar-center {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
}

.menubar-app-title {
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.2px;
}

/* Menubar Right Actions */
.menubar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menubar-layout-toggles {
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 4px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.menubar-layout-btn {
  background: transparent;
  border: none;
  color: #64748b;
  width: 25px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.menubar-layout-btn:hover {
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.08);
}

.menubar-layout-btn.active {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.16);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.2);
}

.menubar-layout-btn i {
  width: 14px;
  height: 14px;
}

.menubar-window-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 4px;
}

.window-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  opacity: 0.6;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.window-dot:hover {
  opacity: 1;
}

.dot-min { background: #fbbf24; }
.dot-max { background: #34d399; }
.dot-close { background: #f43f5e; }

/* App Workspace Flex Row (Fully Resizable) */
.app-workspace {
  display: flex;
  flex-direction: row;
  flex: 1;
  min-height: 0;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* Resizer Bars */
.resizer-col {
  width: 5px;
  background: rgba(255, 255, 255, 0.03);
  cursor: col-resize;
  flex-shrink: 0;
  position: relative;
  z-index: 40;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.resizer-col::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -4px;
  right: -4px;
}

.resizer-col .resizer-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 3px;
  height: 36px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.18);
  transition: all 0.15s ease;
}

.resizer-col:hover, .resizer-col.dragging {
  background: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.6);
}

.resizer-col:hover .resizer-handle, .resizer-col.dragging .resizer-handle {
  background: #ffffff;
  height: 48px;
  box-shadow: 0 0 8px #ffffff;
}

/* Collapsed Panel Rules */
.panel-nav.collapsed { display: none !important; }
.panel-docs.collapsed { display: none !important; }
.sidebar-right.collapsed { display: none !important; }
.resizer-col.hidden-resizer { display: none !important; }

/* ==========================================================================
   Edge Dock Strips & Horizontal Mini Cards (For Collapsed Panels)
   ========================================================================== */
.edge-dock {
  position: absolute;
  top: 50%;
  z-index: 95;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  transform: translateY(-50%);
}

.edge-dock.dock-left {
  left: 0;
  align-items: flex-start;
}

.edge-dock.dock-right {
  right: 0;
  align-items: flex-end;
}

.edge-dock-card {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: rgba(11, 17, 32, 0.94);
  backdrop-filter: blur(16px);
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.55), 0 0 12px rgba(56, 189, 248, 0.12);
  border: none;
}

.edge-dock-card i {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.edge-dock-card .dock-arrow {
  width: 13px;
  height: 13px;
  color: #64748b;
  transition: transform 0.2s ease, color 0.2s ease;
}

/* Collapsed panels become tall edge tabs with vertical labels. */
.edge-dock > .edge-dock-card {
  width: 42px;
  height: 180px;
  min-height: 180px;
  padding: 10px 5px;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  white-space: normal;
}

.edge-dock > .edge-dock-card span {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  line-height: 1;
  letter-spacing: .02em;
}

.edge-dock.dock-left > .edge-dock-card:hover {
  transform: translateX(3px);
}

.edge-dock.dock-right > .edge-dock-card:hover {
  transform: translateX(-3px);
}

/* Left Edge Mini Card */
.dock-card-left {
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-left: 3px solid #38bdf8;
  border-radius: 0 8px 8px 0;
  color: #e2e8f0;
}

.dock-card-left i:not(.dock-arrow) {
  color: #38bdf8;
}

.dock-card-left:hover {
  transform: translateX(4px);
  background: rgba(15, 23, 42, 0.98);
  border-color: rgba(56, 189, 248, 0.6);
  border-left-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.7), 0 0 20px rgba(56, 189, 248, 0.3);
}

.dock-card-left:hover .dock-arrow {
  color: #38bdf8;
  transform: translateX(2px);
}

/* Right Edge Mini Card */
.dock-card-right {
  border: 1px solid rgba(52, 211, 153, 0.28);
  border-right: 3px solid #34d399;
  border-radius: 8px 0 0 8px;
  color: #e2e8f0;
}

.dock-card-right i:not(.dock-arrow) {
  color: #34d399;
}

.dock-card-right:hover {
  transform: translateX(-4px);
  background: rgba(15, 23, 42, 0.98);
  border-color: rgba(52, 211, 153, 0.6);
  border-right-color: #34d399;
  color: #ffffff;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.7), 0 0 20px rgba(52, 211, 153, 0.3);
}

.dock-card-right:hover .dock-arrow {
  color: #34d399;
  transform: translateX(-2px);
}

/* Header Inline Mini Card (when nav is closed but docs is open) */
.inline-header-card {
  border-radius: 6px !important;
  border: 1px solid rgba(56, 189, 248, 0.3) !important;
  border-left: 2px solid #38bdf8 !important;
  padding: 3px 8px !important;
  font-size: 0.72rem !important;
  margin-right: 6px;
  flex-shrink: 0;
}

/* Active Resizing Dragging Helper */
body.resizing-active {
  user-select: none !important;
  -webkit-user-select: none !important;
  cursor: col-resize !important;
}

body.resizing-active * {
  user-select: none !important;
  -webkit-user-select: none !important;
  cursor: col-resize !important;
}

body.resizing-active canvas,
body.resizing-active iframe,
body.resizing-active textarea,
body.resizing-active input {
  pointer-events: none !important;
}

body.resizing-active .panel-nav,
body.resizing-active .panel-docs,
body.resizing-active .sidebar-right,
body.resizing-active .center-content {
  transition: none !important;
}

/* Sub-panel 1: Dokumentumközpont (Navigation & Folders & Tags) */
.panel-nav {
  width: var(--nav-width, 250px);
  min-width: 210px;
  max-width: 480px;
  background: #080c16;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.panel-nav-header {
  height: 52px;
  padding: 0 10px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.hub-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.hub-logo {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(2, 132, 199, 0.3);
  flex-shrink: 0;
}

.hub-logo i {
  width: 15px;
  height: 15px;
}

.hub-title {
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.counter-pill {
  font-size: 0.68rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  padding: 1px 7px;
  border-radius: 12px;
}

.icon-btn-ghost {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.icon-btn-ghost:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.icon-btn-ghost i {
  width: 15px;
  height: 15px;
}

.panel-search-box {
  margin: 10px 10px;
  padding: 6px 10px;
  background: #0b1120;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
  overflow: hidden;
  transition: all 0.15s ease;
}

.panel-search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

.panel-search-box i {
  width: 14px;
  height: 14px;
  color: #64748b;
  flex-shrink: 0;
}

.panel-search-box input {
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.78rem;
  color: #fff;
  flex: 1;
  min-width: 0;
  width: auto;
}

.panel-search-box kbd {
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.65rem;
  color: #64748b;
  flex-shrink: 0;
  white-space: nowrap;
}

.panel-subtabs {
  display: flex;
  padding: 0 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  gap: 14px;
}

.subtab-btn {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 500;
  padding: 8px 0;
  cursor: pointer;
  position: relative;
  transition: color 0.15s ease;
}

.subtab-btn:hover {
  color: #cbd5e1;
}

.subtab-btn.active {
  color: #38bdf8;
  font-weight: 600;
}

.subtab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: #38bdf8;
  border-radius: 2px 2px 0 0;
}

.panel-nav-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 8px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.smart-filters-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.smart-filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: #8b9cb5;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.15s ease;
}

.smart-filter-item i {
  width: 16px;
  height: 16px;
  color: #64748b;
}

.smart-filter-item .filter-label {
  flex: 1;
  font-size: 0.8rem;
  font-weight: 500;
}

.smart-filter-item .filter-count {
  font-size: 0.72rem;
  color: #64748b;
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 6px;
  border-radius: 10px;
}

.smart-filter-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #f1f5f9;
}

.smart-filter-item.active {
  background: rgba(2, 132, 199, 0.16);
  border-color: rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.1);
}

.smart-filter-item.active i {
  color: #38bdf8;
}

.smart-filter-item.active .filter-count {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.18);
}

.section-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

.section-title {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.section-action-btn {
  background: transparent;
  border: none;
  color: #64748b;
  padding: 2px;
  cursor: pointer;
  border-radius: 3px;
}

.section-action-btn:hover {
  color: #fff;
}

.section-action-btn i {
  width: 14px;
  height: 14px;
}

.section-link-btn {
  background: transparent;
  border: none;
  color: #38bdf8;
  font-size: 0.72rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 2px;
}

.section-link-btn i {
  width: 12px;
  height: 12px;
}

/* Folders Tree */
.folders-tree {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.folder-item {
  display: flex;
  flex-direction: column;
}

.folder-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  color: #94a3b8;
  transition: all 0.15s ease;
}

.folder-row:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #f1f5f9;
}

.folder-row.active {
  background: rgba(2, 132, 199, 0.12);
  color: #38bdf8;
}
.folder-row.drop-target { outline: 2px solid #38bdf8; outline-offset: -2px; background: rgba(56,189,248,.18); }
.folder-root-drop { margin-bottom: 5px; border: 1px dashed rgba(148,163,184,.3); border-radius: 7px; }
.doc-item-card[draggable="true"] { cursor: grab; }
.doc-item-card.is-dragging { opacity: .45; cursor: grabbing; }

.folder-chevron-left {
  width: 12px;
  height: 12px;
  color: #475569;
}

.folder-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.folder-name {
  flex: 1;
  font-size: 0.79rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-count {
  font-size: 0.7rem;
  color: #64748b;
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 6px;
  border-radius: 8px;
}

.folder-arrow-right {
  width: 12px;
  height: 12px;
  color: #475569;
}

.folder-subitems {
  padding-left: 24px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 2px;
}
.folder-expand {
  width: 14px;
  height: 18px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  background: transparent;
  border: 0;
  cursor: pointer;
  flex-shrink: 0;
}
.folder-expand svg { width: 12px; height: 12px; transition: transform .15s ease; }
.folder-expand.empty { opacity: .25; cursor: default; }
.folder-subitems { padding-left: 16px; border-left: 1px solid rgba(148,163,184,.16); margin-left: 14px; }
.folder-document-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #94a3b8;
  text-align: left;
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}
.folder-document-row:hover { background: rgba(56,189,248,.1); color: #e2e8f0; }
.folder-document-row svg { width: 13px; height: 13px; flex: 0 0 auto; color: #38bdf8; }
.folder-document-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-add-menu {
  position: fixed;
  z-index: 3000;
  width: 228px;
  padding: 6px;
  border: 1px solid #334155;
  border-radius: 10px;
  background: #151d2d;
  box-shadow: 0 14px 36px rgba(0,0,0,.45);
}
.folder-add-menu-title { padding: 7px 9px; color: #94a3b8; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-add-menu button { width: 100%; display: flex; align-items: center; gap: 9px; padding: 9px; border: 0; border-radius: 6px; background: transparent; color: #e2e8f0; text-align: left; cursor: pointer; }
.folder-add-menu button:hover { background: rgba(56,189,248,.12); }
.folder-add-menu svg { width: 15px; height: 15px; color: #38bdf8; }


.subitem-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 5px;
  font-size: 0.76rem;
  color: #8b9cb5;
  cursor: pointer;
  transition: all 0.15s ease;
}

.subitem-row:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}

.subitem-row i {
  width: 13px;
  height: 13px;
  color: #64748b;
}

.subitem-name {
  flex: 1;
}

.subitem-count {
  font-size: 0.68rem;
  color: #64748b;
}

/* Tags Cloud Pills */
.tags-cloud-pill {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 2px 0;
}

.tag-badge-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 0.7rem;
  color: #8b9cb5;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tag-badge-chip:hover {
  border-color: #38bdf8;
  color: #fff;
  background: rgba(56, 189, 248, 0.08);
}

.tag-badge-chip.active {
  border-color: #38bdf8;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
}

.tag-chip-count {
  color: #64748b;
  font-size: 0.65rem;
}

/* Sub-panel 2: Dokumentumok List & Inspector */
.panel-docs {
  width: var(--docs-width, 320px);
  min-width: 250px;
  max-width: 580px;
  flex-shrink: 0;
  background: #0b1120;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.panel-docs-header {
  height: 52px;
  padding: 0 10px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.docs-heading {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.docs-heading h3 {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.docs-count-paren {
  color: #64748b;
  font-weight: 500;
  font-size: 0.82rem;
}

.view-mode-toggles {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.view-toggle-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 4px;
  background: transparent;
  border: 1px solid transparent;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.view-toggle-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.view-toggle-btn.active {
  background: rgba(56, 189, 248, 0.12);
  border-color: #38bdf8;
  color: #38bdf8;
}

.view-toggle-btn i {
  width: 14px;
  height: 14px;
}

#btn-collapse-docs,
#btn-collapse-nav,
#btn-collapse-ai {
  width: 26px;
  height: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 4px;
  color: #64748b;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

#btn-collapse-docs:hover,
#btn-collapse-nav:hover,
#btn-collapse-ai:hover {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
}

.view-toggle-btn:hover {
  color: #fff;
}

.view-toggle-btn.active {
  background: rgba(56, 189, 248, 0.12);
  border-color: #38bdf8;
  color: #38bdf8;
}

.view-toggle-btn i {
  width: 15px;
  height: 15px;
}

.panel-docs-subbar {
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(0, 0, 0, 0.2);
}

.sort-selector {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sort-selector i {
  width: 14px;
  height: 14px;
  color: #64748b;
}

.sort-select {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.74rem;
  outline: none;
  cursor: pointer;
}

.sort-select option {
  background: #0f172a;
  color: #fff;
}

.docs-cards-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 8px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Document Item Card */
.doc-item-card {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
  background: #0f182c;
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.doc-item-card:hover {
  background: #141f38;
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateX(2px);
}

.doc-item-card.active {
  background: rgba(2, 132, 199, 0.12);
  border-color: #0284c7;
  box-shadow: 0 0 15px rgba(2, 132, 199, 0.25);
}

/* Document Type Badge (Red P:, Blue W:, Green E:) */
.doc-type-badge {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  font-family: var(--font-display);
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.badge-p {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
}

.badge-w {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
}

.badge-e {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
}

.card-main {
  flex: 1;
  min-width: 0;
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.card-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.card-indicators {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot-status {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.card-more-btn {
  background: transparent;
  border: none;
  color: #475569;
  cursor: pointer;
  padding: 0 2px;
}

.card-more-btn:hover {
  color: #fff;
}

.card-subline {
  font-size: 0.7rem;
  color: #64748b;
  margin: 3px 0 6px 0;
}

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.card-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.card-tag-pill {
  font-size: 0.65rem;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 5px;
  border-radius: 3px;
}

.card-links-num {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 0.68rem;
  color: #94a3b8;
}

.card-links-num i {
  width: 11px;
  height: 11px;
  color: #64748b;
}

/* Selected Document Inspector (Bottom Preview Card) */
.selected-doc-inspector {
  border-top: 1px solid rgba(56, 189, 248, 0.3);
  background: linear-gradient(180deg, #0d1629 0%, #070b14 100%);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 -6px 25px rgba(0, 0, 0, 0.6);
  z-index: 10;
}

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

.inspector-title-block {
  flex: 1;
  min-width: 0;
}

.inspector-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inspector-meta {
  font-size: 0.7rem;
  color: #64748b;
  margin-top: 2px;
}

.inspector-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.star-btn {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 3px;
  border-radius: 4px;
}

.star-btn:hover {
  color: #fbbf24;
}

.star-btn.starred {
  color: #fbbf24;
}

.star-btn i {
  width: 16px;
  height: 16px;
}

.inspector-desc {
  font-size: 0.76rem;
  line-height: 1.45;
  color: #cbd5e1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.inspector-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.inspector-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  gap: 10px;
}

.btn-open-doc {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
  transition: all 0.15s ease;
}

.btn-open-doc:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.45);
}

.btn-open-doc i {
  width: 14px;
  height: 14px;
}

.btn-connections-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: #38bdf8;
  font-size: 0.72rem;
  cursor: pointer;
  padding: 4px;
  transition: color 0.15s ease;
}

.btn-connections-link:hover {
  color: #7dd3fc;
  text-decoration: underline;
}

.btn-connections-link i {
  width: 13px;
  height: 13px;
}


.doc-tag-pill {
  font-size: 0.65rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  padding: 1px 5px;
  border-radius: 4px;
}

/* Center Content */
.center-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-main);
  position: relative;
  overflow: hidden;
}

.content-tabs {
  height: 48px;
  display: flex;
  align-items: center;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  padding: 0 16px;
  gap: 8px;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn i {
  width: 16px;
  height: 16px;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
  background: var(--bg-card);
  color: var(--primary);
  font-weight: 600;
  border: 1px solid var(--border-color);
}

#tab-btn-graph {
  flex: 0 0 auto;
  position: relative;
  z-index: 1;
}

.document-tabs {
  display: flex;
  align-items: stretch;
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
}

.document-tab {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  min-width: 130px;
  max-width: 240px;
  height: 100%;
  border-right: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.document-tab.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: inset 0 2px var(--primary);
}

.document-tab-open,
.document-tab-close {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.document-tab-open {
  justify-content: flex-start;
  gap: 8px;
  flex: 1;
  min-width: 0;
  padding: 0 8px 0 12px;
  font-size: 0.78rem;
  text-align: left;
}

.document-tab-open > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-tab-open i {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.document-tab.dirty .document-tab-open > span::after {
  content: ' •';
  color: var(--accent-amber);
}

.document-tab-close {
  width: 26px;
  flex: 0 0 auto;
  border-radius: 4px;
}

.document-tab-close i {
  width: 13px;
  height: 13px;
}

.document-tab-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

.document-tab-open:hover {
  color: var(--text-main);
}

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

.doc-tab-menu-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.doc-tab-menu-trigger:hover,
.doc-tab-menu-trigger[aria-expanded="true"] {
  border-color: var(--border-active);
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.doc-tab-menu-trigger i {
  width: 16px;
  height: 16px;
}

.doc-tab-context-menu {
  position: fixed;
  z-index: 2000;
  min-width: 160px;
  padding: 4px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #151c2e;
  box-shadow: var(--shadow-md);
}

.doc-tab-context-menu button {
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-main);
  font: inherit;
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
}

.doc-tab-context-menu button:hover,
.doc-tab-context-menu button:focus-visible {
  outline: none;
  background: rgba(56, 189, 248, 0.14);
}

.graph-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.tab-pane {
  display: none;
  flex: 1;
  height: calc(100% - 48px);
  position: relative;
  overflow: hidden;
}

.tab-pane.active {
  display: flex;
  flex-direction: column;
}

/* Graph & Office Canvas Pane */
#pane-graph {
  background: radial-gradient(circle at center, #101524 0%, #080b12 100%);
  position: relative;
}

#office-canvas, #knowledge-graph-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

#office-canvas {
  cursor: grab;
  touch-action: none;
}

.office-document-label-layer {
  position: absolute;
  inset: 0;
  z-index: 10;
  overflow: hidden;
  pointer-events: none;
}

.office-document-label-hitbox {
  position: absolute;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  box-sizing: border-box;
  transform: translate(-50%, -50%);
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  cursor: pointer;
  pointer-events: auto;
}

.office-document-label-hitbox:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

.office-document-label-hitbox[hidden] {
  display: none !important;
}

#office-canvas.hidden, #knowledge-graph-canvas.hidden {
  display: none !important;
}

.graph-toolbar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 20, 34, 0.9);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  padding: 5px 12px;
  border-radius: var(--radius-md);
  z-index: 20;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  max-width: 95%;
  flex-wrap: wrap;
}

.toolbar-mode-switch {
  display: flex;
  background: rgba(0, 0, 0, 0.45);
  padding: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
  gap: 2px;
}

.mode-pill-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 4px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.mode-pill-btn i {
  width: 14px;
  height: 14px;
}

.mode-pill-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.mode-pill-btn.active {
  background: var(--primary);
  color: #090d16;
  box-shadow: 0 0 10px var(--primary-glow);
}

.toolbar-divider {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 2px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.room-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
}

.room-selector-wrapper i {
  width: 14px;
  height: 14px;
  color: var(--primary);
}

.room-selector-wrapper select {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 0.76rem;
  outline: none;
  cursor: pointer;
}

.room-selector-wrapper select option {
  background: #0f172a;
  color: #fff;
}

.asset-studio-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  padding: 4px 10px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(168, 85, 247, 0.18));
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #fff;
  border-radius: var(--radius-sm);
}

.asset-studio-btn:hover {
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}

.badge-mini {
  background: #10b981;
  color: #090d16;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
}

.graph-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.graph-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.1);
}

.graph-btn i {
  width: 16px;
  height: 16px;
}

.graph-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-left: 12px;
  border-left: 1px solid var(--border-color);
  padding-left: 12px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot.hr { background: #c084fc; box-shadow: 0 0 6px #c084fc; }
.legend-dot.sec { background: #34d399; box-shadow: 0 0 6px #34d399; }
.legend-dot.it { background: #38bdf8; box-shadow: 0 0 6px #38bdf8; }
.legend-dot.proj { background: #fbbf24; box-shadow: 0 0 6px #fbbf24; }

.graph-tooltip {
  position: absolute;
  background: rgba(15, 20, 34, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-active);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-glow);
  pointer-events: none;
  z-index: 50;
  max-width: 260px;
}

.graph-tooltip h4 {
  font-size: 0.9rem;
  color: var(--primary);
  margin-bottom: 4px;
}

.graph-tooltip p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.graph-tooltip .tooltip-stats {
  font-size: 0.7rem;
  color: var(--accent-purple);
}

.graph-tooltip.office-doc-tooltip {
  width: min(340px, calc(100vw - 32px));
  max-width: 340px;
  max-height: min(340px, calc(100vh - 32px));
  overflow: auto;
  white-space: normal;
  border-width: 1px 1px 1px 3px;
}

.office-doc-tooltip .office-tooltip-meta {
  margin-top: 3px;
  color: #94a3b8;
  font-size: 0.72rem;
  overflow-wrap: anywhere;
}

.office-doc-tooltip .office-tooltip-summary {
  margin: 0 0 7px;
  color: #dbeafe;
  font-size: 0.78rem;
  font-weight: 600;
}

.office-doc-tooltip .office-tooltip-content {
  max-height: 170px;
  margin: 0 0 9px;
  color: #aab8ca;
  font-size: 0.75rem;
  line-height: 1.45;
  overflow: hidden;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.office-doc-tooltip .office-tooltip-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* Document View & Editor Pane */
.doc-view-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.doc-toolbar {
  padding: 16px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.doc-meta-info h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.doc-badges {
  display: flex;
  align-items: center;
  gap: 8px;
}

.doc-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.doc-body-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 30px 40px;
}

.doc-reader-pane {
  max-width: 800px;
  margin: 0 auto;
  font-size: 1rem;
  line-height: 1.7;
  color: #e2e8f0;
}

.doc-reader-pane h1 { font-family: var(--font-display); font-size: 2rem; margin-bottom: 20px; color: #fff; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; }
.doc-reader-pane h2 { font-family: var(--font-display); font-size: 1.45rem; margin-top: 30px; margin-bottom: 14px; color: #38bdf8; }
.doc-reader-pane h3 { font-family: var(--font-display); font-size: 1.2rem; margin-top: 24px; margin-bottom: 10px; color: #93c5fd; }
.doc-reader-pane p { margin-bottom: 16px; }
.doc-reader-pane ul, .doc-reader-pane ol { margin-left: 24px; margin-bottom: 18px; }
.doc-reader-pane li { margin-bottom: 6px; }
.doc-reader-pane code { font-family: var(--font-mono); background: rgba(255, 255, 255, 0.08); padding: 2px 6px; border-radius: 4px; font-size: 0.9em; color: #f472b6; }
.doc-reader-pane pre { background: #0c101c; border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 16px; overflow-x: auto; margin-bottom: 20px; }
.doc-reader-pane pre code { background: transparent; padding: 0; color: #38bdf8; }
.doc-reader-pane blockquote { border-left: 3px solid var(--primary); padding-left: 16px; margin: 16px 0; color: #94a3b8; font-style: italic; background: rgba(56, 189, 248, 0.04); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* Interactive Wiki-Link in Markdown */
.wiki-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(192, 132, 252, 0.14);
  color: #d8b4fe;
  border: 1px solid rgba(192, 132, 252, 0.35);
  padding: 1px 7px;
  border-radius: 5px;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92em;
  cursor: pointer;
  transition: all 0.15s ease;
}

.wiki-link:hover {
  background: rgba(192, 132, 252, 0.28);
  border-color: #c084fc;
  box-shadow: 0 0 10px rgba(192, 132, 252, 0.3);
  transform: translateY(-1px);
}

.doc-editor-pane {
  height: 100%;
  display: flex;
}

.doc-editor-pane textarea {
  width: 100%;
  height: 100%;
  background: #090d16;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  line-height: 1.6;
  resize: none;
  outline: none;
}

.doc-editor-pane textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}

/* Relations Panel */
.doc-relations-panel {
  border-top: 1px solid var(--border-color);
  background: var(--bg-sidebar);
  padding: 14px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.relations-col h4 {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.relations-col h4 i {
  width: 14px;
  height: 14px;
  color: var(--primary);
}

.links-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.relation-chip {
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.relation-chip:hover {
  border-color: var(--accent-purple);
  background: rgba(192, 132, 252, 0.1);
  color: #d8b4fe;
}

/* Empty Selection */
.empty-selection-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 60vh;
  text-align: center;
  color: var(--text-muted);
}

.empty-selection-placeholder i {
  width: 56px;
  height: 56px;
  color: var(--primary);
  opacity: 0.5;
  margin-bottom: 16px;
}

.empty-selection-placeholder h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--text-main);
  margin-bottom: 8px;
}

/* Right Sidebar: AI Chat & Agent */
.sidebar-right {
  width: var(--ai-width, 380px);
  min-width: 260px;
  max-width: 650px;
  flex-shrink: 0;
  background-color: var(--bg-sidebar);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.ai-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  background: rgba(21, 28, 46, 0.5);
}

.ai-controls {
  display: flex;
  flex: 1 1 100%;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.ai-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #059669, #0284c7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.ai-avatar i {
  width: 20px;
  height: 20px;
}

.ai-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff;
}

.ai-status {
  font-size: 0.7rem;
  color: var(--accent-green);
}

.model-select {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
}

#conversation-select {
  width: 130px;
  max-width: 24vw;
}

#conversation-view-select {
  width: 92px;
  max-width: 20vw;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message-bubble {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  line-height: 1.5;
  animation: fadeInMsg 0.25s ease;
}

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

.message-bubble.user {
  background: linear-gradient(135deg, #0369a1, #1d4ed8);
  color: #fff;
  align-self: flex-end;
  max-width: 85%;
  border-bottom-right-radius: 2px;
}

.message-bubble.assistant {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: #e2e8f0;
  align-self: flex-start;
  width: 100%;
}

.welcome-bubble {
  border-color: rgba(56, 189, 248, 0.3);
  background: rgba(15, 23, 42, 0.7);
}

.msg-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--primary);
  margin-bottom: 6px;
}

.msg-header i {
  width: 14px;
  height: 14px;
}

/* Quick Prompts Chips */
.quick-prompts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.quick-prompt-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-prompt-chip:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--primary);
  color: #fff;
  transform: translateX(3px);
}

/* Agent Action Step Cards */
.agent-action-card {
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.25);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: #6ee7b7;
}

.agent-action-card i {
  width: 14px;
  height: 14px;
  color: var(--accent-green);
}

/* Citation Badges */
.citations-wrapper {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.citations-title {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.citation-chip {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #7dd3fc;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.7rem;
  cursor: pointer;
  margin-right: 4px;
  margin-bottom: 4px;
}

.citation-chip small {
  flex-basis: 100%;
  padding-left: 15px;
  opacity: 0.78;
  font-size: 0.62rem;
}

.citation-chip:hover {
  background: rgba(56, 189, 248, 0.25);
}

.message-feedback {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.message-feedback-button {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  cursor: pointer;
}

.message-feedback-button:hover,
.message-feedback-button.selected {
  color: var(--accent-green);
  border-color: var(--accent-green);
}

.message-feedback-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

/* Chat Input */
.chat-input-container {
  padding: 12px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-sidebar);
}

.chat-form {
  position: relative;
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px;
  transition: all 0.2s ease;
}

.chat-form:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}

.chat-form textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  resize: none;
  max-height: 100px;
  padding-right: 36px;
}

.btn-send {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  border: none;
  color: #090d16;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-send:hover {
  background: #7dd3fc;
  transform: scale(1.05);
}

.btn-send i {
  width: 16px;
  height: 16px;
}

.btn-chat-cancel {
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  margin-right: 40px;
  padding: 0 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.btn-chat-cancel:hover {
  color: var(--accent-rose);
  border-color: var(--accent-rose);
}

.btn-chat-cancel i {
  width: 14px;
  height: 14px;
}

.chat-footer-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.chat-footer-info i {
  width: 12px;
  height: 12px;
  color: var(--accent-green);
  display: inline-block;
  vertical-align: middle;
}

.chat-data-disclosure {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 0.66rem;
  line-height: 1.45;
}

.chat-data-disclosure a {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Modals */
.modal-overlay, .modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeInOverlay 0.2s ease;
}

@keyframes fadeInOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card, .modal-box {
  width: 90%;
  max-width: 580px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.settings-modal-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 64vh; max-height: min(72vh, 780px); overflow: hidden; }
#modal-settings .modal-card { width: min(1120px, 94vw); max-width: 1120px; }
#modal-settings .modal-body { padding: 0; overflow: hidden; }
.settings-modal-nav { padding: 20px 12px; border-right: 1px solid rgba(148,163,184,.18); background: rgba(15,23,42,.36); display: flex; flex-direction: column; gap: 5px; overflow-y: auto; }
.settings-nav-item { display: flex; align-items: center; gap: 10px; border: 0; border-radius: 8px; padding: 11px 12px; color: #94a3b8; background: transparent; text-align: left; cursor: pointer; font: inherit; font-size: .86rem; }
.settings-nav-item svg { width: 17px; height: 17px; flex: 0 0 auto; }
.settings-nav-item:hover, .settings-nav-item.active { color: #e2e8f0; background: rgba(56,189,248,.13); }
.settings-nav-item.active { box-shadow: inset 2px 0 #38bdf8; }
.settings-modal-content { overflow-y: auto; padding: 22px 26px; }
.settings-modal-pane[hidden] { display: none; }
.settings-pane-heading { margin: 0 0 20px; color: #e2e8f0; font-size: 1.05rem; }
@media (max-width: 720px) {
  .settings-modal-layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); max-height: 72vh; }
  .settings-modal-nav { flex-direction: row; overflow-x: auto; padding: 10px; border-right: 0; border-bottom: 1px solid rgba(148,163,184,.18); }
  .settings-nav-item { white-space: nowrap; }
  .settings-nav-item.active { box-shadow: inset 0 -2px #38bdf8; }
  .settings-modal-content { padding: 16px; }
}

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

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-header h3 i {
  width: 20px;
  height: 20px;
  color: var(--primary);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-close:hover {
  color: #fff;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 70vh;
  overflow-y: auto;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-inline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-inline-row label {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}

.settings-inline-control {
  width: 60%;
  flex: 0 0 60%;
}

.settings-inline-control input {
  width: 100%;
}

@media (max-width: 420px) {
  .settings-inline-control {
    width: 52%;
    flex-basis: 52%;
  }
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input, .form-group textarea, .form-group select {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  color: #fff;
  font-size: 0.88rem;
  outline: none;
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

.form-help {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.ai-data-notice {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.025);
  padding: 12px 14px;
}

.ai-data-notice summary {
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.ai-data-notice summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 4px;
}

.ai-data-notice-content {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.ai-data-notice-content p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.76rem;
  line-height: 1.55;
}

.ai-data-notice-content a {
  width: fit-content;
  color: var(--primary);
  font-size: 0.76rem;
}

.privacy-page {
  min-height: 100vh;
  padding: 32px 18px;
  background: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-sans);
}

.privacy-card {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: clamp(22px, 5vw, 48px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
}

.privacy-back,
.privacy-card a {
  color: var(--primary);
}

.privacy-language {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.privacy-language select {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--text-main);
}

.privacy-eyebrow {
  margin-top: 32px;
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.privacy-card h1 {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.6rem);
}

.privacy-updated {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.privacy-card section {
  margin-top: 30px;
}

.privacy-card h2 {
  margin-bottom: 10px;
  font-size: 1.08rem;
}

.privacy-card p,
.privacy-card li {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.7;
}

.privacy-card p + p {
  margin-top: 10px;
}

.privacy-card ul {
  display: grid;
  gap: 10px;
  padding-left: 22px;
}

.privacy-card strong {
  color: var(--text-main);
}

.modal-footer {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
}

/* Dropzone for Uploads */
.dropzone {
  border: 2px dashed rgba(56, 189, 248, 0.4);
  border-radius: var(--radius-md);
  padding: 30px;
  text-align: center;
  cursor: pointer;
  background: rgba(56, 189, 248, 0.03);
  transition: all 0.2s ease;
}

.dropzone:hover {
  border-color: var(--primary);
  background: rgba(56, 189, 248, 0.08);
}

.dropzone i {
  width: 44px;
  height: 44px;
  color: var(--primary);
  margin-bottom: 10px;
}

.dropzone h4 {
  font-size: 1rem;
  color: #fff;
  margin-bottom: 6px;
}

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

.upload-preview {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.upload-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-input);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

/* System Stats Card in Settings Modal */
.system-stats-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

.system-stats-card h4 {
  font-size: 0.82rem;
  color: var(--primary);
  margin-bottom: 8px;
}

.ai-usage-summary { color: var(--text-secondary); font-size: 0.78rem; margin: 10px 0; }
.ai-usage-daily { max-width: 100%; overflow-x: auto; }
.ai-usage-table { width: 100%; border-collapse: collapse; font-size: 0.72rem; color: var(--text-secondary); }
.ai-usage-table th, .ai-usage-table td { padding: 6px 8px; border-bottom: 1px solid var(--border-color); text-align: left; white-space: nowrap; }
.ai-usage-table th { color: var(--text-main); font-weight: 600; }

.brain-onboarding {
  position: fixed;
  z-index: 10050;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
  background: rgba(4, 8, 16, .82);
  backdrop-filter: blur(6px);
}
.brain-onboarding-card {
  width: min(100%, 620px);
  padding: 26px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .45);
}
.brain-onboarding-header, .brain-onboarding-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.brain-onboarding-header h2 { margin: 0; font-size: 1.2rem; }
.onboarding-close { padding: 6px; border: 0; background: transparent; color: var(--text-secondary); cursor: pointer; }
.brain-onboarding-eyebrow { margin: 0 0 7px; color: var(--primary); font-size: .68rem; font-weight: 700; letter-spacing: .12em; }
.brain-onboarding-progress { display: flex; gap: 8px; margin: 22px 0 14px; padding: 0; list-style: none; }
.brain-onboarding-progress li { flex: 1; padding: 8px; border-bottom: 2px solid var(--border-color); color: var(--text-muted); font-size: .75rem; text-align: center; }
.brain-onboarding-progress li[aria-current="step"] { border-color: var(--primary); color: var(--text-main); }
.brain-onboarding-step { min-height: 170px; padding: 14px 0 20px; }
.brain-onboarding-step h3 { margin: 0 0 10px; }
.brain-onboarding-step p, #onboarding-workspace { color: var(--text-secondary); line-height: 1.6; }
.brain-onboarding-footer { padding-top: 14px; border-top: 1px solid var(--border-color); }
.brain-onboarding-footer > div { display: flex; gap: 8px; }
.brain-onboarding-error { color: var(--danger, #fb7185); }
@media (max-width: 520px) {
  .brain-onboarding-card { padding: 18px; }
  .brain-onboarding-footer { align-items: stretch; flex-direction: column-reverse; }
  .brain-onboarding-footer > div { justify-content: flex-end; }
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* Helpers */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); font-size: 0.8rem; font-style: italic; }

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ==========================================================================
   2.5D Asset Stúdió & Blockbench Modell Tár Modal
   ========================================================================== */
.modal-lg {
  max-width: 760px;
  width: 90%;
}

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

.modal-icon-badge {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0284c7, #9333ea);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
}

.modal-subtitle {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.asset-studio-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(14, 23, 42, 0.85), rgba(30, 41, 59, 0.6));
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 18px;
}

.banner-info h4 {
  font-size: 0.86rem;
  color: #fff;
  margin-bottom: 4px;
}

.banner-info code {
  color: var(--primary);
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
}

.banner-info p {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.section-subheading {
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.asset-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
}

.asset-slot-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px;
  transition: all 0.2s ease;
}

.asset-slot-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.asset-slot-card.active-slot {
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(14, 27, 48, 0.65);
}

.slot-preview {
  width: 50px;
  height: 50px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.slot-thumbnail {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}

.voxel-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-muted);
}

.voxel-placeholder i {
  width: 18px;
  height: 18px;
}

.voxel-placeholder span {
  font-size: 0.6rem;
  font-weight: 600;
}

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

.slot-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 4px;
}

.slot-header strong {
  font-size: 0.78rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slot-status-pill {
  font-size: 0.65rem;
  font-weight: 600;
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  width: fit-content;
}

.pill-loaded {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.pill-voxel {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.slot-src {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-mono);
}

.asset-upload-zone {
  border: 2px dashed rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-md);
  padding: 18px;
  text-align: center;
  background: rgba(12, 16, 28, 0.5);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 14px;
}

.asset-upload-zone:hover {
  border-color: var(--primary);
  background: rgba(56, 189, 248, 0.05);
}

.asset-upload-zone i {
  width: 28px;
  height: 28px;
  color: var(--primary);
  margin-bottom: 6px;
}

.asset-upload-zone h4 {
  font-size: 0.86rem;
  color: #fff;
  margin-bottom: 2px;
}

.asset-upload-zone p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.link-label {
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
}

.asset-guide-box {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.guide-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-purple);
  margin-bottom: 8px;
}

.guide-header i {
  width: 14px;
  height: 14px;
}

.guide-steps {
  padding-left: 20px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.guide-steps strong, .guide-steps code {
  color: #fff;
}

