/* ==========================================================================
   KassenKompass Design System - Apple-Style
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Variables
   -------------------------------------------------------------------------- */
:root {
  /* Primary */
  --primary: #6B46C1;
  --primary-dark: #553C9A;
  --primary-light: #9F7AEA;
  --primary-50: #FAF5FF;

  /* Accent */
  --accent-teal: #14B8A6;

  /* Status */
  --success: #10B981;
  --success-light: #D1FAE5;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --error: #EF4444;
  --error-light: #FEE2E2;
  --info: #3B82F6;
  --info-light: #DBEAFE;

  /* Backgrounds */
  --bg-page: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-muted: #F1F5F9;
  --bg-sidebar: #FFFFFF;
  --bg-hover: #F8FAFC;

  /* Text */
  --text-heading: #0F172A;
  --text-body: #334155;
  --text-muted: #64748B;
  --text-disabled: #94A3B8;

  /* Borders */
  --border: #E2E8F0;
  --border-muted: #F1F5F9;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);

  /* Layout */
  --sidebar-width: 260px;
  --header-height: 64px;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.2s ease;
}

/* --------------------------------------------------------------------------
   Base Styles
   -------------------------------------------------------------------------- */
* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-body);
  background-color: var(--bg-page);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  padding: 32px 40px;
  max-width: 1400px;
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 24px 16px;
  padding-bottom: 16px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  padding: 0 12px;
  margin-bottom: 32px;
}

.sidebar-logo img {
  height: 36px;
  width: auto;
}

.sidebar-logo-text {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
}

.sidebar-logo-text .text-primary {
  color: var(--primary);
}

.sidebar-logo-text .text-teal {
  color: var(--accent-teal);
}

/* Nav Sections */
.nav-section {
  margin-bottom: 28px;
}

.nav-section-header {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-disabled);
  padding: 0 12px;
  margin-bottom: 8px;
}

/* Nav Items */
.nav-item {
  margin-bottom: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-body);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.nav-link:hover {
  background: var(--bg-hover);
  color: var(--text-heading);
}

.nav-link.active {
  background: var(--bg-hover);
  color: var(--primary);
}

.nav-link i {
  font-size: 18px;
  width: 20px;
  text-align: center;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.nav-link:hover i,
.nav-link.active i {
  color: var(--primary);
}

.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
}

/* User Info at Bottom */
.sidebar-footer {
  flex-shrink: 0;
  padding: 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-sidebar);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--primary-50);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-weight: 600;
}

.user-details {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

/* --------------------------------------------------------------------------
   Page Header
   -------------------------------------------------------------------------- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-heading);
  margin: 0 0 4px 0;
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

.page-actions {
  display: flex;
  gap: 12px;
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-muted);
  overflow: hidden;
}

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

.card-header h3,
.card-header h4,
.card-header h5,
.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-heading);
  margin: 0;
}

.card-body {
  padding: 24px;
}

.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-muted);
}

/* Stat Cards */
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-muted);
  padding: 20px 24px;
  transition: box-shadow var(--transition-normal);
}

.stat-card:hover {
  box-shadow: var(--shadow-lg);
}

.stat-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

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

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
}

.stat-icon.teal { background: var(--accent-teal); }
.stat-icon.pink { background: #F43F5E; }
.stat-icon.blue { background: var(--info); }
.stat-icon.green { background: var(--success); }
.stat-icon.purple { background: var(--primary); }
.stat-icon.warning { background: var(--warning); }
.stat-icon.orange { background: #f97316; }
.stat-icon.red { background: var(--danger); }

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.1;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.stat-comparison {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.stat-comparison-label {
  color: var(--text-muted);
}

.stat-comparison-value {
  font-weight: 600;
}

.stat-comparison-value.positive { color: var(--success); }
.stat-comparison-value.negative { color: var(--error); }

/* Stat Grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: white;
}

.btn-secondary {
  background: var(--bg-muted);
  color: var(--text-body);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--border);
  color: var(--text-heading);
}

.btn-outline-primary {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline-primary:hover {
  background: var(--primary-50);
  color: var(--primary);
}

.btn-outline-secondary {
  background: transparent;
  color: var(--text-body);
  border-color: var(--border);
}

.btn-outline-secondary:hover {
  background: var(--bg-muted);
  color: var(--text-heading);
}

.btn-success {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.btn-success:hover {
  background: #059669;
  border-color: #059669;
  color: white;
}

.btn-danger {
  background: var(--error);
  color: white;
  border-color: var(--error);
}

.btn-danger:hover {
  background: #DC2626;
  border-color: #DC2626;
  color: white;
}

.btn-warning {
  background: var(--warning);
  color: white;
  border-color: var(--warning);
}

.btn-warning:hover {
  background: #D97706;
  border-color: #D97706;
  color: white;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-lg {
  padding: 14px 24px;
  font-size: 16px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form-group {
  margin-bottom: 20px;
}

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

.form-control {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  font-size: 14px;
  color: var(--text-heading);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.form-control:hover {
  border-color: #CBD5E1;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(107, 70, 193, 0.1);
}

.form-control::placeholder {
  color: var(--text-disabled);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748B' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

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

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-muted);
  color: var(--text-body);
}

.table tbody tr:hover {
  background: var(--bg-hover);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table-responsive {
  overflow-x: auto;
}

/* --------------------------------------------------------------------------
   Badges
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-full);
}

.badge-primary,
.bg-primary {
  background: var(--primary) !important;
  color: white !important;
}

.badge-success,
.bg-success {
  background: var(--success-light) !important;
  color: #065F46 !important;
}

.badge-warning,
.bg-warning {
  background: var(--warning-light) !important;
  color: #92400E !important;
}

.badge-danger,
.bg-danger {
  background: var(--error-light) !important;
  color: #991B1B !important;
}

.badge-info,
.bg-info {
  background: var(--info-light) !important;
  color: #1E40AF !important;
}

.badge-secondary,
.bg-secondary {
  background: var(--bg-muted) !important;
  color: var(--text-muted) !important;
}

/* --------------------------------------------------------------------------
   Alerts
   -------------------------------------------------------------------------- */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.alert-success {
  background: var(--success-light);
  color: #065F46;
  border: 1px solid #A7F3D0;
}

.alert-warning {
  background: var(--warning-light);
  color: #92400E;
  border: 1px solid #FDE68A;
}

.alert-danger,
.alert-error {
  background: var(--error-light);
  color: #991B1B;
  border: 1px solid #FECACA;
}

.alert-info {
  background: var(--info-light);
  color: #1E40AF;
  border: 1px solid #BFDBFE;
}

.alert .btn-close {
  margin-left: auto;
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  opacity: 0.5;
}

.alert .btn-close:hover {
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Data Lists
   -------------------------------------------------------------------------- */
.data-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.data-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border-muted);
  transition: background var(--transition-fast);
}

.data-list-item:last-child {
  border-bottom: none;
}

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

.data-list-label {
  font-size: 14px;
  color: var(--text-body);
}

.data-list-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-heading);
}

/* --------------------------------------------------------------------------
   Empty States
   -------------------------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 8px;
}

.empty-state-text {
  font-size: 14px;
  margin-bottom: 20px;
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--error) !important; }
.text-muted { color: var(--text-muted) !important; }

.bg-page { background: var(--bg-page) !important; }
.bg-card { background: var(--bg-card) !important; }
.bg-muted { background: var(--bg-muted) !important; }

.fw-medium { font-weight: 500 !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-bold { font-weight: 700 !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: 8px !important; }
.mb-3 { margin-bottom: 12px !important; }
.mb-4 { margin-bottom: 16px !important; }
.mb-5 { margin-bottom: 24px !important; }
.mb-6 { margin-bottom: 32px !important; }

.mt-4 { margin-top: 16px !important; }
.mt-5 { margin-top: 24px !important; }

.me-2 { margin-right: 8px !important; }
.me-3 { margin-right: 12px !important; }

.gap-2 { gap: 8px !important; }
.gap-3 { gap: 12px !important; }
.gap-4 { gap: 16px !important; }

.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }
.align-items-center { align-items: center !important; }
.justify-content-between { justify-content: space-between !important; }
.flex-wrap { flex-wrap: wrap !important; }

.text-end { text-align: right !important; }
.text-center { text-align: center !important; }

/* --------------------------------------------------------------------------
   Login Page
   -------------------------------------------------------------------------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-page) 0%, #EDE9FE 100%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo img {
  height: 48px;
}

.login-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  margin-bottom: 20px;
}

.login-alert i {
  font-size: 18px;
  flex-shrink: 0;
}

.login-alert-success {
  background: var(--success-light);
  color: #065F46;
  border: 1px solid #A7F3D0;
}

.login-alert-danger {
  background: var(--error-light);
  color: #991B1B;
  border: 1px solid #FECACA;
}

.login-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-heading);
  text-align: center;
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 32px;
}

.login-container {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-form {
  width: 100%;
}

.login-form .form-group {
  margin-bottom: 20px;
}

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

.login-form input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  font-size: 14px;
  color: var(--text-heading);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.login-form input:hover {
  border-color: #CBD5E1;
}

.login-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(107, 70, 193, 0.1);
}

.login-form input::placeholder {
  color: var(--text-disabled);
}

.btn-block {
  width: 100%;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-muted);
  font-size: 12px;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-wrapper {
    margin-left: 0;
  }

  .main-content {
    padding: 24px 20px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    gap: 16px;
  }

  .page-actions {
    width: 100%;
  }

  .page-actions .btn {
    flex: 1;
  }
}

/* --------------------------------------------------------------------------
   Override Bootstrap
   -------------------------------------------------------------------------- */
.navbar {
  display: none !important;
}

.row {
  margin: 0;
}

.col-md-2,
.col-md-10,
.col-md-12 {
  padding: 0;
}

/* Fix for Bootstrap containers */
.container-fluid {
  padding: 0;
}

/* --------------------------------------------------------------------------
   Excel-like Table Filters
   -------------------------------------------------------------------------- */
.table-filterable th {
  position: relative;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.table-filterable th.no-filter {
  cursor: default;
}

.th-content {
  display: flex;
  align-items: center;
  gap: 6px;
}

.th-filter-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  color: var(--text-disabled);
  font-size: 10px;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.table-filterable th:hover .th-filter-icon {
  color: var(--text-muted);
  background: rgba(0,0,0,0.05);
}

.table-filterable th.filter-active .th-filter-icon {
  color: var(--primary);
  background: var(--primary-50);
}

.th-sort-icon {
  display: inline-flex;
  align-items: center;
  color: var(--text-disabled);
  font-size: 12px;
  margin-left: auto;
}

.table-filterable th.sort-asc .th-sort-icon,
.table-filterable th.sort-desc .th-sort-icon {
  color: var(--primary);
}

/* Filter Dropdown */
.filter-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  max-width: 300px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: none;
  margin-top: 4px;
}

.filter-dropdown.show {
  display: block;
}

.filter-dropdown-header {
  padding: 12px;
  border-bottom: 1px solid var(--border-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.filter-dropdown-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-heading);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.filter-dropdown-clear {
  font-size: 11px;
  color: var(--primary);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
}

.filter-dropdown-clear:hover {
  background: var(--primary-50);
}

/* Sort Options */
.filter-sort-options {
  padding: 8px;
  border-bottom: 1px solid var(--border-muted);
  display: flex;
  gap: 4px;
}

.filter-sort-btn {
  flex: 1;
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-body);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all var(--transition-fast);
}

.filter-sort-btn:hover {
  background: var(--bg-muted);
}

.filter-sort-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Search in Filter */
.filter-search {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-muted);
}

.filter-search input {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
}

.filter-search input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-card);
}

/* Filter Values List */
.filter-values {
  max-height: 240px;
  overflow-y: auto;
  padding: 4px 0;
}

.filter-value-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-body);
  cursor: pointer;
  transition: background var(--transition-fast);
}

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

.filter-value-item.selected {
  /* No background color on the whole row */
}

.filter-value-checkbox {
  width: 16px;
  height: 16px;
  border: 1px solid var(--border);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.filter-value-item.selected .filter-value-checkbox {
  background: var(--primary);
  border-color: var(--primary);
}

.filter-value-checkbox i {
  font-size: 10px;
  opacity: 0;
  color: white;
}

.filter-value-item.selected .filter-value-checkbox i {
  opacity: 1;
}

.filter-value-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-value-count {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-muted);
  padding: 1px 6px;
  border-radius: 10px;
}

/* Date Filter */
.filter-date-options {
  padding: 8px 12px;
}

.filter-date-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  font-size: 13px;
  color: var(--text-body);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.filter-date-option:hover {
  background: var(--bg-hover);
}

.filter-date-option.selected {
  background: var(--primary-50);
  color: var(--primary);
}

/* Filter Footer */
.filter-dropdown-footer {
  padding: 8px 12px;
  border-top: 1px solid var(--border-muted);
  display: flex;
  gap: 8px;
}

.filter-dropdown-footer .btn {
  flex: 1;
  padding: 6px 12px;
  font-size: 12px;
}

/* Active Filter Tags */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.active-filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--primary-50);
  color: var(--primary);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
}

.active-filter-tag .remove {
  cursor: pointer;
  opacity: 0.7;
}

.active-filter-tag .remove:hover {
  opacity: 1;
}

.clear-all-filters {
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
}

.clear-all-filters:hover {
  color: var(--primary);
}

/* No Results */
.filter-no-results {
  padding: 16px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* Table Row Highlighting */
.table tbody tr.filter-match {
  background: var(--primary-50);
}

/* --------------------------------------------------------------------------
   Date Hierarchy Filter
   -------------------------------------------------------------------------- */
.filter-date-hierarchy {
  max-height: 300px;
  overflow-y: auto;
  padding: 4px 0;
}

.date-tree {
  padding: 0;
}

.date-year {
  border-bottom: 1px solid var(--border-muted);
}

.date-year:last-child {
  border-bottom: none;
}

.date-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

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

/* Only checkbox gets purple when selected, not the whole row */
.date-item.selected .filter-value-checkbox {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.date-item.selected .filter-value-checkbox i {
  opacity: 1;
}

.date-item.partial .filter-value-checkbox {
  background: var(--primary-light);
  border-color: var(--primary-light);
  color: white;
}

.date-item.partial .filter-value-checkbox i {
  opacity: 1;
}

.date-year-header {
  font-weight: 600;
  color: var(--text-heading);
}

.date-month-header {
  padding-left: 28px;
  font-weight: 500;
}

.date-day {
  padding-left: 52px;
  font-size: 13px;
}

.date-expand-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
  flex-shrink: 0;
  border-radius: 3px;
  transition: all var(--transition-fast);
}

.date-expand-icon:hover {
  background: var(--bg-muted);
  color: var(--text-heading);
}

.date-label {
  flex: 1;
}

.date-months,
.date-days {
  background: var(--bg-muted);
}

.date-days {
  background: rgba(0,0,0,0.02);
}

/* Hide expand icon for days */
.date-day .date-expand-icon {
  display: none;
}

.date-day {
  padding-left: 44px;
}

/* --------------------------------------------------------------------------
   Dashboard Tabs
   -------------------------------------------------------------------------- */
.dashboard-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.dashboard-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: -1px;
}

.dashboard-tab:hover {
  color: var(--text-body);
  background: var(--bg-hover);
}

.dashboard-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.dashboard-tab i {
  font-size: 16px;
}

/* --------------------------------------------------------------------------
   Link List (Vertriebler Dashboard)
   -------------------------------------------------------------------------- */
.link-list {
  display: flex;
  flex-direction: column;
}

.link-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  text-decoration: none;
  color: var(--text-body);
  border-bottom: 1px solid var(--border-light);
  transition: all var(--transition-fast);
}

.link-item:last-child {
  border-bottom: none;
}

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

.link-item-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--primary-50);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.link-item-content {
  flex: 1;
  min-width: 0;
}

.link-item-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-heading);
}

.link-item-arrow {
  color: var(--text-muted);
  font-size: 14px;
}

.link-item:hover .link-item-arrow {
  color: var(--primary);
  transform: translateX(2px);
}

.link-item:hover .link-item-icon {
  background: var(--primary);
  color: white;
}
