/* =====================================================================
   Analytics Hub — Design 1:1 am HomePageHeroes-Dashboard (Hero-Board)
   ausgerichtet: Sidebar + schlanker Kopf, Karten
   `rounded-xl border-gray-200 bg-white p-5 shadow-sm`, KPI-Karten mit
   farbiger Icon-Kachel, lucide-Icons, class-basierter Dark Mode.

   Dort ist es Tailwind v4; hier gibt es keinen Build-Schritt, deshalb
   stehen dieselben Werte als CSS-Variablen und Klassen.
   Quelle der Werte: dashboard/src/app/globals.css + CONVENTIONS.md
   ===================================================================== */

:root {
  /* Markenfarben (identisch zu @theme im HPH-Dashboard) */
  --navy-950: #060f22;
  --navy-900: #0a1834;
  --navy-800: #0f2148;
  --navy-700: #16305f;
  --navy-600: #1e4179;
  --hero-600: #e11d2a;
  --hero-700: #a81018;
  --hero-50: #fef2f2;
  --brand-600: #4f46e5;
  --brand-500: #6366f1;
  --brand-50: #eef2ff;

  /* Tailwind-Graustufen, damit die Klassennamen 1:1 übertragbar bleiben */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --gray-950: #030712;

  /* Rollen */
  --flaeche: #fff; /* Karten, Sidebar, Kopf */
  --rand: var(--gray-200);
  --rand-stark: var(--gray-300);
  --text: var(--gray-900);
  --text-leise: var(--gray-500);
  --text-sehr-leise: var(--gray-400);
  --gruen: #059669;
  --rot: #dc2626;
  --schatten: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --schatten-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.dark {
  --flaeche: var(--gray-900);
  --rand: var(--gray-800);
  --rand-stark: var(--gray-700);
  --text: var(--gray-100);
  --text-leise: var(--gray-400);
  --text-sehr-leise: var(--gray-500);
  --gruen: #34d399;
  --rot: #f87171;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  /* Heller CI-Hintergrund wie homepageheroes.io (sanfter Blauverlauf) */
  background: linear-gradient(180deg, #fff 0%, #eef4ff 40%, #f7faff 75%, #fff 100%) fixed;
}
.dark body { background: var(--gray-950); }

a { color: inherit; }
:focus-visible { outline: 2px solid var(--brand-600); outline-offset: 2px; border-radius: 6px; }

.ikon { flex: 0 0 auto; }
.i-3 { width: .875rem; height: .875rem; }
.i-4 { width: 1rem; height: 1rem; }
.i-5 { width: 1.25rem; height: 1.25rem; }
.i-8 { width: 2rem; height: 2rem; }

.leise { color: var(--text-leise); }
.sehr-leise { color: var(--text-sehr-leise); }
.mono { font-variant-numeric: tabular-nums; }

/* =================================================================== */
/* Gerüst: Sidebar links, Kopf + Inhalt rechts                         */
/* =================================================================== */
.rahmen { display: flex; min-height: 100vh; }
.spalte { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.hauptteil { flex: 1; padding: 1rem; }
@media (min-width: 640px) { .hauptteil { padding: 1.5rem; } }
@media (min-width: 1024px) { .hauptteil { padding: 2rem; } }

/* ------------------------------------------------------ Seitenleiste */
.seitenleiste {
  position: sticky; top: 0; z-index: 20;
  display: none; flex-direction: column;
  height: 100vh; width: 15rem; flex-shrink: 0;
  padding: .5rem .5rem 4rem;
  border-right: 1px solid var(--rand);
  background: var(--flaeche);
  box-shadow: var(--schatten);
  transition: width .3s ease-in-out;
}
@media (min-width: 768px) {
  .seitenleiste { display: flex; }
  /* Eingeklappt: nur Icons. Gilt bewusst erst ab md — auf dem Handy ist
     die Leiste eine Schublade und soll immer breit mit Text erscheinen. */
  .seitenleiste.zu { width: 4rem; }
  .seitenleiste.zu .marke-text,
  .seitenleiste.zu .beschriftung,
  .seitenleiste.zu .seitenleiste-fuss,
  .seitenleiste.zu .klapp-text { display: none; }
  .seitenleiste.zu .klapp-ikon .ikon { transform: rotate(180deg); }
}

.marke-block {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem; padding: .5rem 0 1rem;
  border-bottom: 1px solid var(--rand);
}
.marke {
  display: flex; align-items: center; gap: .625rem;
  padding: 0 .375rem; text-decoration: none; min-width: 0;
}
.marke-punkt {
  display: grid; place-content: center; flex: 0 0 auto;
  width: 2.25rem; height: 2.25rem; border-radius: .625rem;
  background: linear-gradient(145deg, var(--brand-500), var(--navy-800));
  color: #fff; font-size: .9375rem; font-weight: 800;
}
.marke-text { min-width: 0; }
.marke-name {
  display: block; font-size: 15px; font-weight: 800;
  letter-spacing: -.025em; color: var(--navy-900);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dark .marke-name { color: var(--gray-100); }
/* Markenschriftzug mit Farbverlauf wie „HomePageHeroes" */
.marke-akzent {
  background: linear-gradient(180deg, #3b82f6 0%, #4f46e5 55%, #7c3aed 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.marke-unter { display: block; font-size: .75rem; color: var(--text-sehr-leise); }

.nav-liste { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: .25rem; }
.nav-eintrag {
  position: relative; display: flex; align-items: center;
  width: 100%; height: 2.75rem; padding: 0;
  border: none; border-left: 2px solid transparent; border-radius: .375rem;
  background: none; color: var(--text-leise);
  font: inherit; font-size: .875rem; text-align: left; cursor: pointer;
  transition: background-color .2s, color .2s;
}
.nav-eintrag .kachel { display: grid; place-content: center; width: 3rem; height: 100%; flex: 0 0 auto; }
.nav-eintrag .beschriftung { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: .75rem; }
.nav-eintrag:hover { background: color-mix(in srgb, var(--brand-50) 60%, transparent); color: var(--navy-900); }
.dark .nav-eintrag:hover { background: var(--gray-800); color: var(--gray-100); }
.nav-eintrag[aria-current='page'] {
  border-left-color: var(--brand-600); background: var(--brand-50);
  color: var(--navy-900); font-weight: 500; box-shadow: var(--schatten);
}
.dark .nav-eintrag[aria-current='page'] { background: var(--gray-800); color: #fff; }

.seitenleiste-fuss { margin: 0; padding: .5rem .75rem; font-size: 11px; color: var(--gray-300); }
.dark .seitenleiste-fuss { color: var(--gray-600); }

.klapp-knopf {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 0; padding: .5rem;
  border: none; border-top: 1px solid var(--rand); background: none;
  font: inherit; font-size: .875rem; color: var(--text-leise); cursor: pointer;
  transition: background-color .2s;
}
.klapp-knopf:hover { background: var(--gray-50); }
.dark .klapp-knopf:hover { background: var(--gray-800); }
.klapp-ikon { display: grid; place-content: center; width: 2.5rem; height: 2.5rem; color: var(--text-sehr-leise); }
.klapp-ikon .ikon { transition: transform .3s; }

/* Mobile: Off-Canvas-Schublade + Abdunkelung */
.nur-mobil { display: inline-flex; }
@media (min-width: 768px) { .nur-mobil { display: none !important; } }
.overlay {
  position: fixed; inset: 0; z-index: 40; background: rgb(0 0 0 / .4);
  opacity: 0; pointer-events: none; transition: opacity .3s;
}
.overlay.offen { opacity: 1; pointer-events: auto; }
@media (min-width: 768px) { .overlay { display: none; } }
@media (max-width: 767px) {
  .seitenleiste {
    position: fixed; inset: 0 auto 0 0; z-index: 50;
    display: flex; width: 18rem; max-width: 85vw; height: 100%;
    padding-bottom: .5rem;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / .25);
    transform: translateX(-100%); transition: transform .3s ease-in-out;
  }
  .seitenleiste.offen { transform: translateX(0); }
  .seitenleiste .klapp-knopf { display: none; }
}

/* ------------------------------------------------------------- Kopf */
.kopf {
  position: sticky; top: 0; z-index: 10;
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem;
  min-height: 3.5rem; padding: .5rem 1rem;
  border-bottom: 1px solid var(--rand); background: var(--flaeche);
}
@media (min-width: 640px) { .kopf { padding: .5rem 1.5rem; flex-wrap: nowrap; } }
@media (max-width: 639px) {
  #drawerAuf { order: 1; }
  .kopf-rechts { order: 2; }
  #zeitWahl { order: 4; }
  .live-pille { order: 5; }
  .konto-block { padding-left: .75rem; gap: .5rem; }
}
.kopf-rechts { margin-left: auto; display: flex; align-items: center; gap: .75rem; }

.knopf-ikon {
  display: inline-flex; align-items: center; justify-content: center;
  height: 2.25rem; width: 2.25rem; flex: 0 0 auto;
  border: 1px solid var(--rand); border-radius: .5rem;
  background: var(--flaeche); color: var(--text-leise);
  cursor: pointer; transition: background-color .2s, color .2s, border-color .2s;
}
.knopf-ikon:hover { background: var(--gray-50); color: var(--text); }
.dark .knopf-ikon:hover { background: var(--gray-800); color: var(--gray-100); }
.knopf-abmelden { border-color: transparent; background: none; color: var(--text-sehr-leise); }
.knopf-abmelden:hover { background: var(--hero-50); color: var(--hero-600); }
.dark .knopf-abmelden:hover { background: color-mix(in srgb, var(--hero-600) 10%, transparent); color: var(--hero-600); }

select.waehler {
  height: 2.25rem; min-width: 0; max-width: 100%;
  border: 1px solid var(--rand); border-radius: .5rem;
  background: var(--flaeche); color: var(--text);
  font: inherit; font-size: .875rem; font-weight: 500;
  padding: 0 2rem 0 .75rem; cursor: pointer;
}
/* Achtung: #projektWahl hatte hier fruehere Regeln (flex: 0 0 15rem) aus der
   Zeit, als die Projektwahl ein <select> im Seitenkopf war. Sie sind entfernt —
   das Element sitzt jetzt in der Seitenleiste, und eine ID sticht jede Klasse,
   also hat die alte Regel die neue Breitenlogik ueberstimmt. */
#zeitWahl { flex: 0 1 10rem; }

.live-pille {
  display: inline-flex; align-items: center; gap: .375rem;
  border-radius: 9999px; padding: .125rem .625rem;
  background: #ecfdf5; color: #047857;
  font-size: .75rem; font-weight: 500; white-space: nowrap;
}
.dark .live-pille { background: rgb(6 78 59 / .3); color: #34d399; }
.live-pille[hidden] { display: none; }
.live-punkt { width: .5rem; height: .5rem; border-radius: 9999px; background: currentColor; animation: pulsieren 2s ease-in-out infinite; }
@keyframes pulsieren { 0%, 100% { opacity: 1 } 50% { opacity: .35 } }
@media (prefers-reduced-motion: reduce) { .live-punkt { animation: none } }

.konto-block {
  display: flex; align-items: center; gap: .75rem;
  border-left: 1px solid var(--rand); padding-left: 1rem;
}
.avatar {
  display: grid; place-content: center; flex: 0 0 auto;
  width: 2.25rem; height: 2.25rem; border-radius: 9999px;
  background: var(--navy-900); color: #fff; font-size: .75rem; font-weight: 700;
}
.dark .avatar { background: var(--navy-700); }
.konto-text { display: none; text-align: right; }
@media (min-width: 640px) { .konto-text { display: block; } }
.konto-text p { margin: 0; }
.konto-text p:first-child { font-size: .875rem; font-weight: 500; line-height: 1.25; }
.konto-text p:last-child { font-size: .75rem; line-height: 1.25; color: var(--text-sehr-leise); }

/* =================================================================== */
/* Seitenkopf (Titel + Beschreibung, wie ui/PageHeader.tsx)            */
/* =================================================================== */
.seitenkopf {
  display: flex; flex-wrap: wrap; align-items: flex-start;
  justify-content: space-between; gap: .75rem 1rem; margin-bottom: 1.5rem;
}
.seitenkopf:empty { display: none; }
.seitenkopf h1 { margin: 0; font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }
.seitenkopf p { margin: .25rem 0 0; font-size: .875rem; color: var(--text-leise); }

/* =================================================================== */
/* Karten                                                              */
/* =================================================================== */
.karte {
  border: 1px solid var(--rand); border-radius: .75rem;
  background: var(--flaeche); box-shadow: var(--schatten);
}
.block { padding: 1.25rem 1.5rem; }
.block > h3 {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  margin: 0 0 1rem; font-size: .9375rem; font-weight: 600;
}
.block > h3 .hinweis { font-weight: 400; font-size: .8125rem; color: var(--text-sehr-leise); }

/* --------------------------------------------------------- Kennzahlen */
.kpis { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.kpis.vier { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) { .kpis.vier { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .kpis.vier { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpis.fuenf { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) { .kpis.fuenf { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .kpis.fuenf { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.kpi { padding: 1.25rem; }
.kpi .kachel { display: inline-flex; border-radius: .5rem; padding: .5rem; }
.kpi .titel { margin: .75rem 0 0; font-size: .75rem; font-weight: 500; color: var(--text-leise); }
.kpi .wert { margin: .25rem 0 0; font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }
.kpi .trend {
  display: flex; align-items: center; gap: .25rem; margin-top: .375rem;
  font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Erklärung statt Prozentwert: darf umbrechen, sonst wird sie abgeschnitten */
.kpi .trend.erklaerung { white-space: normal; }
/* Zusätze, die nur auf breiten Schirmen Platz haben (Trendtext, Live-Pille) */
.nur-breit { display: none; }
@media (min-width: 640px) { .nur-breit { display: inline; } }
.trend.hoch { color: var(--gruen); }
.trend.runter { color: var(--rot); }
.trend.neutral { color: var(--text-sehr-leise); }

/* Farbige Icon-Kacheln (Tailwind-Paletten, hell + dunkel) */
.t-blau   { background: #eff6ff; color: #2563eb; }
.t-indigo { background: #eef2ff; color: #4f46e5; }
.t-rot    { background: #fef2f2; color: #dc2626; }
.t-gruen  { background: #ecfdf5; color: #059669; }
.t-amber  { background: #fffbeb; color: #d97706; }
.t-violet { background: #f5f3ff; color: #7c3aed; }
.t-grau   { background: #f8fafc; color: #475569; }
.dark .t-blau   { background: rgb(30 58 138 / .2);  color: #60a5fa; }
.dark .t-indigo { background: rgb(49 46 129 / .2);  color: #818cf8; }
.dark .t-rot    { background: rgb(127 29 29 / .2);  color: #f87171; }
.dark .t-gruen  { background: rgb(6 78 59 / .2);    color: #34d399; }
.dark .t-amber  { background: rgb(120 53 15 / .2);  color: #fbbf24; }
.dark .t-violet { background: rgb(76 29 149 / .2);  color: #a78bfa; }
.dark .t-grau   { background: rgb(15 23 42 / .4);   color: #94a3b8; }

/* ------------------------------------------------------------- Raster */
.raster-2 { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 1024px) { .raster-2 { grid-template-columns: 1fr 1fr; } }
.abstand { margin-top: 1rem; }

/* ------------------------------------------------------------- Listen */
.liste { display: flex; flex-direction: column; gap: .125rem; }
.zeile {
  position: relative; display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .5rem .625rem; border-radius: .375rem; font-size: .875rem;
}
.zeile .balken { position: absolute; inset: 0 auto 0 0; border-radius: .375rem; background: var(--brand-50); }
.dark .zeile .balken { background: color-mix(in srgb, var(--brand-500) 20%, transparent); }
.zeile .name, .zeile .zahl { position: relative; }
.zeile .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zeile .zahl { font-weight: 600; font-variant-numeric: tabular-nums; flex-shrink: 0; }

/* ------------------------------------------------------------ Tabelle */
.tabelle-huelle { overflow-x: auto; margin: 0 -.5rem; padding: 0 .5rem; }
.tabelle { width: 100%; border-collapse: collapse; font-size: .875rem; }
.tabelle th {
  text-align: left; font-size: .75rem; font-weight: 500;
  color: var(--text-leise); padding: .5rem .625rem;
  border-bottom: 1px solid var(--rand); white-space: nowrap;
}
.tabelle td { padding: .75rem .625rem; border-bottom: 1px solid var(--rand); vertical-align: top; }
.tabelle tr:last-child td { border-bottom: none; }
.tabelle .num { text-align: right; font-variant-numeric: tabular-nums; }
.tabelle tbody tr:hover { background: color-mix(in srgb, var(--brand-500) 4%, transparent); }
a.pfad { color: var(--brand-600); text-decoration: none; }
a.pfad:hover { text-decoration: underline; }
.dark a.pfad { color: var(--brand-500); }

/* --------------------------------------------------- Badges & Hinweise */
.badge {
  display: inline-flex; align-items: center; gap: .25rem;
  border-radius: 9999px; padding: .125rem .625rem;
  font-size: .75rem; font-weight: 500; white-space: nowrap;
}
.badge-gruen { background: #ecfdf5; color: #047857; }
.badge-rot { background: var(--hero-50); color: #b91c1c; }
.badge-grau { background: var(--gray-100); color: var(--gray-600); }
.badge-indigo { background: var(--brand-50); color: var(--brand-600); }
.badge-amber { background: #fffbeb; color: #b45309; }
.dark .badge-gruen { background: rgb(6 78 59 / .3); color: #34d399; }
.dark .badge-rot { background: rgb(127 29 29 / .3); color: #fca5a5; }
.dark .badge-grau { background: var(--gray-800); color: var(--gray-400); }
.dark .badge-indigo { background: color-mix(in srgb, var(--brand-500) 18%, transparent); color: #a5b4fc; }
.dark .badge-amber { background: rgb(120 53 15 / .3); color: #fbbf24; }

/* Anfragen-Tabelle: Datum/Termine nicht umbrechen, lange Nachrichten kappen */
.anfragen-tabelle .nowrap { white-space: nowrap; }
.anfragen-tabelle td.nachricht { max-width: 18rem; }
.anfragen-tabelle td.nachricht .klemm {
  overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.anfragen-tabelle .badge { white-space: nowrap; }

/* Hinweiskästen: erklären, warum Daten fehlen */
.hinweis-box {
  display: flex; gap: .75rem; align-items: flex-start;
  border: 1px solid var(--rand); border-radius: .75rem;
  background: var(--flaeche); box-shadow: var(--schatten);
  padding: 1rem 1.25rem; font-size: .875rem; line-height: 1.6; color: var(--text-leise);
}
.hinweis-box .kachel { display: inline-flex; border-radius: .5rem; padding: .5rem; flex: 0 0 auto; }
.hinweis-box strong { color: var(--text); font-weight: 600; }
.hinweis-box code { font-size: .8125rem; }
.hinweis-box.warn { border-color: color-mix(in srgb, var(--hero-600) 30%, transparent); background: var(--hero-50); color: #991b1b; }
.dark .hinweis-box.warn { background: color-mix(in srgb, var(--hero-600) 8%, transparent); color: #fca5a5; }
.hinweis-box.warn strong { color: #7f1d1d; }
.dark .hinweis-box.warn strong { color: #fecaca; }

/* Leerzustand wie ui/EmptyState.tsx: Icon + Titel + Hinweis */
.leer { padding: 2.5rem 1rem; text-align: center; }
.leer .ikon { color: var(--gray-300); margin-inline: auto; }
.dark .leer .ikon { color: var(--gray-700); }
.leer .titel { margin: .75rem 0 0; font-size: .875rem; font-weight: 500; }
.leer .zusatz { margin: .25rem 0 0; font-size: .8125rem; color: var(--text-sehr-leise); }

/* ------------------------------------------------------------ Knöpfe */
.knopf, .knopf-still {
  display: inline-flex; align-items: center; gap: .375rem;
  border-radius: .5rem; padding: .5rem 1rem;
  font: inherit; font-size: .875rem; font-weight: 500; cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s;
}
.knopf { border: 1px solid transparent; background: var(--navy-900); color: #fff; }
.knopf:hover { background: var(--navy-700); }
.dark .knopf { background: var(--navy-700); }
.dark .knopf:hover { background: var(--navy-600); }
.knopf-still { border: 1px solid var(--rand-stark); background: var(--flaeche); color: var(--gray-600); }
.knopf-still:hover { border-color: var(--brand-600); color: var(--brand-600); }
.dark .knopf-still { color: var(--gray-400); }
.knopf-gefahr:hover { border-color: var(--hero-600); background: var(--hero-50); color: var(--hero-600); }
.dark .knopf-gefahr:hover { background: color-mix(in srgb, var(--hero-600) 10%, transparent); border-color: var(--hero-600); color: var(--hero-600); }
.knopf-klein { padding: .375rem .625rem; font-size: .8125rem; }

/* ---------------------------------------------------------- Formulare */
.feld {
  width: 100%; font: inherit; font-size: .875rem;
  padding: .5rem .75rem; border: 1px solid var(--rand-stark); border-radius: .5rem;
  background: var(--flaeche); color: var(--text);
}
.dark .feld { border-color: var(--gray-700); background: var(--gray-900); }
.feld::placeholder { color: var(--text-sehr-leise); }
.feld-klein { padding: .375rem .5rem; font-size: .8125rem; }
.formular { display: grid; gap: 1rem; }
.formular label { display: block; font-size: .875rem; font-weight: 500; }
.formular label .feld { margin-top: .375rem; font-weight: 400; }
.formular .zusatz { font-weight: 400; color: var(--text-sehr-leise); }
.formular .meldung { margin: 0; min-height: 1.25em; font-size: .875rem; }
.formular fieldset { margin: 0; border: 1px solid var(--rand); border-radius: .5rem; padding: .75rem 1rem; }
.formular legend { padding: 0 .375rem; font-size: .75rem; font-weight: 500; color: var(--text-leise); }
.formular fieldset label { display: flex; align-items: center; gap: .5rem; padding: .25rem 0; font-weight: 400; }
.zeilenform { display: flex; gap: .375rem; align-items: center; }

.diagramm { position: relative; height: 260px; }
.lade { opacity: .45; transition: opacity .2s; }

/* =================================================================== */
/* Anmeldung                                                           */
/* =================================================================== */
.anmelde-seite { display: grid; place-items: center; min-height: 100vh; padding: 2rem 1.25rem; }
.anmelde-karte { width: 100%; max-width: 24rem; padding: 2rem; }
.anmelde-karte .marke { justify-content: center; margin-bottom: 1.75rem; }
.anmelde-karte .marke-name { font-size: 1.0625rem; }
.anmelde-form { display: flex; flex-direction: column; gap: 1rem; }
.anmelde-form label { display: block; font-size: .875rem; font-weight: 500; }
.anmelde-form input { width: 100%; }
.anmelde-form .feld { margin-top: .375rem; font-weight: 400; }
.anmelde-form .knopf { justify-content: center; padding: .625rem 1rem; margin-top: .25rem; }

/* ============================================================
   Projektwahl in der Seitenleiste — zeigt jederzeit, auf welcher
   Domain man gerade ist. Die aktive Zeile bekommt Akzentfarbe und
   einen Balken links; Farbe allein reicht nicht (Rot-Gruen-Schwaeche),
   deshalb zusaetzlich fett + Haken.
   ============================================================ */
.projekt-block { box-sizing: border-box; max-width: 100%; padding: .5rem .5rem .25rem; border-bottom: 1px solid var(--rand, #e5e7eb); }
.projekt-block > h4 {
  margin: 0 0 .375rem; padding: 0 .5rem;
  font-size: .6875rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--leise, #6b7280);
}
.projekt-liste { display: grid; gap: 2px; }
.projekt-eintrag {
  display: flex; align-items: center; gap: .5rem; width: 100%;
  padding: .4rem .5rem; border: 0; border-radius: .5rem;
  background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
  border-left: 3px solid transparent;
}
.projekt-eintrag:hover { background: var(--flaeche-2, #f1f5f9); }
.projekt-eintrag .pj-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .875rem; }
.projekt-eintrag .pj-domain { display: block; font-size: .6875rem; color: var(--leise, #6b7280); overflow: hidden; text-overflow: ellipsis; }
.projekt-eintrag[aria-current='true'] {
  background: color-mix(in srgb, var(--akzent, #4f46e5) 12%, transparent);
  border-left-color: var(--akzent, #4f46e5);
  font-weight: 600;
}
.projekt-eintrag[aria-current='true'] .pj-name { color: var(--akzent, #4f46e5); }
.pj-punkt { width: 8px; height: 8px; border-radius: 50%; background: var(--leise, #9ca3af); flex: none; }
.projekt-eintrag[aria-current='true'] .pj-punkt { background: var(--akzent, #4f46e5); box-shadow: 0 0 0 3px color-mix(in srgb, var(--akzent, #4f46e5) 20%, transparent); }
.pj-stift { opacity: 0; border: 0; background: none; cursor: pointer; color: var(--leise, #6b7280); padding: 2px; border-radius: .25rem; }
.projekt-eintrag:hover .pj-stift, .projekt-eintrag:focus-within .pj-stift { opacity: 1; }
.pj-stift:hover { color: var(--akzent, #4f46e5); }
.seitenleiste.zu .projekt-block > h4,
.seitenleiste.zu .projekt-eintrag .pj-name,
.seitenleiste.zu .projekt-eintrag .pj-stift { display: none; }

/* ============================================================
   Detailfenster fuer eine Anfrage
   ============================================================ */
.modal-hg {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center;
  background: rgba(15, 23, 42, .55); padding: 1rem;
}
.modal {
  background: var(--flaeche, #fff); color: inherit;
  border-radius: .875rem; border: 1px solid var(--rand, #e5e7eb);
  width: min(46rem, 100%); max-height: 88vh; overflow: auto;
  box-shadow: 0 24px 48px rgba(0, 0, 0, .28);
}
.modal-kopf {
  display: flex; align-items: center; gap: .75rem;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--rand, #e5e7eb);
  position: sticky; top: 0; background: inherit; border-radius: .875rem .875rem 0 0;
}
.modal-kopf h3 { margin: 0; font-size: 1rem; flex: 1; }
.modal-koerper { padding: 1.25rem; }
.modal-koerper dl { display: grid; grid-template-columns: 10rem 1fr; gap: .5rem 1rem; margin: 0; }
.modal-koerper dt { color: var(--leise, #6b7280); font-size: .8125rem; }
.modal-koerper dd { margin: 0; }
.modal-koerper .lang { white-space: pre-wrap; }
@media (max-width: 640px) { .modal-koerper dl { grid-template-columns: 1fr; gap: .125rem .5rem; } }
.zeile-klickbar { cursor: pointer; }
.zeile-klickbar:hover { background: var(--flaeche-2, #f8fafc); }

/* Konto-Menue oben rechts: Konto + Verwaltung + Abmelden */
.waehler-schmal { min-width: 6.5rem; }
.konto-menue { position: relative; }
button.konto-block {
  display: flex; align-items: center; gap: .5rem;
  background: none; border: 0; font: inherit; color: inherit; cursor: pointer;
  padding: .25rem .375rem; border-radius: .5rem;
}
button.konto-block:hover { background: var(--flaeche-2, #f1f5f9); }
.konto-pfeil {
  width: 6px; height: 6px; flex: none; margin-left: .125rem;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg); opacity: .5; transition: transform .15s;
}
button.konto-block[aria-expanded='true'] .konto-pfeil { transform: rotate(-135deg); }
.konto-klapp {
  position: absolute; right: 0; top: calc(100% + .375rem); z-index: 50;
  min-width: 13rem; padding: .375rem;
  background: var(--flaeche, #fff); border: 1px solid var(--rand, #e5e7eb);
  border-radius: .625rem; box-shadow: 0 12px 28px rgba(0, 0, 0, .16);
}
.konto-klapp button, .konto-klapp .abmelde-form button {
  display: flex; align-items: center; gap: .5rem; width: 100%;
  padding: .5rem .625rem; border: 0; border-radius: .5rem;
  background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.konto-klapp button:hover { background: var(--flaeche-2, #f1f5f9); }
.konto-klapp hr { border: 0; border-top: 1px solid var(--rand, #e5e7eb); margin: .375rem 0; }
.konto-klapp .gefahr { color: #b91c1c; }

/* Projektwahl in der Seitenleiste als Auswahlfeld, aktives Projekt farbig */
.projekt-waehler {
  display: flex; align-items: center; gap: .375rem; padding: 0 .5rem .25rem;
  box-sizing: border-box; max-width: 100%;
}
.projekt-waehler .pj-stift { opacity: .6; }
.projekt-waehler .pj-stift:hover { opacity: 1; }
.projekt-domain-zeile {
  padding: 0 .5rem .5rem; font-size: .6875rem; color: var(--leise, #6b7280);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.seitenleiste.zu .projekt-waehler, .seitenleiste.zu .projekt-domain-zeile { display: none; }

/* --- Anfragen: Bearbeitungsstand, Preis, Ausblenden --- */

/* Das Auswahlfeld sieht aus wie ein Etikett, verhaelt sich aber wie ein
   Auswahlfeld — der Stand ist auf einen Blick lesbar UND direkt aenderbar,
   ohne die Zeile vorher oeffnen zu muessen. Farben wie bei .badge-*. */
.status-wahl {
  appearance: none; -webkit-appearance: none;
  border: 1px solid transparent; border-radius: 999px;
  padding: .25rem 1.35rem .25rem .6rem; cursor: pointer;
  font: inherit; font-size: .75rem; font-weight: 600; line-height: 1.2;
  background-repeat: no-repeat; background-position: right .4rem center; background-size: .55rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%23999' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
}
.status-wahl:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 1px; }

.s-offen    { background: #fffbeb; color: #b45309; }
.s-geplant  { background: var(--brand-50); color: var(--brand-600); }
.s-erledigt { background: #ecfdf5; color: #047857; }
.s-abgesagt { background: var(--gray-100); color: var(--gray-600); }
.dark .s-offen    { background: rgb(120 53 15 / .3); color: #fbbf24; }
.dark .s-geplant  { background: color-mix(in srgb, var(--brand-500) 18%, transparent); color: #a5b4fc; }
.dark .s-erledigt { background: rgb(6 78 59 / .3); color: #34d399; }
.dark .s-abgesagt { background: var(--gray-800); color: var(--gray-400); }

.tabelle th.num, .tabelle td.num { text-align: right; }
/* Tabellenziffern: sonst springen die Spaltenbreiten beim Neuladen. */
.preis { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.preis-ab { font-weight: 400; font-size: .75rem; color: var(--text-sehr-leise); }

.preis-liste { margin: 0; padding: 0; list-style: none; }
.preis-liste li { display: flex; justify-content: space-between; gap: 1rem; padding: .15rem 0; }

/* Ausgeblendete Zeilen bleiben lesbar, treten aber deutlich zurueck. */
.zeile-aus { opacity: .45; }
.zeile-aus td:not(:last-child) { text-decoration: line-through; text-decoration-thickness: 1px; }

.knopf-weg { opacity: 0; transition: opacity .12s ease; }
tr:hover .knopf-weg, tr:focus-within .knopf-weg { opacity: .7; }
.knopf-weg:hover, .knopf-weg:focus-visible { opacity: 1; color: var(--rot); }
/* Touch: ohne Zeigegeraet gibt es kein Hover — dann dauerhaft sichtbar. */
@media (hover: none) { .knopf-weg { opacity: .7; } }

.karte h3 .knopf-klein { margin-left: auto; }
.knopf-klein {
  display: inline-flex; align-items: center; gap: .35rem;
  border: 1px solid var(--rand); border-radius: 8px; background: var(--flaeche);
  padding: .3rem .6rem; font: inherit; font-size: .78rem; font-weight: 500;
  color: var(--text-leise); cursor: pointer;
}
.knopf-klein:hover { color: var(--text); border-color: var(--rand-stark); }
.knopf-klein.aktiv { color: var(--brand-600); border-color: var(--brand-500); background: var(--brand-50); }
.dark .knopf-klein.aktiv { background: color-mix(in srgb, var(--brand-500) 15%, transparent); }

/* ============================================================
   Eigenes Auswahlmenue (Ersatz fuer <select>)
   Chrome auf dem Mac zeichnet die Optionsliste eines <select> als
   System-Menue — nicht gestaltbar. Darum Knopf + eigenes Popup.
   ============================================================ */
.wahl-huelle { position: relative; display: block; min-width: 0; }

.wahl-knopf {
  display: flex; align-items: center; gap: .4rem; width: 100%;
  box-sizing: border-box; min-width: 0;
  border: 1px solid var(--rand); border-radius: 9px; background: var(--flaeche);
  padding: .45rem .6rem; cursor: pointer;
  font: inherit; font-size: .875rem; font-weight: 500; color: var(--text);
  text-align: left; line-height: 1.3;
}
.wahl-knopf:hover { border-color: var(--rand-stark); }
.wahl-knopf:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 1px; }
.wahl-text { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wahl-pfeil { flex: none; opacity: .5; transition: transform .15s ease; }
.wahl-knopf[aria-expanded="true"] .wahl-pfeil { transform: rotate(180deg); }

/* Projektwahl: als Akzent hervorgehoben — man sieht sofort, wo man ist. */
.wahl-knopf.wahl-projekt {
  font-weight: 600; color: var(--brand-600);
  background: var(--brand-50); border-color: transparent;
}
.dark .wahl-knopf.wahl-projekt {
  color: #a5b4fc; background: color-mix(in srgb, var(--brand-500) 16%, transparent);
}
.wahl-knopf.wahl-projekt:hover { border-color: var(--brand-500); }

/* Sprachkuerzel: schmal, nur zwei Zeichen. */
.wahl-knopf.wahl-kurz { width: auto; padding: .45rem .5rem; font-weight: 600; letter-spacing: .03em; }

.wahl-popup {
  position: absolute; z-index: 60; top: calc(100% + 4px); left: 0;
  /* Darf breiter werden als der Knopf — in der schmalen Seitenleiste braeche
     "QP Business & IT Solutions" sonst um. Das Menue schwebt ohnehin ueber
     dem Inhalt, es darf die Leiste also ueberragen. */
  min-width: 100%; width: max-content; max-width: min(17rem, calc(100vw - 2rem));
  max-height: min(60vh, 22rem); overflow-y: auto;
  display: grid; gap: 1px; padding: 4px;
  border: 1px solid var(--rand); border-radius: 11px;
  background: var(--flaeche); box-shadow: var(--schatten-md);
  animation: wahl-auf .12s ease-out;
}
.wahl-popup.nach-oben { top: auto; bottom: calc(100% + 4px); }
@keyframes wahl-auf { from { opacity: 0; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .wahl-popup { animation: none; } }

/* Rechtsbuendig aufklappen, wenn der Knopf am rechten Rand sitzt (Kopfzeile). */
.kopf .wahl-popup { left: auto; right: 0; }

.wahl-eintrag {
  display: flex; align-items: center; gap: .5rem; width: 100%;
  box-sizing: border-box; border: 0; border-radius: 7px; background: none;
  padding: .5rem .55rem; cursor: pointer; text-align: left;
  font: inherit; font-size: .875rem; color: var(--text);
}
.wahl-eintrag:hover, .wahl-eintrag:focus-visible { background: var(--gray-100); outline: none; }
.dark .wahl-eintrag:hover, .dark .wahl-eintrag:focus-visible { background: var(--gray-800); }
.wahl-eintrag.gewaehlt { color: var(--brand-600); font-weight: 600; }
.dark .wahl-eintrag.gewaehlt { color: #a5b4fc; }
.wahl-eintrag-text { flex: 1 1 0; min-width: 0; display: grid; gap: 1px; }
/* Die Domain unter dem Namen: verrraet, welche Seite gemeint ist, wenn zwei
   Projekte aehnlich heissen. */
.wahl-zusatz {
  font-size: .75rem; font-weight: 400; color: var(--text-sehr-leise);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wahl-haken { flex: none; }

/* Der Stift darf nicht mitschrumpfen und nicht abgeschnitten werden. */
.projekt-waehler { align-items: stretch; }
.projekt-waehler .wahl-huelle { flex: 1 1 0; min-width: 0; }
.projekt-waehler .pj-stift {
  flex: none; width: 28px; display: grid; place-items: center;
  border: 0; background: none; border-radius: 7px; cursor: pointer;
  color: var(--text-leise); opacity: .6;
}
.projekt-waehler .pj-stift:hover { opacity: 1; background: var(--gray-100); }
.dark .projekt-waehler .pj-stift:hover { background: var(--gray-800); }
.seitenleiste.zu .wahl-huelle { display: none; }

/* --- Aktionen (benannte Klicks) --- */
/* Dreier-Reihe: die Vierer-Regel liesse die Karten hier zu schmal werden. */
.kpis.drei { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .kpis.drei { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .kpis.drei { grid-template-columns: 1fr; } }

/* Zielaktionen (abgeschickte Formulare) heben sich vom Rest ab — sie sind
   das eigentliche Ergebnis, alles andere ist der Weg dorthin. */
.ziel-ikon { color: #047857; margin-right: .35rem; vertical-align: -2px; }
.dark .ziel-ikon { color: #34d399; }

/* Eigener Balken fuer die Aktionen-Tabelle. NICHT .balken wiederverwenden —
   die Klasse ist als absolut positionierter Hintergrund in .zeile belegt. */
.anteil-balken {
  min-width: 80px; height: 6px; border-radius: 999px;
  background: var(--gray-100); overflow: hidden;
}
.dark .anteil-balken { background: var(--gray-800); }
.anteil-balken > span {
  display: block; height: 100%; border-radius: 999px;
  background: var(--brand-500); transition: width .3s ease;
}
@media (prefers-reduced-motion: reduce) { .anteil-balken > span { transition: none; } }


/* ---------------------------------------------------- Zeitraum-Leiste
   Steht ueber den Kacheln, nicht im Kopf: Der Zeitraum gehoert zu den
   Zahlen darunter. Presets und Datumsfelder liegen nebeneinander —
   kein Aufklappen, kein Uebernehmen-Knopf. */
.zeit-leiste {
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem;
  margin: 0 0 1.25rem;
}
.zeit-presets {
  display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px;
  background: var(--gray-100); border-radius: 9px;
}
.dark .zeit-presets { background: var(--gray-800); }
.zeit-preset {
  padding: .4375rem .75rem; min-height: 34px; border: 0; background: none;
  font: inherit; font-size: .8125rem; font-weight: 500; color: var(--text-leise);
  border-radius: 7px; cursor: pointer; white-space: nowrap;
}
.zeit-preset:hover { color: var(--text); }
.zeit-preset.aktiv {
  background: var(--flaeche); color: var(--brand-600); box-shadow: var(--schatten);
}
.dark .zeit-preset.aktiv { color: #a5b4fc; }
.zeit-preset:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 1px; }

.zeit-spanne { display: inline-flex; align-items: flex-end; gap: .5rem; }
.zeit-spanne label { display: grid; gap: .2rem; }
.zeit-spanne label > span {
  font-size: .6875rem; font-weight: 500; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-sehr-leise);
}
/* Native Datumsfelder: bringen Tastatur, Kalenderblatt und Landesformat mit. */
.zeit-spanne input[type="date"] {
  font: inherit; font-size: .8125rem; padding: .4375rem .5rem; min-height: 34px;
  border: 1px solid var(--rand); border-radius: 7px;
  background: var(--flaeche); color: var(--text);
}
.zeit-spanne input:hover { border-color: var(--rand-stark); }
.zeit-spanne input:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 1px; }
.zeit-bis { color: var(--text-sehr-leise); padding-bottom: .5rem; }

@media (max-width: 560px) {
  .zeit-spanne { width: 100%; }
  .zeit-spanne label { flex: 1; }
  .zeit-spanne input[type="date"] { width: 100%; }
}

/* Leadgewinnung: Überschrift innerhalb einer Karte und kleine Nebentexte. */
.karten-titel { margin: 0 0 .25rem; font-size: 1rem; font-weight: 600; }
.klein { font-size: .8125rem; }
.zelle-titel { font-weight: 500; }
.zelle-titel a { color: inherit; text-decoration: none; }
.zelle-titel a:hover { text-decoration: underline; }

/* Einmalpasswort-Dialog: blockiert das Dashboard, bis ein eigenes Passwort steht. */
.pw-tor { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: var(--grund, #f6f7f9); }
.pw-karte {
  width: 100%; max-width: 24rem; background: var(--flaeche, #fff);
  border: 1px solid var(--rand, #e5e7eb); border-radius: 1rem; padding: 1.75rem;
  box-shadow: 0 4px 16px rgba(16,24,40,.09);
}
.pw-karte h1 { margin: 0 0 .25rem; font-size: 1.25rem; }
.pw-karte .leise { margin: 0 0 1.125rem; font-size: .875rem; }
.pw-karte label { display: block; font-size: .8125rem; font-weight: 600; margin-bottom: .75rem; }
.pw-karte input {
  display: block; width: 100%; margin-top: .3125rem; padding: .625rem .75rem; font: inherit;
  border: 1px solid var(--rand, #e5e7eb); border-radius: .5rem; background: inherit; color: inherit;
}
.pw-fehler { background: #fee4e2; color: #b42318; border-radius: .5rem; padding: .5rem .75rem; font-size: .8125rem; margin: 0 0 .875rem; }

/* Kurzmeldung schwebt über allem, damit sie nichts verschiebt. */
.kurzmeldung {
  position: fixed; top: 1rem; left: 50%; z-index: 200;
  transform: translate(-50%, -.75rem); opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  background: #dcfae6; color: #067647; border: 1px solid currentColor;
  border-radius: 999px; padding: .5rem 1.125rem; font-size: .875rem; font-weight: 600;
  box-shadow: 0 4px 16px rgba(16,24,40,.09);
}
.kurzmeldung::before { content: "✓ "; font-weight: 700; }
.kurzmeldung.an { opacity: 1; transform: translate(-50%, 0); }

/* ── Leadgewinnung ─────────────────────────────────────────────────── */
/* Fehlende Plakettenfarbe fuer "kein Kunde" (Anbieter, Jobsuche). */
.badge-lila { background: #f5f3ff; color: #6d28d9; }
.dark .badge-lila { background: rgb(76 29 149 / .3); color: #c4b5fd; }

.lead-filter { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0 .75rem; }
.lead-filter .feld { min-width: 0; }
.lead-filter input[type="search"] { flex: 1 1 16rem; }
.lead-filter select { flex: 0 1 10rem; }
.lead-schalter {
  display: inline-flex; align-items: center; gap: .5rem; padding: .5rem .75rem;
  border: 1px solid var(--rand, #e5e7eb); border-radius: .5rem; font-size: .875rem;
  white-space: nowrap; cursor: pointer;
}

/* Der Score ist die wichtigste Zahl der Zeile - er bekommt Gewicht und einen
   Balken, damit man die Rangfolge sieht, ohne Zahlen zu vergleichen. */
.lead-tabelle td { vertical-align: top; }
.lead-score { width: 5.5rem; }
.lead-zahl { font-size: 1.0625rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.lead-zahl.heiss { color: #b91c1c; }
.lead-zahl.warm  { color: #b45309; }
.lead-zahl.kalt  { color: var(--gray-500, #6b7280); }
.lead-zahl.aus   { color: #6d28d9; }
.lead-balken { display: block; width: 3rem; height: 4px; border-radius: 2px; background: var(--gray-100, #f3f4f6); margin: .3rem 0 0 auto; overflow: hidden; }
.lead-balken i { display: block; height: 100%; background: var(--brand-500, #4f46e5); border-radius: 2px; }
.dark .lead-balken { background: rgb(255 255 255 / .08); }

.lead-titel { font-weight: 500; line-height: 1.35; }
.lead-titel a { color: inherit; text-decoration: none; }
.lead-titel a:hover { text-decoration: underline; }
.lead-marken { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem; margin-top: .3125rem; }
.lead-firma { font-size: .75rem; color: var(--gray-500, #6b7280); }
.nowrap { white-space: nowrap; }

@media (max-width: 700px) {
  .lead-filter select { flex: 1 1 calc(50% - .25rem); }
  .lead-schalter { flex: 1 1 100%; justify-content: center; }
  .lead-score { width: 4rem; }
}
