:root {
  --bg: #f5f4f0; --surface: #ffffff; --sidebar-bg: #1a1f2e;
  --sidebar-text: #a8b0c4; --accent: #2e6fba; --accent-dark: #1d4f8a;
  --text: #1a1f2e; --text-muted: #7a8097; --border: #e2e0d8;
  --danger: #c0392b; --success: #27ae60; --warning: #e67e22;
  --info: #2980b9; --sidebar-width: 240px; --radius: 8px;
  --shadow: 0 1px 4px rgba(0,0,0,0.08);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'DM Sans', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-width); background: var(--sidebar-bg); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; overflow-y: auto; z-index: 100; overscroll-behavior: contain; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.brand-icon { font-size: 22px; }
.brand-name { font-family: 'DM Serif Display', serif; font-size: 16px; color: white; }
.nav-section { padding: 16px 12px 4px; }
.nav-group-header { display: flex; align-items: center; justify-content: space-between; cursor: pointer; padding: 16px 12px 4px; user-select: none; color: rgba(168,176,196,0.5); font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; }
.nav-group-header:hover { color: rgba(168,176,196,0.8); }
.nav-group-chevron { width: 12px; height: 12px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.2s ease; }
.nav-group.collapsed .nav-group-chevron { transform: rotate(-90deg); }
.nav-group-items { overflow: hidden; transition: max-height 0.25s ease, opacity 0.2s ease; max-height: 600px; opacity: 1; }
.nav-group.collapsed .nav-group-items { max-height: 0; opacity: 0; }
.nav-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: rgba(168,176,196,0.5); padding: 0 8px; display: block; margin-bottom: 4px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 6px; color: var(--sidebar-text); text-decoration: none; font-size: 13.5px; transition: all 0.15s; margin-bottom: 2px; }
.nav-link svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.nav-link:hover { background: rgba(255,255,255,0.08); color: white; }
.nav-link.active { background: rgba(46,111,186,0.3); color: white; }
.sidebar-footer { margin-top: auto; padding: 16px; border-top: 1px solid rgba(255,255,255,0.08); display: flex; align-items: center; gap: 10px; }
.user-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.user-avatar { width: 32px; height: 32px; background: var(--accent); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-weight: 600; font-size: 13px; flex-shrink: 0; }
.user-name { font-size: 13px; color: white; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--sidebar-text); }
.logout-btn { background: none; border: none; cursor: pointer; color: var(--sidebar-text); padding: 6px; border-radius: 6px; display: flex; align-items: center; transition: all 0.15s; }
.logout-btn:hover { color: white; background: rgba(255,255,255,0.1); }
.logout-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.main-content { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.page-header { background: var(--surface); border-bottom: 1px solid var(--border); padding: 20px 28px; }
.page-title { font-family: 'DM Sans', sans-serif; font-size: 18px; font-weight: 600; }
.content-body, .content { padding: 24px 28px; }
.flex-gap { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mb-4 { margin-bottom: 1.5rem; }
.text-right { text-align: right !important; }
.font-mono { font-family: 'Courier New', monospace; }
.table-wrap { overflow-x: auto; width: 100%; }
.table-wrap table { width: 100%; border-collapse: collapse; }
.table-wrap table th { text-align: left; padding: 10px 14px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); border-bottom: 2px solid var(--border); font-weight: 500; white-space: nowrap; }
.table-wrap table td { padding: 11px 14px; border-bottom: 1px solid #f0ede6; font-size: 13.5px; vertical-align: top; }
.table-wrap table tbody tr:hover { background: #faf9f6; }
.table-wrap table tfoot td { padding: 11px 14px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat-card.danger { border-color: var(--danger,#e74c3c); background: rgba(231,76,60,.06); }
.stat-card.success { border-color: var(--success,#27ae60); background: rgba(39,174,96,.06); }
.stat-icon { font-size: 24px; margin-bottom: 10px; }
.stat-value { font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-title { font-family: 'DM Sans', sans-serif; font-size: 16px; font-weight: 600; }
.card-body { padding: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 20px; }
.property-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.property-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.property-header h3 { font-family: 'DM Sans', sans-serif; font-size: 16px; font-weight: 600; }
.property-address { color: var(--text-muted); font-size: 13px; margin-bottom: 12px; }
.property-actions { display: flex; gap: 8px; margin-top: 16px; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 11px 16px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); border-bottom: 1px solid var(--border); font-weight: 500; }
.table td { padding: 12px 16px; border-bottom: 1px solid #f0ede6; font-size: 13.5px; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #faf9f6; }
.row-warning { background: #fff9f0 !important; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.badge-success { background: #e8f5e9; color: #2e7d32; }
.badge-warning { background: #fff3e0; color: #e65100; }
.badge-danger { background: #ffebee; color: #c62828; }
.badge-info { background: #e3f2fd; color: #1565c0; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 6px; font-family: 'DM Sans', sans-serif; font-size: 13.5px; font-weight: 500; cursor: pointer; border: none; text-decoration: none; transition: all 0.15s; white-space: nowrap; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: #f5f4f0; }
.btn-danger { background: var(--danger); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }
.form-container { max-width: 700px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full-width { grid-column: 1 / -1; }
.form-group label { font-size: 12.5px; font-weight: 500; color: var(--text-muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="month"], input:not([type]), select, textarea { padding: 9px 12px; border: 1px solid var(--border); border-radius: 6px; font-family: 'DM Sans', sans-serif; font-size: 13.5px; background: var(--surface); color: var(--text); transition: border-color 0.15s; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(46,111,186,0.1); }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.checkbox-label input { width: auto; }
.form-actions { display: flex; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 13.5px; }
.alert-error { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }
.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.alert-warning { background: #fff3e0; color: #e65100; border: 1px solid #ffe0b2; }
.filter-bar { margin-bottom: 16px; }
.filter-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filter-form select, .filter-form input { max-width: 200px; width: auto; }
.content-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.total-amount { font-size: 14px; color: var(--text-muted); }
.total-amount strong { color: var(--text); font-size: 16px; }
.detail-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.detail-list { padding: 4px 0; }
.detail-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 20px; border-bottom: 1px solid #f5f4f0; font-size: 13.5px; }
.detail-row span { color: var(--text-muted); }
.info-block { background: #f5f4f0; border-radius: 8px; padding: 16px 20px; margin-bottom: 20px; font-size: 13.5px; line-height: 1.8; }
.welcome-card { max-width: 500px; }
.welcome-card h2 { font-family: 'DM Sans', sans-serif; font-size: 20px; font-weight: 600; margin-bottom: 16px; }
.empty-state { text-align: center; padding: 48px; color: var(--text-muted); }
.empty-state p { font-size: 15px; margin-bottom: 16px; }
.empty-hint { padding: 16px 20px; color: var(--text-muted); font-size: 13px; }
.error-container { text-align: center; padding: 60px 20px; }
.error-code { font-size: 48px; margin-bottom: 16px; }
.error-container h2 { font-family: 'DM Sans', sans-serif; font-size: 22px; font-weight: 600; margin-bottom: 8px; }
.error-container p { color: var(--text-muted); margin-bottom: 24px; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-content { background: white; border-radius: 10px; padding: 28px; width: 380px; box-shadow: 0 10px 40px rgba(0,0,0,0.15); }
.modal-content h3 { font-family: 'DM Sans', sans-serif; font-size: 18px; font-weight: 600; margin-bottom: 20px; }
.login-body { background: var(--sidebar-bg); display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-container { background: white; border-radius: 12px; padding: 40px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.login-brand { text-align: center; margin-bottom: 32px; }
.login-icon { font-size: 40px; display: block; margin-bottom: 12px; }
.login-title { font-family: 'DM Serif Display', serif; font-size: 26px; font-weight: 400; color: var(--text); margin-bottom: 4px; }
.login-subtitle { color: var(--text-muted); font-size: 14px; }
.login-form .form-group { margin-bottom: 16px; }
.login-form label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.login-form button { margin-top: 8px; padding: 12px 20px; font-size: 15px; }
.text-muted { color: var(--text-muted); }
small.text-muted { font-size: 12px; }
.hamburger { background: none; border: none; cursor: pointer; color: var(--text); padding: 6px; border-radius: 6px; display: flex; align-items: center; }
.hamburger:hover { background: var(--border); }
.main { margin-left: 260px; height: 100vh; overflow-y: auto; }

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

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s ease; }
  .sidebar.open { transform: translateX(0); }
  .main-content, .main { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full-width { grid-column: 1; }
}

/* Kollabierbare Karten (Formular auf Tablet/Mobile) */
.collapsible-body { overflow: hidden; transition: max-height 0.25s ease; }
.collapsible-body.collapsed { max-height: 0 !important; }
.collapse-toggle { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 0; line-height: 1; }
.collapse-toggle svg { transition: transform 0.2s; }
.collapse-toggle.open svg { transform: rotate(180deg); }

@media (min-width: 769px) {
  .hamburger { display: none; }
}


/* Wartungsfenster Laufschrift-Banner */
.impersonation-banner {
  background: #8b1a1a;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 1100;
  box-shadow: 0 2px 8px rgba(139,26,26,0.4);
}
.main:has(~ .impersonation-banner), body:has(.impersonation-banner) .content {
  outline: 3px solid #8b1a1a;
}
.maintenance-banner {
  background: #c62828;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  height: 36px;
  position: relative;
  overflow: hidden;
  width: 100%;
}
.maintenance-banner-track {
  position: absolute;
  top: 50%;
  display: flex;
  white-space: nowrap;
  animation: maintenance-scroll 30s linear infinite;
}
.maintenance-banner-text {
  padding: 0 48px;
  white-space: nowrap;
}
@keyframes maintenance-scroll {
  0%   { transform: translateY(-50%) translateX(0); }
  100% { transform: translateY(-50%) translateX(-50%); }
}
