/* =============================================================================
   Tenant-Matcher Dashboard — Basis-Stylesheet
   -----------------------------------------------------------------------------
   ALLE Farben/Schriften liegen als CSS-Variablen in :root. Die PPDesign-Vorgaben
   werden in static/theme-ppdesign.css gemappt (wird NACH dieser Datei geladen
   und ueberschreibt nur die Variablen — Layout bleibt unangetastet).
   ============================================================================= */

:root {
  /* --- Marke / PPDesign-Mapping (hier ueberschreibt theme-ppdesign.css) --- */
  --color-primary:          #1f3a5f;   /* Hauptfarbe (Buttons, Topbar) */
  --color-primary-contrast: #ffffff;   /* Text auf Hauptfarbe */
  --color-accent:           #2d6cdf;   /* Links, Hervorhebung */

  /* --- Flaechen / Hintergruende --- */
  --color-bg:             #f4f6f9;   /* Seitenhintergrund */
  --color-surface:        #ffffff;   /* Karten/Tabellen */
  --color-surface-alt:    #f8fafc;   /* Zebrastreifen, Detailbereiche */
  --color-border:         #e2e8f0;

  /* --- Text --- */
  --color-text:           #1a2330;
  --color-text-muted:     #64748b;

  /* --- Ampel --- */
  --ampel-gruen-bg:       #d6f0dd;  --ampel-gruen-fg: #1c7a3e;
  --ampel-orange-bg:      #fdeccb;  --ampel-orange-fg: #9a6209;
  --ampel-rot-bg:         #fbd5da;  --ampel-rot-fg:    #b3203a;
  --flag-bg:              #fbd5da;  --flag-fg:         #b3203a;

  /* --- Typografie / Form --- */
  --font:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04);
  --shadow-hover: 0 4px 14px rgba(16,24,40,.10);
  --maxw: 1140px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .2rem; letter-spacing: -.01em; }
.muted { color: var(--color-text-muted); }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }

/* --- Topbar --- */
.topbar { background: var(--color-primary); color: #fff; }
.topbar__inner {
  max-width: var(--maxw); margin: 0 auto; padding: .75rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: .7rem; color: #fff; }
.brand:hover { text-decoration: none; }
.brand__mark {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 8px;
  background: rgba(255,255,255,.14); font-weight: 700; letter-spacing: .02em;
}
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__text strong { font-size: 1.02rem; }
.brand__text small { opacity: .8; font-size: .76rem; }
.topbar__meta { display: flex; gap: .5rem; flex-wrap: wrap; }

.chip {
  display: inline-block; padding: .2rem .6rem; border-radius: 999px;
  font-size: .74rem; font-weight: 600;
}
.chip--muted { background: rgba(255,255,255,.16); color: #fff; }

/* --- Disclaimer (Pflicht-Hinweis) --- */
.disclaimer {
  background: #fff7e6; border-bottom: 1px solid #f3e2bd; color: #8a5a00;
  font-size: .85rem; font-weight: 600;
  display: flex; align-items: center; gap: .5rem;
  padding: .55rem 1.25rem; max-width: var(--maxw); margin: 0 auto;
}
.disclaimer__icon {
  display: inline-grid; place-items: center; width: 18px; height: 18px;
  border-radius: 50%; background: #e8a400; color: #fff; font-size: .7rem; font-style: italic;
}

main.container { padding-top: 1.75rem; padding-bottom: 3rem; }

/* --- Page head --- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head__actions { display: flex; gap: .5rem; }

.btn {
  display: inline-block; padding: .5rem .9rem; border-radius: 8px;
  font-size: .85rem; font-weight: 600; cursor: pointer; border: 1px solid transparent;
}
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--color-primary); color: #fff; }
.btn--primary:hover { box-shadow: var(--shadow-hover); }
.btn--ghost { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border); }
.btn--ghost:hover { background: var(--color-surface-alt); }

/* --- Objekt-Karten --- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }
.card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow);
  color: var(--color-text); display: flex; flex-direction: column; gap: .7rem;
  transition: box-shadow .15s, transform .15s;
}
a.card:hover { text-decoration: none; box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.card__head { display: flex; align-items: center; justify-content: space-between; }
.card__nr { font-weight: 700; font-size: 1.05rem; }
.card__addr { color: var(--color-text-muted); font-size: .9rem; }
.card__foot { display: flex; align-items: center; justify-content: space-between; font-size: .82rem; margin-top: .2rem; }
.card__link { color: var(--color-accent); font-weight: 600; }

.ampel-bar { display: flex; height: 26px; border-radius: 6px; overflow: hidden; background: var(--color-surface-alt); }
.ampel-bar__seg { display: grid; place-items: center; color: #fff; font-size: .76rem; font-weight: 700; min-width: 26px; }
.ampel-bar__seg--gruen  { background: var(--ampel-gruen-fg); }
.ampel-bar__seg--orange { background: var(--ampel-orange-fg); }
.ampel-bar__seg--rot    { background: var(--ampel-rot-fg); }
.ampel-bar__seg--leer   { color: var(--color-text-muted); font-weight: 500; flex: 1; }

.flag { color: var(--flag-fg); background: var(--flag-bg); border-radius: 6px; padding: .1rem .45rem; font-weight: 700; font-size: .8rem; }
.ok { color: var(--ampel-gruen-fg); font-weight: 700; }

/* --- Breadcrumb --- */
.breadcrumb { font-size: .82rem; color: var(--color-text-muted); margin-bottom: .75rem; }
.breadcrumb span { margin: 0 .35rem; }

/* --- Statistik-Chips --- */
.stats { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.stat {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: .7rem 1.1rem; min-width: 96px;
  display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.stat__num { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.stat__lbl { font-size: .76rem; color: var(--color-text-muted); margin-top: .25rem; }
.stat--gruen  .stat__num { color: var(--ampel-gruen-fg); }
.stat--orange .stat__num { color: var(--ampel-orange-fg); }
.stat--rot    .stat__num { color: var(--ampel-rot-fg); }
.stat--flag   .stat__num { color: var(--flag-fg); }

/* --- Shortlist-Tabelle --- */
.table-wrap { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.shortlist { width: 100%; border-collapse: collapse; font-size: .88rem; }
.shortlist thead th {
  text-align: left; background: var(--color-surface-alt); color: var(--color-text-muted);
  font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .03em;
  padding: .7rem .85rem; border-bottom: 1px solid var(--color-border);
}
.shortlist tbody td { padding: .7rem .85rem; border-bottom: 1px solid var(--color-border); vertical-align: top; }
.shortlist tbody tr:last-child td { border-bottom: none; }
.shortlist .num { text-align: right; font-variant-numeric: tabular-nums; }
.td-name { font-weight: 600; white-space: nowrap; }
.row--gruen  { box-shadow: inset 3px 0 0 var(--ampel-gruen-fg); }
.row--orange { box-shadow: inset 3px 0 0 var(--ampel-orange-fg); }
.row--rot    { box-shadow: inset 3px 0 0 var(--ampel-rot-fg); }

.pill { display: inline-block; padding: .18rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 700; }
.pill--gruen  { background: var(--ampel-gruen-bg);  color: var(--ampel-gruen-fg); }
.pill--orange { background: var(--ampel-orange-bg); color: var(--ampel-orange-fg); }
.pill--rot    { background: var(--ampel-rot-bg);    color: var(--ampel-rot-fg); }

/* Klappbare Zeilen */
.hint-row { font-size: .82rem; margin: 0 0 .6rem; }
.row[data-target] { cursor: pointer; }
.row[data-target]:hover td { background: var(--color-surface-alt); }
.row[data-target]:focus { outline: 2px solid var(--color-accent); outline-offset: -2px; }
.td-name { line-height: 1.25; }
.begr-snip {
  display: block; color: var(--color-text-muted); font-size: .78rem; font-weight: 400;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; margin-top: .15rem;
}
.chev { text-align: center; color: var(--color-text-muted); width: 28px; }
.chev__icon { display: inline-block; transition: transform .15s; font-style: normal; }
.row.open .chev__icon { transform: rotate(180deg); color: var(--color-accent); }

/* Volle-Breite-Detailzeile — Begründung wird komplett angezeigt */
.detail-row[hidden] { display: none; }
.detail-row > td { padding: 0; background: var(--color-surface-alt); }
.detail { padding: 1rem 1.1rem; }
.detail__begr { margin: 0 0 .75rem; max-width: 70ch; }

table.kriterien { width: 100%; border-collapse: collapse; font-size: .8rem; margin-bottom: .5rem; }
.kriterien td { padding: .3rem .5rem; border-bottom: 1px solid var(--color-border); }
.krit__typ { font-size: .66rem; font-weight: 700; color: var(--color-text-muted); width: 48px; }
.krit__name { font-weight: 600; white-space: nowrap; }
.krit__erg { white-space: nowrap; font-weight: 600; }
.krit--erfuellt .krit__erg { color: var(--ampel-gruen-fg); }
.krit--knapp .krit__erg { color: var(--ampel-orange-fg); }
.krit--nicht_erfuellt .krit__erg { color: var(--ampel-rot-fg); }
.krit__beleg { color: var(--color-text-muted); font-size: .76rem; }

.hinweis-box { background: #fff7e6; border: 1px solid #f3e2bd; border-radius: 8px; padding: .6rem .75rem; font-size: .82rem; margin-top: .5rem; }
.hinweis-box--rot { background: var(--ampel-rot-bg); border-color: #f1b6c0; }
.hinweis-box ul { margin: .35rem 0 0; padding-left: 1.1rem; }
.absage { margin-top: .4rem; }
.absage__text { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 6px; padding: .55rem; font-style: italic; white-space: pre-line; }

/* --- Footer --- */
.footer { border-top: 1px solid var(--color-border); background: var(--color-surface); margin-top: 2rem; }
.footer__inner { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; font-size: .76rem; color: var(--color-text-muted); flex-wrap: wrap; }

@media (max-width: 720px) {
  .td-begr { max-width: none; }
  .topbar__meta { display: none; }
  .footer__inner { flex-direction: column; }
}

/* --- Daten-Upload --- */
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.card h3 { margin: 0 0 .5rem; }
.upload-card { display: flex; flex-direction: column; gap: .85rem; align-items: flex-start; }
.file-input { font-size: .9rem; }
.file-input::file-selector-button {
  font: inherit; font-weight: 600; cursor: pointer; margin-right: .6rem;
  padding: .45rem .8rem; border-radius: 8px;
  border: 1px solid var(--color-border); background: var(--color-surface-alt); color: var(--color-text);
}
.check { display: flex; gap: .5rem; align-items: center; font-size: .85rem; color: var(--color-text-muted); }
.check input { width: auto; }
.cols { margin: .5rem 0 0; padding-left: 1.1rem; font-size: .85rem; color: var(--color-text-muted); line-height: 1.7; }
code { background: var(--color-surface-alt); border: 1px solid var(--color-border); border-radius: 4px; padding: .05rem .35rem; font-size: .85em; }

/* --- Upload-Ergebnis je Objekt --- */
.obj-block { margin-bottom: 2rem; }
.obj-block__head { display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; margin-bottom: .6rem; }
.obj-block__head h2 { margin: 0; }
.obj-block__counts { display: flex; gap: .4rem; margin-left: auto; }

@media (max-width: 720px) {
  .upload-grid { grid-template-columns: 1fr; }
  .brand__sep, .brand__text { display: none; }
  .topbar__nav { gap: .7rem; }
}

/* --- Objekt-Formular --- */
.objekt-form { display: flex; flex-direction: column; gap: 1rem; }
fieldset.card { border: 1px solid var(--color-border); min-width: 0; }
legend { font-weight: 600; padding: 0 .5rem; font-size: 1rem; }
.legend-tag { font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  background: var(--color-surface-alt); border: 1px solid var(--color-border); color: var(--color-text-muted);
  padding: .1rem .5rem; border-radius: 999px; margin-left: .4rem; }
.legend-tag--manual { color: #7A5A12; background: #F8EFD9; border-color: #EAD9AE; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .85rem 1rem; }
.objekt-form label { display: flex; flex-direction: column; gap: .3rem; font-size: .82rem; font-weight: 600; color: var(--color-text); }
.objekt-form label.full { grid-column: 1 / -1; }
.objekt-form input, .objekt-form select {
  font: inherit; font-weight: 400; padding: .5rem .6rem; border: 1px solid var(--color-border);
  border-radius: 8px; background: var(--color-surface); color: var(--color-text); width: 100%;
}
.objekt-form input:focus, .objekt-form select:focus { outline: 2px solid var(--color-accent); outline-offset: -1px; }
.check-row { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; margin-top: 1rem; }
/* Haken IMMER als Zeile (Checkbox links neben Text) — schlaegt .objekt-form label {flex-direction:column} */
.objekt-form label.check { display: flex; flex-direction: row; align-items: center; gap: .55rem;
  font-size: .85rem; font-weight: 500; color: var(--color-text); }
.check input { width: auto; flex: none; }
.subfield { border: 1px solid var(--color-border); border-radius: 8px; padding: .85rem 1rem; margin-top: 1rem; }
.subfield__legend { font-size: .8rem; font-weight: 600; color: var(--color-text); padding: 0 .4rem; }
/* Pflicht-Unterlagen als klickbare Auswahlzeilen (aktiv = hervorgehoben) */
.check-col { display: flex; flex-direction: column; gap: .4rem; margin: .3rem 0 .8rem; }
.check-col .check { padding: .55rem .7rem; border: 1px solid var(--color-border); border-radius: 8px;
  background: var(--color-surface); cursor: pointer; transition: background .15s ease, border-color .15s ease; }
.check-col .check:hover { background: var(--color-surface-alt); }
.check-col .check:has(input:checked) { border-color: var(--color-accent); background: #eff5fe; }
.form-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: .25rem; }
/* Block-A-Auto-Fill (PropStack) */
.btn--sm { padding: .4rem .75rem; font-size: .82rem; }
.ps-load { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-top: -.35rem; }
.ps-status { font-size: .82rem; }

/* --- Anforderungs-Leiste (Objekt-Detail) --- */
.anf-bar { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.anf { font-size: .78rem; background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: 999px; padding: .2rem .65rem; color: var(--color-text-muted); }
.anf strong { color: var(--color-text); font-weight: 600; }
.anf--extra { background: var(--color-surface-alt); }

/* --- Upload-Zeile (Objekt-Detail) --- */
.upload-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.upload-row__controls { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.upload-row input[type=file] { width: auto; }

/* --- Leerzustand --- */
.empty-state { text-align: center; padding: 2.5rem 1rem; }
.empty-state p { margin: .3rem 0; }

/* --- Zugangskontrolle: Header-Nutzer + Abmelden --- */
.topbar__nav { display: flex; align-items: center; gap: 1rem; }
.topbar__user {
  font-size: .78rem; font-weight: 600; color: #fff;
  background: rgba(255,255,255,.16); padding: .22rem .6rem; border-radius: 999px;
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar__logout { color: #fff; opacity: .85; font-size: .82rem; }
.topbar__logout:hover { opacity: 1; }

/* --- Login-Seite --- */
.login {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1.25rem;
  padding: 2rem 1.25rem; background: var(--color-bg);
}
.login__card {
  width: 100%; max-width: 380px; background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 2rem 1.75rem; text-align: center;
}
.pplogo--login { margin-bottom: 1.1rem; justify-content: center; }
.pplogo--login .pplogo__w { color: var(--color-primary); }
.login__title { font-size: 1.4rem; margin: .2rem 0 .1rem; color: var(--color-text); }
.login__sub { color: var(--color-text-muted); font-size: .84rem; margin-bottom: 1.4rem; }
.btn-google {
  display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
  width: 100%; padding: .7rem 1rem; border: 1px solid var(--color-border);
  border-radius: 8px; background: #fff; color: var(--color-text);
  font-weight: 600; font-size: .92rem; transition: box-shadow .15s ease, border-color .15s ease;
}
.btn-google:hover { text-decoration: none; box-shadow: var(--shadow-hover); border-color: #cbd5e1; }
.login__hint { color: var(--color-text-muted); font-size: .76rem; margin-top: .9rem; }
.login__form { display: flex; flex-direction: column; gap: .8rem; text-align: left; }
.login__form label {
  display: flex; flex-direction: column; gap: .3rem;
  font-size: .82rem; font-weight: 600; color: var(--color-text);
}
.login__form input {
  padding: .55rem .7rem; border: 1px solid var(--color-border); border-radius: 8px;
  font: inherit; font-weight: 400; color: var(--color-text); background: #fff;
}
.login__form input:focus { outline: 2px solid var(--color-accent); outline-offset: -1px; }
.login__submit { width: 100%; justify-content: center; margin-top: .3rem; padding: .65rem 1rem; }
.login__trenner {
  display: flex; align-items: center; gap: .7rem; margin: 1.1rem 0;
  color: var(--color-text-muted); font-size: .76rem;
}
.login__trenner::before, .login__trenner::after {
  content: ""; flex: 1; height: 1px; background: var(--color-border);
}
.login__error {
  background: var(--ampel-rot-bg); color: var(--ampel-rot-fg);
  border-radius: 8px; padding: .65rem .8rem; font-size: .82rem;
  font-weight: 600; margin-bottom: 1.1rem;
}
.login__legal { color: var(--color-text-muted); font-size: .72rem; max-width: 380px; text-align: center; }
