/* =====================================================================
   Paket 11 Phase 4 — Dashboard-Tab (Startseite mit Übersicht)
   ===================================================================== */

.db-root {
  padding: 18px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.db-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 4px;
}
.db-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}
.db-greeting {
  font-size: 13px;
  color: #64748b;
}

/* ─── Scope-Toggle (Ich / Team) ─────────────────────────────────────── */
.db-scope {
  margin-left: auto;
  display: inline-flex;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  overflow: hidden;
  background: white;
}
.db-scope button {
  border: none;
  background: white;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  color: #374151;
}
.db-scope button.active {
  background: #2563eb;
  color: white;
}
.db-scope button:not(:last-child) { border-right: 1px solid #d1d5db; }

/* ─── KPI-Kacheln ───────────────────────────────────────────────────── */
.db-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}
.db-kpi {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}
.db-kpi .v { font-size: 22px; font-weight: 700; color: #0f172a; }
.db-kpi .l { font-size: 11px; color: #6b7280; text-transform: uppercase; letter-spacing: .5px; }
.db-kpi .sub { font-size: 11px; color: #94a3b8; margin-top: 2px; }
.db-kpi.good  { background: linear-gradient(180deg, #ecfdf5 0%, #fff 100%); border-color: #a7f3d0; }
.db-kpi.warn  { background: linear-gradient(180deg, #fffbeb 0%, #fff 100%); border-color: #fcd34d; }
.db-kpi.info  { background: linear-gradient(180deg, #eff6ff 0%, #fff 100%); border-color: #bfdbfe; }

/* ─── Grid für Wiedervorlagen + Rückmeldungen ───────────────────────── */
.db-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 1100px) {
  .db-grid { grid-template-columns: 1fr; }
}

.db-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.db-card h3 {
  margin: 0 0 6px 0;
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 8px;
}
.db-card h3 .count {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 4px;
}
.db-card h3 .meta {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 400;
  margin-left: auto;
}

.db-list { display: flex; flex-direction: column; gap: 6px; }
.db-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 9px 11px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.db-item:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.db-item .firma  { font-size: 13px; font-weight: 600; color: #111827; line-height: 1.3; }
.db-item .titel  { font-size: 11px; color: #6b7280; line-height: 1.3; }
.db-item .dot    { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; flex-shrink: 0; }
.db-item .dot.overdue { background: #ef4444; box-shadow: 0 0 4px rgba(239,68,68,.4); }
.db-item .dot.today   { background: #f59e0b; box-shadow: 0 0 4px rgba(245,158,11,.4); }
.db-item .dot.soon    { background: #3b82f6; }
.db-item .when {
  text-align: right;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
}
.db-item .when.overdue { color: #b91c1c; }
.db-item .when.today   { color: #b45309; }

/* ─── Empty + Loading ──────────────────────────────────────────────── */
.db-empty {
  padding: 22px 10px;
  color: #94a3b8;
  font-size: 13px;
  text-align: center;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px dashed #e2e8f0;
}
.db-loading {
  padding: 40px 20px;
  text-align: center;
  color: #6b7280;
  font-size: 14px;
}

/* ─── Quick-Actions-Zeile ──────────────────────────────────────────── */
.db-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
}
.db-quick button,
.db-quick a {
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: white;
  color: #334155;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .12s, border-color .12s;
}
.db-quick button:hover,
.db-quick a:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.db-quick .primary {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
}
.db-quick .primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

/* ─── Ergebnis-Badges in Rückmeldungs-Liste (Paket 13b) ────────────── */
.erg-badge {
  display: inline-block;
  margin-left: 4px;
  font-size: 12px;
  padding: 0 4px;
  border-radius: 4px;
  vertical-align: middle;
}
.erg-badge.good    { background: #d1fae5; }
.erg-badge.bad     { background: #fee2e2; }
.erg-badge.neutral { background: #e5e7eb; }
.erg-badge.info    { background: #dbeafe; }

/* ─── Paket 19c-Hotfix: Dark-Theme-Overrides ───────────────────────────
   dashboard.css nutzte ursprünglich harte Light-Farben (white, #0f172a,
   #f8fafc), die im Dark-Theme als helle Inseln durchschlagen. Hier alle
   Surfaces auf die globalen Theme-Variablen mappen. */
body[data-theme="dark"] .db-header h2 { color: var(--text); }
body[data-theme="dark"] .db-greeting  { color: var(--text-light); }

body[data-theme="dark"] .db-scope {
  background: var(--bg-secondary);
  border-color: var(--border);
}
body[data-theme="dark"] .db-scope button {
  background: var(--bg-secondary);
  color: var(--text-light);
}
body[data-theme="dark"] .db-scope button.active {
  background: var(--accent);
  color: var(--bg);
}
body[data-theme="dark"] .db-scope button:not(:last-child) { border-right-color: var(--border); }

body[data-theme="dark"] .db-kpi {
  background: var(--bg-secondary);
  border-color: var(--border);
}
body[data-theme="dark"] .db-kpi .v   { color: var(--text); }
body[data-theme="dark"] .db-kpi .l   { color: var(--text-light); }
body[data-theme="dark"] .db-kpi .sub { color: var(--text-secondary); }
body[data-theme="dark"] .db-kpi.good { background: linear-gradient(180deg, rgba(74,222,128,.10) 0%, var(--bg-secondary) 100%); border-color: rgba(74,222,128,.30); }
body[data-theme="dark"] .db-kpi.warn { background: linear-gradient(180deg, rgba(251,191,36,.10) 0%, var(--bg-secondary) 100%); border-color: rgba(251,191,36,.30); }
body[data-theme="dark"] .db-kpi.info { background: linear-gradient(180deg, rgba(91,141,239,.10) 0%, var(--bg-secondary) 100%); border-color: rgba(91,141,239,.30); }

body[data-theme="dark"] .db-card {
  background: var(--bg-secondary);
  border-color: var(--border);
  color: var(--text);
}
body[data-theme="dark"] .db-card h3 { color: var(--text); }
body[data-theme="dark"] .db-card h3 .count { background: var(--bg); color: var(--text-light); }
body[data-theme="dark"] .db-card h3 .meta  { color: var(--text-secondary); }

body[data-theme="dark"] .db-item {
  background: var(--bg);
  border-color: var(--border);
}
body[data-theme="dark"] .db-item:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}
body[data-theme="dark"] .db-item .firma { color: var(--text); }
body[data-theme="dark"] .db-item .titel { color: var(--text-light); }
body[data-theme="dark"] .db-item .when  { color: var(--text-light); }

body[data-theme="dark"] .db-empty {
  background: var(--bg);
  color: var(--text-secondary);
  border-color: var(--border);
}
body[data-theme="dark"] .db-loading { color: var(--text-light); }

body[data-theme="dark"] .db-quick button,
body[data-theme="dark"] .db-quick a {
  background: var(--bg-secondary);
  border-color: var(--border);
  color: var(--text);
}
body[data-theme="dark"] .db-quick button:hover,
body[data-theme="dark"] .db-quick a:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}
body[data-theme="dark"] .db-quick .primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
body[data-theme="dark"] .db-quick .primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

body[data-theme="dark"] .erg-badge.good    { background: rgba(74,222,128,.18);  color: #86EFAC; }
body[data-theme="dark"] .erg-badge.bad     { background: rgba(248,113,113,.18); color: #FCA5A5; }
body[data-theme="dark"] .erg-badge.neutral { background: rgba(255,255,255,.08); color: var(--text-light); }
body[data-theme="dark"] .erg-badge.info    { background: rgba(91,141,239,.18);  color: #93B5F4; }
