/* =====================================================
   TB-Service24 Plattform — Design System
   Portiert aus der alten TB-App (DM Mono + Syne, Orange Accent)
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Syne:wght@400;600;700;800&display=swap');

:root {
  --bg:       #0f1117;
  --surface:  #1a1d27;
  --surface2: #22263a;
  --border:   #2e3347;
  --accent:   #f97316;
  --accent2:  #fb923c;
  --green:    #22c55e;
  --red:      #ef4444;
  --yellow:   #eab308;
  --blue:     #3b82f6;
  --purple:   #8b5cf6;
  --teal:     #14b8a6;
  --text:     #f1f5f9;
  --muted:    #64748b;
  --mono:     'DM Mono', monospace;
  --sans:     'Syne', sans-serif;

  /* Aliase fuer bestehende Components */
  --c-bg:       var(--bg);
  --c-bg-alt:   var(--surface);
  --c-surface:  var(--surface);
  --c-border:   var(--border);
  --c-text:     var(--text);
  --c-text-dim: var(--muted);
  --c-primary:  var(--accent);
  --c-primary-d:var(--accent2);
  --c-danger:   var(--red);
  --c-success:  var(--green);
  --c-warn:     var(--yellow);
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,.3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

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

/* ---- BUTTONS ---- */
button, .btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: 8px; border: none;
  cursor: pointer; font-family: var(--sans); font-weight: 700;
  font-size: 13px; transition: all .2s; min-height: 38px;
}
button:disabled, .btn:disabled { opacity: .5; cursor: not-allowed; }
button, .btn { background: var(--accent); color: #fff; }
button:hover:not(:disabled), .btn:hover:not(:disabled) { background: var(--accent2); transform: translateY(-1px); }
.ghost, .btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); transform: none; }
.danger, .btn.danger { background: var(--red); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-blue { background: var(--blue); color: #fff; }

/* ---- INPUTS ---- */
input, select, textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; color: var(--text);
  font-family: var(--mono); font-size: 13px; outline: none;
  transition: border-color .2s; min-height: 38px;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
select option { background: var(--surface); }
textarea { resize: vertical; min-height: 70px; }
label { display: block; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; font-family: var(--mono); }

/* ---- LAYOUT: Sidebar + Main ---- */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: 220px;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 100;
  transition: width .25s, transform .3s; overflow: hidden;
}
.sidebar.collapsed { width: 56px; }
.sidebar.collapsed .sidebar-logo span,
.sidebar.collapsed .nav-section,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .user-name,
.sidebar.collapsed .user-role,
.sidebar.collapsed #logout-btn { display: none; }
.sidebar.collapsed .sidebar-logo { padding: 12px; justify-content: center; }
.sidebar.collapsed .nav-item { justify-content: center; margin: 2px 4px; padding: 10px 4px; }
.sidebar.collapsed .nav-icon { font-size: 18px; width: auto; }
.sidebar.collapsed .user-chip { justify-content: center; padding: 8px 4px; }
.sidebar.collapsed .user-avatar { width: 28px; height: 28px; font-size: 11px; }
.sidebar.collapsed + .sidebar-overlay + .main-content,
.sidebar.collapsed ~ .main-content { margin-left: 56px; }
.sidebar.collapsed ~ .main-content .td-bottom-bar { left: 56px; }

.sidebar-logo {
  display: flex; align-items: center; gap: 10px; padding: 14px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .icon {
  width: 32px; height: 32px; background: var(--accent); border-radius: 8px;
  display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0;
}
.sidebar-logo span { font-size: 15px; font-weight: 800; white-space: nowrap; }
.collapse-btn {
  position: absolute; top: 16px; right: -12px; width: 24px; height: 24px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  font-size: 12px; color: var(--muted); z-index: 101; min-height: auto; padding: 0;
}
.collapse-btn:hover { color: var(--accent); border-color: var(--accent); transform: none; }
#sidebar-nav {
  flex: 1; overflow-y: auto; overflow-x: hidden; padding-bottom: 8px;
}
#sidebar-nav::-webkit-scrollbar { width: 4px; }
#sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.nav-section {
  padding: 14px 12px 5px; font-size: 10px; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: 1.5px; font-family: var(--mono);
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin: 2px 8px;
  border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600;
  color: var(--muted); transition: all .15s; text-decoration: none;
}
.nav-item:hover { background: var(--surface2); color: var(--text); text-decoration: none; }
.nav-item.active { background: rgba(249,115,22,.15); color: var(--accent); }
.nav-icon { font-size: 14px; width: 20px; text-align: center; }
.sidebar-bottom {
  margin-top: auto; border-top: 1px solid var(--border); padding: 10px;
}
.user-chip {
  display: flex; align-items: center; gap: 8px; padding: 8px;
  border-radius: 8px; background: var(--surface2);
}
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.user-name { font-size: 12px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 10px; color: var(--muted); font-family: var(--mono); }

.main-content { margin-left: 220px; min-height: 100vh; }
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 10px 20px; display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 50;
}
.topbar h1 { font-size: 16px; font-weight: 800; flex: 1; white-space: nowrap; }
.content-area { padding: 20px; overflow-x: hidden; }
@media(max-width:480px){ .content-area { padding: 10px; } }
@media(max-width:768px){ body { padding-left: 0; padding-right: 0; } }

/* Mobile: Sidebar als Overlay */
.menu-toggle { display: none; background: none; border: none; color: var(--text); font-size: 22px; cursor: pointer; padding: 4px; min-height: auto; }
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); width: 280px; padding-top: env(safe-area-inset-top); }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.5); }
  .main-content { margin-left: 0 !important; }
  .menu-toggle { display: block; font-size: 26px; padding: 8px; min-height: 44px; }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 99; }
  .sidebar.open + .sidebar-overlay { display: block; }
  .topbar { padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top)); }
  .topbar h1 { font-size: 15px; }
  .nav-item { padding: 12px 14px; font-size: 14px; min-height: 44px; }
  .nav-icon { font-size: 18px; }
  button, .btn { min-height: 44px; font-size: 14px; padding: 10px 16px; }
  input, select, textarea { min-height: 44px; font-size: 16px; padding: 10px 12px; }
  .card { padding: 12px; border-radius: 10px; }
  .table th, .table td { padding: 10px 8px; font-size: 13px; }
  .tbl th, .tbl td { padding: 8px 6px; }
  .badge { font-size: 12px; padding: 3px 8px; }
  .td-bottom-bar { padding-bottom: calc(8px + env(safe-area-inset-bottom)); left: 0; }
  .td-bb-btn { min-height: 44px; font-size: 13px; }
  h2 { font-size: 18px; }
  h3 { font-size: 15px; }
}

/* ---- TICKET DETAIL ---- */
.td { padding-bottom: 70px; }
.td-loading,.td-err { padding: 30px; text-align: center; color: var(--muted); }
.td-err { color: var(--red); }

.td-header {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 10px;
}
.td-header-top { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.td-back { background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; padding: 0; min-height: auto; }
.td-back:hover { color: var(--accent); transform: none; }
.td-title-block { flex: 1; min-width: 0; }
.td-nr { font-size: 12px; color: var(--muted); font-family: var(--mono); }
.td-title { font-size: 18px; font-weight: 800; line-height: 1.2; }
.td-typ-badge { padding: 4px 12px; border-radius: 20px; color: #fff; font-size: 12px; font-weight: 700; white-space: nowrap; }
.td-meta-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.td-status-big { padding: 5px 16px; border-radius: 20px; font-size: 14px; font-weight: 800; font-family: var(--mono); }
.st-open { background: rgba(34,197,94,.15); color: var(--green); }
.st-wait { background: rgba(234,179,8,.15); color: var(--yellow); }
.st-done { background: rgba(59,130,246,.15); color: var(--blue); }
.st-closed { background: var(--surface2); color: var(--muted); }
.st-work { background: rgba(59,130,246,.2); color: var(--blue); }
.st-pause { background: rgba(234,179,8,.15); color: var(--yellow); }
.td-prio { font-size: 12px; font-family: var(--mono); font-weight: 700; padding: 3px 10px; border-radius: 8px; background: var(--surface2); }
.td-prio-high { background: rgba(239,68,68,.2); color: var(--red); }
.td-due { font-size: 12px; font-family: var(--mono); color: var(--muted); }
.td-overdue { color: var(--red); font-weight: 700; animation: blink 1.5s ease-in-out infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.4} }
.td-panne-flag { background: var(--red); color: #fff; font-size: 12px; font-weight: 800; padding: 4px 12px; border-radius: 20px; }

.td-assign-bar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 14px; margin-bottom: 10px;
}
.td-assigned { display: flex; gap: 8px; align-items: center; }
.td-assign-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; font-weight: 700; }
.td-assign-name { font-size: 16px; font-weight: 700; }
.td-assign-remove { min-height: auto; padding: 2px 6px; font-size: 14px; }
.td-not-assigned { background: rgba(234,179,8,.15); color: var(--yellow); padding: 6px 14px; border-radius: 8px; font-size: 14px; font-weight: 700; }
.td-assign-me { min-height: 40px; padding: 6px 16px; font-size: 14px; margin-left: auto; }
.td-assign-sel { width: auto; min-width: 130px; min-height: 36px; font-size: 12px; }

.td-quick { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.td-quick-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 8px 6px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 11px; font-weight: 600;
  cursor: pointer; transition: all .15s; text-decoration: none;
  flex: 1 1 0; min-width: 60px; min-height: 56px; text-align: center;
}
.td-quick-btn:hover { border-color: var(--accent); color: var(--accent); transform: none; text-decoration: none; }
.td-quick-btn span { font-size: 20px; display: block; }
.td-quick-active { background: rgba(34,197,94,.15); border-color: #22c55e; color: #16a34a; }
.td-quick-call { background: var(--green); border-color: var(--green); color: #fff; }
.td-quick-call:hover { background: #16a34a; border-color: #16a34a; color: #fff; }
.td-quick-call small { font-size: 10px; opacity: .8; font-family: var(--mono); display: block; }

.td-status-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.td-st-btn {
  flex: 1 1 auto; min-height: 44px; padding: 6px 12px; border-radius: 8px;
  font-size: 13px; font-weight: 700; background: var(--surface); border: 1px solid var(--border);
  color: var(--muted); cursor: pointer; transition: all .15s;
}
.td-st-btn:hover { border-color: var(--accent); color: var(--text); transform: none; }
.td-st-btn.active { color: #fff; border-color: transparent; }
.td-st-btn.active.st-work { background: var(--blue); }
.td-st-btn.active.st-pause { background: var(--yellow); color: #000; }
.td-st-btn.active.st-done { background: var(--green); }
.td-st-btn.active.st-open { background: var(--green); }
.td-st-btn.active.st-wait { background: var(--yellow); color: #000; }
.td-st-more { width: auto; min-height: 48px; font-size: 13px; }

.td-section { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; }
.td-section-empty { opacity: .7; }
.td-section-title { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.td-aa-list { display: flex; flex-direction: column; gap: 4px; }
.td-aa-item { display: flex; gap: 8px; align-items: flex-start; padding: 6px 10px; background: var(--surface2); border-radius: 8px; font-size: 14px; line-height: 1.5; }
.td-aa-num { color: var(--accent); font-weight: 800; font-family: var(--mono); min-width: 22px; }
.td-summary { background: var(--surface2); padding: 10px 14px; border-radius: 8px; border-left: 3px solid var(--accent); margin-bottom: 8px; font-size: 14px; white-space: pre-wrap; }
.td-desc { font-size: 15px; line-height: 1.7; white-space: pre-wrap; color: var(--text); }
.td-thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.td-thumb { display: block; width: 80px; height: 80px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.td-thumb img { width: 100%; height: 100%; object-fit: cover; }
.td-thumb-file { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 10px; text-align: center; color: var(--muted); gap: 4px; text-decoration: none; }

.td-details { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; }
.td-details-body { margin-top: 10px; }
.td-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.td-label { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-family: var(--mono); }
.td-field { position: relative; }
.td-field-val { font-weight: 700; font-size: 14px; padding: 4px 0; min-height: 24px; border-bottom: 1px dashed transparent; transition: border-color .2s; }
.td-field-val:hover { border-bottom-color: var(--accent); }
.td-field-val:empty::after { content: '\2013'; color: var(--muted); font-weight: 400; }
.td-field-edit input { width: 100%; font-size: 13px; min-height: 34px; padding: 4px 8px; border: 1px solid var(--accent); border-radius: 6px; }
.td-ac { position: absolute; left: 0; right: 0; top: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,.15); z-index: 100; max-height: 200px; overflow-y: auto; display: none; }
.td-ac-item { padding: 8px 10px; cursor: pointer; font-size: 13px; border-bottom: 1px solid var(--border); }
.td-ac-item:hover { background: var(--surface2); }
.td-ac-empty { padding: 8px 10px; font-size: 12px; color: var(--muted); }
.td-note { border-left: 3px solid var(--border); padding: 6px 10px; margin-bottom: 6px; font-size: 14px; }
.td-cl-dup { background: rgba(34,197,94,.06); border-left: 3px solid var(--green); }
.kb-card { transition: transform .15s, box-shadow .15s; }
.kb-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.kb-items.drag-over { background: rgba(59,130,246,.08); }

.td-cl-card {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 14px; margin-bottom: 8px;
}
.td-cl-gruppe {
  background: var(--surface2); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px;
}
.td-cl-gruppe-title {
  font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 8px; font-family: var(--mono);
}
.td-cl-punkt {
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.td-cl-punkt:last-child { border-bottom: none; }
.td-cl-punkt-row { display: flex; gap: 10px; align-items: flex-start; }
.td-cl-vorlage-btn { padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--border); cursor: pointer; transition: background .12s; }
.td-cl-vorlage-btn:hover { background: var(--surface2); }
.td-cl-vorlage-btn:last-child { border-bottom: none; }
.td-cl-check {
  display: flex; gap: 10px; align-items: center; font-size: 15px; cursor: pointer;
  padding: 4px 0; min-height: auto;
}
.td-cl-extras {
  margin-top: 6px; margin-left: 32px; display: flex; flex-direction: column; gap: 4px;
}
.td-cl-foto-row {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.td-cl-foto-thumb {
  width: 60px; height: 60px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border);
}

.td-bottom-bar {
  position: fixed; bottom: 0; left: 220px; right: 0;
  background: var(--surface); border-top: 1px solid var(--border);
  display: flex; gap: 0; z-index: 60; padding: 0;
}
.td-bb-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px; background: none; border: none; border-right: 1px solid var(--border);
  color: var(--muted); font-size: 10px; font-weight: 600; cursor: pointer;
  min-height: 56px; font-family: var(--sans);
}
.td-bb-btn:last-child { border-right: none; }
.td-bb-btn:hover { background: var(--surface2); color: var(--accent); }
.td-bb-btn span { font-size: 20px; }
@media (max-width: 768px) {
  .td-bottom-bar { left: 0; padding-bottom: env(safe-area-inset-bottom); }
  .td { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .td-header { padding: 10px 12px; }
  .td-meta-row { gap: 6px; }
  .td-section { margin-bottom: 8px; }
  .td-section-title { font-size: 12px; padding: 6px 10px; }
  .td-desc { font-size: 13px; }
}

/* ---- CARDS ---- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px;
}
.card-title { font-size: 13px; font-weight: 700; margin-bottom: 10px; }

.stack > * + * { margin-top: 10px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 200px; }

/* ---- TABLE ---- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; font-family: var(--mono); }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table th { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; background: var(--surface2); }

/* ---- BADGES ---- */
.badge {
  display: inline-block; font-size: 11px; font-family: var(--mono); font-weight: 700;
  padding: 2px 8px; border-radius: 20px; background: var(--surface2); color: var(--muted);
}
.badge.ok     { background: rgba(34,197,94,.15); color: var(--green); }
.badge.danger { background: rgba(239,68,68,.15); color: var(--red); }
.badge.warn   { background: rgba(234,179,8,.15); color: var(--yellow); }
.badge.admin  { background: rgba(249,115,22,.2); color: var(--accent); }

/* ---- LOGIN ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; position: relative; }
.login-wrap::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse 60% 60% at 50% 0%, rgba(249,115,22,.15) 0%, transparent 70%); pointer-events: none; }
.login-card { width: 100%; max-width: 420px; position: relative; z-index: 1; padding: 44px 38px; }
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-logo .icon { width: 44px; height: 44px; background: var(--accent); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.login-logo span { font-size: 22px; font-weight: 800; }

.muted { color: var(--muted); font-size: 13px; font-family: var(--mono); }
.error { color: var(--red); font-size: 13px; font-family: var(--mono); }
.ok    { color: var(--green); font-size: 13px; font-family: var(--mono); }

/* ---- STATUS-BUTTONS ---- */
.status-btn {
  background: var(--surface2); border: 1px solid var(--border); color: var(--muted);
  border-radius: 20px; padding: 5px 14px; font-size: 12px; font-weight: 700;
  font-family: var(--mono); min-height: auto; cursor: pointer; transition: all .15s;
}
.status-btn:hover { border-color: var(--accent); color: var(--text); transform: none; }
.status-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.status-btn.active.ok { background: var(--green); border-color: var(--green); }
.status-btn.active.warn { background: var(--yellow); border-color: var(--yellow); color: #000; }

/* ---- SCHNELLAKTIONEN ---- */
.quick-actions .quick-btn {
  display: inline-flex; flex-direction: column; align-items: center; text-align: center;
  min-height: 50px; padding: 8px 14px; font-size: 12px; line-height: 1.3; border-radius: 10px;
}
.quick-btn .qicon { font-size: 18px; }
.quick-btn .qsub { font-size: 10px; opacity: .7; font-family: var(--mono); }

/* ---- INFO-GRID ---- */
.info-grid-simple { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.tg-label { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-family: var(--mono); }

/* ---- TABS ---- */
.tabs { display: flex; gap: 3px; flex-wrap: wrap; background: var(--surface2); border-radius: 10px; padding: 4px; }
.tab {
  flex: 0 0 auto; padding: 8px 14px; border: none; background: none; color: var(--muted);
  border-radius: 7px; cursor: pointer; font-family: var(--sans); font-size: 13px;
  font-weight: 600; transition: all .15s; min-height: 36px;
}
@media(max-width:768px){ .tab { padding: 10px 12px; min-height: 44px; font-size: 13px; } }
.tab:hover { color: var(--text); transform: none; }
.tab.active { background: var(--surface); color: var(--text); }

/* ---- ADMIN KACHELN ---- */
.admin-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.admin-tile { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; transition: transform .12s, border-color .12s; }
.admin-tile:hover { transform: translateY(-2px); border-color: var(--accent); text-decoration: none; }
.admin-tile-emoji { font-size: 26px; }
.admin-tile-title { font-weight: 700; font-size: 14px; }
.admin-tile-desc { font-size: 12px; color: var(--muted); font-family: var(--mono); margin-top: 2px; }

/* ---- DASHBOARD GRID ---- */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.dash-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; text-align: center; }
.dash-number { font-size: 30px; font-weight: 800; line-height: 1; color: var(--accent); }
.dash-label { font-size: 11px; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
@media(max-width:480px){
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-card { padding: 12px 8px; }
  .dash-number { font-size: 24px; }
}
.dash-label { font-size: 10px; color: var(--muted); margin-top: 6px; text-transform: uppercase; letter-spacing: .5px; font-family: var(--mono); }

/* ---- RECHTE-MATRIX ---- */
.rights-matrix th, .rights-matrix td { padding: 6px 8px; }
.rights-matrix th { font-size: 11px; }
.rights-matrix tr.rights-group td { background: var(--surface2); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }

/* ---- CHECKBOX STYLE ---- */
.cbx { display: inline-flex; align-items: center; gap: 6px; margin-right: 10px; min-height: auto; cursor: pointer; font-size: 13px; }
.cbx input[type="checkbox"] { width: auto; min-height: auto; }

/* ---- WIZARD ---- */
.wizard-step { min-height: 300px; }
.step-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--border); margin: 0 3px; }
.step-dot.active { background: var(--accent); }
.emoji-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 4px; max-width: 400px; }
.emoji-btn { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; font-size: 18px; padding: 5px; min-height: 36px; cursor: pointer; }
.emoji-btn:hover { border-color: var(--accent); transform: none; }
.emoji-btn.active { background: var(--accent); border-color: var(--accent); }
.color-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.color-btn { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; min-height: auto; padding: 0; }
.color-btn.active { border-color: #fff; outline: 2px solid var(--accent); }

/* ---- FILE UPLOAD ---- */
.file-list { display: flex; flex-direction: column; gap: 5px; }
.file-item { display: flex; gap: 8px; align-items: center; padding: 6px; background: var(--surface2); border-radius: 8px; }
.file-thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; }
.file-icon { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; font-size: 18px; background: var(--surface); border-radius: 6px; }

/* ---- KI ASSISTENT ---- */
.ki-assistent { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.ki-compact { border-left: 3px solid var(--accent); }
.ki-header { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface2); }
.ki-avatar { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; color: #fff; flex-shrink: 0; }
.ki-avatar-sm { width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; color: #fff; flex-shrink: 0; }
.ki-name { font-weight: 700; font-size: 13px; }
.ki-role { font-size: 11px; font-family: var(--mono); }
.ki-messages { display: flex; flex-direction: column; gap: 8px; padding: 10px; min-height: 100px; max-height: 50vh; overflow-y: auto; }
.ki-compact .ki-messages { min-height: 50px; max-height: 28vh; }
.ki-empty { text-align: center; padding: 14px; font-size: 12px; font-family: var(--mono); }
.ki-msg { display: flex; gap: 6px; }
.ki-msg-user { justify-content: flex-end; }
.ki-bubble { background: var(--surface2); padding: 8px 12px; border-radius: 8px; max-width: 85%; white-space: pre-wrap; font-size: 13px; line-height: 1.5; }
.ki-msg-user .ki-bubble { background: var(--accent); color: #fff; }
.ki-input-bar { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--border); align-items: center; }
.ki-input-bar input { flex: 1; min-height: 34px; border-radius: 20px; padding: 6px 14px; }
.ki-mic-btn { width: 34px; height: 34px; border-radius: 50%; background: var(--surface2); border: 1px solid var(--border); font-size: 16px; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; min-height: auto; }
.ki-mic-btn:hover { border-color: var(--accent); transform: none; }
.ki-mic-btn.recording { background: var(--red); border-color: var(--red); animation: pulse-mic 1s ease-in-out infinite; }
@keyframes pulse-mic { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.ki-send-btn { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 14px; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; min-height: auto; border: none; }
.ki-send-btn:hover { background: var(--accent2); transform: none; }
.ki-interim { padding: 4px 10px; font-size: 11px; color: var(--muted); font-family: var(--mono); background: var(--surface2); border-top: 1px dashed var(--border); }
.ki-actions .ki-action-btn { border-radius: 20px; font-size: 11px; font-family: var(--mono); }

/* ---- KB / WISSENSDATENBANK ---- */
.kb-search { display: flex; gap: 8px; margin-bottom: 12px; }
.kb-search input { flex: 1; }
.kb-cat-group { margin-bottom: 8px; }
.kb-cat-header { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; transition: all .15s; user-select: none; }
.kb-cat-header:hover { border-color: var(--accent); background: var(--surface2); }
.kb-cat-header.open { border-color: var(--accent); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.kb-cat-icon { font-size: 14px; font-weight: 700; color: var(--accent); transition: transform .2s; }
.kb-cat-header.open .kb-cat-icon { transform: rotate(90deg); }
.kb-cat-name { font-size: 14px; font-weight: 700; flex: 1; }
.kb-cat-count { font-size: 11px; color: var(--muted); font-family: var(--mono); background: var(--surface2); padding: 2px 8px; border-radius: 10px; }
.kb-cat-body { display: none; border: 1px solid var(--accent); border-top: none; border-radius: 0 0 10px 10px; overflow: hidden; }
.kb-folder-group { border-bottom: 1px solid var(--border); }
.kb-folder-group:last-child { border-bottom: none; }
.kb-folder-header { display: flex; align-items: center; gap: 8px; padding: 8px 14px; cursor: pointer; background: var(--surface2); transition: background .15s; }
.kb-folder-header:hover { background: rgba(249,115,22,.06); }
.kb-folder-header.open { background: rgba(249,115,22,.05); }
.kb-folder-icon { font-size: 12px; color: var(--muted); transition: transform .2s; }
.kb-folder-header.open .kb-folder-icon { transform: rotate(90deg); }
.kb-folder-name { flex: 1; font-size: 13px; font-weight: 600; }
.kb-folder-count { font-size: 10px; color: var(--muted); font-family: var(--mono); background: var(--border); padding: 1px 7px; border-radius: 10px; }
.kb-folder-articles { display: none; }
.kb-article { background: var(--surface); border-bottom: 1px solid var(--border); padding: 12px 16px; cursor: pointer; transition: all .15s; }
.kb-article:hover { background: var(--surface2); }
.kb-article.open { border-left: 3px solid var(--accent); }
.kb-article-title { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.kb-article-body { font-size: 13px; line-height: 1.7; margin-top: 10px; display: none; color: var(--text); }
.kb-article.open .kb-article-body { display: block; }
.kb-tag { display: inline-block; padding: 2px 6px; border-radius: 4px; font-size: 10px; font-family: var(--mono); background: var(--surface2); color: var(--muted); margin-right: 3px; }

/* ---- LIVE MONITOR ---- */
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); flex-shrink: 0; animation: pulse-dot 2s ease-in-out infinite; }
@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
.live-feed { display: flex; flex-direction: column; }
.live-entry { display: flex; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 12px; font-family: var(--mono); }
.live-entry-icon { font-size: 14px; width: 22px; text-align: center; flex-shrink: 0; }

/* ---- CHAT (Mein KI) ---- */
.chat-messages { display: flex; flex-direction: column; gap: 10px; min-height: 300px; max-height: 60vh; overflow-y: auto; padding: 14px; }
.chat-msg { display: flex; gap: 8px; }
.chat-user { justify-content: flex-end; }
.chat-bubble { background: var(--surface2); padding: 10px 14px; border-radius: 10px; max-width: 80%; white-space: pre-wrap; font-size: 13px; }
.chat-user .chat-bubble { background: var(--accent); color: #fff; }

/* ---- SIGNATURE ---- */
.sig-wrap canvas { border: 1px solid var(--border); border-radius: 8px; background: #fff; }

/* Disposition */
.disp-row { display: flex; gap: 6px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.disp-row:last-child { border-bottom: none; }
.disp-row:hover { background: var(--surface2); }
.disp-ai { border-left: 3px solid var(--yellow); background: rgba(234,179,8,.03); }
.disp-cell { flex-shrink: 0; }
.disp-nr { width: 60px; font-family: var(--mono); font-size: 12px; }
.disp-subject { flex: 1 1 140px; min-width: 0; }
.disp-mode-opt { display: flex; gap: 8px; align-items: center; padding: 12px 16px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600; transition: all .15s; }
.disp-mode-opt:hover { border-color: var(--accent); }
.disp-mode-opt.active { border-color: var(--accent); background: rgba(249,115,22,.1); }
.disp-mode-opt input { width: auto; min-height: auto; }
.disp-sug { padding: 0 10px 8px 10px; background: rgba(234,179,8,.05); border-bottom: 1px solid var(--border); }
.disp-sug-item { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 4px 0; font-size: 12px; }
.td-section { background: var(--surface); border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.td-section-title { padding: 8px 12px; font-weight: 700; font-size: 13px; background: var(--surface2); border-bottom: 1px solid var(--border); }

/* Notification Bell & Panel */
.notif-bell { position: relative; cursor: pointer; font-size: 18px; padding: 4px 8px; user-select: none; }
.notif-badge { position: absolute; top: -2px; right: 0; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; line-height: 16px; text-align: center; border-radius: 8px; padding: 0 4px; }
.notif-panel { position: absolute; top: 100%; right: 8px; width: 340px; max-height: 420px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.25); z-index: 999; }
.notif-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.notif-item { padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .15s; }
.notif-item:hover { background: var(--surface2); }
.notif-item.read { opacity: .5; }
@media(max-width:480px){ .notif-panel { width: calc(100vw - 16px); right: 4px; } }

/* Tabellen */
.tbl { border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 2px solid var(--border); }
.tbl td { padding: 6px 8px; border-bottom: 1px solid var(--border); }
.tbl tr:hover { background: var(--surface2); }
.tab-btn.active { color: var(--accent); border-bottom: 2px solid var(--accent); }

/* Chat Panel Mobile */
@media(max-width:480px){
  #chat-panel { width: calc(100vw - 16px) !important; right: 8px !important; bottom: 70px !important; max-height: 70vh !important; }
  #chat-btn { bottom: 10px !important; right: 10px !important; }
}

/* KI Typing Animation */
@keyframes ki-blink { 0%,100%{opacity:.2} 50%{opacity:1} }

/* Chat */
.chat-contact { display:flex; align-items:center; gap:6px; padding:10px 12px; cursor:pointer; font-size:13px; border-bottom:1px solid var(--border); transition:background .15s; }
.chat-contact:hover { background:var(--surface); }
.chat-contact.active { background:rgba(249,115,22,.12); color:var(--accent); font-weight:700; }
.chat-section { padding:8px 12px 4px; font-size:10px; color:var(--muted); text-transform:uppercase; letter-spacing:1px; font-weight:700; }
.chat-badge { background:var(--red); color:#fff; font-size:9px; font-weight:700; min-width:16px; height:16px; line-height:16px; text-align:center; border-radius:8px; padding:0 4px; margin-left:auto; }
@media(max-width:768px){
  .chat-contact { padding:14px 14px; font-size:15px; min-height:48px; }
  .chat-section { font-size:11px; padding:10px 14px 4px; }
  .chat-badge { font-size:11px; min-width:20px; height:20px; line-height:20px; }
}

/* Voice Assistant (minimal - nur Audio) */
