/* ============================================================
   REFINED DESIGN SYSTEM 2026 — additive Layer über styles.css
   Geladen NACH styles.css → überschreibt selektiv.
   Revertierbar durch Entfernen des <link>-Tags + dieser Datei.
   ============================================================ */

:root {
  /* ── Color (oklch) — gleicher Brand-Eindruck, ruhiger + tieferer Kontrast ── */
  --rf-brand:        #0f766e;   /* FB Solutions — Petrol/Teal */
  --rf-brand-hover:  #0d9488;
  --rf-brand-quiet:  #e6f2f0;
  --rf-accent:       #7ac143;   /* FB Solutions — Limettengrün */
  --rf-accent-hover: #8ed158;
  --rf-warning:      oklch(76% 0.16 65);
  --rf-danger:       oklch(60% 0.22 25);
  --rf-purple:       oklch(60% 0.20 295);

  --rf-ink:          oklch(20% 0.02 256);   /* near-black, leicht warm */
  --rf-ink-2:        oklch(40% 0.01 256);
  --rf-ink-3:        oklch(47% 0.01 256);   /* WCAG AA ≥4.5:1 auf rf-paper */
  --rf-ink-4:        oklch(75% 0.01 256);

  --rf-paper:        oklch(99% 0.005 256);  /* fast weiß, minimal kühl */
  --rf-paper-2:      oklch(97% 0.005 256);
  --rf-paper-3:      oklch(94% 0.005 256);
  --rf-line:         oklch(92% 0.005 256);
  --rf-line-soft:    oklch(96% 0.005 256);

  /* ── Editorial Type Scale (modular, fluid) ── */
  --rf-text-xs:    clamp(0.75rem, 0.72rem + 0.10vw, 0.8125rem);
  --rf-text-sm:    clamp(0.8125rem, 0.78rem + 0.13vw, 0.875rem);
  --rf-text-base:  clamp(0.9375rem, 0.91rem + 0.13vw, 1rem);
  --rf-text-lg:    clamp(1.0625rem, 1.03rem + 0.16vw, 1.125rem);
  --rf-text-xl:    clamp(1.25rem, 1.20rem + 0.25vw, 1.4375rem);
  --rf-text-2xl:   clamp(1.625rem, 1.55rem + 0.36vw, 1.875rem);
  --rf-text-3xl:   clamp(2rem, 1.85rem + 0.71vw, 2.5rem);
  --rf-text-display: clamp(2.5rem, 2.20rem + 1.45vw, 3.5rem);

  /* ── Type Pairing — DM Sans für Display-Charakter, Inter für UI, JetBrains für Zahlen ── */
  --rf-font-display: 'DM Sans', 'Plus Jakarta Sans', system-ui, sans-serif;
  --rf-font-ui:      'Inter', system-ui, -apple-system, sans-serif;
  --rf-font-mono:    'JetBrains Mono', ui-monospace, monospace;

  /* Letter-spacing per Größe (Display tighter, kleine Schrift airier) */
  --rf-tracking-tight:   -0.025em;
  --rf-tracking-normal:  -0.011em;
  --rf-tracking-wide:    0.025em;
  --rf-tracking-caps:    0.06em;

  /* Line-heights — Editorial: knapp für Display, großzügig für Text */
  --rf-leading-tight:   1.05;
  --rf-leading-snug:    1.25;
  --rf-leading-normal:  1.55;
  --rf-leading-relaxed: 1.7;

  /* ── Radius — kohärentes Ratio (4 → 8 → 14 → 22 → pill) ── */
  --rf-radius-xs:   4px;
  --rf-radius-sm:   8px;
  --rf-radius-md:  14px;
  --rf-radius-lg:  22px;
  --rf-radius-xl:  30px;
  --rf-radius-pill: 999px;

  /* ── Elevation — 5 Layer, intentional für depth, nicht random ── */
  --rf-elev-1: 0 1px 2px rgba(15,17,23,.04), 0 1px 1px rgba(15,17,23,.03);
  --rf-elev-2: 0 1px 2px rgba(15,17,23,.04), 0 4px 8px -2px rgba(15,17,23,.05);
  --rf-elev-3: 0 2px 4px rgba(15,17,23,.04), 0 12px 24px -6px rgba(15,17,23,.08);
  --rf-elev-4: 0 4px 8px rgba(15,17,23,.05), 0 24px 48px -12px rgba(15,17,23,.12);
  --rf-elev-5: 0 8px 16px rgba(15,17,23,.06), 0 40px 80px -16px rgba(15,17,23,.18);
  --rf-glow-brand: 0 0 0 4px oklch(58% 0.20 256 / 0.12);

  /* ── Motion ── */
  --rf-ease-out: cubic-bezier(0.16, 1, 0.3, 1);    /* expo-out, sanft */
  --rf-ease-in:  cubic-bezier(0.7, 0, 0.84, 0);
  --rf-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --rf-dur-fast:   140ms;
  --rf-dur-base:   220ms;
  --rf-dur-slow:   420ms;
}

/* Reduced Motion respektieren */
@media (prefers-reduced-motion: reduce) {
  :root {
    --rf-dur-fast: 0ms;
    --rf-dur-base: 0ms;
    --rf-dur-slow: 0ms;
  }
}

/* ── Bestehende Tokens auf den Refined-Stack mappen (Kaskade abwärts) ── */
:root {
  --brand:        var(--rf-brand);
  --brand-light:  var(--rf-brand-hover);
  --accent:       var(--rf-accent);
  --accent-dark:  oklch(60% 0.16 162);
  --warning:      var(--rf-warning);
  --warning-dark: oklch(64% 0.16 65);
  --danger:       var(--rf-danger);
  --purple:       var(--rf-purple);
  --text:         var(--rf-ink);
  --text-2:       var(--rf-ink-2);
  --text-3:       var(--rf-ink-3);
  --surface:      var(--rf-paper);
  --surface-2:    var(--rf-paper-2);
  --surface-3:    var(--rf-paper-3);
  --border:       var(--rf-line);
  --border-light: var(--rf-line-soft);
  --shadow:       var(--rf-elev-1);
  --shadow-lg:    var(--rf-elev-3);
  --shadow-xl:    var(--rf-elev-4);
  --radius-sm:    var(--rf-radius-xs);
  --radius:       var(--rf-radius-sm);
  --radius-lg:    var(--rf-radius-md);
  --radius-xl:    var(--rf-radius-lg);
  --transition:   var(--rf-dur-base) var(--rf-ease-out);
  --font:         var(--rf-font-ui);
  --font-display: var(--rf-font-display);
  --font-mono:    var(--rf-font-mono);
}

/* ── Body: bessere Default-Typographie ── */
body {
  font-family: var(--rf-font-ui);
  font-size: var(--rf-text-base);
  line-height: var(--rf-leading-normal);
  letter-spacing: var(--rf-tracking-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ── Headings: Display-Font + tight tracking ── */
h1, h2, h3,
.text-display,
.text-h1, .text-h2, .text-h3 {
  font-family: var(--rf-font-display);
  letter-spacing: var(--rf-tracking-tight);
  line-height: var(--rf-leading-tight);
  color: var(--rf-ink);
}
.text-display { font-size: var(--rf-text-display); font-weight: 700; }
.text-h1      { font-size: var(--rf-text-3xl);     font-weight: 700; }
.text-h2      { font-size: var(--rf-text-2xl);     font-weight: 600; }
.text-h3      { font-size: var(--rf-text-xl);      font-weight: 600; }

/* Numerische Werte in mono — KPIs, Beträge, IDs */
.text-num {
  font-family: var(--rf-font-mono);
  font-feature-settings: "tnum" 1, "ss01" 1;
  letter-spacing: -0.01em;
}

/* Caps-Eyebrow für Section-Header (editorial pattern) */
.text-eyebrow {
  font-family: var(--rf-font-ui);
  font-size: var(--rf-text-xs);
  font-weight: 600;
  letter-spacing: var(--rf-tracking-caps);
  text-transform: uppercase;
  color: var(--rf-ink-3);
}

/* ── Buttons: refined rhythm + designed states ── */
.btn {
  padding: 10px 18px;
  border-radius: var(--rf-radius-sm);
  font-family: var(--rf-font-ui);
  font-weight: 600;
  font-size: var(--rf-text-sm);
  letter-spacing: var(--rf-tracking-normal);
  transition:
    background var(--rf-dur-fast) var(--rf-ease-out),
    color var(--rf-dur-fast) var(--rf-ease-out),
    box-shadow var(--rf-dur-base) var(--rf-ease-out),
    transform var(--rf-dur-fast) var(--rf-ease-out),
    border-color var(--rf-dur-fast) var(--rf-ease-out);
  box-shadow: var(--rf-elev-1);
}
.btn:hover  { transform: translateY(-1px); box-shadow: var(--rf-elev-2); }
.btn:active { transform: translateY(0); box-shadow: var(--rf-elev-1); }
.btn-primary { background: var(--rf-brand); color: white; }
.btn-primary:hover { background: var(--rf-brand-hover); box-shadow: var(--rf-elev-2), var(--rf-glow-brand); }
.btn-accent  { background: var(--rf-accent); color: white; }
.btn-accent:hover { background: var(--rf-accent-hover); }
.btn-ghost   { background: transparent; box-shadow: none; border: 1px solid var(--rf-line); }
.btn-ghost:hover { background: var(--rf-paper-2); border-color: var(--rf-ink-4); box-shadow: none; transform: translateY(-1px); }
.btn-sm { padding: 6px 12px; font-size: var(--rf-text-xs); border-radius: var(--rf-radius-xs); }

/* Focus-Ring überall einheitlich */
:focus-visible {
  outline: 2px solid var(--rf-brand);
  outline-offset: 2px;
  border-radius: var(--rf-radius-xs);
}

/* ── Cards: elevation-2 statt random shadow ── */
.card,
.surface-card {
  background: var(--rf-paper);
  border: 1px solid var(--rf-line);
  border-radius: var(--rf-radius-md);
  box-shadow: var(--rf-elev-1);
  transition: box-shadow var(--rf-dur-base) var(--rf-ease-out), border-color var(--rf-dur-base) var(--rf-ease-out);
}
.card:hover { box-shadow: var(--rf-elev-2); }

/* ── License-Gate auf Brand-Token statt hardcoded blue ── */
.auth-btn {
  background: var(--rf-brand);
  font-family: var(--rf-font-ui);
  letter-spacing: var(--rf-tracking-normal);
}
.auth-btn:hover  { background: var(--rf-brand-hover); }
.auth-btn:active { background: oklch(52% 0.20 256); }
.auth-title {
  font-family: var(--rf-font-display);
  letter-spacing: var(--rf-tracking-tight);
}

/* ── Input-Felder: ruhiger fokus, Glas-Effekt erhalten ── */
.form-input, .form-select, .form-textarea {
  font-family: var(--rf-font-ui);
  border-radius: var(--rf-radius-sm);
  transition:
    border-color var(--rf-dur-fast) var(--rf-ease-out),
    box-shadow var(--rf-dur-base) var(--rf-ease-out);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--rf-brand);
  box-shadow: var(--rf-glow-brand);
  outline: none;
}

/* ── Sidebar Brand: Display-Font für Identität ── */
.sidebar-brand .brand-name,
.sidebar .brand-name {
  font-family: var(--rf-font-display);
  letter-spacing: var(--rf-tracking-tight);
  font-weight: 700;
}

/* ── KPI-Werte: konsequent monospace, tabular numerals ── */
.intel-card-value,
.kpi-value,
[data-kpi-value] {
  font-family: var(--rf-font-mono);
  font-feature-settings: "tnum" 1;
  letter-spacing: -0.015em;
  font-weight: 700;
}

/* ── Dark Mode Refinement: nicht reines Schwarz, sondern blau-getöntes Tief ── */
[data-theme="dark"] {
  --rf-paper:     oklch(18% 0.018 256);
  --rf-paper-2:   oklch(22% 0.018 256);
  --rf-paper-3:   oklch(26% 0.018 256);
  --rf-ink:       oklch(96% 0.005 256);
  --rf-ink-2:     oklch(78% 0.01 256);
  --rf-ink-3:     oklch(60% 0.01 256);
  --rf-ink-4:     oklch(40% 0.01 256);
  --rf-line:      oklch(30% 0.018 256);
  --rf-line-soft: oklch(26% 0.018 256);
  --rf-brand:     oklch(70% 0.18 256);
  --rf-brand-hover: oklch(76% 0.18 256);
  --surface:      var(--rf-paper);
  --surface-2:    var(--rf-paper-2);
  --surface-3:    var(--rf-paper-3);
  --text:         var(--rf-ink);
  --text-2:       var(--rf-ink-2);
  --text-3:       var(--rf-ink-3);
  --border:       var(--rf-line);
  --border-light: var(--rf-line-soft);
}

/* ── Non-Dark Theme Bridge — expliziter Werte-Mirror pro Theme.
     GRUND FÜR HARDCODING: :root { --brand: var(--rf-brand); } + themenweite
     --rf-brand: var(--brand) würde einen CSS-Custom-Property-Cycle bilden
     (beide Declarations sind "applied" → Browser macht beide invalid-at-
     computed-value-time, alle Tokens fallen auf Initial leer). Siehe Spec
     CSS Custom Properties Level 2 §2.2.2.
     Werte identisch mit den Legacy-Theme-Blöcken in styles.css.              ── */
[data-theme="light"] {
  /* Default light — nutzt :root-Fallbacks, nur Type/Ink-Ton anpassen falls
     ein aktiveres Licht-Theme gewünscht. Hier keine Overrides → :root wirkt. */
}
[data-theme="sap"] {
  --rf-brand:       #0a6ed1;
  --rf-brand-hover: #1b90ff;
  --rf-accent:      #0f828f;
  --rf-accent-hover: #29b3a6;
  --rf-paper:       #f7f7f7;
  --rf-paper-2:     #edeff0;
  --rf-paper-3:     #e3e6e8;
  --rf-ink:         #32363a;
  --rf-ink-2:       #445268; /* WCAG AA: 5.5:1 auf #f7f7f7 */
  --rf-ink-3:       #5a6268; /* WCAG AA: 5.2:1 auf #f7f7f7 */
  --rf-line:        #d9dce0;
  --rf-line-soft:   #e5e8eb;
  --rf-glow-brand:  0 0 0 4px rgba(10,110,209,.18);
}
[data-theme="ocean"] {
  --rf-brand:       #0077b6;
  --rf-brand-hover: #0096c7;
  --rf-accent:      #00b4d8;
  --rf-accent-hover: #48cae4;
  --rf-paper:       #f0f9ff;
  --rf-paper-2:     #e0f2fe;
  --rf-paper-3:     #bae6fd;
  --rf-ink:         #0c4a6e;
  --rf-ink-2:       #075985;
  --rf-ink-3:       #334e68; /* WCAG AA: 7.7:1 auf #f0f9ff (war #0284c7 → 3.84:1) */
  --rf-line:        #bae6fd;
  --rf-line-soft:   #e0f2fe;
  --rf-glow-brand:  0 0 0 4px rgba(0,119,182,.22);
}
[data-theme="warm"] {
  --rf-brand:       #b45309;
  --rf-brand-hover: #d97706;
  --rf-accent:      #059669;
  --rf-accent-hover: #34d399;
  --rf-paper:       #fffbf5;
  --rf-paper-2:     #fef7ed;
  --rf-paper-3:     #fde9d0;
  --rf-ink:         #422006;
  --rf-ink-2:       #78350f;
  --rf-ink-3:       #7c5a32; /* WCAG AA: 5.0:1 auf #fffbf5 (war #a0845c → 3.42:1) */
  --rf-line:        #e8d5b8;
  --rf-line-soft:   #f3e8d5;
  --rf-glow-brand:  0 0 0 4px rgba(180,83,9,.22);
}
[data-theme="takasago"] {
  --rf-brand:       #a81b4b;
  --rf-brand-hover: #c9305f;
  --rf-accent:      #198754;
  --rf-accent-hover: #34d399;
  --rf-paper:       #f9fafb;
  --rf-paper-2:     #f3f4f6;
  --rf-paper-3:     #e5e7eb;
  --rf-ink:         #0c0d0e;
  --rf-ink-2:       #4b5058; /* WCAG AA: 7.0:1 */
  --rf-ink-3:       #6b7280; /* WCAG AA: 4.7:1 auf #f9fafb (war #9ca3af → 2.43:1) */
  --rf-line:        #dee2e6;
  --rf-line-soft:   #eaeff0;
  --rf-glow-brand:  0 0 0 4px rgba(168,27,75,.24);
}

/* ── Global Selection: brand-tinted (Default / Dark) ── */
::selection {
  background: oklch(58% 0.20 256 / 0.18);
  color: inherit;
}

/* ── Scrollbar: subtil, nicht aufdringlich ── */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--rf-ink-4) transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--rf-ink-4);
  border-radius: var(--rf-radius-pill);
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background-color: var(--rf-ink-3); background-clip: content-box; }

/* ============================================================
   PHASE 2 — BENTO DENSITY auf Dashboard + Sendungs-Übersicht
   ============================================================ */

/* Page-Header: editorial weight, less cramped */
.page-header {
  margin-bottom: clamp(1.5rem, 1rem + 2vw, 3rem);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--rf-line-soft);
  align-items: flex-end;
}
.page-header .page-title h1 {
  font-family: var(--rf-font-display);
  font-size: var(--rf-text-3xl);
  font-weight: 700;
  letter-spacing: var(--rf-tracking-tight);
  line-height: var(--rf-leading-tight);
  margin-bottom: 4px;
}
.page-header .page-title .subtitle {
  font-family: var(--rf-font-ui);
  font-size: var(--rf-text-sm);
  color: var(--rf-ink-3);
  font-weight: 500;
  letter-spacing: 0;
}

/* Theme-Toggle: kompakter, gehört nicht in den Hauptweg des Auges */
.theme-toggle {
  background: var(--rf-paper-2);
  border-radius: var(--rf-radius-pill);
  padding: 2px;
  gap: 0;
  box-shadow: inset 0 0 0 1px var(--rf-line-soft);
}
.theme-toggle .theme-btn {
  padding: 5px 11px;
  font-size: var(--rf-text-xs);
  border-radius: var(--rf-radius-pill);
  font-weight: 600;
  letter-spacing: var(--rf-tracking-normal);
  border: none;
  background: transparent;
  color: var(--rf-ink-3);
  transition: background var(--rf-dur-fast) var(--rf-ease-out), color var(--rf-dur-fast) var(--rf-ease-out);
}
.theme-toggle .theme-btn:hover { color: var(--rf-ink); background: transparent; }
.theme-toggle .theme-btn.active {
  background: var(--rf-paper);
  color: var(--rf-ink);
  box-shadow: var(--rf-elev-1);
}

/* Uniformes KPI-Grid — auto-fit Spalten, alle Karten gleiche Größe.
   Bento-Asymmetrie war intern logisch (Hero + Medium + Small), wirkte aber
   visuell wie kaputtes CSS. Stattdessen: ruhiges Raster, gleicher Rhythmus. */
@media (min-width: 768px) {
  .dash-section .stats-grid,
  .stats-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-lg);
  }
  .dash-section .stats-grid > .stat-card,
  .stats-grid > .stat-card {
    grid-column: span 1;
    padding: 18px 20px;
  }
}
@media (min-width: 1280px) {
  .dash-section .stats-grid,
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
}

/* Stat-Card: ruhige Karte mit klarem Hierarchy-Zeichen */
.stat-card {
  background: var(--rf-paper);
  border: 1px solid var(--rf-line);
  border-radius: var(--rf-radius-md);
  padding: 18px 20px;
  box-shadow: var(--rf-elev-1);
  transition: box-shadow var(--rf-dur-base) var(--rf-ease-out), transform var(--rf-dur-base) var(--rf-ease-out);
  position: relative;
  overflow: hidden;
}
.stat-card:hover {
  box-shadow: var(--rf-elev-2);
  transform: translateY(-1px);
}
.stat-card .stat-label,
.stat-card [data-kpi-label] {
  font-family: var(--rf-font-ui);
  font-size: var(--rf-text-xs);
  color: var(--rf-ink-3);
  font-weight: 500;
  letter-spacing: var(--rf-tracking-caps);
  text-transform: uppercase;
}

/* Asymmetrisches grid-2 (Aktivitäten dominant, Kritische sekundär) */
.dash-section .grid-2 {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: var(--space-lg);
}
@media (max-width: 900px) {
  .dash-section .grid-2 { grid-template-columns: 1fr; }
}

/* Dash-Section-Header: editorial eyebrow */
.dash-section-header {
  font-family: var(--rf-font-ui);
  font-size: var(--rf-text-xs);
  font-weight: 600;
  letter-spacing: var(--rf-tracking-caps);
  text-transform: uppercase;
  color: var(--rf-ink-3);
  padding: 14px 18px;
  border-bottom: 1px solid var(--rf-line-soft);
}

/* ============================================================
   PHASE 3 — COMMAND-PALETTE FIRST: Sidebar quieter, K-Hint stärker
   ============================================================ */

/* Sidebar: schlanker, weniger visuelle Last */
:root {
  --sidebar-w: 248px;
}
.sidebar {
  background: linear-gradient(180deg, oklch(15% 0.018 256) 0%, oklch(12% 0.018 256) 100%);
  border-right: 1px solid oklch(25% 0.018 256);
}
/* Subtile bg-Patterns: noch leiser */
.sidebar::before { opacity: 0.15 !important; }
.sidebar::after  { opacity: 0 !important; }  /* Cargo-Bild ganz weg, war zu unruhig */

/* Sidebar-Brand */
.sidebar-brand {
  padding: 22px 18px 18px;
  border-bottom: 1px solid oklch(28% 0.018 256);
}
.sidebar-brand::after { display: none; }  /* doppelte Linie weg */
.sidebar-brand .brand-name {
  font-family: var(--rf-font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: var(--rf-tracking-tight);
}
.sidebar-brand .brand-sub {
  font-size: 11px;
  color: rgba(255,255,255,.4);
  letter-spacing: var(--rf-tracking-caps);
  text-transform: uppercase;
  font-weight: 500;
}

/* Sidebar Search-Box: prominent, mit ⌘K-Hint */
.sidebar .search-box {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  color: rgba(255,255,255,.85);
  font-size: var(--rf-text-sm);
  border-radius: var(--rf-radius-sm);
  padding: 9px 44px 9px 14px;
  width: 100%;
  font-family: var(--rf-font-ui);
  transition: background var(--rf-dur-fast), border-color var(--rf-dur-fast);
}
.sidebar .search-box::placeholder { color: rgba(255,255,255,.45); }
.sidebar .search-box:focus {
  background: rgba(255,255,255,.10);
  border-color: rgba(99,134,255,.5);
  outline: none;
  box-shadow: 0 0 0 3px rgba(99,134,255,.15);
}
/* ⌘K Hint-Kbd am rechten Rand der Search-Box */
.sidebar .search-wrap { position: relative; }
.sidebar .search-wrap::after {
  content: '⌘K';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--rf-font-mono);
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,.5);
  background: rgba(255,255,255,.08);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,.08);
  pointer-events: none;
  letter-spacing: 0.05em;
}

/* Nav-Group-Labels: hoher Kontrast für Lesbarkeit (WCAG-AA auf dunkler Sidebar) */
.nav-group-label {
  font-family: var(--rf-font-ui);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: var(--rf-tracking-caps);
  text-transform: uppercase;
  color: rgba(255,255,255,.82);
  padding: 14px 18px 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color var(--rf-dur-fast);
}
.nav-group-label:hover { color: #fff; }
.nav-group.collapsed .nav-group-label { color: rgba(255,255,255,.55); }
.nav-group.collapsed .nav-group-label:hover { color: rgba(255,255,255,.9); }
.nav-collapse-icon { width: 10px; height: 10px; opacity: .6; transition: transform var(--rf-dur-fast); }
.nav-group.collapsed .nav-collapse-icon { transform: rotate(-90deg); }

/* Nav-Items: klarere Hierarchie, ruhiger Hover */
.nav-item {
  padding: 8px 16px;
  margin: 1px 8px;
  border-radius: var(--rf-radius-sm);
  font-family: var(--rf-font-ui);
  font-size: var(--rf-text-sm);
  font-weight: 500;
  color: rgba(255,255,255,.72);
  letter-spacing: var(--rf-tracking-normal);
  transition: background var(--rf-dur-fast) var(--rf-ease-out), color var(--rf-dur-fast) var(--rf-ease-out);
}
.nav-item:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}
.nav-item.active {
  background: rgba(99,134,255,.15);
  color: #fff;
  font-weight: 600;
}
.nav-item.active::before {
  background: var(--rf-brand);
  width: 3px;
  height: 50%;
}
.nav-item .nav-icon { opacity: 0.8; }
.nav-item.active .nav-icon { opacity: 1; }

/* Sidebar-Footer: schlanker */
.sidebar-footer-icons {
  border-top: 1px solid oklch(28% 0.018 256);
  padding: 10px 12px;
}
.sidebar-icon-btn {
  font-size: 10px;
  color: rgba(255,255,255,.45);
  border-radius: var(--rf-radius-xs);
}
.sidebar-icon-btn:hover { background: rgba(255,255,255,.08); color: rgba(255,255,255,.9); }

/* Main-Content nach links rückt mit dem schmalereren Sidebar */
.main { margin-left: var(--sidebar-w); }

/* Cmd+K Palette (bestehender CommandPalette) — angedeutete Glow-Box */
.command-palette,
.cmdk-overlay {
  backdrop-filter: blur(12px);
  background: oklch(15% 0.018 256 / 0.6);
}

/* Reduzierter Kontrast für den noch kleineren Sidebar — Brand bleibt aufmerksamkeitsstärkster Punkt */
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .nav-group-label { display: none; }
.sidebar.collapsed .search-wrap::after { display: none; }
.sidebar.collapsed .sidebar-brand { padding: 14px 8px; }

/* ── Dashboard-UX-Polish ────────────────────────────────────────
   Greeting (pp-headline) sitzt jetzt NACH dem page-header → kompakter darstellen.
   Empty-State-Warenwert: keine 4 leere €0,00-Kacheln, dezenter Hinweis.
   Header-Buttons: Icon + Label nebeneinander.
   FAB: Icon + winziges Label darunter.
*/
/* ── Sticky-Header beim Scrollen ──────────────────────────────
   Page-Header (Titel + Action-Buttons + Kompakt + User-Badge) bleibt am
   oberen Viewport-Rand kleben, damit Aktionen jederzeit erreichbar sind.
   Filter-/Tab-Bars in den großen Listen-Views (Anfragen, Sendungen,
   Tracking, DPL, Pickups, Archiv, Rechnungen) docken direkt unter dem
   Page-Header an. */
/* Sticky braucht einen scrollbaren Vorfahren der TATSÄCHLICH scrollt.
   <main id="main-content"> hatte overflow-y:auto, aber Höhe=Inhalt (kein
   interner Scroll) → Sticky-Anchor war main, Window-Scroll lief aber via
   body → Sticky engagierte nie. Fix: main + view auf overflow visible
   damit body/window der Scroll-Container ist. */
main#main-content,
.view {
  overflow: visible !important;
}

/* Spezifität-Override: bestehende #v-dashboard .page-header / #v-analytics
   .page-header haben ID-Selektoren mit höherer Spezifität, daher !important
   für die layout-kritischen Eigenschaften. Background bleibt theme-aware. */
.view .page-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 80 !important;
  background: var(--rf-paper, var(--bg, #fff));
  background-image: linear-gradient(to bottom, var(--rf-paper, var(--bg, #fff)) 70%, transparent);
  margin-bottom: var(--space-md, 14px);
  padding-top: 8px;
  transition: box-shadow .15s;
}
/* Wenn nicht ganz oben: dezenter Schatten als Tiefen-Hint */
.view .page-header.is-stuck {
  box-shadow: 0 4px 14px -8px rgba(0,0,0,.18);
}
[data-theme="dark"] .view .page-header,
.dark .view .page-header,
body[data-oled="on"] .view .page-header {
  background: var(--rf-paper, oklch(11% .015 256));
  background-image: linear-gradient(to bottom, oklch(11% .015 256) 70%, transparent);
}

/* Status-Tabs / Filter-Bars in den Listen-Views direkt unter Page-Header sticky.
   Generic .tabs ist NUR als direktes Kind des View-Containers sticky (also nicht
   in Modals/Inhalts-Cards wo .tabs auch genutzt wird). */
.view > .tabs,
.view .status-tabs,
.view .ship-filters,
.view .inq-filters,
.view .view-toolbar,
.view .filter-bar {
  position: sticky !important;
  top: 88px;  /* Page-Header-Höhe — anpassbar; wird via min-height/auto natürlich begrenzt */
  z-index: 70;
  background: var(--rf-paper, var(--bg, #fff));
  padding: 8px 0;
  margin-bottom: 0;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
[data-theme="dark"] .view > .tabs,
[data-theme="dark"] .view .status-tabs,
[data-theme="dark"] .view .ship-filters,
[data-theme="dark"] .view .inq-filters,
[data-theme="dark"] .view .view-toolbar,
[data-theme="dark"] .view .filter-bar,
.dark .view > .tabs, .dark .view .status-tabs, .dark .view .ship-filters,
.dark .view .inq-filters, .dark .view .view-toolbar, .dark .view .filter-bar,
body[data-oled="on"] .view > .tabs,
body[data-oled="on"] .view .status-tabs,
body[data-oled="on"] .view .ship-filters,
body[data-oled="on"] .view .inq-filters,
body[data-oled="on"] .view .view-toolbar,
body[data-oled="on"] .view .filter-bar {
  background: oklch(11% .015 256);
}

/* Ausnahme: Dashboard hat KEIN Filter-Bar und ein „Pin" wäre im Weg
   bei den vielen Widgets. Page-Header bleibt aber sticky (siehe oben). */

/* Modal-Header sticky in scroll-baren Modals */
.modal-overlay .modal .modal-title,
.modal-overlay .modal-title,
.modal-overlay .modal-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--rf-paper, #fff);
  border-bottom: 1px solid var(--rf-line, #e5e7eb);
}
[data-theme="dark"] .modal-overlay .modal .modal-title,
[data-theme="dark"] .modal-overlay .modal-title,
[data-theme="dark"] .modal-overlay .modal-header,
.dark .modal-overlay .modal .modal-title,
.dark .modal-overlay .modal-title,
.dark .modal-overlay .modal-header,
body[data-oled="on"] .modal-overlay .modal .modal-title,
body[data-oled="on"] .modal-overlay .modal-title,
body[data-oled="on"] .modal-overlay .modal-header {
  background: oklch(15% .015 256);
}

.pp-headline.pp-headline--compact {
  margin: 4px 0 12px;
  padding: 0;
}
.pp-headline.pp-headline--compact .pp-display {
  font-size: clamp(0.95rem, 0.85rem + 0.4vw, 1.15rem);
  font-weight: 500;
  color: var(--rf-ink-2, #4b5563);
}
.pp-headline.pp-headline--compact .pp-kicker { display: none; }
.pp-headline.pp-headline--compact .pp-divider { display: none; }

/* Warenwert Empty-State — minimaler Hinweis statt 281px-Block */
.gv-kpi-card.gv-kpi-card--empty { padding: 10px 16px; }
.gv-kpi-card.gv-kpi-card--empty .gv-head { margin: 0; }
.gv-coverage.gv-coverage--neutral { color: var(--rf-ink-3, #6b7280) !important; }

/* Icon-Buttons im Dashboard-Header: Label sichtbar (kein Icon-Rätsel mehr) */
.btn .btn-label {
  margin-left: 4px;
  font-size: 12px;
  font-weight: 500;
  vertical-align: middle;
}
@media (max-width: 1280px) {
  /* Auf engeren Viewports nur Icon — Tooltip bleibt */
  .btn .btn-label { display: none; }
}

/* Floating-Toolbar (FAB): Icon + winziges Label */
.vp-fab .vp-fab-btn { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; position: relative; }
.vp-fab .vp-fab-ic { font-size: 16px; line-height: 1; }
.vp-fab .vp-fab-lbl { font-size: 9px; line-height: 1; opacity: .85; letter-spacing: .02em; }
.vp-fab .vp-fab-badge { position: absolute; top: -2px; right: -2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: #ef4444; color: #fff; font-size: 9px; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px var(--rf-paper, #fff); }

/* Primäre Tagesaktionen (Neue Anfrage / Neue Sendung) hervorgehoben */
.vp-fab .vp-fab-btn.vp-fab-cta {
  background: linear-gradient(135deg, var(--rf-brand, #4361ee) 0%, color-mix(in oklch, var(--rf-brand, #4361ee) 70%, #000) 100%);
  color: #fff;
  border-radius: 10px;
  padding: 6px 8px;
  box-shadow: 0 2px 8px color-mix(in oklch, var(--rf-brand, #4361ee) 35%, transparent), inset 0 1px 0 rgba(255,255,255,.15);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.vp-fab .vp-fab-btn.vp-fab-cta .vp-fab-lbl { opacity: 1; font-weight: 700; }
.vp-fab .vp-fab-btn.vp-fab-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px color-mix(in oklch, var(--rf-brand, #4361ee) 45%, transparent), inset 0 1px 0 rgba(255,255,255,.2);
  filter: brightness(1.05);
}
.vp-fab .vp-fab-btn.vp-fab-cta:active { transform: translateY(0); filter: brightness(.95); }
/* Dark / OLED: etwas hellere Brand-Farbe für Lesbarkeit */
[data-theme="dark"] .vp-fab .vp-fab-btn.vp-fab-cta,
body[data-oled="on"] .vp-fab .vp-fab-btn.vp-fab-cta {
  background: linear-gradient(135deg, oklch(62% 0.18 256) 0%, oklch(48% 0.16 256) 100%);
  box-shadow: 0 2px 10px oklch(50% 0.18 256 / 0.45), inset 0 1px 0 rgba(255,255,255,.18);
}

/* Alter Speed-Dial unten rechts ausgeblendet — KI-Agent + Termine sind jetzt
   in der zentralen FAB-Bar, Backup im 'Mehr'-Popover unter '💾 System'. */
.speed-dial { display: none !important; }

/* Smart-Insights theme-aware — vorher hardcoded weißer Hintergrund + dunkler Text
   wurde in Dark/Takasago/Ozean Theme unsichtbar (dark on dark). */
.ht-insights {
  background: linear-gradient(135deg, color-mix(in oklch, var(--rf-brand, #4361ee) 8%, var(--rf-paper, #fff)), var(--rf-paper, #fff)) !important;
  border-color: color-mix(in oklch, var(--rf-brand, #4361ee) 35%, var(--rf-line, #e5e7eb)) !important;
}
.ht-insights-head h3 {
  color: var(--rf-ink, var(--text, #111)) !important;
}
.ht-insight {
  background: var(--rf-paper, var(--surface, #fff)) !important;
  border: 1px solid var(--rf-line, var(--border, #e5e7eb)) !important;
}
.ht-text {
  color: var(--rf-ink-2, var(--text, #374151)) !important;
}
/* Dark-Theme Override */
[data-theme="dark"] .ht-insights,
.dark .ht-insights,
body[data-oled="on"] .ht-insights {
  background: linear-gradient(135deg, oklch(20% .04 256), oklch(12% .015 256)) !important;
  border-color: oklch(30% .04 256) !important;
}
[data-theme="dark"] .ht-insights-head h3,
.dark .ht-insights-head h3,
body[data-oled="on"] .ht-insights-head h3 {
  color: oklch(94% .005 256) !important;
}
[data-theme="dark"] .ht-insight,
.dark .ht-insight,
body[data-oled="on"] .ht-insight {
  background: oklch(15% .015 256) !important;
  border-color: oklch(25% .03 256) !important;
}
[data-theme="dark"] .ht-text,
.dark .ht-text,
body[data-oled="on"] .ht-text {
  color: oklch(88% .01 256) !important;
}

/* Compact-Mode Header: deutlicher als clickable kennzeichnen — größerer
   Hover-Effekt, klarer Cursor, größeres Hit-Target. Vorher zu subtil. */
.cm-group-header {
  cursor: pointer;
  min-height: 48px;
  transition: background .15s, box-shadow .15s, border-color .15s;
}
.cm-group-header:hover {
  border-color: var(--rf-brand, #4361ee) !important;
  box-shadow: 0 0 0 2px color-mix(in oklch, var(--rf-brand, #4361ee) 12%, transparent);
}
.cm-group-header .cm-group-chev {
  flex-shrink: 0;
  margin-left: 4px;
}
.cm-group-header:not(.is-open) .cm-group-label::after {
  content: '  ▸ aufklappen';
  font-size: 10px;
  font-weight: 400;
  color: var(--rf-ink-3, #6b7280);
  margin-left: 6px;
  opacity: .7;
}

/* Alte Drag-Handles (⠿) verstecken — werden durch das neue universelle
   Drag-Reorder-System (.dr-handle) ersetzt. */
.dash-widget-drag {
  display: none !important;
}

/* Universelles Drag-Reorder — Hover-Handle links oben auf jedem Widget */
.dr-handle {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  color: var(--rf-ink-3, #9ca3af);
  font-size: 13px;
  line-height: 1;
  border-radius: 6px;
  z-index: 5;
  opacity: 0;
  transition: opacity .12s ease, background .12s, color .12s;
  user-select: none;
  pointer-events: auto;
}
/* Sichtbar nur on-hover über dem Widget — kein permanentes Visual-Rauschen */
.gv-kpi-card:hover > .dr-handle,
#pipelineBar:hover > .dr-handle,
#dashIntelAlerts:hover > .dr-handle,
#todayWidget:hover > .dr-handle,
.ht-insights:hover > .dr-handle,
#spediteurScorecard:hover > .dr-handle,
#cashflowDashWidget:hover > .dr-handle,
#nigeriaComplianceWidget:hover > .dr-handle,
#africaComplianceWidget:hover > .dr-handle,
#demurrageWidget:hover > .dr-handle,
#etaDriftWidget:hover > .dr-handle,
#receivablesWidget:hover > .dr-handle,
#dashWidgetContainer:hover > .dr-handle,
#dashSectionStats:hover > .dr-handle,
#dashFavSection:hover > .dr-handle,
#dashSectionCards:hover > .dr-handle,
#agentMonitorWidget:hover > .dr-handle {
  opacity: 0.7;
}
.dr-handle:hover {
  opacity: 1 !important;
  background: var(--rf-paper-2, var(--surface-3, #f3f4f6));
  color: var(--rf-ink, #111);
}
.dr-handle:active {
  cursor: grabbing;
}
.dr-dragging {
  opacity: 0.4;
  outline: 2px dashed var(--rf-brand, #4361ee);
  outline-offset: 2px;
}
.dr-drop-before {
  box-shadow: 0 -3px 0 0 var(--rf-brand, #4361ee);
}
.dr-drop-after {
  box-shadow: 0 3px 0 0 var(--rf-brand, #4361ee);
}
/* Dark-Theme */
[data-theme="dark"] .dr-handle,
.dark .dr-handle,
body[data-oled="on"] .dr-handle {
  color: oklch(60% .01 256);
}
[data-theme="dark"] .dr-handle:hover,
.dark .dr-handle:hover,
body[data-oled="on"] .dr-handle:hover {
  background: oklch(20% .02 256);
  color: oklch(94% .005 256);
}
