/* ============================================
   1. CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
  /* Primaerfarben (Industrie-Blau) */
  --color-primary:          #3B6E8F;
  --color-primary-dark:     #2C5570;
  --color-primary-light:    #5A8FAD;
  --color-primary-10:       #E8F0F5;
  --color-primary-5:        #F2F7FA;

  /* Akzentfarbe (Allways Rot - sparsam einsetzen) */
  --color-accent:           #E63312;
  --color-accent-dark:      #C42B0E;
  --color-accent-10:        #FDE8E4;

  /* Neutrale Farben */
  --color-black:            #1A1A1A;
  --color-bg:               #F4F7F9;
  --color-bg-white:         #FFFFFF;
  --color-surface:          #FFFFFF;
  --color-background:       #F4F7F9;

  /* Text */
  --color-text:             #333333;
  --color-text-secondary:   #666666;
  --color-text-light:       #666666;
  --color-text-muted:       #999999;

  /* Borders */
  --color-border:           #D8DEE4;
  --color-border-light:     #E8ECF0;

  /* Status-Farben (UNVERAENDERT) */
  --color-success:          #1B8C3A;
  --color-success-light:    #E8F5E9;
  --color-warning:          #E6A817;
  --color-warning-light:    #FFF8E1;
  --color-danger:           #D32F2F;
  --color-danger-light:     #FDECEA;
  --color-info:             #1565C0;
  --color-info-light:       #E3F2FD;
  --color-draft:            #757575;
  --color-draft-bg:         #F5F5F5;

  /* Layout */
  --sidebar-width: 260px;
  --font-family: 'Inter', Arial, Helvetica, sans-serif;
  --border-radius: 4px;
  --border-radius-lg: 8px;

  /* Schatten */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

  /* Radien */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Transitions */
  --transition-speed: 150ms;
  --transition-speed-slow: 300ms;
}

/* ============================================
   2. Base / Reset
   ============================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  color: var(--color-text);
  background: var(--color-bg);
  min-width: 1024px;
  line-height: 1.5;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1, h2, h3, h4 {
  color: var(--color-black);
  line-height: 1.3;
}

h1 { font-size: 1.75rem; font-weight: 300; letter-spacing: 1px; }
h2 { font-size: 1.375rem; font-weight: 700; }
h3 { font-size: 1.125rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }

/* ============================================
   3. Layout: Sidebar + Content
   ============================================ */
.app-layout {
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  background: #2C3E50;
  color: #ffffff;
  position: fixed;
  width: var(--sidebar-width);
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 3px solid var(--color-accent);
}

.sidebar-logo {
  display: flex;
  flex-direction: column;
}

.sidebar-logo-text {
  font-size: 1.125rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.025em;
}

.sidebar-logo-subtitle {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 2px;
}

.sidebar-brand-line {
  height: 3px;
  background: var(--color-accent);
  width: 40px;
  margin: 4px 0;
  border-radius: 1px;
}

/* --- Navigation --- */
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 8px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-radius: 0;
  cursor: pointer;
  transition: background var(--transition-speed), color var(--transition-speed);
  color: #CCCCCC;
  font-size: 0.875rem;
  font-weight: 500;
  user-select: none;
  text-decoration: none;
  border-left: 3px solid transparent;
}

.sidebar-nav-item:hover {
  background: rgba(59, 110, 143, 0.08);
  color: #ffffff;
  text-decoration: none;
}

.sidebar-nav-item.active {
  background: rgba(59, 110, 143, 0.15);
  color: #ffffff;
  font-weight: 600;
  border-left: 3px solid var(--color-primary);
}

.sidebar-nav-item svg,
.sidebar-nav-item i {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-spacer {
  flex: 1;
}

.sidebar-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 4px 16px;
}

/* --- Main Content --- */
.main-content {
  margin-left: var(--sidebar-width);
  padding: 24px 32px;
  min-height: 100vh;
  background: var(--color-bg);
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.content-header h1 {
  margin: 0;
}

.content-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ============================================
   4. Tables
   ============================================ */
.data-table-container {
  background: var(--color-bg-white);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-bg-white);
}

.data-table thead th {
  background: #2C3E50;
  color: #ffffff;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  position: relative;
}

.data-table thead th:hover {
  background: #34495E;
}

.data-table thead th.sort-asc::after {
  content: ' \25B2';
  font-size: 0.625rem;
}

.data-table thead th.sort-desc::after {
  content: ' \25BC';
  font-size: 0.625rem;
}

.data-table thead th.no-sort {
  cursor: default;
}

.data-table thead th.no-sort:hover {
  background: #2C3E50;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--color-border-light);
  transition: background var(--transition-speed);
}

.data-table tbody tr:nth-child(even) {
  background: #F8FAFB;
}

.data-table tbody tr:hover {
  background: var(--color-primary-5);
}

.data-table tbody td {
  padding: 8px 12px;
  vertical-align: middle;
  font-size: 0.875rem;
}

.data-table td.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: 'Inter', monospace;
}

.data-table td.actions {
  white-space: nowrap;
  text-align: right;
}

.data-table td.actions .btn {
  margin-left: 4px;
}

.data-table .empty-row td {
  text-align: center;
  padding: 40px 12px;
  color: var(--color-text-muted);
  font-style: italic;
}

/* Table Toolbar (Search/Filter) */
.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border-light);
  gap: 12px;
  flex-wrap: wrap;
}

.table-toolbar .search-input {
  flex: 1;
  min-width: 200px;
  max-width: 400px;
}

.table-toolbar .filter-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ============================================
   5. Forms
   ============================================ */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--color-text);
  font-size: 0.875rem;
}

.form-label .required {
  color: var(--color-danger);
  margin-left: 2px;
}

.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  font-family: var(--font-family);
  font-size: 0.875rem;
  color: var(--color-text);
  background: var(--color-bg-white);
  transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 110, 143, 0.1);
}

.form-input::placeholder {
  color: var(--color-text-muted);
}

.form-input.is-invalid,
.form-select.is-invalid,
.form-textarea.is-invalid {
  border-color: var(--color-danger);
}

.form-input.is-invalid:focus,
.form-select.is-invalid:focus,
.form-textarea.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.1);
}

.form-error {
  color: var(--color-danger);
  font-size: 0.75rem;
  margin-top: 4px;
}

.form-hint {
  color: var(--color-text-light);
  font-size: 0.75rem;
  margin-top: 4px;
}

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

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23718096' d='M6 8.825a.5.5 0 01-.354-.146l-4-4a.5.5 0 11.708-.708L6 7.617l3.646-3.646a.5.5 0 11.708.708l-4 4A.5.5 0 016 8.825z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group {
  flex: 1;
}

.form-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-border-light);
}

.form-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.form-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 16px;
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

/* ============================================
   6. Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--border-radius);
  font-family: var(--font-family);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-speed);
  border: none;
  line-height: 1.4;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--color-primary);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-dark);
}

.btn-accent {
  background: var(--color-accent);
  color: #ffffff;
}

.btn-accent:hover:not(:disabled) {
  background: var(--color-accent-dark);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.btn-secondary:hover:not(:disabled) {
  background: #F5F5F5;
  border-color: var(--color-text-light);
}

.btn-danger {
  background: var(--color-danger);
  color: #ffffff;
}

.btn-danger:hover:not(:disabled) {
  background: #c53030;
}

.btn-success {
  background: var(--color-success);
  color: #ffffff;
}

.btn-success:hover:not(:disabled) {
  background: #2f855a;
}

.btn-warning {
  background: var(--color-warning);
  color: #ffffff;
}

.btn-warning:hover:not(:disabled) {
  background: #b7791f;
}

.btn-ghost {
  background: transparent;
  color: var(--color-primary);
  padding: 6px 8px;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--color-primary-5);
  color: var(--color-primary-dark);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
}

.btn-icon {
  padding: 6px;
  width: 32px;
  height: 32px;
}

.btn-icon.btn-sm {
  width: 28px;
  height: 28px;
  padding: 4px;
}

.btn-group {
  display: flex;
  gap: 8px;
}

/* ============================================
   7. Status Badges
   ============================================ */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* Angebot Status */
.badge-draft {
  background: var(--color-draft-bg);
  color: var(--color-draft);
}

.badge-sent {
  background: var(--color-primary-5);
  color: var(--color-primary);
}

.badge-negotiation {
  background: #fefcbf;
  color: #975a16;
}

.badge-accepted {
  background: #f0fff4;
  color: #276749;
}

.badge-rejected {
  background: #fff5f5;
  color: #c53030;
}

.badge-expired {
  background: #fffaf0;
  color: #c05621;
}

/* Rechnungs Status */
.badge-paid {
  background: #f0fff4;
  color: #276749;
}

.badge-partial_paid {
  background: #fefcbf;
  color: #975a16;
}

.badge-overdue {
  background: #fff5f5;
  color: #c53030;
}

.badge-cancelled {
  background: var(--color-draft-bg);
  color: var(--color-draft);
}

/* Liefer Status */
.badge-pending {
  background: var(--color-draft-bg);
  color: var(--color-draft);
}

.badge-in_production {
  background: var(--color-primary-5);
  color: var(--color-primary);
}

.badge-shipped {
  background: #fefcbf;
  color: #975a16;
}

.badge-delivered {
  background: #f0fff4;
  color: #276749;
}

/* ============================================
   8. Modal / Slide-in Panel
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--color-bg-white);
  border-radius: var(--border-radius-lg);
  max-width: 640px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  transform: translateY(-20px);
  transition: transform 200ms ease;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-content-lg {
  max-width: 900px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border-light);
}

.modal-header h2 {
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-light);
  padding: 4px;
  border-radius: var(--border-radius);
  transition: color var(--transition-speed), background var(--transition-speed);
}

.modal-close:hover {
  color: var(--color-text);
  background: #F5F5F5;
}

.modal-close svg {
  width: 20px;
  height: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border-light);
}

/* Slide Panel */
.slide-panel {
  position: fixed;
  top: 0;
  right: -520px;
  width: 520px;
  height: 100vh;
  background: var(--color-bg-white);
  z-index: 1000;
  transition: right var(--transition-speed-slow) ease;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  padding: 24px;
}

.slide-panel.active {
  right: 0;
}

.slide-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.slide-panel-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.slide-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border-light);
}

/* ============================================
   9. KPI Cards
   ============================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--color-bg-white);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--color-primary);
  transition: box-shadow var(--transition-speed);
}

.kpi-card:hover {
  box-shadow: var(--shadow-md);
}

.kpi-card-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-light);
  margin-bottom: 8px;
}

.kpi-card-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.2;
}

.kpi-card-subtitle {
  font-size: 0.8125rem;
  color: var(--color-text-light);
  margin-top: 4px;
}

.kpi-card.success {
  border-left-color: var(--color-success);
}

.kpi-card.warning {
  border-left-color: var(--color-warning);
}

.kpi-card.danger {
  border-left-color: var(--color-danger);
}

/* ============================================
   10. Kanban Board
   ============================================ */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: 400px;
}

.kanban-column {
  min-width: 260px;
  flex: 1;
  background: #F5F5F5;
  border-radius: var(--border-radius-lg);
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.kanban-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 4px;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-text);
}

.kanban-column-count {
  background: rgba(0, 0, 0, 0.1);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 700;
}

.kanban-column-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
}

.kanban-column-body.drag-over {
  background: rgba(59, 110, 143, 0.08);
  border-radius: var(--border-radius);
  border: 2px dashed var(--color-primary);
}

.kanban-card {
  background: var(--color-bg-white);
  border-radius: var(--border-radius);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  transition: box-shadow var(--transition-speed), transform var(--transition-speed);
  border: 1px solid var(--color-border-light);
}

.kanban-card:hover {
  box-shadow: var(--shadow-md);
}

.kanban-card.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}

.kanban-card-title {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 4px;
}

.kanban-card-subtitle {
  font-size: 0.8125rem;
  color: var(--color-text-light);
}

.kanban-card-amount {
  font-weight: 700;
  font-size: 0.875rem;
  margin-top: 8px;
  color: var(--color-primary);
}

.kanban-card-date {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* ============================================
   11. Notifications (Toast)
   ============================================ */
.notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.notification {
  padding: 12px 20px;
  border-radius: var(--border-radius);
  color: #ffffff;
  font-weight: 500;
  font-size: 0.875rem;
  box-shadow: var(--shadow-lg);
  transform: translateX(calc(100% + 20px));
  transition: transform var(--transition-speed-slow) ease;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 400px;
}

.notification.show {
  transform: translateX(0);
}

.notification-success {
  background: var(--color-success);
}

.notification-error {
  background: var(--color-danger);
}

.notification-warning {
  background: var(--color-warning);
}

.notification-info {
  background: var(--color-info);
}

/* ============================================
   12. Confirm Dialog
   ============================================ */
.confirm-dialog {
  max-width: 420px;
  text-align: center;
}

.confirm-dialog p {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  margin-bottom: 24px;
}

.confirm-dialog-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* ============================================
   13. Timeline / Activity Log
   ============================================ */
.timeline {
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-border);
}

.timeline-item {
  position: relative;
  padding-bottom: 20px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 2px solid var(--color-bg-white);
}

.timeline-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.timeline-item-title {
  font-weight: 600;
  font-size: 0.875rem;
}

.timeline-item-date {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.timeline-item-body {
  font-size: 0.875rem;
  color: var(--color-text-light);
}

/* ============================================
   14. Cards & Panels
   ============================================ */
.card {
  background: var(--color-bg-white);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border-light);
}

.card-header h3 {
  margin: 0;
}

/* ============================================
   15. Search Input
   ============================================ */
.search-input-wrapper {
  position: relative;
}

.search-input-wrapper svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
  pointer-events: none;
}

.search-input-wrapper .form-input {
  padding-left: 36px;
}

/* ============================================
   16. Tabs (Inline)
   ============================================ */
.inline-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 20px;
}

.inline-tab {
  padding: 10px 20px;
  cursor: pointer;
  font-weight: 500;
  color: var(--color-text-light);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition-speed);
}

.inline-tab:hover {
  color: var(--color-text);
}

.inline-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 600;
}

/* ============================================
   17. Placeholder / Empty State
   ============================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-state svg {
  width: 64px;
  height: 64px;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

.empty-state-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 8px;
}

.empty-state-description {
  font-size: 0.875rem;
  color: var(--color-text-light);
  max-width: 400px;
  margin-bottom: 20px;
}

/* ============================================
   18. Utility Classes
   ============================================ */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-muted { color: var(--color-text-light); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mr-2 { margin-right: 8px; }
.ml-2 { margin-left: 8px; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   19. Pagination
   ============================================ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  padding: 16px;
}

.pagination-btn {
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-white);
  color: var(--color-text);
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 0.875rem;
  transition: all var(--transition-speed);
}

.pagination-btn:hover:not(:disabled) {
  background: #F5F5F5;
}

.pagination-btn.active {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============================================
   20. Scrollbar
   ============================================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ============================================
   21. Offer/Invoice Editor
   ============================================ */

/* Sticky action bar */
.editor-action-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-bg);
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border-light);
  margin-bottom: 20px;
}

/* Position table inline editing */
.position-table-editor {
  width: 100%;
  border-collapse: collapse;
}

.position-table-editor thead th {
  background: #2C3E50;
  color: #fff;
  padding: 8px 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-align: left;
  white-space: nowrap;
}

.position-table-editor thead th.numeric {
  text-align: right;
}

.position-table-editor tbody td {
  padding: 4px 4px;
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: middle;
  font-size: 0.8125rem;
}

.position-table-editor tbody td.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.position-table-editor td input,
.position-table-editor td select {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  font-size: 0.8125rem;
  font-family: inherit;
  background: #fff;
}

.position-table-editor td input:focus,
.position-table-editor td select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(59, 110, 143, 0.15);
}

.position-table-editor td input.input-narrow {
  width: 70px;
}

.position-table-editor td input.input-price {
  width: 90px;
  text-align: right;
}

.position-table-editor td input[readonly] {
  background: #F5F5F5;
  color: var(--color-text-light);
  border-color: transparent;
}

/* Option row styling */
.position-row-option {
  background: #f8f9fb !important;
}

.position-row-option:hover {
  background: #eef1f6 !important;
}

.position-row-option td:first-child {
  padding-left: 24px;
  color: var(--color-text-light);
}

.position-row-main {
  background: #fff;
}

.position-row-main:hover {
  background: #F5F5F5;
}

/* Summary table */
.offer-summary-table {
  margin-left: auto;
  width: 380px;
  border-collapse: collapse;
}

.offer-summary-table td {
  padding: 6px 10px;
  font-size: 0.875rem;
}

.offer-summary-table td:first-child {
  text-align: right;
  color: var(--color-text-light);
}

.offer-summary-table td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
  min-width: 130px;
}

.offer-summary-table .total-row td {
  font-weight: 700;
  font-size: 1.125rem;
  border-top: 2px solid var(--color-primary);
  padding-top: 10px;
  color: var(--color-text);
}

.offer-summary-table .margin-row td {
  color: var(--color-text-light);
  font-style: italic;
  font-size: 0.8125rem;
  border-top: 1px dashed var(--color-border-light);
  padding-top: 8px;
}

.offer-summary-table .discount-row {
  color: var(--color-danger, #e53e3e);
}

/* Customer address block in editor */
.customer-address-block {
  background: #F5F5F5;
  border: 1px solid var(--color-border-light);
  border-radius: 6px;
  padding: 12px 16px;
  font-size: 0.875rem;
  line-height: 1.6;
  margin-top: 8px;
  min-height: 60px;
}

.customer-address-block .company-name {
  font-weight: 600;
}

/* Editor section spacing */
.editor-section {
  margin-bottom: 24px;
}

.editor-section-title {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-light);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border-light);
}

/* Position actions */
.position-actions {
  display: flex;
  gap: 2px;
  white-space: nowrap;
}

.position-actions .btn {
  padding: 2px 6px;
  font-size: 0.75rem;
}

/* Add position button area */
.add-position-bar {
  padding: 12px;
  border: 2px dashed var(--color-border);
  border-radius: 6px;
  text-align: center;
  margin-top: 8px;
  background: #fafbfc;
}

.add-position-bar:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-5);
}

/* Read-only position table (detail view) */
.position-table-readonly {
  width: 100%;
  border-collapse: collapse;
}

.position-table-readonly thead th {
  background: #2C3E50;
  color: #fff;
  padding: 10px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-align: left;
}

.position-table-readonly thead th.numeric {
  text-align: right;
}

.position-table-readonly tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border-light);
  font-size: 0.8125rem;
}

.position-table-readonly tbody td.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.position-table-readonly .option-row {
  background: #f8f9fb;
}

.position-table-readonly .option-row td:first-child {
  padding-left: 28px;
  color: var(--color-text-light);
}

/* Payment tracking */
.payment-info {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.payment-info-item {
  text-align: center;
  padding: 16px;
  border-radius: 8px;
  background: #F5F5F5;
}

.payment-info-item .label {
  font-size: 0.75rem;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.payment-info-item .amount {
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.payment-info-item .amount.paid {
  color: var(--color-success, #38a169);
}

.payment-info-item .amount.remaining {
  color: var(--color-danger, #e53e3e);
}

/* ============================================
   22. Chart Container
   ============================================ */
.chart-container {
  position: relative;
  width: 100%;
}

/* ============================================
   23. Kanban Column Color Accents
   ============================================ */
.kanban-column-body[data-status="draft"] { border-top: 3px solid #a0aec0; }
.kanban-column-body[data-status="sent"] { border-top: 3px solid #63b3ed; }
.kanban-column-body[data-status="negotiation"] { border-top: 3px solid #ecc94b; }
.kanban-column-body[data-status="accepted"] { border-top: 3px solid #68d391; }
.kanban-column-body[data-status="paid"] { border-top: 3px solid #68d391; }
.kanban-column-body[data-status="delivered"] { border-top: 3px solid #68d391; }
.kanban-column-body[data-status="rejected"] { border-top: 3px solid #fc8181; }
.kanban-column-body[data-status="overdue"] { border-top: 3px solid #fc8181; }
.kanban-column-body[data-status="partial_paid"] { border-top: 3px solid #ecc94b; }
.kanban-column-body[data-status="cancelled"] { border-top: 3px solid #a0aec0; }
.kanban-column-body[data-status="pending"] { border-top: 3px solid #a0aec0; }
.kanban-column-body[data-status="in_production"] { border-top: 3px solid #63b3ed; }
.kanban-column-body[data-status="shipped"] { border-top: 3px solid #ecc94b; }

/* ============================================
   24. CRM Activity Styles
   ============================================ */
.activity-icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }
.activity-icon-call { background: var(--color-info-light); color: var(--color-info); }
.activity-icon-email { background: #ebf4ff; color: var(--color-primary); }
.activity-icon-meeting { background: var(--color-warning-light); color: var(--color-warning); }
.activity-icon-note { background: #F5F5F5; color: var(--color-text-light); }
.activity-icon-status_change { background: var(--color-success-light); color: var(--color-success); }
.activity-icon-reminder { background: var(--color-danger-light); color: var(--color-danger); }

.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border-light);
  align-items: flex-start;
}

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

.timeline-item-content {
  flex: 1;
  min-width: 0;
}

.timeline-item-subject {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 2px;
}

.timeline-item-meta {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.timeline-item-date {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  padding-top: 2px;
}

/* ============================================
   25. Dashboard Grid
   ============================================ */
.dashboard-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 1100px) {
  .dashboard-grid-2 {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   26. Task List (Pending Actions)
   ============================================ */
.task-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border-light);
}

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

.task-item-date {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-primary);
  min-width: 90px;
  flex-shrink: 0;
}

.task-item-text {
  font-size: 0.875rem;
  color: var(--color-text);
  flex: 1;
}

.task-item-ref {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.task-item.overdue .task-item-date {
  color: var(--color-danger);
}

/* ============================================
   27. CRM Filter Toolbar
   ============================================ */
.crm-filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  flex: 1;
}

.crm-filter-group select,
.crm-filter-group input[type="date"] {
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  font-size: 0.8125rem;
  font-family: inherit;
  background: var(--color-bg-white);
  min-width: 140px;
}

.crm-filter-group select:focus,
.crm-filter-group input[type="date"]:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(59, 110, 143, 0.15);
}

/* ========================================
   28. SETTINGS - Logo Preview
   ======================================== */

.logo-preview-container {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-top: 8px;
}

.logo-preview {
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: 12px;
  background: var(--color-bg-white);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  min-height: 60px;
}

.logo-preview img {
  aspect-ratio: 900 / 232;
  object-fit: contain;
  width: 100%;
  height: auto;
  max-width: 300px;
}

/* Logo Seitenverhaeltnis-Sperre (900x232px = 3.88:1) */
.logo-img,
.sidebar-logo img {
  aspect-ratio: 900 / 232;
  object-fit: contain;
  width: 100%;
  height: auto;
  max-width: 180px;
}

.login-logo img,
.login-logo-img {
  aspect-ratio: 900 / 232;
  object-fit: contain;
  width: 100%;
  height: auto;
  max-width: 280px;
}

.logo-upload-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.logo-upload-area .btn {
  align-self: flex-start;
}

.logo-placeholder {
  color: var(--color-text-muted);
  font-size: 0.8125rem;
  font-style: italic;
}

/* ========================================
   29. SETTINGS - Input with Suffix
   ======================================== */

.input-with-suffix {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-with-suffix .form-input {
  flex: 0 0 auto;
  width: 120px;
}

.input-suffix {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  white-space: nowrap;
}

/* ========================================
   30. SETTINGS - Info Box
   ======================================== */

.info-box {
  background: var(--color-info-light);
  border: 1px solid #90CAF9;
  border-left: 4px solid var(--color-info);
  border-radius: var(--border-radius);
  padding: 12px 16px;
  margin-top: 12px;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.info-box strong {
  color: var(--color-text-primary);
}

/* ========================================
   31. SETTINGS - Actions Bar
   ======================================== */

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 20px;
  margin-top: 20px;
  border-top: 1px solid var(--color-border);
}

/* ========================================
   32. RESPONSIVE - Breakpoints
   ======================================== */

@media (max-width: 1024px) {
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }

  .kanban-board {
    overflow-x: auto;
  }
}

@media (max-width: 768px) {
  .form-row {
    flex-direction: column;
  }

  .dashboard-grid-2 {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .kanban-board {
    min-width: 800px;
  }

  .sidebar {
    width: 60px;
  }

  .sidebar-nav-item span,
  .sidebar-logo-text,
  .sidebar-logo-subtitle {
    display: none;
  }

  .main-content {
    margin-left: 60px;
  }

  .inline-tabs {
    flex-wrap: wrap;
  }
}

/* ============================================
   22. Login & Auth Styles
   ============================================ */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #2C3E50;
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-img {
  max-width: 200px;
  height: auto;
  display: inline-block;
}

.login-logo-title {
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--color-primary);
  margin-bottom: 4px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.login-logo-subtitle {
  font-size: 0.875rem;
  color: #718096;
}

.login-error {
  background: #fff5f5;
  border-left: 4px solid #e53e3e;
  color: #c53030;
  padding: 12px 16px;
  border-radius: 0 6px 6px 0;
  margin-bottom: 20px;
  font-size: 0.875rem;
  display: none;
}

.login-error.visible {
  display: block;
}

.login-form .form-group {
  margin-bottom: 20px;
}

.login-form .form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #2d3748;
  margin-bottom: 6px;
}

.login-form .form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.9375rem;
  color: #2d3748;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.login-form .form-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(59, 110, 143, 0.15);
}

.password-input-wrapper {
  position: relative;
}

.password-input-wrapper .form-input {
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #a0aec0;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.password-toggle:hover {
  color: #2d3748;
}

.login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  cursor: pointer;
}

.login-remember input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.btn-login {
  width: 100%;
  padding: 12px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-login:hover {
  background: var(--color-primary-dark);
}

.btn-login:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.login-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: none;
}

.btn-login.loading .login-spinner {
  display: block;
}

.btn-login.loading .login-btn-text {
  display: none;
}

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

.login-footer {
  text-align: center;
  margin-top: 32px;
  font-size: 0.75rem;
  color: #a0aec0;
}

/* Password Strength Bar */
.password-strength {
  margin-top: 8px;
}

.password-strength-bar {
  height: 4px;
  border-radius: 2px;
  background: #e2e8f0;
  overflow: hidden;
  margin-bottom: 4px;
}

.password-strength-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s, background-color 0.3s;
  width: 0;
}

.password-strength-fill.strength-0 { width: 0; background: #e2e8f0; }
.password-strength-fill.strength-1 { width: 25%; background: #e53e3e; }
.password-strength-fill.strength-2 { width: 50%; background: #dd6b20; }
.password-strength-fill.strength-3 { width: 75%; background: #d69e2e; }
.password-strength-fill.strength-4 { width: 100%; background: #38a169; }

.password-strength-label {
  font-size: 0.75rem;
  color: #718096;
}

/* Setup Wizard */
.setup-wizard-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-black);
  margin-bottom: 8px;
  text-align: center;
}

.setup-wizard-desc {
  font-size: 0.875rem;
  color: #718096;
  text-align: center;
  margin-bottom: 28px;
  line-height: 1.5;
}

.setup-requirements {
  background: #F5F5F5;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
}

.setup-requirements ul {
  margin: 8px 0 0 0;
  padding-left: 20px;
}

.setup-requirements li {
  margin-bottom: 4px;
}

.setup-requirements li.valid {
  color: #38a169;
}

.setup-requirements li.invalid {
  color: #a0aec0;
}

/* Password Change Dialog */
.password-change-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.password-change-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  padding: 32px;
  width: 100%;
  max-width: 400px;
}

.password-change-card h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-black);
  margin-bottom: 20px;
}

/* Sidebar User Info & Logout */
.sidebar-user-info {
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.7);
}

.sidebar-user-name {
  font-weight: 600;
  color: #fff;
  display: block;
  margin-bottom: 2px;
}

.sidebar-user-role {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  text-transform: capitalize;
}

.sidebar-nav-item.logout-item {
  color: rgba(255, 255, 255, 0.6);
  margin-top: 4px;
}

.sidebar-nav-item.logout-item:hover {
  background: rgba(229, 62, 62, 0.2);
  color: #fc8181;
}

/* Inactivity Warning Dialog */
.inactivity-warning-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.inactivity-warning-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  padding: 32px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.inactivity-warning-icon {
  color: #dd6b20;
  margin-bottom: 16px;
}

.inactivity-warning-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-black);
  margin-bottom: 8px;
}

.inactivity-warning-text {
  font-size: 0.875rem;
  color: #718096;
  margin-bottom: 24px;
  line-height: 1.5;
}

.inactivity-warning-countdown {
  font-size: 1.5rem;
  font-weight: 700;
  color: #dd6b20;
  margin-bottom: 24px;
}

.inactivity-warning-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.inactivity-warning-actions .btn {
  min-width: 140px;
}

/* Responsive: Login Card auf kleinen Screens */
@media (max-width: 480px) {
  .login-card {
    padding: 24px;
  }

  .login-logo-title {
    font-size: 1.25rem;
  }
}

/* ============================================
   23. User Management Styles
   ============================================ */

/* --- Aktions-Menue (Kontextmenue) --- */
.action-menu {
  position: absolute;
  right: 0;
  top: 100%;
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  min-width: 200px;
  padding: 4px 0;
}

.action-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--color-text);
  transition: background var(--transition-speed);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.action-menu-item:hover {
  background: #F5F5F5;
}

.action-menu-item.danger {
  color: var(--color-danger);
}

.action-menu-item.danger:hover {
  background: var(--color-danger-light);
}

.action-menu-divider {
  height: 1px;
  background: var(--color-border-light);
  margin: 4px 0;
}

.action-menu-item svg,
.action-menu-item i {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* --- Rollen-Badges --- */
.badge-superadmin { background: #2d3748; color: #fff; }
.badge-admin { background: #3182ce; color: #fff; }
.badge-user { background: #718096; color: #fff; }
.badge-viewer { background: #a0aec0; color: #fff; }
.badge-active { background: var(--color-success-light); color: var(--color-success); }
.badge-inactive { background: var(--color-danger-light); color: var(--color-danger); }

/* --- Berechtigungs-Matrix --- */
.permission-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.permission-matrix thead th {
  background: #F5F5F5;
  padding: 10px 12px;
  text-align: center;
  font-weight: 600;
  font-size: 0.8125rem;
  border-bottom: 2px solid var(--color-border);
}

.permission-matrix thead th:first-child {
  text-align: left;
}

.permission-matrix tbody td {
  padding: 10px 12px;
  text-align: center;
  border-bottom: 1px solid var(--color-border-light);
}

.permission-matrix tbody td:first-child {
  text-align: left;
  font-weight: 500;
}

.permission-matrix tbody tr:hover {
  background: #F5F5F5;
}

.permission-matrix input[type="radio"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--color-primary);
}

.permission-matrix .level-disabled {
  color: var(--color-text-muted);
  font-size: 0.75rem;
}

/* --- Sidebar User Dropdown --- */
.sidebar-user-info {
  position: relative;
  cursor: pointer;
}

.sidebar-user-info:hover {
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-user-dropdown {
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 0;
}

.sidebar-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: background var(--transition-speed), color var(--transition-speed);
  text-decoration: none;
}

.sidebar-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  text-decoration: none;
}

.sidebar-dropdown-item svg,
.sidebar-dropdown-item i {
  width: 16px;
  height: 16px;
}

.sidebar-dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 4px 16px;
}

.sidebar-dropdown-logout:hover {
  background: rgba(229, 62, 62, 0.2);
  color: #fc8181;
}

/* --- Passwort-Auto-Generator --- */
.generated-password-display {
  background: #F5F5F5;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: 12px 16px;
  font-family: monospace;
  font-size: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0;
}

.generated-password-display .btn-copy {
  cursor: pointer;
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: 0.8125rem;
  padding: 4px 8px;
}

.generated-password-display .btn-copy:hover {
  text-decoration: underline;
}

/* --- EK-Preis Checkbox Hervorhebung --- */
.permission-special-flag {
  background: #fefcbf;
  border: 1px solid #d69e2e;
  border-radius: var(--border-radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* --- Relative Position fuer Action-Menu Anchor --- */
.data-table td.actions-cell {
  position: relative;
}

/* --- Template-Auswahl im Permissions-Modal --- */
.permission-template-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: #F5F5F5;
  border-radius: var(--border-radius);
}

.permission-template-row select {
  flex: 1;
}

/* --- Profil-Modal --- */
.profile-field {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border-light);
  font-size: 0.875rem;
}

.profile-field-label {
  color: var(--color-text-light);
  font-weight: 500;
}

.profile-field-value {
  color: var(--color-text);
}

/* --- Passwort-Radio-Optionen --- */
.password-option-group {
  margin: 12px 0;
}

.password-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  cursor: pointer;
}

.password-option input[type="radio"] {
  accent-color: var(--color-primary);
}

.password-manual-field {
  padding-left: 24px;
  margin-top: 4px;
}

/* ============================================
   Audit Log Styles
   ============================================ */

.audit-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.audit-filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.audit-filter-group label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.audit-filter-group .form-input,
.audit-filter-group .form-select {
  min-width: 140px;
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
}

.audit-filter-actions {
  display: flex;
  align-items: flex-end;
  margin-left: auto;
}

/* Audit Badges */
.audit-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.4;
}

.audit-badge-info {
  background-color: var(--color-info-light);
  color: var(--color-info);
}

.audit-badge-success {
  background-color: var(--color-success-light);
  color: var(--color-success);
}

.audit-badge-warning {
  background-color: var(--color-warning-light);
  color: var(--color-warning);
}

.audit-badge-danger {
  background-color: var(--color-danger-light);
  color: var(--color-danger);
}

/* Audit Table */
.audit-table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.audit-table td {
  font-size: 0.85rem;
  vertical-align: middle;
}

.audit-timestamp {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  color: var(--color-text-light);
}

.audit-entity-id {
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  color: var(--color-text-light);
}

.audit-details-cell {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
  color: var(--color-text-light);
}

/* Audit Pagination */
.audit-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--color-border-light);
}

.audit-pagination-info {
  font-size: 0.8rem;
  color: var(--color-text-light);
}

.audit-pagination-btns {
  display: flex;
  gap: 0.25rem;
}

.audit-pagination-btns .btn {
  padding: 0.3rem 0.5rem;
  min-width: unset;
}

/* Audit Timeline (User-Profil) */
.audit-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.audit-timeline-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--color-border-light);
}

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

.audit-timeline-time {
  font-size: 0.8rem;
  color: var(--color-text-light);
  font-variant-numeric: tabular-nums;
}

.audit-timeline-detail {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* ============================================
   Task Styles
   ============================================ */

.task-filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 1.5rem;
  align-items: center;
}

.task-filter-bar .form-select {
  width: 200px;
}

.task-filter-bar .form-input {
  flex: 1;
  max-width: 300px;
}

/* Task Groups */
.task-group {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
}

.task-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}

.task-group-count {
  background: var(--color-text-muted);
  color: white;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.task-group-overdue .task-group-header {
  background: #fff5f5;
  color: #c53030;
  border-bottom-color: #fed7d7;
}
.task-group-overdue .task-group-count {
  background: #c53030;
}

.task-group-today .task-group-header {
  background: #fffff0;
  color: #b7791f;
  border-bottom-color: #fefcbf;
}
.task-group-today .task-group-count {
  background: #d69e2e;
}

.task-group-week .task-group-header {
  background: #f0fff4;
  color: #276749;
  border-bottom-color: #c6f6d5;
}
.task-group-week .task-group-count {
  background: #38a169;
}

.task-group-completed .task-group-header {
  background: var(--color-bg);
  color: var(--color-text-muted);
}

/* Task Item (Row) */
.task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-border-light);
  transition: background 0.15s;
}

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

.task-item:hover {
  background: var(--color-bg);
}

.task-item.completed {
  opacity: 0.55;
}

.task-item.completed .task-subject {
  text-decoration: line-through;
}

.task-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.task-item-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Checkbox */
.task-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--color-primary);
  flex-shrink: 0;
}

/* Priority Badge */
.task-priority-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
}

.priority-high {
  color: #c53030;
}

.priority-medium {
  color: #d69e2e;
}

.priority-low {
  color: #718096;
}

/* Subject */
.task-subject {
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Assignee */
.task-assignee {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--color-text-light);
  white-space: nowrap;
}

/* Due Date */
.task-due-date {
  font-size: 0.8rem;
  color: var(--color-text-light);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.task-due-date.overdue {
  color: #c53030;
  font-weight: 600;
}

/* Reference Link */
.task-ref-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--color-primary);
  cursor: pointer;
  white-space: nowrap;
}

.task-ref-link:hover {
  text-decoration: underline;
}

/* Task Ref Info in Modal */
.task-ref-info {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--color-primary);
  margin-bottom: 1rem;
}

/* Dashboard Widget */
.task-dashboard-list {
  padding: 0;
}

.task-dashboard-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--color-border-light);
}

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

.task-dashboard-item.overdue {
  background: #fff5f5;
}

.task-dashboard-subject {
  flex: 1;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-dashboard-date {
  font-size: 0.8rem;
  color: var(--color-text-light);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.task-dashboard-date.overdue {
  color: #c53030;
  font-weight: 600;
}

.task-dashboard-summary {
  padding: 8px 16px;
  font-size: 0.8rem;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
}

/* Kanban Task Badge */
.kanban-task-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 8px;
  background: var(--color-primary-5);
  color: var(--color-primary);
  font-weight: 600;
  margin-top: 4px;
}

/* Form Row for Modal */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ============================================
   Task Kanban Board (CRM Integration)
   ============================================ */

.task-kanban-col-open .kanban-column-header { border-bottom-color: #a0aec0; }
.task-kanban-col-progress .kanban-column-header { border-bottom-color: #63b3ed; }
.task-kanban-col-done .kanban-column-header { border-bottom-color: #68d391; }
.task-kanban-col-cancelled .kanban-column-header { border-bottom-color: #fc8181; }

.task-kanban-card {
  background: white;
  border-radius: 6px;
  padding: 0;
  margin-bottom: 8px;
  cursor: grab;
  transition: box-shadow 150ms, transform 150ms;
  border: 1px solid var(--color-border-light);
  display: flex;
  overflow: hidden;
  position: relative;
}
.task-kanban-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transform: translateY(-1px);
}
.task-kanban-card.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}

.task-kanban-card-priority {
  width: 4px;
  flex-shrink: 0;
}
.task-kanban-card-priority.priority-high { background: #c53030; }
.task-kanban-card-priority.priority-medium { background: #d69e2e; }
.task-kanban-card-priority.priority-low { background: #718096; }

.task-kanban-card-body {
  padding: 10px 12px;
  flex: 1;
  min-width: 0;
}

.task-kanban-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 2px 6px;
  border-radius: 3px;
  margin-bottom: 4px;
}
.task-kanban-badge.priority-high { background: #fff5f5; color: #c53030; }
.task-kanban-badge.priority-medium { background: #fffff0; color: #b7791f; }
.task-kanban-badge.priority-low { background: #F5F5F5; color: #718096; }

.task-kanban-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
  line-height: 1.3;
}

.task-kanban-card-ref {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.task-kanban-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--color-text-light);
}

.task-kanban-card-assignee {
  display: flex;
  align-items: center;
  gap: 3px;
}

.task-kanban-card-due {
  white-space: nowrap;
}
.task-kanban-card-due.overdue {
  color: #c53030;
  font-weight: 600;
}

.kanban-show-more {
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-primary);
  padding: 8px;
  cursor: default;
}

/* Task item cancelled state */
.task-item.cancelled {
  opacity: 0.55;
}
.task-item.cancelled .task-subject {
  text-decoration: line-through;
  color: var(--color-text-muted);
}

/* CRM Activity Reference Links */
.crm-ref-link {
  color: var(--color-primary);
  text-decoration: none;
  cursor: pointer;
}
.crm-ref-link:hover {
  text-decoration: underline;
}
.crm-customer-context {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* CRM Filter Erweiterungen */
.crm-filter-group input[type="text"] {
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.8125rem;
  background: white;
  min-width: 180px;
}
.crm-filter-group input[type="text"]:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(59, 110, 143, 0.15);
}

/* Task Kanban Filter Bar */
.task-kanban-filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
}
.task-kanban-filter-bar select {
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.8125rem;
  background: white;
  min-width: 140px;
}
.task-kanban-filter-bar select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(59, 110, 143, 0.15);
}

/* ============================================
   Tailwind-Ersatz (CSP-Haertung)
   Ersetzt die 4 Tailwind-exklusiven Utility-Klassen
   die nach Entfernung des Tailwind Play CDN benoetigt werden.
   ============================================ */
.text-blue-600 { color: #2563eb; }
.text-gray-500 { color: #6b7280; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.hover\:underline:hover { text-decoration: underline; }
