/* ═══════════════════════════════════════════════════════════════════
   K-CORPORATE-REDESIGN (Sandbox) — Überlagerung über app.css
   Quelle: Design-Projekt „Planungsapp Redesign Mockups" (Turn 1, Light)
   Prinzip: Token-Overrides + gezielte Komponenten-Regeln. Wird NACH
   app.css geladen; app.css bleibt unverändert (Vergleichbarkeit).
   ═══════════════════════════════════════════════════════════════════ */

/* ── Brandon Grotesque (CI-Schrift für Titel & Kennzahlen) ── */
@font-face {
  font-family: 'Brandon';
  src: url('/static/fonts/BrandonGrotesque-Black.otf') format('opentype');
  font-weight: 900;
  font-display: swap;
}
@font-face {
  font-family: 'Brandon';
  src: url('/static/fonts/BrandonGrotesque-Light.otf') format('opentype');
  font-weight: 300;
  font-display: swap;
}

:root {
  /* CD-Basis */
  --primary: #0082C8;
  --primary-dark: #006AAF;
  --primary-light: #1A9FE0;
  --primary-subtle: color-mix(in srgb, #0082C8 10%, #fff);
  --logistik: #14A69A;            /* K-Logistik-Türkis */
  --logistik-dunkel: #0E7C73;

  --font: 'Helvetica Neue', Helvetica, Arial, -apple-system, sans-serif;
  --font-display: 'Brandon', 'Helvetica Neue', sans-serif;

  /* Flächen (CD-Neutrals statt Slate) */
  --bg: #EAEEF3;
  --bg-deep: #DDE4EC;
  --bg-surface: #F8FAFC;
  --bg-hover: #F8FAFC;
  --bg-table-header: #F8FAFC;

  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --border-muted: #E2E8F0;

  --text: #0F172A;
  --text-heading: #0F172A;
  --text-muted: #64748B;
  --text-light: #94A3B8;

  /* Navy-Sidebar (CD-Motiv der Dachmarke) */
  --sidebar-bg: #0B1220;
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active: rgba(0, 130, 200, 0.20);
  --sidebar-active-border: #0082C8;
  --sidebar-text: #8FA0B8;
  --sidebar-text-active: #FFFFFF;
  --sidebar-border: #0B1220;

  --topbar-bg: #FFFFFF;

  --radius: 10px;
  --radius-lg: 14px;

  --shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.12);
}

/* ── Typografie: Brandon für Titel & Kennzahlen ── */
h1, h2,
.topbar-title,
.page-title,
.stat-value {
  font-family: var(--font-display);
  font-weight: 900;
  letter-spacing: 0;
}
.topbar-title { font-size: 19px; }
.stat-value { font-size: 25px; }

/* Card-Header als dezente Uppercase-Labels (wie Mockup) */
.card-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-light);
}

/* ── Sidebar ── */
.sidebar {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.sidebar-logo {
  background: transparent;
  border-bottom: none;
  padding: 22px 18px 18px;
}
.sidebar-logo img { filter: none; }
.sidebar-logo-text { color: #E2E8F0; }
.sidebar-logo-sub { color: #5B6B85; }

.sidebar-section { border-bottom: none; }
.sidebar-section-label {
  color: #5B6B85;
  letter-spacing: 0.14em;
}
.nav-item { border-radius: 9px; }
.nav-item:hover { color: #FFFFFF; }
.nav-item.active { color: #FFFFFF; }
.nav-sub-item { color: #8FA0B8; }
.nav-sub-item:hover { color: #FFFFFF; }
.nav-sub-item.active { color: #FFFFFF; }
.nav-chevron { color: #5B6B85; }

/* Sidebar-Fußzeile (User) auf Navy lesbar halten */
.sidebar > div:last-child { border-top: 1px solid rgba(255, 255, 255, 0.08) !important; }
.sidebar > div:last-child .nav-item > div > div:first-child { color: #E2E8F0 !important; }
.sidebar > div:last-child .nav-item > div > div:last-child { color: #5B6B85 !important; }
#sync-status-chip { color: #5B6B85 !important; }

/* K-Logistik-Akzent in der Navigation */
button[data-group="k-logistik-menu"] .icon i,
div[data-group-children="k-logistik-menu"] .icon i { color: var(--logistik); }

/* Zähler-Badges in der Nav: CD-Blau statt Rot */
.nav-item .badge, .nav-notif-badge { background: var(--primary); }

/* ── Topbar ── */
.topbar { background: var(--topbar-bg); }

/* ── Buttons: flächig statt Verlauf ── */
.btn-primary {
  background: var(--primary);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 30%, transparent);
}
.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 38%, transparent);
  transform: none;
}
.btn-success { background: #10B981; box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25); }
.btn-danger { background: #EF4444; box-shadow: 0 2px 6px rgba(239, 68, 68, 0.25); }

/* ── Karten & KPI ── */
.card, .stat-card { border-color: var(--border); }
.stat-icon { border-radius: 10px; font-size: 18px; width: 42px; height: 42px; }
.stat-icon.blue { background: color-mix(in srgb, #0082C8 12%, #fff); color: #0082C8; }
.stat-icon.green { background: color-mix(in srgb, #10B981 12%, #fff); color: #067647; }
.stat-icon.yellow { background: color-mix(in srgb, #F59E0B 14%, #fff); color: #B45309; }
.stat-icon.purple { background: color-mix(in srgb, #8B5CF6 12%, #fff); color: #6D28D9; }

/* ── Tagesgruppen (Planung, Turn 2): Brandon-Datum ── */
tr.day-header td { font-family: var(--font-display); font-weight: 900; font-size: 13px; }
.day-hdr .dl { font-family: var(--font-display); font-weight: 900; }

/* ── Tabellen (helle Header-Zeile wie Mockup; im Dark-Mode gilt app.css) ── */
thead th {
  background: var(--bg-table-header);
  color: var(--text-light);
  letter-spacing: 0.06em;
}

/* ── Badges als Pills ── */
.badge, [class^="badge-"], [class*=" badge-"] { border-radius: 999px; }

/* ── Mitarbeiterakte (CD Turn 4): Seitenleiste + kompaktes Feldraster ── */
.ma-akte-nav {
  width: 222px;
  flex: none;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
}
.ma-akte-nav-titel {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-light);
  padding: 9px 12px 3px;
}
.ma-akte .ma-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px;
  border: none;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--font);
  text-align: left;
  width: 100%;
}
.ma-akte .ma-nav-item i { color: var(--text-light); font-size: 13px; width: 16px; }
.ma-akte .ma-nav-item:hover { background: rgba(15, 23, 42, 0.05); color: var(--text); }
.ma-akte .ma-nav-item.active {
  background: var(--bg-card);
  font-weight: 700;
  color: var(--text);
  box-shadow: inset 3px 0 0 var(--primary), 0 1px 3px rgba(15, 23, 42, 0.07);
}
.ma-akte .ma-nav-item.active i { color: var(--primary); }
.ma-akte .ma-nav-item[data-tab="kuendigung"],
.ma-akte .ma-nav-item[data-tab="kuendigung"] i { color: #B91C1C; }

/* Feldmaße lt. Mockup 4b: 36px hoch · 3 Spalten · 13px Abstand, Labels normal */
.ma-akte .form-grid, .ma-akte .form-grid-3 { grid-template-columns: repeat(3, 1fr); gap: 13px 18px; }
.ma-akte .form-group { gap: 5px; }
.ma-akte .form-group label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}
.ma-akte input:not([type="checkbox"]):not([type="radio"]),
.ma-akte select {
  height: 36px;
  padding: 0 11px;
  border-radius: 9px;
  font-size: 13.5px;
}
.ma-akte textarea { border-radius: 9px; font-size: 13.5px; }

/* ── VA-Detail (CD Turn 5): Besetzungs-Rail ── */
.rail-filter {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 4px 11px;
  border-radius: 999px;
}
.rail-filter.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}
.rail-filter.joker:not(.active) {
  color: #B45309;
  background: color-mix(in srgb, #F59E0B 11%, var(--bg-card));
  border-color: color-mix(in srgb, #F59E0B 30%, var(--bg-card));
}
.vorschlag-item { border-radius: 9px; }
.vorschlag-item:hover { background: var(--bg-surface); }

/* ═══ Dark-Mode: Sidebar-Werte konsistent halten (Rest wie app.css) ═══ */
body.dark-mode {
  --sidebar-bg: #0B1220;
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active: rgba(0, 130, 200, 0.20);
  --sidebar-text: #8FA0B8;
  --sidebar-text-active: #FFFFFF;
  --sidebar-border: #0B1220;
}

/* CD Turn 7: Kunden */
/* Sperrliste in Rot — analog zu [data-tab="kuendigung"] in der Mitarbeiterakte */
.ma-akte .ma-nav-item[data-tab="tabSperrliste"],
.ma-akte .ma-nav-item[data-tab="tabSperrliste"] i { color: #B91C1C; }

/* Kundenliste: 48px-Raster, ruhige Zeilen (keine unterstrichenen Namen) */
#kunden-table td { height: 48px; padding-top: 6px; padding-bottom: 6px; }
#kunden-table tbody tr.kunden-zeile:hover { background: var(--bg-surface); }

/* ⋯-Zeilenmenü: Einträge als volle Menüzeilen */
.kunden-menue .btn {
  display: flex;
  width: 100%;
  justify-content: flex-start;
  gap: 8px;
  font-size: 12.5px;
  white-space: nowrap;
}

/* ── Kopfleiste auf schmalen Fenstern (CD Turn 6) ──
   app.css blendet unter 768px alle .btn-ghost der Topbar aus. Notizfach und
   Meldungen bleiben erreichbar, das breite Suchfeld weicht stattdessen. */
@media (max-width: 768px) {
  .topbar-actions > #notiz-btn,
  .topbar-actions > #meldung-btn,
  .topbar-actions > #theme-toggle { display: inline-flex !important; }
  #global-suche-feld { display: none !important; }
}

/* ── Dark-Mode-Feinschliff (Review 06.08.2026) ──
   Neue Redesign-Flächen nutzen Variablen; hier nur die Stellen, an denen im
   Dark-Mode sonst zu wenig Kontrast bliebe. */
body.dark-mode .ma-akte .ma-nav-item.active {
  background: var(--bg-surface);
  box-shadow: inset 3px 0 0 var(--primary), 0 1px 3px rgba(0, 0, 0, 0.35);
}
body.dark-mode .rail-filter { background: var(--bg-surface); border-color: var(--border); }
body.dark-mode .rail-filter.joker:not(.active) {
  color: #FCD34D;
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.35);
}
body.dark-mode .vorschlag-item:hover { background: var(--bg-hover); }
/* Suchtreffer-Overlay + Panels: Karten-Hintergrund statt Weiß */
body.dark-mode #global-suche-ergebnis,
body.dark-mode #neu-menu,
body.dark-mode #kopf-panel { background: var(--bg-card); }
body.dark-mode .gs-treffer:hover,
body.dark-mode .neu-eintrag:hover { background: var(--bg-hover); }

/* CD: MA-Liste Filter */
.ma-list-select {
  height: 36px;
  padding: 0 30px 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background-color: var(--bg-card);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2394A3B8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.ma-list-select:hover { border-color: var(--primary); }
.ma-list-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 130, 200, 0.14); }
