/* ============================================================
   ProjectPlanningBuddy – Stylesheet
   ============================================================ */

:root {
  --sidebar-w: 240px;
  --sidebar-bg: #1e2d40;
  --sidebar-text: #94a3b8;
  --sidebar-active: #ffffff;
  --sidebar-active-bg: rgba(255,255,255,.12);
  --sidebar-hover-bg: rgba(255,255,255,.06);

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0891b2;
  --purple: #7c3aed;

  --body-bg: #f1f5f9;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;

  --radius: 8px;
  --radius-sm: 5px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

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

html { font-size: 15px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--body-bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ============================================================
   AUTH
   ============================================================ */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1e2d40 0%, #2c4a6e 100%);
}
.auth-container { width: 100%; max-width: 420px; padding: 20px; }
.auth-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 40px 36px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}
.auth-logo h1 { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.auth-logo p { font-size: 0.8rem; color: var(--text-muted); }
.auth-hint {
  margin-top: 20px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.auth-hint code { background: #f1f5f9; padding: 1px 5px; border-radius: 3px; font-family: monospace; }

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

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  color: #ffffff;
  font-weight: 700;
  font-size: 1.05rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.875rem;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item:hover { background: var(--sidebar-hover-bg); color: #fff; }
.nav-item.active { background: var(--sidebar-active-bg); color: var(--sidebar-active); font-weight: 600; }
.nav-item-action { color: #93c5fd; }
.nav-item-action:hover { color: #bfdbfe; }
.nav-divider {
  padding: 14px 10px 4px;
}
.nav-divider span {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(148,163,184,.6);
}
.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-chip { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.user-meta { min-width: 0; }
.user-name { font-size: 0.8rem; color: #e2e8f0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.7rem; color: var(--sidebar-text); }
.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 5px;
  color: var(--sidebar-text);
  display: flex;
  align-items: center;
}
.btn-icon:hover { background: rgba(255,255,255,.1); color: #fff; }
.btn-icon svg { width: 16px; height: 16px; }

/* Avatar */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}
.avatar.sm { width: 24px; height: 24px; font-size: 0.7rem; }

/* Main area */
.main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.main-content {
  flex: 1;
  padding: 28px 32px;
  max-width: 1400px;
  width: 100%;
}

/* Flash messages */
.flash {
  padding: 12px 16px;
  font-size: 0.875rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.flash button { background: none; border: none; cursor: pointer; font-size: 1rem; opacity: .6; }
.flash button:hover { opacity: 1; }
.flash-success { background: #dcfce7; color: #166534; border-bottom: 2px solid #16a34a; }
.flash-error { background: #fee2e2; color: #991b1b; border-bottom: 2px solid #dc2626; }

/* ============================================================
   PAGE ELEMENTS
   ============================================================ */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-title { font-size: 1.6rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.page-sub { color: var(--text-muted); font-size: 0.875rem; margin-top: 4px; }
.page-sub a { color: var(--primary); text-decoration: none; }
.page-sub a:hover { text-decoration: underline; }

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-header h2 { font-size: 1.05rem; font-weight: 600; color: var(--text); }

.project-desc { color: var(--text-muted); margin-bottom: 20px; font-size: 0.9rem; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
  line-height: 1;
}
.btn svg { width: 15px; height: 15px; }
.btn:disabled { opacity: .5; cursor: default; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: #f1f5f9; color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-lg { padding: 10px 22px; font-size: 0.95rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ============================================================
   FORMS
   ============================================================ */
.form-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  box-shadow: var(--shadow);
}
.form { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 160px; }
.flex-2 { flex: 2 !important; }

label { font-size: 0.875rem; font-weight: 500; color: var(--text); }
.required { color: var(--danger); }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: #94a3b8; }

.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.checkbox-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: #fafafa;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text);
}
.checkbox-label input { width: auto; }

/* ============================================================
   CARDS & GRIDS
   ============================================================ */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}
.project-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: box-shadow .2s, transform .2s;
}
.project-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.project-card-header { padding: 18px 20px 12px; }
.project-card-title { display: flex; align-items: flex-start; gap: 10px; justify-content: space-between; flex-wrap: wrap; margin-bottom: 8px; }
.project-card-title a { font-size: 1rem; font-weight: 700; color: var(--text); text-decoration: none; }
.project-card-title a:hover { color: var(--primary); }
.project-card-desc { font-size: 0.825rem; color: var(--text-muted); line-height: 1.4; }
.project-card-stats { display: grid; grid-template-columns: repeat(3,1fr); padding: 0 20px 12px; gap: 4px; }
.stat { text-align: center; }
.stat-value { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.stat-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.project-card-progress { padding: 0 20px 16px; }
.project-card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.project-card-actions { display: flex; gap: 6px; }

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
}
.kpi-card-danger { border-color: #fca5a5; background: #fff5f5; }
.kpi-value { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.kpi-label { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; }

/* ============================================================
   PROGRESS BARS
   ============================================================ */
.progress-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  width: 100%;
}
.progress-bar.sm { height: 6px; width: 80px; }
.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width .3s ease;
}
.progress-fill-danger { background: var(--danger); }
.progress-row { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; }
.progress-inline { display: flex; align-items: center; gap: 8px; }

/* ============================================================
   TABLES
   ============================================================ */
.task-table-wrap, .card { overflow: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.data-table th {
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.data-table tfoot td {
  background: #f8fafc;
  border-top: 2px solid var(--border);
  font-size: 0.875rem;
  padding: 10px 14px;
}
.data-table tbody tr:hover td { background: #fafafa; }
.data-table tbody tr:last-child td { border-bottom: none; }
.row-actions { white-space: nowrap; text-align: right; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-active { background: #dbeafe; color: #1e40af; }
.badge-completed { background: #dcfce7; color: #166534; }
.badge-archived { background: #f1f5f9; color: #475569; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-in_progress { background: #dbeafe; color: #1e40af; }
.badge-blocked { background: #fee2e2; color: #991b1b; }
.badge-admin    { background: #ede9fe; color: #5b21b6; }
.badge-neutral  { background: #f1f5f9; color: #64748b; }
.badge-danger { background: #fee2e2; color: #991b1b; }

/* Trade badge */
.trade-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  background: #f1f5f9;
  color: #475569;
  font-weight: 500;
}

/* Trade color bar */
.trade-color-bar {
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: var(--primary);
  flex-shrink: 0;
}

/* ============================================================
   PRIORITY DOTS
   ============================================================ */
.priority-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px;
}
.priority-low { background: #94a3b8; }
.priority-medium { background: var(--warning); }
.priority-high { background: #f97316; }
.priority-critical { background: var(--danger); }

/* Task layout */
.task-title { display: flex; align-items: flex-start; gap: 8px; }
.task-desc { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; padding-left: 16px; }
.assignee { display: flex; align-items: center; gap: 8px; }

/* ============================================================
   FILTER BUTTONS
   ============================================================ */
.filter-group { display: flex; gap: 4px; flex-wrap: wrap; }
.filter-btn {
  padding: 4px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: all .15s;
}
.filter-btn:hover { background: #f1f5f9; color: var(--text); }
.filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.empty-state.compact { padding: 32px 20px; }
.empty-state svg { width: 48px; height: 48px; color: #cbd5e1; margin: 0 auto 16px; display: block; }
.empty-state h3 { font-size: 1rem; color: var(--text); margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 20px; }
.empty-state p a { color: var(--primary); text-decoration: none; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 16px;
}
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }

/* ============================================================
   UTILITIES
   ============================================================ */
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.small { font-size: 0.8rem; }
.nowrap { white-space: nowrap; }

/* ============================================================
   GANTT
   ============================================================ */
.gantt-wrap {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  padding: 8px;
  box-shadow: var(--shadow);
  min-height: 200px;
}
.gantt-controls { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.active-view { background: var(--primary) !important; color: #fff !important; border-color: var(--primary) !important; }

/* ============================================================
   TABELLEN-SCROLL-WRAPPER (Desktop + Mobile)
   ============================================================ */
.table-scroll-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.table-scroll-wrap > .data-table {
  border-radius: 0;
  box-shadow: none;
}

/* ============================================================
   MOBILE-TOPBAR (nur auf kleinen Bildschirmen sichtbar)
   ============================================================ */
.mobile-topbar {
  display: none;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  /* ── Layout ─────────────────────────────────────────────── */
  .layout { display: block; }

  /* ── Sidebar: off-canvas, einfahrbar ────────────────────── */
  .sidebar {
    position: fixed;
    top: 0;
    left: calc(-1 * var(--sidebar-w) - 4px);
    height: 100dvh;
    z-index: 300;
    transition: left .25s ease;
    box-shadow: none;
  }
  .sidebar.open {
    left: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,.35);
  }

  /* ── Overlay hinter der Sidebar ─────────────────────────── */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 250;
    backdrop-filter: blur(1px);
  }
  .sidebar-overlay.open { display: block; }

  /* ── Mobile-Topbar ───────────────────────────────────────── */
  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--sidebar-bg);
    color: #fff;
    padding: 0 16px;
    height: 52px;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
  }
  .mobile-brand {
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
  }
  .hamburger-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #fff;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
  }
  .hamburger-btn:hover { background: rgba(255,255,255,.1); }

  /* ── Inhaltsbereich ──────────────────────────────────────── */
  .main-content {
    padding: 16px;
    max-width: 100%;
  }

  /* ── Seitenheader ────────────────────────────────────────── */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .page-header .btn-group { flex-wrap: wrap; }

  /* ── Projektkacheln ──────────────────────────────────────── */
  .project-grid { grid-template-columns: 1fr; }

  /* ── KPI-Kacheln ─────────────────────────────────────────── */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }

  /* ── Formulare ───────────────────────────────────────────── */
  .form-row { flex-direction: column; }
  .form-card { padding: 20px 16px; }

  /* ── Touch-Targets ───────────────────────────────────────── */
  .btn        { min-height: 42px; }
  .nav-item   { padding: 11px 10px; }
  .btn-icon   { min-width: 40px; min-height: 40px; }

  /* ── Aufgaben-Tabelle: weniger wichtige Spalten ausblenden ─ */
  .task-col-trade,
  .task-col-cost,
  .task-col-assignee { display: none; }

  /* ── Gantt: horizontal scrollbar ────────────────────────── */
  .gantt-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* ── Budget-Layout ───────────────────────────────────────── */
  .budget-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .budget-grid     { grid-template-columns: 1fr; }

  /* ── Anhang-Layout ───────────────────────────────────────── */
  .att-layout { grid-template-columns: 1fr; }
  .att-sidebar { order: -1; }
  .att-main { overflow-x: auto; }
  /* Spalten: Datei | Aufgabe | Aktionen (Kategorie, Hochgeladen, Größe ausblenden) */
  .att-table-head,
  .att-table-row  { grid-template-columns: 2fr 1.5fr 60px; }
  .att-table-head > *:nth-child(2),
  .att-table-row  > *:nth-child(2),   /* Kategorie */
  .att-table-head > *:nth-child(4),
  .att-table-row  > *:nth-child(4),   /* Hochgeladen */
  .att-table-head > *:nth-child(5),
  .att-table-row  > *:nth-child(5)    /* Größe */
  { display: none; }
}

/* Copyright-Footer */
.app-footer {
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
  padding: 10px 24px 12px;
  border-top: 1px solid #e2e8f0;
  margin-top: auto;
}
.app-footer a { color: #94a3b8; text-decoration: none; }
.build-info { white-space: nowrap; }
.build-sha {
  font-family: monospace;
  font-size: 10px;
  color: #cbd5e1;
}
.env-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 3px;
  vertical-align: middle;
}
.env-production  { background: #dcfce7; color: #15803d; }
.env-staging     { background: #fef9c3; color: #a16207; }
.env-development { background: #e0e7ff; color: #4338ca; }

/* Login-Versionszeile */
.login-version {
  margin-top: 20px;
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
}

/* ============================================================
   PROGNOSE-METHODEN-UMSCHALTER (Projektübersicht)
   ============================================================ */
.kpi-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 10px;
}
.method-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
}
.method-switcher-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-right: 2px;
}
.method-btn {
  padding: 3px 12px;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.method-btn:hover { background: var(--body-bg); color: var(--text); }
.method-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
html.dark .method-btn { border-color: #334155; color: #94a3b8; }
html.dark .method-btn:hover { background: #1e293b; color: #e2e8f0; }
html.dark .method-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ============================================================
   PROGNOSTIZIERTER ENDTERMIN (Projektkachel)
   ============================================================ */
.proj-end-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  margin-top: 4px;
}
.proj-end-row.proj-neutral { color: var(--text-muted); }
.proj-end-row.proj-ok   { color: #16a34a; }
.proj-end-row.proj-warn { color: #d97706; }
.proj-end-row.proj-late { color: #dc2626; }
.proj-delay-hint {
  font-size: 0.7rem;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 600;
  margin-left: 2px;
  background: #fee2e2;
  color: #dc2626;
}
.proj-delay-hint.warn { background: #fef3c7; color: #92400e; }
.text-warning { color: var(--warning); }
html.dark .proj-end-row.proj-ok   { color: #4ade80; }
html.dark .proj-end-row.proj-warn { color: #fbbf24; }
html.dark .proj-end-row.proj-late { color: #f87171; }
html.dark .proj-delay-hint        { background: #3b1c1c; color: #fca5a5; }
html.dark .proj-delay-hint.warn   { background: #451a03; color: #fde68a; }

/* ============================================================
   KOMMENTARE
   ============================================================ */
.comment-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 8px; }
.comment-item {
  background: var(--body-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.comment-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.comment-author { font-weight: 600; font-size: 0.85rem; color: var(--text); }
.comment-date   { font-size: 0.75rem; color: var(--text-muted); }
.comment-delete {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 1px 5px;
  border-radius: 3px;
  line-height: 1;
}
.comment-delete:hover { background: #fee2e2; color: var(--danger); }
.comment-body { font-size: 0.875rem; color: var(--text); white-space: pre-wrap; line-height: 1.5; }

/* ============================================================
   GANTT TOAST (Datum-Drag-Feedback)
   ============================================================ */
.gantt-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  pointer-events: none;
  transition: opacity .4s;
  box-shadow: var(--shadow-md);
}
.gantt-toast.toast-ok  { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.gantt-toast.toast-err { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* ============================================================
   DARK MODE
   ============================================================ */
html.dark {
  --body-bg:    #0f172a;
  --card-bg:    #1e293b;
  --border:     #334155;
  --text:       #e2e8f0;
  --text-muted: #94a3b8;
}

/* Eingabefelder */
html.dark input,
html.dark select,
html.dark textarea {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #334155;
  color-scheme: dark;
}
html.dark input::placeholder,
html.dark textarea::placeholder { color: #475569; }
html.dark input[type=date]::-webkit-calendar-picker-indicator { filter: invert(.7); }
html.dark select option { background: #1e293b; }

/* Tabellen */
html.dark .data-table th { background: #0f172a; color: #94a3b8; }
html.dark .data-table td { border-color: #334155; }
html.dark .data-table tr:nth-child(even) td { background: #172033; }
html.dark .data-table tr:hover td { background: rgba(99,102,241,.1); }

/* Seitenelemente */
html.dark .page-header { border-color: #334155; }
html.dark .auth-hint code { background: #1e293b; color: #94a3b8; }
html.dark .checkbox-grid { background: #0f172a; border-color: #334155; }
html.dark .app-footer { border-color: #334155; }

/* Buttons */
html.dark .btn-outline { border-color: #334155; color: #94a3b8; }
html.dark .btn-outline:hover { background: #1e293b; color: #e2e8f0; }
html.dark .btn-ghost { color: #94a3b8; }
html.dark .btn-ghost:hover { background: #1e293b; color: #e2e8f0; }

/* Badges */
html.dark .trade-badge { background: #1e3a5f; color: #93c5fd; border-color: #1e40af; }
html.dark .status-badge.pending     { background: #1e293b; color: #94a3b8; border-color: #334155; }
html.dark .status-badge.in-progress { background: #1c2d4b; color: #60a5fa; border-color: #1e40af; }
html.dark .status-badge.completed   { background: #132d1e; color: #4ade80; border-color: #166534; }
html.dark .status-badge.blocked     { background: #3b1c1c; color: #f87171; border-color: #991b1b; }
html.dark .priority-high, html.dark .priority-critical { background: #3b1c1c; color: #fca5a5; }
html.dark .priority-medium { background: #1c2d4b; color: #93c5fd; }
html.dark .priority-low    { background: #1e293b; color: #94a3b8; }

/* Kommentare im Dunkelmodus */
html.dark .comment-item { background: #0f172a; border-color: #334155; }
html.dark .comment-delete:hover { background: #3b1c1c; }

/* Toast im Dunkelmodus */
html.dark .gantt-toast.toast-ok  { background: #132d1e; color: #4ade80; border-color: #166534; }
html.dark .gantt-toast.toast-err { background: #3b1c1c; color: #fca5a5; border-color: #991b1b; }

/* Gantt im Dunkelmodus (Toolbar + Wrapper sind Inline-Styles in gantt/index.ejs, daher !important) */
html.dark .gantt-wrap {
  background: #1e293b !important;
  border-color: #334155 !important;
  scrollbar-color: #475569 #0f172a;
}
html.dark .gantt-wrap::-webkit-scrollbar-track { background: #0f172a; }
html.dark .gantt-wrap::-webkit-scrollbar-thumb { background: #475569; border-color: #0f172a; }
html.dark .gantt-toolbar {
  background: #0f172a !important;
  border-color: #334155 !important;
}
html.dark .gantt-toolbar .zoom-label { color: #94a3b8 !important; }
html.dark .gantt-toolbar .cp-toggle  { color: #94a3b8 !important; }
/* Frappe Gantt übernimmt seinen eigenen Dunkelmodus via html[data-theme=dark] */
.app-footer a:hover { color: #64748b; }

/* ============================================================
   DATEIANHÄNGE (Aufgaben-Formular)
   ============================================================ */
.attachment-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.attachment-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--body-bg);
}
.attachment-icon {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.attachment-icon svg { width: 18px; height: 18px; }
.attachment-icon.sm { width: 28px; height: 28px; border-radius: 6px; }
.attachment-icon.sm svg { width: 14px; height: 14px; }
.icon-img  { background: #e0f2fe; color: #0369a1; }
.icon-pdf  { background: #fee2e2; color: #b91c1c; }
.icon-doc  { background: #dbeafe; color: #1d4ed8; }
.icon-zip  { background: #fef9c3; color: #854d0e; }
.icon-dwg  { background: #fce7f3; color: #9d174d; }
.icon-file { background: #f1f5f9; color: #475569; }

.attachment-info { flex: 1; min-width: 0; }
.attachment-name { font-weight: 500; font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attachment-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.attachment-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.att-cat-badge {
  display: inline-block; padding: 1px 8px;
  background: var(--primary); color: #fff;
  border-radius: 20px; font-size: 0.72rem; font-weight: 500;
  opacity: 0.85;
}

.attachment-upload-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.file-input {
  display: block; width: 100%; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card-bg); color: var(--text); font-size: 0.875rem;
}
.file-input:focus { outline: none; border-color: var(--primary); }

/* ============================================================
   DATEIEN-ÜBERSICHT (Projekt)
   ============================================================ */
.att-layout { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: start; }

.att-sidebar {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 0; position: sticky; top: 16px;
}
.att-filter-title {
  font-size: 0.72rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-muted);
  padding: 6px 16px 8px;
}
.att-filter-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 16px; font-size: 0.875rem; color: var(--text);
  text-decoration: none; border-left: 3px solid transparent;
  transition: background .12s;
}
.att-filter-item:hover { background: var(--body-bg); }
.att-filter-item.active { border-left-color: var(--primary); background: var(--body-bg); font-weight: 600; color: var(--primary); }
.att-filter-item.empty { color: var(--text-muted); }
.att-count-badge {
  min-width: 20px; height: 20px; padding: 0 6px;
  background: var(--primary); color: #fff;
  border-radius: 10px; font-size: 0.7rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.att-count-badge.zero { background: var(--border); color: var(--text-muted); }

.att-main { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.att-table { width: 100%; }
.att-table-head {
  display: grid; grid-template-columns: 2fr 1fr 1.5fr 1.2fr 80px 80px;
  padding: 10px 16px; background: var(--body-bg);
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.att-table-row {
  display: grid; grid-template-columns: 2fr 1fr 1.5fr 1.2fr 80px 80px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  align-items: center; font-size: 0.875rem;
  transition: background .1s;
}
.att-table-row:last-child { border-bottom: none; }
.att-table-row:hover { background: var(--body-bg); }
.att-file-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.att-filename { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-row-actions { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }

/* Dark mode */
html.dark .attachment-item { background: #1e293b; border-color: #334155; }
html.dark .icon-img  { background: #082f49; color: #38bdf8; }
html.dark .icon-pdf  { background: #450a0a; color: #fca5a5; }
html.dark .icon-doc  { background: #172554; color: #93c5fd; }
html.dark .icon-zip  { background: #2d1b00; color: #fbbf24; }
html.dark .icon-dwg  { background: #4a044e; color: #f0abfc; }
html.dark .icon-file { background: #1e293b; color: #64748b; }
html.dark .file-input { background: #1e293b; border-color: #334155; color: #e2e8f0; }
html.dark .att-sidebar { background: #1e293b; border-color: #334155; }
html.dark .att-filter-item:hover { background: #0f172a; }
html.dark .att-filter-item.active { background: #0f172a; }
html.dark .att-main { background: #1e293b; border-color: #334155; }
html.dark .att-table-head { background: #0f172a; border-color: #334155; }
html.dark .att-table-row { border-color: #334155; }
html.dark .att-table-row:hover { background: #0f172a; }

/* ============================================================
   HILFE / BENUTZERHANDBUCH
   ============================================================ */
.help-content {
  max-width: 820px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 48px;
}
.help-content h1 { font-size: 1.6rem; font-weight: 700; margin: 0 0 6px; }
.help-content h2 { font-size: 1.15rem; font-weight: 700; margin: 32px 0 10px; padding-top: 24px; border-top: 1px solid var(--border); color: var(--primary); }
.help-content h2:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }
.help-content h3 { font-size: 0.95rem; font-weight: 700; margin: 20px 0 8px; }
.help-content h4 { font-size: 0.875rem; font-weight: 600; margin: 16px 0 6px; color: var(--text-muted); }
.help-content p { margin: 0 0 12px; line-height: 1.65; }
.help-content ul, .help-content ol { margin: 0 0 12px 22px; line-height: 1.65; }
.help-content li { margin-bottom: 4px; }
.help-content code {
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.82em;
  background: var(--body-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}
.help-content pre {
  background: var(--body-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 14px;
}
.help-content pre code { background: none; border: none; padding: 0; font-size: 0.82rem; }
.help-content table { width: 100%; border-collapse: collapse; margin: 0 0 16px; font-size: 0.875rem; }
.help-content th { background: var(--body-bg); font-weight: 600; text-align: left; padding: 8px 12px; border: 1px solid var(--border); }
.help-content td { padding: 7px 12px; border: 1px solid var(--border); }
.help-content tr:nth-child(even) td { background: var(--body-bg); }
.help-content blockquote { border-left: 3px solid var(--primary); margin: 0 0 14px; padding: 8px 16px; background: var(--body-bg); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-muted); font-size: 0.9rem; }
.help-content hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.help-content strong { font-weight: 600; }
.help-content a { color: var(--primary); }

html.dark .help-content { background: #1e293b; border-color: #334155; }
html.dark .help-content h2 { border-color: #334155; }
html.dark .help-content code { background: #0f172a; border-color: #334155; }
html.dark .help-content pre { background: #0f172a; border-color: #334155; }
html.dark .help-content th { background: #0f172a; border-color: #334155; }
html.dark .help-content td { border-color: #334155; }
html.dark .help-content tr:nth-child(even) td { background: #0f172a; }
html.dark .help-content blockquote { background: #0f172a; border-color: var(--primary); }
