/* ==========================================================================
   Win3 Academy - Layout System
   Header, sidebar, navigation, grid helpers, responsive breakpoints
   ========================================================================== */

/* --------------------------------------------------------------------------
   Public Header
   -------------------------------------------------------------------------- */
/* --- Header (stevensolbach.de style) --- */
.ss-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-sticky);
  background: transparent;
  transition: background 0.4s ease, backdrop-filter 0.4s ease, -webkit-backdrop-filter 0.4s ease, transform 0.35s ease;
}

/* Hide on scroll down */
.ss-header.header-hidden {
  transform: translateY(-100%);
}

/* Inner container */
.ss-header-inner {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 60px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Gold decorative lines (top + bottom) */
.ss-header-inner::before,
.ss-header-inner::after {
  content: '';
  position: absolute;
  left: 16px;
  right: 16px;
  height: 1.5px;
  background: linear-gradient(90deg, transparent 0%, var(--accent-gold) 3%, var(--accent-gold) 97%, transparent 100%);
  opacity: 0.65;
  pointer-events: none;
  mask-image: var(--line-mask, none);
  -webkit-mask-image: var(--line-mask, none);
}

.ss-header-inner::before {
  top: 18px;
}

.ss-header-inner::after {
  bottom: 18px;
}

/* Glass panel (always visible) */
.ss-header-glass {
  position: absolute;
  top: 18px;
  left: 12px;
  right: 12px;
  bottom: 18px;
  border-radius: 16px;
  background: rgba(26, 26, 26, 0.65);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--gold-10);
  pointer-events: none;
  z-index: 0;
}

[data-theme="light"] .ss-header-glass {
  background: rgba(255, 255, 255, 0.65);
  border-color: rgba(188, 128, 52, 0.15);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
}

/* Logo background circle - opaque disc behind logo to block lines through transparent PNG */
.ss-header-logo-bg {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(26, 26, 26, 0.65) 55%, rgba(26, 26, 26, 0.65) 65%, transparent 100%);
  z-index: 1;
  pointer-events: none;
  /* Size/position set by JS (initGoldLineGap) */
}

[data-theme="light"] .ss-header-logo-bg {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.65) 55%, rgba(255, 255, 255, 0.65) 65%, transparent 100%);
}

/* Logo */
.ss-header-logo {
  display: block;
  text-decoration: none;
  flex-shrink: 0;
  height: 130px;
  position: relative;
  z-index: 2;
}

.ss-header-logo img {
  height: 100%;
  width: auto;
  object-fit: contain;
}

/* Logo theme swap: dark mode shows light logo, light mode shows dark logo */
.logo-light { display: none; }
.logo-dark  { display: block; }

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

/* Enhance gold emblem visibility on light backgrounds */
[data-theme="light"] .ss-header-logo .logo-light {
  filter: drop-shadow(0 1px 2px rgba(120, 80, 20, 0.35)) contrast(1.3) saturate(1.4);
}

.ss-header-logo-link {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  text-decoration: none;
}

/* Nav container */
.ss-header-nav {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Nav links */
.ss-header-link {
  font-family: var(--font-body, 'Poppins', sans-serif);
  font-size: 14px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  transition: color 0.25s ease, background 0.25s ease;
  position: relative;
  white-space: nowrap;
}

.ss-header-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

/* Active state (academy route matching) */
.ss-header-link.active {
  color: var(--accent-gold);
}

.ss-header-link.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 14px;
  right: 14px;
  height: 2px;
  background: var(--accent-gold);
  border-radius: 1px;
}

[data-theme="light"] .ss-header-link {
  color: rgba(45, 39, 38, 0.55);
}

[data-theme="light"] .ss-header-link:hover {
  color: var(--text-primary, #2D2726);
  background: rgba(45, 39, 38, 0.05);
}

[data-theme="light"] .ss-header-link.active {
  color: var(--accent-gold);
}

/* Nav divider */
.ss-header-divider {
  width: 1px;
  height: 24px;
  background: var(--gold-25);
  margin: 0 4px;
  flex-shrink: 0;
}

/* CTA button */
.ss-header-cta {
  font-family: var(--font-body, 'Poppins', sans-serif);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #1a1a1a;
  background: linear-gradient(135deg, #BC8034, #D4A24C);
  padding: 7px 18px;
  border-radius: 16px;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ss-header-cta svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  flex-shrink: 0;
}

.ss-header-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(188, 128, 52, 0.3);
  color: #fff;
  background: linear-gradient(135deg, #A06A20, #BC8034);
}

/* Header actions (right side - theme toggle, avatar, etc.) */
.ss-header-actions {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: var(--space-md, 16px);
  flex-shrink: 0;
}

/* Theme toggle button */
.theme-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md, 8px);
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

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

[data-theme="light"] .theme-toggle {
  color: rgba(45, 39, 38, 0.5);
}

[data-theme="light"] .theme-toggle:hover {
  background: rgba(45, 39, 38, 0.05);
  color: var(--text-primary, #2D2726);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* Header avatar (logged-in state) */
.header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--gold-25);
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.header-avatar:hover {
  border-color: var(--accent-gold);
}

/* Spacer to push content below fixed header */
.ss-header-spacer {
  height: 140px;
}

/* --------------------------------------------------------------------------
   Hamburger Menu (Mobile)
   -------------------------------------------------------------------------- */
.ss-header-hamburger {
  display: none;
  position: relative;
  z-index: 2;
  width: 36px;
  height: 36px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: background 0.2s ease;
  color: rgba(255, 255, 255, 0.7);
}

.ss-header-hamburger:hover {
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .ss-header-hamburger {
  color: var(--text-primary, #2D2726);
}

[data-theme="light"] .ss-header-hamburger:hover {
  background: rgba(45, 39, 38, 0.05);
}

.ss-header-hamburger-line {
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.ss-header-hamburger.active .ss-header-hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.ss-header-hamburger.active .ss-header-hamburger-line:nth-child(2) {
  opacity: 0;
}

.ss-header-hamburger.active .ss-header-hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* --------------------------------------------------------------------------
   Mobile Menu + Overlay
   -------------------------------------------------------------------------- */
.ss-mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.ss-mobile-overlay.open {
  opacity: 1;
  visibility: visible;
}

.ss-mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  background: #2D2726;
  border-left: 1px solid var(--border-subtle);
  z-index: 99999;
  transform: translateX(100%);
  transition: transform 0.35s ease;
  overflow-y: auto;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

[data-theme="light"] .ss-mobile-menu {
  background: var(--bg-primary, #f8f6f3);
  border-left-color: var(--border-subtle);
}

.ss-mobile-menu.open {
  transform: translateX(0);
}

.ss-mobile-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.6);
  transition: background 0.2s ease, color 0.2s ease;
  cursor: pointer;
}

.ss-mobile-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

[data-theme="light"] .ss-mobile-close {
  color: var(--text-secondary);
}

[data-theme="light"] .ss-mobile-close:hover {
  background: rgba(45, 39, 38, 0.05);
  color: var(--text-primary);
}

.ss-mobile-close svg {
  width: 20px;
  height: 20px;
}

.ss-mobile-menu-logo {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

[data-theme="light"] .ss-mobile-menu-logo {
  border-bottom-color: var(--border-subtle);
}

.ss-mobile-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ss-mobile-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
  border-radius: 8px;
  transition: background 0.2s ease, color 0.2s ease;
  text-decoration: none;
}

[data-theme="light"] .ss-mobile-link {
  color: var(--text-secondary);
}

.ss-mobile-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

[data-theme="light"] .ss-mobile-link:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.ss-mobile-link.active {
  color: var(--accent-gold);
  background: rgba(188, 128, 52, 0.08);
}

.ss-mobile-link svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
}

.ss-mobile-cta {
  margin-top: 8px;
  background: linear-gradient(135deg, #BC8034 0%, #D4A04A 100%);
  color: #fff !important;
  border-radius: 10px;
  font-weight: 600;
}

.ss-mobile-cta:hover {
  background: linear-gradient(135deg, #D4A04A 0%, #BC8034 100%);
  color: #fff !important;
}

.ss-mobile-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

[data-theme="light"] .ss-mobile-footer {
  border-top-color: var(--border-subtle);
}

/* --- Light theme: gold lines --- */
[data-theme="light"] .ss-header-inner::before,
[data-theme="light"] .ss-header-inner::after {
  opacity: 0.5;
}

/* --- Mobile: <=900px --- */
@media (max-width: 900px) {
  .ss-header-inner {
    padding: 0 24px;
    height: 120px;
  }

  .ss-header-spacer {
    height: 120px;
  }

  .ss-header-nav {
    display: none;
  }

  .ss-header-hamburger {
    display: flex;
  }

  .ss-header-logo {
    height: 100px;
  }

  .ss-header-logo-bg {
    width: 120px;
    height: 120px;
  }

  .ss-header-glass {
    top: 15px;
    bottom: 15px;
  }

  .ss-header-inner::before {
    top: 15px;
  }

  .ss-header-inner::after {
    bottom: 15px;
  }
}

/* --- Small mobile: <=480px --- */
@media (max-width: 480px) {
  .ss-header-inner {
    padding: 0 16px;
    height: 100px;
  }

  .ss-header-spacer {
    height: 100px;
  }

  .ss-header-logo {
    height: 80px;
  }

  .ss-header-logo-bg {
    width: 100px;
    height: 100px;
  }

  .ss-header-glass {
    top: 10px;
    bottom: 10px;
  }

  .ss-header-inner::before {
    top: 10px;
  }

  .ss-header-inner::after {
    bottom: 10px;
  }
}

/* --------------------------------------------------------------------------
   Portal Sidebar
   -------------------------------------------------------------------------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 240px;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-subtle);
  z-index: var(--z-sidebar);
  display: flex;
  flex-direction: column;
  transition: width var(--transition-slow),
              background var(--transition-theme),
              border-color var(--transition-theme);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Sidebar: User section */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg) var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
}

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

.sidebar-user-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-tier {
  margin-top: 2px;
}

/* Sidebar: Navigation */
.sidebar-nav {
  flex: 1;
  padding: var(--space-sm) 0;
}

.sidebar-section-label {
  padding: var(--space-md) var(--space-md) var(--space-xs);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 8px var(--space-md);
  margin: 1px var(--space-sm);
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background var(--transition-fast),
              color var(--transition-fast),
              border-color var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-nav-item:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.sidebar-nav-item.active {
  color: var(--accent-gold);
  background: rgba(188, 128, 52, 0.08);
  border-left-color: var(--accent-gold);
  font-weight: 500;
}

.sidebar-nav-item svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
}

.sidebar-nav-item-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav-item-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: rgba(217, 105, 53, 0.15);
  color: var(--accent-orange);
  flex-shrink: 0;
}

/* Sidebar: Footer */
.sidebar-footer {
  padding: var(--space-md);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.sidebar-footer-btn {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 6px 10px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

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

.sidebar-footer-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* Sidebar: Collapsed state (icon-only) */
.sidebar-collapsed {
  width: 64px;
}

.sidebar-collapsed .sidebar-user-info,
.sidebar-collapsed .sidebar-section-label,
.sidebar-collapsed .sidebar-nav-item-label,
.sidebar-collapsed .sidebar-nav-item-badge,
.sidebar-collapsed .sidebar-footer-btn span {
  display: none;
}

.sidebar-collapsed .sidebar-user {
  justify-content: center;
  padding: var(--space-md) var(--space-sm);
}

.sidebar-collapsed .sidebar-nav-item {
  justify-content: center;
  padding: 10px;
  margin: 1px var(--space-xs);
  border-left: none;
  border-radius: var(--radius-md);
}

.sidebar-collapsed .sidebar-nav-item.active {
  background: var(--gold-10);
}

.sidebar-collapsed .sidebar-footer {
  flex-direction: column;
  align-items: center;
}

.sidebar-collapsed .sidebar-footer-btn {
  padding: 8px;
}

/* Sidebar: Collapse toggle */
.sidebar-collapse-toggle {
  position: absolute;
  top: 50%;
  right: -12px;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.sidebar-collapse-toggle:hover {
  background: var(--bg-secondary);
  border-color: var(--accent-gold);
}

.sidebar-collapse-toggle svg {
  width: 14px;
  height: 14px;
  stroke: var(--text-muted);
  fill: none;
  stroke-width: 2;
  transition: transform var(--transition-fast);
}

.sidebar-collapsed .sidebar-collapse-toggle svg {
  transform: rotate(180deg);
}

/* --------------------------------------------------------------------------
   Bottom Tab Bar (Mobile Portal)
   -------------------------------------------------------------------------- */
.bottom-tab-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-subtle);
  z-index: var(--z-sticky);
  padding: 0 var(--space-sm);
  padding-bottom: env(safe-area-inset-bottom, 0);
  transition: background var(--transition-theme), border-color var(--transition-theme);
}

.bottom-tab-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.bottom-tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 8px;
  min-width: 56px;
  color: var(--text-dim);
  cursor: pointer;
  transition: color var(--transition-fast);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.bottom-tab-item:hover,
.bottom-tab-item:active {
  color: var(--text-secondary);
}

.bottom-tab-item.active {
  color: var(--accent-gold);
}

.bottom-tab-item svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.bottom-tab-label {
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
}

/* --------------------------------------------------------------------------
   Main Content Area
   -------------------------------------------------------------------------- */
.main-content {
  flex: 1;
  min-height: 100vh;
  transition: margin-left var(--transition-slow), padding var(--transition-slow);
}

/* When sidebar is active (portal view) */
.has-sidebar .main-content {
  margin-left: 240px;
}

.has-sidebar.sidebar-is-collapsed .main-content {
  margin-left: 64px;
}

/* Public view (no sidebar, has header) */
.has-header .main-content {
  padding-top: 0; /* header is sticky, no extra padding needed */
}

/* --------------------------------------------------------------------------
   Page Container
   -------------------------------------------------------------------------- */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-xl);
}

.page-container-sm {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-xl);
}

.page-container-lg {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-xl);
}

.page-container-full {
  padding: var(--space-xl);
}

/* Page header (title + actions) */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
}

.page-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* --------------------------------------------------------------------------
   Section (Full-width content block)
   -------------------------------------------------------------------------- */
.section {
  padding: 60px 0;
}

.section-cta {
  padding: 80px 0;
}

.section-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.section-label {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent-gold);
  margin-bottom: var(--space-sm);
}

/* Headline sizes (responsive) */
.headline-xl {
  font-size: clamp(2rem, 4.4vw, 3.55rem);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.headline-lg {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
}

.headline-md {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
}

/* --------------------------------------------------------------------------
   Grid Helpers
   -------------------------------------------------------------------------- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
}

.grid-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-lg);
}

/* Auto-fit grids (responsive) */
.grid-auto-sm {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-lg);
}

.grid-auto-md {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.grid-auto-lg {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: var(--space-lg);
}

/* Split layout (e.g., ankerpraktik: list + editor) */
.split-view {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: var(--space-lg);
  min-height: calc(100vh - 64px);
}

.split-view-panel {
  overflow-y: auto;
}

/* --------------------------------------------------------------------------
   Responsive Breakpoints
   -------------------------------------------------------------------------- */

/* Tablet: 769px - 1024px */
@media (min-width: 769px) and (max-width: 1024px) {
  /* Sidebar auto-collapses on tablet */
  .sidebar {
    width: 64px;
  }

  .sidebar .sidebar-user-info,
  .sidebar .sidebar-section-label,
  .sidebar .sidebar-nav-item-label,
  .sidebar .sidebar-nav-item-badge,
  .sidebar .sidebar-footer-btn span {
    display: none;
  }

  .sidebar .sidebar-user {
    justify-content: center;
    padding: var(--space-md) var(--space-sm);
  }

  .sidebar .sidebar-nav-item {
    justify-content: center;
    padding: 10px;
    margin: 1px var(--space-xs);
    border-left: none;
  }

  .sidebar .sidebar-nav-item.active {
    background: var(--gold-10);
  }

  .sidebar .sidebar-footer {
    flex-direction: column;
    align-items: center;
  }

  .sidebar .sidebar-footer-btn {
    padding: 8px;
  }

  .has-sidebar .main-content {
    margin-left: 64px;
  }

  .page-container {
    padding: var(--space-lg);
  }

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

  .grid-5 {
    grid-template-columns: repeat(3, 1fr);
  }

  .split-view {
    grid-template-columns: 260px 1fr;
  }
}

/* Mobile: < 769px */
@media (max-width: 768px) {
  /* Hide sidebar on mobile */
  .sidebar {
    display: none;
  }

  .sidebar-collapse-toggle {
    display: none;
  }

  /* Remove sidebar margin */
  .has-sidebar .main-content,
  .has-sidebar.sidebar-is-collapsed .main-content {
    margin-left: 0;
  }

  /* Show bottom tab bar on mobile (portal only) */
  .has-sidebar .bottom-tab-bar {
    display: block;
  }

  /* Add padding at bottom for tab bar */
  .has-sidebar .main-content {
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0));
  }

  /* Page container */
  .page-container,
  .page-container-sm,
  .page-container-lg,
  .page-container-full {
    padding: var(--space-md);
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  /* All grids → single column on mobile */
  .grid-2,
  .grid-3,
  .grid-4,
  .grid-5 {
    grid-template-columns: 1fr;
  }

  /* Split view → stacked on mobile */
  .split-view {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  /* Section spacing */
  .section {
    padding: var(--space-2xl) 0;
  }

  .section-inner {
    padding: 0 var(--space-md);
  }

  /* Toast positioning on mobile */
  #toast-container {
    top: var(--space-md);
    right: var(--space-md);
    left: var(--space-md);
    max-width: none;
  }

  /* KPI cards → 2 columns on mobile */
  .kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
  }
}

/* Small mobile: < 375px */
@media (max-width: 374px) {
  .page-container,
  .page-container-sm,
  .page-container-lg,
  .page-container-full {
    padding: var(--space-sm);
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .bottom-tab-label {
    font-size: 0.5625rem;
  }
}

/* Large desktop: > 1280px */
@media (min-width: 1281px) {
  .page-container {
    padding: var(--space-2xl);
  }
}

/* --------------------------------------------------------------------------
   Print Styles
   -------------------------------------------------------------------------- */
@media print {
  .ss-header,
  .ss-header-spacer,
  .sidebar,
  .bottom-tab-bar,
  .ss-header-hamburger,
  .mobile-drawer,
  .mobile-drawer-overlay,
  #toast-container,
  #particles-bg,
  #particles-fg,
  #glow,
  #cursor-ring {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
  }

  body {
    background: white;
    color: black;
  }
}
