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

:root {
  /* Surfaces (calm dark) */
  --bg: #0e131a;
  --surface-1: #151b23;
  --surface-2: #1b2430;
  --surface-3: #222d3a;
  --surface-hover: #243040;

  /* Borders / lines */
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --border-accent: rgba(16, 185, 129, 0.35);

  /* Text */
  --text: #e6edf3;
  --text-muted: #9aa7b4;
  --text-faint: #6b7785;

  /* Accent */
  --accent: #10b981;
  --accent-2: #059669;
  --accent-soft: rgba(16, 185, 129, 0.14);

  /* Semantic */
  --info: #3b82f6;
  --warn: #f59e0b;
  --danger: #ef4444;
  --ok: #10b981;

  /* Spacing */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px;
  --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;

  /* Radius */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-pill: 999px;

  /* Elevation */
  --shadow-1: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-2: 0 4px 14px rgba(0,0,0,0.3);
  --shadow-3: 0 12px 32px rgba(0,0,0,0.4);

  /* Legacy aliases (Rueckwaertskompatibilitaet) */
  --dark-bg: var(--bg);
  --dark-card-bg: var(--surface-2);
  --dark-text: var(--text);
  --green-primary: var(--accent);
  --green-secondary: var(--accent-2);
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  --sidebar-w: 248px;
  --sidebar-w-collapsed: 72px;
}

body {
  font-family: 'Lato', system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 700px at 80% -10%, rgba(16,185,129,0.06), transparent 60%),
              radial-gradient(900px 600px at -10% 110%, rgba(59,130,246,0.05), transparent 55%),
              var(--bg);
  background-attachment: fixed;
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: rgba(26, 32, 44, 0.5);
}

::-webkit-scrollbar-thumb {
  background: var(--green-primary);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--green-secondary);
}

/* Text Selection */
::selection {
  background: rgba(16, 185, 129, 0.3);
  color: white;
}

/* Color Classes */
.bg-dark-grey { background-color: #616161 !important; }
.bg-light-grey { background-color: #f1f1f1 !important; }
.bg-white { background-color: #fff !important; }
.bg-black { background-color: #000 !important; }
.bg-green { background-color: #4CAF50 !important; }
.bg-teal { background-color: #009688 !important; }
.bg-blue { background-color: #2196F3 !important; }
.bg-blue-grey { background-color: #607D8B !important; }
.bg-red { background-color: #f44336 !important; }
.bg-yellow { background-color: #ffeb3b !important; }
.bg-amber { background-color: #ffc107 !important; }
.bg-orange { background-color: #ff9800 !important; }

.text-white { color: #fff !important; }
.text-black { color: #000 !important; }
.text-grey { color: #9e9e9e !important; }
.text-green { color: #4CAF50 !important; }
.text-red { color: #f44336 !important; }

/* Layout */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px;
}

.main-content {
  padding: var(--sp-5);
  max-width: 1320px;
  margin: 0 auto;
  width: 100%;
}

/* Navbar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, rgba(26, 32, 44, 0.98) 0%, rgba(17, 24, 39, 0.98) 100%);
  border-bottom: 1px solid rgba(16, 185, 129, 0.2);
  z-index: 199;
  display: flex;
  align-items: center;
  padding: 0 8px;
}

.navbar-brand {
  padding: 12px 16px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
}

.navbar-nav {
  display: flex;
  list-style: none;
}

.nav-link {
  padding: 16px 24px;
  color: var(--dark-text);
  text-decoration: none;
  transition: all 0.2s ease;
  border-radius: 6px;
}

.nav-link:hover {
  background: rgba(16, 185, 129, 0.2);
  color: var(--green-primary);
}

.nav-right {
  margin-left: auto;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-dark {
  background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
  color: #fff;
}

.btn-dark:hover {
  background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(74, 85, 104, 0.5);
}

.btn-green,
.btn-primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #fff !important;
  border: none !important;
}

.btn-green:hover,
.btn-primary:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.5);
}

.btn-teal {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
}

.btn-secondary {
  background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%) !important;
  color: #fff !important;
  border: none !important;
}

/* Table */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--dark-text) !important;
  background: transparent !important;
}

.table th,
.table td {
  padding: 8px 12px;
  text-align: left;
  border: 1px solid rgba(16, 185, 129, 0.2);
  background: transparent;
}

/* Remove borders between rowspan cells */
.table td[rowspan] {
  border-top: 1px solid rgba(16, 185, 129, 0.2);
  border-bottom: 1px solid rgba(16, 185, 129, 0.2);
  border-left: 1px solid rgba(16, 185, 129, 0.2);
  border-right: 1px solid rgba(16, 185, 129, 0.2);
}

.table th {
  background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
  color: var(--dark-text);
  font-weight: bold;
}

.table tbody {
  background: transparent;
}

.table-hover tbody tr {
  background: transparent;
}

.table-hover tbody tr:hover {
  background: transparent !important;
}

/* Spacer rows between tickets */
.spacer,
.spacer td {
  background: transparent !important;
  border: none !important;
}

/* Cards */
.card {
  background: rgba(45, 55, 72, 0.95) !important;
  border: 1px solid rgba(16, 185, 129, 0.2) !important;
  border-radius: 8px;
  margin-bottom: 16px;
  color: var(--dark-text) !important;
}

.card-header {
  padding: 12px 16px;
  background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
  color: #fff;
  font-weight: bold;
  border-bottom: 1px solid rgba(16, 185, 129, 0.2);
}

.card-body {
  padding: 16px;
  color: var(--dark-text);
}

/* Forms */
.form-control,
.form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 8px;
  font-size: 14px;
  background: rgba(31, 41, 55, 0.6) !important;
  color: var(--dark-text) !important;
  transition: all 0.2s ease;
}

.form-control::placeholder {
  color: rgba(226, 232, 240, 0.5);
}

.form-control:focus,
.form-select:focus {
  outline: none;
  border-color: var(--green-primary) !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
  background: rgba(31, 41, 55, 0.8) !important;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
  color: var(--dark-text);
}

select.form-control {
  background: rgba(31, 41, 55, 0.6) !important;
  color: var(--dark-text) !important;
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

/* Grid */
.row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -8px;
}

.col {
  padding: 0 8px;
}

.col-6 { width: 50%; }
.col-12 { width: 100%; }

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-small { font-size: 12px; }
.text-large { font-size: 18px; }
.text-xlarge { font-size: 24px; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.p-1 { padding: 8px; }
.p-2 { padding: 16px; }

.hidden { display: none; }

/* Ticket Row */
.ticket-row {
  border: none !important;
  background: transparent !important;
}

.ticket-row td {
  background: rgba(45, 55, 72, 0.95);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 0 !important;
}

/* Second row of ticket (no top border to avoid line in rowspan cells) */
.ticket-row + .ticket-row td {
  border-top: none;
}

.ticket-row:hover td {
  background: rgba(45, 55, 72, 0.95);
}

.ticket-row:hover {
  border: none;
  box-shadow: none;
}

/* Collapsed Ticket - All 4 outermost corners rounded */
/* WOID cell (left side) - top and bottom corners */
.ticket-collapsed .ticket-id {
  border-top-left-radius: 12px !important;
  border-bottom-left-radius: 12px !important;
}

/* Lock cell (right side) - top and bottom corners */
.ticket-collapsed td.bg-dark-grey {
  border-top-right-radius: 12px !important;
  border-bottom-right-radius: 12px !important;
}

/* Expanded Ticket - Only top 2 outermost corners rounded */
/* WOID cell (left side) - only top corner, bottom stays square */
.ticket-expanded .ticket-id {
  border-top-left-radius: 12px !important;
  border-bottom-left-radius: 0 !important;
}

/* Lock cell (right side) - only top corner, bottom stays square */
.ticket-expanded td.bg-dark-grey {
  border-top-right-radius: 12px !important;
  border-bottom-right-radius: 0 !important;
}

/* Worksheet Expansion with Animation */
.worksheet-expansion {
  animation: slideDown 0.4s ease-out;
}

.worksheet-cell {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
}

.worksheet-cell .card {
  border-radius: 0 0 12px 12px !important;
  margin-top: -1px;
  animation: fadeIn 0.4s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ticket-id {
  background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%) !important;
  color: #fff;
  text-align: center;
  vertical-align: middle;
  font-size: 18px;
  font-weight: bold;
  padding: 16px;
  border: 1px solid rgba(16, 185, 129, 0.2) !important;
  transition: border-radius 0.3s ease;
}

/* WOID rounded when collapsed, square bottom when expanded */
.ticket-id:not(.ticket-id-expanded) {
  border-radius: 12px;
}

.ticket-id-expanded {
  border-radius: 12px 12px 0 0;
}

.ticket-time {
  font-size: 11px;
  color: #a0aec0;
}

.ticket-info {
  background: rgba(31, 41, 55, 0.6) !important;
  font-size: 13px;
  color: var(--dark-text);
}

/* Status Colors (ruhiger, semantisch) */
.status-open { background: rgba(16,185,129,0.18) !important; color: #34d399 !important; }
.status-occupied { background: rgba(148,163,184,0.18) !important; color: #cbd5e0 !important; }
.status-assigned { background: rgba(20,184,166,0.18) !important; color: #2dd4bf !important; }
.status-awaiting { background: rgba(245,158,11,0.18) !important; color: #fbbf24 !important; }
.status-closed { background: rgba(148,163,184,0.14) !important; color: #94a3b8 !important; }

/* Priority Colors (ruhiger, semantisch) */
.priority-none { background: rgba(59,130,246,0.16) !important; color: #93c5fd !important; }
.priority-low { background: rgba(16,185,129,0.16) !important; color: #34d399 !important; }
.priority-medium { background: rgba(245,158,11,0.18) !important; color: #fbbf24 !important; }
.priority-high { background: rgba(249,115,22,0.18) !important; color: #fb923c !important; }
.priority-critical { background: rgba(239,68,68,0.18) !important; color: #f87171 !important; }

/* Dropdown */
.dropdown {
  position: relative;
  display: inline-block;
  width: 100%;
  text-align: center;
}

.dropdown .btn {
  width: 100%;
  padding: 6px 12px;
  font-size: 12px;
  border: none !important;
  box-shadow: none !important;
  background: inherit !important;
  color: inherit !important;
  text-align: center;
  display: inline-block;
  margin: 0;
}

.dropdown-content {
  display: none;
  position: absolute;
  background: rgba(45, 55, 72, 0.98);
  min-width: 160px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.4);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 6px;
  z-index: 100;
  left: 50%;
  transform: translateX(-50%);
}

.dropdown:hover .dropdown-content {
  display: block;
}

.dropdown-item {
  padding: 8px 16px;
  color: var(--dark-text);
  cursor: pointer;
  display: block;
  transition: background 0.2s ease;
}

.dropdown-item:hover {
  background: rgba(16, 185, 129, 0.2);
  color: var(--green-primary);
}

/* Modal/Overlay */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.95);
  z-index: 200;
  overflow-y: auto;
  padding: 60px 20px;
}

.overlay-close {
  position: absolute;
  top: 20px;
  right: 45px;
  font-size: 48px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.overlay-close:hover {
  color: var(--green-primary);
  transform: rotate(90deg);
}

.overlay-content {
  max-width: 1000px;
  margin: 0 auto;
  color: #fff;
}

.ticket-projects-overlay { padding: 24px; }
.ticket-projects-modal { width: 100%; max-width: none; min-height: calc(100vh - 48px); box-sizing: border-box; }
.ticket-projects-modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.ticket-projects-modal-header h2 { margin: 0; }
.ticket-projects-modal-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); gap: 24px; align-items: start; }
.ticket-projects-modal-section { background: rgba(45,55,72,0.65); border: 1px solid rgba(59,130,246,0.25); border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; }
.ticket-projects-modal-section h6 { font-weight: bold; margin: 0 0 12px; }
.ticket-projects-modal-side { display: flex; flex-direction: column; }
.ticket-projects-available-list { max-height: min(50vh, 520px); overflow-y: auto; margin-bottom: 8px; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 6px 16px; }
.ticket-projects-available-item { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; padding: 4px 0; }
.ticket-projects-create-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }
@media (max-width: 900px) {
  .ticket-projects-modal-grid { grid-template-columns: 1fr; }
  .ticket-projects-create-form { grid-template-columns: 1fr; }
  .ticket-projects-available-list { grid-template-columns: 1fr; }
}

.ticket-projects-overlay {
  padding: 24px;
}

.ticket-projects-modal {
  width: 100%;
  max-width: none;
  min-height: calc(100vh - 48px);
  box-sizing: border-box;
}

.ticket-projects-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.ticket-projects-modal-header h2 {
  margin: 0;
}

.ticket-projects-modal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr);
  gap: 24px;
  align-items: start;
}

.ticket-projects-modal-section {
  background: rgba(45, 55, 72, 0.65);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 16px;
}

.ticket-projects-modal-section h6 {
  font-weight: bold;
  margin: 0 0 12px;
}

.ticket-projects-modal-side {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ticket-projects-available-list {
  max-height: min(50vh, 520px);
  overflow-y: auto;
  margin-bottom: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 6px 16px;
}

.ticket-projects-available-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  cursor: pointer;
  padding: 4px 0;
}

.ticket-projects-create-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

@media (max-width: 900px) {
  .ticket-projects-modal-grid {
    grid-template-columns: 1fr;
  }

  .ticket-projects-create-form {
    grid-template-columns: 1fr;
  }

  .ticket-projects-available-list {
    grid-template-columns: 1fr;
  }
}

.modal-content {
  background: rgba(45, 55, 72, 0.98) !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
  color: var(--dark-text) !important;
}

/* Slider */
.slider-container {
  width: 100%;
  padding: 8px 0;
}

.slider {
  width: 100%;
  height: 8px;
  background: rgba(31, 41, 55, 0.6);
  border-radius: 8px;
  outline: none;
  transition: all 0.2s;
  -webkit-appearance: none;
}

.slider:hover {
  background: rgba(31, 41, 55, 0.8);
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
  transition: all 0.2s;
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.6);
}

.slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
  border: none;
  transition: all 0.2s;
}

.slider::-moz-range-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.6);
}

/* File Upload */
.drop-zone {
  background: #616161;
  border: 5px dashed #999;
  padding: 40px;
  text-align: center;
  color: #fff;
  cursor: pointer;
}

.drop-zone:hover {
  border-color: #4CAF50;
}

/* Spinner */
.spinner {
  border: 4px solid rgba(16, 185, 129, 0.2);
  border-top: 4px solid var(--green-primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Modern Card Style */
.modern-card {
  background: rgba(45, 55, 72, 0.95);
  border-radius: 12px;
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.modern-card:hover {
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

/* Unified Control Panel - No internal rounded corners */
.control-panel-section {
  padding: 16px;
  border-bottom: 1px solid rgba(16, 185, 129, 0.2);
}

.control-panel-section:last-child {
  border-bottom: none;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

.slide-in {
  animation: slideIn 0.3s ease-out;
}

/* Footer */
.footer {
  background: linear-gradient(135deg, rgba(26, 32, 44, 0.98) 0%, rgba(17, 24, 39, 0.98) 100%);
  border-top: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--dark-text);
  text-align: center;
  padding: 24px;
  margin-top: 32px;
}

/* Ticket-Detail Tabs */
.ticket-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(16, 185, 129, 0.2);
  padding-bottom: 8px;
}
.ticket-tab {
  background: rgba(45, 55, 72, 0.5);
  color: #cbd5e0;
  border: 1px solid rgba(16, 185, 129, 0.15);
  border-radius: 8px 8px 0 0;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.ticket-tab:hover {
  background: rgba(16, 185, 129, 0.12);
  color: var(--dark-text);
}
.ticket-tab-active {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  border-color: transparent;
}
.ticket-tab-content {
  min-height: 120px;
}

/* Responsive */
@media (max-width: 768px) {
  .col-6 { width: 100%; }
  .navbar-nav { display: none; }
  .ticket-tab { padding: 8px 12px; font-size: 13px; }
}

/* ============================================================= */
/* ===================  REDESIGN (Designsystem)  =============== */
/* ============================================================= */

/* --- App-Shell --- */
.app-shell { display: flex; height: 100vh; overflow: hidden; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.app-scroll { flex: 1; overflow-y: auto; }

/* --- Sidebar (fix, Labels sichtbar, gruppiert) --- */
.side {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--surface-1), var(--bg));
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width 0.2s ease;
}
.side.collapsed { width: var(--sidebar-w-collapsed); }
.side-head {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4); border-bottom: 1px solid var(--border);
  min-height: 64px;
}
.side-logo {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800;
}
.side-brand { font-weight: 800; font-size: 16px; letter-spacing: 0.2px; white-space: nowrap; }
.side-brand small { display: block; font-weight: 500; font-size: 11px; color: var(--text-muted); }
.side-nav { flex: 1; overflow-y: auto; padding: var(--sp-3) var(--sp-2); }
.side-group { margin-bottom: var(--sp-4); }
.side-group-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--text-faint); padding: 0 var(--sp-3) var(--sp-2);
}
.side.collapsed .side-group-label,
.side.collapsed .side-link-label,
.side.collapsed .side-brand { display: none; }
.side-link {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 10px var(--sp-3); margin: 2px var(--sp-1);
  border-radius: var(--r-sm); color: var(--text-muted);
  text-decoration: none; transition: all 0.15s ease; white-space: nowrap;
}
.side-link svg { width: 20px; height: 20px; flex-shrink: 0; }
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side-link.active svg { color: var(--accent); }
.side-foot { border-top: 1px solid var(--border); padding: var(--sp-3); }
.side-toggle {
  background: transparent; border: none; color: var(--text-muted);
  cursor: pointer; padding: var(--sp-2); border-radius: var(--r-sm);
  display: flex; align-items: center; gap: var(--sp-2); width: 100%;
}
.side-toggle:hover { background: var(--surface-2); color: var(--text); }

/* --- Page header + container --- */
.page { padding: var(--sp-5); max-width: 1320px; margin: 0 auto; width: 100%; }
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--sp-4); margin-bottom: var(--sp-5); flex-wrap: wrap;
}
.page-title { font-size: 24px; font-weight: 800; margin: 0; }
.page-subtitle { color: var(--text-muted); font-size: 14px; margin-top: 4px; }
.page-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* --- UI Card / Section --- */
.ui-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
}
.ui-card.pad { padding: var(--sp-4); }
.ui-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3); padding: var(--sp-4); border-bottom: 1px solid var(--border);
}
.ui-card-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.ui-card-body { padding: var(--sp-4); }

/* --- Buttons (Redesign-Varianten) --- */
.ui-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--r-sm); border: 1px solid transparent;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.15s ease;
  background: var(--surface-2); color: var(--text); text-decoration: none;
}
.ui-btn:hover { background: var(--surface-hover); }
.ui-btn-primary { background: var(--accent); color: #06231a; border-color: transparent; }
.ui-btn-primary:hover { background: #34d399; }
.ui-btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text-muted); }
.ui-btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.ui-btn-danger { background: rgba(239,68,68,0.15); color: #f87171; }
.ui-btn-danger:hover { background: rgba(239,68,68,0.25); }
.ui-btn-sm { padding: 6px 10px; font-size: 13px; }
.ui-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* --- Badges / Pills --- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; line-height: 1.4;
  background: var(--surface-2); color: var(--text-muted);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-info { background: rgba(59,130,246,0.16); color: #93c5fd; }
.badge-ok { background: rgba(16,185,129,0.16); color: #34d399; }
.badge-warn { background: rgba(245,158,11,0.18); color: #fbbf24; }
.badge-danger { background: rgba(239,68,68,0.18); color: #f87171; }
.badge-muted { background: var(--surface-2); color: var(--text-muted); }

/* --- KPI / Stat cards --- */
.kpi-grid {
  display: grid; gap: var(--sp-4);
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: var(--sp-5);
}
.kpi {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: var(--sp-4);
  display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden;
}
.kpi-accent { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.kpi-label { color: var(--text-muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.kpi-value { font-size: 28px; font-weight: 800; }
.kpi-sub { font-size: 12px; color: var(--text-faint); }
/* legacy dashboard stat classes -> new look */
.stats-grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); margin-bottom: var(--sp-5); }
.stat-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-4); display: flex; align-items: center; gap: var(--sp-4); }
.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 26px; font-weight: 800; }
.stat-label { color: var(--text-muted); font-size: 13px; }
.dashboard-section { margin-top: var(--sp-5); }
.quick-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-3); }

/* --- Ticket Card (ersetzt Tabelle) --- */
.tickets-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.tcard {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--r-md); overflow: visible; transition: border-color 0.15s ease;
}
.tcard:hover { border-color: var(--border-strong); }
.tcard.open { border-color: var(--border-accent); }
.tcard-detail { border-radius: 0 0 var(--r-md) var(--r-md); }
.tcard-main {
  display: grid; grid-template-columns: 92px 1fr auto; gap: var(--sp-4);
  padding: var(--sp-4); align-items: center; cursor: pointer;
}
.tcard-woid { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.tcard-woid .id { font-weight: 800; font-size: 15px; color: var(--accent); }
.tcard-woid .age { font-size: 11px; color: var(--text-faint); }
.tcard-body { min-width: 0; }
.tcard-row1 { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: 4px; }
.tcard-customer { font-weight: 700; }
.tcard-loc { color: var(--text-muted); font-size: 13px; }
.tcard-topic { color: var(--text-muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcard-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tcard-side { display: flex; align-items: center; gap: var(--sp-3); }
.tcard-detail { border-top: 1px solid var(--border); padding: var(--sp-4); background: var(--surface-1); }
.chevron { color: var(--text-muted); transition: transform 0.2s ease; }
.chevron.up { transform: rotate(180deg); }
@media (max-width: 720px) {
  .tcard-main { grid-template-columns: 64px 1fr; }
  .tcard-side { grid-column: 1 / -1; justify-content: space-between; }
}

/* --- Generic data list rows (Kunden/Finanzen/Dokumente) --- */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 12px var(--sp-4); border-bottom: 1px solid var(--border);
  transition: background 0.12s ease; text-decoration: none; color: var(--text);
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--surface-2); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .muted { color: var(--text-muted); font-size: 13px; }

/* --- Clean table (ohne rowSpan-Tricks) --- */
.ui-table { width: 100%; border-collapse: collapse; }
.ui-table th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--text-faint); font-weight: 600; padding: 10px var(--sp-3);
  border-bottom: 1px solid var(--border); background: transparent;
}
.ui-table td { padding: 11px var(--sp-3); border-bottom: 1px solid var(--border); font-size: 14px; }
.ui-table tbody tr:hover td { background: var(--surface-2); }

/* --- Segmented control / toolbar --- */
.toolbar { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: center; margin-bottom: var(--sp-4); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.seg button {
  border: none; background: transparent; color: var(--text-muted);
  padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600;
}
.seg button.active { background: var(--accent-soft); color: var(--accent); }
.search-input { flex: 1; min-width: 200px; }

/* --- Empty state --- */
.empty { text-align: center; color: var(--text-muted); padding: var(--sp-6) var(--sp-4); }
.empty .empty-icon { font-size: 32px; opacity: 0.5; margin-bottom: var(--sp-3); }

/* --- Field --- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--sp-3); }
.field label { font-size: 13px; font-weight: 600; color: var(--text-muted); }

/* --- Tab restyle (ruhiger) --- */
.ticket-tabs { border-bottom-color: var(--border); }
.ticket-tab { background: var(--surface-2); border-color: var(--border); color: var(--text-muted); }
.ticket-tab:hover { background: var(--surface-hover); color: var(--text); }
.ticket-tab-active { background: var(--accent); color: #06231a; }

/* --- Soften legacy cards/forms --- */
.card { background: var(--surface-1) !important; border: 1px solid var(--border) !important; border-radius: var(--r-md); }
.card-header { background: var(--surface-2); border-bottom: 1px solid var(--border); }
.modern-card { background: var(--surface-1); border: 1px solid var(--border); }
.modern-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.form-control, .form-select { background: var(--surface-2) !important; border: 1px solid var(--border) !important; border-radius: var(--r-sm); }
.form-control:focus, .form-select:focus { border-color: var(--accent) !important; box-shadow: 0 0 0 3px var(--accent-soft) !important; }
.footer { background: var(--surface-1); border-top: 1px solid var(--border); padding: var(--sp-4); margin-top: 0; }

/* --- Utilities --- */
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--sp-1); } .gap-2 { gap: var(--sp-2); } .gap-3 { gap: var(--sp-3); } .gap-4 { gap: var(--sp-4); }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.text-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.automatic-assignment-note {
  padding: 12px 14px;
  border-left: 2px solid var(--accent);
  background: var(--surface-2);
}
.automatic-assignment-note p {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}
