:root {
  --brand-primary: #4F46E5;
  --brand-primary-hover: #4338CA;
  --brand-primary-soft: #EEF2FF;
  --brand-navy: #1E1B4B;
  --brand-cream: #FAF7EE;
  --bg-app: #F8F7FB;
  --surface: #FFFFFF;
  --border: #E5E7EB;
  --border-soft: #F1F5F9;
  --text: #0F172A;
  --text-muted: #64748B;
  --text-soft: #94A3B8;

  --status-hoch-bg: #FEE2E2;
  --status-hoch-text: #B91C1C;
  --status-mittel-bg: #FEF3C7;
  --status-mittel-text: #B45309;
  --status-niedrig-bg: #DCFCE7;
  --status-niedrig-text: #166534;
  --status-prog-bg: #DBEAFE;
  --status-prog-text: #1D4ED8;
  --status-warten-bg: #FFEDD5;
  --status-warten-text: #C2410C;
  --status-offen-bg: #F1F5F9;
  --status-offen-text: #475569;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; background: var(--bg-app); color: var(--text); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* Sidebar – dunkles Navy wie im Mockup */
.sidebar {
  background: var(--brand-navy);
  border-right: 1px solid #14123A;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  color: #E0E7FF;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
  margin-bottom: 24px;
  padding: 0 8px;
}

.sidebar-logo img {
  max-width: 100%;
  max-height: 64px;
  width: auto;
  height: auto;
}

.nav-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #C7D2FE;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.nav-link:hover { background: rgba(99, 102, 241, 0.18); color: #FFFFFF; }
.nav-link.active {
  background: var(--brand-primary);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 6px 16px -6px rgba(79, 70, 229, 0.6);
}
.nav-link .nav-badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.1);
  color: #C7D2FE;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.nav-link.active .nav-badge { background: rgba(255, 255, 255, 0.25); color: white; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 12px;
  color: #FFFFFF;
}
.sidebar-user .role-label {
  color: #A5B4FC;
}
.avatar {
  width: 36px; height: 36px;
  border-radius: 999px;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  flex-shrink: 0;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.green { background: linear-gradient(135deg, #10B981, #34D399); }
.avatar.amber { background: linear-gradient(135deg, #F59E0B, #FBBF24); }
.avatar.pink   { background: linear-gradient(135deg, #EC4899, #F472B6); }
.avatar.slate  { background: linear-gradient(135deg, #475569, #64748B); }

.tui-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: #A5B4FC;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.tui-badge .dot { width:6px; height:6px; background:#E30613; border-radius:999px; }

/* Topbar */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 32px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar-search {
  flex: 0 1 720px;
  max-width: 720px;
  position: relative;
}
.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-search input {
  width: 100%;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-app);
  padding: 0 14px 0 44px;
  font-size: 14px;
  outline: none;
  transition: all .15s;
}
.topbar-search input:focus { border-color: var(--brand-primary); background: white; box-shadow: 0 0 0 4px var(--brand-primary-soft); }
.topbar-search .search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-soft); }
.topbar-search .kbd {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-size: 11px; color: var(--text-soft); border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px;
  background: white;
}

.icon-btn {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--bg-app);
  border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: all .15s;
}
.icon-btn:hover { background: white; color: var(--brand-primary); }
.icon-btn .dot-badge {
  position: absolute;
  top: 6px; right: 6px;
  width: 16px; height: 16px;
  background: var(--brand-primary);
  color: white;
  font-size: 9px; font-weight: 700;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface);
}

.topbar-wordmark {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--brand-navy);
}
.topbar-wordmark .accent { color: var(--brand-primary); }

/* Page */
.page { padding: 28px 32px 48px; max-width: 1440px; margin: 0 auto; }
.page-title { font-size: 28px; font-weight: 700; letter-spacing: -.5px; margin: 0; }
.page-subtitle { color: var(--text-muted); margin: 4px 0 24px; font-size: 14px; }

/* Cards / Surfaces */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 16px; font-weight: 600; margin: 0; }
.card-link {
  color: var(--brand-primary);
  text-decoration: none;
  font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 4px;
}
.card-link:hover { text-decoration: underline; }

/* KPI cards */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: flex; align-items: flex-start; gap: 16px;
}
.kpi-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.kpi-icon.indigo { background: #EEF2FF; color: #4F46E5; }
.kpi-icon.amber  { background: #FEF3C7; color: #B45309; }
.kpi-icon.rose   { background: #FFE4E6; color: #BE123C; }
.kpi-icon.emerald{ background: #D1FAE5; color: #047857; }

.kpi-label { font-size: 13px; color: var(--text-muted); margin: 0; }
.kpi-value { font-size: 32px; font-weight: 700; line-height: 1.1; margin: 4px 0 6px; letter-spacing: -.5px; }
.kpi-delta { font-size: 12px; color: var(--brand-primary); font-weight: 500; }
.kpi-delta.neg { color: #DC2626; }
.kpi-delta.pos { color: #059669; }

/* Tabs */
.tabs { display: inline-flex; gap: 4px; background: var(--bg-app); padding: 4px; border-radius: 10px; }
.tab {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all .15s;
}
.tab.active { background: var(--brand-primary); color: white; }

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  text-transform: none;
  color: var(--text-muted);
  padding: 12px 8px;
  border-bottom: 1px solid var(--border);
}
.table td { padding: 14px 8px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table tr.row-link { cursor: pointer; transition: background .12s; }
.table tr.row-link:hover { background: #FAFAFB; }
.table tr:last-child td { border-bottom: none; }
.cell-primary { font-weight: 500; color: var(--text); }
.cell-secondary { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}
.badge-hoch    { background: var(--status-hoch-bg); color: var(--status-hoch-text); }
.badge-mittel  { background: var(--status-mittel-bg); color: var(--status-mittel-text); }
.badge-niedrig { background: var(--status-niedrig-bg); color: var(--status-niedrig-text); }
.badge-prog    { background: var(--status-prog-bg); color: var(--status-prog-text); }
.badge-warten  { background: var(--status-warten-bg); color: var(--status-warten-text); }
.badge-offen   { background: var(--status-offen-bg); color: var(--status-offen-text); }

.type-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  background: #F1F5F9;
  color: #475569;
  font-size: 12px;
  font-weight: 500;
}
.type-pill.erstattung { background: #FEE2E2; color: #B91C1C; }
.type-pill.umbuchung  { background: #DBEAFE; color: #1D4ED8; }
.type-pill.anfrage    { background: #E0E7FF; color: #4338CA; }
.type-pill.aenderung  { background: #FEF3C7; color: #B45309; }
.type-pill.stornierung{ background: #FFE4E6; color: #BE123C; }
.type-pill.webcoupon  { background: #DCFCE7; color: #166534; }
.type-pill.avis       { background: #F1F5F9; color: #475569; }
.type-pill.provision  { background: #EDE9FE; color: #6D28D9; }

/* Dashboard layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}
.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

/* Queue list (sidebar) */
.queue-list { display: flex; flex-direction: column; gap: 4px; }
.queue-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s;
}
.queue-row:hover { background: var(--bg-app); }
.queue-row .q-icon {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--brand-primary-soft); color: var(--brand-primary);
  display: flex; align-items: center; justify-content: center;
}
.queue-row .q-label { flex: 1; font-size: 14px; font-weight: 500; }
.queue-row .q-count { font-size: 13px; color: var(--text-muted); font-weight: 600; }

/* AI suggestions */
.ai-suggestion {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  background: linear-gradient(180deg, #FBFAFF 0%, #FFFFFF 100%);
}
.ai-suggestion p { margin: 0 0 12px; font-size: 13px; color: var(--text); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
}
.btn:hover { background: var(--bg-app); }
.btn-primary {
  background: var(--brand-primary);
  color: white;
  border-color: var(--brand-primary);
}
.btn-primary:hover { background: var(--brand-primary-hover); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-app); color: var(--text); }

/* Beta tag */
.tag-beta {
  display: inline-block;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 4px;
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
  margin-left: 6px;
  vertical-align: middle;
}

/* Inbox */
.inbox-grid {
  display: grid;
  grid-template-columns: 220px 380px 1fr;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  min-height: 700px;
}
.inbox-col { background: var(--surface); overflow-y: auto; }
.inbox-col h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-soft); padding: 16px 16px 8px; margin: 0; }
.folder-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  border-left: 3px solid transparent;
}
.folder-item:hover { background: var(--bg-app); }
.folder-item.active { background: var(--brand-primary-soft); color: var(--brand-primary); border-left-color: var(--brand-primary); font-weight: 500; }
.folder-item .count { margin-left: auto; font-size: 12px; color: var(--text-muted); }
.folder-item.active .count { color: var(--brand-primary); }

.mail-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background .12s;
}
.mail-item:hover { background: var(--bg-app); }
.mail-item.active { background: var(--brand-primary-soft); }
.mail-item.unread .mail-from { font-weight: 700; }
.mail-from { font-size: 13.5px; color: var(--text); margin-bottom: 3px; display: flex; justify-content: space-between; }
.mail-from .time { font-size: 12px; color: var(--text-soft); font-weight: 400; }
.mail-subject { font-size: 13px; color: var(--text); margin-bottom: 4px; font-weight: 500; }
.mail-snippet { font-size: 12.5px; color: var(--text-muted); line-height: 1.4; margin-bottom: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.mail-detail { padding: 28px 32px; }
.mail-detail h2 { font-size: 20px; margin: 0 0 12px; font-weight: 600; }
.mail-meta { display: flex; align-items: center; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--border-soft); margin-bottom: 16px; }
.mail-meta .from { font-size: 13.5px; font-weight: 500; }
.mail-meta .to { font-size: 12.5px; color: var(--text-muted); }

.ai-panel {
  background: linear-gradient(135deg, #F5F3FF 0%, #EEF2FF 100%);
  border: 1px solid #DDD6FE;
  border-radius: 12px;
  padding: 16px;
  margin: 16px 0;
}
.ai-panel-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 12px; font-weight: 600; color: #5B21B6; text-transform: uppercase; letter-spacing: 0.5px; }
.ai-tag-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.ai-tag-grid .label { color: var(--text-muted); }
.ai-tag-grid .value { color: var(--text); font-weight: 500; }

.mail-body { font-size: 14px; line-height: 1.6; color: var(--text); }

/* Vorgang Detail */
.vorgang-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
}
.vorgang-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 24px;
  margin-bottom: 20px;
}
.vorgang-header-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.vorgang-id { font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--text-muted); background: var(--bg-app); padding: 4px 10px; border-radius: 6px; }
.vorgang-title { font-size: 22px; font-weight: 600; margin: 8px 0 0; }
.vorgang-action-bar { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

.tab-bar { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab-bar-item {
  padding: 12px 16px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab-bar-item:hover { color: var(--text); }
.tab-bar-item.active { color: var(--brand-primary); border-bottom-color: var(--brand-primary); }

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 24px;
  padding: 4px 0;
}
.info-item .info-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.info-item .info-value { font-size: 14px; color: var(--text); font-weight: 500; }

.system-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-app);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.system-tag .ico { width: 14px; height: 14px; }

.timeline { display: flex; flex-direction: column; gap: 16px; padding: 4px 0; }
.timeline-item { display: flex; gap: 12px; }
.timeline-dot {
  width: 28px; height: 28px;
  border-radius: 999px;
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.timeline-content { flex: 1; }
.timeline-content .t-title { font-size: 13.5px; font-weight: 500; margin-bottom: 2px; }
.timeline-content .t-meta { font-size: 12px; color: var(--text-muted); }

.wiki-source {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all .12s;
}
.wiki-source:hover { border-color: var(--brand-primary); background: var(--brand-primary-soft); }
.wiki-source .source-title { font-size: 13.5px; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.wiki-source .source-snippet { font-size: 12.5px; color: var(--text-muted); line-height: 1.4; }
.wiki-source .source-url { font-size: 11px; color: var(--brand-primary); margin-top: 4px; }

.citation {
  display: inline-block;
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
  padding: 0 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin: 0 2px;
  cursor: pointer;
  vertical-align: super;
}

/* Queues page */
.queues-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.queue-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
  transition: all .15s;
  cursor: pointer;
}
.queue-card:hover { box-shadow: 0 8px 24px -8px rgba(79, 70, 229, 0.15); border-color: #C7D2FE; transform: translateY(-1px); }
.queue-card-header { display: flex; align-items: center; gap: 12px; }
.queue-card-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.queue-card-title { font-size: 15px; font-weight: 600; margin: 0; }
.queue-card-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.queue-card-stats { display: flex; gap: 20px; padding: 8px 0; }
.queue-stat-num { font-size: 28px; font-weight: 700; line-height: 1; }
.queue-stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; margin-top: 4px; }
.queue-stat.danger .queue-stat-num { color: #DC2626; }
.queue-mini-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.queue-mini-list li { font-size: 12.5px; color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.queue-mini-list li .mini-tag { background: var(--bg-app); color: var(--text-muted); font-family: monospace; font-size: 11px; padding: 1px 6px; border-radius: 4px; }

/* WIKI / KI */
.wiki-grid { display: grid; grid-template-columns: 1fr 320px; gap: 20px; }
.chat-area { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 24px; min-height: 600px; display: flex; flex-direction: column; }
.chat-messages { flex: 1; display: flex; flex-direction: column; gap: 20px; padding-bottom: 16px; }
.msg-user { align-self: flex-end; max-width: 75%; background: var(--brand-primary); color: white; padding: 12px 16px; border-radius: 14px 14px 4px 14px; font-size: 14px; line-height: 1.5; }
.msg-ai { align-self: flex-start; max-width: 85%; }
.msg-ai-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12px; font-weight: 600; color: #5B21B6; }
.msg-ai-body { background: var(--bg-app); border-radius: 4px 14px 14px 14px; padding: 16px; font-size: 14px; line-height: 1.65; color: var(--text); }
.msg-ai-body ul { margin: 10px 0; padding-left: 22px; }
.msg-ai-body li { margin-bottom: 6px; }
.msg-ai-body strong { font-weight: 600; color: var(--brand-navy); }

.chat-input-wrap { display: flex; gap: 8px; padding-top: 16px; border-top: 1px solid var(--border-soft); }
.chat-input { flex: 1; padding: 12px 16px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; outline: none; }
.chat-input:focus { border-color: var(--brand-primary); box-shadow: 0 0 0 4px var(--brand-primary-soft); }

.popular-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag-chip { padding: 4px 10px; border-radius: 999px; background: var(--bg-app); border: 1px solid var(--border); font-size: 12px; color: var(--text-muted); cursor: pointer; }
.tag-chip:hover { border-color: var(--brand-primary); color: var(--brand-primary); }

/* Automatisierungen */
.rules-list { display: flex; flex-direction: column; gap: 12px; }
.rule-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 16px;
  align-items: center;
}
.rule-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--brand-primary-soft); color: var(--brand-primary); display: flex; align-items: center; justify-content: center; }
.rule-title { font-size: 15px; font-weight: 600; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.rule-flow { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.rule-flow code { background: var(--bg-app); padding: 2px 6px; border-radius: 4px; font-family: 'JetBrains Mono', monospace; font-size: 11.5px; color: #4338CA; }
.rule-stats { text-align: right; font-size: 12px; color: var(--text-muted); }
.rule-stats .num { font-size: 18px; font-weight: 700; color: var(--text); display: block; }

.tag-heuristik { background: #DBEAFE; color: #1D4ED8; padding: 2px 7px; border-radius: 4px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.tag-ki { background: #EDE9FE; color: #6D28D9; padding: 2px 7px; border-radius: 4px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }

.toggle {
  width: 44px; height: 24px;
  background: #CBD5E1;
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background .2s;
  border: none;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: white;
  border-radius: 999px;
  transition: left .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.toggle.on { background: var(--brand-primary); }
.toggle.on::after { left: 22px; }

/* Berichte */
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; }
.bar-chart { display: flex; align-items: flex-end; gap: 12px; height: 220px; padding: 16px 0; border-bottom: 1px solid var(--border-soft); }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar { width: 80%; background: linear-gradient(180deg, var(--brand-primary) 0%, #818CF8 100%); border-radius: 6px 6px 0 0; min-height: 4px; transition: all .3s; position: relative; }
.bar:hover { transform: scaleY(1.02); }
.bar-label { font-size: 12px; color: var(--text-muted); }
.bar-value { font-size: 11px; color: var(--text); font-weight: 600; position: absolute; top: -20px; left: 50%; transform: translateX(-50%); }

.pie-wrap { display: flex; align-items: center; gap: 24px; }
.pie-legend { list-style: none; padding: 0; margin: 0; }
.pie-legend li { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 8px; }
.pie-legend .swatch { width: 12px; height: 12px; border-radius: 3px; }
.pie-legend .pct { margin-left: auto; color: var(--text-muted); font-weight: 600; }

/* Buchungen */
.search-bar-big {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.search-bar-big input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  background: transparent;
  padding: 8px 0;
}
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
}
.chip.active { background: var(--brand-primary); color: white; border-color: var(--brand-primary); }
.chip:hover:not(.active) { border-color: var(--brand-primary); color: var(--brand-primary); }

/* Toast */
.toast-stack { position: fixed; bottom: 24px; right: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--brand-navy);
  color: white;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 10px 30px -10px rgba(30, 27, 75, 0.4);
  animation: toastIn .25s ease-out;
  max-width: 360px;
}
.toast .check { background: var(--brand-primary); color: white; width: 24px; height: 24px; border-radius: 999px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
@keyframes toastIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(10px); } }
.toast.closing { animation: toastOut .2s ease-out forwards; }

/* Section visibility */
.section { display: none; }
.section.active { display: block; animation: fadeIn .2s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* Responsive */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .bottom-grid { grid-template-columns: 1fr; }
  .queues-grid { grid-template-columns: repeat(2, 1fr); }
  .vorgang-grid { grid-template-columns: 1fr; }
  .wiki-grid { grid-template-columns: 1fr; }
  .inbox-grid { grid-template-columns: 180px 320px 1fr; }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .queues-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}
