:root {
  --bg: #f4f6f9;
  --card-bg: #ffffff;
  --primary: #1a56db;
  --primary-dark: #1341a8;
  --danger: #e02424;
  --good: #057a55;
  --ok: #b45309;
  --bad: #c81e1e;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

/* NAV */
nav {
  background: #1e2a3a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 52px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand { font-weight: 700; font-size: 1.1rem; letter-spacing: .5px; }
.nav-links { display: flex; align-items: center; gap: 1.5rem; }
.nav-links a { color: #cbd5e1; text-decoration: none; font-size: .9rem; }
.nav-links a:hover { color: #fff; }
.nav-user { color: #94a3b8; font-size: .85rem; }

/* MAIN */
main { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }

/* FLASH */
.flash { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .9rem; }
.flash-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.flash-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* PAGE HEADER */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
}
.page-header h1 { font-size: 1.5rem; font-weight: 700; }
.subtext { color: var(--muted); font-size: .9rem; margin-top: .25rem; }
.badge {
  display: inline-block;
  background: #dbeafe;
  color: #1e40af;
  font-size: .75rem;
  font-weight: 600;
  padding: .15rem .5rem;
  border-radius: 4px;
  margin-bottom: .25rem;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.header-actions { display: flex; gap: .5rem; flex-shrink: 0; }

/* BUTTONS */
.btn {
  display: inline-block;
  padding: .5rem 1.1rem;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: background .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #e5e7eb; color: var(--text); }
.btn-secondary:hover { background: #d1d5db; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

/* CARDS */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
}
.card h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
  color: #374151;
}

/* KPI BAND */
.kpi-band {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.kpi-band .kpi-card {
  flex: 1;
  min-width: 140px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
}
.kpi-label { font-size: .8rem; color: var(--muted); margin-bottom: .2rem; }
.kpi-value { font-size: 1.25rem; font-weight: 700; }
.kpi-good { color: var(--good); }
.kpi-ok { color: var(--ok); }
.kpi-bad { color: var(--bad); }

/* DASHBOARD GRID */
.immo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}
.immo-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s, transform .15s;
  display: block;
}
.immo-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.12); transform: translateY(-1px); }
.immo-card-header {
  background: #1e2a3a;
  color: #fff;
  padding: .75rem 1rem;
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex;
  align-items: center;
  gap: .75rem;
}
.immo-kuerzel {
  background: rgba(255,255,255,.15);
  font-size: .75rem;
  font-weight: 700;
  padding: .15rem .5rem;
  border-radius: 4px;
  letter-spacing: .5px;
  white-space: nowrap;
}
.immo-titel { font-weight: 600; font-size: .95rem; }
.immo-card-body { padding: 1rem; }
.immo-adresse { font-size: .85rem; color: var(--muted); margin-bottom: .75rem; }
.kpi-row { display: flex; gap: 1rem; }
.kpi { flex: 1; }

/* DETAIL GRID */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 1rem;
}

/* TABLE */
.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table td { padding: .35rem 0; border-bottom: 1px solid var(--border); }
.data-table tr:last-child td { border-bottom: none; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table .total td { font-weight: 700; border-top: 2px solid var(--border); padding-top: .5rem; }

/* FORM */
.immo-form { display: flex; flex-direction: column; gap: 1rem; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .75rem;
}
label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; font-weight: 500; color: #374151; }
input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"] {
  padding: .45rem .65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .9rem;
  width: 100%;
  background: #fff;
  transition: border-color .15s;
}
input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,.15); }
.form-actions { display: flex; gap: .75rem; padding-top: .5rem; }

/* AUTH */
.auth-box {
  max-width: 380px;
  margin: 5rem auto;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(0,0,0,0.1);
  padding: 2.5rem;
}
.auth-box h1 { font-size: 1.6rem; font-weight: 800; margin-bottom: .25rem; color: #1e2a3a; }
.auth-box h2 { font-size: 1.1rem; color: var(--muted); margin-bottom: 1.5rem; }
.auth-box form { display: flex; flex-direction: column; gap: .75rem; }
.auth-box button { margin-top: .5rem; }
.auth-box p { margin-top: 1rem; font-size: .85rem; color: var(--muted); text-align: center; }
.auth-box a { color: var(--primary); text-decoration: none; }

/* MISC */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--muted); }
.empty-state p { margin-bottom: 1rem; font-size: 1.1rem; }
.muted { color: var(--muted); font-size: .9rem; }

/* Token-Anzeige */
.token-neu { border: 2px solid var(--primary); background: #f0f7ff; }
.token-wert {
  font-family: monospace;
  font-size: .95rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .6rem 1rem;
  word-break: break-all;
  user-select: all;
  margin-top: .5rem;
}
