:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-2: #222536;
  --border: #2e3248;
  --text: #e8eaf0;
  --text-muted: #6b7394;
  --accent: #e85d2f;
  --accent-soft: rgba(232,93,47,.15);
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #f59e0b;
  --sidebar-w: 240px;
  --topbar-h: 60px;
  --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

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

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}

.login-logo {
  font-family: 'Syne', sans-serif;
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}

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

.login-sub {
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 32px;
}

.input {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  margin-bottom: 16px;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  border: none;
}

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

.btn-accent:hover { opacity: .9; }

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

.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
}

.btn-danger:hover {
  background: var(--red);
  color: white;
}

.btn-full { width: 100%; }

.login-error {
  color: var(--red);
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
}

/* Dashboard */
.dashboard {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

.logo {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 700;
}

.container {
  display: flex;
  margin-top: var(--topbar-h);
  flex: 1;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  position: fixed;
  top: var(--topbar-h);
  bottom: 0;
  left: 0;
}

.nav-item {
  display: block;
  padding: 12px 24px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .2s;
}

.nav-item:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav-item.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

.content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 32px;
}

/* Section Header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.section-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.card h2 {
  font-size: 18px;
  margin-bottom: 20px;
}

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

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
}

/* Table */
.table {
  width: 100%;
  border-collapse: collapse;
}

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

.table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.table tr:hover td {
  background: var(--surface-2);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green {
  background: rgba(34,197,94,.15);
  color: var(--green);
}

.badge-yellow {
  background: rgba(245,158,11,.15);
  color: var(--yellow);
}

.badge-grey {
  background: var(--surface-2);
  color: var(--text-muted);
}

.badge-red {
  background: rgba(239,68,68,.15);
  color: var(--red);
}

/* Slide-in Panel */
.panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,.7);
  z-index: 200;
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}

.panel-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 600px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform .3s;
  z-index: 201;
  display: flex;
  flex-direction: column;
}

.panel.active {
  transform: translateX(0);
}

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

.panel-title {
  font-size: 20px;
  font-weight: 700;
}

.panel-close {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background .2s;
}

.panel-close:hover {
  background: var(--surface-2);
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

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

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

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

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
}

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

.form-textarea {
  width: 100%;
  min-height: 120px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}

.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

.form-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Toggle Switch */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.toggle-track {
  position: relative;
  width: 48px;
  height: 24px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 100px;
  transition: all .2s;
}

.toggle-track.active {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: var(--text);
  border-radius: 50%;
  transition: transform .2s;
}

.toggle-track.active .toggle-thumb {
  transform: translateX(24px);
}

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

/* Image Preview */
.image-preview {
  width: 100%;
  max-width: 400px;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview-empty {
  color: var(--text-muted);
  font-size: 14px;
}

/* Grid Layout */
.grid-layout {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.grid-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all .2s;
}

.grid-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.grid-card-image {
  width: 100%;
  aspect-ratio: 1;
  background: var(--surface-2);
  overflow: hidden;
}

.grid-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.grid-card-content {
  padding: 16px;
}

.grid-card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

.grid-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
}

/* Filters */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.filter-btn {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

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

/* Responsive Anpassungen */
@media (max-width: 768px) {
  .panel {
    max-width: 100%;
  }
  
  .grid-layout {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  
  .section-header {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }
  
  .filter-bar {
    flex-wrap: wrap;
  }
}

/* Utility Classes */
.text-center {
  text-align: center;
}

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

.mt-4 {
  margin-top: 16px;
}

.mb-4 {
  margin-bottom: 16px;
}

/* Mobile First Responsive Styles */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 8px 0;
  }
  
  .nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
  }
  
  .nav-item {
    padding: 8px 12px;
    font-size: 12px;
    border-left: none;
    border-bottom: 2px solid transparent;
  }
  
  .nav-item.active {
    border-left-color: transparent;
    border-bottom-color: var(--accent);
  }
  
  .container {
    flex-direction: column;
  }
  
  .content {
    margin-left: 0;
    padding: 16px;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
  }
  
  .stat-value {
    font-size: 24px !important;
  }
  
  .stat-label {
    font-size: 11px !important;
  }
  
  .section-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
  
  .table {
    font-size: 12px;
  }
  
  .table th,
  .table td {
    padding: 8px;
  }
  
  .login-card {
    padding: 24px;
    margin: 16px;
  }
  
  h1 {
    font-size: 20px !important;
  }
  
  h2 {
    font-size: 16px !important;
  }
  
  h3 {
    font-size: 14px !important;
  }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Scrollbar für Tabelle auf Mobile */
@media (max-width: 768px) {
  .card .table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

/* LAYOUT FIX - Kein leerer Balken */
@media (max-width: 768px) {
  .container {
    margin-top: 0 !important;
  }
  
  .topbar {
    position: relative !important;
    margin-bottom: 0 !important;
  }
  
  .sidebar {
    position: relative !important;
    top: 0 !important;
    border-bottom: 1px solid var(--border);
  }
}

/* Desktop bleibt wie vorher */
@media (min-width: 769px) {
  .container {
    margin-top: var(--topbar-h);
  }
}
