/* Mieterportal – eigenes Stylesheet über Pico CSS v2 (lokal unter /static/vendor).
   Farben mit Kontrast >= 4,5:1 auf Weiß. Status immer Text + Symbol + Farbe. */
:root {
  --accent: #1d4ed8;
  --accent-dark: #1e40af;
  --success: #15803d;
  --danger: #b91c1c;
  --warn: #92400e;
  --bg: #f4f5f7;
  --card-bg: #ffffff;
  --text: #1f2937;
  --text-muted: #525c69;
  --border: #d9dde3;
  --pico-primary: var(--accent);
  --pico-primary-background: var(--accent);
  --pico-primary-hover: var(--accent-dark);
  --pico-primary-hover-background: var(--accent-dark);
  --pico-font-size: 100%;
  --pico-form-element-spacing-vertical: 0.6rem;
  --pico-form-element-spacing-horizontal: 0.75rem;
}
html { font-size: 16px; }
body { background: var(--bg); color: var(--text); font-size: 1rem; line-height: 1.5; }

/* ---------- Kopf und Navigation ---------- */
.site-header { background: var(--card-bg); border-bottom: 1px solid var(--border); padding: 0 16px; }
.site-header nav { max-width: 1140px; margin: 0 auto; flex-wrap: wrap; }
.site-header nav ul { flex-wrap: wrap; margin: 0; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--accent-dark); text-decoration: none; }
.site-header nav a, .site-header summary { font-size: 0.95rem; }
.site-header nav a[aria-current="page"] { font-weight: 700; color: var(--accent-dark); text-decoration: underline; text-underline-offset: 4px; }
.site-header details.dropdown summary { min-height: 44px; display: flex; align-items: center; }
main.container { max-width: 1140px; padding: 20px 16px 40px; }
footer.site-footer { text-align: center; padding: 24px; color: var(--text-muted); font-size: 0.85rem; }
footer.site-footer a { color: var(--text-muted); }

/* ---------- Karten, Titel, Raster ---------- */
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; padding: 20px; margin-bottom: 20px; }
.card-sm { padding: 14px; }
.section-title { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 12px; }
.section-title a { color: inherit; }
.grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-2 { grid-template-columns: repeat(2, 1fr); } }
.stat { text-align: center; }
.stat .value { font-size: 1.8rem; font-weight: 700; color: var(--accent-dark); font-variant-numeric: tabular-nums; }
.stat .label { color: var(--text-muted); font-size: 0.9rem; }

/* ---------- Formulare: eine Spalte, Label über dem Feld ---------- */
.form-row { display: block; }
.form-row > * { width: 100%; }
label { display: block; margin-bottom: 4px; font-size: 0.9rem; font-weight: 600; color: var(--text); }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px 4px; margin-bottom: 16px; }
legend { font-weight: 700; font-size: 0.95rem; padding: 0 6px; }
input, select, textarea { font-size: 1rem; }
.checkbox-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; min-height: 44px; }
.checkbox-row input { width: auto; margin: 0; }
.checkbox-row label { margin: 0; font-weight: 500; }
.field-error { color: var(--danger); font-size: 0.9rem; margin: -8px 0 12px; }
[aria-invalid="true"] { border-color: var(--danger) !important; }
/* Einheit als Suffix: <div class="unit" data-unit="€"><input …></div> */
.unit { position: relative; }
.unit input { padding-right: 3rem; }
.unit::after { content: attr(data-unit); position: absolute; right: 0.9rem; top: 0.65rem; color: var(--text-muted); pointer-events: none; }

/* ---------- Schaltflächen (Touch-Ziele >= 44 px) ---------- */
.btn, a.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: auto;
  min-height: 44px; padding: 8px 16px; margin: 0 4px 4px 0; border-radius: 6px; border: 1px solid var(--border);
  background: #fff; color: var(--text); text-decoration: none; font-size: 0.95rem; cursor: pointer; line-height: 1.2;
}
.btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.btn-primary, a.btn-primary, button.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-danger, button.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #991b1b; color: #fff; }
.btn-sm, a.btn-sm, button.btn-sm { min-height: 36px; padding: 4px 10px; font-size: 0.85rem; }
@media (max-width: 719px) { .btn-sm, a.btn-sm, button.btn-sm { min-height: 44px; } }
button[disabled] { opacity: 0.6; cursor: not-allowed; }

/* ---------- Status: Text + Symbol + Farbe ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.badge-new { background: #dbeafe; color: #1e3a8a; }
.badge-ok, .badge-done { background: #dcfce7; color: #14532d; }
.badge-warn { background: #fef3c7; color: #78350f; }
.badge-open { background: #fee2e2; color: #7f1d1d; }
.badge:not([class*="badge-"]) { background: #e5e7eb; color: #374151; }
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 0.95rem; border: 1px solid transparent; }
.alert-success { background: #dcfce7; color: #14532d; border-color: #bbf7d0; }
.alert-error { background: #fee2e2; color: #7f1d1d; border-color: #fecaca; }
.alert-info { background: #dbeafe; color: #1e3a8a; border-color: #bfdbfe; }
.alert a { color: inherit; text-decoration: underline; }

/* ---------- Tabellen: Geldspalten rechtsbündig, Ziffern untereinander ---------- */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; margin-bottom: 8px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); font-size: 0.93rem; vertical-align: top; }
th { color: var(--text-muted); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; background: var(--card-bg); }
thead th, tr:first-child > th { position: sticky; top: 0; z-index: 1; }
td.num, th.num, td[style*="text-align:right"], th[style*="text-align:right"] { text-align: right; white-space: nowrap; }
tfoot th, tfoot td { font-weight: 700; border-top: 2px solid var(--text); color: var(--text); font-size: 0.93rem; text-transform: none; position: static; }
@media (max-width: 719px) { .card { padding: 14px; } table { display: block; overflow-x: auto; } thead th, tr:first-child > th { position: static; } }

/* ---------- Fokus sichtbar (Tastatur) ---------- */
:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }
a:focus-visible, button:focus-visible, summary:focus-visible { border-radius: 4px; }

/* ---------- Diverses ---------- */
.muted { color: var(--text-muted); font-size: 0.85rem; }
details > summary { cursor: pointer; }
.htmx-request { opacity: 0.6; transition: opacity 120ms; }
.todo { list-style: none; padding: 0; margin: 0; }
.todo li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.todo li:last-child { border-bottom: 0; }
.todo .icon { font-size: 1.2rem; line-height: 1.4; width: 1.6rem; text-align: center; }

/* ---------- Druck ---------- */
@media print {
  .site-header, .site-footer, .btn, form, details { display: none !important; }
  body { background: #fff; }
  .card { border: 0; padding: 0; }
}

/* ---------- Upload-Feld mit Drag & Drop (components/dropzone.html) ---------- */
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 160px; padding: 24px 16px; margin-bottom: 12px; text-align: center; cursor: pointer;
  border: 3px dashed var(--border); border-radius: 12px; background: #f9fafb; transition: background 120ms, border-color 120ms; }
.dropzone:hover, .dropzone:focus-within { border-color: var(--accent); }
.dropzone:focus-within { outline: 3px solid #f59e0b; outline-offset: 2px; }
.dropzone.is-dragover { border-color: var(--accent); border-style: solid; background: #dbeafe; }
.dropzone.is-busy { opacity: 0.7; cursor: progress; }
.dropzone-icon { font-size: 2rem; line-height: 1; color: var(--accent); }
.dropzone-label { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.dropzone-hint { font-size: 0.85rem; color: var(--text-muted); }
/* Datei-Feld unsichtbar, aber per Tastatur erreichbar und für Screenreader vorhanden */
.dropzone-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.dropzone-js .dropzone-fallback { display: none; }
.dropzone-list { list-style: none; padding: 0; margin: 0 0 12px; }
.dropzone-list li { display: grid; grid-template-columns: 1fr 120px auto; gap: 10px; align-items: center;
  padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.dropzone-list progress { width: 100%; margin: 0; }
.dz-name { overflow-wrap: anywhere; }
.dz-ok .dz-state { color: var(--success); font-weight: 600; }
.dz-fail .dz-state { color: var(--danger); font-weight: 600; }
@media (max-width: 719px) { .dropzone-list li { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- Interne Notizen ---------- */
.note-title { font-weight: 700; margin-bottom: 6px; }
.note-body { white-space: pre-line; }
.note-meta { margin-top: 8px; }
.note-pinned { border-left: 4px solid var(--warn); background: #fffbeb; }

/* ---------- Übersicht: Startpunkt und Eingang ---------- */
.page-title { font-size: 1.4rem; margin: 0 0 12px; }
.hero { border: 2px solid var(--accent); background: #eff6ff; border-radius: 12px; padding: 20px; margin-bottom: 20px; }
.hero h2 { font-size: 1.3rem; margin: 0 0 6px; color: var(--accent-dark); }
.hero .next { margin: 4px 0 14px; font-size: 1rem; }
.hero .btn-primary { font-size: 1.05rem; min-height: 50px; padding: 10px 22px; }
.hero-ready { border-color: var(--success); background: #f0fdf4; }
.hero-ready h2 { color: var(--success); }
.inbox-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: baseline; margin-bottom: 8px; }
.inbox-choices details { border-top: 1px solid var(--border); padding: 6px 0; }
.inbox-choices summary { font-weight: 600; min-height: 36px; display: flex; align-items: center; }
.inbox-new { border-color: var(--accent); box-shadow: 0 0 0 2px #dbeafe; }
.preview-banner { background: #92400e; color: #fff; text-align: center; padding: 8px 16px; font-weight: 700; }
.recovery-codes { columns: 2; list-style: none; padding: 0; font-size: 1.1rem; }
.recovery-codes li { padding: 4px 0; }
.assign-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: flex-end; margin: 6px 0 0; }
.assign-row > div { flex: 1 1 180px; }
.assign-row > div:last-child { flex: 0 0 auto; }
.assign-row select, .assign-row input[type=text] { margin-bottom: 0; }
.assign-row .btn { margin-bottom: 0; }
.assign-what { font-weight: 600; align-self: center; }
.assign-other { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 6px; }
.assign-other summary { color: var(--text-muted); font-size: 0.9rem; min-height: 36px; display: flex; align-items: center; }
.assign-other .assign-row { padding: 8px 0; border-bottom: 1px dashed var(--border); }
.inbox-name { overflow-wrap: anywhere; }
.bulk-assign { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; border-color: var(--accent); }
@media (max-width: 719px) { .assign-row > div, .assign-row > div:last-child { flex: 1 1 100%; } .assign-row .btn { width: 100%; } }
.twofa-banner { background: #fef3c7; color: #78350f; border-bottom: 1px solid #fcd34d; padding: 8px 16px; text-align: center; font-size: 0.95rem; }
.twofa-banner a { color: inherit; font-weight: 700; text-decoration: underline; margin-left: 6px; }
.space-free { border-left: 4px solid var(--success); background: #f7fdf9; }
.space details { margin-top: 6px; }
.space details > summary { font-size: 0.9rem; min-height: 32px; display: flex; align-items: center; }
.tax-pos { border-bottom: 1px solid var(--border); padding: 6px 0; }
.tax-pos > summary { display: flex; justify-content: space-between; gap: 10px; }
.tax-total { display: flex; justify-content: space-between; font-weight: 700; border-top: 2px solid var(--text); padding-top: 8px; margin: 10px 0 0; }

/* v2-Texte (23.10.2026): Links in Petrol (Designsystem v2, mieterportal --akzent-dunkel), Lucide-Symbole */
a { color: #08514f; text-underline-offset: 3px; }
a:hover { color: #0b6e6b; }
.btn a, a.btn { text-decoration: none; }
svg.i { width: 1.1em; height: 1.1em; vertical-align: -0.18em; fill: none; stroke: currentColor; stroke-width: 2;
        stroke-linecap: round; stroke-linejoin: round; flex: none; }
.punkt { display: inline-block; width: .6em; height: .6em; border-radius: 50%; background: currentColor; margin-right: .25em; vertical-align: .05em; }
