/* ===== FacilityFirst CAFM/IWMS - Premium Dark Design System ===== */

/* --- CSS Custom Properties (Design Tokens) --- */
:root {
  /* Colors - Dark Theme */
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-tertiary: #1a2235;
  --bg-card: #151d2e;
  --bg-card-hover: #1c2640;
  --bg-input: #0d1525;
  --bg-sidebar: #0c1222;
  --bg-header: rgba(10, 14, 26, 0.85);
  
  --border-color: rgba(99, 102, 241, 0.12);
  --border-light: rgba(255, 255, 255, 0.06);
  --border-focus: #6366f1;
  
  --text-primary: #e8ecf4;
  --text-secondary: #8994a8;
  --text-muted: #5a6578;
  --text-heading: #f1f5fb;
  
  /* Accent Colors */
  --accent-primary: #6366f1;
  --accent-primary-rgb: 99, 102, 241;
  --accent-hover: #818cf8;
  --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
  --accent-glow: 0 0 20px rgba(99, 102, 241, 0.3);
  
  /* Status Colors */
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.1);
  
  /* Module Colors */
  --color-dashboard: #6366f1;
  --color-objects: #3b82f6;
  --color-activities: #f59e0b;
  --color-budget: #10b981;
  --color-finance: #06b6d4;
  --color-employees: #8b5cf6;
  --color-contacts: #ec4899;
  --color-documents: #14b8a6;
  --color-hse: #ef4444;
  --color-reports: #f97316;
  --color-visualization: #6366f1;
  --color-wiki: #a855f7;
  --color-settings: #64748b;
  
  /* Sizing */
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --header-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Font */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
  display: flex;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(99, 102, 241, 0.2); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(99, 102, 241, 0.4); }

::selection { background: rgba(99,102,241,0.3); color: #fff; }

a { color: var(--accent-primary); text-decoration: none; }

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  transition: width var(--transition-slow);
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-header {
  padding: 16px 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  min-height: 65px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.logo-icon {
  width: 38px;
  height: 38px;
  min-width: 38px;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
  box-shadow: var(--accent-glow);
}

.logo-text { overflow: hidden; white-space: nowrap; }

.logo-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-heading);
  display: block;
  letter-spacing: -0.02em;
}

.logo-sub {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.sidebar-toggle:hover { color: var(--text-primary); background: var(--bg-tertiary); }

.sidebar.collapsed .sidebar-toggle i { transform: rotate(180deg); }
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .user-info { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px; }
.sidebar.collapsed .nav-item i { margin: 0; font-size: 18px; }

/* Navigation */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.nav-section { margin-bottom: 4px; }

.nav-section-title {
  display: block;
  padding: 12px 12px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition-fast);
  position: relative;
  margin: 1px 0;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item i {
  width: 20px;
  min-width: 20px;
  text-align: center;
  font-size: 14px;
}

.nav-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(var(--accent-primary-rgb), 0.12);
  color: var(--accent-hover);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent-primary);
  border-radius: 0 3px 3px 0;
}

.nav-item .badge-nav {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.user-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}

.user-info { overflow: hidden; }

.user-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-heading);
  white-space: nowrap;
}

.user-role {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-slow);
  overflow: hidden;
}

.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-collapsed); }

/* --- Header --- */
.main-header {
  height: var(--header-height);
  min-height: var(--header-height);
  background: var(--bg-header);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-left, .header-right { display: flex; align-items: center; gap: 12px; }

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
}

.header-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.header-breadcrumb .fa-chevron-right { font-size: 8px; }

#breadcrumbModule { color: var(--text-primary); font-weight: 500; }

.header-center { flex: 1; max-width: 480px; margin: 0 24px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0 16px;
  height: 40px;
  transition: var(--transition-fast);
}

.search-box:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.15);
}

.search-box i { color: var(--text-muted); font-size: 13px; }

.search-box input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 13px;
  outline: none;
}

.search-box input::placeholder { color: var(--text-muted); }

.search-box kbd {
  font-size: 10px;
  padding: 2px 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-muted);
  font-family: var(--font-family);
}

.header-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  position: relative;
}

.header-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }

.header-btn .badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.header-date {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

/* --- Page Content --- */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg-primary);
}

/* --- Loading Spinner --- */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 60vh;
  gap: 16px;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-spinner.hidden { display: none; }

/* --- Page Header --- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title-group { display: flex; flex-direction: column; gap: 4px; }

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 2px 8px rgba(var(--accent-primary-rgb), 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(var(--accent-primary-rgb), 0.4);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--accent-primary); }

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.2);
}

.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(16,185,129,0.2);
}

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 8px; width: 36px; height: 36px; justify-content: center; }

/* --- KPI Cards Grid --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: var(--transition-fast);
}

.kpi-card:hover {
  border-color: rgba(var(--accent-primary-rgb), 0.3);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-card:hover::before { opacity: 1; }

.kpi-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.kpi-icon.blue { background: var(--info-bg); color: var(--info); }
.kpi-icon.green { background: var(--success-bg); color: var(--success); }
.kpi-icon.yellow { background: var(--warning-bg); color: var(--warning); }
.kpi-icon.red { background: var(--danger-bg); color: var(--danger); }
.kpi-icon.purple { background: rgba(139,92,246,0.1); color: #8b5cf6; }
.kpi-icon.cyan { background: rgba(6,182,212,0.1); color: #06b6d4; }
.kpi-icon.pink { background: rgba(236,72,153,0.1); color: #ec4899; }

.kpi-content { flex: 1; }
.kpi-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.kpi-value { font-size: 22px; font-weight: 700; color: var(--text-heading); letter-spacing: -0.02em; }
.kpi-change { font-size: 11px; margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.kpi-change.positive { color: var(--success); }
.kpi-change.negative { color: var(--danger); }

/* --- Content Grid --- */
.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.content-grid-full {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.content-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition-normal);
}

.card:hover {
  border-color: rgba(var(--accent-primary-rgb), 0.2);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body { padding: 20px; }
.card-body.no-padding { padding: 0; }

/* --- Data Tables --- */
.table-container {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  background: var(--bg-tertiary);
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition-fast);
}

.data-table tbody tr:hover {
  background: rgba(var(--accent-primary-rgb), 0.04);
}

.data-table tbody tr:last-child { border-bottom: none; }

.data-table td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
}

.data-table td.wrap { white-space: normal; max-width: 300px; }

/* --- Status Badges --- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-badge.status-active, .status-badge.status-aktiv { background: var(--success-bg); color: var(--success); }
.status-badge.status-active::before, .status-badge.status-aktiv::before { background: var(--success); }

.status-badge.status-open, .status-badge.status-offen { background: var(--info-bg); color: var(--info); }
.status-badge.status-open::before, .status-badge.status-offen::before { background: var(--info); }

.status-badge.status-progress, .status-badge.status-in-bearbeitung { background: var(--warning-bg); color: var(--warning); }
.status-badge.status-progress::before, .status-badge.status-in-bearbeitung::before { background: var(--warning); }

.status-badge.status-done, .status-badge.status-abgeschlossen, .status-badge.status-bezahlt, .status-badge.status-erledigt { background: var(--success-bg); color: var(--success); }
.status-badge.status-done::before, .status-badge.status-abgeschlossen::before, .status-badge.status-bezahlt::before, .status-badge.status-erledigt::before { background: var(--success); }

.status-badge.status-planned, .status-badge.status-geplant { background: rgba(139,92,246,0.1); color: #8b5cf6; }
.status-badge.status-planned::before, .status-badge.status-geplant::before { background: #8b5cf6; }

.status-badge.status-critical, .status-badge.status-hoch { background: var(--danger-bg); color: var(--danger); }
.status-badge.status-critical::before, .status-badge.status-hoch::before { background: var(--danger); }

.status-badge.status-warning, .status-badge.status-mittel { background: var(--warning-bg); color: var(--warning); }
.status-badge.status-warning::before, .status-badge.status-mittel::before { background: var(--warning); }

.status-badge.status-low, .status-badge.status-niedrig { background: var(--info-bg); color: var(--info); }
.status-badge.status-low::before, .status-badge.status-niedrig::before { background: var(--info); }

.status-badge.status-erstellt { background: rgba(99,102,241,0.1); color: var(--accent-primary); }
.status-badge.status-erstellt::before { background: var(--accent-primary); }

/* --- Priority Badges --- */
.priority-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.priority-dot.hoch { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.priority-dot.mittel { background: var(--warning); }
.priority-dot.niedrig { background: var(--info); }

/* --- Progress Bar --- */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width var(--transition-slow);
  background: var(--accent-gradient);
}

.progress-bar-fill.warning { background: linear-gradient(90deg, #f59e0b, #f97316); }
.progress-bar-fill.danger { background: linear-gradient(90deg, #ef4444, #dc2626); }
.progress-bar-fill.success { background: linear-gradient(90deg, #10b981, #059669); }

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* --- Tags --- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.tag-blue { background: var(--info-bg); color: var(--info); }
.tag-green { background: var(--success-bg); color: var(--success); }
.tag-yellow { background: var(--warning-bg); color: var(--warning); }
.tag-red { background: var(--danger-bg); color: var(--danger); }
.tag-purple { background: rgba(139,92,246,0.1); color: #8b5cf6; }

/* --- Forms --- */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 13px;
  transition: var(--transition-fast);
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.15);
}

.form-select {
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238994a8' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-textarea {
  min-height: 80px;
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* --- Filter Bar --- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-bar .search-input {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 12px;
  height: 36px;
  min-width: 240px;
}

.filter-bar .search-input input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 13px;
  outline: none;
}

.filter-bar .search-input i { color: var(--text-muted); font-size: 12px; }

.filter-tab {
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition-fast);
}

.filter-tab:hover { color: var(--text-primary); border-color: var(--accent-primary); }
.filter-tab.active { background: rgba(var(--accent-primary-rgb), 0.12); color: var(--accent-hover); border-color: var(--accent-primary); }

/* --- Charts (Simple CSS Charts) --- */
.chart-bar-container {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 120px;
  padding: 8px 0;
}

.chart-bar {
  flex: 1;
  border-radius: 4px 4px 0 0;
  min-width: 20px;
  position: relative;
  transition: height var(--transition-slow);
  cursor: pointer;
}

.chart-bar:hover { opacity: 0.8; }

.chart-bar-label {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}

.chart-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Donut chart */
.donut-chart {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.donut-chart-inner {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-heading);
}

/* --- List Items --- */
.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition-fast);
}

.list-item:last-child { border-bottom: none; }
.list-item:hover { background: rgba(var(--accent-primary-rgb), 0.03); }

.list-item-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.list-item-content { flex: 1; min-width: 0; }

.list-item-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.list-item-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* --- Object Tree --- */
.tree-view { padding: 8px; }

.tree-node { margin-left: 20px; }
.tree-node:first-child { margin-left: 0; }

.tree-node-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  font-size: 13px;
}

.tree-node-header:hover { background: var(--bg-tertiary); }

.tree-toggle {
  color: var(--text-muted);
  font-size: 10px;
  width: 16px;
  text-align: center;
  transition: transform var(--transition-fast);
}

.tree-toggle.expanded { transform: rotate(90deg); }

.tree-icon { font-size: 14px; }

.tree-label { color: var(--text-primary); font-weight: 500; }
.tree-count { color: var(--text-muted); font-size: 11px; }
.tree-children { overflow: hidden; }

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { transform: scale(0.95) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-heading);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.modal-close:hover { background: var(--bg-tertiary); color: var(--text-primary); }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* --- Toast --- */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  animation: toastIn 0.3s ease;
  font-size: 13px;
}

.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-error { border-left: 3px solid var(--danger); }
.toast.toast-info { border-left: 3px solid var(--info); }
.toast.toast-warning { border-left: 3px solid var(--warning); }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* --- Tab Bar --- */
.tab-bar {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
  overflow-x: auto;
}

.tab-item {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.tab-item:hover { color: var(--text-primary); }

.tab-item.active {
  color: var(--accent-hover);
  border-bottom-color: var(--accent-primary);
}

/* --- Empty State --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.empty-state i {
  font-size: 48px;
  color: var(--text-muted);
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 360px;
}

/* --- Wiki Styles --- */
.wiki-content {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary);
}

.wiki-content h1 { font-size: 22px; font-weight: 700; margin: 24px 0 12px; color: var(--text-heading); }
.wiki-content h2 { font-size: 18px; font-weight: 600; margin: 20px 0 10px; color: var(--text-heading); }
.wiki-content h3 { font-size: 15px; font-weight: 600; margin: 16px 0 8px; color: var(--text-heading); }
.wiki-content p { margin: 8px 0; }
.wiki-content ul, .wiki-content ol { margin: 8px 0; padding-left: 24px; }
.wiki-content li { margin: 4px 0; }
.wiki-content strong { color: var(--text-heading); }
.wiki-content code { padding: 2px 6px; background: var(--bg-tertiary); border-radius: 4px; font-size: 12px; }

/* --- Condition Rating --- */
.condition-stars { display: flex; gap: 2px; }
.condition-stars .star { color: var(--text-muted); font-size: 12px; }
.condition-stars .star.filled { color: #f59e0b; }

/* --- Amount Display --- */
.amount { font-weight: 600; font-variant-numeric: tabular-nums; }
.amount.positive { color: var(--success); }
.amount.negative { color: var(--danger); }

/* --- Responsive --- */
@media (max-width: 1024px) {
  .content-grid-2 { grid-template-columns: 1fr; }
  .content-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    position: fixed;
    z-index: 200;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
  .mobile-menu-toggle { display: flex; }
  .header-center { display: none; }
  .header-date { display: none; }
  .page-content { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
}

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.3s ease forwards; }

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }

/* --- Glassmorphism accent cards --- */
.glass-card {
  background: rgba(var(--accent-primary-rgb), 0.06);
  border: 1px solid rgba(var(--accent-primary-rgb), 0.15);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(10px);
}

/* --- Object card --- */
.object-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: var(--transition-normal);
  cursor: pointer;
}

.object-card:hover {
  border-color: rgba(var(--accent-primary-rgb), 0.3);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.object-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.object-card-icon { font-size: 20px; }

.object-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-heading);
}

.object-card-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

.object-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}

/* --- Section Header Inline --- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-heading);
}

/* --- Table actions cell --- */
.cell-actions {
  display: flex;
  gap: 4px;
}

.cell-actions button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: var(--transition-fast);
  font-size: 12px;
}

.cell-actions button:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.cell-actions button.delete:hover { color: var(--danger); }
