/* ============================================================
   zentrale.css — Tobi Zentrale CRM
   Design: Lila Akzent, dark sidebar, clean white content
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --tl-purple:    #7c3aed;
  --tl-purple-dk: #6d28d9;
  --tl-green:     #0ea271;
  --tl-red:       #e02424;
  --tl-orange:    #d97706;
  --tl-blue:      #2563eb;

  --sidebar-bg:  #1e1b2e;
  --sidebar-w:   240px;
  --header-h:    56px;

  --text-primary:   #111827;
  --text-secondary: #6b7280;
  --text-light:     #9ca3af;
  --border:         #e5e7eb;
  --bg-light:       #f9fafb;
  --bg-white:       #ffffff;

  --radius:    8px;
  --shadow:    0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-light);
  line-height: 1.5;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
.admin-layout { display: flex; min-height: 100vh; }

.admin-sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  color: #e5e7eb;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
  flex-shrink: 0;
}

.admin-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Sidebar Logo ───────────────────────────────────────────────────────── */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand { font-size: 17px; font-weight: 700; color: #fff; letter-spacing: .5px; }
.sidebar-brand-sub { font-size: 11px; color: #7c7399; font-weight: 400; display: block; }

/* ── Sidebar User ───────────────────────────────────────────────────────── */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  margin-bottom: 4px;
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--tl-purple);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; overflow: hidden; }
.user-name { font-size: 13px; font-weight: 600; color: #f9fafb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: #7c7399; text-transform: uppercase; letter-spacing: .5px; }

/* ── Customer Selector ──────────────────────────────────────────────────── */
.customer-selector {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.customer-select {
  width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: #f9fafb;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
.customer-select:hover { border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.1); }
.customer-select:focus { border-color: var(--tl-purple); box-shadow: 0 0 0 2px rgba(124,58,237,.25); }
.customer-select option { background: #1e1b2e; color: #f9fafb; }

/* ── Sidebar Nav ────────────────────────────────────────────────────────── */
.sidebar-nav { list-style: none; padding: 8px 0; flex: 1; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: #9ca3af;
  text-decoration: none;
  transition: background .15s, color .15s;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-size: 14px;
  font-family: inherit;
  border-left: 3px solid transparent;
}
.nav-link:hover { background: rgba(255,255,255,.06); color: #e5e7eb; }
.nav-item.active .nav-link { color: #fff; background: rgba(124,58,237,.2); border-left-color: var(--tl-purple); }
.nav-icon { font-size: 16px; flex-shrink: 0; width: 22px; display: flex; align-items: center; }
.nav-label { flex: 1; }

/* Sub-Nav (Module unter Abteilungen) */
.nav-sub { list-style: none; padding: 0; margin: 2px 0 4px 0; }
.nav-sub-link {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 44px;
  font-size: 12px;
  color: rgba(255,255,255,.45);
  text-decoration: none;
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.nav-sub-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-sub-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.nav-chevron { margin-left: auto; font-size: 10px; color: rgba(255,255,255,.4); }
.nav-toggle { cursor: pointer; }

.sidebar-footer { border-top: 1px solid rgba(255,255,255,.08); padding: 8px 0; }
.btn-logout { color: #9ca3af; }
.btn-logout:hover { color: #fca5a5 !important; background: rgba(224,36,36,.1) !important; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.admin-header {
  height: var(--header-h);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}
.header-title { font-size: 16px; font-weight: 600; flex: 1; }
.header-actions { display: flex; gap: 8px; align-items: center; }
.header-user-badge { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }

/* ── Content ────────────────────────────────────────────────────────────── */
.admin-content { flex: 1; padding: 24px; }

/* ── KPI Grid ───────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.kpi-label { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.kpi-value { font-size: 28px; font-weight: 700; color: var(--text-primary); line-height: 1; }
.kpi-sub   { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.kpi-card.purple .kpi-value { color: var(--tl-purple); }
.kpi-card.green  .kpi-value { color: var(--tl-green); }
.kpi-card.red    .kpi-value { color: var(--tl-red); }
.kpi-card.orange .kpi-value { color: var(--tl-orange); }
.kpi-card.blue   .kpi-value { color: var(--tl-blue); }

/* ── Card ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 24px;
}
.card-header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.card-title { font-size: 15px; font-weight: 600; flex: 1; }

/* ── Table ──────────────────────────────────────────────────────────────── */
.tl-table { width: 100%; border-collapse: collapse; }
.tl-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-secondary);
  background: var(--bg-light);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.tl-table th:hover { color: var(--text-primary); }
.tl-table th.sort-asc::after  { content: ' ↑'; }
.tl-table th.sort-desc::after { content: ' ↓'; }
.tl-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 13px;
  vertical-align: middle;
}
.tl-table tr:last-child td { border-bottom: none; }
.tl-table tbody tr:hover { background: #f5f3ff; cursor: pointer; }
.text-right { text-align: right; }
.text-muted { color: var(--text-secondary); }
.fw-600     { font-weight: 600; }
.mono       { font-family: 'SF Mono', Consolas, monospace; font-size: 12px; }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
  white-space: nowrap;
}
.badge-entwurf   { background: #f3f4f6; color: #6b7280; }
.badge-gesendet  { background: #dbeafe; color: #1d4ed8; }
.badge-angenommen { background: #dcfce7; color: #15803d; }
.badge-abgelehnt { background: #fee2e2; color: #b91c1c; }
.badge-offen     { background: #fef3c7; color: #92400e; }
.badge-laufend   { background: #dbeafe; color: #1d4ed8; }
.badge-fertig    { background: #dcfce7; color: #15803d; }
.badge-storniert { background: #fee2e2; color: #b91c1c; text-decoration: line-through; }
.badge-bezahlt   { background: #dcfce7; color: #15803d; }
.badge-versendet { background: #e0e7ff; color: #4338ca; }
.badge-ueberfaellig { background: #fee2e2; color: #b91c1c; }
.badge-admin     { background: #ede9fe; color: #6d28d9; }
.badge-mitarbeiter { background: #dbeafe; color: #1d4ed8; }
.badge-viewer    { background: #f3f4f6; color: #6b7280; }
.badge-default   { background: #f3f4f6; color: #6b7280; }

/* ── Filter Bar ─────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-white);
}
.tl-input {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: border .15s;
  font-family: inherit;
  background: var(--bg-white);
}
.tl-input:focus { border-color: var(--tl-purple); box-shadow: 0 0 0 3px rgba(124,58,237,.08); }
.tl-input-search { min-width: 220px; }
.tl-select {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 12px;
  font-size: 13px;
  background: var(--bg-white);
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  font-family: inherit;
}
.tl-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, opacity .15s;
  font-family: inherit;
}
.tl-btn-primary { background: var(--tl-purple); color: #fff; border-color: var(--tl-purple); }
.tl-btn-primary:hover { background: var(--tl-purple-dk); }
.tl-btn-ghost { background: transparent; color: var(--text-secondary); border-color: var(--border); }
.tl-btn-ghost:hover { background: var(--bg-light); color: var(--text-primary); }
.tl-btn-danger { background: var(--tl-red); color: #fff; border-color: var(--tl-red); }
.tl-btn-danger:hover { background: #c81e1e; }
.tl-btn-sm { padding: 5px 12px; font-size: 12px; }
.tl-btn-success { background: var(--tl-green); color: #fff; border-color: var(--tl-green); }
.tl-btn-success:hover { background: #0c8c63; }
.filter-count { font-size: 13px; color: var(--text-secondary); margin-left: auto; }

/* ── Pagination ─────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}
.pagination-controls { display: flex; gap: 4px; }
.page-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  font-family: inherit;
}
.page-btn:hover:not(:disabled) { background: var(--bg-light); color: var(--text-primary); }
.page-btn.active { background: var(--tl-purple); color: #fff; border-color: var(--tl-purple); }
.page-btn:disabled { opacity: .4; cursor: default; }

/* ── Toast ──────────────────────────────────────────────────────────────── */
.tl-toast {
  position: fixed;
  bottom: 24px; right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius);
  background: #1f2937;
  color: #f9fafb;
  font-size: 14px;
  box-shadow: var(--shadow-md);
  transform: translateY(80px);
  opacity: 0;
  transition: transform .25s, opacity .25s;
  z-index: 9999;
  max-width: 340px;
}
.tl-toast.show { transform: translateY(0); opacity: 1; }
.tl-toast--success { background: #065f46; }
.tl-toast--error   { background: #7f1d1d; }
.tl-toast--info    { background: #312e81; }

/* ── Loading / Error / Empty ────────────────────────────────────────────── */
.tl-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--text-secondary);
  gap: 12px;
}
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--tl-purple);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.tl-error { text-align: center; padding: 40px; color: var(--tl-red); }
.tl-empty { text-align: center; padding: 60px; color: var(--text-secondary); }
.tl-empty .empty-icon { font-size: 48px; margin-bottom: 12px; }

/* ── Login Page ─────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-light);
}
.login-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 40px;
  width: 100%;
  max-width: 380px;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-text { font-size: 22px; font-weight: 700; color: var(--tl-purple); }
.login-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; }
.form-input {
  display: block; width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-size: 14px;
  outline: none;
  transition: border .15s;
  font-family: inherit;
}
.form-input:focus { border-color: var(--tl-purple); box-shadow: 0 0 0 3px rgba(124,58,237,.1); }
.btn-login {
  width: 100%;
  padding: 10px;
  background: var(--tl-purple);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: background .15s;
  font-family: inherit;
}
.btn-login:hover { background: var(--tl-purple-dk); }
.btn-login:disabled { opacity: .7; cursor: default; }
.login-error {
  color: var(--tl-red);
  font-size: 13px;
  margin-top: 8px;
  padding: 8px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  display: none;
}

/* ── Drawer ──────────────────────────────────────────────────────────────── */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 200;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 560px;
  max-width: 100vw;
  background: var(--bg-white);
  box-shadow: -4px 0 24px rgba(0,0,0,.15);
  z-index: 201;
  transform: translateX(100%);
  transition: transform .25s;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.drawer.open { transform: translateX(0); }
.drawer-header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-shrink: 0;
}
.drawer-title { font-size: 16px; font-weight: 600; flex: 1; }
.drawer-close {
  background: none; border: none;
  font-size: 22px; cursor: pointer;
  color: var(--text-secondary);
  line-height: 1;
  padding: 4px 6px;
  border-radius: 4px;
}
.drawer-close:hover { background: var(--bg-light); color: var(--text-primary); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }

/* ── Detail Grid ────────────────────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
  margin-bottom: 24px;
}
.detail-item label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-secondary);
  font-weight: 600;
  display: block;
  margin-bottom: 2px;
}
.detail-item span { font-size: 14px; color: var(--text-primary); }
.detail-section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-secondary);
  margin: 20px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* ── Positionen Tabelle ─────────────────────────────────────────────────── */
.pos-table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.pos-table th {
  text-align: left;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.pos-table td {
  padding: 8px 10px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.pos-table tr:last-child td { border-bottom: none; }
.pos-table .text-right { text-align: right; }

/* ── Form (Drawer inline forms) ─────────────────────────────────────────── */
.drawer-form-group { margin-bottom: 14px; }
.drawer-form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-secondary);
}
.drawer-form-group input,
.drawer-form-group select,
.drawer-form-group textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.drawer-form-group input:focus,
.drawer-form-group select:focus,
.drawer-form-group textarea:focus {
  border-color: var(--tl-purple);
  box-shadow: 0 0 0 3px rgba(124,58,237,.08);
}
.drawer-form-group textarea { resize: vertical; min-height: 60px; }
.drawer-form-row { display: flex; gap: 12px; }
.drawer-form-row .drawer-form-group { flex: 1; }

/* ── Pos Editor ──────────────────────────────────────────────────────────── */
.pos-editor { margin-top: 16px; }
.pos-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 8px;
}
.pos-row input { flex: 1; }
.pos-row .pos-del {
  background: none; border: none; cursor: pointer;
  color: var(--tl-red); font-size: 18px; padding: 4px;
}

/* ── Summen-Block ────────────────────────────────────────────────────────── */
.summen-block {
  border-top: 2px solid var(--border);
  margin-top: 16px;
  padding-top: 12px;
}
.summen-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
}
.summen-row.total { font-weight: 700; font-size: 15px; border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px; }

/* ── Druck-Ansicht ───────────────────────────────────────────────────────── */
.print-view {
  display: none;
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 500;
  overflow-y: auto;
  padding: 40px;
}
.print-view.open { display: block; }
.print-close {
  position: fixed;
  top: 12px; right: 12px;
  background: var(--tl-purple);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  z-index: 501;
}
.invoice-doc {
  max-width: 700px;
  margin: 0 auto;
  font-size: 13px;
  line-height: 1.6;
}
.invoice-header { display: flex; justify-content: space-between; margin-bottom: 40px; }
.invoice-sender { font-size: 12px; color: var(--text-secondary); }
.invoice-sender strong { color: var(--text-primary); font-size: 14px; }
.invoice-meta { text-align: right; }
.invoice-meta h1 { font-size: 24px; color: var(--tl-purple); margin-bottom: 8px; }
.invoice-recipient { margin-bottom: 30px; font-size: 14px; }
.invoice-table { width: 100%; border-collapse: collapse; margin: 20px 0; }
.invoice-table th {
  text-align: left; padding: 8px; font-size: 12px;
  border-bottom: 2px solid var(--text-primary);
  font-weight: 600;
}
.invoice-table td { padding: 8px; border-bottom: 1px solid var(--border); }
.invoice-table .text-right { text-align: right; }
.invoice-summen { width: 250px; margin-left: auto; margin-top: 12px; }
.invoice-summen td { padding: 4px 8px; font-size: 13px; }
.invoice-summen .total td { font-weight: 700; font-size: 15px; border-top: 2px solid var(--text-primary); }
.invoice-footer { margin-top: 40px; font-size: 12px; color: var(--text-secondary); border-top: 1px solid var(--border); padding-top: 16px; }

/* ── Tab Bar ─────────────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  background: var(--bg-white);
  overflow-x: auto;
}
.tab-btn {
  padding: 12px 14px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
  font-family: inherit;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--tl-purple); border-bottom-color: var(--tl-purple); }

/* ── Tab Panels ─────────────────────────────────────────────────────────── */
.tab-panel { display: none; padding: 20px 0; }
.tab-panel.active { display: block; }

/* ── Nav Group Labels ──────────────────────────────────────────────────── */
.nav-group-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #7c7399;
  padding: 12px 16px 4px;
  font-weight: 600;
}
.nav-divider {
  height: 1px;
  background: rgba(255,255,255,.06);
  margin: 4px 16px;
}

/* ── Cockpit ───────────────────────────────────────────────────────────── */
.cockpit-header-row,
.cockpit-row {
  display: grid;
  grid-template-columns: 2fr repeat(6, 1fr);
  align-items: center;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.cockpit-header-row {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-secondary);
  background: var(--bg-light);
}
.cockpit-row { cursor: pointer; transition: background .15s; }
.cockpit-row:hover { background: #f5f3ff; }
.cockpit-row:last-child { border-bottom: none; }

/* ── Agent Result ──────────────────────────────────────────────────────── */
.agent-result-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: #f5f3ff;
  margin-top: 12px;
}
.agent-result-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ── Utilities ──────────────────────────────────────────────────────────── */
.mb-0 { margin-bottom: 0 !important; }
.mt-16 { margin-top: 16px; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .admin-sidebar { transform: translateX(-100%); transition: transform .2s; }
  .admin-sidebar.mobile-open { transform: translateX(0); z-index: 300; }
  .admin-main { margin-left: 0; }
  .admin-content { padding: 10px; }
  .admin-header { padding: 0 12px; }
  .header-title { font-size: 14px; }
  .mobile-menu-btn { display: flex !important; }
  .mobile-sidebar-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.5);
    z-index: 299; opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .mobile-sidebar-overlay.open { opacity: 1; pointer-events: auto; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .kpi-card { padding: 12px; }
  .kpi-value { font-size: 22px; }
  .filter-bar { padding: 10px 12px; gap: 6px; }
  .tl-input-search { min-width: 0; flex: 1; }
  #table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tl-table { min-width: 600px; }
  .tl-table th, .tl-table td { padding: 8px 10px; font-size: 12px; }
  .pagination { padding: 8px 12px; font-size: 12px; flex-wrap: wrap; gap: 6px; }
  .drawer { width: 100%; }
  .drawer-body { padding: 14px; }
  .detail-grid { grid-template-columns: 1fr; gap: 8px; }
  .cockpit-header-row { display: none; }
  .cockpit-row { grid-template-columns: 1fr 1fr; gap: 4px; font-size: 12px; }
  .tab-bar { padding: 0 10px; }
  .tab-btn { padding: 10px 10px; font-size: 12px; }
  .print-view { padding: 16px; }
  .invoice-header { flex-direction: column; gap: 16px; }
  .invoice-meta { text-align: left; }
}

/* ── Module Badges ──────────────────────────────────────────────────── */
.module-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* ── System Health ──────────────────────────────────────────────────── */
.system-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.health-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.health-dot--ok      { background: #16a34a; }
.health-dot--error   { background: #dc2626; }
.health-dot--unknown { background: #94a3b8; }

/* ── System Alerts ──────────────────────────────────────────────────── */
.system-alert {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  font-weight: 500;
}
.system-alert--error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}
.system-alert--warn {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

/* ── Webseiten Design ───────────────────────────────────────────────── */
.wd-color-dot {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid var(--border);
  margin-right: 4px;
  vertical-align: middle;
}
.wd-preview-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Activity Timeline ──────────────────────────────────────────────── */
.activity-timeline {
  position: relative;
  padding-left: 8px;
}
.activity-timeline::before {
  content: '';
  position: absolute;
  left: 22px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  position: relative;
}
.activity-item + .activity-item {
  border-top: 1px solid var(--border);
}
.activity-type-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  border: 1px solid;
  z-index: 1;
  background: var(--bg-white);
}
.activity-content {
  flex: 1;
  min-width: 0;
}
.activity-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}
.activity-type-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.activity-customer {
  font-size: 12px;
  color: var(--text-secondary);
}
.activity-customer-link {
  color: var(--tl-purple);
  text-decoration: none;
  font-weight: 500;
}
.activity-customer-link:hover {
  text-decoration: underline;
}
.activity-date {
  font-size: 12px;
  color: var(--text-light);
  margin-left: auto;
}
.activity-description {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.4;
}
.activity-email-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ── Quick-Add Form ────────────────────────────────────────────────── */
.quick-add-form {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-light);
  margin-bottom: 16px;
}

/* ── Activity Filter Bar ───────────────────────────────────────────── */
.activity-filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-white);
}

/* ── Tag Chips ─────────────────────────────────────────────────────── */
.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid;
  gap: 4px;
}
.tag-chip-delete {
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  opacity: .6;
  margin-left: 2px;
}
.tag-chip-delete:hover {
  opacity: 1;
}

/* ── Tag Filter Bar ────────────────────────────────────────────────── */
.tag-filter-bar {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-white);
}
.tag-filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-white);
  color: var(--text-secondary);
  transition: background .15s, color .15s, border-color .15s;
  user-select: none;
}
.tag-filter-chip:hover {
  background: var(--bg-light);
}
.tag-filter-chip.active {
  border-color: currentColor;
}

/* ── Kanban Board ──────────────────────────────────────────────────── */
.kanban-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  min-height: 400px;
  align-items: flex-start;
}
.kanban-column {
  flex: 1;
  min-width: 250px;
  max-width: 320px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 220px);
}
.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  background: var(--bg-white);
  border-radius: var(--radius) var(--radius) 0 0;
  flex-shrink: 0;
}
.kanban-cards {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
}
.kanban-empty {
  text-align: center;
  padding: 20px 8px;
  font-size: 12px;
  color: var(--text-light);
}
.kanban-end-stage {
  opacity: .7;
  min-width: 200px;
  max-width: 240px;
}
.kanban-end-stage .kanban-cards {
  max-height: 300px;
}
.kanban-column.drag-over {
  background: #f0ebff;
  border-color: var(--tl-purple);
  box-shadow: inset 0 0 0 2px rgba(124,58,237,.15);
}

/* ── Deal Card ────────────────────────────────────────────────────── */
.deal-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-left: 3px solid var(--tl-purple);
  border-radius: var(--radius);
  padding: 10px 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: box-shadow .15s, opacity .15s;
  user-select: none;
}
.deal-card:hover {
  box-shadow: var(--shadow-md);
}
.deal-card[draggable="true"]:hover {
  cursor: grab;
}
.deal-card.dragging {
  opacity: 0.5;
}
.deal-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}
.deal-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.deal-card-firma-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .3px;
  flex-shrink: 0;
}
.deal-card-customer {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.deal-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.deal-card-value {
  font-weight: 600;
  color: var(--text-primary);
}
.deal-card-wsk {
  color: var(--text-secondary);
  font-size: 11px;
}
.deal-card-date {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 4px;
}

@media (max-width: 768px) {
  .kanban-board {
    gap: 8px;
  }
  .kanban-column {
    min-width: 220px;
  }
  .kanban-end-stage {
    min-width: 180px;
  }
}

@media print {
  .print-close { display: none; }
  .print-view { position: static; padding: 0; }
}
