/* juunit Academy — Modern SaaS Redesign */
:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: rgba(79,70,229,0.08);
  --primary-glow: rgba(79,70,229,0.25);
  --success: #16a34a;
  --success-bg: rgba(22,163,74,0.08);
  --warning: #d97706;
  --warning-bg: rgba(217,119,6,0.08);
  --danger: #dc2626;
  --danger-bg: rgba(220,38,38,0.08);
  --info: #2563eb;
  --info-bg: rgba(37,99,235,0.08);

  --bg: #fafafa;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-hover: #f5f5f5;
  --bg-input: #ffffff;

  --border: rgba(0,0,0,0.08);
  --border-strong: rgba(0,0,0,0.12);

  --text: #111827;
  --text-secondary: #6b7280;
  --text-muted: #6b7280;
  --text-inverse: #ffffff;

  --radius: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.06), 0 4px 6px rgba(0,0,0,0.04);

  --sidebar-width: 240px;
  --sidebar-collapsed: 64px;
  --nav-height: 56px;
  --bottom-nav-height: 56px;

  --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', SFMono-Regular, ui-monospace, monospace;

  --transition: 150ms ease;

  --donut-text: #111827;
  --donut-subtext: #6b7280;
  --skeleton-from: #f0f0f0;
  --skeleton-mid: #e0e0e0;
}

/* ===== DARK THEME ===== */
[data-theme="dark"] {
  --bg: #0f1117;
  --bg-card: #1a1d27;
  --bg-sidebar: #1a1d27;
  --bg-hover: #252833;
  --bg-input: #252833;

  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.12);

  --text: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.2);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.3), 0 4px 6px rgba(0,0,0,0.2);

  --primary-light: rgba(129,140,248,0.18);
  --primary-glow: rgba(79,70,229,0.35);
  --success-bg: rgba(22,163,74,0.15);
  --warning-bg: rgba(217,119,6,0.15);
  --danger-bg: rgba(220,38,38,0.15);
  --info-bg: rgba(37,99,235,0.15);

  --donut-text: #ffffff;
  --donut-subtext: #cbd5e1;
  --skeleton-from: #252833;
  --skeleton-mid: #1a1d27;
}

/* ===== LOGO SWITCHING ===== */
.logo-dark { display: none; }
.logo-light { display: inline-block; }

[data-theme="dark"] .logo-dark { display: inline-block; }
[data-theme="dark"] .logo-light { display: none; }

/* Login page logo switching — inline styles set display:block, override with !important */
[data-theme="dark"] .login-logo .logo-dark { display: block !important; }
[data-theme="dark"] .login-logo .logo-light { display: none !important; }
.login-logo .logo-dark { display: none !important; }
.login-logo .logo-light { display: block !important; }

/* ===== RESET ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
  letter-spacing: -0.025em;
  line-height: 1.2;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ===== SIDEBAR (Desktop) ===== */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: width var(--transition);
  overflow: hidden;
}

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.sidebar-logo:hover { text-decoration: none; }

.sidebar-logo-img {
  flex-shrink: 0;
}

.sidebar-logo-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0;
}

.sidebar-logo-icon {
  width: 28px; height: 28px;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 0.875rem;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-user-info {
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  display: block;
  text-overflow: ellipsis;
  overflow: hidden;
}

.sidebar-user-role {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 8px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  margin-bottom: 2px;
}
.sidebar-nav-item:hover {
  background: var(--bg-hover);
  color: var(--text);
  text-decoration: none;
}
.sidebar-nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.sidebar-nav-item span:first-child {
  font-size: 1.125rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px 8px 24px;
  border-top: 1px solid var(--border);
}

.sidebar-footer .sidebar-nav-item {
  color: var(--text-muted);
}

/* ===== THEME TOGGLE ===== */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  margin: 0 4px 8px;
  background: var(--bg-hover);
  border-radius: var(--radius);
}

.theme-toggle-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 6px 0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  line-height: 1;
  transition: all var(--transition);
  color: var(--text-muted);
}

.theme-toggle-btn:hover {
  color: var(--text);
}

.theme-toggle-btn.active {
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  color: var(--text);
}

/* Sidebar collapsed (tablet) */
@media (min-width: 768px) and (max-width: 1024px) {
  .sidebar {
    width: var(--sidebar-collapsed);
  }
  .sidebar-logo span:last-child,
  .sidebar-logo-label,
  .sidebar-user-info,
  .sidebar-nav-item span:last-child,
  .sidebar-footer .sidebar-nav-item span:last-child {
    display: none;
  }
  .sidebar-logo-img { width: 28px !important; }
  .sidebar-nav-item {
    justify-content: center;
    padding: 10px;
  }
  .sidebar-nav-item span:first-child {
    width: auto;
  }
  .sidebar-header { padding: 24px 12px 20px; }
  .sidebar-user { padding: 16px 12px; justify-content: center; }
  .sidebar-footer .sidebar-nav-item { justify-content: center; }
  .sidebar-logo { justify-content: center; }
  .main-content { margin-left: var(--sidebar-collapsed); }
  .theme-toggle { flex-direction: column; margin: 0 4px 8px; }
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);  /* default desktop, overridden by @media below */
  min-height: 100vh;
  transition: margin-left var(--transition);
}
@media (min-width: 768px) and (max-width: 1024px) {
  .main-content { margin-left: var(--sidebar-collapsed) !important; }
}

.main-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 32px 48px;
}

/* ===== MOBILE TOPNAV ===== */
.mobile-topnav {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
}

.mobile-topnav-logo {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  letter-spacing: -0.03em;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mobile-topnav-logo:hover { text-decoration: none; }

.mobile-topnav-logo span {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ===== MOBILE BOTTOM NAV ===== */
.bottomnav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  align-items: center;
  justify-content: space-around;
  z-index: 100;
}

.bottomnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.625rem;
  font-weight: 500;
  padding: 8px 0;
  min-width: 48px;
  min-height: 44px;
  flex: 1;
  transition: color var(--transition);
}
.bottomnav-item:hover { text-decoration: none; }
.bottomnav-item span:first-child { font-size: 1.25rem; }
.bottomnav-item:hover, .bottomnav-item.active { color: var(--primary); }

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 767px) {
  .sidebar { display: none; }
  .mobile-topnav { display: flex; }
  .bottomnav { display: flex; }
  .main-content {
    margin-left: 0;
    padding-top: var(--nav-height);
    padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
  }
  .main-inner { padding: 16px 16px 24px; }
}

@media (min-width: 1025px) {
  .main-content { margin-left: var(--sidebar-width); }
}

/* ===== USER AVATAR ===== */
.avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.avatar-sm { width: 28px; height: 28px; font-size: 0.6875rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1rem; }
.avatar-technik { background: #3b82f6; }
.avatar-vertrieb { background: #16a34a; }
.avatar-marketing { background: #9333ea; }
.avatar-backoffice { background: #d97706; }
.avatar-gf, .avatar-admin { background: #4f46e5; }
.avatar-default { background: #6b7280; }

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}
.card-hover:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: var(--border-strong);
}
.card h3 { font-size: 0.9375rem; margin-bottom: 4px; }
.card p { font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 8px; }

/* ===== TRAINING CARDS ===== */
.training-card {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}
.training-card:hover { text-decoration: none; }
.training-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}
.tag-category { background: var(--primary-light); color: var(--primary); }
.tag-level { background: rgba(6,182,212,0.08); color: #0891b2; }
.tag-cert { background: var(--success-bg); color: var(--success); }
.tag-online { background: rgba(139,92,246,0.08); color: #7c3aed; }
.tag-price { font-weight: 700; color: var(--text); font-size: 0.9375rem; }

[data-theme="dark"] .tag-level { background: rgba(6,182,212,0.15); color: #22d3ee; }
[data-theme="dark"] .tag-online { background: rgba(139,92,246,0.15); color: #a78bfa; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  font-family: var(--font);
  line-height: 1.25;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn-primary { background: var(--primary); color: var(--text-inverse); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--bg); border: 1px solid var(--border-strong); color: var(--text); }
.btn-secondary:hover { background: var(--bg-hover); border-color: rgba(0,0,0,0.16); }
.btn-success { background: var(--success); color: var(--text-inverse); }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--danger); color: var(--text-inverse); }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 12px; font-size: 0.8125rem; }

[data-theme="dark"] .btn-secondary { background: var(--bg-card); border-color: var(--border-strong); }
[data-theme="dark"] .btn-secondary:hover { background: var(--bg-hover); border-color: rgba(255,255,255,0.2); }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--text);
  background: var(--bg-input);
  font-family: var(--font);
  transition: all var(--transition);
}
.form-group textarea {
  height: auto;
  min-height: 80px;
  resize: vertical;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

[data-theme="dark"] .form-group select option {
  background: var(--bg-card);
  color: var(--text);
}

/* ===== TOAST / FLASH MESSAGES ===== */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn 300ms ease forwards;
  max-width: 400px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.toast-error { border-left: 3px solid var(--danger); color: var(--danger); }
.toast-success { border-left: 3px solid var(--success); color: var(--success); }
.toast-info { border-left: 3px solid var(--info); color: var(--info); }

.toast-dismiss {
  animation: toastOut 300ms ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(24px); }
}

/* Legacy alert fallback (for in-page alerts) */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 0.875rem; }
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(220,38,38,0.15); }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(22,163,74,0.15); }
.alert-info { background: var(--info-bg); color: var(--info); border: 1px solid rgba(37,99,235,0.15); }

[data-theme="dark"] .alert-error { border-color: rgba(220,38,38,0.3); }
[data-theme="dark"] .alert-success { border-color: rgba(22,163,74,0.3); }
[data-theme="dark"] .alert-info { border-color: rgba(37,99,235,0.3); }

/* ===== STATUS PILLS ===== */
.status {
  display: inline-block;
  padding: 3px 12px;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.status-angefragt { background: var(--warning-bg); color: var(--warning); }
.status-gebucht { background: var(--info-bg); color: var(--info); }
.status-besucht { background: var(--success-bg); color: var(--success); }
.status-storniert { background: var(--danger-bg); color: var(--danger); }
.status-abgelehnt { background: rgba(107,114,128,0.1); color: #4b5563; }
.status-anbieter_storniert { background: var(--danger-bg); color: var(--danger); }
.status-pending { background: var(--warning-bg); color: var(--warning); }
.status-pending_approval { background: var(--warning-bg); color: var(--warning); }
.status-approved { background: var(--success-bg); color: var(--success); }

[data-theme="dark"] .status-abgelehnt { background: rgba(107,114,128,0.2); color: #9ca3af; }

/* ===== FILTERS ===== */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
.filters select,
.filters input {
  height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: var(--font);
  background: var(--bg-card);
  color: var(--text);
  transition: all var(--transition);
}
.filters select:focus,
.filters input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

[data-theme="dark"] .filters select option {
  background: var(--bg-card);
  color: var(--text);
}

/* Search input with inline clear button — works inside .filters or standalone */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 420px;
  margin-bottom: 16px;
}
.search-wrap > input[data-live-filter] {
  width: 100%;
  height: 40px;
  padding: 8px 40px 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: var(--font);
  background: var(--bg-card);
  color: var(--text);
  transition: all var(--transition);
}
.search-wrap > input[data-live-filter]:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-glow);
}
/* Inside .filters, integrate without margin/maxwidth so flex row still works */
.filters .search-wrap {
  margin-bottom: 0;
  flex: 1 1 200px;
  max-width: none;
}
/* Full-width on mobile so the clear button has room */
@media (max-width: 767px) {
  .search-wrap { max-width: none; flex: 1 1 100%; }
  .filters .search-wrap { flex: 1 1 100%; }
  .search-wrap > input[data-live-filter] { min-height: 44px; }
}
.search-clear {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all var(--transition);
}
.search-clear:hover, .search-clear:focus-visible {
  background: var(--bg-subtle, rgba(0,0,0,0.06));
  color: var(--text);
  outline: none;
}
.search-clear[hidden] { display: none !important; }

/* ===== TABLES ===== */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; font-size: 0.875rem; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
tr:hover td { background: var(--bg-hover); }

/* ===== BUDGET ===== */
.budget-donut { width: 140px; height: 140px; margin: 0 auto 16px; }
.budget-legend { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; font-size: 0.8125rem; color: var(--text-secondary); }
.budget-legend-item { display: flex; align-items: center; gap: 6px; }
.budget-dot { width: 10px; height: 10px; border-radius: var(--radius-full); }

/* ===== PAGE HEADER ===== */
.page-header { margin-bottom: 24px; }
.page-header h1, .page-header h2 { font-size: 1.375rem; font-weight: 700; margin-bottom: 4px; }
.page-header p { font-size: 0.875rem; color: var(--text-secondary); }

/* ===== DETAIL PAGE ===== */
.detail-header { margin-bottom: 20px; }
.detail-header h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; }
.detail-section { margin-bottom: 24px; }
.detail-section h3 { font-size: 0.9375rem; margin-bottom: 8px; color: var(--primary); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-item label { font-size: 0.6875rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; display: block; margin-bottom: 2px; }
.detail-item span { font-size: 0.9375rem; font-weight: 500; }

/* ===== TRAVEL INFO ===== */
.travel-info {
  background: rgba(79,70,229,0.03);
  border: 1px solid rgba(79,70,229,0.1);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
}
.travel-info h4 { font-size: 0.875rem; color: var(--primary); margin-bottom: 8px; }
.travel-row { display: flex; justify-content: space-between; font-size: 0.875rem; padding: 4px 0; color: var(--text-secondary); }

[data-theme="dark"] .travel-info {
  background: rgba(79,70,229,0.08);
  border-color: rgba(79,70,229,0.2);
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 3.5rem; margin-bottom: 16px; opacity: 0.6; }
.empty-state-title {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.empty-state p { font-size: 0.9375rem; margin-bottom: 24px; }
.empty-state .btn { margin-top: 0; }

/* ===== SKELETON SHIMMER ===== */
.skeleton {
  background: linear-gradient(90deg, var(--skeleton-from) 25%, var(--skeleton-mid) 50%, var(--skeleton-from) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}
.skeleton-card {
  height: 120px;
  margin-bottom: 12px;
}
.skeleton-line {
  height: 14px;
  margin-bottom: 8px;
  width: 60%;
}
.skeleton-line-short { width: 40%; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== BACK LINK ===== */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition);
  margin-bottom: 16px;
}
.back-link:hover {
  color: var(--primary);
  text-decoration: none;
}

/* ===== LOGIN PAGE ===== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
  background: var(--bg);
}
.login-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-md);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 {
  font-size: 1.375rem;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.03em;
}
.login-logo p { font-size: 0.875rem; color: var(--text-muted); margin-top: 4px; }
.login-logo-icon {
  width: 48px; height: 48px;
  background: var(--primary);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 auto 16px;
}

/* ===== TRAINING LIST GRID ===== */
.training-list {
  display: grid;
  gap: 12px;
}

@media (min-width: 640px) {
  .training-list { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 768px) {
  .detail-grid { grid-template-columns: 1fr 1fr 1fr; }
}

/* ===== CONTENT / CONTAINER ===== */
.content { max-width: 1280px; margin: 0 auto; padding: 16px; }
.container { max-width: 1280px; margin: 0 auto; }

/* ===== FOCUS VISIBLE ===== */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
}

/* ===== UTILITY ===== */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }

/* ===== MOBILE TOAST POSITION ===== */
@media (max-width: 767px) {
  .toast-container {
    top: calc(var(--nav-height) + 8px);
    left: 16px;
    right: 16px;
  }
  .toast { max-width: 100%; }
}

/* ===== DARK MODE — SCROLLBAR ===== */
[data-theme="dark"] ::-webkit-scrollbar { width: 8px; height: 8px; }
[data-theme="dark"] ::-webkit-scrollbar-track { background: var(--bg); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ===== DARK MODE — MISC FIXES ===== */
[data-theme="dark"] img:not(.logo-dark):not(.logo-light):not(.sidebar-logo-img) {
  opacity: 0.9;
}

[data-theme="dark"] ::selection {
  background: rgba(79,70,229,0.4);
  color: #fff;
}

/* ===== SVG NAV ICONS ===== */
.nav-icon { display: inline-flex; align-items: center; vertical-align: middle; }
.nav-icon svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-nav-item .nav-icon, .bottomnav-item .nav-icon { margin-right: 2px; }
.theme-toggle-btn { display: inline-flex; align-items: center; justify-content: center; }
.theme-toggle-btn svg { width: 16px; height: 16px; }

/* ===== STAR RATINGS ===== */
.star-rating { display: inline-flex; align-items: center; gap: 1px; font-size: 0; line-height: 1; }
.star-rating .star { font-size: 14px; line-height: 1; }
.star-rating .star-filled { color: #f59e0b; }
.star-rating .star-half { color: #f59e0b; opacity: 0.6; }
.star-rating .star-empty { color: #d1d5db; }
[data-theme="dark"] .star-rating .star-empty { color: #4b5563; }
.star-rating .star-value { font-size: 0.8125rem; color: var(--text-secondary); margin-left: 4px; font-weight: 500; }
.detail-rating { margin: 8px 0 12px; }
.detail-rating .star { font-size: 18px; }
.detail-rating .star-value { font-size: 1rem; }

/* ===== HIDDEN TRAINING CARD ===== */
.card-hidden { opacity: 0.55; border-style: dashed; }
.card-hidden:hover { opacity: 0.8; }
.tag-hidden { background: var(--danger-bg); color: var(--danger); font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-full); margin-bottom: 4px; display: inline-block; }

/* ===== FILTER TOGGLE ===== */
.filter-toggle input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

/* ===== INFO TOOLTIP ===== */
.info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  font-style: italic;
  font-family: Georgia, serif;
  cursor: help;
  position: relative;
  vertical-align: middle;
  margin-left: 8px;
  transition: background 150ms ease, color 150ms ease;
}
.info-tip:hover {
  background: var(--primary);
  color: white;
}
.info-tip .tip-text {
  display: none;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(100% + 8px);
  width: 280px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  font-size: 13px;
  font-weight: 400;
  font-style: normal;
  font-family: inherit;
  line-height: 1.5;
  color: var(--text-secondary);
  z-index: 1000;
  text-align: left;
  white-space: normal;
}
.info-tip:hover .tip-text {
  display: block;
}
[data-theme="dark"] .info-tip .tip-text {
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
@media (max-width: 768px) {
  .info-tip .tip-text {
    left: auto;
    right: -8px;
    transform: none;
    width: 240px;
  }
}


/* ===== USER MANAGEMENT ===== */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; table-layout: fixed; }
.data-table th { text-align: left; padding: 10px 12px; border-bottom: 2px solid var(--border-strong); color: var(--text-secondary); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; overflow: hidden; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; overflow: hidden; text-overflow: ellipsis; }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table .row-inactive { opacity: 0.5; }
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Column widths */
.data-table th:nth-child(1), .data-table td:nth-child(1) { width: 20%; }
.data-table th:nth-child(2), .data-table td:nth-child(2) { width: 22%; }
.data-table th:nth-child(3), .data-table td:nth-child(3) { width: 12%; }
.data-table th:nth-child(4), .data-table td:nth-child(4) { width: 12%; }
.data-table th:nth-child(5), .data-table td:nth-child(5) { width: 12%; }
.data-table th:nth-child(6), .data-table td:nth-child(6) { width: 10%; }
.data-table th:nth-child(7), .data-table td:nth-child(7) { width: 12%; }

.badge { display: inline-block; padding: 2px 8px; border-radius: var(--radius-full); font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.badge-admin { background: var(--danger-bg); color: var(--danger); }
.badge-gf { background: var(--info-bg); color: var(--info); }
.badge-teamleiter { background: var(--warning-bg); color: var(--warning); }
.badge-backoffice { background: var(--success-bg); color: var(--success); }
.badge-mitarbeiter { background: var(--primary-light); color: var(--primary); }
.badge-azubi { background: rgba(168,85,247,0.08); color: #a855f7; }

.status-active { color: var(--success); }
.status-inactive { color: var(--text-muted); }

.avatar-xs { width: 28px; height: 28px; font-size: 0.625rem; flex-shrink: 0; }

.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.page-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }

/* Mobile: table as cards + single column form */
@media (max-width: 768px) {
  .data-table { table-layout: auto; }
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100% !important; }
  .data-table th:nth-child(n), .data-table td:nth-child(n) { width: 100% !important; }
  .data-table tr { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 8px; }
  .data-table td { padding: 4px 0; border: none; overflow: visible; }
}

@media (max-width: 500px) {
  .detail-grid { grid-template-columns: 1fr !important; }
}

/* ===== ACCESSIBILITY FIXES ===== */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  padding: 12px 24px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius);
  z-index: 9999;
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
}
.skip-link:focus { top: 16px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== TOUCH TARGET FIXES ===== */
.sidebar-nav-item { min-height: 44px; }
.theme-toggle-btn { min-height: 36px; padding: 8px 0; }
a, button, input, select, textarea, [role="button"] { touch-action: manipulation; }

.filters select,
.filters input,
.form-group input,
.form-group select,
.form-group textarea { min-height: 44px; }

/* ===== BOTTOM NAV FIX (max 5 items) ===== */
.bottomnav { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.bottomnav-item { min-width: 44px; flex: 1 0 auto; font-size: 0.6875rem; min-height: 44px; }
.bottomnav-item span:last-child { font-size: 0.625rem; }

/* ===== BUTTON LOADING STATE ===== */
.btn-loading .btn-text { visibility: hidden; }
.btn-loading .btn-spinner {
  position: absolute;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}
.btn-loading { position: relative; pointer-events: none; opacity: 0.7; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== MICROSOFT SSO BUTTON ===== */
.btn-microsoft {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px 24px;
  background: var(--bg-card);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  min-height: 48px;
}
.btn-microsoft:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  text-decoration: none;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ===== AVATAR IMAGE ===== */
.avatar-img {
  object-fit: cover;
  border-radius: 50%;
}
img.avatar { border: 2px solid var(--border); }

/* ===== TRAINING DESCRIPTION ===== */
.training-description { font-size: 0.9375rem; line-height: 1.7; }
.training-description h4 { font-size: 1rem; font-weight: 700; margin: 28px 0 8px; color: var(--text); }
.training-description h4:first-child { margin-top: 0; }
.training-description ul { margin: 2px 0 8px 20px; line-height: 1.3; }
.training-description li { margin-bottom: 0; color: var(--text-secondary); }
.training-description p { margin-bottom: 12px; color: var(--text-secondary); }

/* ===== NAV BADGE ===== */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: white;
  font-size: 0.6875rem;
  font-weight: 700;
  margin-left: 6px;
}

/* ===== FEEDBACK MODAL ===== */
.feedback-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.feedback-modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
}
.feedback-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.feedback-header h3 { font-size: 1rem; margin: 0; }
.feedback-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.feedback-close:hover { color: var(--text); }
.feedback-body { padding: 20px; }
.feedback-cats { display: flex; gap: 12px; margin-top: 8px; }
.feedback-cat { cursor: pointer; display: flex; align-items: center; gap: 4px; }
.feedback-cat input { width: auto; min-height: auto; }
.feedback-body textarea { width: 100%; resize: vertical; }
.feedback-body .btn { margin-top: 12px; }

/* Feedback button in sidebar */
.sidebar-feedback-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  border-radius: var(--radius);
  min-height: 44px;
}
.sidebar-feedback-btn:hover { background: var(--bg-hover); color: var(--text); }

/* ===== MOBILE USER MENU ===== */
.mobile-user-menu { position: relative; }
.mobile-avatar-btn { background: none; border: none; cursor: pointer; padding: 0; }
.mobile-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: 300;
  overflow: hidden;
}
.mobile-user-menu.open .mobile-dropdown { display: block; }
.mobile-dropdown-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.875rem;
}
.mobile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 0.875rem;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  cursor: pointer;
  text-align: left;
}
.mobile-dropdown-item:hover { background: var(--bg-hover); text-decoration: none; }
.mobile-dropdown-item svg { width: 16px; height: 16px; }

/* ===== BOTTOMNAV EXPANDABLE ===== */
.bottomnav-row { display: flex; align-items: center; justify-content: space-around; width: 100%; }
.bottomnav-primary { flex: 1; }
.bottomnav-secondary {
  display: none;
  border-top: 1px solid var(--border);
  padding-top: 4px;
  margin-top: 4px;
  flex-wrap: wrap;
  gap: 4px;
}
.bottomnav-secondary.open { display: flex; }
.bottomnav-more {
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.bottomnav { flex-wrap: wrap; }

/* Fix: bottomnav expand upward */
.bottomnav {
  flex-direction: column-reverse;
  height: auto;
  min-height: var(--bottom-nav-height);
}
.bottomnav-secondary {
  background: var(--bg-card);
  padding: 6px 0;
}
.bottomnav-secondary.open {
  display: flex;
  justify-content: space-around;
}

/* Prevent long strings from breaking layout */
body { overflow-wrap: anywhere; }
.card, .log-card, .data-table td, .feedback-item { overflow-wrap: anywhere; word-break: break-word; min-width: 0; }
p, td, th, .detail-chip, .log-card-body { overflow-wrap: anywhere; word-break: break-word; max-width: 100%; min-width: 0; }
pre, code { white-space: pre-wrap; word-break: break-all; overflow-wrap: anywhere; }
/* Flex children must allow shrinking below min-content for word-break */
.card-grid > *, .feedback-list > *, main, .main-content, .container { min-width: 0; }
/* Catalog mobile 375 overflow fix */
@media (max-width: 767px) {
  .main-content { max-width: 100vw; overflow-x: hidden; padding-left: 12px; padding-right: 12px; }
  .container { max-width: 100%; padding-left: 0; padding-right: 0; }
}

/* Role-based recommendations */
.card-recommended { border-color: var(--primary); border-width: 2px; position: relative; }
.tag-recommended { background: var(--primary); color: white; font-weight: 600; padding: 4px 10px; display: inline-flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.tag-recommended svg { width: 12px; height: 12px; }

/* Role picker badges */
.role-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.role-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 8px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.role-badge:hover {
  border-color: var(--primary);
  background: var(--bg);
}
.role-badge.selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.role-badge.selected:hover {
  background: var(--primary);
  filter: brightness(1.1);
}
.role-badge .role-dept {
  font-size: 0.7rem;
  font-weight: 400;
  opacity: 0.7;
  margin-top: 2px;
}
.role-badge.selected .role-dept {
  opacity: 0.9;
}

/* Mobile: convert data tables to card layout */
@media (max-width: 767px) {
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100% !important; }
  .data-table th:nth-child(n), .data-table td:nth-child(n) { width: 100% !important; }
  .data-table tr {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
  }
  .data-table td {
    padding: 4px 0;
    border: none;
    text-align: left;
  }
  .data-table td:first-child strong {
    font-size: 1rem;
    display: block;
    margin-bottom: 4px;
  }
  .data-table td .badge,
  .data-table td .status,
  .data-table td .tag {
    display: inline-block;
    margin-right: 6px;
  }
  .data-table .row-inactive { opacity: 0.6; }
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
}

/* Critical fix: feedback card handles long unbreakable strings */
.feedback-item, .feedback-item p, .feedback-item .card, .card p {
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

/* Critical fix: bottom nav overlap - add padding to main-content bottom on mobile */
@media (max-width: 767px) {
  .main-content {
    padding-bottom: calc(var(--bottom-nav-height, 80px) + 20px + env(safe-area-inset-bottom, 0px)) !important;
  }
  /* When secondary nav is open, add extra padding */
  body:has(.bottomnav-secondary.open) .main-content {
    padding-bottom: calc(var(--bottom-nav-height, 80px) * 2 + 20px) !important;
  }
}

/* Favorites star on catalog cards */
.training-card { position: relative; }
.fav-star {
  position: absolute;
  top: 12px;
  right: 12px;
  color: #f59e0b;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.fav-star svg { width: 20px; height: 20px; }

/* Fix contrast for tags in dark mode */
[data-theme="dark"] .tag-category,
[data-theme="dark"] .tag-cert {
  color: #a5b4fc;
  background: rgba(129,140,248,0.15);
}
[data-theme="dark"] .tag-level {
  color: #67e8f9;
  background: rgba(103,232,249,0.12);
}
[data-theme="dark"] .tag-price {
  color: #fde047;
  background: rgba(253,224,71,0.12);
}

/* Location tag on training cards */
.tag-location {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(99,102,241,0.08);
  color: var(--primary);
  font-size: 0.7rem;
}
.tag-location svg { width: 12px; height: 12px; }
[data-theme="dark"] .tag-location {
  color: #a5b4fc;
  background: rgba(165,180,252,0.12);
}


/* ==============================================================
   Collapsible filter bar (mobile-first)
   Desktop: filters always expanded, toggle hidden
   Mobile: filters collapsed by default (unless active filter exists)
   ============================================================== */
.filters-collapse {
  display: contents;
}
.filters-toggle {
  display: none;
}
.filters-body {
  display: contents;
}

@media (max-width: 767px) {
  .filters { flex-direction: column; align-items: stretch; }
  .filters-collapse {
    display: block;
    width: 100%;
  }
  .filters-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    list-style: none;
    user-select: none;
  }
  .filters-toggle::-webkit-details-marker { display: none; }
  .filters-toggle::after {
    content: '▾';
    font-size: 1rem;
    transition: transform var(--transition);
  }
  .filters-collapse[open] .filters-toggle::after {
    transform: rotate(180deg);
  }
  .filters-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    padding: 12px;
    background: var(--bg-subtle, rgba(0,0,0,0.04));
    border-radius: var(--radius);
  }
  .filters-body select {
    width: 100%;
  }
  .filters-body label {
    width: 100%;
    display: flex !important;
    align-items: center;
    gap: 10px !important;
    padding: 10px 4px;
    justify-content: flex-start;
  }
  .filters-body label .nav-icon {
    flex: 0 0 auto;
  }
  .filters-body label input[type="checkbox"] {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
  }
  .filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--primary);
    color: white;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 4px;
  }
}

/* ===== DESKTOP FILTER VISIBILITY FIX =====
   <details> native behavior hides content without [open].
   On desktop, force filters visible regardless of open state. */
@media (min-width: 768px) {
  .filters-collapse > .filters-body,
  .filters-collapse:not([open]) > .filters-body {
    display: contents !important;
  }
  .filters-collapse > .filters-toggle,
  .filters-collapse:not([open]) > .filters-toggle {
    display: none !important;
  }
}
