/* =============================================================================
   QUALIA Marketing Management — Shared Design System
   =============================================================================
   Zentrales CSS fuer alle internen Tools (Legal/Nachlass, GEO/AIO,
   Briefing/Projekte). Basiert auf dem SOS-Kinderdorf Corporate Design.

   Verwendung: <link rel="stylesheet" href="../design-system.css">
   Tool-Klasse auf <body> setzen: tool-legal | tool-seo | tool-briefing
   ============================================================================= */


/* =============================================================================
   1. CSS Custom Properties (Design Tokens)
   ============================================================================= */

:root {
  /* --- SOS Corporate Colors --- */
  --sos-gruen:        #84BB55;
  --sos-gruen-dunkel: #3B5426;
  --sos-gruen-80:     #9DC977;
  --sos-gruen-50:     #C2DDAA;
  --sos-gruen-20:     #E6F1DD;
  --sos-blau:         #0076B9;
  --sos-gelb:         #FABB00;
  --sos-gelb-hell:    #FFDD00;
  --sos-rot:          #E2003B;
  --orange-warn:      #E88C17;
  --schwarz:          #1a1a2e;
  --grau:             #4B5663;
  --grau-hell:        #9CA3AF;
  --grau-bg:          #F7F8FA;

  /* --- Layout Colors --- */
  --sidebar-bg:       #1a2332;
  --sidebar-hover:    rgba(132, 187, 85, 0.08);
  --sidebar-active:   rgba(132, 187, 85, 0.15);
  --main-bg:          #F0F2F5;
  --card-bg:          #FFFFFF;
  --text-primary:     #1a1a2e;
  --text-secondary:   #5a6577;
  --text-light:       #94a3b8;
  --border-color:     #e8ecf1;

  /* --- Layout Dimensions --- */
  --sidebar-width:    264px;
  --header-height:    64px;
  --radius:           14px;
  --radius-sm:        10px;
  --radius-xs:        6px;
  --shadow:           0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
  --shadow-hover:     0 4px 20px rgba(0, 0, 0, 0.08), 0 8px 32px rgba(0, 0, 0, 0.04);
  --shadow-elevated:  0 8px 40px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  --transition:       all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast:  all 0.15s cubic-bezier(0.4, 0, 0.2, 1);

  /* --- Glass Effect --- */
  --glass-bg:         rgba(255, 255, 255, 0.72);
  --glass-border:     rgba(255, 255, 255, 0.2);
  --glass-blur:       20px;

  /* --- Tool Accent (default = SOS Gruen, overridden per tool) --- */
  --tool-accent:       var(--sos-gruen);
  --tool-accent-dark:  var(--sos-gruen-dunkel);
  --tool-accent-light: var(--sos-gruen-20);
}


/* --- Tool-specific Accent Overrides --- */

body.tool-legal {
  --tool-accent:       #0076B9;
  --tool-accent-dark:  #005a8e;
  --tool-accent-light: #e0f0fa;
}

body.tool-seo {
  --tool-accent:       #FABB00;
  --tool-accent-dark:  #c89600;
  --tool-accent-light: #fff8e0;
}

body.tool-briefing {
  --tool-accent:       #E2003B;
  --tool-accent-dark:  #b8002f;
  --tool-accent-light: #fde8ec;
}

body.tool-seo-analytics {
  --tool-accent:       #0891B2;
  --tool-accent-dark:  #066e8a;
  --tool-accent-light: #e0f7fa;
}

body.tool-medien {
  --tool-accent:       #7C3AED;
  --tool-accent-dark:  #5b21b6;
  --tool-accent-light: #f3e8ff;
}

body.tool-social {
  --tool-accent:       #E11D48;
  --tool-accent-dark:  #be123c;
  --tool-accent-light: #ffe4e9;
}

body.tool-intelligence {
  --tool-accent:       #6366F1;
  --tool-accent-dark:  #4338ca;
  --tool-accent-light: #eef2ff;
}

body.tool-ressortleitung {
  --tool-accent:       #1E3A5F;
  --tool-accent-dark:  #0f1f33;
  --tool-accent-light: #e8edf4;
}

body.tool-content-factory {
  --tool-accent:       #0D9488;
  --tool-accent-dark:  #0f766e;
  --tool-accent-light: #e0f5f3;
}

body.tool-simulation {
  --tool-accent:       #F97316;
  --tool-accent-dark:  #C2410C;
  --tool-accent-light: #FFF7ED;
}


/* =============================================================================
   2. Reset & Base
   ============================================================================= */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: Arial, Calibri, Helvetica, sans-serif;
  background: var(--main-bg);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(132, 187, 85, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(0, 118, 185, 0.04) 0%, transparent 50%);
  color: var(--text-primary);
  line-height: 1.55;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}


/* =============================================================================
   3. Sidebar (.sidebar)
   ============================================================================= */

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: linear-gradient(180deg, #1a2332 0%, #0f1a26 60%, #162030 100%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  border-right: 1px solid rgba(132, 187, 85, 0.08);
}

/* --- Sidebar Logo --- */

.sidebar-logo {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 22px 22px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(132, 187, 85, 0.06) 0%, transparent 100%);
  text-decoration: none;
  transition: background 0.2s ease;
}

a.sidebar-logo:hover {
  background: linear-gradient(180deg, rgba(132, 187, 85, 0.12) 0%, transparent 100%);
}

.sidebar-logo img {
  height: 36px;
  filter: brightness(0) invert(1);
}

.sidebar-logo .subtitle {
  color: var(--sos-gruen-80);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* --- Tool Indicator --- */

.tool-indicator {
  padding: 14px 18px;
  margin: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: center;
}

.tool-indicator .tool-symbol {
  font-size: 24px;
}

.tool-indicator .tool-name {
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 700;
}

.tool-indicator .tool-badge {
  display: inline-block;
  background: var(--tool-accent);
  color: #FFFFFF;
  font-size: 9px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 700;
}

/* --- Nav Sections --- */

.nav-section {
  padding: 16px 0 4px;
}

.nav-section-title {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  color: #506070;
  padding: 0 24px 8px;
  font-weight: 700;
}

/* --- Collapsible Nav Sections --- */
.nav-section.collapsible .nav-section-title {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-right: 20px;
  transition: color 0.2s ease;
}

.nav-section.collapsible .nav-section-title:hover {
  color: #94a3b8;
}

.nav-section.collapsible .nav-section-title::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center/contain no-repeat;
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

.nav-section.collapsible.collapsed .nav-section-title::after {
  transform: rotate(-90deg);
}

.nav-section.collapsible .nav-items-wrap {
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.nav-section.collapsible.collapsed .nav-items-wrap {
  max-height: 0;
}

/* --- Nav Items --- */

.nav-item {
  padding: 9px 14px;
  margin: 2px 12px;
  cursor: pointer;
  border-left: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: #8899aa;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: var(--transition-fast);
  position: relative;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #c8d6e5;
}

.nav-item.active {
  background: var(--sidebar-active);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(132, 187, 85, 0.15);
}

.nav-item .nav-icon {
  font-size: 16px;
  width: 22px;
  text-align: center;
}

/* --- Home-Button (zurueck zur Startseite) --- */

.sidebar-home {
  display: flex;
  margin: 12px;
  padding: 10px 14px;
  background: rgba(132, 187, 85, 0.08);
  border: 1px solid rgba(132, 187, 85, 0.12);
  border-radius: var(--radius-sm);
  color: #9DC977;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  font-family: Arial, Calibri, sans-serif;
  align-items: center;
  gap: 8px;
  transition: var(--transition-fast);
}

.sidebar-home:hover {
  background: rgba(132, 187, 85, 0.15);
  color: #FFFFFF;
  border-color: rgba(132, 187, 85, 0.3);
}

.sidebar-home .home-icon {
  font-size: 16px;
}

/* --- Sidebar Footer --- */

.sidebar-footer {
  margin-top: auto;
  padding: 16px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.15) 0%, transparent 100%);
}

.sidebar-footer .all-tools-link {
  color: var(--sos-gruen-80);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
  transition: var(--transition);
}

.sidebar-footer .all-tools-link:hover {
  color: #FFFFFF;
}

.sidebar-footer .user-info {
  font-size: 12px;
  color: #5a7a9a;
  margin-top: 10px;
}

.sidebar-footer .user-info strong {
  color: #94a3b8;
}


/* =============================================================================
   3b. Icon-Farbsystem (SOS-Gruen 3-Stufen-Palette)
   =============================================================================
   Dunkel  #3B5426 — Sidebar, Dashboard-Card-Icons (prominent)
   Mittel  #5A7A3A — Section-Titles, Report-Cards, Content-Icons
   Hell    #84BB55 — Aktive States, Hover, Highlights
   ============================================================================= */

/* -- Sidebar: Nav-Icons mit gruenem Grundton -- */
.nav-item .nav-icon .i           { color: #9DC977; }
.nav-item:hover .nav-icon .i     { color: #C2DDAA; }
.nav-item.active .nav-icon .i    { color: #84BB55; }

/* -- Sidebar: Tool-Symbol weiss -- */
.tool-indicator .tool-symbol .i  { color: #FFFFFF; }

/* -- Sidebar: Home-Button erbt -- */
.sidebar-home .home-icon .i      { color: #9DC977; }
.sidebar-home:hover .home-icon .i { color: #FFFFFF; }

/* -- Main Content: Section-Titles & Reports (mittel) -- */
.section-icon .i                 { color: #5A7A3A; }
.rc-icon .i                      { color: #5A7A3A; }

/* -- Main Content: Dashboard-Cards (dunkel, prominent) -- */
.dash-icon .i                    { color: #3B5426; }

/* -- Main Content: Chart-Platzhalter (hell, CD-Gruen) -- */
.chart-icon .i                   { color: #84BB55; }

/* -- Header-Buttons (grau, passend zum Header) -- */
.header .btn-icon .i             { color: #4B5663; }
.header .btn-icon:hover .i       { color: #3B5426; }

/* -- Alerts: Semantische Farben beibehalten -- */
/* alert-icons werden in den Tool-Dateien kontextabhaengig gesetzt */


/* =============================================================================
   4. Header (.header)
   ============================================================================= */

.header {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--header-height);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  z-index: 90;
}

.header h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.header-right {
  display: flex;
  gap: 20px;
  align-items: center;
}

.header-logo {
  height: 32px;
}

.badge-tool {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--tool-accent-light);
  color: var(--tool-accent-dark);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.badge-tool .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tool-accent);
  animation: pulse-dot 2s infinite;
}

.notification-bell {
  position: relative;
  font-size: 18px;
  color: var(--text-secondary);
  cursor: pointer;
}

.notification-bell .notification-count {
  position: absolute;
  top: -6px;
  right: -8px;
  background: var(--sos-rot);
  color: #FFFFFF;
  font-size: 10px;
  min-width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.header-date {
  font-size: 13px;
  color: var(--text-secondary);
}


/* =============================================================================
   5. Main Content (.main-content)
   ============================================================================= */

.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  padding: 28px 32px;
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  scroll-behavior: smooth;
}


/* =============================================================================
   5b. Data Source Badge (.data-source-badge)
   ============================================================================= */

.data-source-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 16px;
}

.data-source-badge .dsb-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.data-source-badge.demo {
  background: #FEF3C7;
  border: 1px solid #F59E0B;
  color: #92400E;
}

.data-source-badge.demo .dsb-dot {
  background: #F59E0B;
}

.data-source-badge.live {
  background: var(--sos-gruen-20);
  border: 1px solid var(--sos-gruen);
  color: var(--sos-gruen-dunkel);
}

.data-source-badge.live .dsb-dot {
  background: var(--sos-gruen);
  animation: pulse-live 2s infinite;
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}


/* =============================================================================
   6. Pages (.page)
   ============================================================================= */

.page {
  display: none;
}

.page.active {
  display: block;
}


/* =============================================================================
   7. Animations
   ============================================================================= */

.fade-in {
  animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--sos-gruen);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}


/* =============================================================================
   7b. Stagger Animations (.stagger)
   Kinder eines .stagger-Containers erscheinen nacheinander.
   Verwendung: <div class="kpi-row stagger"> oder <div class="card-grid stagger">
   ============================================================================= */

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.stagger > * {
  opacity: 0;
  animation: fadeInUp 0.4s ease forwards;
}

.stagger > *:nth-child(1)  { animation-delay: 0.04s; }
.stagger > *:nth-child(2)  { animation-delay: 0.08s; }
.stagger > *:nth-child(3)  { animation-delay: 0.12s; }
.stagger > *:nth-child(4)  { animation-delay: 0.16s; }
.stagger > *:nth-child(5)  { animation-delay: 0.20s; }
.stagger > *:nth-child(6)  { animation-delay: 0.24s; }
.stagger > *:nth-child(7)  { animation-delay: 0.28s; }
.stagger > *:nth-child(8)  { animation-delay: 0.32s; }
.stagger > *:nth-child(9)  { animation-delay: 0.36s; }
.stagger > *:nth-child(10) { animation-delay: 0.40s; }
.stagger > *:nth-child(n+11) { animation-delay: 0.44s; }


/* =============================================================================
   7c. Micro-Interactions (Hover-Lifts, Focus-Rings, Transitions)
   Globale Hover- und Focus-Stile fuer interaktive Elemente.
   ============================================================================= */

/* --- Hover Lift: Cards, Buttons, interaktive Container --- */
.card-lift {
  transition: box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-lift:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}

.card-lift:active {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

/* --- Globaler Focus-Ring (F-07) --- */
:focus-visible {
  outline: 2px solid var(--tool-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Focus innerhalb Sidebar: heller Ring auf dunklem Hintergrund */
.sidebar :focus-visible {
  outline-color: var(--sos-gruen-80);
}

/* Input-Elemente: eigener Focus-Stil (ueberschreibt generic) */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--tool-accent);
  box-shadow: 0 0 0 3px var(--tool-accent-light);
}

/* --- Button Hover/Active Micro-Interactions --- */
.btn,
.btn-primary,
.btn-secondary,
.btn-ghost {
  transition: background-color 0.15s ease, color 0.15s ease,
              box-shadow 0.15s ease, transform 0.1s ease;
}

.btn:active,
.btn-primary:active,
.btn-secondary:active,
.btn-ghost:active {
  transform: scale(0.97);
}

/* --- Nav-Item Hover: subtle glow --- */
.nav-item {
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}


/* =============================================================================
   7d. Skeleton Loader (.skeleton)
   Platzhalter waehrend Daten laden. Shimmer-Animation.
   Verwendung: <div class="skeleton skeleton-text"></div>
               <div class="skeleton skeleton-card"></div>
   ============================================================================= */

@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(90deg,
    #e2e8f0 25%, #f1f5f9 37%, #e2e8f0 63%);
  background-size: 800px 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 10px;
  border-radius: 4px;
}

.skeleton-text.short { width: 40%; }
.skeleton-text.medium { width: 70%; }
.skeleton-text.long { width: 95%; }

.skeleton-heading {
  height: 22px;
  width: 60%;
  margin-bottom: 16px;
  border-radius: 4px;
}

.skeleton-card {
  height: 120px;
  border-radius: var(--radius);
}

.skeleton-kpi {
  height: 100px;
  border-radius: var(--radius);
  border-left: 4px solid #e2e8f0;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.skeleton-chart {
  height: 200px;
  border-radius: var(--radius);
}

/* Skeleton Row: mehrere Zeilen als Gruppe */
.skeleton-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.skeleton-row .skeleton-avatar { flex-shrink: 0; }
.skeleton-row .skeleton-text { flex: 1; margin-bottom: 0; }


/* =============================================================================
   7e. Empty State, Error State, Loading State
   Standardisierte Zustandsanzeigen fuer alle Tools.
   Verwendung:
     <div class="state-empty">
       <div class="state-icon">📭</div>
       <h3 class="state-title">Keine Daten vorhanden</h3>
       <p class="state-desc">Erstellen Sie einen neuen Eintrag.</p>
       <button class="btn-primary state-action">Neuen Eintrag erstellen</button>
     </div>
   ============================================================================= */

.state-empty,
.state-error,
.state-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 24px;
  min-height: 200px;
}

.state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.state-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.state-desc {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 360px;
  line-height: 1.6;
  margin-bottom: 20px;
}

.state-action {
  margin-top: 4px;
}

/* Empty State: dezenter Hintergrund */
.state-empty {
  background: var(--card-bg);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius);
}

.state-empty .state-icon { opacity: 0.3; }

/* Error State: rot-akzentuiert */
.state-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
}

.state-error .state-icon { color: var(--sos-rot); opacity: 0.8; }
.state-error .state-title { color: #991b1b; }
.state-error .state-desc { color: #b91c1c; }

/* Loading State: mit Spinner */
.state-loading .spinner {
  margin-bottom: 16px;
}

.state-loading .state-title {
  color: var(--text-secondary);
  font-weight: 600;
}


/* --- Reduced Motion: alle neuen Animationen respektieren --- */
@media (prefers-reduced-motion: reduce) {
  .stagger > *,
  .fade-in,
  .skeleton,
  .card-lift {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .skeleton {
    background: #e2e8f0;
  }
}


/* =============================================================================
   8. KPI Cards (.kpi-row, .kpi-card)
   ============================================================================= */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  border-top: 3px solid var(--sos-gruen);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.kpi-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(180deg, rgba(132, 187, 85, 0.04) 0%, transparent 100%);
  pointer-events: none;
}

.kpi-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
  border-top-color: var(--sos-gruen-80);
}

.kpi-card.gelb  { border-top-color: var(--sos-gelb); }
.kpi-card.gelb::after { background: linear-gradient(180deg, rgba(250, 187, 0, 0.04) 0%, transparent 100%); }
.kpi-card.blau  { border-top-color: var(--sos-blau); }
.kpi-card.blau::after { background: linear-gradient(180deg, rgba(0, 118, 185, 0.04) 0%, transparent 100%); }
.kpi-card.rot   { border-top-color: var(--sos-rot); }
.kpi-card.rot::after { background: linear-gradient(180deg, rgba(226, 0, 59, 0.04) 0%, transparent 100%); }
.kpi-card.accent { border-top-color: var(--tool-accent); }

.kpi-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.kpi-label {
  font-size: 11px;
  color: var(--text-light);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 6px;
  letter-spacing: -0.5px;
  position: relative;
  z-index: 1;
}


/* =============================================================================
   9. Cards (.card)
   ============================================================================= */

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-hover);
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  letter-spacing: -0.2px;
}

.card-body {
  padding: 20px 24px;
}


/* =============================================================================
   10. Tables (.data-table)
   ============================================================================= */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 10.5px;
  text-transform: uppercase;
  background: var(--grau-bg);
  color: var(--text-secondary);
  border-bottom: 2px solid var(--sos-gruen);
  font-weight: 700;
  letter-spacing: 0.8px;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition-fast);
}

.data-table tbody tr:hover {
  background: rgba(132, 187, 85, 0.04);
}

.data-table .case-row {
  cursor: pointer;
}

.data-table .case-row:hover {
  background: var(--sos-gruen-20);
}

.data-table td {
  padding: 12px 16px;
}

.case-nr,
.row-id {
  font-weight: 700;
  color: var(--sos-gruen-dunkel);
  font-family: Consolas, monospace;
  font-size: 12px;
}


/* =============================================================================
   11. Status Badges (.status-badge)
   ============================================================================= */

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.3px;
  border: 1px solid transparent;
}

.status-badge.neu          { background: #dbeafe; color: #1d4ed8; }
.status-badge.bearbeitung,
.status-badge.warnung      { background: #fef3c7; color: #b45309; }
.status-badge.warten       { background: #ffedd5; color: #c2410c; }
.status-badge.abgeschlossen,
.status-badge.bestanden    { background: #dcfce7; color: #15803d; }
.status-badge.offen        { background: #e2e8f0; color: #475569; }
.status-badge.kritisch     { background: #fde8ec; color: #E2003B; }


/* =============================================================================
   12. Dashboard Layout (.dashboard-columns)
   ============================================================================= */

.dashboard-columns {
  display: grid;
  grid-template-columns: 60% 40%;
  gap: 24px;
}

.wiedervorlage-item,
.alert-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border-color);
}

.wiedervorlage-date {
  font-size: 12px;
  font-weight: 700;
  color: var(--sos-rot);
}

.wiedervorlage-desc {
  font-size: 13px;
}

.wiedervorlage-case {
  font-size: 11px;
  color: var(--text-secondary);
}


/* =============================================================================
   13. Filter Bar (.filter-bar)
   ============================================================================= */

.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-bar select,
.filter-bar input {
  padding: 9px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  transition: var(--transition-fast);
  background: var(--card-bg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.filter-bar select:focus,
.filter-bar input:focus {
  outline: none;
  border-color: var(--sos-gruen);
  box-shadow: 0 0 0 3px rgba(132, 187, 85, 0.15);
}


/* =============================================================================
   14. Buttons (.btn)
   ============================================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: var(--transition-fast);
  text-decoration: none;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: linear-gradient(135deg, var(--sos-gruen) 0%, #6fa344 100%);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(132, 187, 85, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #6fa344 0%, var(--sos-gruen-dunkel) 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(132, 187, 85, 0.4);
}

.btn-secondary {
  background: var(--card-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-secondary:hover {
  background: var(--grau-bg);
  border-color: #d0d7df;
}

.btn-accent {
  background: var(--tool-accent);
  color: #FFFFFF;
}

.btn-accent:hover {
  background: var(--tool-accent-dark);
}

.btn-back {
  background: none;
  border: none;
  color: var(--sos-blau);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.btn-back:hover {
  color: #005a8e;
}


/* =============================================================================
   15. Tabs (.tabs, .tab)
   ============================================================================= */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.tab {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition-fast);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
  margin-bottom: -1px;
  border-radius: var(--radius-xs) var(--radius-xs) 0 0;
}

.tab:hover {
  color: var(--text-primary);
  background: rgba(132, 187, 85, 0.05);
}

.tab.active {
  color: var(--sos-gruen-dunkel);
  border-bottom-color: var(--sos-gruen);
  background: rgba(132, 187, 85, 0.06);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}


/* =============================================================================
   16. Drop Zone (.drop-zone)
   ============================================================================= */

.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--sos-gruen);
  background: var(--sos-gruen-20);
}

.drop-zone .drop-icon {
  font-size: 40px;
  color: var(--text-light);
  margin-bottom: 12px;
}

.drop-zone .drop-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
}

.drop-zone .drop-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}


/* =============================================================================
   17. Hero Section (.hero)
   ============================================================================= */

.hero {
  text-align: center;
  padding: 32px 0;
}

.hero h2 {
  font-size: 28px;
  font-weight: 800;
  color: var(--sos-gruen-dunkel);
}

.hero p {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 480px;
  margin: 8px auto 0;
}


/* =============================================================================
   18. Chat Interface (.chat-layout, .chat-main, .chat-sidebar)
   ============================================================================= */

.chat-layout {
  display: grid;
  grid-template-columns: 30% 70%;
  gap: 24px;
  height: calc(100vh - var(--header-height) - 100px);
}

.chat-sidebar {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  overflow-y: auto;
}

.chat-sidebar h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 16px;
}

.chat-question {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--sos-gruen-dunkel);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 4px;
}

.chat-question:hover {
  background: var(--sos-gruen-20);
}

.chat-main {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.chat-bubble {
  max-width: 80%;
  padding: 14px 18px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.chat-bubble.system {
  background: var(--sos-gruen-20);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  margin-right: auto;
}

.chat-bubble.user {
  background: var(--sos-gruen-dunkel);
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
  margin-left: auto;
}

/* Tool-specific user bubble override (use tool-accent-dark when tool class is set) */
body.tool-legal .chat-bubble.user,
body.tool-seo .chat-bubble.user,
body.tool-briefing .chat-bubble.user {
  background: var(--tool-accent-dark);
}

.chat-bubble .bubble-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.chat-bubble.system .bubble-label {
  color: var(--sos-gruen-dunkel);
}

/* Tool-specific system bubble label */
body.tool-legal .chat-bubble.system .bubble-label,
body.tool-seo .chat-bubble.system .bubble-label,
body.tool-briefing .chat-bubble.system .bubble-label {
  color: var(--tool-accent-dark);
}

.chat-bubble.user .bubble-label {
  color: rgba(255, 255, 255, 0.7);
}

.chat-input-area {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 10px;
}

.chat-input-area input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition: var(--transition);
}

.chat-input-area input:focus {
  outline: none;
  border-color: var(--sos-gruen);
  box-shadow: 0 0 0 3px rgba(132, 187, 85, 0.15);
}


/* =============================================================================
   19. Template Cards (.template-layout, .template-grid, .template-card)
   ============================================================================= */

.template-layout {
  display: grid;
  grid-template-columns: 40% 60%;
  gap: 24px;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.template-card {
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.template-card:hover {
  border-color: var(--sos-gruen);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.template-card.selected {
  border-color: var(--sos-gruen);
  background: var(--sos-gruen-20);
}

.template-card .template-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.template-card .template-name {
  font-size: 12px;
  font-weight: 700;
}


/* =============================================================================
   20. Fristen / Columns (.fristen-grid)
   ============================================================================= */

.fristen-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.fristen-column {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.fristen-column-header {
  padding: 14px 20px;
  font-size: 13px;
  font-weight: 700;
  color: #FFFFFF;
  text-transform: uppercase;
}

.fristen-column-header.red    { background: var(--sos-rot); }
.fristen-column-header.yellow { background: #d97706; }
.fristen-column-header.blue   { background: var(--sos-blau); }
.fristen-column-header.green  { background: var(--sos-gruen); }

.fristen-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}


/* =============================================================================
   21. Compliance Checklist (.checklist-group, .checklist-item)
   ============================================================================= */

.checklist-group {
  margin-bottom: 24px;
}

.checklist-group h3 {
  font-size: 15px;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.checklist-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
  align-items: flex-start;
}

.checklist-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--sos-gruen);
  flex-shrink: 0;
  margin-top: 2px;
}

.checklist-item .check-text {
  flex: 1;
  font-size: 13px;
}

.summary-bar {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 14px;
  font-weight: 700;
  color: #15803d;
  text-align: center;
  margin-top: 20px;
}


/* =============================================================================
   22. Bar Charts (CSS-only)
   ============================================================================= */

.chart-container {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  padding: 24px;
  margin-bottom: 24px;
}

.chart-container h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 20px;
}

/* Vertical bar chart */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  height: 180px;
  border-bottom: 2px solid var(--border-color);
}

.bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.bar {
  width: 100%;
  max-width: 48px;
  background: var(--sos-gruen);
  border-radius: 4px 4px 0 0;
  transition: var(--transition);
}

.bar-value {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 4px;
}

.bar-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* Horizontal bar chart */
.hbar-chart {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hbar-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.hbar-label {
  width: 140px;
  font-size: 13px;
  text-align: right;
  flex-shrink: 0;
}

.hbar-track {
  flex: 1;
  height: 28px;
  background: #f1f5f9;
  border-radius: 6px;
  overflow: hidden;
}

.hbar-fill {
  height: 100%;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  padding-left: 10px;
  transition: var(--transition);
}


/* =============================================================================
   23. Plugin / Integration Page
   ============================================================================= */

.plugin-header {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 28px;
}

.plugin-header h2 {
  font-size: 24px;
  font-weight: 800;
  color: var(--sos-gruen-dunkel);
}

.anthropic-badge {
  font-size: 12px;
  color: var(--text-secondary);
  background: #f1f5f9;
  padding: 4px 12px;
  border-radius: 20px;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.skill-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
  cursor: default;
}

.skill-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.skill-card .skill-icon {
  font-size: 28px;
  margin-bottom: 10px;
}

.skill-card .skill-name {
  font-size: 14px;
  font-weight: 700;
}

.skill-card .skill-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.security-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.security-item {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  padding: 16px;
  text-align: center;
}

.security-item .sec-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.security-item .sec-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--sos-gruen);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.stat-card {
  background: linear-gradient(135deg, var(--sos-gruen), var(--sos-gruen-dunkel));
  border-radius: var(--radius);
  padding: 24px;
  color: #FFFFFF;
  text-align: center;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
}

.stat-card .stat-label {
  font-size: 12px;
  opacity: 0.85;
  margin-top: 4px;
}


/* =============================================================================
   24. Detail View Components
   ============================================================================= */

.case-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.detail-row {
  display: flex;
  border-bottom: 1px solid #f1f5f9;
  padding: 10px 0;
}

.detail-label {
  width: 140px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  flex-shrink: 0;
}

.detail-value {
  flex: 1;
  font-size: 13px;
}

.asset-card {
  background: var(--sos-gruen-20);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 12px;
}

.asset-card h4 {
  font-size: 14px;
  margin-bottom: 4px;
}

.asset-card p {
  font-size: 12px;
  color: var(--text-secondary);
}

.asset-card .asset-value {
  font-size: 16px;
  font-weight: 800;
  color: var(--sos-gruen-dunkel);
  margin-top: 6px;
}


/* =============================================================================
   25. Document List
   ============================================================================= */

.doc-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-color);
  align-items: center;
}

.doc-type-badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
}

.doc-type-badge.testament  { background: #f3e8ff; color: #7c3aed; }
.doc-type-badge.erbschein  { background: #dbeafe; color: #1d4ed8; }
.doc-type-badge.brief      { background: #fef3c7; color: #b45309; }
.doc-type-badge.gutachten  { background: #dcfce7; color: #15803d; }
.doc-type-badge.sonstige   { background: #e2e8f0; color: #475569; }
.doc-type-badge.analyse    { background: #fff8e0; color: #c89600; }
.doc-type-badge.bericht    { background: #dbeafe; color: #1d4ed8; }
.doc-type-badge.briefing   { background: #fde8ec; color: #E2003B; }

.doc-info {
  flex: 1;
}

.doc-info .doc-name {
  font-size: 13px;
  font-weight: 600;
}

.doc-info .doc-meta {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
}


/* =============================================================================
   26. Correspondence / Communication
   ============================================================================= */

.corr-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-color);
  align-items: center;
}

.corr-item .corr-icon {
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.corr-item .corr-info {
  flex: 1;
}

.corr-item .corr-title {
  font-size: 13px;
  font-weight: 600;
}

.corr-item .corr-meta {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
}


/* =============================================================================
   27. Timeline
   ============================================================================= */

.timeline {
  padding-left: 24px;
  border-left: 2px solid var(--sos-gruen-50);
}

.timeline-item {
  margin-bottom: 24px;
  padding-left: 20px;
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--sos-gruen);
  border: 2px solid #FFFFFF;
  box-shadow: 0 0 0 2px var(--sos-gruen);
}


/* =============================================================================
   28. Period Selector (Reporting)
   ============================================================================= */

.period-selector {
  display: inline-flex;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 20px;
}

.period-btn {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  background: var(--card-bg);
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
  border-right: 1px solid var(--border-color);
}

.period-btn:last-child {
  border-right: none;
}

.period-btn.active {
  background: var(--sos-gruen);
  color: #FFFFFF;
}


/* =============================================================================
   29. Mini KPIs (Reporting)
   ============================================================================= */

.mini-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.mini-kpi {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  padding: 16px;
}

.mini-kpi .mini-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mini-kpi .mini-value {
  font-size: 22px;
  font-weight: 800;
  margin-top: 4px;
}

.mini-kpi .mini-trend {
  font-size: 12px;
  font-weight: 600;
  margin-top: 2px;
}

.mini-kpi .mini-trend.up   { color: var(--sos-gruen); }
.mini-kpi .mini-trend.down { color: var(--sos-rot); }


/* =============================================================================
   30. KI-Badge (.ki-badge)
   ============================================================================= */

.ki-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--sos-gruen-20), var(--sos-gruen-50));
  color: var(--sos-gruen-dunkel);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 20px;
}


/* =============================================================================
   31. Form Elements (.form-group)
   ============================================================================= */

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.form-group select,
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  transition: var(--transition);
}

.form-group select:focus,
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--sos-gruen);
  box-shadow: 0 0 0 3px rgba(132, 187, 85, 0.15);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}


/* =============================================================================
   32. Letter Preview (.letter-preview-area)
   ============================================================================= */

.letter-preview-area {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  min-height: 300px;
  overflow: hidden;
}

.letter-placeholder {
  text-align: center;
  padding: 64px;
}

.letter-placeholder .letter-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.letter-placeholder p {
  color: var(--text-light);
  font-size: 14px;
}

.letter-header {
  padding: 16px 24px;
  border-bottom: 2px solid var(--sos-gruen);
  background: #f8fafc;
}


/* =============================================================================
   33. Confidence Bars (.confidence-bar)
   ============================================================================= */

.confidence-bar {
  height: 6px;
  background: #f1f5f9;
  border-radius: 3px;
  overflow: hidden;
}

.confidence-bar .confidence-fill {
  height: 100%;
  background: var(--sos-gruen);
  border-radius: 3px;
  transition: var(--transition);
}


/* =============================================================================
   34. Status Card (.status-card)
   ============================================================================= */

.status-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 28px;
}

.status-card .status-dot-lg {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--sos-gruen);
  animation: pulse-dot 2s infinite;
  flex-shrink: 0;
}

.status-card .status-info {
  flex: 1;
}

.status-card .status-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-card .status-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--sos-gruen);
}


/* =============================================================================
   36. Score-Explain Popover (Erlaeuterung von Scores & KPIs)
   =============================================================================
   Verwendung: data-explain="Erklaerungstext" auf jedem klickbaren Score-Element.
   Optional:   data-explain-title="Titel" fuer eigenen Popover-Titel.
   JS:         <script src="../score-explain.js"></script> vor </body>
   ============================================================================= */

[data-explain] {
  cursor: help;
  position: relative;
}

[data-explain]::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 1px;
  background: currentColor;
  opacity: 0.25;
  border-radius: 1px;
}

[data-explain]:hover::after {
  opacity: 0.5;
}

.score-explain-backdrop {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.08);
  animation: explainFadeIn 0.15s ease;
}

.score-explain {
  position: fixed;
  z-index: 1000;
  background: var(--card-bg, #fff);
  border-radius: var(--radius, 12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
  border-top: 3px solid #84BB55;
  padding: 0;
  max-width: 380px;
  min-width: 260px;
  animation: explainSlideIn 0.2s ease;
  font-family: Arial, Helvetica, sans-serif;
}

.score-explain-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.score-explain-title {
  font-size: 14px;
  font-weight: 700;
  color: #3B5426;
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-explain-title .i {
  color: #84BB55;
}

.score-explain-close {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  color: var(--text-light, #9CA3AF);
  font-size: 18px;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.score-explain-close:hover {
  background: var(--grau-bg, #F5F5F5);
  color: var(--text-primary, #000);
}

.score-explain-body {
  padding: 16px 20px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary, #4B5663);
}

.score-explain-body strong {
  color: var(--text-primary, #000);
  font-weight: 600;
}

.score-explain-body .explain-formula {
  display: block;
  margin: 10px 0;
  padding: 10px 14px;
  background: #f0f7eb;
  border-left: 3px solid #84BB55;
  border-radius: 0 6px 6px 0;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12px;
  color: #3B5426;
}

.score-explain-body .explain-scale {
  display: flex;
  gap: 8px;
  margin: 10px 0 4px;
  flex-wrap: wrap;
}

.score-explain-body .explain-scale span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--grau-bg, #F5F5F5);
}

.score-explain-body .explain-scale .scl-good { background: #dcfce7; color: #15803d; }
.score-explain-body .explain-scale .scl-mid  { background: #fef3c7; color: #b45309; }
.score-explain-body .explain-scale .scl-bad  { background: #fde8ec; color: #b91c1c; }

.score-explain-footer {
  padding: 10px 20px 14px;
  font-size: 11px;
  color: var(--text-light, #9CA3AF);
  border-top: 1px solid var(--border-color, #e2e8f0);
}

@keyframes explainSlideIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes explainFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}


/* =============================================================================
   37. Data-Source Annotator (Demo-Daten-Kennzeichnung)
   =============================================================================
   Kennzeichnet Elemente mit data-source Attribut als Demo-Daten und zeigt
   per Mouseover/Klick die benoetigte Datenquelle an.
   JS: <script src="../data-source.js"></script> vor </body>
   ============================================================================= */

/* ── Inline-Indikator auf Demo-Daten ── */
[data-source] {
  cursor: pointer;
  position: relative;
  border-bottom: 2px dashed #D9770640;
  transition: border-color 0.2s ease, background 0.2s ease;
}

[data-source]:hover {
  border-bottom-color: #D97706;
  background: #FEF3C720;
}

/* Mini-Badge rechts oben */
[data-source]::before {
  content: '';
  position: absolute;
  top: -3px;
  right: -3px;
  width: 8px;
  height: 8px;
  background: #D97706;
  border-radius: 50%;
  border: 1.5px solid #fff;
  opacity: 0.7;
  transition: opacity 0.2s ease;
  pointer-events: none;
  z-index: 1;
}

[data-source]:hover::before {
  opacity: 1;
  animation: dsPulse 1.5s ease infinite;
}

@keyframes dsPulse {
  0%, 100% { box-shadow: 0 0 0 0 #D9770640; }
  50%      { box-shadow: 0 0 0 4px #D9770600; }
}

/* Nicht auf Tabellenzeilen-Ebene — nur auf Zellen/Spans */
tr[data-source]::before { display: none; }
tr[data-source] { border-bottom: none; }

/* ── Mouseover-Tooltip ── */
.ds-tooltip {
  position: fixed;
  z-index: 1001;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14), 0 1px 4px rgba(0, 0, 0, 0.08);
  border-left: 3px solid #D97706;
  padding: 10px 14px;
  max-width: 280px;
  min-width: 180px;
  transform: translateX(-50%);
  animation: dsTooltipIn 0.15s ease;
  font-family: Arial, Helvetica, sans-serif;
  pointer-events: none;
}

@keyframes dsTooltipIn {
  from { opacity: 0; transform: translateX(-50%) translateY(4px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.ds-tooltip-header {
  margin-bottom: 6px;
}

.ds-tooltip-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.ds-tooltip-badge .i {
  width: 12px;
  height: 12px;
}

.ds-tooltip-name {
  font-size: 13px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 2px;
}

.ds-tooltip-info {
  font-size: 11px;
  color: #6B7280;
  line-height: 1.4;
  margin-bottom: 4px;
}

.ds-tooltip-cost {
  font-size: 11px;
  font-weight: 600;
  color: #D97706;
}

.ds-tooltip-hint {
  font-size: 10px;
  color: #9CA3AF;
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px solid #f0f0f0;
}

/* ── Klick-Popover (Detail) ── */
.ds-popover-backdrop {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.08);
  animation: explainFadeIn 0.15s ease;
}

.ds-popover {
  position: fixed;
  z-index: 1000;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
  border-top: 3px solid #D97706;
  max-width: 400px;
  min-width: 300px;
  animation: explainSlideIn 0.2s ease;
  font-family: Arial, Helvetica, sans-serif;
}

.ds-pop-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #e2e8f0;
}

.ds-pop-title {
  font-size: 14px;
  font-weight: 700;
  color: #92400E;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ds-pop-title .i {
  color: #D97706;
}

.ds-pop-close {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  color: #9CA3AF;
  font-size: 18px;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.ds-pop-close:hover {
  background: #F5F5F5;
  color: #000;
}

.ds-pop-body {
  padding: 16px 20px;
}

.ds-pop-type-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.ds-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.ds-type-badge .i {
  width: 14px;
  height: 14px;
}

.ds-demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
}

.ds-pop-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 14px;
}

.ds-pop-table td {
  padding: 7px 0;
  font-size: 13px;
  line-height: 1.5;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: top;
}

.ds-pop-table tr:last-child td {
  border-bottom: none;
}

.ds-pop-key {
  color: #6B7280;
  font-weight: 600;
  width: 80px;
  padding-right: 12px !important;
  white-space: nowrap;
}

.ds-pop-val {
  color: #1a1a1a;
}

.ds-pop-val strong {
  color: #D97706;
  font-weight: 700;
}

.ds-pop-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: 8px;
  color: #92400E;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
  width: 100%;
  box-sizing: border-box;
}

.ds-pop-link:hover {
  background: #FEF3C7;
  border-color: #D97706;
  color: #78350F;
}

.ds-pop-link .i {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.ds-pop-footer {
  padding: 10px 20px 14px;
  font-size: 11px;
  color: #9CA3AF;
  border-top: 1px solid #e2e8f0;
}

.ds-pop-footer strong {
  color: #6B7280;
}


/* =============================================================================
   35. Print Styles
   ============================================================================= */

@media print {
  .sidebar {
    display: none !important;
  }

  .header {
    display: none !important;
  }

  .main-content {
    margin: 0 !important;
    padding: 20px !important;
    height: auto !important;
    overflow: visible !important;
  }

  .card {
    page-break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #ccc;
  }

  .kpi-card {
    page-break-inside: avoid;
  }
}


/* =============================================================================
   36. Responsive Grid Helpers
   ============================================================================= */

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}


/* =============================================================================
   37. Intelligence Forecast Widget (Cross-Distribution)
   ============================================================================= */

.forecast-widget {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  border-left: 4px solid #6366F1;
  position: relative;
}

.forecast-widget::before {
  content: '';
  position: absolute;
  top: 12px;
  right: 16px;
  width: 16px;
  height: 16px;
  background-color: #6366F1;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z'/%3E%3C/svg%3E") center/contain no-repeat;
  opacity: 0.5;
}

.forecast-widget .forecast-source {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #6366F1;
  font-weight: 700;
  margin-bottom: 8px;
}

.forecast-widget .forecast-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.forecast-widget .forecast-value {
  font-size: 24px;
  font-weight: 800;
  color: #6366F1;
}

.forecast-widget .forecast-detail {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.forecast-widget .forecast-scenarios {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 12px;
}

.forecast-widget .scenario {
  display: flex;
  align-items: center;
  gap: 4px;
}

.forecast-widget .scenario-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.forecast-widget .scenario-dot.best { background: var(--sos-gruen); }
.forecast-widget .scenario-dot.mid { background: var(--sos-gelb); }
.forecast-widget .scenario-dot.worst { background: var(--sos-rot); }


/* =============================================================================
   38. KI-Cost Monitoring Styles
   ============================================================================= */

.cost-trend-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 80px;
  padding: 0 4px;
}

.cost-trend-bar .bar {
  flex: 1;
  background: linear-gradient(180deg, #8B5CF6 0%, #6D28D9 100%);
  border-radius: 4px 4px 0 0;
  position: relative;
  min-height: 4px;
  transition: height 0.4s ease;
}

.cost-trend-bar .bar .bar-label {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--text-light);
  white-space: nowrap;
}

.cost-trend-bar .bar .bar-value {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.trend-up { color: var(--sos-rot); }
.trend-down { color: var(--sos-gruen); }
.trend-flat { color: var(--text-light); }

.roi-highlight {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  padding: 20px 24px;
  text-align: center;
}

.roi-highlight .roi-factor {
  font-size: 36px;
  font-weight: 800;
  color: var(--sos-gruen-dunkel);
}

.roi-highlight .roi-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}


/* =============================================================================
   29. Dashboard Configurator — Widget System
   =============================================================================
   Audit: Q-13 (try-catch), S-08 (Allowlist), U-03 (Empty State),
          F-01 (ARIA), F-07 (focus-visible), F-11 (aria-expanded),
          F-17 (reduced-motion), F-06 (mobile)
   ============================================================================= */

/* --- Widget Container --- */
.widget {
  position: relative;
  margin-bottom: 24px;
  border-radius: var(--radius);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.widget.widget-hidden {
  display: none !important;
}

.widget.widget-collapsed > *:not(.widget-handle) {
  display: none !important;
}

.widget.widget-collapsed {
  margin-bottom: 8px;
}

.widget.widget-dragging {
  opacity: 0.92;
  pointer-events: none;
}

/* --- Widget Handle (Drag Bar) --- */
.widget-handle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: linear-gradient(135deg, var(--sos-gruen-20) 0%, #f8fafc 100%);
  border: 1px solid var(--border-color);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: grab;
  user-select: none;
  font-family: Arial, sans-serif;
}

.widget-handle:active {
  cursor: grabbing;
}

.widget-handle:focus-visible {
  outline: 2px solid var(--sos-gruen);
  outline-offset: 2px;
}

.widget-handle-icon {
  font-size: 16px;
  color: var(--grau-hell);
  line-height: 1;
  letter-spacing: 1px;
}

.widget-handle-title {
  flex: 1;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.widget-collapse-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  padding: 2px 6px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.widget-collapse-btn:hover {
  background: rgba(0,0,0,0.05);
  border-color: var(--border-color);
}

.widget-collapse-btn:focus-visible {
  outline: 2px solid var(--sos-gruen);
  outline-offset: 1px;
}

/* Collapsed widget: round all corners on handle */
.widget.widget-collapsed .widget-handle {
  border-bottom: 1px solid var(--border-color);
  border-radius: var(--radius);
}

/* --- Widget Placeholder (Drop Target) --- */
.widget-placeholder {
  border: 2px dashed var(--sos-gruen-50);
  border-radius: var(--radius);
  background: var(--sos-gruen-20);
  margin-bottom: 24px;
  transition: height 0.2s ease;
}

/* --- Config Gear Button --- */
.widget-config-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 900;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--sos-gruen);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(59, 84, 38, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.widget-config-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(59, 84, 38, 0.4);
}

.widget-config-btn:focus-visible {
  outline: 3px solid var(--sos-gruen-dunkel);
  outline-offset: 3px;
}

.widget-config-icon {
  line-height: 1;
}

/* --- Settings Drawer (Slide-In Panel) --- */
.widget-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.widget-drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.widget-drawer {
  position: fixed;
  top: 0;
  right: -380px;
  width: 360px;
  height: 100vh;
  background: #fff;
  z-index: 9999;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
  font-family: Arial, sans-serif;
}

.widget-drawer.open {
  right: 0;
}

.widget-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-color);
}

.widget-drawer-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
}

.widget-drawer-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.widget-drawer-close:hover {
  color: var(--text-primary);
}

.widget-drawer-close:focus-visible {
  outline: 2px solid var(--sos-gruen);
  outline-offset: 2px;
}

.widget-drawer-hint {
  padding: 12px 24px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--grau-bg);
  border-bottom: 1px solid var(--border-color);
}

.widget-drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.widget-drawer-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s ease;
}

.widget-drawer-item:hover {
  background: var(--grau-bg);
}

.widget-drawer-item--hidden {
  opacity: 0.5;
}

.widget-drawer-item--hidden .widget-drawer-label {
  text-decoration: line-through;
}

.widget-drawer-item--dragging {
  background: var(--sos-gruen-20);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 10;
  position: relative;
}

.widget-drawer-placeholder {
  border: 2px dashed var(--sos-gruen-50);
  border-radius: 4px;
  margin: 0 16px;
}

.widget-drawer-grip {
  font-size: 14px;
  color: var(--grau-hell);
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
}

.widget-drawer-grip:active {
  cursor: grabbing;
}

.widget-drawer-label {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

/* --- Toggle Switch --- */
.widget-drawer-toggle-wrap {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.widget-drawer-toggle {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.widget-drawer-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #cbd5e1;
  border-radius: 22px;
  transition: background 0.25s ease;
}

.widget-drawer-toggle-slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.25s ease;
}

.widget-drawer-toggle:checked + .widget-drawer-toggle-slider {
  background: var(--sos-gruen);
}

.widget-drawer-toggle:checked + .widget-drawer-toggle-slider::before {
  transform: translateX(18px);
}

.widget-drawer-toggle:focus-visible + .widget-drawer-toggle-slider {
  outline: 2px solid var(--sos-gruen);
  outline-offset: 2px;
}

/* --- Drawer Footer --- */
.widget-drawer-footer {
  display: flex;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: var(--grau-bg);
}

.widget-drawer-footer .btn {
  flex: 1;
}

/* --- Empty State (U-03) --- */
.widget-empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-secondary);
}

.widget-empty-icon {
  font-size: 48px;
  opacity: 0.3;
  margin-bottom: 16px;
}

.widget-empty-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.widget-empty-desc {
  font-size: 13px;
  max-width: 320px;
  margin: 0 auto;
  line-height: 1.6;
}

/* --- Reduced Motion (F-17) --- */
@media (prefers-reduced-motion: reduce) {
  .widget,
  .widget-drawer,
  .widget-drawer-overlay,
  .widget-drawer-toggle-slider,
  .widget-drawer-toggle-slider::before,
  .widget-placeholder,
  .widget-config-btn {
    transition: none !important;
  }
}

/* --- Mobile (F-06): no drag, simpler layout --- */
@media (max-width: 900px) {
  .widget-handle {
    cursor: default;
  }
  .widget-handle-icon {
    display: none;
  }
  .widget-config-btn {
    bottom: 16px;
    right: 16px;
    width: 42px;
    height: 42px;
    font-size: 18px;
  }
  .widget-drawer {
    width: 300px;
    right: -320px;
  }
  .widget-drawer-grip {
    display: none;
  }
}


/* =============================================================================
   40. Modern Scrollbar & Selection
   ============================================================================= */

/* --- Custom Scrollbar --- */
.main-content::-webkit-scrollbar,
.sidebar::-webkit-scrollbar {
  width: 6px;
}

.main-content::-webkit-scrollbar-track {
  background: transparent;
}

.main-content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 3px;
}

.main-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* --- Text Selection --- */
::selection {
  background: rgba(132, 187, 85, 0.2);
  color: var(--text-primary);
}

/* --- Smooth transitions for page-level elements --- */
.section-title {
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* --- KPI Trend indicators --- */
.kpi-trend {
  position: relative;
  z-index: 1;
}

.kpi-trend.up {
  color: var(--sos-gruen);
}

.kpi-trend.down {
  color: var(--sos-rot);
}

.kpi-trend.neutral {
  color: var(--text-light);
}
