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

:root {
  --primary: #2563EB;
  --primary-light: #EFF6FF;
  --secondary: #3B82F6;
  --accent: #F97316;
  --sbb-red: #F21F50;
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --text: #1E293B;
  --text-muted: #64748B;
  --border: #E2E8F0;
  --success: #16A34A;
  --warning: #D97706;
  --danger: #DC2626;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

/* ── Navbar ─────────────────────────────────────────────────────────── */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  text-decoration: none;
}
.nav-links { display: flex; align-items: center; gap: 8px; }
.nav-link {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 150ms ease;
}
.nav-link:hover { color: var(--text); background: var(--bg); }
.nav-cta {
  background: var(--primary);
  color: #fff !important;
  padding: 6px 14px;
}
.nav-cta:hover { background: #1D4ED8 !important; }
.nav-logout { color: var(--text-muted); }

/* ── Main ────────────────────────────────────────────────────────────── */
.main-content { max-width: 1280px; margin: 0 auto; padding: 32px 24px; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 24px; font-weight: 700; }
.page-sub { color: var(--text-muted); font-size: 14px; margin-top: 2px; }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.back-link {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  display: block;
  margin-bottom: 4px;
}
.back-link:hover { color: var(--text); }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 150ms ease;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #1D4ED8; }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #B91C1C; }
.btn-full { width: 100%; justify-content: center; }

/* ── Badges ──────────────────────────────────────────────────────────── */
.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}
.status-aktiv { background: #DCFCE7; color: #15803D; }
.status-pausiert { background: #FEF9C3; color: #A16207; }
.status-abgeschlossen { background: #EFF6FF; color: #1D4ED8; }

/* ── Alerts ──────────────────────────────────────────────────────────── */
.alert { padding: 10px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.alert-error { background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; }

/* ── Projekt-Grid ────────────────────────────────────────────────────── */
.projekt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.projekt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 150ms ease;
  cursor: pointer;
}
.projekt-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(37,99,235,.1);
  transform: translateY(-1px);
}
.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card-title { font-weight: 600; font-size: 16px; flex: 1; }
.card-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.card-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.meta-item { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-muted); }
.progress-bar-wrap { display: flex; align-items: center; gap: 8px; }
.progress-bar-track { flex: 1; height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--primary); border-radius: 999px; transition: width 400ms ease; }
.progress-label { font-size: 12px; font-weight: 600; color: var(--text-muted); min-width: 30px; text-align: right; }

/* ── Filter Tabs ─────────────────────────────────────────────────────── */
.filter-tabs { display: flex; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.filter-tab {
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-muted);
  transition: all 150ms ease;
}
.filter-tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.filter-tab:hover:not(.active) { color: var(--text); }

/* ── Empty State ─────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.empty-state h3 { font-size: 18px; font-weight: 600; }
.empty-state p { color: var(--text-muted); }

/* ── Login ───────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}
.login-logo { display: flex; justify-content: center; margin-bottom: 20px; }
.login-card h1 { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 6px; }
.login-sub { color: var(--text-muted); text-align: center; font-size: 14px; margin-bottom: 24px; }

/* ── Forms ───────────────────────────────────────────────────────────── */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 720px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.form-full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
label { font-size: 13px; font-weight: 600; color: var(--text); }
input, textarea, select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: border-color 150ms ease;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
textarea { resize: vertical; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 400; cursor: pointer; }
.checkbox-label input { width: auto; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

/* ── Tabs ────────────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  gap: 0;
}
.tab-item {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: all 150ms ease;
  cursor: pointer;
}
.tab-item:hover { color: var(--text); }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-content { min-height: 400px; }
.tab-full { margin: 0 -24px; padding: 0 24px; }

/* ── Detail ──────────────────────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.detail-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 16px; }
.detail-list { display: flex; flex-direction: column; gap: 10px; }
.detail-list dt { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.detail-list dd { font-size: 14px; }
.quick-links { display: flex; flex-direction: column; gap: 10px; }
.quick-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: all 150ms ease;
}
.quick-link:hover { border-color: var(--primary); background: var(--primary-light); }
.quick-link strong { display: block; font-size: 14px; font-weight: 600; }
.quick-link p { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Gantt ───────────────────────────────────────────────────────────── */
.gantt-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.toolbar-left { display: flex; align-items: center; gap: 8px; }
.toolbar-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.view-btn {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 150ms ease;
  color: var(--text-muted);
}
.view-btn:hover { color: var(--text); }
.view-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
#gantt-container { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.gantt-empty { padding: 60px 24px; text-align: center; color: var(--text-muted); }

/* ── Modal ───────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.4);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 4px;
}
.modal-close:hover { background: var(--bg); color: var(--text); }

/* ── Workflow ────────────────────────────────────────────────────────── */
.tab-workflow { overflow: hidden; }
.workflow-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.toolbar-right { display: flex; align-items: center; gap: 8px; }
.save-status { font-size: 13px; color: var(--success); font-weight: 500; }
.node-btn {
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  cursor: grab;
  font-family: inherit;
  transition: all 150ms ease;
}
.node-btn[data-type="start"]        { border-color: #16A34A; color: #15803D; }
.node-btn[data-type="prozess"]      { border-color: var(--primary); color: var(--primary); }
.node-btn[data-type="entscheidung"] { border-color: var(--accent); color: #EA580C; }
.node-btn[data-type="ende"]         { border-color: var(--sbb-red); color: #B91C1C; }
.node-btn:hover { opacity: .8; }

#drawflow-container {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #FAFAFA;
  height: calc(100vh - 280px);
  min-height: 500px;
  position: relative;
}
#drawflow { width: 100%; height: 100%; }

@media (max-width: 768px) {
  .main-content { padding: 20px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .projekt-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
}
