/* ============================================================
   ZEITWERK – GLOBAL STYLES
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #0891b2;
  --primary-dark: #0e7490;
  --primary-light: #e6f7fb;
  --accent: #f59e0b;
  --sidebar-bg: #111827;
  --sidebar-text: #aeb8c6;
  --sidebar-hover: rgba(255,255,255,.075);
  --sidebar-active: rgba(8,145,178,.18);
  --bg: #f4f7f9;
  --bg-subtle: #f1f5f9;
  --card-bg: #ffffff;
  --border: #dbe3ea;
  --text: #172033;
  --text-secondary: #657386;
  --green: #16a34a;
  --orange: #f59e0b;
  --red: #dc2626;
  --purple: #7c3aed;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(15,23,42,.05), 0 10px 28px rgba(29,40,58,.07);
  --shadow-lg: 0 18px 44px rgba(15,23,42,.14);
  --ring: 0 0 0 3px rgba(8,145,178,.16);
  --topbar-h: 60px;
  --sidebar-w: 220px;
  --sidebar-collapsed-w: 56px;
  --transition: .18s ease;
}

html { font-size: 15px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  line-height: 1.5;
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e0; border-radius: 3px; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition), width var(--transition);
  overflow: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-h);          /* exakt gleiche Höhe wie die Topbar */
  padding: 0 18px;
  box-sizing: border-box;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.5px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  position: relative;
}
.nav-item svg { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; }
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active {
  background: var(--sidebar-active);
  color: var(--primary);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

.sidebar-bottom {
  border-top: 1px solid rgba(255,255,255,.06);
  padding: 8px 0;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
}
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-info { overflow: hidden; flex: 1; min-width: 0; }
.user-name { font-size: .8rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: .7rem; color: var(--sidebar-text); }
.logout-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--sidebar-text);
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color .2s, background .2s;
}
.logout-btn:hover { color: #fff; background: rgba(255,255,255,.1); }
.logout-btn svg { width: 16px; height: 16px; fill: currentColor; }

/* Sidebar Collapse Toggle */
.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 8px 0;
  background: none;
  border: none;
  border-top: 1px solid rgba(255,255,255,.06);
  cursor: pointer;
  color: var(--sidebar-text);
  transition: color var(--transition), background var(--transition);
}
.sidebar-collapse-btn:hover { color: #fff; background: var(--sidebar-hover); }
.sidebar-collapse-btn svg { width: 18px; height: 18px; fill: currentColor; transition: transform var(--transition); }

/* Collapsed state */
.sidebar.collapsed { width: var(--sidebar-collapsed-w); }
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .user-info,
.sidebar.collapsed .logout-btn { display: none; }
.sidebar.collapsed .sidebar-logo { justify-content: center; padding: 0; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px 0; }
.sidebar.collapsed .user-profile { justify-content: center; padding: 12px 0; }
.sidebar.collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }
.main-content.sidebar-collapsed { margin-left: var(--sidebar-collapsed-w); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* ---- TOPBAR ---- */
.topbar {
  height: var(--topbar-h);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.menu-toggle { display: none; }
.topbar-title {
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.timer-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  border: 1px solid var(--primary);
  border-radius: 20px;
  padding: 4px 12px;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 600;
  color: var(--primary-dark);
  transition: background var(--transition);
}
.timer-badge:hover { background: #d0edff; }
.timer-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ccc;
}
.timer-dot.running {
  background: var(--green);
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

/* ---- PAGE CONTAINER ---- */
.page-container { flex: 1; min-width: 0; }

.page {
  display: none;
  padding: 28px 28px 48px;
  animation: fadeIn .2s ease;
  min-width: 0;
}
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-header {
  display: flex;
  align-items: center;
  margin-bottom: 18px;
  gap: 12px;
  flex-wrap: wrap;
  min-height: 38px;
}
.page-header h1 { font-size: 1.6rem; font-weight: 700; }
.subline { font-size: .9rem; color: var(--text-secondary); margin-top: 2px; }
/* Tabs/Begrüßung links, Aktionen immer rechts (Überschriften liegen jetzt in der Topbar) */
.page-header > .filter-tabs,
.page-header > .cal-view-tabs { margin-bottom: 0; }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-left: auto; }

/* ---- Sticky-Kopfzeile (alle Seiten außer Dashboard) ----
   Die oberste Aktionszeile bleibt beim Scrollen direkt unter der Topbar stehen.
   Negativer Top-Rand zieht sie schon im Ruhezustand bündig unter die Topbar →
   Ruhezustand = Scroll-Zustand (kein verschwindender Leerraum oben). Full-Bleed
   über die negativen Seitenränder; Hintergrund = Seitenhintergrund. */
.page:not(#page-dashboard) > .page-header,
#page-project-detail > #projDetailTabs {
  position: sticky;
  top: var(--topbar-h);
  z-index: 30;
  background: var(--bg);
  margin: -28px -28px 10px;
  padding: 10px 28px;
  border-bottom: 1px solid var(--border);
}
/* projDetailTabs ist NICHT das erste Element der Seite (Detail-Kopf darüber) →
   nicht hochziehen, sonst überlappt es die Kopf-Karte. */
#page-project-detail > #projDetailTabs { margin-top: 0; }
@media (max-width: 480px) {
  .page:not(#page-dashboard) > .page-header,
  #page-project-detail > #projDetailTabs {
    margin: -16px -16px 10px;
    padding: 10px 16px;
  }
  #page-project-detail > #projDetailTabs { margin-top: 0; }
}

/* Berichte-Kopf: Typ-Tabs + alle Filter + Export IMMER auf EINER Zeile.
   page-header nowrap (Tabs links fix, Filter rechts schrumpfbar); Selects kappen
   lange Kunden-/Mitarbeiternamen statt umzubrechen. */
#page-reports .page-header { flex-wrap: nowrap; gap: 10px; }
#page-reports #reportTypeTabs { flex: 0 0 auto; flex-wrap: nowrap; }
#page-reports #reportTypeTabs .tab-btn { padding: 7px 12px; }
#page-reports .header-actions {
  flex-wrap: nowrap;
  gap: 8px;
  min-width: 0;
}
#page-reports .header-actions .form-select.narrow {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 160px;
}
#page-reports .header-actions input[type="date"] { flex: 0 0 auto; width: 120px; }
#page-reports .header-actions .btn { flex: 0 0 auto; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  /* 1.5px transparente Border => identische Box-Höhe wie .form-input/.form-select
     (gleiche Proportionen für alle Buttons + Felder in einer Toolbar-Zeile) */
  border: 1.5px solid transparent;
  padding: 8px 16px;
  min-height: 38px;
  border-radius: 8px;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 500;
  line-height: 1.4;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); border-color: var(--border); }
.btn-danger { background: #fff; color: #e53e3e; border-color: #fed7d7; }
.btn-danger:hover { background: #fff5f5; }
.btn-success { background: #fff; color: #38a169; border-color: #c6f6d5; }
.btn-success:hover { background: #f0fff4; }
.btn-sm { padding: 5px 12px; min-height: 32px; font-size: .8rem; }
.settings-nav-danger { color: #e53e3e !important; margin-top: auto; border-top: 1px solid var(--border); }
.settings-nav-danger.active, .settings-nav-danger:hover { background: #fff5f5 !important; color: #c53030 !important; }
.danger-zone { border: 1px solid #fed7d7; border-radius: 8px; padding: 1.5rem; background: #fff5f5; }
.danger-zone-warning { color: #c53030; margin-bottom: 1.5rem; font-size: .9rem; line-height: 1.6; }
.setup-section-divider { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: #718096; margin: 1.5rem 0 1rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 6px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  font-size: 1rem;
}
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
.icon-btn:hover { background: var(--bg); color: var(--text); }
.icon-btn.danger:hover { background: #fff0f0; color: var(--red); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: .95rem; font-weight: 600; }
.card-table { box-shadow: var(--shadow); border-radius: var(--radius); }

/* ============================================================
   STATS GRID
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.stat-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; fill: #fff; }
.stat-icon.blue { background: var(--primary); }
.stat-icon.green { background: var(--green); }
.stat-icon.orange { background: var(--orange); }
.stat-icon.purple { background: var(--purple); }
.stat-icon.red { background: var(--red); }

.stat-value { font-size: 1.25rem; font-weight: 700; }
.stat-label { font-size: .78rem; color: var(--text-secondary); margin-top: 2px; }

/* ============================================================
   TIMER CARD (DASHBOARD)
   ============================================================ */
.timer-card {
  background: linear-gradient(135deg, var(--sidebar-bg) 0%, #2d3a55 100%);
  border-radius: var(--radius);
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  box-shadow: var(--shadow-lg);
}
.timer-display {
  font-size: 3rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
  font-family: 'Courier New', monospace;
}
.timer-entry-info { margin-top: 6px; color: rgba(255,255,255,.6); font-size: .85rem; }
.no-entry { font-style: italic; }

.timer-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 50px;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: all var(--transition);
}
.timer-btn.start { background: var(--green); color: #fff; }
.timer-btn.start:hover { background: #2f8a59; transform: scale(1.04); }
.timer-btn.stop { background: var(--red); color: #fff; }
.timer-btn.stop:hover { background: #c53030; transform: scale(1.04); }
.timer-btn svg { width: 20px; height: 20px; fill: currentColor; }

/* ============================================================
   ENTRY LIST
   ============================================================ */
.entry-list { padding: 0 20px; }
.entry-list.detailed { padding: 0; }

.entry-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.entry-item:last-child { border-bottom: none; }
.entry-item:hover { background: #fafbfd; }

.entry-color { width: 4px; height: 40px; border-radius: 2px; flex-shrink: 0; background: var(--primary); }
.entry-main { flex: 1; min-width: 0; }
.entry-title { font-size: .88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-sub { font-size: .78rem; color: var(--text-secondary); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-service-inline { color: var(--primary); font-weight: 500; }

.entry-time { text-align: right; flex-shrink: 0; }
.entry-range { display: block; font-size: .78rem; color: var(--text-secondary); }
.entry-duration { display: block; font-size: .95rem; font-weight: 700; }
.entry-revenue { display: block; font-size: .78rem; color: var(--green); font-weight: 500; }

.entry-actions { display: flex; gap: 2px; align-items: center; }
.entry-billed { opacity: .75; }
.entry-billed-badge { font-size: .7rem; padding: .15rem .4rem; }

/* ============================================================
   WEEK CHART
   ============================================================ */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 120px;
  padding: 16px 20px 0;
}
.bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.bar-wrap { flex: 1; display: flex; align-items: flex-end; width: 100%; }
.bar {
  width: 100%;
  height: var(--bar-height, 0%);
  background: var(--primary);
  border-radius: 4px 4px 0 0;
  transition: height .4s ease;
  min-height: 2px;
}
.bar.today { background: var(--green); }
.bar.weekend { background: #e2e8f0; }
.bar-label {
  font-size: .72rem;
  color: var(--text-secondary);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding-bottom: 8px;
}
.bar-label span { font-size: .68rem; }
.today-label { color: var(--green); font-weight: 600; }
.weekend-label { color: #aaa; }
.target-line { font-size: .72rem; color: var(--text-secondary); padding: 4px 20px 14px; }

.kw-label { font-size: .78rem; color: var(--text-secondary); }

/* ============================================================
   TABLES
   ============================================================ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.data-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
  background: #fafbfd;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #fafbfd; }
.data-table tfoot td {
  background: #fafbfd;
  border-top: 2px solid var(--border);
  font-weight: 600;
}
.sub { font-size: .75rem; color: var(--text-secondary); margin-top: 2px; }

/* ============================================================
   UTILITIES & SHARED STATES
   ============================================================ */
.is-hidden { display: none !important; }
.text-muted { color: var(--text-secondary) !important; }
.text-danger { color: var(--red) !important; }
.text-success { color: var(--green) !important; }
.text-warning { color: var(--orange) !important; }
.text-small { font-size: .85rem !important; }
.text-xs { font-size: .78rem !important; }
.text-mono { font-family: monospace !important; }

.u-row { display: flex; align-items: center; gap: .5rem; }
.u-row-wrap { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.u-spacer { flex: 1; }
.u-mt-xs { margin-top: .4rem !important; }
.u-mt-sm { margin-top: .75rem !important; }
.u-mt-md { margin-top: 1rem !important; }
.u-mb-sm { margin-bottom: .75rem !important; }
.u-cell-right { text-align: right !important; }
.u-cell-nowrap { white-space: nowrap !important; }
.u-break-all { word-break: break-all !important; }

.state-text {
  color: var(--text-secondary);
  font-size: .85rem;
  padding: .5rem 0;
}
.state-text.danger { color: var(--red); }
.state-cell {
  color: var(--text-secondary);
  font-size: .85rem;
  padding: 1rem !important;
}
.state-cell.compact { padding: .5rem !important; }
.state-cell.danger { color: var(--red); }
.grid-state {
  color: var(--text-secondary);
  font-size: .85rem;
  padding: .5rem;
  grid-column: 1 / -1;
}
.grid-state.danger { color: var(--red); }
.section-note {
  color: var(--text-secondary);
  font-size: .85rem;
}
.section-note.danger { color: var(--red); }
.section-note.tight { margin: 0; }
.section-note.block { display: block; }

.table-wrap { overflow-x: auto; }

.color-var { background: var(--item-color, var(--primary)) !important; }

/* ============================================================
   PROGRESS BARS
   ============================================================ */
.progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.progress-bar-wrap .progress-bar {
  height: 6px;
  background: var(--primary);
  border-radius: 3px;
  flex-shrink: 0;
}
.progress-bar-wrap .progress-bar.warning { background: var(--orange); }
.progress-bar-wrap span { font-size: .8rem; color: var(--text-secondary); white-space: nowrap; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
}
.badge.green { background: #e6f7ee; color: var(--green); }
.badge.orange { background: #fff4e6; color: var(--orange); }
.badge.red { background: #fff0f0; color: var(--red); }
.badge.blue { background: var(--primary-light); color: var(--primary-dark); }
.badge.gray { background: #edf2f7; color: #718096; }

/* Projekt-Anzahl-Badge mit Hover-Tooltip */
.proj-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 22px;
  padding: 0 8px;
  background: #edf2f7;
  border-radius: 11px;
  font-size: .8rem;
  font-weight: 600;
  color: #4a5568;
  cursor: default;
  position: relative;
}
.proj-count-badge[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a202c;
  color: #fff;
  padding: .45rem .7rem;
  border-radius: 6px;
  font-size: .78rem;
  font-weight: 400;
  white-space: pre;
  line-height: 1.6;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  z-index: 200;
  text-align: left;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
.proj-count-badge[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #1a202c;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  z-index: 200;
}
.proj-count-badge[data-tooltip]:hover::after,
.proj-count-badge[data-tooltip]:hover::before { opacity: 1; }
.red-val { color: var(--red) !important; }

/* Last-Entry Tooltip (Kundenliste) */
.last-entry-cell { cursor: default; }
.last-entry-tooltip {
  display: none;
  position: absolute;
  z-index: 400;
  background: var(--card-bg, #1e293b);
  border: 1px solid var(--border, rgba(255,255,255,.1));
  border-radius: 8px;
  padding: 10px 14px;
  min-width: 200px;
  max-width: 320px;
  box-shadow: 0 6px 20px rgba(0,0,0,.35);
  font-size: .82rem;
  line-height: 1.5;
  pointer-events: none;
}
.let-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.let-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .65rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.let-user  { font-weight: 600; flex: 1; }
.let-dur   { color: var(--text-secondary, #94a3b8); font-size: .78rem; }
.let-project {
  color: var(--text-secondary, #94a3b8);
  font-size: .78rem;
  margin-bottom: 4px;
}
.let-desc {
  color: var(--text-primary, #e2e8f0);
  border-top: 1px solid var(--border, rgba(255,255,255,.08));
  padding-top: 6px;
  margin-top: 2px;
  font-style: italic;
  word-break: break-word;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-input, .form-select {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: .875rem;
  color: var(--text);
  background: #fff;
  transition: border-color var(--transition);
  font-family: inherit;
}
textarea.form-input { resize: vertical; }
.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,176,255,.1);
}
.form-input.small { width: 90px; }
.form-select.narrow { width: auto; }
.input-clearable { position: relative; display: flex; }
.input-clearable .form-input { padding-right: 2rem; flex: 1; }
.input-clear-btn {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: 2rem; border: none; background: transparent;
  color: #a0aec0; cursor: pointer; font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 0 6px 6px 0;
  transition: color .15s;
}
.input-clear-btn:hover { color: #4a5568; }
.color-input { padding: 4px; height: 38px; cursor: pointer; }
input[type="time"]::-webkit-calendar-picker-indicator {
  background-color: var(--primary);
  border-radius: 4px;
  padding: 3px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'><path d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67V7z'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;
}
.time-stepper {
  display: flex;
  gap: 4px;
}
.time-step-btn {
  flex: 1;
  height: 26px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
  color: #4a5568;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.time-step-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.form-group { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.form-group label { font-size: .8rem; font-weight: 500; color: var(--text-secondary); }
.form-group.flex-2 { flex: 2; }

.form-row {
  display: flex;
  gap: 14px;
  margin-bottom: 14px;
  align-items: flex-start;
}
.form-actions { display: flex; gap: 8px; align-items: flex-end; margin-left: auto; }
.form-section { padding: 0; }

/* Toggle Switch */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #cbd5e0;
  border-radius: 24px;
  transition: var(--transition);
}
.slider:before {
  content: '';
  position: absolute;
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
}
.toggle-switch input:checked + .slider { background: var(--primary); }
.toggle-switch input:checked + .slider:before { transform: translateX(20px); }

/* Search Input */
.search-input {
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: .875rem;
  font-family: inherit;
  min-width: 200px;
  transition: border-color var(--transition);
}
.search-input:focus { outline: none; border-color: var(--primary); }

/* ============================================================
   FILTER TABS
   ============================================================ */
.filter-tabs, .toggle-row {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
}
.tab-btn {
  padding: 7px 16px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: .83rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.tab-btn:hover { border-color: var(--primary); color: var(--primary); }
.tab-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ============================================================
   TRACKING PAGE
   ============================================================ */
.timer-section { padding: 20px; }
.timer-row {
  display: flex;
  gap: 20px;
  align-items: center;
}
.timer-inputs { display: flex; gap: 10px; flex: 1; }
.timer-inputs .form-select { flex: 1; }
.timer-inputs .form-input { flex: 2; }
.timer-controls { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.timer-big {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 2px;
  font-family: 'Courier New', monospace;
  color: var(--text);
}

.manual-entry { margin-bottom: 0; }
.manual-entry .card { padding: 20px; margin-bottom: 20px; }

.date-nav { display: flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 500; }
.daily-total { font-size: .85rem; color: var(--text-secondary); }
.card-header-right { display: flex; align-items: center; gap: 14px; }

.btn-link {
  background: none; border: none; cursor: pointer; padding: 0;
  color: var(--primary); font-size: .85rem; font-weight: 500;
}
.btn-link:hover { color: var(--primary-dark); text-decoration: underline; }

/* ---- Kalender-Widget (3 Monate) ---- */
.track-calendar-card { padding: 12px 16px; }
.track-calendar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.cal-month {
  background: #fafbfd;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.cal-month-title {
  font-size: .8rem; font-weight: 600; color: var(--text);
  text-align: center; margin-bottom: 6px;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.cal-dow {
  text-align: center; font-size: .62rem; font-weight: 600;
  color: var(--text-secondary); padding-bottom: 2px;
}
.cal-cell {
  position: relative;
  aspect-ratio: 1 / 0.74;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  background: #f1f3f7;
  font-size: .72rem; color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
}
.cal-cell.empty { background: none; cursor: default; }
.cal-cell:not(.empty):hover { background: var(--primary-light); }
.cal-cell.future { color: #cbd5e0; cursor: default; }
.cal-cell.future:hover { background: #f1f3f7; }
.cal-cell.today { font-weight: 700; color: var(--primary); }
.cal-cell.today::after {
  content: ''; position: absolute; inset: 0;
  border: 1.5px solid var(--primary); border-radius: 6px; pointer-events: none;
}
.cal-cell.selected { background: var(--primary); color: #fff; }
.cal-cell.selected:hover { background: var(--primary-dark); }
.cal-cell.selected.today { color: #fff; }
.cal-cell.selected.today::after { border-color: #fff; }
.cal-cell .cal-dot {
  position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%);
  width: 50%; height: 3px; border-radius: 2px; background: var(--primary);
}
.cal-cell.selected .cal-dot { background: #fff; }

@media (max-width: 720px) {
  .track-calendar { grid-template-columns: 1fr; gap: 14px; }
}

/* ---- „Letzte Einträge" – Tagesgruppen ---- */
.entry-day-group { margin-bottom: 14px; }
.entry-day-group:last-child { margin-bottom: 0; }
.entry-day-header {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 7px 20px 5px; margin-bottom: 4px;
  background: #fafbfd;
  border-bottom: 1px solid var(--border);
  font-size: .8rem; font-weight: 600; color: var(--text-secondary);
}
.entry-day-total { font-weight: 500; }

/* ============================================================
   PROJECTS
   ============================================================ */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.project-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow var(--transition);
}
.project-card:hover { box-shadow: var(--shadow-lg); }

.project-header { display: flex; align-items: center; gap: 8px; }
.project-color-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.project-header h3 { flex: 1; font-size: .95rem; font-weight: 600; }
.project-menu { color: var(--text-secondary); cursor: pointer; font-size: 1.2rem; padding: 2px 6px; border-radius: 6px; position: relative; user-select: none; }
.project-menu:hover { background: var(--bg); color: var(--text); }
.project-dropdown {
  display: none;
  position: absolute;
  right: 0; top: calc(100% + 4px);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  min-width: 170px;
  z-index: 300;
  padding: 4px 0;
}
.project-dropdown.open { display: block; }
.project-dropdown button {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 14px;
  background: none; border: none; cursor: pointer;
  font-size: .85rem; color: var(--text); text-align: left;
  white-space: nowrap;
}
.project-dropdown button:hover { background: var(--bg); }
.project-dropdown button.danger { color: var(--red); }
.project-dropdown button.danger:hover { background: #fff5f5; }
.dropdown-divider { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.dropdown-label { font-size: .72rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .05em; padding: 4px 14px 2px; }

/* Assign modal user list */
.assign-user-list { display: flex; flex-direction: column; gap: 6px; }
.assign-user-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.assign-user-row:hover { background: var(--bg); }
.assign-user-row input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; }
.assign-user-row .avatar { width: 28px; height: 28px; font-size: .7rem; flex-shrink: 0; }
.assign-user-row span { font-size: .875rem; }
.project-customer { font-size: .8rem; color: var(--text-secondary); }

.project-stats { display: flex; gap: 16px; }
.proj-stat { display: flex; flex-direction: column; }
.proj-stat span { font-size: .95rem; font-weight: 600; }
.proj-stat small { font-size: .72rem; color: var(--text-secondary); }

.project-progress { display: flex; align-items: center; gap: 10px; }
.progress-track { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-fill { width: var(--progress, 0%); height: 100%; background: var(--primary); border-radius: 3px; }
.progress-fill.warning { background: var(--orange); }
.dash-progress-track { margin: .5rem 0; }
.project-progress span { font-size: .78rem; color: var(--text-secondary); width: 32px; flex-shrink: 0; }

.project-footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.project-dates { font-size: .75rem; color: var(--text-secondary); }

/* ============================================================
   TEAM
   ============================================================ */
.team-live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  padding: 16px 20px;
}
.team-member-card {
  background: var(--bg);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.team-member-card.active { border: 1.5px solid var(--primary); background: var(--primary-light); }
.member-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.member-name { font-size: .88rem; font-weight: 600; }
.member-status { font-size: .75rem; color: var(--text-secondary); margin: 3px 0; }
.member-status.running { color: var(--green); font-weight: 500; }
.member-status.absent { color: var(--red); }
.member-status.vacation { color: var(--orange); }
.member-today { font-size: .75rem; color: var(--text-secondary); }

.member-cell { display: flex; align-items: center; gap: 8px; }
.avatar-sm {
  width: 28px; height: 28px;
  border-radius: 50%;
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.positive { color: var(--green); font-weight: 600; }
.negative { color: var(--red); font-weight: 600; }

/* ============================================================
   ABSENCES
   ============================================================ */
.four-col { grid-template-columns: repeat(4, 1fr); }

.cal-legend { display: flex; gap: 16px; padding: 14px 20px 8px; border-bottom: 1px solid var(--border); }
.cal-legend-item { display: flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--text-secondary); }
.cal-dot { width: 10px; height: 10px; border-radius: 50%; }
.cal-dot.vacation { background: var(--primary); }
.cal-dot.sick { background: var(--red); }
.cal-dot.holiday { background: var(--orange); }
.cal-dot.other { background: var(--purple); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 12px 20px;
}
.cal-header {
  text-align: center;
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  padding: 6px 0;
}
.cal-header.weekend, .cal-day.weekend { color: #aaa; }
.cal-day {
  text-align: center;
  padding: 8px 4px;
  border-radius: 6px;
  font-size: .82rem;
  position: relative;
  cursor: pointer;
  transition: background var(--transition);
}
.cal-day:hover { background: var(--primary-light); }
.cal-day.today { background: var(--primary); color: #fff; font-weight: 700; }
.cal-day.sick-day { background: #fff0f0; }
.cal-day.vacation-day { background: var(--primary-light); }
.mini-tag {
  position: absolute;
  top: 1px; right: 1px;
  font-size: .55rem;
  font-weight: 700;
  padding: 0 2px;
  border-radius: 2px;
}
.mini-tag.sick { background: var(--red); color: #fff; }
.mini-tag.vacation { background: var(--primary); color: #fff; }
.mini-tag.public-holiday { background: #d97706; color: #fff; }
.cal-day.public-holiday-day { background: #fffbeb; }
.cal-day.public-holiday-day:hover { background: #fef3c7; }

.absence-list-compact { padding: 12px 20px 16px; border-top: 1px solid var(--border); margin-top: 4px; }
.absence-list-compact h4 { font-size: .82rem; font-weight: 600; margin-bottom: 10px; color: var(--text-secondary); }
.absence-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: .85rem; }
.absence-row:last-child { border-bottom: none; }
.absence-type { padding: 2px 10px; border-radius: 20px; font-size: .72rem; font-weight: 600; }
.absence-type.sick { background: #fff0f0; color: var(--red); }
.absence-type.vacation { background: var(--primary-light); color: var(--primary-dark); }
.absence-who { font-weight: 500; flex: 1; }
.absence-dates { color: var(--text-secondary); font-size: .8rem; }

/* ============================================================
   REPORTS
   ============================================================ */
.reports-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 20px;
  margin-bottom: 20px;
}

.donut-chart-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 20px;
}
.donut-chart { width: 120px; height: 120px; flex-shrink: 0; }
.chart-legend { display: flex; flex-direction: column; gap: 8px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: .78rem; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.legend-val { margin-left: auto; font-weight: 600; color: var(--text-secondary); }

.monthly-chart { padding: 16px 20px; }
.monthly-bars { display: flex; gap: 12px; align-items: flex-end; height: 120px; }
.m-bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.m-bar {
  width: 100%;
  height: var(--bar-height, 0%);
  background: var(--primary);
  border-radius: 4px 4px 0 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex: 0 0 auto;
  align-self: flex-end;
  transition: height .4s;
}
.m-bar span { font-size: .65rem; color: rgba(255,255,255,.9); font-weight: 600; padding-top: 4px; }
.m-bar.holiday-bar { background: #e2e8f0; }
.m-bar.holiday-bar span { color: var(--text-secondary); }
.m-bar.current-month { background: var(--green); }
.m-label { font-size: .72rem; color: var(--text-secondary); margin-top: 6px; }

/* ============================================================
   INVOICES
   ============================================================ */
.action-btns { display: flex; gap: 4px; align-items: center; }

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-layout { display: flex; gap: 24px; }
.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 190px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
  height: fit-content;
  position: sticky;
  top: calc(var(--topbar-h) + 28px);
}
.settings-nav-item {
  text-align: left;
  padding: 9px 14px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 6px;
  font-size: .875rem;
  color: var(--text-secondary);
  font-family: inherit;
  font-weight: 500;
  transition: all var(--transition);
}
.settings-nav-item:hover { background: var(--bg); color: var(--text); }
.settings-nav-item.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }

.settings-content { flex: 1; }
.settings-tab { display: none; }
.settings-tab.active { display: block; }
.settings-tab h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 20px; }
.settings-tab h3 { font-size: .95rem; font-weight: 600; margin-bottom: 12px; }

.settings-avatar-section { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.avatar-large {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.worktime-grid { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.worktime-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
}
.worktime-row span:first-child { width: 90px; font-weight: 500; }
.worktime-row.weekend { color: var(--text-secondary); }

.notification-section { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.notification-section h3 { font-size: .9rem; font-weight: 600; margin-bottom: 12px; margin-top: 0; }
.notif-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: .875rem; }
.notif-row:last-child { border-bottom: none; }

.integrations-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(420px, 520px);
  gap: 16px;
  align-items: start;
  max-width: 1120px;
}
.integration-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color var(--transition);
  align-self: start;
}
.integration-card:hover, .integration-card.connected { border-color: var(--primary); }
#lexofficeCard,
#llmCard {
  grid-column: 1;
}
#llmPolicyCard {
  grid-column: 2;
  grid-row: 1 / span 2;
}
.int-card-header { display: flex; align-items: center; gap: 12px; }
.int-card-logo { flex-shrink: 0; }
.int-card-title { display: flex; flex-direction: column; gap: 4px; }
.int-card-title strong { font-size: .95rem; }
.int-card-desc { font-size: .82rem; color: var(--text-secondary); margin: 0; }
.int-status-badge { font-size: .72rem; padding: 2px 8px; border-radius: 9999px; }
.int-logo { font-size: 1.5rem; flex-shrink: 0; }
.int-info { flex: 1; min-width: 0; }
.int-info h4 { font-size: .88rem; font-weight: 600; }
.int-info p { font-size: .75rem; color: var(--text-secondary); margin-top: 2px; }
.btn-lx { background: #0066CC; color: #fff; border-color: #0066CC; }

.llm-policy-card {
  min-width: 0;
  max-height: calc(100vh - 150px);
  overflow-y: auto;
}
.llm-setting-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.llm-setting-toggle + .llm-setting-toggle { border-top: 0; }
.llm-setting-toggle strong { display: block; font-size: .86rem; }
.llm-setting-toggle small { display: block; color: var(--text-secondary); font-size: .76rem; margin-top: 2px; }
.llm-permission-head,
.llm-permission-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) 62px 82px;
  align-items: center;
  gap: 8px;
}
.llm-permission-head {
  color: var(--text-secondary);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
  margin-top: 2px;
}
.llm-permission-grid { display: flex; flex-direction: column; gap: 4px; }
.llm-permission-row {
  min-height: 32px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(226, 232, 240, .7);
  font-size: .84rem;
}
.llm-check { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.llm-check input { position: absolute; opacity: 0; pointer-events: none; }
.llm-check span {
  width: 19px; height: 19px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fff;
  position: relative;
}
.llm-check input:checked + span { background: var(--primary); border-color: var(--primary); }
.llm-check input:checked + span::after {
  content: "";
  position: absolute;
  left: 5px; top: 2px;
  width: 6px; height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.llm-check input:disabled + span { opacity: .45; cursor: default; }

/* Lexoffice-Protokoll */
.lx-log-entry { display: flex; align-items: flex-start; gap: .5rem; padding: .3rem .45rem; border-radius: 4px; font-size: .77rem; margin-bottom: 2px; }
.lx-log-error { background: #fff5f5; }
.lx-log-ok    { background: #f0fff4; }
.lx-log-icon  { font-size: .65rem; font-weight: 700; flex-shrink: 0; margin-top: 2px; }
.lx-log-error .lx-log-icon { color: var(--red); }
.lx-log-ok    .lx-log-icon { color: var(--green); }
.lx-log-body  { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.lx-log-action { font-weight: 600; color: var(--text); }
.lx-log-msg    { color: var(--text-secondary); word-break: break-word; }
.lx-log-ts     { flex-shrink: 0; color: var(--text-secondary); white-space: nowrap; font-size: .71rem; padding-top: 1px; }
.btn-lx:hover { background: #0055aa; border-color: #0055aa; }
.lx-exported-badge { font-size: .72rem; padding: 2px 8px; cursor: default; }

.billing-plan {
  display: flex;
  gap: 24px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}
.plan-current { flex: 1; }
.plan-current h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.plan-price { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.plan-price small { font-size: .8rem; color: var(--text-secondary); font-weight: 400; }
.plan-users { font-size: .85rem; color: var(--text-secondary); margin: 4px 0 12px; }
.plan-features { flex: 1; border-left: 1px solid var(--border); padding-left: 24px; }
.plan-features h4 { font-size: .88rem; font-weight: 600; margin-bottom: 10px; }
.plan-features ul { list-style: none; display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.plan-features li { font-size: .85rem; color: var(--text-secondary); }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
  animation: fadeIn .15s ease;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--card-bg);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  width: 520px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp .2s ease;
}
.modal-lg { width: 680px; }
.modal-pdf-preview {
  width: min(1120px, 96vw);
  height: min(900px, 94vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pdf-preview-body {
  flex: 1;
  min-height: 0;
  background: #e5e7eb;
  overflow: hidden;
}
.pdf-canvas-scroll {
  width: 100%;
  height: 100%;
  overflow: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.pdf-page-canvas {
  max-width: 100%;
  height: auto !important;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .18);
}
.pdf-preview-loading,
.pdf-preview-fallback {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--text-secondary);
  text-align: center;
  padding: 24px;
}
.pdf-preview-fallback object {
  width: 100%;
  min-height: 420px;
  border: 0;
  margin-top: 12px;
  background: #fff;
}
.pdf-html-preview {
  width: 100%;
  height: 100%;
  overflow: auto;
  padding: 24px;
  display: flex;
  justify-content: center;
}
.pdf-html-page {
  width: min(880px, 100%);
  min-height: 1120px;
  background: #fff;
  color: #1f2937;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .18);
  padding: 34px 42px;
}
.pdf-html-topbar {
  margin: -34px -42px 28px;
  padding: 14px 42px;
  background: #3b82f6;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pdf-html-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, .8fr);
  gap: 28px;
  margin-bottom: 24px;
}
.pdf-html-head h3,
.pdf-html-page h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}
.pdf-html-head p,
.pdf-html-muted {
  margin: 0 0 4px;
  color: #6b7280;
  font-size: .85rem;
}
.pdf-html-meta {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.pdf-html-meta div,
.pdf-html-totals div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}
.pdf-html-meta span,
.pdf-html-totals span {
  color: #6b7280;
}
.pdf-html-recipient {
  background: #eff6ff;
  padding: 14px 16px;
  margin-bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pdf-html-recipient small {
  color: #2563eb;
  font-weight: 700;
}
.pdf-html-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 24px;
}
.pdf-html-stats div {
  border: 1px solid #e5e7eb;
  background: #f8fbff;
  padding: 12px;
  text-align: center;
}
.pdf-html-stats strong {
  display: block;
  color: #2563eb;
  font-size: 1.05rem;
  margin-bottom: 4px;
}
.pdf-html-stats span {
  color: #6b7280;
  font-size: .78rem;
}
.pdf-html-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .86rem;
}
.pdf-html-table th {
  background: #3b82f6;
  color: #fff;
  text-align: left;
  padding: 9px;
}
.pdf-html-table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 9px;
  vertical-align: top;
}
.pdf-html-table tbody tr:nth-child(even):not(.pdf-html-sum) {
  background: #f9fafb;
}
.pdf-html-table th:not(:first-child),
.pdf-html-table td:not(:first-child) {
  text-align: right;
}
.pdf-html-sum {
  background: #eff6ff;
  font-weight: 700;
}
.pdf-html-totals {
  width: min(330px, 100%);
  margin: 22px 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pdf-html-total-main {
  background: #3b82f6;
  color: #fff;
  padding: 10px 12px;
  font-weight: 700;
}
.pdf-html-total-main span {
  color: #fff;
}
.pdf-html-notes {
  margin-top: 24px;
  color: #374151;
}
.pdf-html-notes p {
  margin: 6px 0 0;
  white-space: pre-wrap;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1.05rem; font-weight: 600; }
.modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; max-height: 65vh; }
.form-section-title { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   INFO MODALS (Funktionsübersicht + FAQ)
   ============================================================ */
.info-modal-body { gap: 8px !important; }
.feature-category {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
  margin-top: 8px;
}
.feature-category:first-child { margin-top: 0; }
.feature-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 4px;
}
.feature-list li { position: relative; padding-left: 22px; font-size: .88rem; line-height: 1.5; color: var(--text); }
.feature-list li::before { content: "✓"; position: absolute; left: 0; color: var(--green); font-weight: 700; }
.feature-list li.showcase { color: var(--text-secondary); }
.feature-list li.showcase::before { content: "○"; color: var(--text-secondary); font-weight: 400; }

.faq-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.faq-item:last-child { border-bottom: none; }
.faq-item h4 { font-size: .92rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.faq-item p { font-size: .88rem; line-height: 1.55; color: var(--text-secondary); }

/* ============================================================
   DASHBOARD GRID
   ============================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

/* ============================================================
   SETUP WIZARD
   ============================================================ */
.setup-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--sidebar-bg) 0%, #2d3a55 100%);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .3s ease;
}

.setup-card {
  background: var(--card-bg);
  border-radius: 18px;
  width: 500px;
  max-width: 95vw;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,.35);
  display: flex;
  flex-direction: column;
}

/* ---- Login-Card ---- */
.login-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
}
.login-card .login-logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.5rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}
.login-card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: .375rem;
  color: var(--text);
}
.login-card p {
  font-size: .875rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}
.login-error {
  background: #fff5f5;
  border: 1px solid #feb2b2;
  color: #c53030;
  padding: .625rem .875rem;
  border-radius: 6px;
  font-size: .875rem;
  margin-bottom: 1rem;
  display: none;
}

/* ---- Benutzerauswahl (Legacy – wird nicht mehr genutzt) ---- */
.user-select-card {
  background: var(--card-bg);
  border-radius: 18px;
  padding: 48px 40px 40px;
  width: 540px;
  max-width: 95vw;
  box-shadow: 0 24px 64px rgba(0,0,0,.35);
  text-align: center;
}
.user-select-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 36px;
}
.user-select-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
}
.user-select-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 20px 18px 14px;
  border-radius: 14px;
  border: 2px solid transparent;
  transition: border-color .15s, background .15s;
  min-width: 100px;
}
.user-select-item:hover {
  background: var(--bg-secondary);
  border-color: var(--primary);
}
.user-select-item .avatar-lg {
  width: 60px; height: 60px;
  border-radius: 50%;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.user-select-item .user-select-name {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.setup-progress-track {
  height: 4px;
  background: var(--border);
  border-radius: 4px 4px 0 0;
  overflow: hidden;
}
.setup-progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width .4s ease;
}

.setup-body {
  padding: 36px 36px 24px;
  flex: 1;
}

.setup-step { display: none; }
.setup-step.active { display: block; animation: fadeIn .2s ease; }

.setup-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}
.setup-logo span {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.5px;
}

.setup-step h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.setup-step .setup-sub {
  font-size: .9rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}
.setup-step .form-group { margin-bottom: 14px; }
.setup-step .form-row { margin-bottom: 0; }

.setup-success {
  text-align: center;
  padding: 16px 0 8px;
}
.setup-success-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 2rem;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.setup-success h2 { margin-bottom: 8px; }
.setup-success p { color: var(--text-secondary); margin-bottom: 20px; font-size: .9rem; }

.setup-summary {
  background: var(--bg);
  border-radius: 10px;
  padding: 14px 18px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.setup-summary-row {
  font-size: .875rem;
  display: flex;
  gap: 8px;
}
.setup-summary-row strong { color: var(--text-secondary); min-width: 130px; }

.setup-footer {
  padding: 18px 36px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
}

.setup-dots {
  display: flex;
  gap: 7px;
  align-items: center;
}
.setup-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background .3s, transform .3s;
}
.setup-dot.active { background: var(--primary); transform: scale(1.2); }

.setup-error {
  margin: 0 36px 16px;
  padding: 10px 14px;
  background: #fff0f0;
  color: var(--red);
  border-radius: 8px;
  font-size: .85rem;
  border: 1px solid #fed7d7;
  display: none;
}

.setup-color-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.setup-avatar-preview {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .2s;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .reports-grid { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .integrations-grid {
    grid-template-columns: 1fr;
    max-width: 760px;
  }
  #lexofficeCard,
  #llmCard,
  #llmPolicyCard {
    grid-column: auto;
    grid-row: auto;
  }
  .llm-policy-card {
    max-height: none;
    overflow-y: visible;
  }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-220px); width: 220px; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; width: 100%; max-width: 100vw; }
  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
  }
  .menu-toggle svg { width: 22px; height: 22px; fill: var(--text); }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .timer-row { flex-direction: column; }
  .timer-inputs { flex-direction: column; }
  .settings-layout { flex-direction: column; }
  .settings-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .integrations-grid { max-width: none; }
  .billing-plan { flex-direction: column; }
  .plan-features { border-left: none; border-top: 1px solid var(--border); padding-left: 0; padding-top: 16px; }
}

@media (max-width: 480px) {
  .page { padding: 16px 16px 40px; }
  .stats-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: stretch; }
  .page-header .header-actions { margin-left: 0; }
  /* Auf Mobil darf der Berichte-Kopf wieder umbrechen (sonst horizontaler Overflow) */
  #page-reports .header-actions { flex-wrap: wrap; }
  .topbar { padding: 0 12px; }
  .topbar-actions { gap: 6px; flex: 0 1 auto; overflow-x: auto; scrollbar-width: none; }
  .topbar-actions::-webkit-scrollbar { display: none; }
  .topbar-actions .timer-badge,
  .topbar-actions > .btn-primary { display: none !important; }
  .timer-display { font-size: 2rem; }
  .topbar-actions .btn-sm { font-size: .7rem; padding: 4px 8px; }
  #loginOverlay { padding: 1rem !important; align-items: center; overflow-y: auto; width: 100vw !important; left: 0 !important; right: auto !important; }
  .login-card { padding: 1.75rem 1.25rem; border-radius: 12px; width: 100%; max-width: 100%; }
}

/* ============================================================
   NOTIFICATION PANEL
   ============================================================ */

.notif-wrapper {
  position: relative;
}

.notif-btn {
  position: relative;
}

.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--red, #e53e3e);
  color: #fff;
  border-radius: 8px;
  font-size: .65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
}

.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 9999;
  overflow: hidden;
}

.notif-panel-header {
  padding: 12px 16px;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted, #718096);
  border-bottom: 1px solid var(--border);
}

.notif-panel-body {
  max-height: 320px;
  overflow-y: auto;
}

.notif-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted, #718096);
  font-size: .875rem;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.notif-item:last-child {
  border-bottom: none;
}

.notif-item-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.notif-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.notif-item-text strong {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
}

.notif-item-text span {
  font-size: .8rem;
  color: var(--text-muted, #718096);
}

.notif-sev-error  { border-left: 3px solid var(--red, #e53e3e); }
.notif-sev-warning{ border-left: 3px solid #ed8936; }
.notif-sev-info   { border-left: 3px solid var(--primary, #00b4d8); }

.notif-panel-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.notif-panel-footer a {
  font-size: .8rem;
  color: var(--primary, #00b4d8);
  text-decoration: none;
  font-weight: 500;
}

.notif-panel-footer a:hover {
  text-decoration: underline;
}

/* ============================================================
   PLUGIN MANAGEMENT
   ============================================================ */
.plugin-reload-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--primary-light);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: .85rem;
  color: var(--primary-dark);
  margin-bottom: 16px;
}
.plugin-reload-banner span { flex: 1; }

.plugin-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 10px;
  transition: border-color var(--transition);
}
.plugin-card:hover { border-color: var(--primary); }

.plugin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.plugin-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.plugin-label { font-weight: 600; font-size: .95rem; }
.plugin-version { font-size: .75rem; color: var(--text-secondary); }
.plugin-status-badge { font-size: .72rem; }

.plugin-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.plugin-description {
  font-size: .83rem;
  color: var(--text-secondary);
  margin: 0;
}

.plugin-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.plugin-chip {
  display: inline-flex;
  align-items: center;
  background: #edf2f7;
  color: #4a5568;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.plugin-chip-author {
  text-transform: none;
  font-weight: 400;
  letter-spacing: 0;
}

.plugin-empty { color: var(--text-secondary); font-size: .85rem; }

/* ============================================================
   SICHERHEITSPRÜFUNG
   ============================================================ */

.security-warning-banner {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 10px 20px;
  font-size: .875rem;
  font-weight: 500;
  position: sticky;
  top: var(--topbar-h, 56px);
  z-index: 90;
  border-bottom: 1px solid transparent;
}
.security-warning-banner.warning  { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.security-warning-banner.critical { background: #fff0f0; color: #7f1d1d; border-color: #fca5a5; }

.security-banner-icon { flex-shrink: 0; }
.security-banner-text { flex: 1; }

.security-banner-link {
  background: none;
  border: none;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 600;
  text-decoration: underline;
  color: inherit;
  padding: 0;
}

.security-banner-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: inherit;
  opacity: .55;
  padding: 0 4px;
  line-height: 1;
}
.security-banner-close:hover { opacity: 1; }

.security-check-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.security-overall-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .9rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.security-status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: .75rem;
  font-weight: 600;
}
.security-status-badge.ok       { background: #e6f7ee; color: var(--green, #38a169); }
.security-status-badge.warning  { background: #fff4e6; color: var(--orange, #dd6b20); }
.security-status-badge.critical { background: #fff0f0; color: var(--red,  #e53e3e); }
.security-status-badge.unknown  { background: #edf2f7; color: #718096; }

.security-check-list { display: flex; flex-direction: column; }

.security-check-row {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.security-check-row:last-child { border-bottom: none; }

.security-check-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.security-icon-ok       { background: #e6f7ee; color: var(--green, #38a169); }
.security-icon-warning  { background: #fff4e6; color: var(--orange, #dd6b20); }
.security-icon-critical { background: #fff0f0; color: var(--red,  #e53e3e); }
.security-icon-unknown  { background: #edf2f7; color: #718096; }

.security-check-info   { flex: 1; min-width: 0; }
.security-check-label  { font-size: .875rem; font-weight: 600; color: var(--text); }
.security-check-message { font-size: .82rem; color: var(--text-secondary); margin-top: 2px; }

.security-remedy {
  font-size: .8rem;
  color: var(--orange, #dd6b20);
  margin-top: 6px;
  padding: 6px 10px;
  background: #fff8f0;
  border-left: 3px solid var(--orange, #dd6b20);
  border-radius: 0 4px 4px 0;
}

/* ============================================================
   MATERIAL / INVENTORY
   ============================================================ */

.mat-section {
  margin-top: 1.25rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.mat-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .6rem;
}

.mat-section-title {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.mat-rows-container {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.material-row {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
}

.material-row .form-control {
  font-size: .85rem;
  padding: .3rem .45rem;
  height: auto;
}

.mat-name-wrap {
  flex: 1;
  min-width: 140px;
  position: relative;
}

.mat-name-wrap .form-control {
  width: 100%;
}

.mat-autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  z-index: 200;
  max-height: 200px;
  overflow-y: auto;
}

.mat-ac-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .45rem .7rem;
  cursor: pointer;
  transition: background .1s;
  font-size: .85rem;
}

.mat-ac-item:hover {
  background: var(--primary-light, #ebf4ff);
}

.mat-ac-name {
  font-weight: 500;
  color: var(--text);
}

.mat-ac-meta {
  font-size: .78rem;
  color: var(--text-secondary);
  margin-left: .5rem;
  white-space: nowrap;
}

.mat-remove-btn {
  flex-shrink: 0;
  color: var(--text-secondary);
  padding: .25rem;
  border-radius: 4px;
  transition: color .15s, background .15s;
}

.mat-remove-btn:hover {
  color: #e53e3e;
  background: #fff5f5;
}

/* Kategorie-Tabs */
.mat-category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.mat-cat-tab {
  padding: .28rem .75rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.mat-cat-tab:hover {
  background: var(--primary-light, #ebf4ff);
  border-color: var(--primary);
  color: var(--primary);
}

.mat-cat-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Kategorie-Badge in Tabellenzelle */
.mat-cat-badge {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Kategorie-Verwaltungs-Liste */
.cat-list-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
}

.cat-list-row:last-child { border-bottom: none; }

.cat-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}


/* ============================================================
   SCANNER-KIOSK
   ============================================================ */

.scanner-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.5rem;
  height: calc(100vh - 120px);
  min-height: 500px;
}

/* Linke Spalte: Aktions-Barcodes */
.scanner-codes-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow-y: auto;
}

.scanner-codes-panel h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: .35rem;
}

.scanner-hint {
  font-size: .8rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.scanner-code-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.scanner-code-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .75rem;
  text-align: center;
}

.scanner-code-label {
  font-size: .9rem;
  font-weight: 700;
  margin-bottom: .4rem;
  letter-spacing: .03em;
}

.scanner-barcode {
  display: block;
  margin: 0 auto;
  max-width: 100%;
}

.scanner-code-val {
  font-family: monospace;
  font-size: .72rem;
  color: var(--text-secondary);
  margin-top: .3rem;
}

/* Stat-Karten in der rechten Spalte (2×2) */
.scanner-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 1rem 1rem 0;
}

/* Rechte Spalte: Session */
.scanner-session-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Flash-Overlay */
.scanner-flash {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  border-radius: var(--radius);
  z-index: 10;
}

.scanner-flash.visible { opacity: 1; }

.scanner-flash.ok {
  background: rgba(56, 161, 105, .18);
  color: #38a169;
  animation: scanFlashOk .9s ease-out forwards;
}

.scanner-flash.error {
  background: rgba(229, 62, 62, .25);
  color: #c53030;
  animation: scanFlashError 2.5s ease-out forwards;
}

.scanner-flash.success {
  background: rgba(43, 108, 176, .18);
  color: #2b6cb0;
  animation: scanFlashOk 3s ease-out forwards;
}

@keyframes scanFlashOk {
  0%   { opacity: 1; }
  60%  { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes scanFlashError {
  0%   { opacity: 1; background: rgba(229,62,62,.4); }
  10%  { background: rgba(229,62,62,.15); }
  20%  { background: rgba(229,62,62,.4); }
  30%  { background: rgba(229,62,62,.15); }
  60%  { opacity: 1; }
  100% { opacity: 0; }
}

/* Statusleiste */
.scanner-status-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.scanner-mode-badge {
  padding: .35rem .85rem;
  border-radius: 20px;
  font-size: .85rem;
  font-weight: 700;
  white-space: nowrap;
}

.scanner-mode-badge.idle    { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }
.scanner-mode-badge.mode-in { background: #f0fff4; color: #276749; border: 1px solid #9ae6b4; }
.scanner-mode-badge.mode-out{ background: #fff5f5; color: #9b2c2c; border: 1px solid #feb2b2; }

.scanner-status-text {
  font-size: .85rem;
  color: var(--text-secondary);
}

/* Warenkorb */
.scanner-cart {
  flex: 1;
  overflow-y: auto;
  padding: .75rem 1.25rem;
}

.scanner-cart-empty {
  text-align: center;
  color: var(--text-secondary);
  font-size: .9rem;
  padding: 2rem 0;
}

.scanner-cart-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem .75rem;
  border-radius: 8px;
  margin-bottom: .4rem;
  background: var(--bg);
  border: 1px solid var(--border);
  transition: background .15s;
}

.scanner-cart-row.insufficient {
  background: #fff5f5;
  border-color: #feb2b2;
}

.scanner-cart-name {
  font-weight: 500;
  font-size: .9rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scanner-cart-qty {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-shrink: 0;
}

.scanner-qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scanner-qty-btn:hover { background: var(--border); }

.scanner-qty-val {
  font-size: 1.1rem;
  font-weight: 700;
  min-width: 2rem;
  text-align: center;
}

.scanner-qty-unit {
  font-size: .8rem;
  color: var(--text-secondary);
}

.scanner-warn {
  font-size: .78rem;
  color: #c53030;
  font-weight: 600;
}

/* Footer */
.scanner-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .875rem 1.25rem;
  border-top: 1px solid var(--border);
  gap: .75rem;
}

.scanner-item-count {
  font-size: .85rem;
  color: var(--text-secondary);
}

.scanner-footer-actions {
  display: flex;
  gap: .5rem;
}

/* Print: nur Barcodes drucken */
@media print {
  .sidebar, .topbar, .scanner-session-panel { display: none !important; }
  .scanner-layout { display: block; }
  .scanner-codes-panel { border: none; box-shadow: none; }
}

/* ============================================================
   KALENDER-SEITE
   ============================================================ */
.cal-view-tabs { display: inline-flex; gap: 2px; background: #eef1f6; border-radius: 8px; padding: 3px; }
.cal-view-tabs .tab-btn { border: none; border-radius: 6px; padding: 6px 14px; }
.cal-view-tabs .tab-btn.active { background: #fff; color: var(--primary); box-shadow: var(--shadow); border: none; }

.cal-toolbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.cal-period-label { font-size: 1.05rem; font-weight: 600; min-width: 180px; }
.cal-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.cal-filters .form-select.narrow { min-width: 130px; }
.cal-toggle { display: inline-flex; align-items: center; gap: 5px; font-size: .85rem; color: var(--text-secondary); cursor: pointer; }
.cal-toggle input { accent-color: var(--primary); }

.cal-layout { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start; }
.cal-side { display: flex; flex-direction: column; gap: 16px; }
.cal-list-panel { padding: 14px 16px; }

/* ---- Mini-Monatskalender (Datums-Navigator) ---- */
.cal-mini { padding: 12px 12px 14px; }
.cal-mini-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-mini-title { font-size: .85rem; font-weight: 600; }
.cal-mini-grid { display: grid; grid-template-columns: auto repeat(7, 1fr); gap: 1px; }
.cal-mini-dow { text-align: center; font-size: .6rem; font-weight: 600; color: var(--text-secondary); padding-bottom: 3px; }
.cal-mini-dow.kw { color: #a0aec0; }
.cal-mini-kw {
  display: flex; align-items: center; justify-content: center;
  font-size: .58rem; color: #a0aec0; padding-right: 4px; min-height: 26px;
}
.cal-mini-day {
  position: relative; min-height: 26px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font-size: .68rem; border-radius: 5px; cursor: pointer;
  transition: background var(--transition);
}
.cal-mini-day:hover { background: var(--primary-light); }
.cal-mini-day.out .cal-mini-num { color: #cbd5e0; }
.cal-mini-day.today { font-weight: 700; color: var(--primary); }
.cal-mini-day.today::after { content: ''; position: absolute; inset: 0; border: 1px solid var(--primary); border-radius: 5px; pointer-events: none; }
.cal-mini-day.selected { background: var(--primary); color: #fff; }
.cal-mini-day.selected .cal-mini-num { color: #fff; }
.cal-mini-day.selected.today::after { border-color: #fff; }
.cal-mini-num { line-height: 1.1; }
.cal-mini-dots { display: flex; gap: 2px; height: 4px; align-items: center; }
.cal-mini-dot { width: 4px; height: 4px; border-radius: 50%; }
.cal-mini-day.selected .cal-mini-dot { background: #fff !important; }
.cal-list-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: .9rem; margin-bottom: 10px; }
.cal-li { display: flex; align-items: center; gap: 8px; padding: 5px 4px; border-radius: 6px; cursor: pointer; font-size: .85rem; }
.cal-li:hover { background: #f4f6fa; }
.cal-li input { accent-color: var(--primary); }
.cal-li-dot { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }
.cal-li-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-li-shared { font-size: .65rem; color: var(--text-secondary); background: #eef1f6; padding: 1px 5px; border-radius: 4px; }
.cal-li-edit { border: none; background: none; cursor: pointer; color: var(--text-secondary); opacity: 0; transition: opacity var(--transition); }
.cal-li:hover .cal-li-edit { opacity: 1; }
.cal-main { padding: 14px; min-height: 400px; overflow: hidden; }

/* ---- Monatsansicht ---- */
.cal-grid-head, .cal-m-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-grid-head { margin-bottom: 4px; }
.cal-grid-head .cal-dow { text-align: center; font-size: .72rem; font-weight: 600; color: var(--text-secondary); padding: 4px 0; }
.cal-m-grid { gap: 4px; }
.cal-m-cell { min-height: 96px; background: #f7f9fc; border-radius: 8px; padding: 4px; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal-m-cell.out { background: #fbfcfe; }
.cal-m-cell.out .cal-m-daynum { color: #cbd5e0; }
.cal-m-cell.today { outline: 2px solid var(--primary); outline-offset: -2px; }
.cal-m-daynum { font-size: .8rem; font-weight: 600; cursor: pointer; align-self: flex-start; padding: 0 4px; border-radius: 5px; }
.cal-m-daynum:hover { background: var(--primary-light); color: var(--primary); }
.cal-m-items { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.cal-m-more { font-size: .68rem; color: var(--text-secondary); cursor: pointer; padding-left: 4px; }
.cal-m-more:hover { color: var(--primary); }
.cal-m-entry { font-size: .68rem; color: var(--text-secondary); background: #eef1f6; border-radius: 4px; padding: 1px 5px; cursor: pointer; }
.cal-m-entry:hover { background: #e2e8f0; }

.cal-event-chip {
  font-size: .68rem; line-height: 1.35; color: #fff; background: var(--c, var(--primary));
  border-radius: 4px; padding: 1px 5px; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-event-chip.entry { background: #fff; color: var(--text); border-left: 3px solid var(--c, var(--primary)); }

/* Abwesenheits-Chip: gestreift/gedämpft, hebt sich von Terminen ab */
.cal-abs-chip {
  font-size: .68rem; line-height: 1.35; color: #fff; cursor: pointer;
  border-radius: 4px; padding: 1px 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: var(--c, var(--text-secondary));
  background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.22) 0 5px, transparent 5px 10px);
}
.cal-shareall-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: .85rem; }
.cal-shareall-row input { accent-color: var(--primary); }

/* ---- Wochen-/Tagesansicht (Zeitraster) ---- */
.cal-timegrid { display: flex; flex-direction: column; }
.cal-tg-head { display: flex; }
.cal-tg-head .cal-axis-spacer { width: 56px; flex-shrink: 0; }
.cal-tg-head .cal-tg-dayhead { flex: 1; text-align: center; font-size: .78rem; font-weight: 600; padding: 6px 0; cursor: pointer; color: var(--text-secondary); border-radius: 6px; }
.cal-tg-head .cal-tg-dayhead.today { color: var(--primary); background: var(--primary-light); }

.cal-allday-row { display: flex; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); min-height: 26px; }
.cal-allday-row .cal-axis-spacer { width: 56px; flex-shrink: 0; font-size: .62rem; color: var(--text-secondary); display: flex; align-items: center; justify-content: flex-end; padding-right: 6px; }
.cal-allday-cols { flex: 1; display: grid; gap: 1px; }
.cal-allday-col { padding: 2px; display: flex; flex-direction: column; gap: 2px; border-left: 1px solid var(--border); min-height: 26px; }

.cal-tg-body { display: flex; max-height: 620px; overflow-y: auto; position: relative; }
.cal-time-axis { width: 56px; flex-shrink: 0; }
.cal-hour { position: relative; border-bottom: 1px solid transparent; }
.cal-hour span { position: absolute; top: -7px; right: 6px; font-size: .62rem; color: var(--text-secondary); }
.cal-cols { flex: 1; display: grid; gap: 1px; }
.cal-col {
  position: relative; border-left: 1px solid var(--border);
  background-image: repeating-linear-gradient(to bottom, #eef1f6 0, #eef1f6 1px, transparent 1px, transparent 100%);
  cursor: pointer;
}
.cal-block {
  position: absolute; left: 2px; right: 2px; border-radius: 5px; padding: 2px 5px;
  font-size: .7rem; line-height: 1.25; color: #fff; background: var(--c, var(--primary));
  overflow: hidden; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.cal-block.entry { background: #fff; color: var(--text); border: 1px solid var(--border); border-left: 3px solid var(--c, var(--primary)); }
.cal-block-time { font-weight: 600; opacity: .9; margin-right: 2px; }

/* ---- Agenda / Liste ---- */
.cal-agenda { display: flex; flex-direction: column; gap: 14px; }
.cal-agenda-day { }
.cal-agenda-date { font-size: .82rem; font-weight: 700; color: var(--text-secondary); padding-bottom: 5px; margin-bottom: 5px; border-bottom: 1px solid var(--border); }
.cal-agenda-item { display: flex; align-items: center; gap: 10px; padding: 7px 6px; border-radius: 6px; cursor: pointer; font-size: .85rem; }
.cal-agenda-item:hover { background: #f4f6fa; }
.cal-agenda-time { width: 96px; flex-shrink: 0; font-variant-numeric: tabular-nums; color: var(--text-secondary); font-size: .8rem; }
.cal-agenda-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.cal-agenda-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-agenda-cal { font-size: .72rem; color: var(--text-secondary); flex-shrink: 0; }

/* ---- Modals ---- */
.cal-checkbox-row { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.cal-checkbox-row input { accent-color: var(--primary); width: 16px; height: 16px; }
.cal-share-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.cal-share-name { flex: 1; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-share-row .form-select { width: 130px; }

@media (max-width: 900px) {
  .cal-layout { grid-template-columns: 1fr; }
  .cal-filters { margin-left: 0; }
}

/* ============================================================
   E-MAIL
   ============================================================ */
.modal.modal-lg { max-width: 720px; width: 92%; }

.mail-search { width: 220px; }
.mail-muted { color: var(--text-secondary); font-size: .85rem; }
.mail-empty { color: var(--text-secondary); padding: 2rem 1rem; text-align: center; }

.mail-layout {
  display: grid;
  grid-template-columns: 230px 360px 1fr;
  gap: 1rem;
  height: calc(100vh - 162px); /* Kopfzeile bündig hochgezogen (-28px) → Layout entsprechend höher */
  min-height: 420px;
}
.mail-layout .card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }

/* Linkes Panel */
.mail-side { padding: .75rem !important; overflow-y: auto; }
.mail-side-head { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); margin: 0 0 .35rem; font-weight: 600; }
.mail-acc { display: flex; align-items: center; gap: .35rem; padding: .45rem .5rem; border-radius: 8px; cursor: pointer; }
.mail-acc:hover { background: var(--bg); }
.mail-acc.active { background: var(--primary-light); }
.mail-acc-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.mail-acc-label { font-weight: 600; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-acc-mail { font-size: .72rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-gear { background: none; border: none; cursor: pointer; opacity: .5; font-size: .9rem; }
.mail-gear:hover { opacity: 1; }
.mail-tag { font-size: .62rem; background: var(--border); color: var(--text-secondary); padding: 1px 5px; border-radius: 6px; }
.mail-tag-err { background: #fde8e8; color: #c53030; }
.mail-folder { display: flex; justify-content: space-between; align-items: center; padding: .4rem .5rem; border-radius: 8px; cursor: pointer; font-size: .88rem; }
.mail-folder:hover { background: var(--bg); }
.mail-folder.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.mail-unread-badge { background: var(--primary); color: #fff; font-size: .68rem; border-radius: 10px; padding: 0 6px; min-width: 18px; text-align: center; }

/* Mittlere Spalte: Liste */
.mail-list-head { padding: .75rem 1rem; border-bottom: 1px solid var(--border); font-weight: 600; }
.mail-list-body { overflow-y: auto; flex: 1; }
.mail-row { padding: .6rem 1rem; border-bottom: 1px solid var(--border); cursor: pointer; }
.mail-row:hover { background: var(--bg); }
.mail-row-sel { background: var(--primary-light); }
.mail-row-unread .mail-row-who, .mail-row-unread .mail-row-subj { font-weight: 700; }
.mail-row-unread { border-left: 3px solid var(--primary); }
.mail-row-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.mail-row-who { flex: 1; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-row-date { font-size: .72rem; color: var(--text-secondary); white-space: nowrap; }
.mail-row-subj { font-size: .85rem; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-row-prev { font-size: .76rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Rechte Spalte: Lesen */
.mail-read-col { }
.mail-read-body { overflow-y: auto; flex: 1; padding: 1rem; }
.mail-read-head { border-bottom: 1px solid var(--border); padding-bottom: .75rem; margin-bottom: .75rem; }
.mail-read-subj { font-size: 1.15rem; font-weight: 700; margin-bottom: .4rem; }
.mail-read-meta { font-size: .85rem; line-height: 1.5; }
.mail-read-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.mail-atts { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
.mail-att { font-size: .8rem; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: .3rem .6rem; text-decoration: none; color: var(--text); }
.mail-att:hover { border-color: var(--primary); }
.mail-iframe { width: 100%; min-height: 360px; border: none; background: #fff; }
.mail-text { white-space: pre-wrap; word-wrap: break-word; font-family: system-ui, Arial, sans-serif; font-size: .9rem; margin: 0; }
.mail-remote-note { background: #fffbe6; border: 1px solid #f6e05e; border-radius: 8px; padding: .4rem .6rem; font-size: .8rem; margin-bottom: .5rem; }

/* Navi-Badge „neue E-Mails" mit Animation */
.nav-item[data-page="mail"] { position: relative; }
.mail-nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #e53e3e;
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  box-shadow: 0 0 0 0 rgba(229, 62, 62, .6);
  animation: mailBadgePulse 1.8s ease-out infinite;
}
@keyframes mailBadgePulse {
  0%   { box-shadow: 0 0 0 0 rgba(229, 62, 62, .55); transform: scale(1); }
  70%  { box-shadow: 0 0 0 8px rgba(229, 62, 62, 0); transform: scale(1.08); }
  100% { box-shadow: 0 0 0 0 rgba(229, 62, 62, 0); transform: scale(1); }
}
/* Briefumschlag-Icon sanft wippen, solange ungelesen */
.nav-item.has-unread svg { animation: mailIconWiggle 2.4s ease-in-out infinite; transform-origin: 50% 60%; }
@keyframes mailIconWiggle {
  0%, 88%, 100% { transform: rotate(0); }
  90% { transform: rotate(-9deg); }
  94% { transform: rotate(8deg); }
  98% { transform: rotate(-4deg); }
}
/* Eingeklappte Sidebar: Badge als kleiner Punkt oben rechts am Icon */
.sidebar.collapsed .mail-nav-badge {
  position: absolute; top: 6px; right: 6px; margin: 0;
  min-width: 9px; height: 9px; padding: 0; font-size: 0; line-height: 0;
}
@media (prefers-reduced-motion: reduce) {
  .mail-nav-badge, .nav-item.has-unread svg { animation: none; }
}

/* Anhänge im Verfassen-Dialog */
.mail-attach-list { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.mail-attach-chip { display: inline-flex; align-items: center; gap: .35rem; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: .25rem .5rem; font-size: .8rem; }
.mail-attach-x { background: none; border: none; cursor: pointer; color: var(--text-secondary); font-size: .9rem; line-height: 1; padding: 0; }
.mail-attach-x:hover { color: #e53e3e; }

/* Konto-Modal */
.mail-form-section { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); border-bottom: 1px solid var(--border); padding-bottom: .3rem; margin: 1.2rem 0 .6rem; }
.mail-shares { display: flex; flex-direction: column; gap: .35rem; max-height: 180px; overflow-y: auto; }
.mail-share-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.mail-share-row .form-select.narrow { width: 150px; }

/* Lexoffice-Weiterleitung: Badge in der Mailliste + Regel-Editor */
.mail-lx-badge { display: inline-block; font-size: .66rem; font-weight: 700; line-height: 1.4; padding: .02rem .35rem; margin-left: .25rem; border-radius: 9px; background: #e6fffa; color: #2c7a7b; vertical-align: middle; }
.ma-lx-rule { display: flex; align-items: center; gap: .4rem; margin-bottom: .4rem; }
.ma-lx-rule .ma-lx-field { width: 160px; flex: 0 0 auto; }
.ma-lx-rule .ma-lx-mode { width: 140px; flex: 0 0 auto; }
.ma-lx-rule .ma-lx-val { flex: 1 1 auto; min-width: 0; }
.ma-lx-op { font-size: .78rem; color: var(--text-secondary); white-space: nowrap; }

/* Archiv & Compliance */
.mail-arch-status { margin-bottom: .75rem; }
.mail-arch-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: .5rem; }
.mail-arch-grid > div { background: var(--bg); border-radius: 8px; padding: .5rem; text-align: center; font-size: .75rem; color: var(--text-secondary); }
.mail-arch-grid > div span { display: block; font-size: 1.1rem; font-weight: 700; color: var(--text); }
.mail-arch-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
.mail-verify { border-radius: 8px; padding: .6rem .8rem; font-size: .85rem; }
.mail-verify.ok { background: #e6fffa; border: 1px solid #38b2ac; }
.mail-verify.bad { background: #fff5f5; border: 1px solid #fc8181; }
.mail-audit-body { max-height: 280px; overflow-y: auto; }
.mail-audit-table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.mail-audit-table th, .mail-audit-table td { text-align: left; padding: .35rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.mail-audit-table th { color: var(--text-secondary); font-weight: 600; }
.mail-audit-nav { display: flex; align-items: center; gap: 1rem; justify-content: center; padding: .5rem; font-size: .8rem; }

@media (max-width: 1100px) {
  .mail-layout { grid-template-columns: 200px 1fr; height: auto; }
  .mail-read-col { grid-column: 1 / -1; min-height: 420px; }
}
@media (max-width: 700px) {
  .mail-layout { grid-template-columns: 1fr; }
  .mail-search { width: 140px; }
}


/* ============================================================
   AUSBAU: Globalsuche · Empfänger-Picker · Aufgaben · Tickets · Widgets · 360°
   ============================================================ */

/* ---- Globalsuche (Topbar) ---- */
.global-search { position: relative; flex: 1; max-width: 360px; margin: 0 1rem; }
.global-search .form-input { width: 100%; padding-left: 2.1rem; height: 36px; }
.global-search-icon { position: absolute; left: .6rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; fill: var(--text-secondary); pointer-events: none; }
.global-search-results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); max-height: 420px; overflow-y: auto; z-index: 200; padding: .35rem; }
.gs-group-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); padding: .5rem .6rem .2rem; }
.gs-result { padding: .45rem .6rem; border-radius: 6px; cursor: pointer; font-size: .88rem; }
.gs-result:hover { background: var(--primary-light); }
.gs-empty { padding: .6rem; color: var(--text-secondary); font-size: .85rem; }

/* ---- Empfänger-Picker ---- */
.recipient-picker { position: relative; }
.recipient-results { position: absolute; top: calc(100% + 2px); left: 0; right: 0; background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-lg); max-height: 240px; overflow-y: auto; z-index: 50; }
.recip-result { display: flex; justify-content: space-between; gap: .5rem; padding: .4rem .6rem; cursor: pointer; font-size: .85rem; }
.recip-result:hover { background: var(--primary-light); }
.recipient-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.recip-chip { display: inline-flex; align-items: center; gap: .35rem; background: var(--primary-light); color: var(--primary-dark); border-radius: 14px; padding: .2rem .55rem; font-size: .8rem; }
.recip-chip-meta { color: var(--text-secondary); font-size: .72rem; }
.recip-chip-x { border: none; background: none; cursor: pointer; color: var(--text-secondary); font-size: .85rem; line-height: 1; }
.recip-chip-x:hover { color: var(--red); }

/* ---- Aufgaben ---- */
.tasks-layout { display: grid; grid-template-columns: 240px 1fr; gap: 1rem; align-items: start; }
.tasks-side { padding: .8rem; }
.tasks-main { padding: .5rem; min-height: 300px; }
.task-list-item { display: flex; align-items: center; gap: .5rem; padding: .45rem .5rem; border-radius: 7px; cursor: pointer; font-size: .9rem; }
.task-list-item:hover { background: var(--bg); }
.task-list-item.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.task-list-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.task-list-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-list-shared { font-size: .75rem; }

.task-list-view { display: flex; flex-direction: column; }
.task-row { display: flex; align-items: center; gap: .6rem; padding: .55rem .6rem; border-bottom: 1px solid var(--border); cursor: pointer; }
.task-row:hover { background: var(--bg); }
.task-row.done .task-row-title { text-decoration: line-through; color: var(--text-secondary); }
.task-row-main { flex: 1; min-width: 0; }
.task-row-title { font-size: .92rem; font-weight: 500; }
.task-row-meta { font-size: .76rem; color: var(--text-secondary); display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .2rem; align-items: center; }
.task-due { font-size: .74rem; color: var(--text-secondary); }
.task-due.overdue { color: var(--red); font-weight: 600; }
.task-prio { font-size: .7rem; padding: .05rem .4rem; border-radius: 10px; }
.task-prio.prio-1 { background: #fff3e0; color: #b35900; }
.task-prio.prio-2 { background: #fde8e8; color: var(--red); }
.task-prio.prio-low { background: #eef2f7; color: var(--text-secondary); }
.task-chk { font-size: .74rem; color: var(--text-secondary); }
.task-link { font-size: .74rem; color: var(--text-secondary); }
.task-assignee { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--primary); color: #fff; font-size: .62rem; font-weight: 700; }

.task-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.task-col { background: var(--bg); border-radius: 8px; padding: .5rem; min-height: 200px; }
.task-col-head { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--text-secondary); padding: .25rem .35rem .5rem; display: flex; justify-content: space-between; }
.task-col-count { background: var(--card-bg); border-radius: 10px; padding: 0 .45rem; font-size: .72rem; }
.task-col-body { display: flex; flex-direction: column; gap: .5rem; }
.task-col-empty { color: var(--text-secondary); text-align: center; padding: .5rem; font-size: .8rem; }
.task-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 7px; padding: .55rem; cursor: pointer; box-shadow: var(--shadow); }
.task-card:hover { border-color: var(--primary); }
.task-card-title { font-size: .85rem; font-weight: 500; margin-bottom: .35rem; }
.task-card-meta { font-size: .74rem; color: var(--text-secondary); display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.task-item-row { display: flex; align-items: center; gap: .5rem; margin-bottom: .35rem; }
.task-item-row .ti-label { flex: 1; }

/* ---- Tickets ---- */
.ticket-layout { display: grid; grid-template-columns: 340px 1fr; gap: 1rem; align-items: start; }
.ticket-list-col { padding: 0; max-height: calc(100vh - 192px); overflow-y: auto; }
.ticket-detail-col { padding: 1rem; min-height: 300px; }
.ticket-row { padding: .6rem .8rem; border-bottom: 1px solid var(--border); cursor: pointer; }
.ticket-row:hover { background: var(--bg); }
.ticket-row.active { background: var(--primary-light); }
.ticket-row-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: .2rem; }
.ticket-num { font-size: .74rem; color: var(--text-secondary); font-weight: 600; }
.ticket-row-subj { font-size: .9rem; font-weight: 500; margin-bottom: .2rem; }
.ticket-row-meta { font-size: .75rem; color: var(--text-secondary); }
.ticket-badge { font-size: .7rem; padding: .1rem .5rem; border-radius: 11px; font-weight: 600; }
.ticket-badge.st-new { background: #e3f4ff; color: var(--primary-dark); }
.ticket-badge.st-open { background: #e6fffa; color: #2c7a7b; }
.ticket-badge.st-pending { background: #fff3e0; color: #b35900; }
.ticket-badge.st-resolved { background: #f0fff4; color: var(--green); }
.ticket-badge.st-closed { background: #edf2f7; color: var(--text-secondary); }
.ticket-detail-head { border-bottom: 1px solid var(--border); padding-bottom: .6rem; margin-bottom: .6rem; }
.ticket-detail-num { font-size: .76rem; color: var(--text-secondary); font-weight: 600; }
.ticket-detail-subj { font-size: 1.15rem; margin: .15rem 0; }
.ticket-detail-controls { display: flex; flex-wrap: wrap; gap: .8rem; margin-bottom: 1rem; font-size: .78rem; color: var(--text-secondary); }
.ticket-detail-controls label { display: flex; flex-direction: column; gap: .2rem; }
.form-select-sm { padding: .25rem .5rem; font-size: .82rem; }
.ticket-section { margin-top: 1rem; }
.ticket-section h4 { font-size: .85rem; margin-bottom: .5rem; }
.ticket-msg { border: 1px solid var(--border); border-radius: 8px; padding: .6rem; margin-bottom: .6rem; }
.ticket-msg.out { background: var(--primary-light); border-color: #cdeafd; }
.ticket-msg-head { display: flex; justify-content: space-between; font-size: .8rem; }
.ticket-msg-subj { font-size: .78rem; color: var(--text-secondary); margin: .2rem 0; }
.ticket-msg-bodywrap { margin-top: .4rem; }
.ticket-msg-bodywrap .mail-iframe { width: 100%; min-height: 200px; border: none; }
.ticket-note { background: #fffdf5; border: 1px solid #f0e6c8; border-radius: 8px; padding: .5rem .6rem; margin-bottom: .5rem; }
.ticket-note-head { display: flex; justify-content: space-between; font-size: .78rem; }
.ticket-note-body { font-size: .85rem; margin-top: .25rem; }
.ticket-note-add { margin-top: .5rem; display: flex; flex-direction: column; gap: .4rem; align-items: flex-start; }
.ticket-reply { background: var(--bg); border-radius: 8px; padding: .7rem; }
.ticket-reply-actions { display: flex; justify-content: space-between; align-items: center; margin-top: .5rem; gap: .5rem; }
.ticket-time-row { display: flex; align-items: center; gap: .5rem; font-size: .82rem; padding: .25rem 0; }
.ticket-time-add { display: flex; gap: .5rem; margin-top: .5rem; align-items: center; flex-wrap: wrap; }

/* ---- Dashboard-Widgets ---- */
.dash-widgets { grid-template-columns: repeat(3, 1fr); margin-bottom: 1rem; }
.dash-widget-row { display: flex; align-items: center; gap: .5rem; padding: .4rem .3rem; border-bottom: 1px solid var(--border); cursor: pointer; font-size: .85rem; }
.dash-widget-row:hover { background: var(--bg); }
.dash-widget-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-row-actions { display: inline-flex; gap: 2px; flex-shrink: 0; }
.proj-row-actions .icon-btn { padding: 3px 5px; font-size: .9rem; }

/* ---- Kunden-360° ---- */
.modal.modal-lg { max-width: 860px; width: 92%; }
.cust-act-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.cust-act-col h4 { font-size: .85rem; margin-bottom: .5rem; padding-bottom: .3rem; border-bottom: 1px solid var(--border); }

@media (max-width: 900px) {
  .tasks-layout, .ticket-layout { grid-template-columns: 1fr; }
  .task-board, .dash-widgets, .cust-act-grid { grid-template-columns: 1fr; }
  .global-search { max-width: 180px; }
}

/* ===== Mail Drop-Zonen ===== */
.mail-header { flex-wrap: wrap; align-items: center; }
.mail-dropbar { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.mail-dropzones { display: flex; gap: 10px; flex: 1; flex-wrap: wrap; }
.mail-dropzone {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  flex: 1 1 0;                       /* Felder teilen sich die Breite gleichmäßig (1 = volle Breite, 2 = 50/50 …) */
  min-width: 110px; min-height: 52px; padding: 8px 10px;
  border: 2px dashed var(--border);
  border-radius: 10px; color: var(--text-secondary);
  font-size: .88rem; font-weight: 500; user-select: none;
  white-space: nowrap; overflow: hidden;
  transition: border-color .15s, color .15s, background .15s;
}
.mail-dropzone-icon { font-size: 1.15rem; }
.mail-dropzone-extra { font-weight: 600; }
.mail-dropbar.drag-active .mail-dropzone { border-color: var(--primary); color: var(--primary); }
.mail-dropzone.dragover {
  border-style: solid; border-color: var(--primary);
  color: var(--primary); background: var(--primary-light);
}
.mail-dropbar > .mail-gear { font-size: 1.5rem; padding: 8px; opacity: .55; }
.mail-row[draggable="true"] { cursor: grab; }

/* ============================================================
   ZEITWERK BASE POLISH
   Shared refinements for the operational UI.
   ============================================================ */
html { font-size: 15px; text-rendering: optimizeLegibility; }

body {
  background:
    linear-gradient(180deg, #f8fbfd 0%, #eef4f7 48%, #f7f9fb 100%);
  color: var(--text);
}

::-webkit-scrollbar-thumb { background: #aebccc; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #8594a7; }

.sidebar {
  background:
    linear-gradient(180deg, #121a29 0%, #0e1521 56%, #111827 100%);
  border-right: 1px solid rgba(255,255,255,.07);
  box-shadow: 12px 0 28px rgba(15,23,42,.12);
}

.sidebar-logo {
  height: 68px;
  padding: 0 16px;
  border-bottom-color: rgba(255,255,255,.08);
}

.sidebar-logo svg {
  width: 34px;
  height: 34px;
  filter: drop-shadow(0 8px 18px rgba(8,145,178,.34));
}

.sidebar-logo svg circle:first-child { fill: var(--primary); }

.logo-text {
  letter-spacing: 0;
  font-size: 1.18rem;
}

.sidebar-nav {
  padding: 12px 10px;
  scrollbar-width: thin;
}

.nav-item {
  border-radius: 8px;
  padding: 9px 10px;
  margin: 2px 0;
  gap: 10px;
  font-size: .86rem;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  opacity: .9;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
  transform: translateX(2px);
}

.nav-item.active {
  background: var(--sidebar-active);
  color: #effcff;
  box-shadow: inset 0 0 0 1px rgba(103,232,249,.13);
}

.nav-item.active::before {
  left: 6px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 999px;
}

.sidebar.collapsed .nav-item {
  margin-left: 0;
  margin-right: 0;
  border-radius: 8px;
}

.sidebar-bottom {
  border-top-color: rgba(255,255,255,.08);
  padding: 10px;
}

.sidebar-bottom .nav-item { margin: 0; }

.sidebar-collapse-btn,
.nav-edit-btn,
.logout-btn {
  border-radius: 8px;
}

.sidebar-collapse-btn {
  border-top: 0;
  background: rgba(255,255,255,.035);
  margin-bottom: 8px;
}

.user-profile {
  padding: 12px 8px 4px;
  border-top: 1px solid rgba(255,255,255,.07);
  margin-top: 8px;
}

.avatar,
.avatar-sm,
.member-avatar,
.setup-avatar-preview {
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.24);
}

.topbar {
  height: 68px;
  background: rgba(255,255,255,.86);
  border-bottom: 1px solid rgba(219,227,234,.82);
  box-shadow: 0 8px 24px rgba(15,23,42,.045);
  backdrop-filter: blur(14px);
  padding: 0 28px;
}

.topbar-title {
  font-size: .98rem;
  letter-spacing: 0;
}

.global-search {
  max-width: 420px;
  margin: 0 .75rem;
}

.global-search .form-input {
  height: 38px;
  border-radius: 999px;
  background: #f7fafc;
  border-color: #dce5ed;
}

.global-search .form-input:focus {
  background: #fff;
}

.global-search-results,
.recipient-results,
.project-dropdown,
.notif-panel {
  border-color: rgba(148,163,184,.26);
  box-shadow: var(--shadow-lg);
}

.page {
  padding: 30px 32px 54px;
}

.page-header {
  margin-bottom: 20px;
}

.page-header h1 {
  font-size: 1.85rem;
  line-height: 1.15;
  letter-spacing: 0;
}

.subline {
  color: #708096;
}

.page:not(#page-dashboard) > .page-header,
#page-project-detail > #projDetailTabs {
  top: 68px;
  background: rgba(244,247,249,.92);
  border-bottom-color: rgba(219,227,234,.9);
  backdrop-filter: blur(12px);
}

.card,
.project-card,
.task-card,
.ticket-msg,
.ticket-note,
.mail-att,
.mail-attach-chip,
.modal,
.setup-card,
.login-card {
  border: 1px solid rgba(148,163,184,.22);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.card,
.project-card,
.task-card {
  background: rgba(255,255,255,.96);
}

.card-header {
  padding: 15px 18px;
  background: linear-gradient(180deg, rgba(248,250,252,.9), rgba(255,255,255,.98));
}

.card-header h3 {
  font-size: .9rem;
  letter-spacing: 0;
}

.card-table {
  overflow: hidden;
  border: 1px solid rgba(148,163,184,.22);
  box-shadow: var(--shadow);
}

.btn {
  min-height: 38px;
  border-radius: 8px;
  font-weight: 600;
  box-shadow: none;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.btn:hover,
.icon-btn:hover,
.timer-badge:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(180deg, #06a5c7, var(--primary));
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 8px 18px rgba(8,145,178,.22);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #0891b2, var(--primary-dark));
  border-color: var(--primary-dark);
}

.btn-secondary,
.btn-success,
.btn-danger {
  background: #fff;
  border-color: #d7e0e9;
}

.btn-secondary:hover {
  background: #f7fafc;
  border-color: #b8c6d4;
}

.btn-success {
  color: var(--green);
  border-color: #bde8cc;
}

.btn-danger {
  color: var(--red);
  border-color: #f5c4c4;
}

.icon-btn {
  background: #fff;
  border: 1px solid transparent;
  border-radius: 8px;
}

.icon-btn:hover {
  border-color: #d7e0e9;
  background: #f8fafc;
}

.timer-badge {
  border-color: rgba(8,145,178,.26);
  background: #eefbff;
  color: var(--primary-dark);
  border-radius: 999px;
}

.form-input,
.form-select {
  border-color: #d5dee8;
  background: #fbfdff;
  border-radius: 8px;
}

.form-input:hover,
.form-select:hover {
  border-color: #b9c7d6;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: var(--ring);
  background: #fff;
}

.filter-tabs,
.cal-view-tabs {
  background: #eaf0f5;
  border: 1px solid #d8e2eb;
  border-radius: 8px;
  padding: 3px;
}

.tab-btn {
  border-radius: 6px !important;
}

.tab-btn.active {
  background: #fff !important;
  color: var(--primary-dark) !important;
  box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 6px 14px rgba(15,23,42,.07);
}

.data-table {
  background: #fff;
}

.data-table th {
  background: #f5f8fb;
  color: #64748b;
  border-bottom-color: #dfe7ef;
  letter-spacing: .035em;
}

.data-table td {
  border-bottom-color: #edf2f6;
}

.data-table tbody tr {
  transition: background .14s ease;
}

.data-table tbody tr:hover td {
  background: #f8fbfd;
}

.badge,
.ticket-badge,
.mail-tag,
.recip-chip,
.task-prio,
.scanner-mode-badge {
  border-radius: 999px;
}

.badge.blue,
.ticket-badge.st-new {
  background: #e6f7fb;
  color: var(--primary-dark);
}

.badge.green,
.ticket-badge.st-resolved {
  background: #e9f8ef;
  color: #15803d;
}

.badge.orange,
.ticket-badge.st-pending {
  background: #fff4df;
  color: #a15c00;
}

.badge.red {
  background: #feecec;
  color: var(--red);
}

.stats-grid {
  gap: 18px;
}

.stat-card {
  border: 1px solid rgba(148,163,184,.2);
  border-radius: 8px;
  box-shadow: var(--shadow);
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(249,252,253,.98));
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
}

.stat-icon.blue { background: #0891b2; }
.stat-icon.green { background: #16a34a; }
.stat-icon.orange { background: #f59e0b; }
.stat-icon.purple { background: #7c3aed; }
.stat-icon.red { background: #dc2626; }

.stat-value {
  font-size: 1.33rem;
  letter-spacing: 0;
}

.progress-track,
.progress-bar-wrap .progress-bar {
  background: #e5ecf2;
  border-radius: 999px;
}

.progress-fill,
.progress-bar-wrap .progress-bar {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), #22c55e);
}

.progress-fill.warning,
.progress-bar-wrap .progress-bar.warning {
  background: linear-gradient(90deg, var(--orange), #ef4444);
}

.timer-card {
  background:
    linear-gradient(135deg, #111827 0%, #123044 54%, #0e7490 100%);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
}

.timer-display,
.timer-big {
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.timer-btn {
  border-radius: 999px;
  box-shadow: 0 10px 22px rgba(15,23,42,.16);
}

.timer-btn.start { background: #16a34a; }
.timer-btn.start:hover { background: #15803d; }
.timer-btn.stop { background: #dc2626; }
.timer-btn.stop:hover { background: #b91c1c; }

.entry-item {
  border-bottom-color: #edf2f6;
}

.entry-item:hover,
.dash-widget-row:hover,
.task-row:hover,
.ticket-row:hover,
.mail-row:hover,
.mail-folder:hover,
.mail-acc:hover {
  background: #f7fafc;
}

.entry-color {
  width: 5px;
  border-radius: 999px;
}

.entry-day-header {
  background: #f5f8fb;
}

.dash-canvas {
  gap: 20px;
}

.dash-card .card-header {
  padding: 16px 20px;
}

.dash-card-body {
  padding: 18px 20px 20px;
}

.dash-widget-row {
  border-radius: 7px;
}

.dash-quick-grid .btn {
  background: #f8fbfd;
}

.project-grid {
  gap: 18px;
}

.project-card {
  padding: 18px;
  gap: 13px;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.project-card:hover {
  border-color: rgba(8,145,178,.36);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.project-color-dot {
  width: 10px;
  height: 10px;
  box-shadow: 0 0 0 4px rgba(8,145,178,.1);
}

.project-header h3 {
  font-size: .98rem;
}

.project-stats {
  padding: 10px 0;
  border-top: 1px solid #edf2f6;
  border-bottom: 1px solid #edf2f6;
}

.team-member-card,
.task-col,
.ticket-reply,
.mail-arch-grid > div,
.setup-summary {
  background: #f7fafc;
  border: 1px solid #e2eaf1;
  border-radius: 8px;
}

.team-member-card.active {
  background: #ecfbff;
  border-color: rgba(8,145,178,.42);
}

.mail-layout {
  gap: 14px;
}

.mail-layout .card,
.tasks-side,
.tasks-main,
.ticket-list-col,
.ticket-detail-col {
  border-color: rgba(148,163,184,.22);
}

.mail-list-head,
.notif-panel-header {
  background: #f5f8fb;
}

.mail-row-sel,
.mail-folder.active,
.mail-acc.active,
.task-list-item.active,
.ticket-row.active {
  background: #eaf8fc;
  color: var(--primary-dark);
}

.mail-row-unread {
  border-left-color: var(--primary);
}

.task-col {
  background: #f3f7fa;
}

.task-card:hover {
  border-color: rgba(8,145,178,.45);
  box-shadow: 0 12px 28px rgba(15,23,42,.12);
}

.ticket-msg.out {
  background: #ecfbff;
  border-color: #b8e7f2;
}

.ticket-note {
  background: #fffbeb;
  border-color: #f7dfa2;
}

.modal-overlay {
  background: rgba(15,23,42,.54);
  backdrop-filter: blur(8px);
}

.modal {
  overflow: hidden;
}

.modal-header {
  background: #f7fafc;
  border-bottom-color: #dfe7ef;
}

.modal-footer {
  background: #f8fafc;
  border-top-color: #dfe7ef;
}

#loginOverlay {
  background:
    linear-gradient(135deg, rgba(17,24,39,.92), rgba(14,116,144,.82)) !important;
  backdrop-filter: blur(10px) !important;
}

.login-card {
  max-width: 400px;
  padding: 2.25rem;
}

.login-card .login-logo svg circle:first-child,
.setup-logo svg circle:first-child {
  fill: var(--primary);
}

.login-error,
.setup-error {
  border-radius: 8px;
}

.setup-overlay {
  background: linear-gradient(135deg, #111827 0%, #164e63 100%);
}

.setup-card {
  box-shadow: var(--shadow-lg);
}

.scanner-codes-panel,
.scanner-session-panel {
  border-radius: 8px;
}

*:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

@media (max-width: 768px) {
  .topbar {
    height: 62px;
    padding: 0 16px;
  }

  .page:not(#page-dashboard) > .page-header,
  #page-project-detail > #projDetailTabs {
    top: 62px;
  }

  .sidebar {
    width: 232px;
    transform: translateX(-232px);
  }

  .sidebar.open {
    transform: translateX(0);
  }
}

@media (max-width: 480px) {
  .page {
    padding: 18px 16px 42px;
  }

  .page-header h1 {
    font-size: 1.45rem;
  }

  .global-search {
    max-width: none;
    margin: 0;
  }

  .login-card {
    padding: 1.6rem;
  }
}

/* Ordner als Drop-Ziel + Kopfzeilen */
.mail-folder.dragover { background: var(--primary-light); box-shadow: inset 0 0 0 2px var(--primary); }
.mail-side-head { display: flex; justify-content: space-between; align-items: center; }
.mail-list-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* Ordnerbaum: Name + Hover-Aktionen (Unterordner anlegen, eigenen Ordner entfernen) */
.mail-folder-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-folder-actions { display: none; gap: 2px; flex: 0 0 auto; }
.mail-folder:hover .mail-folder-actions { display: inline-flex; }
.mail-folder-btn {
  background: none; border: none; cursor: pointer;
  font-size: .8rem; line-height: 1; padding: 2px 4px;
  color: var(--text-secondary); border-radius: 4px;
}
.mail-folder-btn:hover { background: var(--primary-light); color: var(--primary); }

/* Mehrfachauswahl in der Nachrichtenliste */
.mail-row-check { accent-color: var(--primary); margin-right: 6px; flex: 0 0 auto; cursor: pointer; }
.mail-row-checked { background: var(--primary-light); }

/* ===== Toast ===== */
.toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 3000;
  display: flex; flex-direction: column; gap: 8px; max-width: 380px;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .14);
  font-size: .88rem; animation: toast-in .2s ease-out;
}
.toast-out { opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; }
.toast-text { flex: 1; }
.toast-action {
  background: none; border: none; cursor: pointer;
  color: var(--primary); font-weight: 600; font-size: .88rem;
  white-space: nowrap; padding: 0;
}
.toast-action:hover { text-decoration: underline; }
.toast-close { background: none; border: none; cursor: pointer; opacity: .4; font-size: .8rem; padding: 0; }
.toast-close:hover { opacity: 1; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ===== Projekt-Detailseite (Drehscheibe) ===== */
.proj-detail-title { display: flex; align-items: center; gap: 10px; }
.proj-detail-title .project-color-dot { width: 14px; height: 14px; flex: 0 0 auto; }
.proj-detail-card { margin-bottom: 1.25rem; padding: 1.25rem 1.6rem; }
.proj-detail-row { display: flex; flex-wrap: wrap; align-items: center; gap: .9rem 3rem; }
.proj-detail-row > div { display: flex; flex-direction: column; gap: 5px; }
.proj-detail-row small { color: var(--text-secondary); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.proj-detail-row > div > span { font-weight: 600; font-size: .95rem; }
.proj-detail-progress { flex-direction: row !important; align-items: center; gap: 8px; flex: 1; min-width: 160px; }
.proj-detail-desc { color: var(--text-secondary); font-size: .88rem; margin: 1rem 0 0; padding-top: .9rem; border-top: 1px solid var(--border); white-space: pre-line; }
.proj-team { display: inline-flex; gap: 4px; }
.proj-team-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  color: #fff; font-size: .7rem; font-weight: 600;
}
#projDetailBody .card { padding: 1.1rem 1.6rem; }
#projDetailBody { margin-top: 1rem; }
.proj-tab-card { display: flex; flex-direction: column; gap: 2px; }
.proj-tab-card .data-table { margin: 0; }
#page-project-detail .card > .mail-muted { margin: .25rem 0; }
.proj-mail-row { padding: .8rem .25rem; border-bottom: 1px solid var(--border); }
.proj-mail-row:first-child { padding-top: .2rem; }
.proj-mail-row:last-child { border-bottom: none; padding-bottom: .2rem; }
.proj-mail-head { display: flex; align-items: center; gap: 10px; font-size: .85rem; }
.proj-mail-dir { color: var(--text-secondary); }
.proj-mail-subj { font-weight: 600; font-size: .88rem; margin-top: 2px; }
.proj-mail-prev { font-size: .8rem; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-mail-body { margin-top: .5rem; }
.proj-qa-item:last-child { border-bottom: 0 !important; }
.proj-qa-answer { background: var(--bg-subtle, #f1f5f9); border-radius: 8px; padding: .5rem .7rem; margin-top: .4rem; font-size: .9rem; white-space: pre-wrap; }
.proj-overview { display: flex; flex-direction: column; gap: 1rem; }
.proj-overview-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: .8rem;
}
.proj-overview-metric {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  padding: .9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  min-width: 0;
}
.proj-overview-metric small {
  color: var(--text-secondary);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.proj-overview-metric strong {
  font-size: 1.25rem;
  line-height: 1.2;
  color: var(--text-primary);
}
.proj-overview-metric span {
  color: var(--text-secondary);
  font-size: .82rem;
  overflow-wrap: anywhere;
}
.proj-overview-metric.green { border-color: rgba(56, 161, 105, .35); background: #f0fff4; }
.proj-overview-metric.gray { background: #f8fafc; }
.proj-overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}
.proj-overview-panel.wide { grid-column: 1 / -1; }
#projDetailBody .proj-overview-panel { padding: 0; overflow: hidden; }
.proj-overview-panel-head {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(248,250,252,.75);
}
.proj-overview-panel-head h3 { margin: 0; font-size: .92rem; }
.proj-overview-panel-body { padding: .7rem 1rem; display: flex; flex-direction: column; gap: .25rem; }
.proj-overview-action {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  padding: .65rem .75rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.proj-overview-action:hover { background: var(--bg); border-color: var(--primary); }
.proj-overview-action span { font-weight: 600; color: var(--text); }
.proj-overview-action small,
.proj-overview-item small { color: var(--text-secondary); font-size: .78rem; }
.proj-overview-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: .55rem;
  align-items: center;
  padding: .55rem .2rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: .85rem;
}
.proj-overview-item:last-child { border-bottom: 0; }
.proj-overview-item:hover { background: var(--bg); }
.proj-overview-item strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 720px) {
  .proj-detail-row { gap: .6rem 1.2rem; }
  .proj-overview-grid { grid-template-columns: 1fr; }
  .proj-overview-item { grid-template-columns: 1fr; align-items: start; gap: .25rem; }
  .proj-overview-item strong { white-space: normal; }
}


/* ============================================================
   DASHBOARD-WIDGETS (editierbares Layout, user_prefs.dashboard)
   ============================================================ */
.dash-canvas {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 22px;
  align-items: stretch;
}
.dash-widget { position: relative; min-width: 0; }
.dash-widget.dw-full  { grid-column: span 6; }
.dash-widget.dw-half  { grid-column: span 3; }
.dash-widget.dw-third { grid-column: span 2; }
@media (max-width: 1200px) {
  .dash-widget.dw-third { grid-column: span 3; }
}
@media (max-width: 860px) {
  .dash-widget.dw-half, .dash-widget.dw-third { grid-column: span 6; }
  /* eigene Breiten/Höhen auf schmalen Screens aufheben (Lesbarkeit vor Layout) */
  .dash-canvas .dash-widget { grid-column: 1 / -1 !important; height: auto !important; }
}

/* Vereinheitlichte Karten mit großzügigerem Innenabstand */
.dash-canvas .card,
.dash-canvas .timer-card,
.dash-canvas .stats-grid { margin-bottom: 0; height: 100%; }
.dash-card { display: flex; flex-direction: column; }
.dash-card .card-header { padding: 18px 26px; }
.dash-card-body { padding: 20px 26px 24px; flex: 1; }
.dash-card-body .entry-list { padding: 0; }
.dash-card-body .entry-item { padding-left: 0; padding-right: 0; }
.dash-card-body .data-table { margin: 0; }
.dash-card-body .week-chart { padding: 0; }
.dash-canvas .stat-card { padding: 22px 26px; }
.dash-canvas .timer-card { padding: 26px 30px; }
.dash-card-body .dash-widget-row { padding: 9px 2px; }

.dash-quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.dash-quick-grid .btn { justify-content: flex-start; }

.dash-vac-num { font-size: 1.7rem; font-weight: 700; }
.dash-vac-num small { font-size: .8rem; font-weight: 500; color: var(--text-secondary); }

/* --- Anpassen-Modus: Werkzeuge, Resize-Griffe, Ausgeblendete (ohne Wackeln) --- */
.dash-editing .dash-widget {
  cursor: grab;
  outline: 2px dashed var(--border);
  outline-offset: 4px;
  border-radius: var(--radius);
  transition: outline-color .15s;
}
.dash-editing .dash-widget:hover { outline-color: var(--primary); }
.dash-editing .dash-widget:active { cursor: grabbing; }
.dash-widget.dash-dragging { opacity: .45; }
.dash-widget.dash-widget-hidden { opacity: .42; }

/* Resize-Griffe: rechter Rand = Breite (Spalten), unterer Rand = Höhe, Ecke = beides */
.dash-resize-handle { position: absolute; z-index: 6; display: none; }
.dash-editing .dash-resize-handle { display: block; }
.dash-resize-e  { top: 8px; bottom: 8px; right: -4px; width: 12px; cursor: ew-resize; }
.dash-resize-s  { left: 8px; right: 8px; bottom: -4px; height: 12px; cursor: ns-resize; }
.dash-resize-se { right: -4px; bottom: -4px; width: 20px; height: 20px; z-index: 7; cursor: nwse-resize; }
.dash-resize-e::after {
  content: ''; position: absolute; top: 50%; right: 4px; transform: translateY(-50%);
  width: 4px; height: 38px; max-height: 60%; border-radius: 4px;
  background: var(--primary); opacity: .3; transition: opacity .15s;
}
.dash-resize-s::after {
  content: ''; position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%);
  width: 38px; max-width: 60%; height: 4px; border-radius: 4px;
  background: var(--primary); opacity: .3; transition: opacity .15s;
}
.dash-resize-se::after {
  content: ''; position: absolute; right: 4px; bottom: 4px; width: 11px; height: 11px;
  border-right: 3px solid var(--primary); border-bottom: 3px solid var(--primary);
  border-radius: 0 0 4px 0; opacity: .45; transition: opacity .15s;
}
.dash-resize-handle:hover::after { opacity: .9; }
.dash-widget.dash-resizing { outline: 2px solid var(--primary) !important; }
body.dash-resize-active, body.dash-resize-active * { user-select: none !important; }
/* Karten mit fester Höhe füllen die Kachel und scrollen bei Überlauf */
.dash-widget.dash-h-fixed > .card,
.dash-widget.dash-h-fixed > .timer-card,
.dash-widget.dash-h-fixed > .stats-grid { height: 100%; }
.dash-widget.dash-h-fixed .dash-card-body { overflow: auto; }
.dash-widget-tools {
  position: absolute;
  top: -12px; right: 10px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  box-shadow: var(--shadow);
  font-size: .75rem;
}
.dash-widget-name { color: var(--text-secondary); font-weight: 600; white-space: nowrap; }
.dash-widget-tools .nav-eye,
.dash-widget-tools .nav-burger {
  display: inline-flex;
  cursor: pointer;
}
.dash-widget-tools svg { width: 16px; height: 16px; fill: var(--text-secondary); }
.dash-widget-tools .nav-eye:hover svg { fill: var(--primary); }
.dash-widget-tools .nav-burger { cursor: grab; }
#dashEditBtn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ============================================================
   NAVIGATION: SORTIER-/AUSBLEND-MODUS (Stift neben Einstellungen)
   ============================================================ */
.nav-settings-row { display: flex; align-items: center; }
.nav-settings-row .nav-item { flex: 1; min-width: 0; }
.nav-edit-btn {
  background: none;
  border: none;
  color: var(--sidebar-text);
  cursor: pointer;
  padding: 8px 12px 8px 6px;
  display: flex;
  align-items: center;
  border-radius: 6px;
}
.nav-edit-btn svg { width: 15px; height: 15px; fill: currentColor; opacity: .7; }
.nav-edit-btn:hover svg { opacity: 1; }
.nav-edit-btn.active { color: var(--primary); }
.nav-edit-btn.active svg { opacity: 1; }
.sidebar.collapsed .nav-edit-btn { display: none; }

.nav-editing .sidebar-nav .nav-item[data-page] {
  cursor: grab;
}
.nav-editing .sidebar-nav .nav-item[data-page]:active { cursor: grabbing; }
.nav-item.nav-dragging { opacity: .45; }
.nav-item.nav-hidden-pref { opacity: .45; }
.nav-edit-tools {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.nav-edit-tools svg { width: 15px; height: 15px; fill: currentColor; opacity: .75; }
.nav-edit-tools .nav-eye { display: inline-flex; cursor: pointer; }
.nav-edit-tools .nav-eye:hover svg { opacity: 1; }
.nav-edit-tools .nav-burger { display: inline-flex; cursor: grab; }
.sidebar.collapsed .nav-edit-tools { display: none; }

/* ============================================================
   PROJEKT-TABS: große Buttons, + als eigene voll klickbare Kapsel
   ============================================================ */
#projDetailTabs { display: flex; flex-wrap: wrap; gap: 6px; }
#projDetailTabs .tab-btn {
  flex: 1 1 0;             /* 8 Buttons teilen sich 100% der Wrapper-Breite */
  min-width: 124px;        /* schmale Fenster: umbrechen statt quetschen */
  display: flex;
  align-items: stretch;
  padding: 0;
  min-height: 56px;        /* ~doppelte Höhe */
  overflow: hidden;        /* Kapsel endet sauber am border-radius */
}
#projDetailTabs .tab-label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  white-space: nowrap;
}
#projDetailTabs .tab-add {
  display: flex;           /* eigene Kapsel: volle Höhe, ganze Fläche klickbar */
  align-items: center;
  justify-content: center;
  width: 46px;
  flex-shrink: 0;
  border-left: 1.5px solid var(--border);
  background: rgba(128, 144, 168, .07);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
  opacity: .8;
  transition: all var(--transition);
}
#projDetailTabs .tab-add:hover { opacity: 1; background: var(--primary); color: #fff; }
#projDetailTabs .tab-btn.active .tab-add {
  border-left-color: rgba(255, 255, 255, .45);
  background: rgba(255, 255, 255, .14);
}
#projDetailTabs .tab-btn.active .tab-add:hover { background: rgba(255, 255, 255, .3); }

/* ============================================================
   AUFGABEN: Projekte-Panel (links, unter den Listen)
   ============================================================ */
.task-proj-count {
  margin-left: auto;
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg);
  border-radius: 999px;
  padding: 1px 7px;
}

/* ============================================================
   TEAM-MODAL: Nav-Berechtigungen (Checkbox-Grid)
   ============================================================ */
.navperm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px 14px;
  margin-bottom: .6rem;
}
.navperm-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .86rem;
  cursor: pointer;
  padding: 3px 0;
}
.navperm-item.navperm-fixed { opacity: .6; cursor: default; }

/* ============================================================
   KI-ASSISTENT (Chat-Widget + Vorschlagskarten)
   ============================================================ */

#llmChatBtn {
  position: fixed; bottom: 22px; right: 22px; z-index: 2500;
  width: 52px; height: 52px; border-radius: 50%;
  border: none; cursor: pointer;
  background: var(--primary); color: #fff;
  font-size: 1.35rem; line-height: 1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .22);
  transition: transform .15s ease, box-shadow .15s ease;
}
#llmChatBtn:hover { transform: scale(1.07); box-shadow: 0 6px 18px rgba(0, 0, 0, .28); }
body.llm-bottom-active #llmChatBtn {
  bottom: 88px;
}

#llmQuickReplyBubble {
  position: fixed;
  right: 84px;
  bottom: 28px;
  z-index: 2500;
  max-width: min(420px, calc(100vw - 120px));
  background: var(--card-bg, #fff);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .18);
  padding: .65rem .85rem;
  color: var(--text);
  font-size: .84rem;
  line-height: 1.4;
  cursor: pointer;
}
body.llm-bottom-active #llmQuickReplyBubble {
  bottom: 94px;
}
#llmQuickReplyBubble::after {
  content: "";
  position: absolute;
  right: -7px;
  bottom: 16px;
  width: 12px;
  height: 12px;
  background: var(--card-bg, #fff);
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  transform: rotate(45deg);
}

#llmChatPanel {
  position: fixed; bottom: 86px; right: 22px; z-index: 2500;
  width: 390px; max-width: calc(100vw - 32px);
  height: 560px; max-height: calc(100vh - 120px);
  display: flex; flex-direction: column;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, .22);
  overflow: hidden;
}

.llm-chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .65rem .9rem;
  background: var(--primary); color: #fff;
  flex: 0 0 auto;
}
.llm-chat-title { font-weight: 600; font-size: .92rem; }
.llm-chat-headerbtns { display: flex; gap: .35rem; align-items: center; }
.llm-chat-header .icon-btn {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 8px;
  color: #fff;
  background: rgba(255, 255, 255, .1);
  opacity: 1;
  font-size: .95rem;
}
.llm-chat-header .icon-btn:hover {
  background: rgba(255, 255, 255, .18);
  border-color: rgba(255, 255, 255, .35);
  transform: translateY(-1px);
}

#llmChatMessages {
  flex: 1 1 auto; overflow-y: auto;
  padding: .9rem;
  display: flex; flex-direction: column; gap: .55rem;
  background: var(--bg, #f7f9fc);
}

.llm-msg {
  max-width: 86%;
  padding: .55rem .8rem;
  border-radius: 12px;
  font-size: .86rem; line-height: 1.45;
  white-space: normal; word-wrap: break-word;
}
.llm-msg-user {
  align-self: flex-end;
  background: var(--primary); color: #fff;
  border-bottom-right-radius: 4px;
}
.llm-msg-assistant {
  align-self: flex-start;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

/* Tipp-Indikator (drei springende Punkte) */
.llm-typing { display: flex; gap: 4px; padding: .7rem .9rem; }
.llm-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-secondary, #718096);
  animation: llmBounce 1.2s infinite;
}
.llm-typing span:nth-child(2) { animation-delay: .15s; }
.llm-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes llmBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30%           { transform: translateY(-5px); opacity: 1; }
}

/* Vorschlagskarte (Bestätigung schreibender Aktionen) */
.llm-proposal {
  align-self: stretch;
  background: var(--card-bg, #fff);
  border: 1px solid var(--primary);
  border-radius: 12px;
  padding: .7rem .85rem;
  font-size: .85rem;
}
.llm-prop-title { font-weight: 600; margin-bottom: .45rem; }
.llm-prop-row {
  display: flex; justify-content: space-between; gap: .75rem;
  padding: 2px 0; font-size: .82rem;
}
.llm-prop-row span { color: var(--text-secondary, #718096); flex: 0 0 auto; }
.llm-prop-row strong { font-weight: 500; text-align: right; word-break: break-word; }
.llm-prop-actions { display: flex; gap: .5rem; margin-top: .6rem; }
.llm-prop-state { margin-top: .5rem; font-size: .82rem; color: var(--text-secondary, #718096); }

.llm-chat-inputrow {
  flex: 0 0 auto;
  display: flex; gap: .55rem; align-items: stretch;
  padding: .6rem .7rem;
  border-top: 1px solid var(--border);
  background: var(--card-bg, #fff);
}
.llm-chat-inputrow textarea {
  flex: 1 1 auto; resize: none;
  border: 1px solid var(--border); border-radius: 10px;
  padding: .5rem .7rem; font-size: .86rem; font-family: inherit;
  height: 42px;
  min-height: 42px;
  max-height: 110px;
  line-height: 1.45;
  overflow-y: auto;
}
.llm-chat-inputrow textarea:focus { outline: none; border-color: var(--primary); }
.llm-chat-inputrow .btn,
.llm-chat-inputrow .icon-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  flex: 0 0 42px;
  padding: 0;
  border-radius: 10px;
}
#llmChatSendBtn {
  font-size: 1rem;
  line-height: 1;
}
.llm-mic-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
}
.llm-mic-btn svg { width: 18px; height: 18px; fill: currentColor; }
.llm-mic-btn:hover { color: var(--primary); background: var(--primary-light); }
.llm-mic-btn.recording {
  color: #fff;
  background: var(--red, #e53e3e);
  border-color: var(--red, #e53e3e);
  animation: llmMicPulse 1s ease-in-out infinite;
}
@keyframes llmMicPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(229, 62, 62, .35); }
  50%      { transform: scale(1.05); box-shadow: 0 0 0 6px rgba(229, 62, 62, 0); }
}

#llmBottomBar {
  position: fixed;
  left: var(--sidebar-w);
  right: 0;
  bottom: 0;
  z-index: 2400;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .7rem 1rem;
  background: rgba(255, 255, 255, .96);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 24px rgba(15, 23, 42, .08);
  backdrop-filter: blur(10px);
}
body.sidebar-collapsed #llmBottomBar { left: var(--sidebar-collapsed-w); }
body.llm-bottom-active .main-content { padding-bottom: 76px; }
#llmBottomInput {
  flex: 1 1 auto;
  height: 42px;
  min-height: 42px;
  max-height: 94px;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .65rem .8rem;
  font-size: .9rem;
  font-family: inherit;
}
#llmBottomInput:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 176, 255, .12); }
#llmBottomBar .llm-mic-btn,
#llmBottomSendBtn {
  height: 42px;
  min-height: 42px;
  border-radius: 10px;
  align-self: center;
}
#llmBottomBar .llm-mic-btn {
  width: 42px;
  min-width: 42px;
  flex: 0 0 42px;
  padding: 0;
}
#llmBottomSendBtn {
  flex: 0 0 auto;
  padding: 0 1rem;
}

@media (max-width: 768px) {
  #llmBottomBar { left: 0; padding: .55rem .65rem; }
  body.sidebar-collapsed #llmBottomBar { left: 0; }
  #llmQuickReplyBubble { left: 12px; right: 74px; max-width: none; }
  #llmBottomSendBtn { padding-left: .75rem; padding-right: .75rem; }
}

/* ============================================================
   DATEIEN – Team-Dateiablage (Windows-Explorer-Stil)
   ============================================================ */

/* ---- Befehlsleiste (Kopf) ---- */
.files-cmdbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.files-cmd-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.files-cmd-right { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.files-cmd-left .btn-ico { width: 15px; height: 15px; fill: currentColor; vertical-align: -3px; margin-right: 3px; }
.files-search { position: relative; display: inline-flex; align-items: center; }
.files-search-ico { position: absolute; left: 9px; width: 15px; height: 15px; fill: var(--text-secondary); pointer-events: none; }
.files-filter-input { padding: 7px 10px 7px 30px; border: 1.5px solid var(--border); border-radius: 8px; font-size: .85rem; width: 160px; background: var(--card-bg); color: var(--text); transition: border-color .15s ease, box-shadow .15s ease; }
.files-filter-input:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring, 0 0 0 3px rgba(8,145,178,.16)); }
.files-sort-sel { width: auto; min-width: 110px; }
.files-viewswitch { display: inline-flex; border: 1.5px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--card-bg); }
.files-viewswitch button { background: none; border: none; border-right: 1px solid var(--border); padding: 6px 9px; cursor: pointer; color: var(--text-secondary); display: inline-flex; align-items: center; transition: background .15s ease, color .15s ease; }
.files-viewswitch button:last-child { border-right: none; }
.files-viewswitch button svg { width: 17px; height: 17px; fill: currentColor; display: block; }
.files-viewswitch button:hover { background: var(--bg-subtle, #f1f5f9); color: var(--text); }
.files-viewswitch button.active { background: var(--primary); color: #fff; }

/* ---- Layout: Navigationsbaum + Hauptbereich ---- */
.files-layout { display: grid; grid-template-columns: 250px 1fr; gap: 16px; align-items: start; }
.files-side { padding: 12px 10px; max-height: calc(100vh - 172px); overflow: auto; position: sticky; top: 96px; }
.files-side-head { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 8px; font-weight: 600; font-size: .85rem; }

.files-tree { display: flex; flex-direction: column; gap: 1px; }
.file-tree-node { display: flex; align-items: center; gap: 4px; padding: 5px 6px; border-radius: 7px; cursor: pointer; font-size: .88rem; user-select: none; }
.file-tree-node:hover { background: var(--bg-subtle, #f1f5f9); }
.file-tree-node.active { background: var(--primary-light, #e6f7fb); color: var(--primary-dark, var(--primary)); font-weight: 600; }
.file-tree-twisty { width: 14px; flex: 0 0 14px; text-align: center; transition: transform .15s ease; color: var(--text-secondary); font-size: .7rem; }
.file-tree-twisty.open { transform: rotate(90deg); }
.file-tree-spacer { width: 14px; flex: 0 0 14px; }
.file-tree-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-tree-count { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; font-size: .68rem; padding: 0 6px; color: var(--text-secondary); margin-left: auto; }

/* ---- Hauptbereich: Adressleiste · Inhalt · Statusleiste ---- */
.files-main { display: flex; flex-direction: column; min-height: 360px; max-height: calc(100vh - 172px); padding: 0; overflow: hidden; position: relative; }
.files-main.files-dragover { outline: 2px dashed var(--primary); outline-offset: -5px; }
.files-main.files-dragover .files-list { background: var(--primary-light, #e6f7fb); }

.files-addressbar { display: flex; align-items: center; gap: 6px; padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--card-bg); flex: 0 0 auto; }
.files-breadcrumb { flex: 1; min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 1px; font-size: .92rem; font-weight: 600; }
.files-crumb { cursor: pointer; color: var(--text); padding: 3px 7px; border-radius: 7px; white-space: nowrap; transition: background .12s ease, color .12s ease; }
.files-crumb:hover { background: var(--bg-subtle, #f1f5f9); color: var(--primary); }
.files-crumb-sep { color: var(--text-secondary); margin: 0 1px; }
.files-folder-menu { flex: 0 0 auto; background: none; border: 1px solid transparent; border-radius: 7px; width: 30px; height: 30px; cursor: pointer; font-size: 1.15rem; line-height: 1; color: var(--text-secondary); transition: background .12s ease, border-color .12s ease, color .12s ease; }
.files-folder-menu:hover { background: var(--bg-subtle, #f1f5f9); border-color: var(--border); color: var(--text); }

.files-statusbar { flex: 0 0 auto; padding: 7px 14px; border-top: 1px solid var(--border); font-size: .76rem; color: var(--text-secondary); background: var(--card-bg); }

.files-list { flex: 1 1 auto; overflow: auto; padding: 12px 14px; }

/* ---- Element (Ordner/Datei) gemeinsam ---- */
.fitem { display: flex; border: 1px solid transparent; border-radius: 9px; cursor: pointer; user-select: none; transition: background .12s ease, border-color .12s ease; }
.fitem:hover { background: var(--bg-subtle, #f1f5f9); }
.fitem.selected { background: var(--primary-light, #e6f7fb); border-color: var(--primary); }
.fitem:focus-visible { outline: none; box-shadow: var(--ring, 0 0 0 3px rgba(8,145,178,.16)); }
.fitem-ico { position: relative; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.fico-folder { fill: var(--primary); display: block; }
.fico-folder.is-home { fill: var(--accent, #f59e0b); }
.fico-emoji { display: inline-block; line-height: 1; }
.fitem-body { min-width: 0; flex: 1; }
.fitem-name { font-size: .86rem; font-weight: 500; color: var(--text); }
.view-tiles .fitem-name, .view-list .fitem-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fitem-sub { font-size: .76rem; color: var(--text-secondary); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fitem-owner { color: var(--text-secondary); font-weight: 400; font-size: .82em; }
.fitem-count { position: absolute; right: -7px; bottom: -5px; background: var(--primary); color: #fff; font-size: .6rem; line-height: 1; padding: 2px 5px; border-radius: 9px; border: 2px solid var(--card-bg); }
.fbadge { font-size: .82em; }

/* Große Symbole */
.files-list.view-icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; align-content: start; }
.view-icons .fitem { flex-direction: column; text-align: center; padding: 12px 8px; gap: 8px; }
.view-icons .fitem-body { width: 100%; }
.view-icons .fico-folder { width: 46px; height: 46px; }
.view-icons .fico-emoji { font-size: 42px; }
.view-icons .fitem-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.view-icons .fitem-sub { display: none; }

/* Kacheln */
.files-list.view-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 8px; align-content: start; }
.view-tiles .fitem { flex-direction: row; align-items: center; padding: 9px 11px; gap: 12px; }
.view-tiles .fico-folder { width: 30px; height: 30px; }
.view-tiles .fico-emoji { font-size: 26px; }

/* Liste (mehrspaltiger Fluss) */
.files-list.view-list { display: block; column-width: 234px; column-gap: 18px; }
.view-list .fitem { break-inside: avoid; padding: 5px 8px; gap: 9px; align-items: center; }
.view-list .fico-folder { width: 18px; height: 18px; }
.view-list .fico-emoji { font-size: 17px; }
.view-list .fitem-sub { display: none; }

/* Details (Tabelle mit sortierbaren Spalten) */
.files-list.view-details { padding: 0; }
.files-dtable { width: 100%; border-collapse: collapse; }
.files-dtable thead th { position: sticky; top: 0; z-index: 1; background: var(--card-bg); text-align: left; font-size: .74rem; font-weight: 600; color: var(--text-secondary); padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; white-space: nowrap; user-select: none; }
.files-dtable thead th:hover { color: var(--text); }
.files-dtable .col-name { width: 48%; }
.files-dtable .sort-arrow { font-size: .62rem; margin-left: 4px; color: var(--primary); }
.files-dtable td { padding: 7px 14px; border-bottom: 1px solid var(--border); font-size: .85rem; vertical-align: middle; color: var(--text); }
.files-dtable td:not(.fcell-name) { color: var(--text-secondary); white-space: nowrap; }
.files-dtable tbody tr { cursor: pointer; }
.files-dtable tbody tr:hover { background: var(--bg-subtle, #f1f5f9); }
.files-dtable tbody tr.selected { background: var(--primary-light, #e6f7fb); }
.fcell-name { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.fcell-name .fico-folder { width: 20px; height: 20px; flex: 0 0 20px; }
.fcell-name .fico-emoji { font-size: 18px; }
.fcell-name > span:not(.fbadge):not(.fico-emoji) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Leerzustand */
.files-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 220px; padding: 30px 20px; text-align: center; color: var(--text-secondary); }
.files-empty-ico { font-size: 46px; opacity: .55; }
.files-empty-title { font-size: 1rem; font-weight: 600; color: var(--text); }
.files-empty-sub { font-size: .85rem; max-width: 360px; }

/* Kontextmenü (Rechtsklick) */
.files-ctxmenu { position: fixed; z-index: 9999; min-width: 198px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg, 0 18px 44px rgba(15,23,42,.18)); padding: 5px; user-select: none; }
.files-ctx-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: .86rem; color: var(--text); }
.files-ctx-item:hover { background: var(--primary); color: #fff; }
.files-ctx-item.danger { color: var(--red, #dc2626); }
.files-ctx-item.danger:hover { background: var(--red, #dc2626); color: #fff; }
.files-ctx-ico { width: 18px; text-align: center; font-size: .95em; }
.files-ctx-sep { height: 1px; background: var(--border); margin: 4px 6px; }

/* Mail-Anhang: „In Dateien speichern"-Knopf neben dem Download-Chip */
.mail-att-wrap { display: inline-flex; align-items: stretch; }
.mail-att-wrap .mail-att { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.mail-att-save { font-size: .8rem; background: var(--bg); border: 1px solid var(--border); border-left: none; border-radius: 0 8px 8px 0; padding: .3rem .5rem; cursor: pointer; color: var(--text); }
.mail-att-save:hover { border-color: var(--primary); color: var(--primary); }

@media (max-width: 900px) {
  .files-layout { grid-template-columns: 1fr; }
  .files-side { position: static; max-height: 240px; }
  .files-main { max-height: none; }
  .files-cmd-right { width: 100%; }
  .files-filter-input { flex: 1; width: auto; }
}
