* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #070614;
  --bg2: #0f0e1f;
  --bg3: #1a1830;
  --accent: #00b1e6;
  --accent2: #0090c0;
  --text: #e2e8f0;
  --text2: #94a3b8;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
  --nav-height: 70px;
  --header-height: 56px;
  --native-safe-top: 0px;
  --safe-top: max(env(safe-area-inset-top, 0px), var(--native-safe-top));
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

/* Login */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.login-logo { width: 120px; margin-bottom: 16px; }
.login-container h1 { color: var(--accent); margin-bottom: 32px; font-size: 24px; }
.login-container form { width: 100%; max-width: 340px; }

/* Header */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: calc(var(--header-height) + var(--safe-top));
  background: rgba(7,6,20,0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0,177,230,0.15);
  display: flex; align-items: center; padding: var(--safe-top) 16px 0; gap: 10px;
}
.header-logo { height: 32px; }
.header-title { 
  font-weight: 700; 
  font-size: 16px; 
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 177, 230, 0.6);
  letter-spacing: 0.5px;
}

/* Content */
.content {
  padding: calc(var(--header-height) + var(--safe-top) + 12px) 16px calc(var(--nav-height) + 16px);
  max-width: 800px;
  margin: 0 auto;
  min-height: 100vh;
}

/* TODO ITEMS CLICKABLE */
[data-todo-title] {
  cursor: pointer;
  transition: all 0.2s ease;
}

[data-todo-title]:hover {
  opacity: 0.8;
}

/* Bottom Nav */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-height);
  background: rgba(7,6,20,0.97);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(0,177,230,0.15);
  display: flex; justify-content: space-around; align-items: center;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.nav-btn {
  background: none; border: none; color: var(--text2);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 10px; padding: 8px 16px; cursor: pointer;
  transition: color 0.2s;
}
.nav-btn i { font-size: 20px; }
.nav-btn.active { color: var(--accent); }

/* Forms */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 4px; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 12px 14px; border-radius: var(--radius);
  background: var(--bg3); border: 1px solid rgba(255,255,255,0.08);
  color: var(--text); font-size: 15px; font-family: inherit;
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--accent);
}
.form-group textarea { min-height: 80px; resize: vertical; position: relative; }
.form-group div[style*="position: relative"] { position: relative; }
.form-group select { appearance: auto; cursor: pointer; }
.form-group input[type="date"], .form-group input[type="time"] { color-scheme: dark; }

/* Buttons */
.btn {
  padding: 12px 24px; border-radius: var(--radius); border: none;
  font-size: 15px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: all 0.2s; font-family: inherit;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:active { background: var(--accent2); transform: scale(0.98); }
.btn-secondary { background: var(--bg3); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-full { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn i { font-size: 14px; }

.btn-fab {
  position: fixed; bottom: calc(var(--nav-height) + 16px); right: 16px;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none;
  font-size: 24px; cursor: pointer; box-shadow: 0 4px 20px rgba(0,177,230,0.4);
  z-index: 50; display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s;
}
.btn-fab:active { transform: scale(0.9); }

.codex-edit-tool-tray {
  position: fixed;
  left: 14px;
  right: auto;
  bottom: calc(var(--nav-height) + 86px);
  z-index: 9600;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: calc(100vw - 28px);
  flex-wrap: wrap;
}

.codex-final-changes {
  position: fixed; inset: 14px 14px 14px auto; margin: 0;
  width: min(460px, calc(100vw - 28px)); max-width: none;
  height: calc(100dvh - 28px); max-height: none; padding: 0;
  border: 1px solid rgba(148, 163, 184, .25); border-radius: 20px;
  background: var(--bg2); color: var(--text);
  box-shadow: 0 24px 80px #0008;
}
.codex-final-changes[open] { display: flex; flex-direction: column; }
.codex-final-changes::backdrop { background: #0007; }
.codex-final-changes header { display: flex; align-items: flex-start; gap: 12px; padding: 22px; border-bottom: 1px solid rgba(148, 163, 184, .25); }
.codex-final-changes h2 { margin: 0 0 8px; font-size: 21px; }
.codex-final-changes header p, .codex-final-changes footer small { margin: 0; color: var(--text2); font-size: 13px; line-height: 1.5; }
.codex-final-changes-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px; }
.codex-final-change { display: flex; align-items: flex-start; gap: 12px; padding: 16px; margin-bottom: 12px; border: 1px solid rgba(148, 163, 184, .25); border-radius: 12px; cursor: pointer; }
.codex-final-change:has(input:checked) { border-color: #22c55e; background: #22c55e12; }
.codex-final-change input { width: 20px; height: 20px; flex: 0 0 20px; margin-top: 2px; accent-color: #22c55e; }
.codex-final-change span { min-width: 0; overflow-wrap: anywhere; }
.codex-final-change strong { display: block; line-height: 1.4; }
.codex-final-change small { display: block; margin-top: 6px; color: var(--text2); font-size: 12px; }
.codex-final-change p { margin: 10px 0 0; font-size: 13px; line-height: 1.5; white-space: pre-line; }
.codex-final-change.is-locked { cursor: default; opacity: .7; }
.codex-final-change-notice { padding: 12px; border-radius: 10px; background: #22c55e18; }
.codex-final-changes footer { display: grid; gap: 12px; padding: 18px 22px; border-top: 1px solid rgba(148, 163, 184, .25); }
.codex-final-changes footer > div { display: flex; flex-wrap: wrap; gap: 8px; }
.codex-final-changes button:disabled { opacity: .5; cursor: default; }

.codex-direct-voice-btn,
.codex-final-data-sync-btn,
.codex-final-transfer-btn,
.codex-point-edit-btn {
  min-width: 66px;
  min-height: 66px;
  border: 1px solid rgba(0, 188, 212, 0.55);
  border-radius: 18px;
  background: linear-gradient(135deg, #00b1e6, #5b5ce2);
  color: #fff;
  box-shadow: 0 14px 36px rgba(0, 177, 230, 0.34);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  line-height: 1.05;
}

.codex-direct-voice-btn {
  background: linear-gradient(135deg, #18d17b, #00bcd4);
  border-color: rgba(34, 197, 94, 0.65);
  box-shadow: 0 14px 36px rgba(34, 197, 94, 0.28);
}

.codex-final-data-sync-btn {
  background: linear-gradient(135deg, #0f766e, #0891b2);
  border-color: rgba(45, 212, 191, 0.72);
  box-shadow: 0 14px 36px rgba(13, 148, 136, 0.30);
}

.codex-final-data-sync-btn:disabled {
  opacity: 0.82;
  cursor: wait;
}

.codex-final-transfer-btn {
  position: relative;
  background: linear-gradient(135deg, #f59e0b, #22c55e);
  border-color: rgba(250, 204, 21, 0.72);
  box-shadow: 0 14px 36px rgba(245, 158, 11, 0.30);
}

.codex-final-transfer-btn b {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  border: 2px solid rgba(255,255,255,0.65);
  font-size: 12px;
  line-height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.codex-final-transfer-btn.is-running,
.codex-final-transfer-btn:disabled {
  opacity: 0.82;
  cursor: wait;
}

.codex-direct-voice-btn i,
.codex-final-data-sync-btn i,
.codex-final-transfer-btn i,
.codex-point-edit-btn i { font-size: 20px; }
.codex-direct-voice-btn span,
.codex-final-data-sync-btn span,
.codex-final-transfer-btn span,
.codex-point-edit-btn span { font-size: 11px; }

.codex-direct-voice-btn.active {
  background: linear-gradient(135deg, #ef4444, #f97316);
  border-color: rgba(254, 202, 202, 0.75);
}

.codex-point-edit-btn.active {
  background: linear-gradient(135deg, #ef4444, #f97316);
  border-color: rgba(254, 202, 202, 0.75);
}
.codex-point-mode {
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.codex-point-mode * { cursor: crosshair !important; }
.codex-point-highlight {
  outline: 3px solid #00e5ff !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.22), 0 0 24px rgba(0, 229, 255, 0.78) !important;
  border-radius: 8px;
}
#ai-chat-messages > .ai-msg-row.assistant-msg:nth-of-type(2) > .ai-bubble:nth-of-type(2),
#ai-chat-messages > .ai-msg-row.assistant-msg:nth-of-type(2) > .ai-bubble.codex-point-highlight:nth-of-type(2) {
  background: #7c3aed !important;
  border-color: rgba(196, 181, 253, 0.72) !important;
  color: #ffffff !important;
}
.codex-area-selection {
  position: fixed;
  z-index: 9602;
  pointer-events: none;
  border: 2px solid #22d3ee;
  border-radius: 10px;
  background: rgba(34, 211, 238, 0.16);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.20), 0 0 24px rgba(34, 211, 238, 0.62);
}
.codex-point-hint {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--nav-height) + 90px);
  z-index: 9601;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(8, 15, 32, 0.96);
  border: 1px solid rgba(0, 188, 212, 0.45);
  color: #e0f7ff;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.38);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 800;
}

@media (min-width: 520px) {
  .codex-edit-tool-tray {
    left: auto;
    right: 14px;
  }
}

@media (max-width: 519px) {
  .codex-edit-tool-tray {
    bottom: calc(var(--nav-height) + 18px);
  }

  .codex-point-hint {
    bottom: calc(var(--nav-height) + 98px);
  }
}
.codex-point-modal { max-width: 680px; }
.codex-point-selected {
    padding: 12px;
    margin-bottom: 14px;
    border-radius: 10px;
  background: rgba(0, 188, 212, 0.10);
  border: 1px solid rgba(0, 188, 212, 0.28);
  color: #c8f7ff;
  font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
  }
  .codex-screenshot-upload {
    display: grid;
    gap: 8px;
    margin: 0 0 14px;
  }
  .codex-screenshot-upload .btn {
    justify-self: flex-start;
  }
  .codex-screenshot-status {
    min-height: 20px;
    padding: 8px 10px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: #b8c6d8;
    font-size: 12px;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }
  .codex-screenshot-status.error {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.35);
    color: #fecaca;
  }
.codex-point-actions {
    display: flex;
    justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.codex-point-voice-status {
  display: none;
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 9px;
  background: rgba(0, 188, 212, 0.10);
  border: 1px solid rgba(0, 188, 212, 0.22);
  color: #d8fbff;
  font-size: 12px;
}
.codex-point-voice-status.error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fecaca;
}

/* Cards */
.card {
  background: var(--bg2); border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.06);
  padding: 16px; margin-bottom: 12px;
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.card h3 { font-size: 16px; font-weight: 600; }
.card-meta { font-size: 13px; color: var(--text2); }

.app-version-card {
  padding: 14px;
}
.app-version-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.app-version-summary strong {
  display: inline-block;
  margin-right: 8px;
}
.app-version-status {
  flex: 0 0 auto;
  max-width: 48%;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(0, 188, 212, 0.12);
  color: #d8fbff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-align: right;
}
.app-version-line {
  overflow-wrap: anywhere;
}
.app-version-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
}
.app-version-actions .btn {
  margin: 0;
}
.app-version-details,
.app-version-changes {
  margin-top: 10px;
}
.app-version-details summary,
.app-version-changes summary {
  cursor: pointer;
  color: #d8fbff;
  font-size: 13px;
  font-weight: 700;
}
.app-version-actions-secondary {
  margin-bottom: 10px;
}
.app-version-changes ul {
  margin: 8px 0 0 18px;
  padding: 0;
  color: #cbd5e1;
  line-height: 1.45;
}
.app-version-note {
  margin-top: 10px;
}

/* Status Badges */
.status-badge {
  padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
  display: inline-block; position: relative;
}
.status-unterschrieben { background: rgba(0,188,212,0.15); color: #00bcd4; }
.status-in-planung { background: rgba(255,152,0,0.15); color: #ff9800; }
.status-geplant { background: rgba(255,152,0,0.15); color: #ff9800; }
.status-dc-montage { background: rgba(233,30,99,0.15); color: #e91e63; }
.status-ac-montage { background: rgba(156,39,176,0.15); color: #9c27b0; }
.status-in-montage { background: rgba(233,30,99,0.15); color: #e91e63; }
.status-abnahme { background: rgba(76,175,80,0.15); color: #4caf50; }
.status-fertig { background: rgba(33,150,243,0.15); color: #2196f3; }
.status-förderungen { background: rgba(139,195,74,0.15); color: #8bc34a; }

/* Dashboard Stats */
.stats-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--bg2); border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.06);
  padding: 16px; text-align: center;
}
.stat-card .stat-number { font-size: 28px; font-weight: 800; color: var(--accent); }
.stat-card .stat-label { font-size: 12px; color: var(--text2); margin-top: 4px; }
.stat-card.wide { grid-column: span 2; }

/* Search */
.search-bar {
  position: relative; margin-bottom: 16px;
}
.search-bar input {
  width: 100%; padding: 12px 14px 12px 42px; border-radius: var(--radius);
  background: var(--bg2); border: 1px solid rgba(255,255,255,0.08);
  color: var(--text); font-size: 15px;
}
.search-bar input:focus { outline: none; border-color: var(--accent); }
.search-bar i {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text2); font-size: 16px;
}

/* List */
.customer-item {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; background: var(--bg2); border-radius: var(--radius);
  margin-bottom: 8px; cursor: pointer; border: 1px solid rgba(255,255,255,0.06);
  transition: border-color 0.2s;
}
.customer-item:active { border-color: var(--accent); }
.customer-item .info { flex: 1; min-width: 0; }
.customer-item .info h4 { font-size: 15px; white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.25; overflow-wrap: anywhere; }
.customer-item .info p { font-size: 12px; color: var(--text2); margin-top: 2px; }
.customer-item .chevron { color: var(--text2); font-size: 14px; }
.customer-item .gemeinde-anmelden-list-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  margin-left: 2px;
  margin-right: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: linear-gradient(135deg,#ff9800,#f57c00);
  border: 1px solid rgba(255,152,0,0.65);
  color: #fff;
  font-weight: 900;
  white-space: nowrap;
}
.customer-item .gemeinde-anmelden-list-label {
  display: none;
}
@media (min-width: 900px) {
  .customer-item .gemeinde-anmelden-list-btn {
    width: auto;
    min-width: 156px;
    height: 38px;
    padding: 0 14px;
    margin-left: 8px;
    margin-right: 6px;
    border-radius: 10px;
    box-shadow: 0 6px 16px rgba(245,124,0,0.26);
    font-size: 13px;
  }
  .customer-item .gemeinde-anmelden-list-label {
    display: inline;
  }
}

/* Calendar */
.calendar-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.calendar-header h2 { font-size: 18px; }
.calendar-nav { display: flex; gap: 8px; }
.calendar-nav button {
  background: var(--bg3); border: none; color: var(--text);
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.calendar-grid {
  display: flex; flex-direction: column; gap: 2px;
  margin-bottom: 20px;
}
.calendar-grid .day-header,
.calendar-week-header .day-header {
  text-align: center; font-size: 11px; color: var(--text2);
  padding: 8px 0; font-weight: 600;
}
.calendar-grid .day-cell,
.calendar-week-row .day-cell {
  text-align: center; padding: 8px 4px; border-radius: 0;
  font-size: 14px; cursor: pointer; min-height: 40px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  position: relative; background: var(--card-bg, #1a1830);
}
.calendar-grid .day-cell.other { color: var(--text2); opacity: 0.3; }
.calendar-grid .day-cell.today { background: var(--accent); color: #fff; font-weight: 700; }
.calendar-grid .day-cell.has-events::after {
  content: ''; position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
}
.calendar-grid .day-cell.today.has-events::after { background: #fff; }
.calendar-grid .day-cell.selected { border: 2px solid var(--accent); }

/* Appointments */
.appointment-item {
  padding: 12px 16px; background: var(--bg2); border-radius: var(--radius);
  margin-bottom: 8px; border-left: 3px solid var(--accent);
  border: 1px solid rgba(255,255,255,0.06);
}
.appointment-item .time { font-size: 13px; color: var(--accent); font-weight: 600; }
.appointment-item .title { font-size: 14px; margin-top: 2px; }
.appointment-item .meta { font-size: 12px; color: var(--text2); margin-top: 4px; }

/* Photo Gallery */
.photo-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
}
.photo-grid .photo-item {
  aspect-ratio: 1; border-radius: 8px; overflow: hidden; cursor: pointer;
  position: relative;
}
.photo-grid .photo-item img { width: 100%; height: 100%; object-fit: cover; }
.photo-grid .photo-item .photo-cat {
  position: absolute; bottom: 4px; left: 4px;
  background: rgba(0,0,0,0.7); padding: 2px 6px; border-radius: 4px;
  font-size: 9px; color: var(--text);
}
.photo-delete-btn {
  position: absolute; top: 4px; right: 4px;
  background: rgba(220,53,69,0.85); border: none; color: #fff;
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; z-index: 2; opacity: 0.7; transition: opacity 0.2s;
}
.photo-delete-btn:hover { opacity: 1; }

/* Customer files: large originals stay on the NAS unless explicitly cached. */
.customer-file-gallery {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.customer-file-image-card,
.customer-file-row {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
}
.customer-file-image-card .photo-item {
  border-radius: 0;
}
.customer-file-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px;
}
.customer-file-placeholder-name {
  max-width: 100%;
  font-size: 12px;
  text-align: center;
  word-break: break-word;
}
.customer-file-row {
  margin-bottom: 8px;
  padding: 12px;
  border-left: 3px solid var(--accent);
}
.customer-file-row-main {
  display: flex;
  align-items: center;
  gap: 12px;
}
.customer-file-delete {
  flex: 0 0 auto;
  padding: 8px 10px;
  background: var(--danger);
  color: #fff;
}
.customer-file-actions {
  --customer-file-accent: var(--accent);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 8px;
  background: rgba(2, 6, 23, 0.35);
}
.customer-file-row > .customer-file-actions {
  margin: 10px -4px -4px;
  padding: 0;
  background: transparent;
}
.customer-file-action {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid rgba(56, 189, 248, 0.55);
  border-color: color-mix(in srgb, var(--customer-file-accent) 55%, transparent);
  border-radius: 8px;
  background: #1e293b;
  background: color-mix(in srgb, var(--customer-file-accent) 18%, #111827);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.15;
  cursor: pointer;
}
.customer-file-action:disabled {
  opacity: 0.62;
  cursor: wait;
}
.customer-file-offline {
  grid-column: 1 / -1;
  border-color: rgba(148, 163, 184, 0.55);
  background: #334155;
}
.customer-file-offline.is-offline-saved {
  border-color: #4ade80;
  background: #15803d;
}

@media (max-width: 520px) {
  .customer-file-gallery { grid-template-columns: 1fr; }
  .customer-file-action { min-height: 44px; font-size: 13px; }
}

/* Lightbox */
.lightbox {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.95); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.lightbox img { max-width: 95vw; max-height: 90vh; object-fit: contain; }
.lightbox .close-btn {
  position: absolute; top: 16px; right: 16px;
  background: rgba(255,255,255,0.1); border: none; color: #fff;
  width: 40px; height: 40px; border-radius: 50%; font-size: 20px; cursor: pointer;
}

/* Signature Canvas */
.signature-pad {
  background: #fff; border-radius: var(--radius);
  touch-action: none; width: 100%; height: 150px;
  cursor: crosshair;
}
.signature-label {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.signature-label button { font-size: 12px; }

/* Checklist */
.checklist-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.05);
}
.checklist-item label { flex: 1; font-size: 14px; cursor: pointer; }
.checklist-item input[type="checkbox"] {
  width: 22px; height: 22px; accent-color: var(--accent); cursor: pointer;
}

/* Modal */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7); z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: var(--bg2); border-radius: 20px 20px 0 0;
  width: 100%; max-width: 500px; max-height: 90vh;
  overflow-y: auto; padding: 24px 20px;
  animation: slideUp 0.3s ease;
  border: 1px solid rgba(255,255,255,0.08);
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h2 { font-size: 18px; }
.modal-close { background: none; border: none; color: var(--text2); font-size: 24px; cursor: pointer; padding: 4px; }

/* Keep the private-space form visible when the Android keyboard opens. */
.private-space-overlay {
  overflow: hidden;
}
.private-space-dialog {
  overscroll-behavior: contain;
  scroll-padding-top: 12px;
  scroll-padding-bottom: max(18px, env(safe-area-inset-bottom));
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}

@media (max-width: 700px) {
  .private-space-dialog {
    padding: 18px 16px max(16px, env(safe-area-inset-bottom));
  }
  .private-space-overlay.keyboard-open .private-space-dialog {
    padding-top: 10px;
  }
  .private-space-overlay.keyboard-open .modal-header {
    margin-bottom: 8px;
  }
  .private-space-overlay.keyboard-open .private-space-intro {
    display: none;
  }
  .private-space-overlay.keyboard-open #private-note-text {
    min-height: 96px;
    max-height: 34vh;
  }
}

/* Keep the important-note composer inside the visible area above mobile keyboards. */
.append-lead-note-overlay {
  overflow: hidden;
  z-index: 100000;
}
.append-lead-note-dialog {
  overscroll-behavior: contain;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.lead-note-alarm-message {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  background: rgba(255,255,255,0.08);
  border-left: 5px solid #ef4444;
  border-radius: 12px;
  padding: 16px;
}
.lead-note-alarm-message-text {
  min-width: 0;
  max-height: 38vh;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 18px;
  line-height: 1.55;
}
.lead-note-alarm-add-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border: 1px solid rgba(125,211,252,0.72);
  border-radius: 14px;
  background: linear-gradient(135deg,#22d3ee,#0284c7);
  color: #fff;
  box-shadow: 0 10px 24px rgba(2,132,199,0.30);
  font-size: 22px;
  cursor: pointer;
}
.lead-note-alarm-add-button:hover,
.lead-note-alarm-add-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(2,132,199,0.42);
  outline: 2px solid rgba(186,230,253,0.85);
  outline-offset: 2px;
}

@media (max-width: 700px) {
  .append-lead-note-dialog {
    padding: 18px 16px max(16px, env(safe-area-inset-bottom));
  }
  .append-lead-note-overlay.keyboard-open .append-lead-note-dialog {
    padding-top: 12px;
  }
  .append-lead-note-overlay.keyboard-open .modal-header {
    margin-bottom: 10px;
    padding-bottom: 8px;
  }
  .append-lead-note-overlay.keyboard-open #append-lead-note-text {
    min-height: 88px;
    max-height: 30vh;
  }
  .lead-note-alarm-message {
    gap: 9px;
    padding: 13px;
  }
  .lead-note-alarm-message-text {
    font-size: 16px;
  }
  .lead-note-alarm-add-button {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
    border-radius: 12px;
  }
}

/* Section Headers */
.section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; margin-top: 20px;
}
.section-header h2 { font-size: 18px; font-weight: 700; }
.section-header:first-child { margin-top: 0; }

/* Page Title */
.page-title {
  font-size: 22px; font-weight: 800; margin-bottom: 16px;
}

/* Tabs */
.tabs {
  display: flex; gap: 8px; margin-bottom: 16px; overflow-x: auto;
  -webkit-overflow-scrolling: touch; padding-bottom: 4px;
}
.tab {
  padding: 8px 16px; border-radius: 20px; font-size: 13px; font-weight: 600;
  white-space: nowrap; cursor: pointer; border: none;
  background: var(--bg3); color: var(--text2);
  transition: all 0.2s; position: relative;
}
.tab.active { background: var(--accent); color: #fff; }
.tab[title]:hover::after, .status-badge[title]:hover::after {
  content: attr(title);
  position: absolute; bottom: 110%; left: 50%; transform: translateX(-50%);
  background: rgba(30,30,30,0.95); color: #fff; padding: 8px 12px;
  border-radius: 8px; font-size: 12px; font-weight: 400;
  white-space: nowrap; z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  pointer-events: none;
}
.tab[title]:hover::before, .status-badge[title]:hover::before {
  content: ''; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: rgba(30,30,30,0.95); z-index: 1000;
}

/* Back Button */
.back-btn {
  background: none; border: none; color: var(--accent); font-size: 14px;
  cursor: pointer; display: flex; align-items: center; gap: 6px;
  margin-bottom: 16px; padding: 4px 0; font-family: inherit; font-weight: 500;
}

/* Error */
.error-msg { color: var(--danger); font-size: 13px; margin-top: 8px; text-align: center; }
.success-msg { color: var(--success); font-size: 13px; margin-top: 8px; text-align: center; }

/* Empty State */
.empty-state {
  text-align: center; padding: 40px 20px; color: var(--text2);
}
.empty-state i { font-size: 48px; margin-bottom: 12px; opacity: 0.3; }
.empty-state p { font-size: 14px; }

/* Responsive tweaks */
@media (min-width: 600px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .photo-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Detail Tabs */
.detail-tabs {
  display: flex; gap: 0; margin-bottom: 16px;
  border-bottom: 2px solid var(--bg3);
}
.detail-tab {
  flex: 1; text-align: center; padding: 10px 8px; font-size: 12px; font-weight: 600;
  cursor: pointer; border: none; background: none; color: var(--text2);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all 0.2s;
}
.detail-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.detail-tab i { display: block; font-size: 18px; margin-bottom: 4px; }

/* Actions row */
.actions-row {
  display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap;
}

/* Filter row */
.filter-row {
  display: flex; gap: 8px; margin-bottom: 12px; overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Toast */
.toast {
  position: fixed; bottom: calc(var(--nav-height) + 16px); left: 50%; transform: translateX(-50%);
  background: var(--accent); color: #fff; padding: 12px 24px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500; z-index: 300; opacity: 0;
  transition: opacity 0.3s; pointer-events: none;
}
.toast.show { opacity: 1; }

/* Upload */
.upload-area {
  border: 2px dashed rgba(0,177,230,0.3); border-radius: var(--radius);
  padding: 24px; text-align: center; cursor: pointer;
  transition: border-color 0.2s;
}
.upload-area:active { border-color: var(--accent); }
.upload-area i { font-size: 32px; color: var(--accent); margin-bottom: 8px; }
.upload-area p { font-size: 13px; color: var(--text2); }
.customer-document-upload-area { position: relative; overflow: hidden; }
.customer-document-file-input {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}
.customer-document-upload-area:focus-within { border-color: var(--accent); }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 4px; }

/* Enhanced Calendar */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 16px;
}

.calendar-title {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.view-toggle {
  display: flex;
  background: var(--bg3);
  border-radius: var(--radius);
  overflow: hidden;
}

.view-btn {
  padding: 6px 12px;
  background: none;
  border: none;
  color: var(--text2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.view-btn.active {
  background: var(--accent);
  color: white;
}

.day-cell {
  position: relative;
  padding: 8px 4px;
  min-height: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.day-number {
  font-size: 14px;
  font-weight: 500;
}

.day-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  margin-top: 2px;
}

.day-dots {
  display: none;
}

.type-dot {
  display: none;
}

.type-legend {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  padding: 12px;
  background: var(--bg2);
  border-radius: var(--radius);
  font-size: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.legend-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--text2);
  min-width: 104px;
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  font: inherit;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.legend-item:hover,
.legend-item:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(34,211,238,0.4);
  background: rgba(34,211,238,0.08);
  outline: none;
}

.legend-item.is-empty {
  opacity: .55;
}

.legend-count {
  display: inline-flex;
  min-width: 23px;
  height: 23px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(0,188,212,0.16);
  border: 1px solid rgba(0,188,212,0.32);
  color: #67e8f9;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.legend-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.type-legend .type-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  box-shadow: 0 0 10px currentColor;
}

/* Week View */
.week-view {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin: 16px 0;
}

.week-day {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 120px;
  cursor: pointer;
  transition: background 0.2s;
}

.week-day:hover {
  background: var(--bg3);
}

.week-day.today {
  border: 2px solid var(--accent);
}

.week-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
}

.day-name {
  color: var(--text2);
}

.day-num {
  color: var(--text);
  font-size: 16px;
}

.week-appointments {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.week-appointment {
  background: var(--bg3);
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 10px;
  cursor: pointer;
  transition: background 0.2s;
}

.week-appointment:hover {
  background: var(--bg);
}

.week-appointment .time {
  color: var(--text2);
  font-size: 9px;
}

.week-appointment .title {
  font-weight: 500;
  margin: 2px 0;
}

.week-appointment .type {
  color: var(--text2);
  font-size: 9px;
}

.no-appointments {
  color: var(--text2);
  font-size: 11px;
  font-style: italic;
  text-align: center;
  padding: 8px 0;
}

/* Enhanced Dashboard */
.appointment-item.prominent {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.appointment-item.this-week {
  border-left-width: 4px !important;
}

.appointment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.appointment-header .time {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}

.appointment-header .type {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card {
  cursor: pointer;
  transition: transform 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
}

/* Navigation Badge */
.nav-badge {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.badge {
  position: absolute;
  top: 2px;
  right: 8px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
  line-height: 1.2;
}

/* Modal Enhancements */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--bg3);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text2);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--bg3);
  color: var(--text);
}

/* Loading Spinner */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(7, 6, 20, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(4px);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(0, 177, 230, 0.3);
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Skeleton Loader */
@keyframes skeleton-shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton-loader {
  display: inline-block;
  width: 100%;
  height: 1em;
  border-radius: var(--radius, 8px);
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 25%,
    rgba(255, 255, 255, 0.12) 50%,
    rgba(255, 255, 255, 0.05) 75%
  );
  background-size: 800px 100%;
  animation: skeleton-shimmer 1.5s infinite linear;
  position: relative;
  overflow: hidden;
}

.skeleton-loader.skeleton-card {
  height: 80px;
  border-radius: var(--radius, 12px);
  margin-bottom: 10px;
}

.skeleton-loader.skeleton-text {
  height: 14px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.skeleton-loader.skeleton-text.short {
  width: 60%;
}

.skeleton-loader.skeleton-text.medium {
  width: 80%;
}

.skeleton-loader.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

/* Stat card skeleton placeholder */
.stat-card.skeleton-loader {
  height: 90px;
  cursor: default;
}

.stat-card.skeleton-loader:hover {
  transform: none;
}

/* Swipe Gestures */
.swipe-indicator {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--accent);
  font-size: 24px;
  opacity: 0;
  transition: all 0.3s;
}

.swipe-indicator.show {
  opacity: 1;
  top: -40px;
}

/* Enhanced Touch Targets */
.day-cell, .week-day, .appointment-item, .stat-card {
  min-height: 44px;
  -webkit-tap-highlight-color: rgba(0, 177, 230, 0.1);
}

/* Voice Button */
.voice-button {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
  z-index: 10;
}

.voice-button:hover {
  background: var(--accent2);
  transform: scale(1.05);
}

.voice-button.recording {
  background: var(--danger);
  animation: pulse-recording 1s infinite;
}

@keyframes pulse-recording {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
}

/* Better Focus States for Accessibility */
button:focus, input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Smooth Animations */
* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.page-title, .section-header, .appointment-item, .stat-card, .week-day {
  animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile Improvements */
@media (max-width: 768px) {
  :root {
    --native-safe-top: 48px;
  }

  /* Android-PWA: Die Statusleiste liegt über der App. Kopfzeile sicher darunter platzieren. */
  @media (display-mode: standalone) {
    :root { --native-safe-top: 48px; }
  }

  .week-view {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .week-day {
    min-height: 80px;
  }
  
  .type-legend {
    font-size: 10px;
    gap: 8px;
  }

  .legend-item {
    min-width: 84px;
    padding: 7px 8px;
  }
  
  .calendar-header {
    flex-direction: column;
    gap: 8px;
  }
  
  .calendar-title {
    width: 100%;
  }
  
  /* Better touch targets on mobile */
  .nav-btn {
    padding: 12px 8px;
  }
  
  .day-cell {
    min-height: 60px;
    padding: 12px 4px;
  }
  
  .appointment-item {
    padding: 16px;
    margin-bottom: 8px;
  }
  
  /* Improve modal on mobile */
  .modal-content {
    margin: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
  }
}

/* ============ OCR STYLES ============ */
.ocr-buttons {
  margin-bottom: 20px;
}

.ocr-buttons .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
}

#ocr-preview {
  background: var(--card-bg, #1a1830);
  border: 1px solid var(--border, rgba(0,177,230,0.15));
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
}

#ocr-preview h4 {
  color: var(--accent);
  margin-bottom: 10px;
  font-size: 16px;
}

.ocr-fields {
  display: grid;
  gap: 10px;
  margin-bottom: 15px;
}

.ocr-fields .form-group {
  margin: 0;
}

.ocr-fields label {
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 4px;
  display: block;
}

.ocr-fields input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border, #333);
  border-radius: 4px;
  background: var(--input-bg, #0f0e1f);
  color: var(--text);
  font-size: 14px;
  transition: all 0.2s ease;
}

.ocr-fields input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 2px rgba(0,177,230,0.15);
}

/* ============ TODO STYLES ============ */
#wichtig-section,
#todo-section {
  margin: 20px 0;
  padding: 16px;
  background: var(--card-bg, #1a1830);
  border-radius: var(--radius);
  border: 1px solid var(--border, rgba(0,177,230,0.15));
}

#wichtig-section {
  border-color: rgba(255, 107, 53, 0.3);
}

#wichtig-section h2 {
  color: #ff6b35;
}

#wichtig-section .section-header {
  margin-bottom: 12px;
}

#todo-section .section-header {
  margin-bottom: 12px;
}

.todo-item {
  display: flex;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  transition: all 0.2s ease;
}

.todo-item:last-child {
  border-bottom: none;
}

.todo-item:hover {
  background: rgba(255,255,255,0.05);
  margin: 0 -8px;
  padding: 8px;
  border-radius: 4px;
}

.todo-item input[type="checkbox"] {
  margin-right: 10px;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.todo-item span {
  flex: 1;
  font-size: 14px;
  line-height: 1.4;
}

#wichtig-section .todo-item > div {
  min-width: 0;
}

#wichtig-section .todo-item span {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}

#wichtig-section .todo-item > div > div > span:first-child {
  flex: 0 0 18px;
}

#wichtig-section .todo-item > div > div > span:last-child {
  flex: 1 1 auto;
}

.todo-add-form {
  margin-top: 15px;
  display: flex;
  gap: 10px;
  align-items: center;
  position: relative;
  z-index: 10;
}

.todo-add-form input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border, #333);
  border-radius: 4px;
  background: var(--input-bg, #0f0e1f);
  color: var(--text);
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}

.todo-add-form input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 2px rgba(0,177,230,0.15);
}

.todo-add-form .btn {
  padding: 10px 14px;
  min-width: 44px;
  min-height: 44px;
  touch-action: manipulation;
}

/* Todo animations */
.todo-item input[type="checkbox"] {
  transition: all 0.2s ease;
}

.todo-item input[type="checkbox"]:checked + span {
  transition: all 0.3s ease;
}

/* Empty states for todo sections */
#wichtig-section .empty-state,
#todo-section .empty-state {
  text-align: center;
  padding: 20px 0;
  color: var(--text2, #94a3b8);
  font-style: italic;
}

/* Important todo styling */
.todo-item.important {
  border-left: 3px solid #ff6b35;
  padding-left: 8px;
  background: rgba(255, 107, 53, 0.05);
}

/* Mobile adjustments */
@media (max-width: 768px) {
  #wichtig-section,
  #todo-section {
    margin: 15px 0;
    padding: 12px;
  }
  
  .todo-add-form {
    flex-direction: column;
    gap: 8px;
  }
  
  .todo-add-form input {
    width: 100%;
  }
  
  .todo-add-form .btn {
    width: 100%;
  }
  
  .ocr-buttons {
    gap: 8px;
  }
  
  .ocr-buttons .btn {
    padding: 10px 12px;
    font-size: 13px;
  }
}

/* ============ CALENDAR WEEK NUMBERS ============ */
.calendar-week-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--bg3);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 4px;
}

.calendar-week-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--bg3);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 4px;
}

.week-number-header {
  display: none;
}

.week-number {
  display: none;
}

/* ============ CUSTOMER PORTAL STYLES ============ */
.calendar-hero {
  position: relative;
  margin: 8px 0 18px;
  padding: 18px;
  border: 1px solid rgba(0,177,230,0.22);
  border-radius: 24px;
  background:
    radial-gradient(circle at 18% 10%, rgba(0,177,230,0.22), transparent 34%),
    radial-gradient(circle at 88% 22%, rgba(245,158,11,0.14), transparent 28%),
    linear-gradient(145deg, rgba(15,14,31,0.96), rgba(18,25,48,0.84));
  box-shadow: 0 18px 50px rgba(0,0,0,0.32), inset 0 1px 0 rgba(255,255,255,0.06);
  overflow: hidden;
}

.calendar-hero::after {
  content: '';
  position: absolute;
  inset: auto 24px -65px auto;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: rgba(0,177,230,0.11);
  filter: blur(4px);
  pointer-events: none;
}

.calendar-hero .calendar-header {
  position: relative;
  z-index: 1;
  margin-bottom: 14px;
}

.calendar-kicker {
  color: #67e8f9;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.calendar-title h2 {
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.1;
  color: #f8fafc;
  text-shadow: 0 10px 28px rgba(0,177,230,0.28);
}

.calendar-nav button {
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.07);
  box-shadow: 0 10px 28px rgba(0,0,0,0.25);
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.calendar-nav button:hover {
  transform: translateY(-2px);
  background: rgba(0,177,230,0.18);
  border-color: rgba(0,177,230,0.35);
}

.view-toggle {
  padding: 4px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
}

.view-btn {
  min-width: 74px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
}

.view-btn.active {
  background: linear-gradient(135deg, #00b1e6, #13c7d8);
  box-shadow: 0 8px 24px rgba(0,177,230,0.3);
}

.calendar-month-stats {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.calendar-month-stats div,
.calendar-month-stats button {
  min-height: 72px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  background: rgba(7,6,20,0.34);
  backdrop-filter: blur(10px);
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.calendar-month-stats button:hover {
  background: rgba(0,188,212,0.14);
  border-color: rgba(0,188,212,0.42);
  transform: translateY(-2px);
}

.calendar-month-stats strong {
  display: block;
  color: #fff;
  font-size: 20px;
  line-height: 1.2;
}

.calendar-month-stats span {
  display: block;
  margin-top: 5px;
  color: var(--text2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.calendar-stat-list-modal { max-width: 780px; width: 94%; max-height: 84vh; overflow: hidden; }
.calendar-stat-list-modal .modal-body { max-height: 70vh; overflow: auto; }
.calendar-stat-subtitle { color: #9fb2c8; margin: 0 0 14px; }
.calendar-stat-list { display: grid; gap: 10px; }
.calendar-stat-appointment-row,
.calendar-stat-day-row {
  align-items: center;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  color: #e8eef8;
  cursor: pointer;
  display: grid;
  gap: 12px;
  padding: 12px;
  text-align: left;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
  width: 100%;
}
.calendar-stat-appointment-row { grid-template-columns: 12px minmax(0,1fr) auto; }
.calendar-stat-day-row { grid-template-columns: minmax(0,1fr) auto; }
.calendar-stat-appointment-row:hover,
.calendar-stat-day-row:hover {
  background: rgba(0,188,212,.12);
  border-color: rgba(0,188,212,.35);
  transform: translateY(-1px);
}
.calendar-stat-dot { border-radius: 99px; height: 36px; width: 5px; }
.calendar-stat-main strong { color: #fff; display: block; font-size: 15px; }
.calendar-stat-main small { color: #9fb2c8; display: block; margin-top: 4px; }
.calendar-stat-main em { color: #cbd5e1; display: block; font-style: normal; margin-top: 7px; overflow-wrap: anywhere; }
.calendar-stat-day-row span { color: #fff; font-weight: 800; }
.calendar-stat-day-row strong { color: #66e7ff; }

.calendar-grid {
  gap: 8px;
  margin-bottom: 22px;
}

.calendar-week-header {
  gap: 8px;
  background: transparent;
  margin-bottom: 8px;
}

.calendar-week-header .day-header {
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  background: rgba(255,255,255,0.06);
  color: #b8c7df;
  font-size: 12px;
}

.calendar-week-row {
  gap: 8px;
  margin-bottom: 0;
  background: transparent;
  overflow: visible;
}

.calendar-grid .day-cell,
.calendar-week-row .day-cell {
  min-height: 82px;
  padding: 12px 8px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(26,24,48,0.96), rgba(22,31,55,0.86));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.calendar-grid .day-cell:hover,
.calendar-week-row .day-cell:hover {
  transform: translateY(-2px);
  border-color: rgba(0,177,230,0.38);
  background: linear-gradient(145deg, rgba(20,44,72,0.95), rgba(26,24,48,0.98));
}

.calendar-grid .day-cell.today,
.calendar-week-row .day-cell.today {
  background: linear-gradient(145deg, #07b7dd, #0f8fc8);
  color: #fff;
  border-color: rgba(255,255,255,0.18);
  box-shadow: 0 14px 32px rgba(0,177,230,0.28);
}

.calendar-grid .day-cell.selected,
.calendar-week-row .day-cell.selected {
  border: 2px solid #f59e0b;
  box-shadow: 0 0 0 3px rgba(245,158,11,0.16);
}

.calendar-grid .day-cell.has-events::after {
  display: none;
}

.day-number {
  font-size: 17px;
  font-weight: 800;
}

.day-badge {
  width: auto;
  min-width: 28px;
  height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(0,177,230,0.18);
  border: 1px solid rgba(103,232,249,0.35);
  color: #e0faff;
  box-shadow: 0 8px 20px rgba(0,177,230,0.18);
}

.day-cell.today .day-badge {
  background: rgba(255,255,255,0.22);
  color: #fff;
  border-color: rgba(255,255,255,0.36);
}

.type-legend {
  margin-top: 14px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(15,14,31,0.72);
}

.calendar-agenda {
  margin-top: 22px;
}

.calendar-agenda-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 14px;
}

.calendar-agenda-header h2 {
  margin-top: 3px;
  font-size: 23px;
}

.calendar-agenda-header span {
  color: #67e8f9;
  border: 1px solid rgba(103,232,249,0.22);
  background: rgba(0,177,230,0.1);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 800;
}

.calendar-agenda-date {
  display: inline-flex;
  margin: 16px 0 8px;
  color: #67e8f9;
  background: rgba(0,177,230,0.09);
  border: 1px solid rgba(0,177,230,0.18);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 800;
}

.calendar-agenda .appointment-item {
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(15,14,31,0.95), rgba(26,24,48,0.86));
  box-shadow: 0 10px 28px rgba(0,0,0,0.22);
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.calendar-agenda .appointment-item:hover {
  transform: translateX(3px);
  border-color: rgba(255,255,255,0.13);
}

.calendar-agenda .appointment-item.calendar-type-highlight {
  border-color: rgba(34,211,238,0.75) !important;
  box-shadow: 0 0 0 2px rgba(34,211,238,0.22), 0 14px 34px rgba(0,188,212,0.18);
  transform: translateX(4px);
}

.appointment-card-layout {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.appointment-card-content {
  flex: 1;
  min-width: 0;
}

.appointment-symbol {
  --appointment-symbol-color: #67e8f9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--appointment-symbol-color) 48%, transparent);
  background: color-mix(in srgb, var(--appointment-symbol-color) 16%, transparent);
  color: var(--appointment-symbol-color);
  box-shadow: inset 0 0 16px rgba(255,255,255,0.03);
}

.appointment-symbol-card {
  margin-top: 2px;
  font-size: 16px;
}

.week-appointment-main {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  min-width: 0;
}

.appointment-symbol-week {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  font-size: 10px;
}

.legend-label i {
  width: 14px;
  text-align: center;
}

.appointment-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.sonepar-material-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(34, 197, 94, 0.36);
  background: rgba(34, 197, 94, 0.13);
  color: #bbf7d0;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.sonepar-material-btn:hover {
  border-color: rgba(34, 197, 94, 0.62);
  background: rgba(34, 197, 94, 0.22);
}

.sonepar-material-panel {
  max-width: 760px;
}

.sonepar-material-context,
.sonepar-material-problem {
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.sonepar-material-context span,
.sonepar-material-problem small,
.sonepar-material-link small {
  display: block;
  color: var(--text2);
  font-size: 12px;
  margin-top: 4px;
}

.sonepar-material-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 14px;
  margin-top: 14px;
}

.sonepar-material-grid h4 {
  font-size: 14px;
  margin: 0 0 8px;
}

.sonepar-material-grid ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text2);
  font-size: 13px;
  line-height: 1.45;
}

.sonepar-material-items {
  display: grid;
  gap: 8px;
}

.sonepar-material-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid rgba(34, 197, 94, 0.2);
  background: rgba(34, 197, 94, 0.08);
  color: var(--text);
  border-radius: 8px;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
}

.sonepar-material-link:hover {
  background: rgba(34, 197, 94, 0.16);
}

.sonepar-material-link i {
  color: #86efac;
}

.sonepar-material-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.sonepar-product-card {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(0, 188, 212, 0.32);
  background: rgba(0, 188, 212, 0.08);
  border-radius: 12px;
}

.sonepar-product-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.sonepar-product-head small {
  display: block;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 4px;
}

.sonepar-product-head strong {
  color: var(--text);
  font-size: 18px;
}

.sonepar-product-sku {
  display: block;
  margin-top: 4px;
  color: #ffd166;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.sonepar-product-card p {
  color: var(--text2);
  margin: 0 0 12px;
  line-height: 1.45;
}

.sonepar-product-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.sonepar-product-cols h5 {
  color: var(--text);
  margin: 0 0 6px;
  font-size: 13px;
}

.sonepar-product-cols ul {
  margin: 0;
  padding-left: 17px;
  color: var(--text2);
  font-size: 12px;
  line-height: 1.45;
}

.sonepar-cart-note {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 193, 7, 0.34);
  border-radius: 10px;
  background: rgba(255, 193, 7, 0.1);
  color: var(--text);
}

.sonepar-cart-note strong {
  color: #ffd166;
  font-size: 14px;
}

.sonepar-cart-note span {
  color: var(--text2);
  font-size: 13px;
  line-height: 1.4;
}

@media (max-width: 768px) {
  .sonepar-material-grid {
    grid-template-columns: 1fr;
  }

  .sonepar-material-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .sonepar-product-cols {
    grid-template-columns: 1fr;
  }

  .calendar-hero {
    padding: 14px;
    border-radius: 20px;
  }

  .calendar-hero .calendar-header {
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    gap: 10px;
  }

  .calendar-title h2 {
    font-size: 24px;
  }

  .calendar-month-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .calendar-week-header,
  .calendar-week-row {
    gap: 5px;
  }

  .calendar-grid .day-cell,
  .calendar-week-row .day-cell {
    min-height: 64px;
    border-radius: 14px;
    padding: 9px 5px;
  }

  .day-number {
    font-size: 15px;
  }

  .day-badge {
    min-width: 24px;
    height: 22px;
    font-size: 10px;
  }
}

.portal-login {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.portal-login-container {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 48px;
  width: 100%;
  max-width: 400px;
  margin: 24px;
}

.portal-logo {
  text-align: center;
  margin-bottom: 32px;
}

.portal-logo h1 {
  color: var(--accent);
  font-size: 28px;
  margin-bottom: 8px;
}

.portal-logo p {
  color: var(--text2);
  font-size: 16px;
}

.portal-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.portal-header {
  background: var(--bg2);
  border-bottom: 1px solid var(--bg3);
  padding: 16px 24px;
}

.portal-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.portal-header h1 {
  color: var(--accent);
  font-size: 24px;
}

.portal-user {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text2);
}

.portal-nav {
  background: var(--bg2);
  border-bottom: 1px solid var(--bg3);
  padding: 0 24px;
  overflow-x: auto;
}

.portal-nav-btn {
  background: transparent;
  border: none;
  color: var(--text2);
  padding: 16px 20px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.portal-nav-btn:hover {
  color: var(--text);
}

.portal-nav-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.portal-content {
  flex: 1;
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.portal-section {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.portal-section h2 {
  color: var(--text);
  font-size: 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.portal-section h3 {
  color: var(--text);
  font-size: 16px;
  margin: 16px 0 8px 0;
}

/* Status Progress */
.status-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 24px 0;
  justify-content: center;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 80px;
  opacity: 0.5;
  transition: all 0.3s;
}

.progress-step.completed,
.progress-step.current {
  opacity: 1;
}

.progress-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  border: 2px solid var(--bg3);
  color: var(--text2);
  transition: all 0.3s;
}

.progress-step.completed .progress-circle {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.progress-step.current .progress-circle {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 0 0 4px rgba(0, 177, 230, 0.2);
}

.progress-label {
  font-size: 12px;
  text-align: center;
  color: var(--text2);
  line-height: 1.2;
}

.progress-step.completed .progress-label,
.progress-step.current .progress-label {
  color: var(--text);
  font-weight: 500;
}

.next-step-hint {
  margin-top: 8px;
  padding: 10px 14px;
  background: rgba(0,188,212,0.1);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  font-size: 13px;
  color: #ccc;
  line-height: 1.5;
}

/* Förderung Info */
.foerderung-info {
  background: var(--bg3);
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
  border-left: 4px solid var(--success);
}

.project-info {
  background: var(--bg3);
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
}

/* Availability */
.availability-form {
  background: var(--bg3);
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
}

.availability-list {
  margin-top: 24px;
}

.availability-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: var(--bg3);
  border-radius: 8px;
  margin-bottom: 8px;
}

.availability-item .date {
  font-weight: 500;
}

.availability-item .note {
  color: var(--text2);
  font-size: 14px;
}

/* Files */
.upload-section {
  background: var(--bg3);
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
  text-align: center;
}

.upload-options {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 12px;
}

.upload-info {
  color: var(--text2);
  font-size: 14px;
}

.files-list {
  margin-top: 24px;
}

.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: var(--bg3);
  border-radius: 8px;
  margin-bottom: 8px;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.file-info i {
  color: var(--accent);
  font-size: 20px;
  width: 24px;
}

.file-details {
  flex: 1;
}

.file-name {
  font-weight: 500;
  margin-bottom: 4px;
}

.file-meta {
  color: var(--text2);
  font-size: 12px;
}

/* Messages */
.messages-container {
  max-height: 400px;
  overflow-y: auto;
  margin: 16px 0;
  padding: 12px;
  background: var(--bg3);
  border-radius: 8px;
}

.message {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
}

.message-in {
  align-items: flex-start;
}

.message-out {
  align-items: flex-end;
}

.message-content {
  background: var(--bg2);
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 70%;
  word-wrap: break-word;
}

.message-out .message-content {
  background: var(--accent);
  color: white;
}

.message-time {
  font-size: 11px;
  color: var(--text2);
  margin-top: 4px;
}

.message-form {
  background: var(--bg3);
  border-radius: 8px;
  padding: 16px;
}

.message-input-group {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.message-input-group textarea {
  flex: 1;
  resize: vertical;
  min-height: 80px;
}

.message-input-group .btn {
  flex-shrink: 0;
  padding: 12px 16px;
  height: fit-content;
}

.empty-message {
  text-align: center;
  color: var(--text2);
  font-style: italic;
  padding: 24px;
}

/* Admin Portal Styles */
.portal-admin-section,
.portal-messages-section {
  background: var(--bg3);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.portal-credentials {
  background: var(--bg2);
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
}

.portal-info ul {
  list-style: none;
  padding-left: 0;
}

.portal-info li {
  padding: 4px 0;
  color: var(--text2);
}

.portal-info li:before {
  content: "✓ ";
  color: var(--success);
  font-weight: bold;
  margin-right: 8px;
}

.admin-messages-container {
  max-height: 300px;
  overflow-y: auto;
  margin: 16px 0;
  padding: 12px;
  background: var(--bg2);
  border-radius: 8px;
}

.admin-message {
  padding: 8px 12px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: var(--bg3);
}

.admin-message.from-customer {
  border-left: 4px solid var(--accent);
}

.admin-message.from-team {
  border-left: 4px solid var(--success);
}

.admin-message .message-content {
  margin-bottom: 4px;
}

.admin-message .message-meta {
  font-size: 11px;
  color: var(--text2);
}

.admin-message-form {
  background: var(--bg2);
  border-radius: 8px;
  padding: 16px;
}

/* Mobile Portal Styles */
@media (max-width: 768px) {
  .portal-header {
    padding: 12px 16px;
  }
  
  .portal-header-content {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
  
  .portal-user {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .portal-content {
    padding: 16px;
  }
  
  .portal-section {
    padding: 16px;
  }
  
  .status-progress {
    flex-direction: column;
    gap: 16px;
  }
  
  .progress-step {
    flex-direction: row;
    min-width: auto;
    width: 100%;
    text-align: left;
    padding: 12px;
    background: var(--bg3);
    border-radius: 8px;
  }
  
  .progress-circle {
    width: 32px;
    height: 32px;
    font-size: 14px;
    flex-shrink: 0;
  }
  
  .progress-label {
    flex: 1;
    text-align: left;
    font-size: 14px;
    margin-left: 12px;
  }
  
  .upload-options {
    flex-direction: column;
  }
  
  .file-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .message-content {
    max-width: 85%;
  }
}

/* OCR Drag & Drop Zone */
.ocr-dropzone {
  margin-bottom: 20px;
  padding: 24px 16px;
  border: 2px dashed rgba(255,255,255,0.15);
  border-radius: 12px;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
  background: rgba(0,180,230,0.03);
}
.ocr-dropzone.dragover {
  border-color: var(--accent);
  background: rgba(0,180,230,0.1);
  transform: scale(1.01);
}
.ocr-dropzone:hover {
  border-color: rgba(255,255,255,0.3);
}

/* ============ SMART ASSISTANT BAR ============ */
.assistant-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 6px 10px;
  margin-bottom: 16px;
  backdrop-filter: blur(10px);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.assistant-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(var(--accent-rgb, 0,122,255), 0.25);
}
.assistant-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.95rem;
  padding: 8px 4px;
  min-width: 0;
}
.assistant-bar input::placeholder {
  color: rgba(255,255,255,0.35);
}
.assistant-bar button {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 10px;
  transition: color 0.2s, background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.assistant-bar button:hover {
  color: var(--accent);
  background: rgba(255,255,255,0.08);
}
.assistant-bar .assistant-send {
  color: var(--accent);
}
.assistant-bar .assistant-mic.recording {
  color: #ff4444;
  animation: mic-pulse 1s infinite;
}
@keyframes mic-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.assistant-response {
  margin-bottom: 16px;
  animation: fadeInUp 0.3s ease;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.assistant-bubble {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.5;
  white-space: pre-line;
  position: relative;
}
.assistant-bubble .assistant-icon {
  display: inline-block;
  margin-right: 6px;
  font-size: 1rem;
}
.assistant-bubble.action-weather {
  border-left: 3px solid #f0ad4e;
}
.assistant-bubble.action-message_sent {
  border-left: 3px solid #5cb85c;
}
.assistant-bubble.action-error {
  border-left: 3px solid #d9534f;
}
.assistant-bubble.action-info {
  border-left: 3px solid var(--accent);
}
.assistant-bubble .close-bubble {
  position: absolute;
  top: 6px;
  right: 10px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.3);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 6px;
}
.assistant-bubble .close-bubble:hover {
  color: rgba(255,255,255,0.7);
}

/* ============ ASSISTANT BAR ============ */
.assistant-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 16px;
  padding: 6px;
  background: var(--card-bg);
  border-radius: 28px;
  border: 2px solid var(--border);
  transition: border-color 0.2s;
}
.assistant-bar:focus-within {
  border-color: var(--accent);
}
.assistant-bar input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 15px;
  padding: 10px 4px;
  outline: none;
}
.assistant-bar input::placeholder {
  color: var(--text);
  opacity: 0.4;
}
.assistant-mic, .assistant-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
}
.assistant-mic {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  position: relative;
}
.assistant-mic:hover {
  background: rgba(255,255,255,0.15);
}
.assistant-mic.recording {
  background: #e53935;
  color: #fff;
  animation: pulse-mic 1s infinite;
}
@keyframes pulse-mic {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229,57,53,0.4); }
  50% { box-shadow: 0 0 0 10px rgba(229,57,53,0); }
}
.assistant-send {
  background: var(--accent);
  color: #fff;
}
.assistant-send:hover {
  opacity: 0.85;
}
#assistant-response {
  margin-bottom: 16px;
}
.assistant-bubble {
  position: relative;
  background: var(--card-bg);
  border-radius: 16px;
  padding: 14px 40px 14px 16px;
  border-left: 4px solid var(--accent);
  font-size: 14px;
  line-height: 1.5;
}
.assistant-bubble.error {
  border-left-color: #e53935;
}
.assistant-bubble.weather {
  border-left-color: #ff9800;
}
.assistant-bubble.message_sent {
  border-left-color: #4caf50;
}
.assistant-bubble.loading {
  opacity: 0.7;
  border-left-color: var(--border);
}
.assistant-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  color: var(--text);
  opacity: 0.4;
  font-size: 20px;
  cursor: pointer;
}
.assistant-close:hover {
  opacity: 1;
}

/* ============ PORTAL NOTIFICATION BADGE ============ */
.portal-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 12px;
  background: #e53935;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
  vertical-align: middle;
  position: relative;
  top: -1px;
  animation: badge-pop 0.3s ease, badge-pulse 2s infinite;
}
@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229,57,53,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(229,57,53,0); }
}
@keyframes badge-pop {
  0% { transform: scale(0); }
  70% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
.portal-unread-banner {
  background: linear-gradient(135deg, #00bcd4, #0097a7);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  margin: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,188,212,0.3);
  animation: slide-down 0.3s ease;
}
@keyframes slide-down {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.portal-unread-banner i {
  font-size: 20px;
}
.portal-unread-banner button {
  margin-left: auto;
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.4);
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.portal-unread-banner button:hover {
  background: rgba(255,255,255,0.3);
}

/* Ready for Montage pulse */
@keyframes pulse-ready {
  0%, 100% { box-shadow: 0 0 0 0 rgba(76,175,80,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(76,175,80,0); }
}

/* ============ INVENTORY STYLES ============ */
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.inventory-card {
  background: var(--bg3);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid rgba(0,177,230,0.1);
  transition: all 0.3s ease;
}

.inventory-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,177,230,0.1);
}

.inventory-card.critical {
  border-left-color: var(--danger) !important;
  background: linear-gradient(135deg, rgba(239,68,68,0.05), rgba(127,29,29,0.1));
}

.inventory-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.inventory-icon {
  font-size: 32px;
  min-width: 40px;
  text-align: center;
}

.inventory-name {
  font-size: 18px;
  font-weight: 600;
  flex: 1;
  color: var(--text);
}

.inventory-actions {
  display: flex;
  gap: 6px;
}

.inventory-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.inventory-quantity {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.quantity-number {
  font-size: 32px;
  font-weight: bold;
  line-height: 1;
}

.quantity-unit {
  font-size: 14px;
  color: var(--text2);
  font-weight: 500;
}

.inventory-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
  color: var(--text2);
}

.inventory-category {
  font-weight: 500;
}

.inventory-threshold {
  color: var(--text2);
}

.inventory-notes {
  font-style: italic;
  color: var(--text2);
  font-size: 13px;
}

.inventory-warning {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--danger);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.inventory-quick-actions {
  display: flex;
  gap: 6px;
  justify-content: center;
  padding-top: 12px;
  border-top: 1px solid rgba(0,177,230,0.1);
}

.inventory-quick-actions .btn {
  padding: 6px 12px;
  font-size: 12px;
  min-width: 45px;
}

/* Dashboard inventory section */
.inventory-critical {
  animation: pulse-critical 2s infinite;
}

@keyframes pulse-critical {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244,67,54,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(244,67,54,0); }
}

/* Mobile responsive */
@media (max-width: 768px) {
  .inventory-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .inventory-card {
    padding: 12px;
  }
  
  .inventory-header {
    flex-wrap: wrap;
  }
  
  .inventory-actions {
    width: 100%;
    justify-content: center;
    margin-top: 8px;
  }
  
  .quantity-number {
    font-size: 28px;
  }
}

/* ---- Long-Press Delete Modal ---- */
.delete-confirm-modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.delete-confirm-content {
  background: #1e1e2e; color: #fff;
  border-radius: 16px; padding: 28px;
  max-width: 360px; width: 90%;
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
  text-align: center;
}
.delete-confirm-content h2 { margin-top: 0; color: #ef5350; font-size: 20px; }
.delete-confirm-content p { margin: 8px 0; font-size: 16px; }
.delete-confirm-content .text-muted { color: #888; font-size: 13px; }
.delete-confirm-content .button-group { display: flex; gap: 12px; margin-top: 24px; }
.delete-confirm-content .button-group .btn {
  flex: 1; padding: 12px; border: none; border-radius: 10px;
  cursor: pointer; font-size: 15px; font-weight: 600;
}
.delete-confirm-content .btn-cancel { background: #333; color: #ccc; }
.delete-confirm-content .btn-danger { background: #d32f2f; color: #fff; }
.delete-confirm-content .btn:disabled { opacity: 0.5; cursor: not-allowed; }


/* ---- Bulk Select & Delete ---- */
[data-customer-id].bulk-selected {
  background: rgba(76, 175, 80, 0.2) !important;
  border-left: 4px solid #4CAF50 !important;
  position: relative;
}
[data-customer-id].bulk-selected::after {
  content: '✓';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #4CAF50;
  font-weight: bold;
  font-size: 20px;
  z-index: 2;
}
.selection-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #1a1a1a;
  color: white;
  padding: 12px 16px;
  z-index: 10000;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
  animation: slideDown 0.2s ease;
}
@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}
.selection-bar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}
.selection-count {
  font-weight: 600;
  font-size: 16px;
}
.selection-actions {
  display: flex;
  gap: 8px;
}
.selection-actions .btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}
.selection-actions .btn-secondary {
  background: #555;
  color: white;
}
.selection-actions .btn-danger {
  background: #d32f2f;
  color: white;
}
.selection-actions .btn:hover { opacity: 0.85; }
.selection-actions .btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* SwissSunConcept NAS */
.nas-hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 18px; margin-bottom: 16px; border: 1px solid rgba(0,188,212,.24); border-radius: 18px; background: linear-gradient(135deg, rgba(0,188,212,.14), rgba(15,23,42,.78)); box-shadow: 0 16px 34px rgba(0,0,0,.22); }
.nas-kicker { color: #67e8f9; font-size: 12px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 6px; }
.nas-hero h3 { margin: 0 0 5px; color: #fff; font-size: 26px; }
.nas-hero p { margin: 0; color: #b7c7d8; line-height: 1.45; }
.nas-status-card, .nas-search-card, .nas-file-list, .nas-note { border: 1px solid rgba(148,163,184,.18); border-radius: 14px; background: rgba(15,23,42,.72); }
.nas-status-card { margin-bottom: 14px; padding: 14px; color: #cbd5e1; }
.nas-status-card.online { border-color: rgba(34,197,94,.34); background: rgba(34,197,94,.09); }
.nas-status-card.offline { border-color: rgba(245,158,11,.35); background: rgba(245,158,11,.09); }
.nas-status-card strong { color: #fff; }
.nas-meta { margin-top: 5px; color: #9fb2c8; font-size: 12px; line-height: 1.45; }
.nas-missing { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.nas-missing code, .nas-meta code { padding: 3px 6px; border-radius: 6px; background: rgba(2,6,23,.8); color: #dbeafe; border: 1px solid rgba(148,163,184,.22); }
.nas-search-card { padding: 14px; margin-bottom: 16px; }
.nas-search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.nas-search-row input { width: 100%; box-sizing: border-box; background: var(--bg3); color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; font: inherit; }
.nas-search-hint { margin-top: 8px; color: #9fb2c8; font-size: 12px; }
.nas-grid { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 16px; align-items: start; }
.nas-section-title { margin: 0 0 10px; color: #fff; font-size: 17px; font-weight: 800; }
.nas-file-list { min-height: 260px; max-height: 520px; overflow: auto; padding: 8px; }
.nas-empty { padding: 26px 14px; color: #8fa4bd; text-align: center; }
.nas-empty.error { color: #fca5a5; }
.nas-result-title { padding: 8px 10px 12px; color: #9fb2c8; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.nas-file-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 11px; margin-bottom: 7px; border: 1px solid rgba(148,163,184,.14); border-radius: 12px; background: rgba(255,255,255,.035); cursor: pointer; transition: border-color .18s ease, transform .18s ease, background .18s ease; }
.nas-file-row:hover { transform: translateY(-1px); border-color: rgba(34,211,238,.48); background: rgba(14,116,144,.16); }
.nas-file-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: rgba(34,211,238,.12); color: #67e8f9; }
.nas-file-info { min-width: 0; display: grid; gap: 3px; }
.nas-file-info strong { color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nas-file-info span { color: #94a3b8; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nas-open-label { color: #67e8f9; font-size: 12px; font-weight: 800; }
.nas-upload-area { padding: 26px 16px; margin-bottom: 12px; border: 2px dashed rgba(34,197,94,.7); border-radius: 16px; background: rgba(34,197,94,.08); text-align: center; cursor: pointer; transition: background .18s ease, border-color .18s ease; }
.nas-upload-area.dragover, .nas-upload-area:hover { background: rgba(34,197,94,.16); border-color: #22c55e; }
.nas-note { padding: 12px; color: #9fb2c8; font-size: 12px; line-height: 1.45; }
@media (max-width: 820px) {
  .nas-hero, .nas-grid, .nas-search-row { grid-template-columns: 1fr; display: grid; }
}

/* WhatsApp inbox */
.whatsapp-inbox {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 14px;
  height: calc(100vh - 170px);
  min-height: 560px;
}

.whatsapp-sidebar,
.whatsapp-chat {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 0;
}

.whatsapp-sidebar {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.whatsapp-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.whatsapp-compose input,
.whatsapp-reply-form textarea {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
}

.whatsapp-status {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
}

.whatsapp-status .ok { color: #25d366; }
.whatsapp-status .warn { color: #fbbf24; }
.whatsapp-config-card { display: grid; gap: 8px; padding: 10px; border-radius: 10px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); }
.whatsapp-config-card.ready { border-color: rgba(37,211,102,.28); background: rgba(37,211,102,.08); }
.whatsapp-config-card.missing { border-color: rgba(251,191,36,.28); background: rgba(251,191,36,.08); }
.whatsapp-config-title { font-weight: 800; }
.whatsapp-config-small { color: var(--text2); font-size: 11px; line-height: 1.45; }
.whatsapp-missing-list, .whatsapp-setup-list { display: flex; flex-wrap: wrap; gap: 6px; }
.whatsapp-missing-list code, .whatsapp-setup-list code, .whatsapp-copy-line code { color: #dbeafe; background: rgba(15,23,42,.85); border: 1px solid rgba(148,163,184,.22); border-radius: 7px; padding: 4px 6px; font-size: 10px; word-break: break-all; }
.whatsapp-copy-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.whatsapp-copy-line.large code { font-size: 12px; padding: 10px; }
.whatsapp-copy-line button { border: 0; border-radius: 8px; padding: 8px 10px; color: #fff; background: #128c7e; cursor: pointer; }
.whatsapp-config-warning { padding: 8px 10px; border-radius: 9px; background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.28); color: #fecaca; font-size: 11px; line-height: 1.45; }

.whatsapp-thread-list {
  overflow-y: auto;
  padding: 8px;
}

.whatsapp-thread {
  position: relative;
  display: grid;
  gap: 3px;
  width: 100%;
  margin: 0 0 6px;
  padding: 11px 12px;
  text-align: left;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}

.whatsapp-thread:hover,
.whatsapp-thread.active {
  background: rgba(37, 211, 102, 0.1);
  border-color: rgba(37, 211, 102, 0.35);
}

.thread-title {
  font-weight: 700;
}

.thread-phone,
.thread-preview {
  color: var(--text2);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-unread {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #25d366;
  color: #07130b;
  font-size: 11px;
  font-weight: 800;
}

.whatsapp-chat {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.whatsapp-chat-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.whatsapp-chat-header strong,
.whatsapp-chat-header span {
  display: block;
}

.whatsapp-chat-header span {
  margin-top: 3px;
  color: var(--text2);
  font-size: 12px;
}

.whatsapp-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding: 16px;
  background:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 22px 22px;
}

.whatsapp-message {
  display: flex;
}

.whatsapp-message.outbound {
  justify-content: flex-end;
}

.whatsapp-bubble {
  max-width: min(72%, 620px);
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg3);
  color: var(--text);
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.whatsapp-message.outbound .whatsapp-bubble {
  background: rgba(37, 211, 102, 0.16);
  border: 1px solid rgba(37, 211, 102, 0.28);
}

.whatsapp-message-meta {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
  color: var(--text2);
  font-size: 11px;
}

.whatsapp-reply-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--border);
}

.whatsapp-empty {
  color: var(--text2);
  padding: 18px;
  text-align: center;
}

@media (max-width: 760px) {
  .whatsapp-inbox {
    grid-template-columns: 1fr;
    height: auto;
  }

  .whatsapp-sidebar,
  .whatsapp-chat {
    min-height: 320px;
  }

  .whatsapp-messages {
    min-height: 360px;
  }

  .whatsapp-bubble {
    max-width: 88%;
  }
}

/* ============ VOICE RECORDING OVERLAY ============ */
.voice-recording-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s;
}
.voice-recording-overlay.active {
  opacity: 1;
}
.voice-recording-container {
  text-align: center;
  color: #fff;
  padding: 40px;
}
.recording-indicator {
  margin-bottom: 20px;
}
.recording-dot {
  width: 20px;
  height: 20px;
  background: #e53935;
  border-radius: 50%;
  margin: 0 auto;
  animation: recording-pulse 1s infinite;
}
@keyframes recording-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
}
.waveform {
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: center;
  height: 40px;
  margin-bottom: 20px;
}
.wave-bar {
  width: 4px;
  background: var(--accent, #4fc3f7);
  border-radius: 2px;
  animation: wave 0.8s ease-in-out infinite;
}
.wave-bar:nth-child(1) { animation-delay: 0s; height: 10px; }
.wave-bar:nth-child(2) { animation-delay: 0.1s; height: 20px; }
.wave-bar:nth-child(3) { animation-delay: 0.2s; height: 30px; }
.wave-bar:nth-child(4) { animation-delay: 0.3s; height: 40px; }
.wave-bar:nth-child(5) { animation-delay: 0.2s; height: 30px; }
.wave-bar:nth-child(6) { animation-delay: 0.1s; height: 20px; }
.wave-bar:nth-child(7) { animation-delay: 0s; height: 10px; }
@keyframes wave {
  0%, 100% { transform: scaleY(0.5); }
  50% { transform: scaleY(1); }
}
.recording-text {
  font-size: 1.2rem;
  margin-bottom: 8px;
}
.recording-subtitle {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-bottom: 16px;
}
.recording-timer {
  font-size: 1.5rem;
  font-family: monospace;
  margin-bottom: 24px;
  color: #e53935;
}
.stop-recording-btn {
  background: #e53935;
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 12px 32px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}
.stop-recording-btn:hover {
  background: #c62828;
}

/* Long-press indicator */
.long-press-indicator {
  position: absolute;
  top: -4px; left: -4px; right: -4px; bottom: -4px;
  border: 3px solid transparent;
  border-radius: 50%;
  border-top-color: var(--accent, #4fc3f7);
  animation: lp-spin 2s linear;
  pointer-events: none;
}
.long-press-indicator.active {
  border-color: #e53935;
  animation: none;
}
@keyframes lp-spin {
  to { transform: rotate(360deg); }
}
.long-press-hint {
  position: absolute;
  top: 110%;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  z-index: 100;
  pointer-events: none;
}

/* Voice processing/success/error */
.voice-processing {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  color: var(--text);
  opacity: 0.8;
}
.processing-spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: var(--accent, #4fc3f7);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.voice-success {
  padding: 10px 14px;
  background: rgba(76,175,80,0.15);
  border-left: 3px solid #4caf50;
  border-radius: 8px;
  color: #a5d6a7;
  margin: 8px 0;
  animation: fadeInUp 0.3s;
}
.voice-error {
  padding: 10px 14px;
  background: rgba(244,67,54,0.15);
  border-left: 3px solid #f44336;
  border-radius: 8px;
  color: #ef9a9a;
  margin: 8px 0;
  animation: fadeInUp 0.3s;
}
.mic-permission-prompt {
  padding: 12px;
  background: rgba(255,152,0,0.1);
  border-left: 3px solid #ff9800;
  border-radius: 8px;
  color: var(--text);
  margin: 8px 0;
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ========== WICHTIG-CARDS MODERN REDESIGN ========== */

/* GLOBAL FIX: Remove all problematic outlines */
#content > * {
  outline: none !important;
  box-shadow: none !important;
}

#content div {
  outline: none !important;
}

/* Wichtig Card Container */
.wichtig-card {
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
  outline: none !important;
  box-shadow: none !important;
}

.wichtig-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.05), transparent);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.wichtig-card:hover::before {
  opacity: 1;
}

.wichtig-card button {
  transition: all 0.2s ease;
}

.wichtig-card button:hover {
  transform: scale(1.08);
  opacity: 1 !important;
}

.wichtig-card button:active {
  transform: scale(0.95);
}

/* Wichtig Customer Card */
.wichtig-customer-card {
  position: relative;
  overflow: hidden;
}

.wichtig-customer-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.5s;
  pointer-events: none;
}

.wichtig-customer-card:hover::after {
  left: 100%;
}

/* Tab Animations */
.tab-btn-modern {
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Empty State */
.empty-wichtig-state {
  padding: 40px 20px;
  text-align: center;
  background: rgba(71, 85, 105, 0.1);
  border: 2px dashed rgba(255, 87, 34, 0.2);
  border-radius: 12px;
  animation: fadeIn 0.4s ease-out;
}

.empty-wichtig-state i {
  font-size: 48px;
  color: #94a3b8;
  margin-bottom: 16px;
  display: block;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInCard {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Priorität Badges */
.priority-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  transition: all 0.2s;
}

.priority-critical {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.priority-warning {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.priority-info {
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  color: #fff;
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}

/* File/Image Display */
.wichtig-file-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
}

.wichtig-file-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.wichtig-image {
  max-width: 100%;
  border-radius: 8px;
  margin-top: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid rgba(255, 87, 34, 0.2);
}

.wichtig-image:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 24px rgba(255, 87, 34, 0.2);
}

/* Responsive Grid für Cards */
@media (max-width: 768px) {
  .wichtig-card {
    margin-bottom: 10px;
  }
  
  .wichtig-card button {
    font-size: 11px;
    padding: 6px;
  }
}

@media (min-width: 769px) {
  .wichtig-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
  }
}

/* Fördercheck Dashboard: bewusst kompakt, damit er als Arbeitswerkzeug wirkt. */
.funding-check-card { margin-top: 12px; padding: 12px 14px; border: 1px solid rgba(148,163,184,.2); border-radius: 14px; background: rgba(15,23,42,.68); box-shadow: none; }
.funding-check-card.loading { color: var(--text2); }
.funding-check-compact { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.funding-check-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: rgba(34,211,238,.1); color: #67e8f9; }
.funding-check-copy { min-width: 0; }
.funding-check-title { color: #cbd5e1; font-size: 14px; line-height: 1.35; }
.funding-check-title strong { color: #f8fafc; }
.funding-check-facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.funding-check-facts span { color: #94a3b8; font-size: 11px; }
.funding-check-facts span + span::before { content: "·"; margin-right: 6px; color: #475569; }
.funding-next-task { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(148,163,184,.14); }
.funding-next-task > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; min-width: 0; }
.funding-next-task span { color: #64748b; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.funding-next-task strong { color: #e2e8f0; font-size: 14px; }
.funding-next-task small, .funding-row-next { color: #94a3b8; font-size: 12px; }
.funding-row-next { margin-top: 6px; }
.funding-check-error { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: #fbbf24; }
.funding-check-header { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: start; }
.funding-kicker { color: #67e8f9; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 2px; }
.funding-check-card h3 { margin: 0 0 5px; color: #fff; font-size: 18px; }
.funding-check-card p { margin: 0; color: #b7c7d8; line-height: 1.45; }
.funding-summary { display: grid; grid-template-columns: repeat(2, minmax(72px, 1fr)); gap: 8px; min-width: 260px; }
.funding-summary > div { padding: 10px; border-radius: 12px; background: rgba(255,255,255,.08); text-align: center; }
.funding-summary strong, .funding-modal-stats strong { display: block; color: #22d3ee; font-size: 24px; line-height: 1; }
.funding-summary span, .funding-modal-stats span { color: #a9bad0; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.funding-summary button { grid-column: span 2; }
.funding-disclaimer { display: flex; gap: 8px; align-items: center; margin: 14px 0; padding: 10px 12px; border-radius: 12px; background: rgba(251,191,36,.11); border: 1px solid rgba(251,191,36,.24); color: #fde68a; font-size: 13px; }
.funding-list { display: grid; gap: 10px; }
.funding-customer-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid rgba(148,163,184,.22); border-radius: 14px; background: rgba(15,23,42,.72); cursor: pointer; transition: transform .18s ease, border-color .18s ease, background .18s ease; }
.funding-customer-row:hover { transform: translateY(-1px); border-color: rgba(34,211,238,.55); background: rgba(14,116,144,.18); }
.funding-customer-row.checked { opacity: .74; }
.funding-row-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: #fff; }
.funding-priority { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.funding-priority.high { background: rgba(239,68,68,.18); color: #fca5a5; border: 1px solid rgba(239,68,68,.35); }
.funding-priority.medium { background: rgba(245,158,11,.18); color: #fbbf24; border: 1px solid rgba(245,158,11,.35); }
.funding-priority.low { background: rgba(59,130,246,.18); color: #93c5fd; border: 1px solid rgba(59,130,246,.35); }
.funding-priority.checked { background: rgba(34,197,94,.18); color: #86efac; border: 1px solid rgba(34,197,94,.35); }
.funding-row-location { margin-top: 5px; color: #9fb2c8; font-size: 13px; }
.funding-row-location.missing { color: #fbbf24; }
.funding-hint-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.funding-hint-tags span { padding: 5px 8px; border-radius: 999px; background: rgba(255,255,255,.07); color: #cbd5e1; font-size: 12px; }
.funding-hint-tags .funding-tag-warning { background: rgba(245,158,11,.16); border: 1px solid rgba(245,158,11,.28); color: #fbbf24; }
.funding-hint-tags .funding-tag-auto { background: rgba(34,197,94,.16); border: 1px solid rgba(34,197,94,.28); color: #86efac; }
.funding-row-actions { display: flex; align-items: center; gap: 8px; }
.funding-checked { display: inline-flex; align-items: center; gap: 6px; color: #86efac; font-weight: 700; }
.funding-empty { padding: 16px; border-radius: 14px; background: rgba(255,255,255,.05); color: #a9bad0; text-align: center; }
.funding-modal, .funding-detail-modal { max-width: 980px; width: min(94vw, 980px); max-height: 86vh; overflow: auto; }
.funding-modal-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; margin: 10px 0 14px; }
.funding-modal-stats > div { padding: 12px; border-radius: 14px; background: rgba(0,188,212,.08); border: 1px solid rgba(0,188,212,.18); text-align: center; }
.funding-modal-section { margin-top: 16px; display: grid; gap: 10px; }
.funding-modal-section h3 { margin: 0 0 2px; color: #fff; }
.funding-detail-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.funding-detail-meta > div { padding: 8px 10px; border-radius: 999px; background: rgba(255,255,255,.07); color: #cbd5e1; font-size: 13px; }
.funding-detail-hints { display: grid; gap: 10px; }
.funding-detail-hint { padding: 13px; border-radius: 14px; background: rgba(15,23,42,.76); border: 1px solid rgba(148,163,184,.18); }
.funding-detail-hint strong { color: #fff; }
.funding-detail-hint p { margin: 7px 0; color: #cbd5e1; line-height: 1.45; }
.funding-detail-hint a { color: #22d3ee; text-decoration: none; font-weight: 700; }
.funding-source-button { display: inline-flex; align-items: center; gap: 7px; padding: 0; border: 0; background: transparent; color: #22d3ee; font: inherit; font-weight: 800; cursor: pointer; }
.funding-source-button:hover, .funding-source-button:focus-visible { color: #67e8f9; text-decoration: underline; outline: none; }
.funding-auto-check { margin: 10px 0 12px; padding: 12px; border-radius: 12px; border: 1px solid rgba(34,197,94,.28); background: rgba(20,83,45,.22); }
.funding-auto-check.missing { border-color: rgba(245,158,11,.28); background: rgba(120,53,15,.2); }
.funding-auto-check.pending, .funding-auto-check.loading { border-color: rgba(34,211,238,.3); background: rgba(8,47,73,.25); }
.funding-auto-check.found { border-color: rgba(34,197,94,.4); background: rgba(20,83,45,.28); }
.funding-auto-check.not_found { border-color: rgba(148,163,184,.3); background: rgba(15,23,42,.52); }
.funding-auto-check.error { border-color: rgba(239,68,68,.34); background: rgba(127,29,29,.22); }
.funding-auto-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.funding-auto-head strong { color: #dcfce7; }
.funding-auto-head span { color: #86efac; font-weight: 800; }
.funding-auto-check.missing .funding-auto-head strong, .funding-auto-check.missing .funding-auto-head span { color: #fbbf24; }
.funding-auto-check.error .funding-auto-head strong, .funding-auto-check.error .funding-auto-head span { color: #fca5a5; }
.funding-auto-check p { margin: 8px 0; }
.funding-auto-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.funding-auto-meta span { padding: 5px 8px; border-radius: 999px; background: rgba(255,255,255,.08); color: #cbd5e1; font-size: 12px; }
.funding-auto-check ul { margin: 8px 0 0 18px; padding: 0; color: #dbeafe; line-height: 1.5; }
.funding-auto-snippets { margin-top: 10px; padding: 10px; border-radius: 10px; background: rgba(255,255,255,.06); }
.funding-auto-snippets strong { color: #fff; }
.funding-auto-run { margin-top: 10px; }
.funding-ai-panel, .funding-tax-panel { display: grid; gap: 12px; align-items: center; margin: 12px 0; padding: 14px; border-radius: 14px; border: 1px solid rgba(34,211,238,.22); background: rgba(8,47,73,.35); }
.funding-ai-panel { grid-template-columns: minmax(0, 1fr) auto; }
.funding-ai-panel strong, .funding-tax-panel strong { color: #fff; }
.funding-ai-panel p, .funding-tax-panel p { margin: 5px 0 0; color: #cbd5e1; line-height: 1.45; }
.funding-tax-panel.critical { border-color: rgba(239,68,68,.35); background: rgba(127,29,29,.25); }
.funding-data-gaps { margin-top: 9px; color: #fbbf24; font-weight: 700; font-size: 13px; }
.funding-detail-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 16px; }
@media (max-width: 760px) {
  .funding-check-header, .funding-customer-row { grid-template-columns: 1fr; }
  .funding-check-compact { grid-template-columns: auto minmax(0, 1fr); }
  .funding-open-list { grid-column: 1 / -1; width: 100%; }
  .funding-next-task { grid-template-columns: 1fr; }
  .funding-next-task .btn { width: 100%; }
  .funding-check-error { align-items: stretch; flex-direction: column; }
  .funding-summary, .funding-modal-stats { grid-template-columns: repeat(2, 1fr); min-width: 0; }
  .funding-ai-panel { grid-template-columns: 1fr; }
  .funding-row-actions { justify-content: stretch; }
  .funding-row-actions .btn { flex: 1; }
}

@media (max-width: 820px) {
  .receipt-tool-grid { grid-template-columns: 1fr !important; }
  .receipt-stats { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

/* Obsidian Projektbericht-Import */
.project-report-modal { max-width: 820px; width: 94%; max-height: 84vh; overflow: hidden; }
.project-report-modal .modal-body { max-height: 70vh; overflow: auto; }
.project-report-customer { background: rgba(0,188,212,.10); border: 1px solid rgba(0,188,212,.28); border-radius: 12px; color: #d8fbff; margin-bottom: 14px; padding: 12px; }
.project-report-candidates { display: grid; gap: 10px; }
.project-report-candidate { align-items: center; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.10); border-radius: 14px; display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr) auto; padding: 12px; }
.project-report-title { color: #fff; font-weight: 800; margin-bottom: 4px; }
.project-report-path { color: #9fb2c8; font-size: 12px; overflow-wrap: anywhere; }
.project-report-meta { color: #66e7ff; font-size: 12px; margin-top: 5px; }
.project-report-empty { background: rgba(255,152,0,.10); border: 1px solid rgba(255,152,0,.35); border-radius: 12px; color: #ffcc80; line-height: 1.45; padding: 14px; }
@media (max-width: 620px) {
  .project-report-candidate { grid-template-columns: 1fr; }
}

/* DC-Abnahmeprotokoll */
.dc-acceptance-app { display: grid; gap: 16px; }
.dc-toolbar, .dc-data-panel { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.dc-toolbar h1 { margin: 0 0 6px; color: var(--accent); font-size: 24px; }
.dc-toolbar p, .dc-status { color: var(--text2); margin: 0; }
.dc-controls { display: grid; grid-template-columns: minmax(220px, 1fr) auto auto auto; gap: 10px; align-items: end; margin-top: 14px; }
.dc-file-picker span, .dc-data-panel label { display: block; margin-bottom: 6px; color: var(--text2); font-size: 12px; font-weight: 700; }
.dc-file-picker input, .dc-data-panel input, .dc-data-panel textarea { width: 100%; box-sizing: border-box; background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; color: var(--text); padding: 10px 12px; font: inherit; }
.dc-status { min-height: 18px; margin-top: 10px; font-size: 13px; }
.ac-inverter-lookup-row, .ac-grid-lookup-row { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 8px; align-items: center; }
.ac-inverter-lookup-btn, .ac-grid-lookup-btn { width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 8px; background: var(--accent); color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.ac-inverter-lookup-btn:disabled, .ac-grid-lookup-btn:disabled { opacity: .58; cursor: wait; }
.ac-inverter-lookup-status, .ac-grid-lookup-status { min-height: 16px; margin-top: 6px; color: var(--text2); font-size: 12px; line-height: 1.35; }
.ac-inverter-lookup-status[data-type="ok"], .ac-grid-lookup-status[data-type="ok"] { color: #27d36f; }
.ac-inverter-lookup-status[data-type="info"], .ac-grid-lookup-status[data-type="info"] { color: var(--accent); }
.ac-inverter-lookup-status[data-type="warn"], .ac-grid-lookup-status[data-type="warn"] { color: #f4a11b; }
.dc-editor { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 210mm); gap: 18px; align-items: start; }
.dc-data-panel { position: sticky; top: 12px; }
.dc-data-panel h2 { margin: 0 0 12px; color: var(--accent); font-size: 18px; }
.dc-data-grid { display: grid; gap: 10px; }
.dc-protocol-page { position: relative; width: 210mm; min-height: 297mm; margin: 0 auto; padding: 10mm 18mm 31mm; background: #fff; color: #1d2528; box-shadow: 0 10px 30px rgba(0,0,0,.28); font-family: Arial, Helvetica, sans-serif; font-size: 7.8pt; line-height: 1.25; }
.dc-doc-header { margin-bottom: 3mm; border-bottom: .7mm solid #f4a11b; padding-bottom: 2.5mm; }
.dc-header-top { display: grid; grid-template-columns: 34mm 1fr 15mm; gap: 5mm; align-items: center; }
.dc-logo-card { height: 22mm; display: flex; align-items: center; justify-content: center; border: 1px solid #d8e0e3; border-radius: 3mm; background: #f9fbfb; }
.dc-logo { width: 28mm; max-height: 16mm; object-fit: contain; }
.dc-doc-kicker { color: #176b5a; font-size: 7pt; font-weight: 800; letter-spacing: .6pt; text-transform: uppercase; }
.dc-doc-badge { width: 14mm; height: 14mm; display: flex; flex-direction: column; justify-content: center; align-items: center; border-radius: 50%; background: #176b5a; color: #fff; font-size: 8pt; font-weight: 800; line-height: 1; box-shadow: 0 0 0 1.2mm #eaf3f1; }
.dc-doc-badge span { color: #fff !important; font-size: 6pt !important; font-weight: 700 !important; letter-spacing: .6pt; }
.dc-brand, .dc-protocol-page h2 { color: #176b5a; font-weight: 700; }
.dc-protocol-page h1 { margin: .8mm 0 .8mm; font-size: 15pt; line-height: 1.05; color: #1d2528; }
.dc-protocol-page h1 span, .dc-protocol-page h2 span, .dc-protocol-page td span, .dc-protocol-page p span, .dc-protocol-page label span { color: #657377; font-size: .82em; font-weight: 400; }
.dc-subtitle, .dc-hint { color: #657377; margin: .6mm 0 0; }
.dc-project-strip { display: grid; grid-template-columns: 1.05fr 1.45fr .7fr 1fr; gap: 1.2mm; margin-top: 2.5mm; }
.dc-project-strip > div { min-height: 9mm; padding: 1.2mm 1.5mm; border: 1px solid #d8e0e3; border-radius: 2mm; background: #f5f8f8; overflow: hidden; }
.dc-project-strip span { display: block; color: #657377; font-size: 5.7pt; font-weight: 800; text-transform: uppercase; letter-spacing: .35pt; }
.dc-project-strip strong { display: block; margin-top: .5mm; color: #1d2528; font-size: 7pt; line-height: 1.15; overflow-wrap: anywhere; }
.dc-hint { font-size: 6.2pt; padding: 1.2mm 1.5mm; border-left: .8mm solid #176b5a; background: #f5f8f8; border-radius: 1.5mm; }
.dc-protocol-page h2 { margin: 2.5mm 0 1.1mm; font-size: 9pt; }
.dc-info-grid { display: grid; grid-template-columns: repeat(2, 1fr); border: 1px solid #d8e0e3; border-radius: 3mm; overflow: hidden; }
.dc-info-box { min-height: 10mm; padding: 1mm 1.7mm; border-right: 1px solid #d8e0e3; border-bottom: 1px solid #d8e0e3; background: #f5f8f8; }
.dc-info-box:nth-child(2n) { border-right: 0; }
.dc-info-box label { display: block; margin: 0 0 .4mm; color: #657377; font-size: 6.5pt; font-weight: 700; }
.dc-info-box input, .dc-measure-table input, .dc-comment-box { width: 100%; box-sizing: border-box; border: 0; background: transparent; color: #1d2528; font: inherit; }
.dc-table { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid #d8e0e3; border-radius: 3mm; overflow: hidden; }
.dc-table th, .dc-table td { padding: .85mm 1.4mm; border-right: 1px solid #d8e0e3; border-bottom: 1px solid #d8e0e3; text-align: left; vertical-align: middle; }
.dc-table th { color: #657377; background: #f5f8f8; font-size: 6.5pt; }
.dc-table td:last-child, .dc-table th:last-child { border-right: 0; }
.dc-table tr:last-child td { border-bottom: 0; }
.dc-table input[type="checkbox"] { width: 3.8mm; height: 3.8mm; accent-color: #176b5a; }
.dc-table .dc-nr, .dc-table .dc-tick, .dc-table td:first-child, .dc-table td:nth-child(3), .dc-table td:nth-child(4) { text-align: center; }
.dc-comment-box { min-height: 8mm; padding: 1mm 1.7mm; border: 1px solid #d8e0e3; border-radius: 3mm; resize: vertical; }
.dc-signature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid #d8e0e3; border-radius: 3mm; overflow: hidden; }
.dc-signature-grid > div:first-child { border-right: 1px solid #d8e0e3; }
.dc-signature-grid canvas { display: block; width: 100%; height: 10.5mm; background: #fff; touch-action: none; cursor: crosshair; }
.dc-signature-grid label { display: block; padding: .9mm 1.7mm; color: #657377; background: #f5f8f8; border-top: 1px solid #d8e0e3; font-size: 6.8pt; font-weight: 700; }
.dc-footer { position: absolute; left: 0; right: 0; bottom: 0; color: #fff; background: #2598d1; font-size: 8pt; font-weight: 700; line-height: 1.05; }
.dc-footer-stripe { height: 2mm; background: #f4a11b; }
.dc-footer-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; min-height: 24mm; padding: 4mm 18mm; gap: 9mm; }
.dc-footer-grid > div + div { border-left: 1mm solid #f4a11b; padding-left: 9mm; }
@media (max-width: 1080px) {
  .dc-controls, .dc-editor { grid-template-columns: 1fr; }
  .dc-data-panel { position: static; }
  .dc-protocol-page { width: 100%; min-height: auto; padding: 14px; }
  .dc-footer { position: static; margin: 14px -14px -14px; }
}
@media (max-width: 620px) {
  .dc-header-top, .dc-project-strip, .dc-info-grid, .dc-signature-grid, .dc-footer-grid { grid-template-columns: 1fr; }
  .dc-info-box, .dc-signature-grid > div:first-child, .dc-footer-grid > div + div { border-right: 0; border-left: 0; }
  .dc-doc-badge { display: none; }
}
@media print {
  @page { size: A4; margin: 0; }
  body.dc-print-mode { background: #fff !important; }
  body.dc-print-mode .app-header,
  body.dc-print-mode .bottom-nav,
  body.dc-print-mode .no-print,
  body.dc-print-mode .dc-data-panel,
  body.dc-print-mode .dc-toolbar { display: none !important; }
  body.dc-print-mode #content { max-width: none !important; padding: 0 !important; margin: 0 !important; }
  body.dc-print-mode .dc-acceptance-app,
  body.dc-print-mode .dc-editor { display: block !important; }
  body.dc-print-mode .dc-protocol-page { width: 210mm; min-height: 297mm; padding: 10mm 18mm 31mm; box-shadow: none; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* Tagesverlaeufe der Kundennotizen */
.crm-note-day { margin: 8px 0; border: 1px solid rgba(255,152,0,.25); border-radius: 10px; background: rgba(0,0,0,.12); overflow: hidden; }
.crm-note-day[hidden] { display: none !important; }
#customer-pending-notes .reonic-note-item[hidden] { display: none !important; }
.crm-note-day-summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 46px; padding: 9px 12px; color: var(--text); font-size: 13px; font-weight: 700; cursor: pointer; list-style: none; }
.crm-note-day-summary::-webkit-details-marker { display: none; }
.crm-note-day-summary::marker { content: ''; }
.crm-note-day-summary:hover { background: rgba(255,152,0,.09); }
.crm-note-day-summary:focus-visible { outline: 2px solid #ff9800; outline-offset: -2px; }
.crm-note-day-summary .fa-chevron-right { margin-right: 6px; color: #ffb74d; transition: transform .15s ease; }
.crm-note-day[open] .crm-note-day-summary .fa-chevron-right { transform: rotate(90deg); }
.crm-note-day-count { color: #ffcc80; font-size: 11px; white-space: nowrap; }
.crm-note-day-body { padding: 4px 8px 8px; border-top: 1px solid rgba(255,255,255,.06); }
.crm-note-day-body .crm-note-card:last-child { margin-bottom: 0 !important; }
.crm-note-text.is-clamped { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.crm-note-text.is-clamped.is-expanded { display: block; }
.crm-note-expand { margin: 0 0 4px; padding: 0; border: 0; background: transparent; color: #7dd3fc; font: inherit; font-size: 11px; cursor: pointer; }
.crm-note-expand:focus-visible { outline: 2px solid #7dd3fc; outline-offset: 2px; }
.crm-note-mail-details { margin-top: 5px; font-size: 11px; color: #94a3b8; }
.crm-note-mail-details > summary { width: fit-content; cursor: pointer; }

/* Reonic-Notizen: schnelle Suche mit mobiler Spracheingabe */
.reonic-notes-section {
  margin-top: 16px;
  padding: 14px;
  background: linear-gradient(135deg, rgba(255, 152, 0, .12), rgba(255, 69, 0, .08));
  border: 1px solid rgba(255, 152, 0, .3);
  border-radius: 12px;
}
.reonic-notes-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.reonic-notes-heading h3 {
  margin: 0;
  color: #ff9800;
}
.reonic-notes-total {
  padding: 4px 9px;
  border: 1px solid rgba(255, 152, 0, .28);
  border-radius: 999px;
  background: rgba(255, 152, 0, .1);
  color: #ffcc80;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.reonic-notes-search-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  margin-bottom: 7px;
  padding-right: clamp(70px, 10vw, 96px);
}
.reonic-notes-search-box {
  order: 2;
  min-height: 46px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 0 11px;
  border: 1px solid rgba(255, 152, 0, .34);
  border-radius: 10px;
  background: rgba(3, 7, 18, .54);
  color: #ffb74d;
}
.reonic-notes-search-box:focus-within {
  border-color: #ff9800;
  box-shadow: 0 0 0 3px rgba(255, 152, 0, .13);
}
.reonic-notes-search-box input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
}
.reonic-notes-search-box input::placeholder { color: #7f8da3; }
.reonic-notes-search-box button {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
}
.reonic-notes-search-box button:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.reonic-notes-voice-btn {
  order: 1;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border: 1px solid rgba(34, 211, 238, .38);
  border-radius: 10px;
  background: rgba(6, 182, 212, .13);
  color: #67e8f9;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.reonic-notes-voice-btn:hover { background: rgba(6, 182, 212, .22); }
.reonic-notes-voice-btn.is-listening {
  border-color: rgba(248, 113, 113, .7);
  background: rgba(239, 68, 68, .2);
  color: #fecaca;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, .12);
}
.reonic-notes-search-feedback {
  min-height: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  margin-bottom: 8px;
  color: #94a3b8;
  font-size: 12px;
}
#pending-note-search-status { color: #67e8f9; }
#pending-note-search-status.is-error { color: #fca5a5; }
.reonic-notes-search-empty {
  margin: 4px 0 9px;
  padding: 16px;
  border: 1px dashed rgba(255, 152, 0, .35);
  border-radius: 10px;
  color: #ffcc80;
  text-align: center;
}
.reonic-note-item[hidden],
.reonic-notes-search-empty[hidden],
#pending-note-search-clear[hidden],
#pending-note-search-status[hidden] {
  display: none !important;
}

@media (max-width: 620px) {
  .reonic-notes-section { padding: 11px; }
  .reonic-notes-search-row { grid-template-columns: auto minmax(0, 1fr); }
}

@media (max-width: 440px) {
  .reonic-notes-voice-btn {
    width: 46px;
    padding: 0;
  }
  .reonic-notes-voice-btn span { display: none; }
}

/* ============================================================
   PV-Anlagenmonitoring
   ============================================================ */
.detail-tabs {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.detail-tab { min-width: 68px; }

/* Tool labels need their full width on narrow screens; scroll instead of overlap. */
#tools-tabs > .detail-tab {
  flex: 0 0 auto !important;
  min-width: max-content;
}

.customer-item-with-monitoring { flex-wrap: wrap; }
.customer-monitoring-list {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}
.monitoring-state-pill {
  --monitoring-color: #cbd5e1;
  --monitoring-bg: rgba(148,163,184,0.14);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--monitoring-color);
  border-radius: 999px;
  background: var(--monitoring-bg);
  color: var(--monitoring-color);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}
.monitoring-state-pill strong {
  padding-left: 6px;
  border-left: 1px solid var(--monitoring-color);
  color: #fff;
  font-size: 11px;
}
.monitoring-list-portal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid rgba(56,189,248,0.32);
  border-radius: 8px;
  background: rgba(14,165,233,0.12);
  color: #7dd3fc;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.monitoring-list-portal-btn:hover { background: rgba(14,165,233,0.22); }

.customer-monitoring-view { display: grid; gap: 14px; }
.monitoring-overview-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid rgba(56,189,248,0.24);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(14,165,233,0.13), rgba(15,14,31,0.96) 62%);
}
.monitoring-overview-copy { min-width: 0; }
.monitoring-eyebrow,
.monitoring-provider-label {
  display: block;
  margin-bottom: 5px;
  color: #67e8f9;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.monitoring-overview-card h2 { margin: 0 0 6px; font-size: 20px; }
.monitoring-overview-card p { max-width: 720px; color: #cbd5e1; font-size: 13px; line-height: 1.55; }
.monitoring-overview-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;
}
.monitoring-overview-actions .btn,
.monitoring-installation-actions .btn,
.monitoring-section-heading .btn,
.monitoring-link-form .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.monitoring-security-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid rgba(34,197,94,0.22);
  border-radius: 10px;
  background: rgba(34,197,94,0.08);
  color: #bbf7d0;
  font-size: 12px;
  line-height: 1.45;
}
.monitoring-security-note i { margin-top: 2px; color: #4ade80; }
.monitoring-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}
.monitoring-section-heading > div { display: flex; align-items: baseline; gap: 9px; }
.monitoring-section-heading h3 { margin: 0; font-size: 17px; }
.monitoring-section-heading span { color: var(--text2); font-size: 12px; }
.monitoring-installations-list { display: grid; gap: 12px; }
.monitoring-installation-card {
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  background: var(--bg2);
}
.monitoring-installation-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.monitoring-installation-header h3 { margin: 0; font-size: 17px; }
.monitoring-installation-ids {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  margin-top: 5px;
  color: var(--text2);
  font-size: 11px;
  overflow-wrap: anywhere;
}
.monitoring-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 8px;
}
.monitoring-metric {
  display: grid;
  grid-template-columns: auto minmax(0,1fr);
  gap: 3px 7px;
  min-width: 0;
  padding: 11px;
  border: 1px solid rgba(148,163,184,0.12);
  border-radius: 10px;
  background: rgba(255,255,255,0.025);
}
.monitoring-metric i { grid-row: 1 / span 2; align-self: center; color: #38bdf8; }
.monitoring-metric span { color: var(--text2); font-size: 10px; line-height: 1.25; }
.monitoring-metric strong { overflow-wrap: anywhere; color: #fff; font-size: 14px; }
.monitoring-timestamps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 11px;
  color: var(--text2);
  font-size: 11px;
}
.monitoring-timestamps i { margin-right: 4px; color: #7dd3fc; }
.monitoring-timestamps strong { color: #cbd5e1; }
.monitoring-last-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(245,158,11,0.10);
  color: #fde68a;
  font-size: 11px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.monitoring-alarms {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.monitoring-alarms h4 { margin: 0 0 8px; font-size: 13px; }
.monitoring-no-alarms {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #86efac;
  font-size: 12px;
}
.monitoring-alarm-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 7px;
  padding: 9px 10px;
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: 9px;
  background: rgba(239,68,68,0.09);
  color: #fecaca;
}
.monitoring-alarm-item > i { margin-top: 2px; color: #f87171; }
.monitoring-alarm-item > div { display: grid; gap: 2px; min-width: 0; }
.monitoring-alarm-item strong { overflow-wrap: anywhere; font-size: 12px; }
.monitoring-alarm-item span { color: #fca5a5; font-size: 10px; }
.monitoring-installation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.monitoring-empty-state,
.monitoring-error-state,
.monitoring-loading {
  padding: 32px 18px;
  border: 1px dashed rgba(148,163,184,0.24);
  border-radius: 14px;
  background: rgba(15,14,31,0.72);
  color: var(--text2);
  text-align: center;
}
.monitoring-empty-state > i,
.monitoring-error-state > i { margin-bottom: 9px; color: #7dd3fc; font-size: 30px; }
.monitoring-empty-state h3,
.monitoring-error-state h3 { margin: 0 0 5px; color: var(--text); font-size: 17px; }
.monitoring-empty-state p,
.monitoring-error-state p { max-width: 620px; margin: 0 auto 13px; font-size: 12px; line-height: 1.5; }
.monitoring-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.monitoring-link-form {
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid rgba(56,189,248,0.3);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(14,165,233,0.10), rgba(15,14,31,0.98));
  scroll-margin-top: calc(var(--header-height) + var(--safe-top) + 12px);
}
.monitoring-link-form-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}
.monitoring-link-form-header span { color: #67e8f9; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.monitoring-link-form-header h3 { margin: 3px 0 0; font-size: 17px; }
.monitoring-form-close {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(148,163,184,0.2);
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  color: var(--text2);
  font-size: 23px;
  cursor: pointer;
}
.monitoring-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 11px;
}
.monitoring-form-grid label { display: grid; gap: 6px; min-width: 0; }
.monitoring-form-grid label > span { color: #cbd5e1; font-size: 12px; font-weight: 700; }
.monitoring-form-grid small { color: var(--text2); font-weight: 500; }
.monitoring-form-grid input,
.monitoring-form-grid select {
  width: 100%;
  min-height: 44px;
  padding: 10px 11px;
  border: 1px solid rgba(148,163,184,0.24);
  border-radius: 9px;
  outline: none;
  background: #111020;
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.monitoring-form-grid input:focus,
.monitoring-form-grid select:focus { border-color: #38bdf8; box-shadow: 0 0 0 3px rgba(56,189,248,0.11); }
.monitoring-enabled-toggle {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 13px;
  cursor: pointer;
}
.monitoring-enabled-toggle input { width: 18px; height: 18px; margin-top: 2px; accent-color: #0ea5e9; }
.monitoring-enabled-toggle span { display: grid; gap: 2px; }
.monitoring-enabled-toggle strong { font-size: 12px; }
.monitoring-enabled-toggle small { color: var(--text2); font-size: 10px; }
.monitoring-form-privacy {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(34,197,94,0.08);
  color: #bbf7d0;
  font-size: 11px;
  line-height: 1.45;
}
.monitoring-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}
.monitoring-form-actions button:disabled { cursor: wait; opacity: .65; }

@media (max-width: 760px) {
  .detail-tab { flex: 0 0 72px; }
  .customer-item-with-monitoring .info { flex-basis: calc(100% - 90px); }
  .customer-item-with-monitoring .customer-monitoring-list {
    order: 5;
    width: 100%;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px solid rgba(148,163,184,0.09);
  }
  .monitoring-list-portal-btn {
    min-width: 44px;
    min-height: 44px;
  }
  .customer-item-with-monitoring .chevron { margin-left: auto; }
  .monitoring-overview-card { flex-direction: column; padding: 15px; }
  .monitoring-overview-actions { width: 100%; align-items: stretch; }
  .monitoring-overview-actions .monitoring-state-pill { align-self: flex-start; }
  .monitoring-overview-actions .btn { min-height: 44px; }
  .monitoring-section-heading { align-items: stretch; flex-direction: column; }
  .monitoring-section-heading .btn { min-height: 44px; }
  .monitoring-installation-header { flex-direction: column; }
  .monitoring-metrics-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .monitoring-installation-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .monitoring-installation-actions .btn:first-child { grid-column: 1 / -1; min-height: 44px; }
  .monitoring-installation-actions .btn { min-height: 44px; }
  .monitoring-form-grid { grid-template-columns: 1fr; }
  .monitoring-form-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .monitoring-form-actions .btn { min-height: 44px; }
}

@media (max-width: 390px) {
  .monitoring-list-portal-btn span { display: none; }
  .monitoring-metrics-grid { grid-template-columns: 1fr; }
  .monitoring-installation-actions,
  .monitoring-form-actions { grid-template-columns: 1fr; }
  .monitoring-installation-actions .btn:first-child { grid-column: auto; }
}
/* Customer-specific NAS browser; large files load only when selected. */
.customer-vault-dialog { width: min(940px, calc(100vw - 24px)); max-width: none; height: 90dvh; max-height: 94dvh; margin: auto; padding: 20px; box-sizing: border-box; overflow: auto; border: 1px solid var(--border, #334155); border-radius: 16px; background: var(--bg, #101827); color: var(--text, #eef5ff); }
.customer-vault-dialog::backdrop { background: rgba(0,0,0,.75); }
.customer-vault-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.customer-vault-header h2 { font-size: 20px; margin: 0; overflow-wrap: anywhere; }
.customer-vault-hint { font-size: 13px; opacity: .8; margin: 12px 0; }
.customer-vault-toolbar, .customer-vault-breadcrumbs { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.customer-vault-dialog button, .customer-vault-dialog a.btn { min-height: 44px; }
.customer-vault-breadcrumbs .btn { white-space: normal; overflow-wrap: anywhere; text-align: left; }
.customer-vault-entry { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 14px 12px; margin-bottom: 7px; background: rgba(100,150,200,.08); color: inherit; border: 1px solid var(--border, #334155); border-radius: 10px; cursor: pointer; }
.customer-vault-entry:hover, .customer-vault-entry:focus-visible { border-color: var(--accent, #00bcd4); background: rgba(0,188,212,.12); }
.customer-vault-entry > span:first-child { font-size: 25px; }
.customer-vault-entry > span:last-child { min-width: 0; }
.customer-vault-thumbnail { position: relative; display: flex; align-items: center; justify-content: center; width: 96px; height: 72px; flex: 0 0 96px; overflow: hidden; border-radius: 6px; background: rgba(0,0,0,.2); }
.customer-vault-thumbnail img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; }
.customer-vault-thumbnail.is-loaded { font-size: 0 !important; }
.customer-vault-thumbnail.is-loaded img { opacity: 1; }
.customer-vault-entry strong, .customer-vault-entry small { display: block; overflow-wrap: anywhere; }
.customer-vault-entry small { margin-top: 5px; opacity: .7; }
.customer-vault-body h3 { overflow-wrap: anywhere; }
.customer-vault-image { display: block; width: 100%; max-height: 68dvh; object-fit: contain; }
.customer-vault-pdf { width: 100%; height: 62dvh; border: 0; background: white; }
.customer-vault-text { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
@media (max-width: 520px) { .customer-vault-dialog { padding: 12px; } .customer-vault-header h2 { font-size: 17px; } }
/* Google import status stays visible in both calendar views. */
.google-calendar-sync { display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; padding:14px 18px; margin:14px 0; border:1px solid rgba(148,163,184,.3); border-radius:14px; background:var(--bg2); }
.google-calendar-sync p { margin:5px 0 0; color:var(--text2); font-size:13px; max-width:760px; }
.google-calendar-sync p[data-error="true"] { color:#fbbf24; }

/* ============================================================
   Dashboard Tagessteuerung – Designprototyp 2026-09-18
   ============================================================ */
.dashboard-day-content {
  max-width: 1320px;
  width: 100%;
}

.dashboard-day-shell {
  --day-surface: rgba(15, 23, 42, 0.74);
  --day-surface-strong: #101827;
  --day-border: rgba(148, 163, 184, 0.16);
  display: grid;
  gap: 18px;
}

.dashboard-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 6px 2px 0;
}

.dashboard-day-header h1 {
  margin: 3px 0 0;
  color: #f8fafc;
  font-size: clamp(24px, 2.4vw, 34px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.dashboard-day-header p {
  margin: 6px 0 0;
  color: #94a3b8;
  font-size: 13px;
}

.dashboard-day-eyebrow,
.dashboard-day-section-kicker {
  display: block;
  color: #67e8f9;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dashboard-day-search {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid var(--day-border);
  border-radius: 11px;
  background: var(--day-surface-strong);
  color: #cbd5e1;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.dashboard-day-assistant {
  max-width: none;
  margin: 0;
  border-width: 1px;
  border-color: rgba(34, 211, 238, 0.2);
  border-radius: 13px;
  background: rgba(15, 23, 42, 0.66);
}

.dashboard-day-summary {
  display: grid;
  grid-template-columns: 112px 132px 112px minmax(0, 1fr);
  gap: 10px;
}

.dashboard-day-metric,
.dashboard-day-recommendation {
  min-height: 76px;
  padding: 13px 14px;
  border: 1px solid var(--day-border);
  border-radius: 13px;
  background: var(--day-surface-strong);
  color: #e2e8f0;
}

.dashboard-day-metric {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.dashboard-day-metric strong {
  color: #22d3ee;
  font-size: 25px;
  font-weight: 900;
  line-height: 1;
}

.dashboard-day-metric span {
  margin-top: 7px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
}

.dashboard-day-recommendation {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  font: inherit;
}

.dashboard-day-recommendation > i:first-child {
  color: #f59e0b;
  font-size: 18px;
}

.dashboard-day-recommendation span {
  display: grid;
  gap: 3px;
  min-width: 0;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.4;
}

.dashboard-day-recommendation strong {
  color: #f8fafc;
  font-size: 13px;
}

.dashboard-day-recommendation.is-clickable {
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.dashboard-day-recommendation.is-clickable:hover {
  border-color: rgba(34, 211, 238, 0.48);
  background: rgba(34, 211, 238, 0.08);
}

.dashboard-day-recommendation-arrow {
  color: #22d3ee;
}

.dashboard-day-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(310px, 0.72fr);
  align-items: start;
  gap: 16px;
}

.dashboard-day-work,
.dashboard-day-side {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 14px;
  min-width: 0;
}

.dashboard-day-work > #dash-today,
.dashboard-day-side > #dash-upcoming,
.dashboard-day-side > #dash-email-review,
.dashboard-day-side > #dash-missing-photos,
.dashboard-day-side > #dash-messages,
.dashboard-day-side > #dash-uploads {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--day-border);
  border-radius: 14px;
  background: var(--day-surface);
}

.dashboard-day-work > #dash-followups:empty,
.dashboard-day-side > div:empty {
  display: none;
}

.dashboard-day-work #dash-followups > section {
  margin: 0 !important;
  padding: 16px !important;
  border-radius: 14px !important;
  background: linear-gradient(115deg, rgba(14, 165, 233, 0.13), rgba(15, 23, 42, 0.78) 58%) !important;
}

.dashboard-day-work #dash-today .section-header,
.dashboard-day-side #dash-upcoming .section-header {
  align-items: flex-start;
  margin-bottom: 12px;
}

.dashboard-day-work #dash-today .section-header h2,
.dashboard-day-side #dash-upcoming .section-header h2 {
  margin: 2px 0 0;
  color: #f8fafc;
  font-size: 18px;
}

.dashboard-day-work #dash-today .appointment-item,
.dashboard-day-side #dash-upcoming .appointment-item {
  margin-bottom: 9px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  box-shadow: none;
}

.dashboard-day-work #dash-today .appointment-item:last-child,
.dashboard-day-side #dash-upcoming .appointment-item:last-child {
  margin-bottom: 0;
}

.dashboard-day-side #dash-upcoming .appointment-item {
  padding: 11px;
}

.dashboard-day-side #dash-upcoming .appointment-header {
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 4px 8px;
  margin-bottom: 5px;
}

.dashboard-day-side #dash-upcoming .appointment-header .time {
  min-width: 0;
}

.dashboard-day-side #dash-upcoming .appointment-header .type {
  margin-left: auto;
  text-align: right;
}

.dashboard-day-side #dash-upcoming .title {
  font-size: 13px;
}

.dashboard-day-side #dash-upcoming .meta {
  font-size: 11px;
}

.dashboard-day-empty {
  min-height: 128px;
  padding: 22px 14px;
  border: 1px dashed rgba(148, 163, 184, 0.16);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.018);
}

.dashboard-day-empty i {
  font-size: 26px;
  opacity: 0.52;
}

.dashboard-day-work > #wichtig-section,
.dashboard-day-work > #todo-section {
  margin: 0;
  border-color: var(--day-border);
  border-radius: 14px;
  background: var(--day-surface);
}

.dashboard-day-work > #wichtig-section {
  border-left: 4px solid #f59e0b;
}

.dashboard-day-work > #wichtig-section h2 {
  color: #fbbf24 !important;
}

.dashboard-day-work > #todo-section .section-header {
  margin-top: 0 !important;
}

.dashboard-day-secondary {
  display: grid;
  gap: 18px;
  padding-top: 2px;
}

.dashboard-day-secondary::before {
  content: "Kunden und weitere Bereiche";
  color: #94a3b8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dashboard-day-secondary #dash-overview-row,
.dashboard-day-secondary #dash-leads {
  padding: 16px;
  border: 1px solid var(--day-border);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.56);
}

.dashboard-day-secondary #dash-leads:empty,
.dashboard-day-secondary #dash-inventory:empty {
  display: none;
}

@media (min-width: 1024px) {
  body.crm-dashboard-day-mode .content {
    width: auto;
    max-width: none;
    margin-left: 176px;
    margin-right: 0;
    padding-right: 24px;
    padding-left: 24px;
  }

  body.crm-dashboard-day-mode .bottom-nav {
    top: calc(var(--header-height) + var(--safe-top));
    right: auto;
    bottom: 0;
    width: 176px;
    height: auto;
    padding: 18px 10px 14px;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 5px;
    border-top: 0;
    border-right: 1px solid rgba(0, 177, 230, 0.15);
    background: rgba(8, 10, 24, 0.98);
  }

  body.crm-dashboard-day-mode .nav-btn {
    position: relative;
    width: 100%;
    min-height: 43px;
    padding: 8px 11px;
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    text-align: left;
  }

  body.crm-dashboard-day-mode .nav-btn i {
    width: 19px;
    font-size: 16px;
    text-align: center;
  }

  body.crm-dashboard-day-mode .nav-btn.active {
    background: rgba(34, 211, 238, 0.12);
  }

  body.crm-dashboard-day-mode .nav-btn .badge {
    top: 6px;
    right: 6px;
  }
}

@media (max-width: 1023px) {
  .dashboard-day-content {
    max-width: 860px;
  }

  .dashboard-day-layout {
    grid-template-columns: 1fr;
  }

  .dashboard-day-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-day-side > #dash-upcoming {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .dashboard-day-content {
    padding-right: 12px;
    padding-left: 12px;
  }

  .dashboard-day-shell {
    gap: 14px;
  }

  .dashboard-day-header {
    align-items: flex-start;
  }

  .dashboard-day-header h1 {
    font-size: 25px;
  }

  .dashboard-day-search {
    width: 44px;
    min-width: 44px;
    padding: 0;
  }

  .dashboard-day-search span {
    display: none;
  }

  .dashboard-day-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-day-metric {
    min-height: 70px;
    padding: 11px;
  }

  .dashboard-day-metric strong {
    font-size: 22px;
  }

  .dashboard-day-recommendation {
    grid-column: 1 / -1;
    min-height: 72px;
  }

  .dashboard-day-side {
    grid-template-columns: 1fr;
  }

  .dashboard-day-side > #dash-upcoming {
    grid-column: auto;
  }

  .dashboard-day-work > #dash-today,
  .dashboard-day-side > #dash-upcoming,
  .dashboard-day-side > #dash-email-review,
  .dashboard-day-side > #dash-missing-photos,
  .dashboard-day-side > #dash-messages,
  .dashboard-day-side > #dash-uploads,
  .dashboard-day-secondary #dash-overview-row,
  .dashboard-day-secondary #dash-leads {
    padding: 13px;
  }
}

/* Kunden-Phasenboard v75: Reonic-inspirierte Projektkarten */
.customer-page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}
.customer-page-heading .page-title { margin-bottom: 3px !important; }
.customer-page-heading p { margin: 0; color: var(--crm-muted, #94a3b8); font-size: 13px; }
.customer-view-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--crm-line, rgba(148,163,184,.16));
  border-radius: 11px;
  background: rgba(8,15,27,.72);
}
.customer-view-switch button {
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #8fa1b7;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.customer-view-switch button i { margin-right: 6px; }
.customer-view-switch button.active { background: rgba(34,211,238,.14); color: #67e8f9; box-shadow: inset 0 0 0 1px rgba(34,211,238,.2); }
.customer-search { max-width: 640px; }
.customer-board-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 2px 10px;
  color: #8291a7;
  font-size: 12px;
}
.customer-board-summary strong { color: #e2e8f0; font-size: 14px; }
.customer-board-summary i { margin-right: 5px; color: #22d3ee; }
.customer-phase-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(282px, 310px);
  gap: 12px;
  padding: 2px 2px 18px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-color: rgba(34,211,238,.35) transparent;
}
.customer-phase-column {
  align-self: start;
  min-width: 0;
  max-height: calc(100vh - 270px);
  overflow: hidden;
  scroll-snap-align: start;
  border: 1px solid var(--crm-line, rgba(148,163,184,.16));
  border-top: 3px solid var(--phase-color);
  border-radius: 14px;
  background: rgba(8,15,27,.62);
}
.customer-phase-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 13px 11px;
  border-bottom: 1px solid rgba(148,163,184,.12);
  background: linear-gradient(135deg, color-mix(in srgb, var(--phase-color) 12%, transparent), transparent 62%);
}
.customer-phase-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: color-mix(in srgb, var(--phase-color) 18%, transparent);
  color: var(--phase-color);
}
.customer-phase-header > div { min-width: 0; flex: 1; }
.customer-phase-header h2 { margin: 0; color: #f8fafc; font-size: 14px; line-height: 1.2; }
.customer-phase-header p { margin: 3px 0 0; color: #8291a7; font-size: 11px; }
.customer-phase-header button {
  width: 30px;
  height: 30px;
  border: 1px solid color-mix(in srgb, var(--phase-color) 34%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--phase-color) 10%, transparent);
  color: var(--phase-color);
  cursor: pointer;
}
.customer-phase-stack { display: grid; gap: 9px; max-height: calc(100vh - 332px); padding: 10px; overflow-y: auto; }
.customer-phase-card {
  position: relative;
  padding: 13px;
  border: 1px solid rgba(148,163,184,.15);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(18,31,51,.98), rgba(11,20,35,.98));
  box-shadow: 0 8px 24px rgba(0,0,0,.13);
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.customer-phase-card:hover, .customer-phase-card:focus-visible { transform: translateY(-2px); border-color: color-mix(in srgb, var(--phase-color) 48%, #334155); box-shadow: 0 12px 30px rgba(0,0,0,.2); outline: none; }
.customer-card-topline { display: flex; align-items: center; gap: 9px; }
.customer-card-avatar { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; background: color-mix(in srgb, var(--phase-color) 17%, #111827); color: var(--phase-color); font-size: 11px; font-weight: 900; }
.customer-card-title { min-width: 0; flex: 1; }
.customer-card-title h3 { margin: 0; overflow: hidden; color: #f8fafc; font-size: 14px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.customer-card-title span { display: block; margin-top: 3px; overflow: hidden; color: #8fa1b7; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.customer-card-open { color: #52657c; font-size: 11px; }
.customer-card-address { display: flex; gap: 7px; margin-top: 11px; color: #a9b7c9; font-size: 11px; line-height: 1.4; }
.customer-card-address i { margin-top: 2px; color: var(--phase-color); }
.customer-card-technical { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.customer-card-technical span { padding: 5px 7px; border: 1px solid rgba(250,204,21,.16); border-radius: 7px; background: rgba(250,204,21,.07); color: #fde68a; font-size: 10px; font-weight: 800; }
.customer-card-technical i { margin-right: 5px; }
.customer-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 11px; padding-top: 10px; border-top: 1px solid rgba(148,163,184,.1); }
.customer-card-footer .status-badge { max-width: 155px; overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.customer-card-updated { color: #64748b; font-size: 10px; white-space: nowrap; }
.customer-card-updated i { margin-right: 4px; }
.customer-card-actions { display: flex; gap: 6px; margin-top: 9px; }
.customer-card-action { display: inline-flex; min-height: 30px; align-items: center; gap: 6px; padding: 0 9px; border: 1px solid rgba(34,211,238,.22); border-radius: 8px; background: rgba(34,211,238,.09); color: #67e8f9; font-size: 10px; font-weight: 800; cursor: pointer; }
.customer-phase-empty { min-height: 112px; display: grid; place-items: center; align-content: center; gap: 8px; color: #52657c; font-size: 11px; }
.customer-phase-empty i { font-size: 20px; }

@media (min-width: 1450px) {
  body.crm-workspace-mode[data-crm-page="customers"] .content > * { max-width: 1500px; }
}

@media (max-width: 680px) {
  .customer-page-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .customer-view-switch { width: 100%; }
  .customer-view-switch button { flex: 1; }
  .customer-board-summary span:last-child { display: none; }
  .customer-phase-board { grid-auto-columns: minmax(84vw, 320px); margin-right: -12px; padding-right: 12px; }
  .customer-phase-column.is-empty { display: none; }
  .customer-phase-column { max-height: calc(100vh - 330px); }
  .customer-phase-stack { max-height: calc(100vh - 392px); }
}

/* ============================================================
   SwissSun CRM Workspace – gesamtes UI, Bearbeitung 2026-09-19
   ============================================================ */
body.crm-workspace-mode {
  --crm-canvas: #070b14;
  --crm-sidebar: #09111e;
  --crm-panel: rgba(15, 23, 42, 0.82);
  --crm-panel-solid: #101a2b;
  --crm-panel-soft: rgba(20, 31, 50, 0.7);
  --crm-line: rgba(148, 163, 184, 0.16);
  --crm-line-strong: rgba(34, 211, 238, 0.28);
  --crm-cyan: #22d3ee;
  --crm-cyan-strong: #06b6d4;
  --crm-orange: #f59e0b;
  --crm-copy: #f1f5f9;
  --crm-muted: #94a3b8;
  --crm-shadow: 0 18px 44px rgba(0, 0, 0, 0.22);
  background:
    radial-gradient(circle at 78% -8%, rgba(14, 165, 233, 0.08), transparent 29rem),
    var(--crm-canvas);
}

body.crm-workspace-mode .app-header {
  height: calc(64px + var(--safe-top));
  padding: var(--safe-top) 18px 0;
  border-bottom-color: var(--crm-line);
  background: rgba(7, 11, 20, 0.9);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.14);
}

body.crm-workspace-mode .header-logo { height: 30px; }
body.crm-workspace-mode .header-title { font-size: 15px; }

.header-page-context {
  display: none;
  min-width: 0;
  padding-left: 18px;
  border-left: 1px solid var(--crm-line, rgba(148, 163, 184, 0.16));
}

.header-page-context span,
.header-page-context strong { display: block; }
.header-page-context span {
  margin-bottom: 2px;
  color: #67e8f9;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.header-page-context strong {
  overflow: hidden;
  color: #f8fafc;
  font-size: 14px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.crm-workspace-mode .content {
  width: 100%;
  max-width: 1120px;
  padding-top: calc(64px + var(--safe-top) + 22px);
}

body.crm-workspace-mode .page-title,
body.crm-workspace-mode .section-header {
  color: var(--crm-copy);
}

body.crm-workspace-mode .page-title {
  margin-bottom: 18px;
  font-size: clamp(22px, 2.2vw, 30px);
  letter-spacing: -0.025em;
}

body.crm-workspace-mode .section-header {
  margin-top: 24px;
  margin-bottom: 12px;
}

body.crm-workspace-mode .section-header h2 {
  color: #f8fafc;
  font-size: 17px;
  letter-spacing: -0.01em;
}

body.crm-workspace-mode .card,
body.crm-workspace-mode .stat-card,
body.crm-workspace-mode .customer-item,
body.crm-workspace-mode .appointment-item,
body.crm-workspace-mode .todo-section,
body.crm-workspace-mode .google-calendar-sync {
  border: 1px solid var(--crm-line);
  border-radius: 14px;
  background: var(--crm-panel);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.018);
}

body.crm-workspace-mode .card { padding: 17px; }
body.crm-workspace-mode .stat-card {
  min-height: 92px;
  padding: 16px;
  transition: border-color .18s ease, transform .18s ease, background .18s ease;
}
body.crm-workspace-mode .stat-card:hover,
body.crm-workspace-mode .customer-item:hover,
body.crm-workspace-mode .appointment-item:hover {
  border-color: var(--crm-line-strong);
  background: rgba(17, 31, 51, 0.94);
  transform: translateY(-1px);
}
body.crm-workspace-mode .stat-number { color: var(--crm-cyan); }
body.crm-workspace-mode .stat-label,
body.crm-workspace-mode .card-meta { color: var(--crm-muted); }

body.crm-workspace-mode .stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 11px;
}

body.crm-workspace-mode .customer-item {
  min-height: 70px;
  margin-bottom: 9px;
  padding: 14px 16px;
  gap: 13px;
}
body.crm-workspace-mode .customer-item .info h4 {
  color: #f8fafc;
  font-size: 15px;
}
body.crm-workspace-mode .customer-item .chevron { color: var(--crm-cyan); }

body.crm-workspace-mode .search-bar {
  margin-bottom: 14px;
}
body.crm-workspace-mode .search-bar input,
body.crm-workspace-mode .form-group input,
body.crm-workspace-mode .form-group select,
body.crm-workspace-mode .form-group textarea,
body.crm-workspace-mode input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
body.crm-workspace-mode select,
body.crm-workspace-mode textarea {
  border: 1px solid var(--crm-line);
  border-radius: 11px;
  background: rgba(8, 15, 27, 0.78);
  color: var(--crm-copy);
}
body.crm-workspace-mode .search-bar input { min-height: 46px; padding-left: 43px; }
body.crm-workspace-mode .form-group label {
  margin-bottom: 7px;
  color: #a8b7ca;
  font-size: 12px;
  font-weight: 750;
}
body.crm-workspace-mode input:focus,
body.crm-workspace-mode select:focus,
body.crm-workspace-mode textarea:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.65) !important;
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.09);
}

body.crm-workspace-mode .btn {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
}
body.crm-workspace-mode .btn-primary {
  background: linear-gradient(135deg, #06b6d4, #0284c7);
  box-shadow: 0 8px 20px rgba(6, 182, 212, 0.17);
}
body.crm-workspace-mode .btn-secondary {
  border-color: var(--crm-line);
  background: rgba(30, 41, 59, 0.72);
}
body.crm-workspace-mode .btn-danger { background: #dc2626; }
body.crm-workspace-mode .btn-success { background: #16a34a; }
body.crm-workspace-mode .btn:hover { filter: brightness(1.08); }

body.crm-workspace-mode .tabs,
body.crm-workspace-mode .dash-tabs,
body.crm-workspace-mode .filter-row {
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--crm-line);
  border-radius: 12px;
  background: rgba(8, 15, 27, 0.62);
}
body.crm-workspace-mode .tab,
body.crm-workspace-mode .dash-tab {
  border-radius: 8px;
  color: var(--crm-muted);
}
body.crm-workspace-mode .tab.active,
body.crm-workspace-mode .dash-tab.active {
  background: rgba(34, 211, 238, 0.12);
  color: var(--crm-cyan);
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.18);
}

body.crm-workspace-mode .status-badge {
  border: 1px solid currentColor;
  border-radius: 999px;
  background-color: transparent;
  font-weight: 800;
}

body.crm-workspace-mode .empty-state {
  min-height: 150px;
  padding: 28px 18px;
  border: 1px dashed rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.38);
}

body.crm-workspace-mode .modal {
  border: 1px solid var(--crm-line);
  border-radius: 18px;
  background: #0d1727;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
}
body.crm-workspace-mode .modal-header {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--crm-line);
}

body.crm-workspace-mode table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--crm-line);
  border-radius: 12px;
  background: var(--crm-panel);
}
body.crm-workspace-mode th {
  background: rgba(30, 41, 59, 0.72);
  color: #cbd5e1;
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
body.crm-workspace-mode th,
body.crm-workspace-mode td {
  padding: 11px 13px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  text-align: left;
}
body.crm-workspace-mode tr:last-child td { border-bottom: 0; }

body.crm-workspace-mode .calendar-hero {
  border: 1px solid var(--crm-line-strong);
  border-radius: 18px;
  background: linear-gradient(125deg, rgba(8, 145, 178, 0.17), rgba(15, 23, 42, 0.82) 55%);
  box-shadow: var(--crm-shadow);
}
body.crm-workspace-mode .calendar-grid,
body.crm-workspace-mode .calendar-week-header,
body.crm-workspace-mode .calendar-week-row,
body.crm-workspace-mode .calendar-agenda {
  border-color: var(--crm-line);
  background-color: var(--crm-panel-soft);
}

body.crm-workspace-mode[data-crm-page="customer-detail"] .content,
body.crm-workspace-mode[data-crm-page="customer-form"] .content,
body.crm-workspace-mode[data-crm-page="calendar"] .content,
body.crm-workspace-mode[data-crm-page="tools"] .content,
body.crm-workspace-mode[data-crm-page="statistics"] .content,
body.crm-workspace-mode[data-crm-page="inventory"] .content,
body.crm-workspace-mode[data-crm-page="stock-management"] .content,
body.crm-workspace-mode[data-crm-page="financial-reports"] .content,
body.crm-workspace-mode[data-crm-page="planung"] .content {
  max-width: 1280px;
}

body.crm-workspace-mode[data-crm-page="customers"] .content,
body.crm-workspace-mode[data-crm-page="leadfy"] .content,
body.crm-workspace-mode[data-crm-page="archiv"] .content {
  max-width: 1180px;
}

@media (min-width: 1024px) {
  body.crm-workspace-mode .header-page-context { display: block; }

  body.crm-workspace-mode .content,
  body.crm-dashboard-day-mode .content {
    width: auto;
    max-width: none;
    margin-right: 0;
    margin-left: 196px;
    padding-right: clamp(24px, 3vw, 46px);
    padding-left: clamp(24px, 3vw, 46px);
  }

  body.crm-workspace-mode .content > * {
    width: 100%;
    max-width: 1280px;
    margin-right: auto;
    margin-left: auto;
  }

  body.crm-workspace-mode .bottom-nav,
  body.crm-dashboard-day-mode .bottom-nav {
    top: calc(64px + var(--safe-top));
    right: auto;
    bottom: 0;
    width: 196px;
    height: auto;
    padding: 22px 12px 16px;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 5px;
    border-top: 0;
    border-right: 1px solid var(--crm-line);
    background: linear-gradient(180deg, rgba(9, 17, 30, 0.99), rgba(7, 11, 20, 0.99));
  }

  body.crm-workspace-mode .bottom-nav::before {
    content: "Navigation";
    margin: 0 10px 8px;
    color: #64748b;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
  }

  body.crm-workspace-mode .nav-btn,
  body.crm-dashboard-day-mode .nav-btn {
    position: relative;
    width: 100%;
    min-height: 45px;
    padding: 9px 12px;
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 11px;
    border-radius: 10px;
    color: #8291a7;
    font-size: 12px;
    font-weight: 750;
    text-align: left;
  }
  body.crm-workspace-mode .nav-btn i,
  body.crm-dashboard-day-mode .nav-btn i {
    width: 19px;
    font-size: 16px;
    text-align: center;
  }
  body.crm-workspace-mode .nav-btn:hover { background: rgba(148, 163, 184, 0.07); color: #dbeafe; }
  body.crm-workspace-mode .nav-btn.active,
  body.crm-dashboard-day-mode .nav-btn.active {
    background: linear-gradient(90deg, rgba(34, 211, 238, 0.15), rgba(34, 211, 238, 0.05));
    color: #67e8f9;
    box-shadow: inset 3px 0 0 #22d3ee;
  }
  body.crm-workspace-mode .nav-btn .badge { top: 7px; right: 7px; }
  body.crm-workspace-mode .btn-fab { right: 28px; bottom: 28px; }
}

@media (max-width: 1023px) {
  body.crm-workspace-mode .app-header { height: calc(58px + var(--safe-top)); }
  body.crm-workspace-mode .content {
    max-width: 900px;
    padding-top: calc(58px + var(--safe-top) + 16px);
  }
  body.crm-workspace-mode .bottom-nav {
    justify-content: flex-start;
    gap: 2px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  body.crm-workspace-mode .bottom-nav::-webkit-scrollbar { display: none; }
  body.crm-workspace-mode .nav-btn {
    min-width: 72px;
    min-height: 58px;
    flex: 1 0 72px;
    padding: 7px 8px;
  }
}

@media (max-width: 680px) {
  body.crm-workspace-mode { --nav-height: 116px; }
  body.crm-workspace-mode .content { padding-right: 12px; padding-left: 12px; }
  body.crm-workspace-mode .header-title { display: none; }
  body.crm-workspace-mode .card { padding: 14px; }
  body.crm-workspace-mode .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.crm-workspace-mode .stat-card { min-height: 82px; padding: 13px; }
  body.crm-workspace-mode .customer-item { padding: 13px; }
  body.crm-workspace-mode .btn { min-height: 44px; }
  body.crm-workspace-mode table { display: block; overflow-x: auto; }
  body.crm-workspace-mode .bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-auto-rows: 54px;
    align-content: center;
    gap: 0;
    overflow: hidden;
    padding: 4px 3px env(safe-area-inset-bottom, 0);
  }
  body.crm-workspace-mode .nav-btn {
    width: 100%;
    min-width: 0;
    min-height: 52px;
    padding: 5px 2px;
    flex: none;
    gap: 3px;
    font-size: 9px;
  }
  body.crm-workspace-mode .nav-btn i { font-size: 17px; }
  body.crm-workspace-mode #offline-sync-status {
    bottom: calc(var(--nav-height) + 4px) !important;
  }
  body.crm-workspace-mode #customer-fab {
    right: 12px;
    bottom: calc(var(--nav-height) + 82px);
    width: 52px !important;
    height: 52px;
    padding: 0 !important;
    border-radius: 50% !important;
  }
  body.crm-workspace-mode #customer-fab #fab-text { display: none; }
}
