/* Immomailer — mobile-first, kein Framework */
:root {
  --blau: #1d4ed8;
  --blau-dunkel: #1e3a8a;
  --tinte: #1f2937;
  --grau: #6b7280;
  --linie: #e5e7eb;
  --flaeche: #f4f5f7;
  --weiss: #ffffff;
  --gruen: #15803d;
  --amber: #b45309;
  --rot: #b91c1c;
  --violett: #6d28d9;
  --radius: 10px;
  --schatten: 0 1px 3px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--tinte);
  background: var(--flaeche);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1 { font-size: 1.4rem; margin: 0 0 .75rem; }
h2 { font-size: 1.05rem; margin: 1.25rem 0 .5rem; }
h2:first-child { margin-top: 0; }
h3 { font-size: .95rem; margin: 1rem 0 .25rem; color: var(--grau); }
a { color: var(--blau); }
.muted { color: var(--grau); font-weight: normal; font-size: .9em; }
.hint { color: var(--grau); font-size: .85rem; }
.ok-text { color: var(--gruen); }
.warn-text { color: var(--amber); }

/* --- Kopfzeile --- */
.topbar { background: var(--weiss); border-bottom: 1px solid var(--linie); }
.topbar-inner {
  max-width: 1100px; margin: 0 auto; padding: .5rem 1rem;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .5rem;
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--tinte); }
.logo { height: 36px; width: auto; border-radius: 4px; }
.brand-name { font-weight: 700; letter-spacing: .02em; }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.nav-link {
  text-decoration: none; color: var(--tinte); padding: .55rem .75rem;
  border-radius: 8px; font-size: .95rem;
}
.nav-link:hover { background: var(--flaeche); }
.nav-logout { color: var(--grau); }
.demo-banner {
  background: #fef3c7; color: #92400e; text-align: center;
  font-size: .85rem; padding: .35rem .75rem;
}

/* --- Layout --- */
.container { max-width: 1100px; margin: 0 auto; padding: 1rem; width: 100%; flex: 1; }
.footer { background: var(--weiss); border-top: 1px solid var(--linie); margin-top: 2rem; }
.footer-inner {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
  padding: 1rem; font-size: .85rem; color: var(--grau);
}
.footer-links { display: flex; gap: 1rem; }
.footer-links a { color: var(--grau); }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem;
}
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.card {
  background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--radius);
  box-shadow: var(--schatten); padding: 1.25rem; margin-bottom: 1rem;
}
.card-narrow { max-width: 420px; margin: 3rem auto; }
.card-form { max-width: 720px; margin: 1rem auto; }
.center { text-align: center; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 860px) { .grid2 { grid-template-columns: 1fr 1fr; } }

.flash {
  background: #dbeafe; color: var(--blau-dunkel); border-radius: 8px;
  padding: .75rem 1rem; margin-bottom: 1rem; font-size: .95rem;
  overflow-wrap: anywhere;
}
.flash-error { background: #fee2e2; color: var(--rot); }

/* --- Statuskacheln --- */
.statusboard {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: 1rem;
}
@media (min-width: 720px) { .statusboard { grid-template-columns: repeat(6, 1fr); } }
.statuscard {
  background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--radius);
  padding: .6rem .5rem; text-align: center; text-decoration: none; color: var(--tinte);
}
.statuscard.aktiv { border-color: var(--blau); box-shadow: 0 0 0 1px var(--blau); }
.statuscard-zahl { display: block; font-size: 1.3rem; font-weight: 700; }
.statuscard-label { display: block; font-size: .72rem; color: var(--grau); }

/* --- Filter --- */
.filterbar { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filterbar input[type="search"] { flex: 1 1 200px; }
.filterbar select { flex: 0 1 auto; }

/* --- Formulare --- */
label { display: block; margin-bottom: .9rem; font-size: .9rem; font-weight: 600; }
input[type="text"], input[type="search"], input[type="url"], input[type="tel"],
input[type="email"], input[type="number"], input[type="password"], select, textarea {
  width: 100%; padding: .65rem .75rem; margin-top: .25rem;
  border: 1px solid #d1d5db; border-radius: 8px;
  font: inherit; font-weight: 400; color: var(--tinte); background: var(--weiss);
  min-height: 44px;
}
textarea { min-height: auto; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--blau); outline-offset: 1px; border-color: var(--blau);
}
select { appearance: auto; }
fieldset {
  border: 1px solid var(--linie); border-radius: var(--radius);
  padding: 1rem; margin: 0 0 1rem;
}
legend { font-weight: 700; font-size: .95rem; padding: 0 .4rem; }
.formgrid { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
@media (min-width: 640px) {
  .formgrid { grid-template-columns: 1fr 1fr; }
  .formgrid .span2 { grid-column: span 2; }
}
.checklabel { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; }
.checklabel input { width: 1.3rem; height: 1.3rem; min-height: auto; margin-top: .15rem; flex-shrink: 0; }
.radiorow { display: flex; gap: 1.5rem; margin-bottom: .75rem; }
.radiolabel { display: flex; align-items: center; gap: .45rem; font-weight: 400; margin: 0; }
.radiolabel input { width: 1.25rem; height: 1.25rem; min-height: auto; }
.statusrow { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }
.statusrow select { flex: 1 1 180px; width: auto; }
.uploadrow { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.uploadrow input[type="file"] { flex: 1 1 220px; }
.linkbox { font-size: .8rem; color: var(--grau); }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .6rem 1rem; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-size: .95rem; font-weight: 600; cursor: pointer;
  text-decoration: none; min-height: 44px; text-align: center;
}
.btn-primary { background: var(--blau); color: #fff; }
.btn-primary:hover { background: var(--blau-dunkel); }
.btn-secondary { background: var(--weiss); color: var(--tinte); border-color: #d1d5db; }
.btn-secondary:hover { background: var(--flaeche); }
.btn-ghost { background: transparent; color: var(--grau); }
.btn-danger { background: #fff; color: var(--rot); border-color: #fca5a5; }
.btn-danger:hover { background: #fef2f2; }
.btn-disabled { background: var(--flaeche); color: var(--grau); cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-groß { font-size: 1.05rem; padding: .8rem 1rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.file-btn { position: relative; overflow: hidden; margin: 0; }
.file-btn input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: auto;
}
.actionlist { display: flex; flex-direction: column; gap: .5rem; }
.actionlist form { margin: 0; }

/* --- Tabellen (Desktop) → Karten (Mobil) --- */
.tablewrap { overflow-x: auto; }
.datatable { width: 100%; border-collapse: collapse; background: var(--weiss);
  border: 1px solid var(--linie); border-radius: var(--radius); overflow: hidden; }
.datatable th, .datatable td { padding: .65rem .75rem; text-align: left; font-size: .92rem; }
.datatable thead th {
  background: var(--flaeche); color: var(--grau); font-size: .78rem;
  text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--linie);
}
.datatable tbody tr { border-bottom: 1px solid var(--linie); }
.datatable tbody tr:last-child { border-bottom: none; }
.rowlink { cursor: pointer; }
.rowlink:hover { background: #f8fafc; }
.datatable a { text-decoration: none; font-weight: 600; }

@media (max-width: 719px) {
  .datatable thead { display: none; }
  .datatable, .datatable tbody, .datatable tr, .datatable td { display: block; width: 100%; }
  .datatable { border: none; background: transparent; }
  .datatable tbody tr {
    background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--radius);
    box-shadow: var(--schatten); margin-bottom: .6rem; padding: .35rem 0;
  }
  .datatable td { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem .9rem; }
  .datatable td::before {
    content: attr(data-label); color: var(--grau); font-size: .8rem; flex-shrink: 0;
    padding-top: .1rem;
  }
  .datatable td[data-label="Detail"] { flex-direction: column; gap: .15rem; }
}

/* --- Badges --- */
.badge {
  display: inline-block; padding: .15rem .6rem; border-radius: 999px;
  font-size: .78rem; font-weight: 600; background: var(--flaeche); color: var(--grau);
  white-space: nowrap;
}
.badge-neu { background: #dbeafe; color: var(--blau-dunkel); }
.badge-link_gesendet { background: #fef3c7; color: var(--amber); }
.badge-vollstaendig { background: #dcfce7; color: var(--gruen); }
.badge-termin { background: #ede9fe; color: var(--violett); }
.badge-vermietet { background: #d1fae5; color: #065f46; }
.badge-abgesagt { background: #fee2e2; color: var(--rot); }
.badge-aktiv { background: #dcfce7; color: var(--gruen); }
.badge + .hint { display: block; margin-top: .15rem; }

/* --- Detailseiten --- */
.datalist { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: .3rem .9rem; margin: 0; }
.datalist dt { color: var(--grau); font-size: .85rem; padding-top: .1rem; }
.datalist dd { margin: 0; overflow-wrap: anywhere; }
.nachricht {
  background: var(--flaeche); border-radius: 8px; padding: .75rem;
  white-space: pre-wrap; font-size: .92rem; overflow-wrap: anywhere;
}
.objektinfo {
  background: var(--flaeche); border-left: 4px solid var(--blau);
  border-radius: 8px; padding: .75rem 1rem; margin-bottom: 1rem;
}
.empty { text-align: center; color: var(--grau); padding: 3rem 1rem; }
.inline-upload { margin: 0; }
.sticky-save {
  position: sticky; bottom: 0; background: var(--flaeche);
  padding: .75rem 0; border-top: 1px solid var(--linie); margin-top: .5rem;
}
code {
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: 4px;
  padding: .05rem .35rem; font-size: .82rem; overflow-wrap: anywhere;
}
textarea { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .88rem; }
.checkgrid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: .1rem 1rem; margin-bottom: 1rem;
}
@media (min-width: 640px) { .checkgrid { grid-template-columns: repeat(3, 1fr); } }
.checkgrid .checklabel { font-weight: 400; margin-bottom: .3rem; }
.stellplatz-block { display: flex; gap: 2rem; flex-wrap: wrap; margin-bottom: 1rem; }
.stellplatz-block .checklabel { font-weight: 400; margin-bottom: .3rem; }

/* Hervorgehobene Beschriftungen (nur die Texte, blau) */
.blau-label { color: var(--blau); }
input.blau-text { color: var(--blau); font-weight: 600; }

/* 2FA */
.qr-box { display: inline-block; padding: .5rem; background: #fff; border: 1px solid var(--linie); border-radius: 8px; }
.qr-box svg { width: 200px; height: 200px; display: block; }
.totp-secret { font-size: 1rem; letter-spacing: .05em; word-break: break-all; }
.objektbild-vorschau {
  max-width: 100%; max-height: 240px; border-radius: var(--radius); border: 1px solid var(--linie);
}
details.card summary { cursor: pointer; }
.objektbild-anfrage {
  width: 100%; max-height: 320px; object-fit: cover; border-radius: var(--radius);
  border: 1px solid var(--linie); margin-bottom: .75rem;
}
.objektlink { margin-top: .5rem; }
.objektlink a { font-weight: 600; }
.widerruf-box {
  margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--linie); text-align: center;
}
.termin-vergangen { opacity: .55; }

/* Kostentabelle im Objektformular */
.kostenblock { margin-bottom: 1rem; }
.kostenzeile { display: flex; gap: .5rem; align-items: center; margin-bottom: .4rem; }
.kostenzeile > input[type="text"]:first-child { flex: 2 1 0; }
.kostenzeile .k-betrag { flex: 1 1 0; text-align: right; max-width: 160px; }
.kostenzeile .k-label { flex: 2 1 0; font-size: .9rem; }
.kostenzeile-summe { border-top: 1px solid var(--linie); padding-top: .5rem; margin-top: .25rem; }
.btn-summe { flex: 0 0 auto; padding: .5rem .75rem; min-height: 44px; font-size: 1.1rem; line-height: 1; }
.kostenzeile input { margin-top: 0; }
