:root {
  --sidebar-w: 240px;
  --sidebar-bg: #111827;
  --sidebar-accent: #f59e0b;
  --sidebar-hover: #1f2937;
  --sidebar-text: #d1d5db;
  --sidebar-section: #6b7280;
  --topbar-h: 56px;
  --topbar-bg: #ffffff;
  --body-bg: #f3f4f6;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --accent: #f59e0b;
  --accent-dark: #d97706;
  --danger: #ef4444;
  --success: #10b981;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: 'Inter', system-ui, sans-serif; background: var(--body-bg); color: var(--text); font-size: 14px; }

/* ===== Layout ===== */
#wrapper { min-height: 100vh; }

/* ===== Sidebar ===== */
#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1000;
  transition: width 0.25s ease, transform 0.25s ease;
  overflow: hidden;
}
#content-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  transition: margin-left 0.25s ease;
  display: flex;
  flex-direction: column;
}

/* Collapsed sidebar */
.sidebar-collapsed #sidebar { width: 60px; }
.sidebar-collapsed #content-wrapper { margin-left: 60px; }
.sidebar-collapsed .sidebar-brand span,
.sidebar-collapsed .sidebar-nav a span,
.sidebar-collapsed .nav-section,
.sidebar-collapsed .sidebar-footer a span { display: none; }
.sidebar-collapsed .sidebar-brand { justify-content: center; }
.sidebar-collapsed .sidebar-nav a { justify-content: center; padding: 12px; }
.sidebar-collapsed .sidebar-nav a i { margin: 0; font-size: 1.2rem; }
.sidebar-collapsed .sidebar-footer a { justify-content: center; }
.sidebar-collapsed .sidebar-footer a i { margin: 0; }

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  padding: 16px 14px;
  border-bottom: 1px solid #1f2937;
  min-height: var(--topbar-h);
  white-space: nowrap;
}
.sidebar-brand img { flex-shrink: 0; }

/* Nav */
.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.sidebar-nav li a i { font-size: 1rem; flex-shrink: 0; }
.sidebar-nav li a:hover {
  background: var(--sidebar-hover);
  color: #ffffff;
}
.sidebar-nav li.active a {
  background: var(--sidebar-hover);
  color: var(--sidebar-accent);
  border-left-color: var(--sidebar-accent);
  font-weight: 600;
}
.nav-section {
  padding: 16px 16px 4px;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sidebar-section);
  font-weight: 600;
  white-space: nowrap;
}

/* Sidebar footer */
.sidebar-footer {
  border-top: 1px solid #1f2937;
  padding: 12px 0;
}
.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--sidebar-text);
  text-decoration: none;
  white-space: nowrap;
}
.sidebar-footer a:hover { color: var(--danger); background: rgba(239,68,68,0.08); }

/* ===== Topbar ===== */
.topbar {
  height: var(--topbar-h);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* ===== Content ===== */
.content-body {
  padding: 24px;
  flex: 1;
}

/* ===== Cards ===== */
.card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  font-weight: 600;
}

/* ===== Stat Cards ===== */
.stat-card {
  padding: 20px;
  border-radius: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.stat-icon.orange  { background: #fef3c7; color: #d97706; }
.stat-icon.blue    { background: #dbeafe; color: #2563eb; }
.stat-icon.green   { background: #d1fae5; color: #059669; }
.stat-icon.red     { background: #fee2e2; color: #dc2626; }
.stat-icon.purple  { background: #ede9fe; color: #7c3aed; }
.stat-value { font-size: 1.7rem; font-weight: 700; line-height: 1; }
.stat-label { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

/* ===== Tables ===== */
.table { font-size: 13px; }
.table th { font-weight: 600; color: var(--text-muted); text-transform: uppercase; font-size: 11px; letter-spacing: 0.05em; }
.table td, .table th { vertical-align: middle; }
.table-hover tbody tr:hover { background: #f9fafb; }

/* ===== Badges ===== */
.badge-status { font-size: 11px; font-weight: 600; padding: 4px 8px; border-radius: 20px; }

/* Status colors */
.status-neu         { background: #dbeafe; color: #1d4ed8; }
.status-bestaetigt  { background: #d1fae5; color: #065f46; }
.status-in_bearbeitung { background: #fef3c7; color: #92400e; }
.status-abgeschlossen  { background: #f3f4f6; color: #374151; }
.status-storniert   { background: #fee2e2; color: #991b1b; }
.status-wartend     { background: #e0e7ff; color: #3730a3; }
.status-in_arbeit   { background: #fef3c7; color: #92400e; }
.status-fertig      { background: #d1fae5; color: #065f46; }
.status-pausiert    { background: #f3f4f6; color: #6b7280; }
.status-roh         { background: #fce7f3; color: #9d174d; }
.status-verkauf     { background: #d1fae5; color: #065f46; }
.status-entwurf     { background: #f3f4f6; color: #6b7280; }
.status-gesendet    { background: #dbeafe; color: #1d4ed8; }
.status-bezahlt     { background: #d1fae5; color: #065f46; }
.status-ueberfaellig { background: #fee2e2; color: #991b1b; }

/* Priority */
.prio-niedrig  { background: #f3f4f6; color: #6b7280; }
.prio-normal   { background: #dbeafe; color: #1d4ed8; }
.prio-hoch     { background: #fef3c7; color: #92400e; }
.prio-dringend { background: #fee2e2; color: #991b1b; }

/* Stock warning */
.stock-low { color: var(--danger); font-weight: 600; }

/* ===== Forms ===== */
.form-control, .form-select {
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245,158,11,0.15);
}
.form-label { font-weight: 500; font-size: 13px; margin-bottom: 4px; }

/* ===== Buttons ===== */
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #000; }

/* ===== Modal ===== */
.modal-header { border-bottom: 1px solid var(--border); }
.modal-footer { border-top: 1px solid var(--border); }

/* ===== Tab Pills ===== */
.nav-pills .nav-link.active { background: var(--accent); color: #000; font-weight: 600; }
.nav-pills .nav-link { color: var(--text); }

/* ===== Kanban (Werkstatt) ===== */
.kanban-board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 12px; }
.kanban-col {
  min-width: 260px;
  background: #f9fafb;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 12px;
  flex-shrink: 0;
}
.kanban-col-header {
  font-weight: 700;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
  margin-bottom: 10px;
  text-align: center;
}
.kanban-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.kanban-card:hover { box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.kanban-card-title { font-weight: 600; font-size: 13px; }
.kanban-card-meta  { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ===== Search Box ===== */
.search-box {
  position: relative;
}
.search-box input { padding-left: 36px; }
.search-box .bi {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* ===== Login Page ===== */
body.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
}
.login-card {
  background: white;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.login-header {
  text-align: center;
  margin-bottom: 28px;
}
.login-header img { max-height: 70px; }

/* ===== AI Search Box ===== */
.ai-search-box {
  background: linear-gradient(135deg, #fef3c7, #fff);
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 20px;
}
.ai-result {
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-top: 12px;
  white-space: pre-wrap;
  font-size: 13px;
  max-height: 400px;
  overflow-y: auto;
}

/* ===== Import/Export ===== */
.export-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  background: white;
  transition: box-shadow 0.2s;
}
.export-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  #sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    width: var(--sidebar-w);
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 1050;
  }
  #content-wrapper { margin-left: 0; }
  .sidebar-open #sidebar { transform: translateX(0); }
  .content-body { padding: 16px; }
}

/* Overlay (Handy) */
#sidebarOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1040;
}
.sidebar-open #sidebarOverlay { display: block; }

/* ===== Utilities ===== */
.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cursor-pointer { cursor: pointer; }
.fw-500 { font-weight: 500; }
