/* ============================================================
   Vermieterschutz24 · Professional SaaS UI
   ============================================================ */

:root {
  --primary:       #1a5fb4;
  --primary-dark:  #1249a0;
  --primary-light: #dbeafe;
  --accent:        #0ea5e9;
  --success:       #16a34a;
  --success-bg:    #dcfce7;
  --warning:       #d97706;
  --warning-bg:    #fef3c7;
  --danger:        #dc2626;
  --danger-bg:     #fee2e2;
  --neutral:       #6b7280;
  --neutral-bg:    #f3f4f6;

  --bg:            #f1f5f9;
  --surface:       #ffffff;
  --surface-2:     #f8fafc;
  --border:        #e2e8f0;
  --border-strong: #cbd5e1;

  --text:          #0f172a;
  --text-2:        #475569;
  --text-3:        #94a3b8;

  --sidebar-bg:    #0f172a;
  --sidebar-w:     256px;

  --radius-sm:     6px;
  --radius:        10px;
  --radius-lg:     14px;
  --radius-xl:     20px;

  --shadow-sm:     0 1px 3px rgba(0,0,0,.08);
  --shadow:        0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:     0 12px 40px rgba(0,0,0,.12);
}

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

html { font-size: 15px; -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

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

/* ── APP SHELL ── */
.app-shell { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  border-right: 1px solid rgba(255,255,255,.05);
}

.sidebar-brand {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-logo { width: 100%; max-width: 190px; filter: brightness(0) invert(1); opacity: .9; }

.sidebar-section {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
  color: #475569;
  text-transform: uppercase;
  padding: 16px 16px 6px;
}

.sidebar-nav { padding: 8px 8px; flex: 1; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #94a3b8;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  transition: .12s;
  text-decoration: none;
  margin-bottom: 1px;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #e2e8f0; }
.sidebar-nav a.active { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(26,95,180,.4); }
.sidebar-nav a.nav-danger { color: #f87171; }
.sidebar-nav a.nav-danger:hover { background: rgba(248,113,113,.1); }
.nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

/* ── CONTENT ── */
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ── TOPBAR ── */
.topbar {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 16px; font-weight: 600; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.user-menu {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 12px 6px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}
.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.badge-role {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary);
}

/* ── PAGE ── */
.page { padding: 28px; max-width: 1320px; margin: 0 auto; width: 100%; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.page-header h1 { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -.02em; }
.page-subtitle { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.card-title { font-size: 15px; font-weight: 600; color: var(--text); }
.card-subtitle { font-size: 12px; color: var(--text-3); margin-top: 1px; }

/* ── STATS ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.stat-icon { font-size: 22px; margin-bottom: 10px; }
.stat-value { font-size: 30px; font-weight: 700; color: var(--text); letter-spacing: -.03em; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-2); margin-top: 4px; font-weight: 500; }
.stat-card.stat-danger .stat-value { color: var(--danger); }
.stat-card.stat-success .stat-value { color: var(--success); }
.stat-card.stat-warning .stat-value { color: var(--warning); }

/* ── GRID ── */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 12px; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  background: var(--surface-2);
}
thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
thead th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }
.td-muted { color: var(--text-2); font-size: 13px; }
.td-strong { font-weight: 600; }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
label .req { color: var(--danger); margin-left: 2px; }
label .hint { font-weight: 400; color: var(--text-3); font-size: 12px; margin-left: 6px; }

input[type=text], input[type=email], input[type=password],
input[type=date], input[type=datetime-local], input[type=number],
input:not([type]), select, textarea {
  display: block;
  width: 100%;
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  line-height: 1.5;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,95,180,.12);
}
input:disabled, select:disabled { background: var(--surface-2); color: var(--text-3); cursor: not-allowed; }
textarea { min-height: 80px; resize: vertical; }
select { cursor: pointer; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
input[type=file] { padding: 8px; background: var(--surface-2); cursor: pointer; }

.form-row { display: grid; gap: 14px; margin-bottom: 0; }
.form-row.cols-2 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.form-row.cols-3 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.form-row.cols-4 { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: .12s;
  margin-bottom: 8px;
}
.check-row:hover { border-color: var(--primary); background: var(--primary-light); }
.check-row label { margin: 0; cursor: pointer; font-weight: 500; font-size: 13.5px; }
.check-row.checked { border-color: var(--success); background: var(--success-bg); }
.check-row.blocked { border-color: var(--danger); background: var(--danger-bg); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 13.5px;
  font-family: inherit;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: .14s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: #fca5a5; }
.btn-danger:hover { background: #fecaca; }
.btn-success { background: var(--success-bg); color: var(--success); border-color: #86efac; }
.btn-warning { background: var(--warning-bg); color: var(--warning); border-color: #fcd34d; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: var(--radius-sm); }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { padding: 7px; }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-neutral { background: var(--neutral-bg); color: var(--neutral); }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }

/* ── ALERTS ── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  margin-bottom: 18px;
  line-height: 1.55;
}
.alert-danger  { background: var(--danger-bg);  color: var(--danger);  border: 1px solid #fca5a5; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #86efac; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid #fcd34d; }
.alert-info    { background: var(--primary-light); color: var(--primary); border: 1px solid #93c5fd; }

/* ── MODAL ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
  margin-bottom: 20px;
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-3);
  padding: 4px;
  border-radius: 6px;
  line-height: 1;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 0 24px 20px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── PHOTO GRID ── */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 20px; }
.photo-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.photo-card img { width: 100%; height: 160px; object-fit: cover; display: block; }
.photo-card-body { padding: 12px 14px; font-size: 13px; }
.photo-card-body strong { display: block; color: var(--text); margin-bottom: 3px; }
.photo-card-body .meta { color: var(--text-3); font-size: 12px; }
.evidence-note { background: var(--warning-bg); color: var(--warning); padding: 7px 10px; border-radius: var(--radius-sm); font-size: 12.5px; margin-top: 8px; border: 1px solid #fcd34d; }

/* ── SIGNATURE PAD ── */
.sig-pad {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  width: 100%;
  height: 170px;
  touch-action: none;
  cursor: crosshair;
  background: #fafafa;
  display: block;
}
.sig-pad:focus { outline: 2px solid var(--primary); }

/* ── KAUTION STATUS ── */
.deposit-card { border-radius: var(--radius-lg); border: 2px solid var(--border); padding: 22px; margin-bottom: 20px; background: var(--surface); }
.deposit-card.blocked  { border-color: var(--danger); }
.deposit-card.released { border-color: var(--success); }
.deposit-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.deposit-status-badge { font-size: 14px; font-weight: 700; padding: 8px 18px; border-radius: 999px; }

/* ── LOGIN ── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%); padding: 20px; }
.auth-box { background: var(--surface); border-radius: var(--radius-xl); padding: 38px 40px; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); }
.auth-logo { max-width: 200px; display: block; margin: 0 auto 26px; }
.auth-title { font-size: 20px; font-weight: 700; text-align: center; margin-bottom: 6px; }
.auth-sub { font-size: 13px; color: var(--text-2); text-align: center; margin-bottom: 24px; }

/* ── PRINT ── */
@media print {
  .sidebar, .topbar, .page-actions, .btn, form { display: none !important; }
  .page { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .page { padding: 16px; }
  .topbar { padding: 0 16px; }
  .page-header { flex-direction: column; }
  .modal { max-width: 100%; }
}

/* ── UTILITIES ── */
.text-muted { color: var(--text-2); }
.text-small { font-size: 12.5px; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.fw-600 { font-weight: 600; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.nowrap { white-space: nowrap; }
.w-100 { width: 100%; }
.hero-logo { max-width: 280px; display: block; margin: 0 auto 18px; }

.form-section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 10px;
}
