/* === GLOBAL RESET === */
[hidden] {
  display: none !important;
}

/* === VARIABLES & THEME === */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f7f7f8;
  --bg-sidebar: #f4f4f5;
  --bg-input: #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --border-light: #f0f0f0;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #dbeafe;
  --user-bubble: #eff6ff;
  --error: #ef4444;
  --error-bg: #fef2f2;
  --success: #22c55e;
  --warning: #f59e0b;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --sidebar-width: 340px;
  --header-height: 52px;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Cascadia Code", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #0f0f15;
    --bg-secondary: #1a1a25;
    --bg-sidebar: #111118;
    --bg-input: #1a1a25;
    --text-primary: #e5e5e5;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --border: #2a2a3a;
    --border-light: #1f1f2e;
    --accent: #4f8ff7;
    --accent-hover: #3b7ee6;
    --accent-light: #1e3a5f;
    --user-bubble: #1a2744;
    --error: #f87171;
    --error-bg: #2d1b1b;
    --success: #4ade80;
    --warning: #fbbf24;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
  }
}

/* === RESET === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-family);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
}

/* === LOGIN PAGE === */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: var(--bg-secondary);
}

.login-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 400px;
  max-width: 90vw;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  margin-bottom: 8px;
  display: flex;
  justify-content: center;
}

.login-logo .brand-icon {
  color: var(--accent);
}

.login-card h1 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 4px;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 32px;
}

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

.form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--bg-input);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}

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

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

.login-error {
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--error-bg);
  color: var(--error);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

/* === BUTTONS === */
/* Primary: solid accent — for confirm/submit actions only */
.btn-primary {
  width: 100%;
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* Secondary: outline bleu — for all standalone action buttons */
.btn-secondary {
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

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

/* Icon button (header, modal close, etc.) */
.btn-icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  min-width: 36px;
  min-height: 36px;
}

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

/* Mini action buttons (32x32, for message/conversation actions) */
.btn-mini-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 6px;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-mini-action:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.btn-mini-action svg { flex-shrink: 0; }

.btn-mini-danger:hover {
  color: var(--error);
  background: var(--error-bg);
}

/* === APP LAYOUT === */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* === HEADER === */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
  flex-shrink: 0;
}

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

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-icon {
  color: var(--accent);
  display: flex;
  flex-shrink: 0;
}

.brand-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

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

.header-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  min-width: 36px;
  min-height: 36px;
}

.header-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.header-btn.active {
  color: var(--accent);
  background: var(--accent-light);
}

.header-version {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0 4px;
}

/* === MAIN LAYOUT === */
.main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* === SIDEBAR === */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: margin-left 0.3s ease;
  overflow: hidden;
}

.sidebar.collapsed {
  margin-left: calc(-1 * var(--sidebar-width));
}

.sidebar-scroll {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* === SIDEBAR NAV (tab-style menu at top, never scrolls) === */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 14px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav-btn:hover {
  background: var(--bg-secondary);
}

.sidebar-nav-btn.active {
  color: var(--accent);
  font-weight: 600;
}

.sidebar-nav-btn.active .module-chevron {
  transform: rotate(90deg);
}

.module-chevron {
  flex-shrink: 0;
  transition: transform 0.2s;
}

.module-badge {
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--accent-light);
  color: var(--accent);
  margin-left: auto;
}

/* Info line below a nav button (fixed, always visible) */
.nav-info {
  font-size: 10px;
  color: var(--text-muted);
  padding: 0 14px 6px 34px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* === NEW CONV between nav and panel === */
.sidebar-new-conv {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* === SIDEBAR PANELS (content below nav, scrollable) === */
.sidebar-panel {
  display: none;
  padding: 10px 14px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.sidebar-panel.active {
  display: block;
}

/* Filters panel: list + buttons collés, scroll si déborde */
.sidebar-panel.panel-filters {
  overflow-y: auto;
}

.sidebar-panel.panel-filters.active {
  display: block;
}

.panel-filters .filter-actions-row {
  padding-top: 8px;
}

/* === SETTINGS INSIDE MODULES === */
.setting-group {
  margin-bottom: 10px;
}

.setting-group:last-child {
  margin-bottom: 0;
}

.setting-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.setting-caption {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 2px;
  margin-bottom: 6px;
}

/* === SIDEBAR FOOTER === */
.sidebar-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  text-align: center;
  flex-shrink: 0;
}

.sidebar-user {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.sidebar-legal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* === LEGAL LINKS === */
.legal-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.legal-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.legal-sep {
  color: var(--text-muted);
  font-size: 11px;
}

.chat-legal-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 6px 0 0;
}

/* === ABOUT/PRIVACY MODAL CONTENT === */
.about-content h4 {
  font-size: 14px;
  font-weight: 600;
  margin-top: 16px;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.about-content p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.about-content p strong {
  color: var(--text-primary);
}

.about-version {
  margin-top: 20px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* === INLINE FILTER SHARES === */
.filter-shares-list {
  margin-bottom: 0;
  padding-right: 4px;
}

.filter-share-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.filter-share-item input[type="checkbox"] {
  accent-color: var(--accent);
  flex-shrink: 0;
}

.filter-share-item label {
  flex: 1;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-share-count {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
  white-space: nowrap;
}

/* === ARCHITECTURE MODULE === */
.archi-machine {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 12px;
}

.archi-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.archi-dot.online { background: var(--success); }
.archi-dot.offline { background: var(--error); }

.archi-machine-name {
  font-weight: 500;
  color: var(--text-primary);
}

.archi-machine-role {
  font-size: 11px;
  color: var(--text-muted);
}

.archi-machine-detail {
  font-size: 10px;
  color: var(--text-muted);
  padding-left: 16px;
  margin-bottom: 4px;
}

/* === SUB-MODULE (details/summary inside modules) === */
.sub-module {
  margin-top: 10px;
  border-top: 1px solid var(--border);
  padding-top: 4px;
  margin-left: 10px;
}

.sub-module-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px 0;
  list-style: none;
}

.sub-module-toggle::-webkit-details-marker { display: none; }

.sub-module-toggle svg {
  flex-shrink: 0;
  transition: transform 0.2s;
}

.sub-module[open] .sub-module-toggle svg {
  transform: rotate(90deg);
}

.sub-module-body {
  padding-top: 6px;
}

.archi-section-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.archi-separator {
  height: 1px;
  background: var(--border);
  margin: 10px 0;
}


.btn-new-conv {
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-new-conv:hover {
  background: var(--accent);
  color: #fff;
}


/* Filter actions row (3 buttons) */
.filter-actions-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.filter-actions-row button {
  flex: 1;
}

/* === CONVERSATION LIST === */
.conv-list {
  max-height: 280px;
  overflow-y: auto;
}

.conv-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: background 0.15s;
  min-height: 36px;
}

.conv-item:hover { background: var(--bg-secondary); }

.conv-item.active {
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: 500;
}

.conv-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.conv-actions {
  display: flex;
  gap: 2px;
}

/* Desktop: hide actions until hover */
@media (hover: hover) {
  .conv-actions { display: none; }
  .conv-item:hover .conv-actions { display: flex; }
}

/* Touch: always show slightly transparent */
@media (hover: none) {
  .conv-actions { opacity: 0.6; }
}

/* === TOGGLE GROUP === */
.toggle-group {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 8px;
}

.toggle-btn {
  flex: 1;
  padding: 6px 10px;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.toggle-btn.active {
  background: var(--accent);
  color: #fff;
}

.toggle-btn:hover:not(.active) {
  background: var(--bg-secondary);
}

/* === SELECT INPUT === */
/* Select: height matches toggle buttons for visual harmony */
.select-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  background: var(--bg-input);
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
  margin-bottom: 4px;
  font-family: inherit;
}

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

/* === INDEX STATUS (Admin) === */
.index-status {
  font-size: 13px;
  margin-bottom: 8px;
}

.index-status .status-running {
  color: var(--warning);
}

.index-status .status-idle {
  color: var(--text-muted);
}

.index-status .status-paused {
  color: var(--accent);
}

.index-status .status-done {
  color: var(--success);
}

.index-status .status-error {
  color: var(--error);
}

.index-status .status-mbp-paused {
  color: var(--warning);
}

.index-progress-bar {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

.index-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.index-progress-fill.running { background: var(--warning); }
.index-progress-fill.done { background: var(--success); }

.index-detail {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.index-machine {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.index-phase {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
  font-style: italic;
}

.index-fragment-detail {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.index-delta-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.delta-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 500;
}

.delta-badge.delta-added {
  background: #dcfce7;
  color: #166534;
}

.delta-badge.delta-modified {
  background: #fef3c7;
  color: #92400e;
}

.delta-badge.delta-deleted {
  background: #fee2e2;
  color: #991b1b;
}

@media (prefers-color-scheme: dark) {
  .delta-badge.delta-added {
    background: #14532d;
    color: #86efac;
  }
  .delta-badge.delta-modified {
    background: #78350f;
    color: #fcd34d;
  }
  .delta-badge.delta-deleted {
    background: #7f1d1d;
    color: #fca5a5;
  }
}

.index-preview {
  margin-top: 6px;
}

.index-preview-result {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 6px 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}


/* === FILE BROWSER / EXCLUSIONS === */
.btn-browse-share {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  padding: 0 2px;
  opacity: 0.5;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.btn-browse-share:hover {
  opacity: 1;
}

.modal-wide {
  max-width: 600px;
  width: 90vw;
}
.modal-wide .modal-body {
  max-height: 60vh;
  overflow-y: auto;
}

.tree-node-row.excluded {
  opacity: 0.45;
}
.tree-node-row.excluded .tree-node-name {
  text-decoration: line-through;
}

.exclusion-count {
  font-size: 12px;
  color: var(--text-muted);
  margin-right: auto;
}

@media (prefers-color-scheme: dark) {
  .tree-node-row.excluded {
    opacity: 0.4;
  }
}

/* === INDEX ACTIONS (Admin) === */
.index-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.index-actions .btn-warning,
.index-actions .btn-danger {
  flex: 1;
  text-align: center;
  white-space: nowrap;
}

.index-actions:empty {
  display: none;
}

/* Running actions: pause + stop side by side, 50% each */
#idx-running-actions {
  display: flex;
  gap: 6px;
}

#idx-running-actions button {
  flex: 1;
}

/* Small buttons: match btn-secondary style but smaller */
.btn-small {
  padding: 8px 12px;
  font-size: 12px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

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

.btn-danger {
  padding: 6px 12px;
  background: transparent;
  color: var(--error);
  border: 1px solid var(--error);
  border-radius: var(--radius-md);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-warning {
  padding: 6px 12px;
  background: transparent;
  color: var(--warning);
  border: 1px solid var(--warning);
  border-radius: var(--radius-md);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-warning:hover { background: var(--warning); color: #1a1a1a; }

.btn-success {
  padding: 6px 12px;
  background: transparent;
  color: var(--success);
  border: 1px solid var(--success);
  border-radius: var(--radius-md);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-success:hover { background: var(--success); color: #1a1a1a; }

/* === INDEX SELECTOR === */
.index-selector {
  margin-bottom: 10px;
}

.index-selector label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.index-selector-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.index-selector-row select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  font-size: 13px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
}

.index-selector-row select:focus { border-color: var(--accent); }

/* Single button = full width, multiple buttons = share row */
.index-selector-row button {
  width: 100%;
}

.index-selector-buttons {
  display: flex;
  gap: 6px;
}

.index-selector-buttons button {
  flex: 1;
  width: auto;
}

/* === QUEUE FROZEN BAR === */
.queue-frozen-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 8px;
  background: #fef3c7;
  border-radius: var(--radius-md);
  font-size: 12px;
  color: #92400e;
}

.queue-frozen-bar span {
  flex: 1;
  font-weight: 500;
}

.queue-frozen-bar .btn-secondary {
  flex-shrink: 0;
  width: auto;
  padding: 6px 14px;
  font-size: 11px;
  color: #92400e;
  border-color: #92400e;
}

.queue-frozen-bar .btn-secondary:hover {
  background: #92400e;
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .queue-frozen-bar {
    background: #78350f;
    color: #fcd34d;
  }
  .queue-frozen-bar .btn-secondary {
    color: #fcd34d;
    border-color: #fcd34d;
  }
  .queue-frozen-bar .btn-secondary:hover {
    background: #fcd34d;
    color: #78350f;
  }
}

/* === INDEX QUEUE === */
.index-queue-item {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  padding: 1px 0 1px 8px;
  color: var(--text-secondary);
  line-height: 1.3;
}

.index-queue-item span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.index-queue-item .queue-num {
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 14px;
  text-align: right;
}

.index-stats {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* === NAS STATUS (Admin) === */
.nas-status {
  font-size: 12px;
  margin-bottom: 8px;
}

.nas-share-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.nas-share-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.nas-share-dot.indexed { background: var(--success); }
.nas-share-dot.indexed-empty { background: var(--accent); }
.nas-share-dot.running { background: var(--warning); }
.nas-share-dot.paused { background: var(--warning); opacity: 0.6; }
.nas-share-dot.not-indexed { background: var(--text-muted); }

.nas-share-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.nas-share-badge {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 8px;
  flex-shrink: 0;
}

.nas-share-badge.indexed {
  background: var(--accent-light);
  color: var(--accent);
}

.nas-share-badge.running {
  background: #fef3c7;
  color: #92400e;
}

.nas-share-badge.paused {
  background: #fef3c7;
  color: #92400e;
}

.nas-share-badge.not-indexed {
  background: var(--bg-secondary);
  color: var(--text-muted);
}

/* === TOAST NOTIFICATION === */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: #fff;
  z-index: 200;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
  max-width: 350px;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.success { background: var(--success); color: #1a1a1a; }
.toast.error { background: var(--error); }
.toast.info { background: var(--accent); }
.toast.warning { background: var(--warning); color: #1a1a1a; }

/* === MODAL === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 520px;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

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

.modal-footer {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}

.modal-footer .btn-primary,
.modal-footer .btn-secondary {
  width: auto;
  min-width: 100px;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    z-index: 50;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.collapsed {
    margin-left: calc(-1 * var(--sidebar-width));
  }
}

/* === SCROLLBAR === */
::-webkit-scrollbar {
  width: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* === ANIMATIONS === */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.3s ease;
}

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

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* === Index errors in CR === */
.index-errors-summary {
  font-size: 11px;
  color: var(--warning);
  margin-top: 4px;
}

.btn-toggle-errors {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 11px;
  padding: 0 4px;
  text-decoration: underline;
}

.index-error-list {
  margin-top: 4px;
  padding: 4px 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  max-height: 120px;
  overflow-y: auto;
}

.index-error-file {
  font-size: 10px;
  color: var(--text-muted);
  padding: 1px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* === Reindex Alert Modal === */
.reindex-scan-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.reindex-intro {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.reindex-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.reindex-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--bg-secondary);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.reindex-item:hover {
  background: var(--bg-hover);
}

.reindex-item input[type="checkbox"] {
  flex-shrink: 0;
}

.reindex-item-name {
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reindex-item-total {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* === SIDEBAR RESIZE === */
.sidebar-resize-handle {
  width: 4px;
  cursor: col-resize;
  background: transparent;
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 10;
  transition: background 0.2s;
}
.sidebar-resize-handle:hover,
.sidebar-resize-handle.dragging {
  background: var(--accent);
}
.sidebar {
  position: relative;
  min-width: 250px;
  max-width: 600px;
}
