:root {
  --brand: #1a5d2e;
  --brand-dark: #124421;
  --bg: #f4f6f5;
  --card: #ffffff;
  --border: #dde3e0;
  --text: #1c2520;
  --muted: #66736c;
  --accent: #2f7d46;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ---- Top-Nav ---- */
.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--brand);
  padding: 0 18px;
  height: 52px;
  flex-wrap: wrap;
}
.topnav .brand {
  color: #fff;
  font-weight: 700;
  margin-right: 18px;
  white-space: nowrap;
}
.topnav a {
  color: #d9eadf;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.92rem;
}
.topnav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.topnav a.active { background: rgba(255,255,255,.2); color: #fff; font-weight: 600; }
.topnav .spacer { flex: 1 1 auto; }
.topnav .user { color: #d9eadf; font-size: 0.85rem; }
.topnav .user em { color: #a8c8b3; font-style: normal; }
.topnav a.logout { color: #fff; font-weight: 600; }

/* ---- Content ---- */
.content {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 18px 60px;
}

h1 { font-size: 1.5rem; margin: 0 0 6px; }
h2 { font-size: 1.15rem; margin: 26px 0 10px; }
.subtitle { color: var(--muted); margin: 0 0 20px; }

/* ---- Kacheln ---- */
.cards {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 0 0 22px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  min-width: 170px;
  flex: 1 1 170px;
}
.card .label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
.card .value { font-size: 1.45rem; font-weight: 700; margin-top: 4px; }
.card .value.small { font-size: 1.1rem; }

/* ---- Tabellen ---- */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  font-size: 0.9rem;
}
th, td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th { background: #eef3ef; color: var(--brand-dark); font-size: 0.78rem; text-transform: uppercase; letter-spacing: .02em; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f7faf8; }
td.num, th.num { text-align: right; white-space: nowrap; }
td.center, th.center { text-align: center; }

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #eef3ef;
  color: var(--muted);
}
.badge.ust { background: #fdeaea; color: #b3261e; }
.badge.hk { background: #e7f0fb; color: #1a56a0; }
.badge.wohnung { background: #eaf6ee; color: var(--brand); }
.badge.laden { background: #fdf3e0; color: #8a5a00; }
.badge.gewerbe { background: #efe9fb; color: #5b3aa0; }
.badge.haus { background: #e7f0fb; color: #1a56a0; }

/* ---- Buttons & Forms ---- */
button, .btn {
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 9px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 600;
}
button:hover, .btn:hover { background: var(--brand-dark); }
.btn.secondary { background: #eef3ef; color: var(--brand-dark); }
.btn.danger { background: #b3261e; }
a.btn { text-decoration: none; display: inline-block; }

form.inline { display: inline-block; margin: 0; }

label { display: block; font-size: 0.8rem; color: var(--muted); margin: 10px 0 4px; font-weight: 600; }
input, select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 0.92rem;
  background: #fff;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 20px;
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0 14px;
}

.error { background: #fdeaea; color: #b3261e; padding: 10px 14px; border-radius: 7px; margin: 12px 0; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }

/* ---- Objekt-Karten ---- */
.objekt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.objekt-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  text-decoration: none;
  color: var(--text);
  display: block;
}
.objekt-card:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.objekt-card h3 { margin: 0 0 8px; font-size: 1.05rem; }
.objekt-card .row { display: flex; justify-content: space-between; font-size: 0.88rem; padding: 2px 0; }
.objekt-card .row span:first-child { color: var(--muted); }

/* ---- Login ---- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 34px; width: 100%; max-width: 380px; box-shadow: 0 6px 24px rgba(0,0,0,.08); }
.login-box h1 { text-align: center; margin: 0 0 4px; }
.login-sub { text-align: center; color: var(--muted); margin: 0 0 22px; }
.login-box button { width: 100%; margin-top: 18px; }

/* ---- Mieter-Detail ---- */
.detail-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 820px) {
  .detail-grid { grid-template-columns: 1fr; }
}
table.kv { font-size: 0.9rem; }
table.kv td { border-bottom: 1px solid var(--border); padding: 7px 10px; }
table.kv td:first-child { color: var(--muted); width: 48%; }
table.kv tr:last-child td { border-bottom: none; }
