/* ============== Reset & Base ============== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  /* Vertikale Scrollbar nur wenn nötig (auto wäre default, aber wir setzen es explizit) */
  overflow-x: hidden; /* niemals horizontaler Scroll */
  overflow-y: auto;
  background: var(--bg); /* Hintergrund auf html, damit body keine min-height braucht */
}

:root {
  --bg: #eef0f3;
  --bg-2: #ffffff;
  --bg-3: #e6e8ec;
  --text: #1d1d1f;
  --text-2: #515156;
  --text-3: #86868b;
  --border: transparent;
  --border-soft: rgba(0,0,0,.04);
  --border-strong: #d2d2d7;
  --primary: #1d1d1f;
  --primary-fg: #ffffff;
  --accent: #ff5757;
  --accent-hover: #ff3838;
  --accent-soft: #fff0f0;
  --accent-fg: #ffffff;
  --danger: #ff3b30;
  --danger-bg: #ffeded;
  --success: #34c759;
  --success-bg: #e8f9ec;
  --warning: #ff9500;
  --warning-bg: #fff4e3;
  --info: #007aff;
  --info-bg: #e8f2ff;
  --shadow-xs: 0 1px 2px rgba(15,18,28,.04);
  --shadow-sm: 0 2px 4px rgba(15,18,28,.05), 0 1px 1px rgba(15,18,28,.04);
  --shadow: 0 4px 14px rgba(15,18,28,.06), 0 2px 4px rgba(15,18,28,.04);
  --shadow-md: 0 12px 28px rgba(15,18,28,.09), 0 4px 8px rgba(15,18,28,.05);
  --shadow-lg: 0 28px 64px rgba(15,18,28,.18), 0 8px 18px rgba(15,18,28,.08);
  --shadow-hover: 0 14px 36px rgba(15,18,28,.12), 0 4px 10px rgba(15,18,28,.06);
  --radius: 18px;
  --radius-sm: 10px;
  --sidebar-w: 248px;
  --topbar-h: 64px;
  --layout-gap: 14px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

html[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-2: #1a1a1a;
  --bg-3: #242424;
  --text: #f5f5f7;
  --text-2: #c7c7cc;
  --text-3: #8e8e93;
  --border: transparent;
  --border-soft: rgba(255,255,255,.05);
  --border-strong: #3a3a3a;
  --primary: #f5f5f7;
  --primary-fg: #0a0a0a;
  --accent: #ff5757;
  --accent-hover: #ff7070;
  --accent-soft: rgba(255,87,87,0.14);
  --danger: #ff453a;
  --danger-bg: rgba(255,69,58,.12);
  --success: #30d158;
  --success-bg: rgba(48,209,88,.12);
  --warning: #ff9f0a;
  --warning-bg: rgba(255,159,10,.12);
  --info: #0a84ff;
  --info-bg: rgba(10,132,255,.12);
  --shadow-xs: 0 1px 2px rgba(0,0,0,.4);
  --shadow-sm: 0 2px 6px rgba(0,0,0,.5);
  --shadow: 0 4px 16px rgba(0,0,0,.55), 0 2px 4px rgba(0,0,0,.4);
  --shadow-md: 0 12px 32px rgba(0,0,0,.7), 0 4px 8px rgba(0,0,0,.5);
  --shadow-lg: 0 28px 60px rgba(0,0,0,.8);
  --shadow-hover: 0 14px 36px rgba(0,0,0,.7), 0 4px 10px rgba(0,0,0,.5);
}

body {
  font-family: var(--font);
  background: transparent; /* Hintergrund kommt vom html */
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  /* Kein min-height: body wird nur so hoch wie der echte Inhalt */
  position: relative;
  overflow-x: hidden; /* Sicherheitsnetz gegen horizontalen Scroll vom Glow */
}
/* color-scheme passt native Browser-Widgets (Date/Time-Picker, Scrollbars) an Light/Dark an */
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="dark"] input[type="date"],
html[data-theme="dark"] input[type="time"],
html[data-theme="dark"] input[type="datetime-local"],
html[data-theme="dark"] input[type="month"],
html[data-theme="dark"] input[type="week"] {
  color-scheme: dark;
}
/* Akzentfarbe für native Picker (Highlight im Time-Picker, Selected-Tag im Kalender) */
input[type="date"], input[type="time"], input[type="datetime-local"],
input[type="month"], input[type="week"], input[type="range"], input[type="checkbox"], input[type="radio"] {
  accent-color: var(--accent);
}
/* Ambient Glow im Hintergrund — wie auf der Login-Seite, aber dezenter weil immer da */
body::before {
  content: '';
  position: fixed;
  top: -180px; left: 50%;
  width: 110vw; height: 540px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse 60% 60% at 50% 40%, rgba(255,87,87,.10), transparent 65%);
  pointer-events: none;
  z-index: 0;
  animation: ambient-pulse 14s ease-in-out infinite;
}
html[data-theme="dark"] body::before {
  background: radial-gradient(ellipse 60% 60% at 50% 40%, rgba(255,87,87,.22), transparent 65%);
}
@keyframes ambient-pulse {
  0%, 100% { opacity: 0.65; transform: translateX(-50%) scale(1); }
  50%      { opacity: 1;    transform: translateX(-50%) scale(1.05); }
}
/* Sidebar/Topbar/Main müssen über dem Glow liegen */
.sidebar, .topbar, .main, .main-public, #modalRoot { position: relative; z-index: 1; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============== Sidebar ============== */
.sidebar {
  position: fixed;
  top: var(--layout-gap);
  left: var(--layout-gap);
  bottom: var(--layout-gap);
  width: var(--sidebar-w);
  /* Milchglas-Effekt: halbtransparenter Hintergrund + Backdrop-Blur */
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  padding: 20px 14px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  z-index: 30;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.4);
  transition: transform .25s ease, width .25s ease, padding .25s ease;
  box-shadow: 0 10px 40px rgba(15,18,28,.08), 0 2px 8px rgba(15,18,28,.04);
}
/* Optional: Scrollbar in der Sidebar dezenter machen (Webkit) */
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
/* Desktop-Collapse: zu schmaler Icon-Bar (64px) */
html[data-sidebar="collapsed"] {
  --sidebar-w: 64px;
}
html[data-sidebar="collapsed"] .sidebar {
  padding: 20px 8px;
}
html[data-sidebar="collapsed"] .nav a {
  justify-content: center;
  padding: 12px 0;
}
html[data-sidebar="collapsed"] .nav a span,
html[data-sidebar="collapsed"] .nav-sep,
html[data-sidebar="collapsed"] .brand-name,
html[data-sidebar="collapsed"] .sidebar-user-info,
html[data-sidebar="collapsed"] .sidebar-logout {
  display: none;
}
html[data-sidebar="collapsed"] .brand-logo,
html[data-sidebar="collapsed"] .brand {
  justify-content: center;
  padding: 0 0 22px;
}
html[data-sidebar="collapsed"] .brand-logo img { max-height: 32px; }
html[data-sidebar="collapsed"] .sidebar-footer {
  flex-direction: column;
  padding: 8px 4px;
}
html[data-sidebar="collapsed"] .sidebar-user {
  padding: 4px;
  justify-content: center;
}
html[data-sidebar="collapsed"] .sidebar-user-avatar { margin: 0; }
html[data-sidebar="collapsed"] .sidebar-collapse-btn svg { transform: rotate(180deg); }
/* Collapse-Button — fixed im Viewport, sitzt am rechten Sidebar-Rand */
.sidebar-collapse-btn {
  position: fixed;
  left: calc(var(--sidebar-w) + var(--layout-gap) - 12px);
  top: calc(var(--layout-gap) + 22px);
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--text-2);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  display: grid; place-items: center;
  box-shadow: var(--shadow);
  transition: all .2s ease;
  z-index: 35;
  padding: 0;
}
.sidebar-collapse-btn:hover {
  background: var(--accent); color: var(--accent-fg); border-color: var(--accent);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(255,87,87,.4);
}
html[data-sidebar="collapsed"] .sidebar-collapse-btn svg { transform: rotate(180deg); }
@media (max-width: 900px) {
  .sidebar-collapse-btn { display: none; }
}
html[data-theme="dark"] .sidebar {
  background: rgba(26, 26, 28, 0.55);
  border-color: rgba(255,255,255,.08);
  box-shadow: 0 12px 40px rgba(0,0,0,.55), 0 2px 8px rgba(0,0,0,.3);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; }
.brand-logo { display: block; padding: 0 8px 22px; }
.brand-logo img { display: block; max-height: 40px; max-width: 100%; width: auto; object-fit: contain; transition: filter .2s ease; }
html[data-theme="dark"] .brand-logo-invert-dark img { filter: invert(1) hue-rotate(180deg) brightness(1.05); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--accent-fg);
  display: grid; place-items: center; font-weight: 700; font-size: 18px;
  box-shadow: 0 4px 12px rgba(255,87,87,.3);
}
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--text-2); font-weight: 500; font-size: 14px;
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.nav a:hover { background: var(--bg-3); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a.active svg { color: var(--accent); }
.nav a svg { flex: 0 0 20px; }
.nav-sep { font-size: 11px; text-transform: uppercase; color: var(--text-3); letter-spacing: .07em; padding: 22px 12px 8px; font-weight: 700; }

/* ============== Topbar — eingebettet, ohne Karten-Rahmen ============== */
.topbar {
  position: fixed;
  top: var(--layout-gap);
  left: calc(var(--sidebar-w) + var(--layout-gap) * 2);
  right: var(--layout-gap);
  height: var(--topbar-h);
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  display: flex; align-items: center; gap: 14px; padding: 0 4px;
  z-index: 20;
  border-radius: 0;
  border: 0;
  box-shadow: none;
}
html[data-theme="dark"] .topbar { background: transparent; border: 0; box-shadow: none; }
/* Topbar-Icons: alle als runde Kreise mit subtilem Hover */
.icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-soft);
  background: var(--bg-2);
  color: var(--text-2);
  cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 2px 6px rgba(15,18,28,.04);
  transition: all .15s ease;
}
.icon-btn:hover {
  background: var(--bg-3); color: var(--text);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15,18,28,.08);
}
html[data-theme="dark"] .icon-btn { border-color: rgba(255,255,255,.08); background: rgba(255,255,255,.04); }
html[data-theme="dark"] .icon-btn:hover { background: rgba(255,255,255,.08); }

.sidebar-toggle { display: none; }

/* Suchleiste: eingebettet (kein Box-Hintergrund), Lupe im roten Kreis links */
.search-wrap {
  flex: 1; position: relative; max-width: 560px;
  display: flex; align-items: center; gap: 10px;
}
.search-wrap > svg {
  flex-shrink: 0;
  width: 36px; height: 36px;
  padding: 9px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  pointer-events: none;
  box-shadow: 0 3px 10px rgba(255,87,87,.25);
}
.search-wrap input {
  width: 100%; height: 40px; padding: 0 38px 0 4px;
  border: 0; border-radius: 0;
  background: transparent;
  color: var(--text); font-family: inherit; font-size: 15px;
  outline: 0;
  transition: all .15s ease;
}
.search-wrap input::placeholder { color: var(--text-3); }
.search-wrap input:focus { background: transparent; box-shadow: none; }
.kbd-hint {
  position: absolute; right: 4px; background: var(--bg-3); border: 1px solid var(--border-strong);
  border-radius: 6px; padding: 2px 7px; font-size: 11px; color: var(--text-3); font-family: monospace;
}
.search-results {
  position: absolute; top: 44px; left: 0; right: 0;
  background: var(--bg-2); border-radius: 14px;
  box-shadow: var(--shadow-lg); max-height: 480px; overflow-y: auto; z-index: 50;
  padding: 6px;
}
.sr-item { border-radius: 8px; }
.sr-group { padding: 6px 0; }
.sr-group-title { font-size: 11px; text-transform: uppercase; color: var(--text-3); padding: 4px 14px; font-weight: 600; letter-spacing: .05em; }
.sr-item { display: flex; gap: 10px; padding: 8px 14px; cursor: pointer; }
.sr-item:hover, .sr-item.focus { background: var(--bg-3); }
.sr-item-title { font-weight: 500; font-size: 14px; }
.sr-item-meta { font-size: 12px; color: var(--text-3); }
.sr-empty { padding: 18px; color: var(--text-3); text-align: center; font-size: 14px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.user-chip {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: var(--accent-fg);
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(255,87,87,.3);
  overflow: hidden;
}
.user-chip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.user-chip:hover { transform: scale(1.05); }

/* ============== Main ============== */
.main {
  margin-left: calc(var(--sidebar-w) + var(--layout-gap) * 2);
  margin-right: var(--layout-gap);
  margin-top: calc(var(--topbar-h) + var(--layout-gap) * 2);
  padding: 14px 22px 24px;
  /* keine min-height — Seite scrollt nur, wenn der Inhalt wirklich höher als Viewport ist */
}
.main-public {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: var(--bg);
  position: relative;
}
html[data-theme="dark"] .main-public { background: #07070a; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.page-title { font-size: 28px; font-weight: 700; margin: 0; letter-spacing: -0.03em; }
.page-sub { color: var(--text-2); margin: 4px 0 0; font-size: 14px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back-btn {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--bg-2); color: var(--text-2);
  text-decoration: none; flex-shrink: 0;
  box-shadow: var(--shadow-xs);
  transition: all .15s ease;
  margin-top: 4px;
}
.back-btn:hover { color: var(--text); box-shadow: var(--shadow-sm); transform: translateX(-2px); }
.back-btn:active { transform: translateX(0); }

/* ============== Cards & Layout ============== */
.card {
  background: var(--bg-2); border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, transform .2s ease;
}
.card:hover { box-shadow: var(--shadow); }
.card-title { font-size: 15px; font-weight: 600; margin: 0 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-pad-0 { padding: 0; }
.card-title-row { padding: 16px 18px; border-bottom: 1px solid var(--border-soft); display: flex; align-items: center; justify-content: space-between; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 200px; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-12 { margin-bottom: 12px; } .mb-24 { margin-bottom: 24px; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.text-muted { color: var(--text-2); }
.text-faint { color: var(--text-3); }
.text-sm { font-size: 13px; } .text-xs { font-size: 12px; } .text-lg { font-size: 17px; } .text-xl { font-size: 21px; }
.font-medium { font-weight: 500; } .font-semibold { font-weight: 600; } .font-bold { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }

/* ============== Stats ============== */
.stat {
  background: var(--bg-2); border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, transform .2s ease;
}
.stat:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.stat-label { font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.stat-value { font-size: 30px; font-weight: 700; margin-top: 8px; letter-spacing: -.025em; color: var(--text); }
.stat-meta { font-size: 13px; color: var(--text-2); margin-top: 8px; }
.stat-meta.good { color: var(--success); font-weight: 600; }
.stat-meta.bad { color: var(--danger); font-weight: 600; }
.stat-icon {
  float: right; width: 40px; height: 40px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center;
}
.stat-icon.good { background: var(--success-bg); color: var(--success); }
.stat-icon.warn { background: var(--warning-bg); color: var(--warning); }
.stat-icon.info { background: var(--info-bg); color: var(--info); }
.stat-icon.danger { background: var(--danger-bg); color: var(--danger); }

/* ============== Buttons ============== */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 10px 16px; border: 0; border-radius: 10px;
  background: var(--bg-2); color: var(--text); cursor: pointer; font-family: inherit;
  font-size: 14px; font-weight: 600; text-decoration: none; transition: all .15s ease;
  white-space: nowrap;
  box-shadow: var(--shadow-xs);
}
.btn:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-xs); }
.btn-primary { background: var(--primary); color: var(--primary-fg); box-shadow: 0 4px 12px rgba(15,18,28,.15); }
.btn-primary:hover { background: var(--text-2); box-shadow: 0 6px 18px rgba(15,18,28,.2); }
.btn-accent { background: var(--accent); color: var(--accent-fg); box-shadow: 0 6px 14px rgba(255,87,87,.3); }
.btn-accent:hover { background: var(--accent-hover); box-shadow: 0 8px 22px rgba(255,87,87,.4); }
.btn-danger { color: var(--danger); background: var(--bg-2); }
.btn-danger:hover { background: var(--danger-bg); color: var(--danger); }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--bg-3); box-shadow: none; transform: none; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn-icon { padding: 8px; }
.btn-block { width: 100%; }

/* ============== Forms ============== */
.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; padding: 10px 14px; border: 0; border-radius: 10px;
  background: var(--bg-3); color: var(--text); font-family: inherit; font-size: 14px;
  outline: 0; transition: all .15s ease;
  box-shadow: inset 0 0 0 1px var(--border-soft);
}
.input:focus, .select:focus, .textarea:focus { background: var(--bg-2); box-shadow: 0 0 0 3px var(--accent-soft), inset 0 0 0 1px var(--accent); }
.input[readonly], .input:disabled { background: var(--bg-3); color: var(--text-2); }
.textarea { resize: vertical; min-height: 88px; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%2364748b' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px;
}
.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border-soft); }

/* ============== Table ============== */
.table {
  width: 100%; border-collapse: collapse;
  background: var(--bg-2); border-radius: var(--radius); overflow: hidden;
}
.table-wrap { background: var(--bg-2); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow-sm); }
.table th {
  text-align: left; font-weight: 700; font-size: 11px; color: var(--text-3);
  padding: 14px 18px; border-bottom: 1px solid var(--border-soft);
  text-transform: uppercase; letter-spacing: .06em; background: var(--bg-2);
}
.table td {
  padding: 14px 18px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; font-size: 14px;
}
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--bg-3); }
.table tr[data-href] { cursor: pointer; }
.table tr[data-href]:hover td { background: var(--bg-3); }
.table-link { color: var(--text); font-weight: 600; }
.table-link:hover { color: var(--accent); text-decoration: none; }
.table-actions { text-align: right; white-space: nowrap; }
.table-actions a, .table-actions button { color: var(--text-3); margin-left: 6px; background: transparent; border: 0; cursor: pointer; padding: 4px; border-radius: 4px; }
.table-actions a:hover, .table-actions button:hover { color: var(--accent); background: var(--bg-3); }
.table-empty { padding: 40px 20px; text-align: center; color: var(--text-3); }

/* ============== Badges ============== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.4;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .95; }
.badge-gray { background: #e8e8ed; color: #3a3a3c; }
.badge-blue { background: #d6e9ff; color: #0040a0; }
.badge-amber { background: #ffe9c2; color: #864200; }
.badge-violet { background: #ead8ff; color: #4a1e9e; }
.badge-emerald { background: #c5f5d4; color: #006927; }
.badge-rose { background: #ffd8d8; color: #a8001a; }
html[data-theme="dark"] .badge-gray { background: rgba(199,199,204,.16); color: #d1d1d6; }
html[data-theme="dark"] .badge-blue { background: rgba(10,132,255,.22); color: #7eb6ff; }
html[data-theme="dark"] .badge-amber { background: rgba(255,159,10,.22); color: #ffcd6e; }
html[data-theme="dark"] .badge-violet { background: rgba(191,90,242,.22); color: #d6a4ff; }
html[data-theme="dark"] .badge-emerald { background: rgba(48,209,88,.22); color: #6ee592; }
html[data-theme="dark"] .badge-rose { background: rgba(255,69,58,.22); color: #ff8a82; }

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

/* Inline-Status-Select — sieht wie ein Badge aus, ist aber ein <select> */
.status-inline {
  appearance: none; -webkit-appearance: none;
  border: 0; padding: 4px 24px 4px 11px;
  border-radius: 999px; font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: inherit; outline: none;
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 10px 10px;
  transition: all .15s ease;
}
.status-inline:hover { filter: brightness(.95); }
.status-inline:focus { box-shadow: 0 0 0 3px var(--accent-soft); }
.status-inline.gray { background-color: #e8e8ed; color: #3a3a3c; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M1 3l4 4 4-4' stroke='%233a3a3c' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.status-inline.blue { background-color: #d6e9ff; color: #0040a0; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M1 3l4 4 4-4' stroke='%230040a0' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.status-inline.amber { background-color: #ffe9c2; color: #864200; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M1 3l4 4 4-4' stroke='%23864200' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.status-inline.violet { background-color: #ead8ff; color: #4a1e9e; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M1 3l4 4 4-4' stroke='%234a1e9e' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.status-inline.emerald { background-color: #c5f5d4; color: #006927; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M1 3l4 4 4-4' stroke='%23006927' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.status-inline.rose { background-color: #ffd8d8; color: #a8001a; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M1 3l4 4 4-4' stroke='%23a8001a' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
html[data-theme="dark"] .status-inline.gray { background-color: rgba(199,199,204,.16); color: #d1d1d6; }
html[data-theme="dark"] .status-inline.blue { background-color: rgba(10,132,255,.22); color: #7eb6ff; }
html[data-theme="dark"] .status-inline.amber { background-color: rgba(255,159,10,.22); color: #ffcd6e; }
html[data-theme="dark"] .status-inline.violet { background-color: rgba(191,90,242,.22); color: #d6a4ff; }
html[data-theme="dark"] .status-inline.emerald { background-color: rgba(48,209,88,.22); color: #6ee592; }
html[data-theme="dark"] .status-inline.rose { background-color: rgba(255,69,58,.22); color: #ff8a82; }

/* Custom Date-Picker — nativen Browser-Picker abschalten */
input[type="date"]::-webkit-calendar-picker-indicator {
  display: none !important;
  -webkit-appearance: none;
  appearance: none;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}
input[type="date"]::-webkit-inner-spin-button,
input[type="date"]::-webkit-clear-button { display: none; }
input[type="date"] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; cursor: pointer; }
html[data-theme="dark"] input[type="date"] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E"); }

.dp-popover {
  background: var(--bg-2);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 14px;
  min-width: 280px;
  font-family: inherit;
  animation: ddIn .15s ease;
  user-select: none;
}
.dp-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; gap: 8px;
}
.dp-month-label {
  background: transparent; border: 0;
  color: var(--text); font-weight: 700; font-size: 14px;
  cursor: pointer; padding: 6px 10px; border-radius: 8px;
  font-family: inherit;
}
.dp-month-label:hover { background: var(--bg-3); }
.dp-nav { display: flex; gap: 4px; }
.dp-nav button {
  width: 30px; height: 30px; border-radius: 8px; border: 0;
  background: transparent; color: var(--text-2);
  cursor: pointer; font-size: 18px; font-weight: 700; line-height: 1;
  font-family: inherit;
  transition: all .12s ease;
}
.dp-nav button:hover { background: var(--bg-3); color: var(--text); }
.dp-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 6px;
}
.dp-weekdays > div {
  font-size: 10px; color: var(--text-3); text-align: center;
  font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 4px 0;
}
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-day {
  aspect-ratio: 1 / 1;
  border: 0; background: transparent;
  color: var(--text); cursor: pointer;
  border-radius: 9px; font-size: 13px; font-weight: 500;
  transition: all .1s ease;
  font-family: inherit;
  display: grid; place-items: center;
  min-height: 32px;
}
.dp-day:hover { background: var(--bg-3); }
.dp-day.dp-other { color: var(--text-3); opacity: 0.45; }
.dp-day.today { color: var(--accent); font-weight: 700; }
.dp-day.today::after {
  content: ''; display: block; width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent); margin-top: -2px;
}
.dp-day.selected {
  background: var(--accent); color: var(--accent-fg);
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(255,87,87,.35);
}
.dp-day.selected:hover { background: var(--accent-hover); }
.dp-day.selected.today::after { background: var(--accent-fg); }

.dp-months {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
}
.dp-mo {
  padding: 14px 8px; border: 0; background: transparent;
  border-radius: 9px; color: var(--text); font-weight: 600; font-size: 13px;
  cursor: pointer; font-family: inherit;
  transition: all .1s ease;
}
.dp-mo:hover { background: var(--bg-3); }
.dp-mo.selected {
  background: var(--accent); color: var(--accent-fg);
  box-shadow: 0 4px 12px rgba(255,87,87,.35);
}
.dp-mo.dp-other { color: var(--text-3); opacity: 0.45; }

.dp-foot {
  display: flex; justify-content: space-between; margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}
.dp-link {
  background: transparent; border: 0; color: var(--accent);
  font-size: 13px; font-weight: 600; cursor: pointer;
  padding: 4px 10px; border-radius: 6px; font-family: inherit;
}
.dp-link:hover { background: var(--accent-soft); }

/* Auftragsverlauf-Pipeline */
.auftrag-pipeline {
  display: flex; align-items: flex-start; gap: 8px;
  margin: 8px 0 4px; padding: 8px 0;
}
.auftrag-step {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center;
  text-align: center; min-width: 110px; max-width: 160px;
}
.step-circle {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bg-3); color: var(--text-3);
  font-weight: 700; font-size: 14px;
  margin-bottom: 8px;
  transition: all .2s ease;
}
/* abgeschlossen — Haken */
.auftrag-step.done .step-circle {
  background: var(--success); color: white;
  box-shadow: 0 4px 12px rgba(52,199,89,.3);
}
/* verloren — rotes X */
.auftrag-step.lost .step-circle {
  background: var(--danger); color: white;
  box-shadow: 0 4px 12px rgba(255,59,48,.3);
}
.auftrag-step.lost .step-label strong { color: var(--text-3); text-decoration: line-through; }
.auftrag-connector.lost { background: rgba(255,59,48,.18); }
/* im Fluss (versendet, angenommen) — blau, KEIN Haken, nur Nummer */
.auftrag-step.forward .step-circle {
  background: var(--info, #007aff); color: white;
  box-shadow: 0 4px 12px rgba(0,122,255,.3);
}
/* Entwurf vorhanden, aber nicht versendet — Akzent-rot */
.auftrag-step.progress .step-circle {
  background: var(--accent); color: white;
  box-shadow: 0 4px 12px rgba(255,87,87,.3);
}
.step-label { font-size: 13px; line-height: 1.4; }
.step-label strong { color: var(--text); font-weight: 600; }
.auftrag-step.pending .step-label strong { color: var(--text-3); }
.auftrag-connector {
  flex: 1; height: 2px; background: var(--bg-3);
  margin-top: 17px; min-width: 20px; border-radius: 1px;
}
.auftrag-connector.done { background: var(--success); }
@media (max-width: 720px) {
  .auftrag-pipeline { flex-direction: column; align-items: stretch; }
  .auftrag-step { flex-direction: row; gap: 12px; max-width: 100%; align-items: flex-start; text-align: left; }
  .step-circle { margin-bottom: 0; flex-shrink: 0; }
  .auftrag-connector { width: 2px; height: 20px; margin: 0 0 0 17px; }
}

/* Custom Status-Dropdown (öffnet sich bei Klick auf .status-inline) */
.status-dropdown {
  background: var(--bg-2);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  min-width: 160px;
  display: flex; flex-direction: column; gap: 2px;
  animation: ddIn .15s ease;
}
@keyframes ddIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.status-dropdown-item {
  display: block; width: 100%;
  padding: 7px 14px;
  border: 0;
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  cursor: pointer; text-align: left;
  font-family: inherit;
  transition: transform .1s ease;
}
.status-dropdown-item:hover { transform: translateX(2px); filter: brightness(.95); }
.status-dropdown-item.active { box-shadow: inset 0 0 0 2px currentColor; }

.status-dropdown-item.gray { background-color: #e8e8ed; color: #3a3a3c; }
.status-dropdown-item.blue { background-color: #d6e9ff; color: #0040a0; }
.status-dropdown-item.amber { background-color: #ffe9c2; color: #864200; }
.status-dropdown-item.violet { background-color: #ead8ff; color: #4a1e9e; }
.status-dropdown-item.emerald { background-color: #c5f5d4; color: #006927; }
.status-dropdown-item.rose { background-color: #ffd8d8; color: #a8001a; }
html[data-theme="dark"] .status-dropdown-item.gray { background-color: rgba(199,199,204,.16); color: #d1d1d6; }
html[data-theme="dark"] .status-dropdown-item.blue { background-color: rgba(10,132,255,.22); color: #7eb6ff; }
html[data-theme="dark"] .status-dropdown-item.amber { background-color: rgba(255,159,10,.22); color: #ffcd6e; }
html[data-theme="dark"] .status-dropdown-item.violet { background-color: rgba(191,90,242,.22); color: #d6a4ff; }
html[data-theme="dark"] .status-dropdown-item.emerald { background-color: rgba(48,209,88,.22); color: #6ee592; }
html[data-theme="dark"] .status-dropdown-item.rose { background-color: rgba(255,69,58,.22); color: #ff8a82; }

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
.text-accent { color: var(--accent); }
.bg-accent-soft { background: var(--accent-soft); }

/* ============== Flash & Toast ============== */
.flash {
  padding: 12px 16px; border-radius: 12px; margin-bottom: 16px;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
}
.flash-info { background: var(--info-bg); color: var(--info); }
.flash-success { background: var(--success-bg); color: var(--success); }
.flash-warning { background: var(--warning-bg); color: var(--warning); }
.flash-danger { background: var(--danger-bg); color: var(--danger); }

.toast-wrap { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  background: var(--bg-2); border-left: 4px solid var(--accent);
  padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow-lg);
  font-size: 14px; min-width: 240px; max-width: 400px; animation: toast-in .25s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
@keyframes toast-in { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ============== Modal ============== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  z-index: 100; display: grid; place-items: center; padding: 20px;
  animation: fade-in .15s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-2); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 720px; max-height: 90vh; display: flex; flex-direction: column;
  animation: slide-up .25s cubic-bezier(.16,1,.3,1);
}
@keyframes slide-up { from { transform: translateY(24px) scale(.98); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
.modal-head { padding: 20px 24px; border-bottom: 1px solid var(--border-soft); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-weight: 700; font-size: 18px; margin: 0; letter-spacing: -.01em; }
.modal-close { background: transparent; border: 0; color: var(--text-3); font-size: 26px; cursor: pointer; line-height: 1; padding: 0 6px; border-radius: 8px; }
.modal-close:hover { background: var(--bg-3); color: var(--text); }
.modal-body { padding: 24px; overflow-y: auto; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--border-soft); display: flex; justify-content: flex-end; gap: 8px; background: var(--bg); border-radius: 0 0 var(--radius) var(--radius); }
.modal-lg { max-width: 920px; }
.modal-sm { max-width: 440px; }

/* ============== Pipeline ============== */
.pipeline { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 12px; }
.pipe-col { background: var(--bg-3); border-radius: 14px; padding: 14px; min-height: 180px; }
.pipe-col h4 { margin: 0 0 12px; font-size: 12px; text-transform: uppercase; color: var(--text-3); display: flex; justify-content: space-between; letter-spacing: .06em; font-weight: 700; }
.pipe-card { background: var(--bg-2); border-radius: 10px; padding: 11px 12px; margin-bottom: 8px; font-size: 13px; cursor: pointer; box-shadow: var(--shadow-xs); transition: all .2s ease; }
.pipe-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.pipe-card .name { font-weight: 600; color: var(--text); }
.pipe-card .meta { color: var(--text-3); font-size: 12px; margin-top: 4px; }

/* ============== Login ============== */
/* ============== Login (Neu) ============== */
.login-shell {
  position: relative;
  width: 100%; max-width: 420px;
  display: flex; flex-direction: column; align-items: stretch;
  z-index: 1;
}
.login-glow {
  position: absolute; inset: -120px; z-index: 0;
  background: radial-gradient(ellipse 60% 50% at 50% 30%, rgba(255,87,87,.18), transparent 70%);
  pointer-events: none;
  animation: login-pulse 8s ease-in-out infinite;
}
@keyframes login-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}
.login-card { width: 100%; position: relative; z-index: 1; }
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand .brand-mark {
  width: 56px; height: 56px; font-size: 28px;
  margin: 0 auto 16px; border-radius: 16px;
  background: var(--accent); color: var(--accent-fg);
  display: grid; place-items: center; font-weight: 700;
  box-shadow: 0 12px 32px rgba(255,87,87,.45);
}
.login-logo {
  margin: 0 auto 16px;
  max-width: 200px; max-height: 80px;
  display: flex; align-items: center; justify-content: center;
}
.login-logo img { display: block; max-width: 100%; max-height: 80px; width: auto; height: auto; object-fit: contain; transition: filter .2s ease; }
html[data-theme="dark"] .login-logo-invert-dark img { filter: invert(1) hue-rotate(180deg) brightness(1.05); }
.login-brand h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.login-brand .login-sub { color: var(--text-3); margin: 8px 0 0; font-size: 13px; }
.login-form-card {
  padding: 28px !important;
  border-radius: 18px !important;
  background: var(--bg-2);
  box-shadow: var(--shadow-md);
}
.login-form-card .field { margin-bottom: 14px; }
.login-form-card .btn-block { padding: 12px 16px; font-weight: 600; }
.login-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 18px 0 14px;
  color: var(--text-3); font-size: 12px;
}
.login-divider::before, .login-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border-strong);
  opacity: 0.4;
}
.login-footer {
  text-align: center; margin-top: 24px;
  color: var(--text-3); font-size: 11px; letter-spacing: 0.04em;
}

/* ============== Notes Stream ============== */
.note-list { display: flex; flex-direction: column; gap: 10px; }
.note {
  border-radius: 10px; padding: 10px 12px;
  background: var(--bg-2);
  box-shadow: var(--shadow-xs);
}
.note.important { border-color: var(--warning); background: var(--warning-bg); }
html[data-theme="dark"] .note.important { background: rgba(245,158,11,.08); }
.note-meta { display: flex; gap: 8px; align-items: center; font-size: 11px; color: var(--text-3); margin-bottom: 4px; }
.note-actions { margin-left: auto; display: flex; gap: 4px; }
.note-actions button { background: transparent; border: 0; cursor: pointer; padding: 2px; color: var(--text-3); border-radius: 4px; }
.note-actions button:hover { color: var(--accent); }
.note-body { font-size: 14px; white-space: pre-wrap; }

/* ============== Activity Timeline ============== */
.timeline { display: flex; flex-direction: column; gap: 10px; }
.timeline-item { display: flex; gap: 10px; }
.timeline-dot { width: 28px; height: 28px; border-radius: 50%; background: var(--bg-3); color: var(--accent); display: grid; place-items: center; flex-shrink: 0; margin-top: 1px; }
.timeline-body { flex: 1; font-size: 13px; }
.timeline-body .when { color: var(--text-3); font-size: 11px; }

/* ============== Calc Sliders ============== */
.slider-row { display: grid; grid-template-columns: 1fr auto 80px; gap: 12px; align-items: center; padding: 8px 0; }
.slider-row label { font-size: 13px; color: var(--text-2); }
.slider-row input[type="range"] { accent-color: var(--accent); }
.slider-row .val { text-align: right; font-weight: 600; }
.calc-result { background: var(--bg-3); border-radius: 10px; padding: 16px; margin-top: 16px; }
.calc-result.warn { background: var(--danger-bg); border: 1px solid var(--danger); color: var(--danger); }

/* Document/Invoice Preview — Styles werden inline im beleg.php definiert */

/* ============== Tabs ============== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tabs button {
  background: transparent; border: 0; padding: 10px 14px; cursor: pointer;
  font-size: 14px; color: var(--text-2); font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============== Item Editor ============== */
.items-table { width: 100%; border-collapse: collapse; }
.items-table th { font-size: 12px; color: var(--text-3); text-align: left; font-weight: 600; padding: 4px 8px; text-transform: uppercase; letter-spacing: .04em; }
.items-table td { padding: 4px; }
.items-table input[type="text"], .items-table input[type="number"] { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-2); color: var(--text); font-size: 13px; font-family: inherit; }
.items-table .num { text-align: right; }
.items-table button.del { color: var(--danger); background: transparent; border: 0; cursor: pointer; padding: 6px; border-radius: 6px; transition: background .12s ease; }
.items-table button.del:hover { background: var(--danger-bg); }
.items-table .row-actions { display: flex; gap: 2px; align-items: center; justify-content: center; }
.items-table button.dup { color: var(--text-3); background: transparent; border: 0; cursor: pointer; padding: 6px; border-radius: 6px; display: grid; place-items: center; transition: all .12s ease; }
.items-table button.dup:hover { background: var(--bg-3); color: var(--accent); }

/* ============== Misc ============== */
.tag { background: var(--bg-3); color: var(--text-2); padding: 2px 8px; border-radius: 999px; font-size: 11px; }
.warning-pill { background: var(--danger-bg); color: var(--danger); padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--danger); }
.warning-pill::before { content: '!'; width: 16px; height: 16px; border-radius: 50%; background: var(--danger); color: white; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.dropdown { position: relative; display: inline-block; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 4px); background: var(--bg-2); border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 200px; z-index: 60; display: none; padding: 6px; }
.dropdown-menu a, .dropdown-menu button { border-radius: 8px; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button { display: flex; gap: 8px; align-items: center; width: 100%; text-align: left; padding: 8px 14px; background: transparent; border: 0; color: var(--text); cursor: pointer; font-family: inherit; font-size: 14px; text-decoration: none; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--bg-3); }

.countdown { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }
.countdown.urgent { color: var(--danger); }
.countdown.warn { color: var(--warning); }
.countdown.ok { color: var(--text-2); }

/* ============== Responsive — iPad / iPhone / Touch-Geräte ============== */

/* iPad Landscape und kleiner (1100px abwärts) — Sidebar schmaler, Padding reduziert */
@media (max-width: 1100px) {
  :root { --sidebar-w: 220px; }
  .main { padding: 22px 24px 24px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  /* Detail-Layout (Sidebar 360px + Main) → schmalere Sidebar */
  .main > .grid[style*="360px 1fr"] { grid-template-columns: 300px 1fr !important; }
  .main > .grid[style*="1fr 320px"] { grid-template-columns: 1fr 280px !important; }
}

/* iPad Portrait + kleiner (900px) — Sidebar wird ausklappbar */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; --topbar-h: 56px; --layout-gap: 8px; }
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
    top: 0; left: 0; bottom: 0;
    border-radius: 0;
    border: 0;
    box-shadow: 0 8px 32px rgba(0,0,0,.25);
  }
  .sidebar.open { transform: translateX(0); }
  /* Backdrop hinter offener Sidebar */
  body.sidebar-open::after {
    content: ''; position: fixed; inset: 0;
    background: rgba(0,0,0,.4); z-index: 25;
    animation: backdrop-in .2s ease;
  }
  @keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
  .topbar { left: 0; right: 0; top: 0; padding: 0 14px; gap: 10px; border-radius: 0; border: 0; }
  .main { margin-left: 0; margin-right: 0; margin-top: var(--topbar-h); padding: 16px; }
  .sidebar-toggle { display: grid; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .pipeline { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: stretch; gap: 12px; }
  .doc-print { padding: 20px; }
  /* Detail-Layouts vollständig stacken */
  .main > .grid[style*="360px 1fr"],
  .main > .grid[style*="1fr 320px"],
  .main > .grid[style*="300px 1fr"],
  .main > .grid[style*="1fr 280px"] {
    grid-template-columns: 1fr !important;
  }
  /* Calculator-Layouts */
  .main .grid[style*="minmax(0, 1fr) minmax(0, 1.2fr)"],
  .main .grid[style*="minmax(0, 1.6fr) minmax(280px, 1fr)"] {
    grid-template-columns: 1fr !important;
  }
  /* Page-header Action-Bar */
  .page-actions { flex-wrap: wrap; gap: 6px; }
  .page-actions .btn { font-size: 13px; padding: 8px 12px; }
  /* Cards weniger Padding */
  .card { padding: 16px; border-radius: 14px; }
  /* Stat-Werte etwas kleiner */
  .stat-value { font-size: 22px; }
  /* Filter-Form auf Mobile stapeln */
  .filter-form { flex-direction: column; align-items: stretch; }
  .filter-form .input { max-width: none !important; }
}

/* iPhone — Aggressives Mobile-Layout */
@media (max-width: 600px) {
  .main { padding: 12px 12px 24px; }
  .topbar { padding: 0 10px; gap: 8px; }
  .topbar-actions .icon-btn { width: 36px; height: 36px; }
  .search-wrap input { font-size: 16px; }   /* verhindert iOS-Zoom beim Fokus */
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .page-title { font-size: 22px; }
  .card-title { font-size: 14px; }
  .card { padding: 14px; }
  /* Tabellen: horizontal scrollen statt brechen */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -14px; padding: 0 14px; }
  .table { min-width: 540px; font-size: 13px; }
  .table th, .table td { padding: 8px 10px; }
  /* Modals: fast-Vollbild */
  .modal-backdrop { padding: 0; align-items: flex-start; }
  .modal, .modal-lg, .modal-sm {
    max-width: 100%; width: 100%; max-height: 100vh;
    border-radius: 0;
  }
  .modal-head { padding: 14px 16px; }
  .modal-body { padding: 14px 16px; }
  .modal-foot { padding: 12px 16px; }
  /* Form-Inputs: 16px gegen iOS-Zoom */
  .input, .textarea, .select { font-size: 16px; }
  /* Stat-Karten kompakt */
  .stat { padding: 14px; }
  .stat-value { font-size: 20px; }
  .stat-label { font-size: 11px; }
  /* Sidebar-Footer kompakter */
  .sidebar-user-name { font-size: 13px; }
  .sidebar-user-email { font-size: 11px; }
  /* Drop-Zone immer kompakt halten */
  .drop-zone { padding: 8px 12px; }
  body.dragging-files .drop-zone { padding: 16px 12px; }
  /* Pipeline (Auftragsverlauf) vertikal */
  .auftrag-pipeline { gap: 0; }
  /* Page-header: Buttons in zwei Spalten */
  .page-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .page-actions > .btn-danger { grid-column: 1 / -1; }
  .page-actions > .dropdown { grid-column: 1 / -1; }
  .page-actions > form { display: contents; }
  /* Quick-Actions im Modal */
  .form-actions { flex-direction: column-reverse; gap: 8px; }
  .form-actions .btn { width: 100%; }
}

/* Kleine iPhones (SE, etc.) */
@media (max-width: 380px) {
  .main { padding: 10px 10px 20px; }
  .grid-4 { grid-template-columns: 1fr; }
  .topbar-actions { gap: 4px; }
  .icon-btn { width: 34px; height: 34px; }
  .page-title { font-size: 19px; }
  .stat-value { font-size: 18px; }
}

/* Touch-spezifische Anpassungen — größere Hit-Targets */
@media (hover: none) and (pointer: coarse) {
  /* Hover-only Actions immer sichtbar machen (würden sonst nie aktivierbar sein) */
  .tp-actions, .fixed-cost-row .fc-actions, .tp-add-bar { opacity: 1 !important; display: flex !important; }
  .tp-row .tp-actions { display: flex !important; }
  /* Buttons & Links: min 44px Touch-Target (Apple HIG) */
  .btn-sm { min-height: 40px; padding: 8px 14px; }
  .btn { min-height: 44px; }
  .icon-btn { min-width: 44px; min-height: 44px; }
  .nav a { padding: 12px 14px; }
  .filter-chip { padding: 8px 14px; min-height: 36px; }
  /* Tap-Highlight bei Tabellen-Zeilen entfernen */
  tr[data-href] { -webkit-tap-highlight-color: rgba(255,87,87,.1); }
}

@media print {
  .no-print { display: none !important; }
}

@media print {
  .no-print { display: none !important; }
}

/* ---- Drop-Zone für Anhänge ---- */
/* Default: kompakter Button-artiger Streifen (eine Zeile, klein) */
.drop-zone {
  position: relative;
  border: 1.5px dashed var(--border-strong);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, padding .25s ease, transform .15s ease, box-shadow .15s ease;
  background: var(--bg-2);
  outline: none;
  overflow: hidden;
}
.drop-zone:hover { border-color: var(--accent); background: var(--bg-3); }
.drop-zone:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,87,87,0.18); }

/* Kinder fangen keine Maus-/Drag-Events ab */
.drop-zone *:not(input) { pointer-events: none !important; }

/* Inneres Layout: standardmäßig kompakt in einer Zeile (Icon + Text nebeneinander) */
.drop-zone .drop-zone-inner {
  display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 10px;
  transition: gap .2s ease;
}
.drop-zone .drop-zone-icon {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-3); color: var(--text-2);
  font-size: 13px; font-weight: 700;
  border: 1px solid var(--border-strong);
  transition: all .2s ease;
}
.drop-zone .drop-zone-text { font-size: 12px; color: var(--text-2); line-height: 1.3; }
.drop-zone .drop-zone-text strong { font-weight: 600; color: var(--text); }
.drop-zone .drop-zone-text br + span { display: none; }  /* zweite Zeile im Compact-Mode ausblenden */

/* === Ausgeklappte Variante: nur sichtbar, wenn ein Drag aktiv ist === */
body.dragging-files .drop-zone {
  padding: 22px 16px;
  border-width: 2px;
  border-color: var(--accent);
  background: rgba(255,87,87,0.04);
}
body.dragging-files .drop-zone .drop-zone-inner {
  flex-direction: column; gap: 8px;
}
body.dragging-files .drop-zone .drop-zone-icon {
  width: 36px; height: 36px; font-size: 18px;
  background: var(--accent); color: white; border-color: var(--accent);
}
body.dragging-files .drop-zone .drop-zone-text { font-size: 13px; color: var(--text); }
body.dragging-files .drop-zone .drop-zone-text br + span { display: inline; }

/* Drop-Zielzone (Maus direkt darüber): noch deutlicher */
.drop-zone.drag-over {
  border-style: solid;
  background: rgba(255,87,87,0.14) !important;
  box-shadow: 0 0 0 4px rgba(255,87,87,0.18);
  transform: scale(1.02);
}

/* ---- Fixkosten-Manager im Kalkulator ---- */
.fixed-costs-list { display: flex; flex-direction: column; gap: 6px; }
.fixed-cost-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  transition: background .15s ease;
}
.fixed-cost-row:hover { background: var(--bg-3); }
.fixed-cost-row .fc-main { min-width: 0; }
.fixed-cost-row .fc-label { font-weight: 600; font-size: 13px; color: var(--text); }
.fixed-cost-row .fc-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; display: flex; align-items: center; gap: 4px; }
.fixed-cost-row .fc-amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fixed-cost-row .fc-actions { display: flex; gap: 2px; }
.fixed-cost-row .fc-actions .btn-ghost { background: transparent; border: 0; padding: 4px 8px; cursor: pointer; color: var(--text-muted); font-size: 14px; border-radius: 4px; }
.fixed-cost-row .fc-actions .btn-ghost:hover { background: var(--bg-3); color: var(--text); }

/* ---- Filter-Chips (anhakbar) ---- */
.filter-form {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  padding: 4px 0;
}
.filter-group {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}
.filter-label {
  font-size: 12px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px; font-weight: 500;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  transition: all .12s ease;
}
.filter-chip input { display: none; }
.filter-chip:hover { background: var(--bg-3); border-color: var(--border-strong, var(--border)); }
.filter-chip.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg, #fff);
}
.filter-chip.on::before {
  content: '✓';
  font-weight: 700;
  margin-right: -2px;
}

/* ---- Sidebar-Footer (Profil + Logout) ---- */
.sidebar {
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}
.sidebar .nav { flex: 1 1 auto; }
.sidebar-footer {
  flex-shrink: 0;
  margin: 14px -14px 0;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-2);
}
.sidebar-user {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
  transition: background .15s ease;
}
.sidebar-user:hover { background: var(--bg-3); text-decoration: none; }
.sidebar-user-avatar {
  flex: 0 0 36px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: var(--accent-fg);
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px;
  overflow: hidden;
  box-shadow: 0 3px 8px rgba(255,87,87,.28);
}
.sidebar-user-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sidebar-user-info {
  display: flex; flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}
.sidebar-user-name {
  font-weight: 600; font-size: 13px;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-email {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-logout {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  color: var(--text-2);
  background: transparent;
  transition: all .15s ease;
}
.sidebar-logout:hover {
  background: var(--danger-bg);
  color: var(--danger);
  text-decoration: none;
}

/* ---- Warning-Button für Zahlungserinnerungen ---- */
.btn-warning {
  background: var(--warning, #ff9500);
  color: #fff;
  border: 0;
}
.btn-warning:hover { filter: brightness(0.92); }

/* ============== Notion-style Notes ============== */
.np-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; gap: 12px; flex-wrap: wrap;
}
.np-cheatsheet {
  font-family: var(--font);
  font-size: 11px;
  background: var(--bg-3);
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}
.np-list { display: flex; flex-direction: column; gap: 10px; }
.np-new-slot:not(:empty) { margin-bottom: 10px; }

.np-note {
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 12px 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.np-note:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.np-note.important { border-left: 3px solid var(--accent); background: linear-gradient(to right, var(--accent-soft) 0, var(--bg-2) 24px); }
.np-note.editing { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,87,87,.12); }

.np-note-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 4px;
}
.np-note-time { font-size: 11px; color: var(--text-3); }
.np-note-actions { display: flex; gap: 2px; }
.np-note-actions button {
  background: transparent; border: 0; padding: 4px 8px;
  cursor: pointer; color: var(--text-3); font-size: 14px;
  border-radius: 4px; line-height: 1;
}
.np-note-actions button:hover { background: var(--bg-3); color: var(--text); }
.np-note-actions button[data-act=del]:hover { color: var(--danger); }
.np-note-actions button[data-act=toggle]:hover { color: var(--accent); }

.np-note-title {
  font-size: 16px; font-weight: 700; color: var(--text);
  margin: 4px 0 6px; line-height: 1.3;
}
.np-note-body {
  font-size: 14px; line-height: 1.55; color: var(--text);
  word-break: break-word;
}
.np-note-body h1 { font-size: 20px; font-weight: 700; margin: 12px 0 6px; }
.np-note-body h2 { font-size: 17px; font-weight: 700; margin: 10px 0 5px; }
.np-note-body h3 { font-size: 15px; font-weight: 700; margin: 8px 0 4px; color: var(--text); }
.np-note-body h4, .np-note-body h5, .np-note-body h6 { font-size: 13px; font-weight: 700; margin: 6px 0 3px; color: var(--text-2); }
.np-note-body p { margin: 6px 0; }
.np-note-body ul, .np-note-body ol { margin: 6px 0; padding-left: 22px; }
.np-note-body li { margin: 2px 0; }
.np-note-body code {
  background: var(--bg-3); padding: 2px 6px; border-radius: 4px;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 12.5px;
}
.np-note-body pre {
  background: var(--bg-3); padding: 10px 12px; border-radius: 6px;
  overflow-x: auto; margin: 8px 0;
}
.np-note-body pre code { background: transparent; padding: 0; font-size: 12.5px; }
.np-note-body hr { border: 0; border-top: 1px solid var(--border-strong); margin: 12px 0; }
.np-note-body a { color: var(--accent); }

/* Markdown TODO-checkboxen */
.np-note-body .md-todo {
  display: flex; align-items: flex-start; gap: 8px; margin: 3px 0;
}
.np-note-body .md-todo.done span:last-child { text-decoration: line-through; color: var(--text-3); }
.np-note-body .md-check {
  width: 16px; height: 16px; border: 1.5px solid var(--border-strong);
  border-radius: 4px; display: inline-grid; place-items: center;
  flex-shrink: 0; margin-top: 2px;
  font-size: 12px; line-height: 1;
}
.np-note-body .md-check-done { background: var(--success); color: #fff; border-color: var(--success); }

/* Edit-Mode */
.np-input-title {
  width: 100%; border: 0; outline: 0; background: transparent;
  font-size: 16px; font-weight: 700; color: var(--text); font-family: inherit;
  padding: 4px 0; margin-bottom: 6px;
}
.np-input-body {
  width: 100%; border: 0; outline: 0; background: transparent;
  font-family: inherit; font-size: 14px; line-height: 1.55; color: var(--text);
  resize: vertical; min-height: 120px; padding: 0;
}
.np-edit-bar {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-soft);
}

/* Quick-Input für Notizen (immer sichtbar, expandiert beim Fokus) */
.np-quick {
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.np-quick:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,87,87,.12); }
.np-quick .np-quick-title {
  width: 100%; border: 0; outline: 0; background: transparent;
  font-family: inherit; font-size: 14px; font-weight: 600;
  color: var(--text); padding: 6px 0;
}
.np-quick .np-quick-body {
  width: 100%; border: 0; outline: 0; background: transparent;
  font-family: inherit; font-size: 13.5px; color: var(--text);
  resize: vertical; padding: 0;
  min-height: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height .2s ease, padding .2s ease;
}
.np-quick[data-state="expanded"] .np-quick-body {
  min-height: 72px;
  max-height: 400px;
  padding: 4px 0;
}
.np-quick .np-quick-bar {
  display: none;
  justify-content: space-between; align-items: center;
  margin-top: 6px; padding-top: 6px;
  border-top: 1px solid var(--border-soft);
}
.np-quick[data-state="expanded"] .np-quick-bar { display: flex; }

/* ============== Tasks Panel (Notion-style, mit Sub-Aufgaben + Verbindungslinien) ============== */
.tp-root { position: relative; }
.tp-empty {
  font-size: 12px; color: var(--text-3);
  padding: 10px 6px; text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: 8px; margin-bottom: 8px;
}
.tp-task {
  position: relative;
  padding: 2px 0;
}
.tp-children {
  margin-left: 16px;
  padding-left: 14px;
  position: relative;
}
/* Vertikale Linie für Sub-Aufgaben */
/* Vertikale Linie pro Kind-Task statt einer durchgehenden im Container.
   So endet die Linie automatisch beim letzten Kind und ragt nicht ins Leere. */
.tp-children > .tp-task { position: relative; }
.tp-children > .tp-task::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 0;
  width: 2px;
  background: var(--border-strong);
  bottom: 0;
}
/* Letztes Kind: Linie endet bei der Mitte der Row (wo der horizontale Connector ansetzt) */
.tp-children > .tp-task:last-child::before {
  bottom: auto;
  height: 18px;
}
.tp-row {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background .1s ease;
  position: relative;
}
.tp-row::before {
  content: '';
  position: absolute;
  left: -14px; top: 50%;
  width: 12px; height: 2px;
  background: var(--border-strong);
  border-radius: 2px;
  opacity: 0;
}
.tp-children .tp-task > .tp-row::before { opacity: 1; }
.tp-row:hover { background: var(--bg-3); }
.tp-bullet {
  flex-shrink: 0;
  display: grid; place-items: center;
  width: 18px; height: 18px;
}
.tp-check {
  appearance: none;
  width: 16px; height: 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  cursor: pointer;
  display: grid; place-items: center;
  background: transparent;
}
.tp-check:checked {
  background: var(--success);
  border-color: var(--success);
}
.tp-check:checked::after {
  content: '✓'; color: white; font-size: 11px; font-weight: 700; line-height: 1;
}
.tp-check-new {
  display: inline-block;
  width: 16px; height: 16px;
  border: 1.5px dashed var(--border-strong);
  border-radius: 4px;
  opacity: 0.5;
}
.tp-title {
  flex: 1 1 auto;
  font-size: 14px; line-height: 1.4;
  color: var(--text);
  outline: 0;
  padding: 2px 4px;
  border-radius: 4px;
  min-width: 0;
  word-break: break-word;
}
.tp-title:focus { background: var(--bg-2); box-shadow: 0 0 0 2px var(--accent-soft); }
.tp-task.done .tp-title { text-decoration: line-through; color: var(--text-3); }
.tp-actions {
  display: none; flex-shrink: 0; gap: 2px;
}
.tp-row:hover .tp-actions { display: flex; }
.tp-actions button {
  background: transparent; border: 0; padding: 2px 6px;
  font-size: 11px; cursor: pointer; color: var(--text-3);
  border-radius: 4px;
}
.tp-add-sub { font-weight: 500; }
.tp-add-sub:hover { background: var(--accent-soft); color: var(--accent); }
.tp-done { font-size: 13px; line-height: 1; }
.tp-done:hover { color: var(--success); background: var(--success-bg, rgba(34, 197, 94, 0.1)); }
.tp-task.done .tp-done { color: var(--success); }
.tp-del { font-size: 14px; line-height: 1; }
.tp-del:hover { color: var(--danger); background: var(--danger-bg); }
/* Strike-through bei erledigten Aufgaben (da der Haken weg ist) */
.tp-task.done > .tp-row > .tp-title {
  text-decoration: line-through;
  opacity: 0.55;
}

.tp-new .tp-input {
  flex: 1 1 auto;
  background: transparent; border: 0; outline: 0;
  font-family: inherit; font-size: 14px; color: var(--text);
  padding: 2px 4px;
}
.tp-new .tp-row { background: var(--bg-3); }
.tp-new .tp-row::before { opacity: 1; background: var(--accent); }

/* Add-Bar IMMER sichtbar — kein Hover-Trick mehr (war auf Touch unsichtbar und Klick funktionierte nicht) */
.tp-add-bar {
  margin-top: 6px;
  opacity: 1;
}
.tp-add-bar[data-active="0"] { display: none; }
.tp-add-root {
  display: block;
  width: 100%;
  background: var(--bg-3);
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: inherit; font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  text-align: left;
  transition: all .12s ease;
}
.tp-add-root:hover, .tp-add-root:focus {
  border-color: var(--accent);
  border-style: solid;
  color: var(--accent);
  background: var(--accent-soft);
  outline: 0;
}

/* ============== Collapsible Cards ============== */
/* Toggle-Pfeil per CSS ::before — keine DOM-Manipulation, kein Layout-Bruch */
.card.collapsible > .card-title {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-left: 22px;
}
.card.collapsible > .card-title::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  width: 14px; height: 14px;
  transform: translateY(-50%);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2386868b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='4 6 8 10 12 6'/></svg>");
  background-repeat: no-repeat; background-position: center;
  transition: transform .2s ease;
}
.card.collapsible.collapsed > .card-title::before {
  transform: translateY(-50%) rotate(-90deg);
}
/* Im eingeklappten Zustand alle direkten Kinder außer dem Title komplett ausblenden */
.card.collapsible.collapsed > :not(.card-title) {
  display: none !important;
}
.card.collapsible.collapsed > .card-title {
  margin-bottom: 0;
}

/* ============== Finance Dashboard ============== */
.fin-card { padding: 22px; }
.fin-card-title { font-size: 14px; font-weight: 600; color: var(--text-2); }
.fin-card-big { font-size: 28px; font-weight: 700; color: var(--text); letter-spacing: -.01em; line-height: 1.1; margin-top: 4px; }
.fin-legend { display: flex; align-items: center; font-size: 11px; color: var(--text-2); }
.fin-legend .dot { width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; display: inline-block; }
.fin-list { display: flex; flex-direction: column; gap: 4px; }
.fin-list-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px; font-size: 14px; color: var(--text); }
.fin-list-row strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.fin-pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 22px; padding: 0 8px;
  border-radius: 999px; font-size: 12px; font-weight: 700;
}
.fin-pill.rose { background: rgba(255,87,87,.12); color: var(--danger); }
.fin-pill.amber { background: rgba(255,149,0,.15); color: var(--warning); }
.fin-cta {
  display: inline-block; font-size: 13px; font-weight: 600;
  color: var(--accent); text-decoration: none;
}
.fin-cta:hover { text-decoration: underline; }
.fin-legend-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; padding: 4px 0; min-width: 0;
}
.fin-legend-row .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.fin-legend-row a { color: var(--text); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fin-legend-row a:hover { color: var(--accent); }

@media (max-width: 900px) {
  .grid[style*="repeat(2, minmax(0,1fr))"] { grid-template-columns: 1fr !important; }
}

/* ============== Finance KPI Strip ============== */
.fin-kpi {
  background: var(--bg-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
  border-left: 3px solid transparent;
  transition: box-shadow .2s ease;
}
.fin-kpi:hover { box-shadow: var(--shadow); }
.fin-kpi.good { border-left-color: var(--success); }
.fin-kpi.warn { border-left-color: var(--warning); }
.fin-kpi.bad  { border-left-color: var(--danger); }
.fin-kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; color: var(--text-3); }
.fin-kpi-value { font-size: 24px; font-weight: 700; color: var(--text); letter-spacing: -.02em; margin: 4px 0 2px; line-height: 1.1; }
.fin-kpi-sub { font-size: 12px; color: var(--text-3); }

@media (max-width: 900px) {
  .grid[style*="repeat(4, minmax(0,1fr))"] { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 540px) {
  .grid[style*="repeat(4, minmax(0,1fr))"] { grid-template-columns: 1fr !important; }
}

/* ============== Finance Compact Mode ============== */
/* alles auf der Finanzseite enger gepackt, damit mehr aufs Bild passt */
body[data-page="finance"] .main { padding-top: 16px; padding-bottom: 40px; }
body[data-page="finance"] .page-header { margin-bottom: 12px; }
body[data-page="finance"] .page-title { font-size: 22px; }
body[data-page="finance"] .page-sub { font-size: 12px; }

body[data-page="finance"] .mb-24 { margin-bottom: 14px; }
body[data-page="finance"] .mb-12 { margin-bottom: 10px; }
body[data-page="finance"] .mt-24 { margin-top: 14px; }
body[data-page="finance"] .mt-12 { margin-top: 10px; }

body[data-page="finance"] .fin-card { padding: 16px 18px; }
body[data-page="finance"] .fin-card-title { font-size: 13px; }
body[data-page="finance"] .fin-card-big { font-size: 22px; margin-top: 2px; }
body[data-page="finance"] .fin-list-row { font-size: 13px; padding: 4px 2px; gap: 8px; }
body[data-page="finance"] .fin-pill { min-width: 22px; height: 20px; font-size: 11px; padding: 0 6px; }
body[data-page="finance"] .fin-cta { font-size: 12px; }
body[data-page="finance"] .fin-legend, body[data-page="finance"] .fin-legend-row { font-size: 12px; }
body[data-page="finance"] .fin-legend-row { padding: 2px 0; }

body[data-page="finance"] .fin-kpi { padding: 12px 14px; }
body[data-page="finance"] .fin-kpi-label { font-size: 10px; }
body[data-page="finance"] .fin-kpi-value { font-size: 20px; margin: 2px 0 1px; }
body[data-page="finance"] .fin-kpi-sub { font-size: 11px; }

body[data-page="finance"] .card-title { font-size: 13px; margin-bottom: 8px; }
body[data-page="finance"] .card { padding: 16px 18px; }
body[data-page="finance"] .table { font-size: 12.5px; }
body[data-page="finance"] .table th, body[data-page="finance"] .table td { padding: 6px 8px; }
body[data-page="finance"] canvas { max-height: 200px; }

/* KPI-Strip mit kleinerem Gap */
body[data-page="finance"] .grid[style*="repeat(4"] { gap: 10px !important; }
body[data-page="finance"] .grid[style*="repeat(2"] { gap: 12px !important; }

/* ============== Notifications-Panel ============== */
.notif-wrap { position: relative; }
.notif-btn { position: relative; }
.notif-badge {
  position: absolute; top: -2px; right: -2px;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--danger); color: white;
  border-radius: 9px;
  font-size: 11px; font-weight: 700;
  place-items: center;
  border: 2px solid var(--bg); box-sizing: content-box;
  line-height: 1;
}
/* Standardmäßig versteckt — sichtbar nur über .show-Klasse */
.notif-badge { display: none; }
.notif-badge.show { display: grid; }
.notif-panel {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 380px; max-height: 480px;
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.notif-panel[hidden] { display: none !important; }
.notif-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid var(--border-soft);
  font-size: 14px;
}
.notif-clear {
  background: transparent; border: 0; cursor: pointer;
  color: var(--accent); font-size: 12px; font-weight: 600;
}
.notif-clear:hover { text-decoration: underline; }
.notif-close-btn {
  background: transparent; border: 0; cursor: pointer;
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--text-3); font-size: 20px; line-height: 1;
  padding: 0; font-weight: 300;
}
.notif-close-btn:hover { background: var(--bg-3); color: var(--text); }
.notif-list { overflow-y: auto; flex: 1; }
.notif-empty {
  padding: 24px 14px; text-align: center;
  color: var(--text-3); font-size: 13px;
}
.notif-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  text-decoration: none; color: inherit;
  position: relative;
  transition: background-color .15s ease;
}
.notif-item:hover { background: var(--bg-3); text-decoration: none; }
.notif-item.read { opacity: 0.55; }
.notif-icon {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 14px;
  background: var(--bg-3); color: var(--text-2);
}
.notif-item.sev-danger .notif-icon { background: rgba(255,87,87,.18); color: var(--danger); }
.notif-item.sev-warning .notif-icon { background: rgba(255,184,0,.18); color: #c47a00; }
.notif-item.sev-info .notif-icon { background: rgba(99,102,241,.18); color: #6366f1; }
.notif-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notif-title { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.3; }
.notif-sub { font-size: 12px; color: var(--text-3); line-height: 1.3; }
.notif-time { flex-shrink: 0; font-size: 11px; color: var(--text-3); white-space: nowrap; }
.notif-dismiss {
  position: absolute; top: 6px; right: 6px;
  background: transparent; border: 0; cursor: pointer;
  color: var(--text-3); font-size: 18px; line-height: 1;
  width: 20px; height: 20px; border-radius: 4px;
  padding: 0;
  opacity: 0;
  transition: opacity .15s ease;
}
.notif-item:hover .notif-dismiss { opacity: 1; }
.notif-dismiss:hover { background: var(--bg-3); color: var(--danger); }
@media (max-width: 700px) {
  .notif-panel { width: calc(100vw - 28px); right: -8px; }
}

/* ============== Sortable Tables (Excel-Stil) ============== */
.th-sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 22px !important;
  transition: background-color .15s ease;
}
.th-sortable:hover { background: var(--bg-3); }
.th-sortable .th-sort-ind {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  display: inline-flex; align-items: center;
  width: 10px; height: 14px;
  color: var(--text-3);
  opacity: .4;
  transition: opacity .15s ease, color .15s ease;
  pointer-events: none;
}
.th-sortable:hover .th-sort-ind { opacity: .8; }
.th-sortable.sort-asc .th-sort-ind,
.th-sortable.sort-desc .th-sort-ind {
  opacity: 1; color: var(--accent);
}
.th-sortable.sort-asc .th-sort-ind .down,
.th-sortable.sort-desc .th-sort-ind .up { opacity: .2; }

/* ============== Dashboard Redesign (Intelly-Style) ============== */
/* Begrüßungs-Block — jetzt in der Hauptspalte, kein border-bottom */
.dash-greeting {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
  padding: 4px 4px 8px;
  margin-bottom: 4px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.dash-greeting-main { min-width: 0; }
.dash-greeting-title {
  font-size: 22px; font-weight: 800; margin: 0 0 4px;
  letter-spacing: -.01em; color: var(--text);
  display: inline-flex; align-items: center; gap: 8px;
}
.dash-greeting-emoji { font-size: 22px; }
.dash-greeting-date { color: var(--text-3); font-size: 13px; margin-top: 4px; }
.dash-greeting-summary {
  margin: 8px 0 0;
  color: var(--text-2); font-size: 14px;
  line-height: 1.55;
  max-width: 760px;
}
.dash-greeting-brief {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 13.5px; color: var(--text-2);
  text-align: right; flex-shrink: 0;
}
.dash-greeting-brief a { color: var(--accent); font-weight: 600; }
.dash-greeting-brief a:hover { text-decoration: underline; }
@media (max-width: 700px) {
  .dash-greeting-brief { text-align: left; width: 100%; }
}

.dash-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 28px;
}
.dash-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.dash-aside {
  display: flex; flex-direction: column; gap: 18px;
  padding-left: 22px;
  border-left: 1px solid var(--border-soft);
}
.dash-day-panel-side {
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}
@media (max-width: 1100px) {
  .dash-layout { grid-template-columns: minmax(0, 1fr) 280px; gap: 22px; }
}
@media (max-width: 900px) {
  .dash-layout { grid-template-columns: 1fr; gap: 16px; }
  .dash-aside { padding-left: 0; border-left: 0; padding-top: 16px; border-top: 1px solid var(--border-soft); }
}

/* 2x2 Tile-Grid */
.dash-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 14px;
}
.dash-tile {
  display: block;
  background: var(--bg-2);
  border-radius: 18px;
  padding: 18px 20px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease;
  position: relative;
  overflow: hidden;
}
.dash-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; }
.dash-tile-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.dash-tile-label { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; }
.dash-tile-icon { font-size: 22px; opacity: 0.8; }
.dash-tile-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; color: var(--text); margin-bottom: 10px; line-height: 1.1; }
.dash-tile-sub { font-size: 12px; color: var(--text-3); }

/* Mini-Sparkbars */
.dash-sparkbars { display: flex; align-items: flex-end; gap: 4px; height: 42px; margin-bottom: 6px; }
.spark-bar { flex: 1; background: var(--accent-soft); border-radius: 3px 3px 0 0; min-height: 4px; transition: background .2s ease; }
.spark-bar.active { background: var(--accent); }
.dash-tile:hover .spark-bar { background: rgba(255,87,87,.45); }
.dash-tile:hover .spark-bar.active { background: var(--accent-hover); }

/* Mini-Meta Reihe (Umsatz / Kosten) */
.dash-tile-meta-row { display: flex; gap: 16px; font-size: 12px; }
.dash-tile-meta-row strong { font-variant-numeric: tabular-nums; }

/* Pipeline-Stage-Reihe in einer Tile */
.dash-tile-stage-row { display: flex; gap: 6px; flex-wrap: wrap; }
.dash-stage {
  display: flex; flex-direction: column; align-items: center;
  background: var(--bg-3);
  border-radius: 8px;
  padding: 6px 8px;
  flex: 1; min-width: 0;
  text-align: center;
}
.dash-stage-num { font-weight: 700; font-size: 14px; color: var(--text); }
.dash-stage-lbl { font-size: 10px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* === Voll-breiter Kalender-Wrapper (oben auf Dashboard, ohne Karten-Rahmen) === */
.dash-calendar-wrap {
  padding: 4px 4px 22px;
  margin-bottom: 18px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  border-bottom: 1px solid var(--border-soft);
}
/* Pipeline-Sektion: kein extra Kasten, nur Abstand + Titel */
.dash-pipeline { padding: 4px 4px 0; }
.dash-section-title { margin: 0; font-size: 16px; font-weight: 700; color: var(--text); }
/* Pipeline-Spalten bekommen den dezenten Karten-Look statt der ganzen Sektion */
.dash-pipeline .pipeline { gap: 12px; }
.dash-calendar-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
  gap: 28px;
  align-items: stretch;
}
.dash-cal-inner {
  min-width: 0;
}
.dash-day-panel {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-soft);
  padding-left: 22px;
  min-width: 0;
}
.dash-day-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 12px;
}
.dash-day-h {
  margin: 0; font-size: 16px; font-weight: 700; color: var(--text);
}
.dash-day-count {
  font-size: 12px; color: var(--text-3);
}
.dash-day-content {
  flex: 1;
  overflow-y: auto;
  max-height: 360px;
}
@media (max-width: 900px) {
  .dash-calendar-grid { grid-template-columns: 1fr; gap: 16px; }
  .dash-day-panel { border-left: 0; border-top: 1px solid var(--border-soft); padding-left: 0; padding-top: 16px; }
}

/* === Kalender-Widget v2 (Pille-Style) === */
.dash-cal-card { padding: 14px 16px; }
.dash-cal-head {
  display: grid; grid-template-columns: 24px 1fr 24px auto; align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.dash-cal-add {
  font-size: 12px;
  padding: 5px 10px;
}

/* ========== Custom Time-Picker (passend zum Kalender) ========== */
.tp-popup {
  width: 240px;
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,.4), 0 6px 14px rgba(0,0,0,.15);
  padding: 14px;
  font-family: var(--font);
}
.tp-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-bottom: 12px;
}
.tp-title { font-size: 15px; font-weight: 700; color: var(--text); }
.tp-display {
  font-size: 18px; font-weight: 700; color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.tp-body { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tp-col { display: flex; flex-direction: column; min-width: 0; }
.tp-col-label {
  font-size: 10px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .06em;
  text-align: center; padding: 4px 0;
}
.tp-col-scroll {
  height: 200px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
  padding: 2px;
  /* Scrollbars verstecken aber Scrollen erlauben */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.tp-col-scroll::-webkit-scrollbar { width: 0; height: 0; display: none; }
.tp-cell {
  border: 0; background: transparent;
  padding: 7px 0;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 14px; font-weight: 500;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: all .12s ease;
  font-family: inherit;
}
.tp-cell:hover { background: var(--bg-3); color: var(--text); }
.tp-cell.selected {
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(255,87,87,.3);
}
.tp-footer {
  display: flex; justify-content: space-between; align-items: center;
  gap: 4px;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}
.tp-foot-link {
  background: transparent; border: 0;
  color: var(--accent);
  font-size: 13px; font-weight: 600;
  cursor: pointer; padding: 4px 10px;
  border-radius: 6px;
  font-family: inherit;
  transition: background .12s ease;
}
.tp-foot-link:hover { background: var(--accent-soft); }
.tp-foot-ok { background: var(--accent); color: var(--accent-fg); }
.tp-foot-ok:hover { background: var(--accent-hover); }

/* ========== Kalender v3 — Native-Picker-Style (Monat links, Pfeile rechts, Footer) ========== */
.dash-cal-head-v3 {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 4px 12px;
}
.dash-cal-title-v3 {
  font-weight: 700; font-size: 15px; color: var(--text);
  letter-spacing: -.01em;
}
.dash-cal-nav-group {
  display: flex; align-items: center; gap: 4px;
}
.dash-cal-nav-v3 {
  width: 26px; height: 26px; border-radius: 6px;
  display: grid; place-items: center;
  color: var(--text-2);
  text-decoration: none;
  transition: all .12s ease;
}
.dash-cal-nav-v3:hover { background: var(--bg-3); color: var(--text); text-decoration: none; }

.dash-cal-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px; padding: 12px 4px 4px;
  border-top: 1px solid var(--border-soft);
}
.dash-cal-foot-link {
  background: transparent; border: 0;
  color: var(--accent);
  font-size: 13px; font-weight: 600;
  cursor: pointer; padding: 4px 8px;
  text-decoration: none;
  font-family: inherit;
  border-radius: 6px;
  transition: background .12s ease;
}
.dash-cal-foot-link:hover { background: var(--accent-soft); text-decoration: none; }

/* ========== Kalender v3 — modern, kompakt, ohne KW-Spalte ========== */
.dash-cal-head-v2 {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 0 0 12px;
}
.dash-cal-head-v2 .dash-cal-title {
  text-align: center;
  display: inline-flex; align-items: center;
  margin: 0 auto;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 600; font-size: 12.5px;
  letter-spacing: 0;
  box-shadow: 0 2px 8px rgba(255,87,87,.25);
}
.dash-cal-head-v2 .dash-cal-nav {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--text-2);
  text-decoration: none;
  transition: all .12s ease;
  flex-shrink: 0;
}
.dash-cal-head-v2 .dash-cal-nav:hover {
  background: var(--bg-3); color: var(--text); text-decoration: none;
}

/* Wochentag-Header */
.dash-cal-weekdays-v2 {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}
.dash-cal-weekdays-v2 > div {
  text-align: center;
  font-size: 10px;
  color: var(--text-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 4px 0;
}

/* Tage-Grid */
.dash-cal-grid-v2 {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.dash-cal-cell-v2 {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 50%;
  padding: 0;
  position: relative;
  transition: background-color .1s ease, color .1s ease, transform .1s ease;
  font-family: inherit;
}
.dash-cal-cell-v2:hover:not(.empty):not(.selected) {
  background: var(--bg-3);
  color: var(--text);
}
.dash-cal-cell-v2.empty {
  cursor: default;
  pointer-events: none;
}
.dash-cal-cell-v2.today {
  color: var(--accent);
  font-weight: 700;
}
.dash-cal-cell-v2.today::after {
  content: '';
  position: absolute;
  bottom: 3px; left: 50%;
  transform: translateX(-50%);
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--accent);
}
.dash-cal-cell-v2.selected {
  background: var(--accent) !important;
  color: var(--accent-fg) !important;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(255,87,87,.35);
}
.dash-cal-cell-v2 .dash-cal-dot {
  position: absolute;
  bottom: 3px; left: 50%;
  transform: translateX(-50%);
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--accent);
}
.dash-cal-cell-v2.selected .dash-cal-dot { background: var(--accent-fg); }

/* Termin-Button v3 — minimal, modern, Icon-only-Pille */
.dash-cal-add-btn-v3 {
  display: inline-flex !important;
  align-items: center; justify-content: center; gap: 6px;
  margin: 14px auto 0;
  padding: 7px 14px;
  background: var(--accent);
  color: var(--accent-fg);
  border: 0;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -.01em;
  cursor: pointer;
  transition: all .15s ease;
  box-shadow: 0 3px 10px rgba(255,87,87,.3);
  font-family: inherit;
  width: auto;
}
.dash-cal-add-btn-v3:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(255,87,87,.4);
}
.dash-cal-add-btn-v3 svg {
  width: 14px; height: 14px;
  stroke: var(--accent-fg);
}
.dash-cal-inner { text-align: center; }

/* Tabelle: 7 Tagsspalten + KW */
.dash-cal-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 2px 4px;
  table-layout: fixed;
}
.dash-cal-table thead th {
  font-size: 10px; font-weight: 600; color: var(--text-3);
  text-align: center; padding: 4px 0;
  text-transform: uppercase; letter-spacing: .06em;
}
.dash-cal-table thead .dash-cal-kw-h {
  font-size: 10px; color: var(--text-3); opacity: .7;
  padding-left: 8px;
}
.dash-cal-table tbody td {
  text-align: center; vertical-align: middle;
  padding: 0;
}
.dash-cal-table tbody .dash-cal-kw {
  font-size: 10px; color: var(--text-3); opacity: .6;
  font-weight: 600; padding-left: 8px;
  white-space: nowrap;
}
.dash-cal-table .dash-cal-cell {
  width: 36px; height: 36px;
  margin: 0 auto;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 0;
  font-size: 13px; font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  position: relative;
  transition: all .12s ease;
  padding: 0;
}
.dash-cal-table .dash-cal-cell:hover {
  background: var(--bg-3);
  color: var(--text);
}
.dash-cal-table .dash-cal-cell.empty {
  cursor: default;
  background: transparent;
}
.dash-cal-table .dash-cal-cell.today {
  color: var(--accent);
  font-weight: 700;
}
.dash-cal-table .dash-cal-cell.today::after {
  content: '';
  position: absolute;
  bottom: 3px; left: 50%;
  transform: translateX(-50%);
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--accent);
}
.dash-cal-table .dash-cal-cell.selected {
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 700;
  box-shadow: none;
}
.dash-cal-table .dash-cal-cell.selected .dash-cal-dot { background: var(--accent-fg); }
.dash-cal-table .dash-cal-cell .dash-cal-dot {
  position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: var(--accent);
}

/* Add-Event-Pille unten — kompakter, mit roter Bubble */
.dash-cal-add-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  margin: 12px auto 0; padding: 6px 14px 6px 6px;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  width: auto;
}
.dash-cal-add-btn:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: var(--bg-2);
}
.dash-cal-add-icon {
  font-size: 13px; line-height: 1;
  display: inline-grid; place-items: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(255,87,87,.3);
}
/* Container für zentrierten Button */
.dash-cal-inner { text-align: center; }
.dash-cal-table { text-align: left; }
.dash-cal-title { text-align: center; font-weight: 700; font-size: 14px; color: var(--text); }
.dash-cal-nav {
  width: 24px; height: 24px; border-radius: 6px;
  display: grid; place-items: center;
  color: var(--text-2);
  text-decoration: none; font-size: 16px;
  transition: all .15s ease;
}
.dash-cal-nav:hover { background: var(--bg-3); color: var(--accent); text-decoration: none; }
.dash-cal-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr);
  font-size: 10px; color: var(--text-3); font-weight: 600;
  text-align: center; padding: 6px 0 4px;
  text-transform: uppercase; letter-spacing: .05em;
}
.dash-cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.dash-cal-cell {
  aspect-ratio: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 8px;
  font-size: 12.5px; color: var(--text-2);
  text-decoration: none;
  cursor: pointer;
  transition: all .12s ease;
  position: relative;
  min-height: 32px;
}
.dash-cal-cell.empty { background: transparent; cursor: default; }
.dash-cal-cell:not(.empty):hover {
  background: var(--bg-3);
  color: var(--text);
  text-decoration: none;
}
.dash-cal-cell.today { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.dash-cal-cell.selected { background: var(--accent); color: var(--accent-fg); font-weight: 700; }
.dash-cal-cell.selected .dash-cal-dot { background: var(--accent-fg); }
.dash-cal-dot {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent);
  margin-top: 2px;
}

/* Tagesliste */
.dash-day-list { display: flex; flex-direction: column; gap: 6px; }
.dash-day-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--bg-3);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  transition: background .15s ease, transform .1s ease;
}
.dash-day-item:hover { background: var(--accent-soft); transform: translateX(2px); text-decoration: none; }
.dash-day-icon { font-size: 18px; flex-shrink: 0; }
.dash-day-body { flex: 1; min-width: 0; }
.dash-day-title { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-day-sub { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-day-time {
  font-size: 11px; color: var(--text-2); font-weight: 600;
  background: var(--bg-2); padding: 3px 8px; border-radius: 999px;
  flex-shrink: 0;
}

/* Day-Delete-Button */
.dash-day-item { position: relative; }
.dash-day-del {
  background: transparent; border: 0; cursor: pointer;
  color: var(--text-3); font-size: 16px; line-height: 1;
  width: 22px; height: 22px; border-radius: 4px; padding: 0;
  opacity: 0;
  transition: opacity .15s ease, background .15s ease, color .15s ease;
  flex-shrink: 0;
}
.dash-day-item:hover .dash-day-del { opacity: 1; }
.dash-day-del:hover { background: var(--bg-2); color: var(--danger); }

/* Kalender-Zellen in der wide-Variante: etwas größer + nicht quadratisch zwingen */
.dash-calendar-wrap .dash-cal-cell {
  aspect-ratio: auto;
  min-height: 44px;
  font-size: 13px;
}

/* Responsive */
@media (max-width: 900px) {
  .dash-tiles { grid-template-columns: 1fr; }
}

/* Tile-Charts */
.dash-tile-chart { height: 50px; margin: 8px 0 6px; }
.dash-tile-chart canvas { width: 100% !important; height: 100% !important; }
.dash-tile-doughnut-row { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.dash-tile-legend { flex: 1; font-size: 11.5px; line-height: 1.5; min-width: 0; }
.dash-tile-legend div { display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-tile-legend strong { margin-left: auto; font-variant-numeric: tabular-nums; }
.dash-tile-legend .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* (Alte Doppel-Definition für Floating-Layout entfernt — neue Regeln stehen oben am Anfang der Datei.) */

/* Kalender-Cell: jetzt als Button, keine Underline */
button.dash-cal-cell {
  background: none; border: 0; font-family: inherit; cursor: pointer; padding: 0;
}
button.dash-cal-cell:hover:not(.empty) { background: var(--bg-3); color: var(--text); }

/* ============== Bento Grid Dashboard (asymmetrisch) ============== */
/* Bento-Grid wurde rückgängig gemacht — Dashboard nutzt wieder das schlichte 2x2-Tile-Layout */
.dash-bento { display: none; }
.b-umsatz     { grid-area: umsatz; }
.b-gewinn     { grid-area: gewinn; }
.b-forderungen{ grid-area: forderg; }
.b-pipeline   { grid-area: pipeline; }
.b-aufgaben   { grid-area: aufgaben; }
.b-followups  { grid-area: followups; }

.bento-tile {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--bg-2);
  border-radius: 22px;
  padding: 18px 20px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform .25s cubic-bezier(.2,.8,.3,1), box-shadow .25s ease;
}
.bento-tile:hover {
  transform: translateY(-3px) rotate(-0.4deg);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.bento-tile:nth-child(2):hover { transform: translateY(-3px) rotate(0.3deg); }
.bento-tile:nth-child(4):hover { transform: translateY(-3px) rotate(-0.3deg); }

.bento-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.bento-label { font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; }
.bento-pill {
  font-size: 11px; font-weight: 600; color: var(--text-2);
  background: var(--bg-3); padding: 3px 10px; border-radius: 999px;
  white-space: nowrap;
}
.bento-big { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; color: var(--text); margin-top: 4px; }
.bento-meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--text-3); margin-top: 4px;
}
.bento-trend { font-size: 13px; }
.bento-trend.up { color: var(--success); }
.bento-trend.down { color: var(--danger); }
.bento-chart { height: 80px; margin-top: 10px; flex: 1; min-height: 0; }
.bento-chart-tall { height: 130px; }
.bento-chart canvas { width: 100% !important; height: 100% !important; }
.bento-icon {
  position: absolute; right: 16px; bottom: 14px;
  font-size: 24px; opacity: 0.5;
  transition: opacity .2s ease;
}
.bento-tile:hover .bento-icon { opacity: 1; }
.bento-icon-inline { font-size: 16px; opacity: 0.7; }

.bento-doughnut-wrap { display: flex; justify-content: center; padding: 8px 0; }
.bento-doughnut { position: relative; width: 110px; height: 110px; }
.bento-doughnut-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none; text-align: center;
}
.bento-legend {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11.5px; color: var(--text-2);
  margin-top: 6px;
}
.bento-legend span { display: flex; align-items: center; gap: 6px; }
.bento-legend strong { margin-left: auto; font-variant-numeric: tabular-nums; }
.bento-legend .dot { width: 8px; height: 8px; border-radius: 50%; }

/* Glow-Akzent links auf jeder Bento-Kachel */
.bento-tile::before {
  content: ''; position: absolute;
  top: 0; left: 0; width: 4px; height: 50%;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
  opacity: 0; transition: opacity .25s ease;
}
.bento-tile:hover::before { opacity: 1; }

/* Responsive */
@media (max-width: 1200px) {
  .dash-bento {
    grid-template-columns: repeat(4, 1fr);
    grid-template-areas:
      "umsatz   umsatz   gewinn   gewinn"
      "forderg  forderg  pipeline pipeline"
      "aufgaben aufgaben followups followups";
  }
}
@media (max-width: 700px) {
  .dash-bento {
    grid-template-columns: 1fr;
    grid-template-areas: "umsatz" "gewinn" "forderg" "pipeline" "aufgaben" "followups";
  }
}

/* Sidebar-Sektion-Labels (jetzt mit Etwas Padding + Linie) */
.nav-sep:first-child { padding-top: 4px; }

/* ════════════════════════════════════════════════════════════════════
   ENDE-OVERRIDE-BLOCK — höchste Priorität, überschreibt alles davor.
   Hier landen alle Regeln die der User explizit gefordert hat, damit
   sie garantiert NICHT von älteren Regeln im File überschrieben werden.
   ════════════════════════════════════════════════════════════════════ */

/* ---- Topbar-Icons rund (Glocke, Plus, Mond) ---- */
.topbar .icon-btn,
.topbar .notif-btn {
  width: 40px !important; height: 40px !important;
  border-radius: 50% !important;
  border: 1px solid var(--border-soft) !important;
  background: var(--bg-2) !important;
}
html[data-theme="dark"] .topbar .icon-btn,
html[data-theme="dark"] .topbar .notif-btn {
  background: rgba(255,255,255,.04) !important;
  border-color: rgba(255,255,255,.08) !important;
}

/* ---- Topbar selbst: kein Kasten ---- */
.topbar {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-radius: 0 !important;
}

/* ---- Suchleiste eingebettet, Lupe in rotem Kreis ---- */
.topbar .search-wrap {
  display: flex !important; align-items: center !important; gap: 10px !important;
}
.topbar .search-wrap > svg {
  width: 36px !important; height: 36px !important;
  padding: 9px !important;
  border-radius: 50% !important;
  background: var(--accent) !important;
  color: var(--accent-fg) !important;
  position: static !important;
  flex-shrink: 0 !important;
  box-shadow: 0 3px 10px rgba(255,87,87,.25) !important;
}
.topbar .search-wrap input {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 38px 0 4px !important;
}
.topbar .search-wrap input:focus {
  background: transparent !important;
  box-shadow: none !important;
}

/* ---- Sidebar Milchglas ---- */
.sidebar {
  background: rgba(255,255,255,.55) !important;
  backdrop-filter: saturate(180%) blur(24px) !important;
  -webkit-backdrop-filter: saturate(180%) blur(24px) !important;
  border: 1px solid rgba(255,255,255,.4) !important;
}
html[data-theme="dark"] .sidebar {
  background: rgba(26,26,28,.55) !important;
  border: 1px solid rgba(255,255,255,.08) !important;
}

/* ---- Kalender Monat in roter Pille ---- */
.dash-cal-head-v2 .dash-cal-title {
  display: inline-flex !important;
  margin: 0 auto !important;
  padding: 6px 16px !important;
  border-radius: 999px !important;
  background: var(--accent) !important;
  color: var(--accent-fg) !important;
  font-weight: 700 !important; font-size: 13px !important;
  font-size: 13px !important;
  box-shadow: 0 4px 12px rgba(255,87,87,.25) !important;
  text-align: center !important;
  letter-spacing: -.01em !important;
}

/* (Alter dash-cal-add-btn-Block entfernt — neue v3-Version oben.) */

/* ---- Notif-Badge: standardmäßig hart versteckt ---- */
.notif-badge { display: none !important; }
.notif-badge.show { display: grid !important; }
