/* Moritz Frank Immobilien · Verwaltung
   Erscheinungsbild nach docs/design-mfi.md (Palette, Schriften, geprüfte Kontraste).
   Drei Regeln für alle, die hier etwas ergänzen:
   1. Jede Fläche setzt ihre Schriftfarbe selbst (Falle „vererbte helle Schrift“ aus der dunklen Seitenleiste).
   2. Amber GEFÜLLT nur für den einen Hauptknopf je Bildschirm (.btn-gold bzw. .btn-amber). Sonst Amber nur als Linie, Icon oder Text auf Dunkel.
   3. Die alten Variablennamen (--navy-3, --gold, --linie, --text-2 …) bleiben als Verweise bestehen: die Module benutzen sie in eigenen Stilen. */

:root {
  color-scheme: light;

  /* Palette MFI (Quelle: docs/design-mfi.md) */
  --night: #07101F;
  --navy: #0B1D3A;
  --brand: #00255B;
  --brand-2: #1C3F73;
  --ice: #EEF2F7;
  --paper: #F7F9FC;
  --card: #FFFFFF;
  --text: #0F1A2B;
  --muted: #44566E;
  --on-dark: #EAF0F8;
  --on-dark-muted: #9DB0C8;
  --amber: #F2A93B;
  --amber-soft: #FFD48A;
  --brick: #9C5A48;
  --line: rgba(255, 255, 255, .12);
  --font-head: 'Instrument Serif', Georgia, serif;
  --font-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 14px;
  --shadow: 0 30px 60px -30px rgba(7, 16, 31, .6);

  /* Ableitungen für die helle Arbeitsfläche (Kontraste nachgemessen, siehe Kommentare) */
  --text-3: #56677C;            /* dritte Textstufe: 5,79 auf card · 5,49 paper · 5,15 ice */
  --rand: #DAE2EB;              /* Kartenränder, Tabellenkopf */
  --rand-2: #E8EDF3;            /* Zeilentrenner */
  --rand-feld: #7E8EA4;         /* Eingabefelder: ≥ 3:1 gegen card und paper (Nicht-Text-Kontrast) */
  --rand-knopf: #B9C4D2;
  --zeile-hover: #F3F6FA;
  --fokus: #1C3F73;
  --fokus-ring: 0 0 0 3px rgba(28, 63, 115, .18);
  --schatten-karte: 0 1px 2px rgba(15, 26, 43, .05), 0 14px 32px -26px rgba(15, 26, 43, .32);
  --nav-gesperrt: #7D92AE;      /* gesperrte Menüpunkte: 5,27 auf navy · 5,98 auf night */

  /* Statusfarben, auf die Palette abgestimmt (Text darauf ≥ 4,5:1 auch auf der hellen Tönung) */
  --gruen: #16704A;  --gruen-hell: #E5F4EC;    /* 6,09 card · 5,36 auf gruen-hell */
  --rot: #AE2A22;    --rot-hell: #FBEBE8;      /* 6,66 card · 5,75 auf rot-hell */
  --orange: #8F560B; --orange-hell: #FDF1DC;   /* 5,99 card · 5,36 auf orange-hell */

  /* Bestandsnamen (Module verwenden sie, nicht entfernen) */
  --navy-2: var(--night);
  --navy-3: var(--brand-2);
  --gold: var(--amber);
  --bg: var(--paper);
  --flaeche: var(--card);
  --linie: #D5DEE9;
  --linie-2: var(--ice);
  --text-2: var(--muted);
  --blau: var(--brand-2);
  --blau-hell: #E6EDF6;
  --schatten: var(--schatten-karte);
  --font: var(--font-body);
  --mono: var(--font-mono);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  display: flex; overflow: hidden;
  font-family: var(--font-body); font-size: 13.5px; line-height: 1.45; font-weight: 450;
  color: var(--text); background: var(--paper);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-2); text-underline-offset: 2px; }
a:hover { color: var(--brand); }
::selection { background: rgba(242, 169, 59, .35); color: var(--text); }
:focus-visible { outline: 2px solid var(--fokus); outline-offset: 2px; }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); }
h1, h2, h3 { font-family: var(--font-head); font-weight: 400; letter-spacing: -.005em; line-height: 1.12; }
h1 em, h2 em, h3 em { font-style: italic; color: var(--brand-2); }

/* ---------- Seitenleiste (dunkel) ---------- */
#seitenleiste {
  width: 256px; flex-shrink: 0; display: flex; flex-direction: column; overflow: hidden;
  color: var(--on-dark); color-scheme: dark;
  background: var(--navy) linear-gradient(180deg, var(--night) 0%, var(--navy) 46%);
  border-right: 1px solid var(--line);
}
.marke { display: block; padding: 24px 22px 16px; color: var(--on-dark); text-decoration: none; border-radius: 12px; }
.marke:hover { color: var(--on-dark); }
.marke:focus-visible { outline: 2px solid var(--amber-soft); outline-offset: -6px; }
.marke .logo-svg { display: block; width: 176px; height: auto; }
.logo-name { font-family: var(--font-head); fill: var(--on-dark); }
.logo-sub { font-family: var(--font-mono); font-weight: 500; fill: var(--on-dark-muted); }
.marke-zusatz {
  display: flex; align-items: center; gap: 10px; width: 176px; margin-top: 13px;
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 500; letter-spacing: .34em; text-transform: uppercase;
  color: var(--amber);
}
.marke-zusatz::before, .marke-zusatz::after { content: ''; flex: 1; height: 1px; background: rgba(242, 169, 59, .38); }

.objektwahl { margin: 2px 14px 4px; padding: 12px 12px 11px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .035); color: var(--on-dark); }
.objektwahl label { display: block; margin: 0 2px 7px; font-family: var(--font-mono); font-size: 9.5px; font-weight: 500; letter-spacing: .22em; text-transform: uppercase; color: var(--on-dark-muted); }
.objektwahl select {
  width: 100%; appearance: none; -webkit-appearance: none; cursor: pointer;
  padding: 8px 30px 8px 10px; border: 1px solid rgba(234, 240, 248, .22); border-radius: 9px;
  background: rgba(7, 16, 31, .55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23FFD48A' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 11px center / 10px 6px;
  color: var(--on-dark); font-size: 13px; font-weight: 600;
}
.objektwahl select:hover { border-color: rgba(255, 212, 138, .55); }
.objektwahl select:focus-visible { outline: 2px solid var(--amber-soft); outline-offset: 2px; }
.objektwahl select option { background: var(--navy); color: var(--on-dark); }
#objekt-info { margin: 8px 2px 0; display: flex; gap: 7px; flex-wrap: wrap; align-items: center; font-size: 11.5px; line-height: 1.4; color: var(--on-dark-muted); }
#objekt-info:empty { display: none; }
#objekt-info .typ { padding: 1px 7px; border: 1px solid rgba(242, 169, 59, .5); border-radius: 99px; background: rgba(242, 169, 59, .1); font-family: var(--font-mono); font-size: 9.5px; font-weight: 500; letter-spacing: .14em; color: var(--amber-soft); }

#nav { flex: 1; overflow-y: auto; padding: 4px 12px 28px; scrollbar-width: thin; scrollbar-color: rgba(234, 240, 248, .18) transparent; }
#nav .gruppe { margin-top: 16px; }
#nav .gruppe-titel { padding: 0 10px 6px; font-family: var(--font-mono); font-size: 9.5px; font-weight: 500; letter-spacing: .22em; text-transform: uppercase; color: var(--amber); }
#nav a {
  position: relative; display: flex; align-items: center; gap: 10px; margin: 1px 0; padding: 6px 10px; border-radius: 9px;
  color: var(--on-dark-muted); text-decoration: none; font-size: 13px; font-weight: 500; line-height: 1.35;
  transition: background-color .2s, color .2s;
}
#nav a .i { width: 18px; flex: none; text-align: center; font-size: 13px; color: var(--on-dark-muted); font-variant-emoji: text; }
#nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
#nav a:hover .i { color: var(--amber-soft); }
#nav a.aktiv { background: rgba(242, 169, 59, .16); color: #fff; font-weight: 650; }
#nav a.aktiv::before { content: ''; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--amber); }
#nav a.aktiv .i { color: var(--amber); }
#nav a.gesperrt, #nav a.gesperrt .i { color: var(--nav-gesperrt); }
#nav a.gesperrt:hover { color: var(--on-dark-muted); }
/* aktiv UND gesperrt (Objekt passt nicht zur offenen Seite): auf der Amber-Tönung reicht --nav-gesperrt nicht (3,95), --on-dark-muted 5,70 */
#nav a.aktiv.gesperrt, #nav a.aktiv.gesperrt .i { color: var(--on-dark-muted); }
#nav a:focus-visible { outline: 2px solid var(--amber-soft); outline-offset: -2px; }
#nav a .zahl { margin-left: auto; padding: 0 7px; border-radius: 99px; background: var(--amber-soft); color: var(--night); font-family: var(--font-mono); font-size: 10px; font-weight: 500; line-height: 1.6; }

/* ---------- Hauptbereich (hell) ---------- */
#haupt { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--paper); color: var(--text); }
#kopfzeile {
  position: relative; z-index: 20; height: 58px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 0 28px; background: var(--card); color: var(--text); border-bottom: 1px solid var(--rand);
}
#brotkrumen { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
#brotkrumen b { margin: 0 2px; font-family: var(--font-body); font-size: 14px; font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--text); }
.kopf-rechts { position: relative; display: flex; align-items: center; gap: 10px; }
#schnellsuche {
  width: 340px; height: 38px; padding: 0 16px 0 38px; border: 1px solid var(--rand-knopf); border-radius: 99px;
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='5.2' fill='none' stroke='%2344566E' stroke-width='1.6'/%3E%3Cpath d='M11 11l3.6 3.6' stroke='%2344566E' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 14px center / 15px 15px;
  color: var(--text); transition: border-color .15s, box-shadow .15s, background-color .15s;
}
#schnellsuche::placeholder { color: var(--text-3); }
#schnellsuche:focus { outline: none; border-color: var(--brand-2); background-color: var(--card); box-shadow: var(--fokus-ring); }
#suchergebnisse { position: absolute; right: 0; top: 46px; z-index: 50; display: none; width: 440px; max-height: 440px; overflow-y: auto; padding: 6px; background: var(--card); color: var(--text); border: 1px solid var(--rand); border-radius: 14px; box-shadow: 0 24px 60px -24px rgba(7, 16, 31, .45); }
#suchergebnisse.offen { display: block; }
#suchergebnisse a { display: block; padding: 9px 12px; border-radius: 9px; text-decoration: none; color: var(--text); font-weight: 600; }
#suchergebnisse a:hover, #suchergebnisse a.sel { background: var(--ice); color: var(--brand); }
#suchergebnisse a small { display: block; margin-top: 1px; color: var(--muted); font-size: 12px; font-weight: 500; }
#inhalt { flex: 1; overflow-y: auto; padding: 26px 30px 72px; background: var(--paper); color: var(--text); scrollbar-width: thin; scrollbar-color: #BAC5D3 transparent; }

/* Menüknopf und Schleier nur auf schmalen Bildschirmen (Seitenleiste als Schublade) */
#menue-knopf { display: none; flex: none; width: 40px; height: 40px; padding: 0; border: 1px solid var(--rand-knopf); border-radius: 12px; background: var(--card); color: var(--text); cursor: pointer; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
#menue-knopf span { display: block; width: 17px; height: 2px; border-radius: 2px; background: var(--text); transition: transform .25s, opacity .25s; }
body.nav-offen #menue-knopf span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.nav-offen #menue-knopf span:nth-child(2) { opacity: 0; }
body.nav-offen #menue-knopf span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
#schleier { display: none; }

.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 24px; flex-wrap: wrap; margin: 0 0 22px; }
.page-header h1 { margin: 0; font-family: var(--font-head); font-size: 34px; font-weight: 400; line-height: 1.04; letter-spacing: -.01em; color: var(--text); }
.page-header h1::before {
  content: ''; display: block; width: 30px; height: 9px; margin: 0 0 11px 1px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 9'%3E%3Cpath d='M2 7.2 15 2.2 28 7.2' fill='none' stroke='%23F2A93B' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / contain;
}
.page-header .sub { max-width: 82ch; margin-top: 7px; color: var(--muted); font-size: 13.5px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Karten / Kennzahlen ---------- */
.card { margin-bottom: 18px; background: var(--card); color: var(--text); border: 1px solid var(--rand); border-radius: var(--radius); box-shadow: var(--schatten-karte); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px 12px; border-bottom: 1px solid var(--rand-2); }
.card-head h2 { margin: 0; font-family: var(--font-head); font-size: 21px; font-weight: 400; line-height: 1.15; color: var(--text); }
.card-body { padding: 16px 18px; }
.card-body:has(> .tbl-wrap:only-child) { padding: 0; border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; }
.card-body > .tbl-wrap:only-child .tbl-tools { padding: 12px 16px 0; }
.raster { display: grid; gap: 18px; }
.raster-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.raster-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.raster-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .raster-3, .raster-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { position: relative; overflow: hidden; padding: 15px 18px 14px 21px; background: var(--card); color: var(--text); border: 1px solid var(--rand); border-radius: var(--radius); box-shadow: var(--schatten-karte); }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand-2); }
.kpi.gut::before { background: var(--gruen); } .kpi.schlecht::before { background: var(--rot); } .kpi.warn::before { background: var(--orange); } .kpi.gold::before { background: var(--amber); }
.kpi-label { font-family: var(--font-mono); font-size: 10px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.kpi-wert { margin-top: 7px; font-family: var(--font-head); font-size: 31px; font-weight: 400; line-height: 1.08; letter-spacing: -.005em; color: var(--text); font-variant-numeric: lining-nums tabular-nums; overflow-wrap: anywhere; }
.kpi-sub { margin-top: 3px; color: var(--text-3); font-size: 12px; }

/* ---------- Knöpfe ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 16px;
  border: 1px solid var(--rand-knopf); border-radius: 99px; background: var(--card); color: var(--text);
  font-family: var(--font-body); font-size: 13px; font-weight: 650; line-height: 1.2; white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: background-color .18s, border-color .18s, color .18s, box-shadow .18s;
}
.btn:hover { border-color: var(--brand-2); color: var(--brand); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--fokus); outline-offset: 2px; }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn:disabled:hover { border-color: var(--rand-knopf); color: var(--text); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 10px 22px -16px rgba(0, 37, 91, .8); }
.btn-primary:hover, .btn-primary:disabled:hover { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
/* Hauptknopf: Amber gefüllt, höchstens einer je Bildschirm (Variante 'gold' oder 'amber') */
.btn-gold, .btn-amber { background: var(--amber); border-color: var(--amber); color: var(--night); box-shadow: 0 12px 26px -16px rgba(242, 169, 59, .95); }
.btn-gold:hover, .btn-amber:hover { background: var(--amber-soft); border-color: var(--amber-soft); color: var(--night); }
.btn-gold:focus-visible, .btn-amber:focus-visible { outline-color: var(--brand); }
.btn-danger { background: var(--card); border-color: #E2B3AD; color: var(--rot); }
.btn-danger:hover { background: var(--rot-hell); border-color: var(--rot); color: var(--rot); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--brand-2); }
.btn-ghost:hover { background: var(--ice); border-color: transparent; color: var(--brand); }
.btn-sm { padding: 5px 11px; gap: 5px; font-size: 12px; }
.btn .ic { font-size: 1.05em; line-height: 1; }

/* ---------- Etiketten / Hinweise ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid transparent; border-radius: 99px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 500; letter-spacing: .07em; text-transform: uppercase; line-height: 1.5; white-space: nowrap; vertical-align: middle;
}
.badge-grau { background: var(--ice); border-color: #DCE3EC; color: var(--muted); }
.badge-blau { background: var(--blau-hell); border-color: #CBD8EA; color: var(--brand-2); }
.badge-gruen { background: var(--gruen-hell); border-color: #BEE1CC; color: var(--gruen); }
.badge-rot { background: var(--rot-hell); border-color: #F0C6C0; color: var(--rot); }
.badge-orange { background: var(--orange-hell); border-color: #F0D6A8; color: var(--orange); }
.badge-gold { background: #FFF4DE; border-color: rgba(242, 169, 59, .6); color: #7A4706; }
.hinweis { margin-bottom: 14px; padding: 11px 15px; border: 1px solid; border-radius: 12px; font-size: 13px; line-height: 1.5; }
.hinweis-info { background: #EDF2F9; border-color: #C9D7EA; color: var(--brand); }
.hinweis-ok { background: var(--gruen-hell); border-color: #BCE0CA; color: #135C3A; }
.hinweis-warn { background: #FDF3E2; border-color: #EFD3A0; color: #7A4706; }
.hinweis-fehler { background: #FBECEA; border-color: #EDC3BD; color: #8E2219; }
.hinweis a { color: inherit; font-weight: 650; }
.leer { padding: 48px 20px; text-align: center; color: var(--muted); }
.leer p { margin: 0 0 14px; font-family: var(--font-head); font-size: 21px; font-style: italic; line-height: 1.3; color: var(--muted); }
.pos { color: var(--gruen); } .neg { color: var(--rot); } .muted { color: var(--muted); } .klein { font-size: 12px; }
.mono { font-family: var(--font-mono); font-size: 12px; }

/* ---------- Tabellen ---------- */
.tbl-tools { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.tbl-suche {
  width: 240px; padding: 6px 14px 6px 32px; border: 1px solid var(--rand-feld); border-radius: 99px; color: var(--text);
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='5.2' fill='none' stroke='%2344566E' stroke-width='1.6'/%3E%3Cpath d='M11 11l3.6 3.6' stroke='%2344566E' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 11px center / 13px 13px;
}
.tbl-suche::placeholder { color: var(--text-3); }
.tbl-suche:focus { outline: none; border-color: var(--brand-2); box-shadow: var(--fokus-ring); }
.tbl-anzahl { margin-right: auto; color: var(--text-3); font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; }
.tbl-scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; color: var(--text); font-variant-numeric: tabular-nums; }
.tbl th {
  position: sticky; top: 0; padding: 9px 12px; text-align: left; white-space: nowrap; cursor: pointer; user-select: none;
  background: var(--paper); border-bottom: 1px solid var(--rand); color: var(--muted);
  font-family: var(--font-mono); font-size: 10px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase;
}
.tbl th:hover { color: var(--text); }
.tbl th.auf::after, .tbl th.ab::after { font-size: 8px; color: var(--brand-2); }
.tbl th.auf::after { content: ' ▲'; } .tbl th.ab::after { content: ' ▼'; }
.tbl td { padding: 8px 12px; border-bottom: 1px solid var(--rand-2); vertical-align: middle; }
.tbl .r { text-align: right; white-space: nowrap; }
.tbl.klickbar tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: var(--zeile-hover); }
.tbl tfoot td { font-weight: 700; border-top: 1px solid var(--rand); border-bottom: 0; background: var(--paper); }
.tbl td.akt, .tbl th.akt { text-align: right; white-space: nowrap; width: 1%; }
.tbl .leer-zeile { padding: 28px; text-align: center; color: var(--text-3); }
.tbl .mehr { text-align: center; }
.tbl tr.inaktiv td { color: var(--text-3); }
.tbl tr.markiert td { background: #FFF6E5; }
.tbl input[type=checkbox] { width: 15px; height: 15px; }

/* ---------- Reiter ---------- */
.tabs { display: flex; gap: 2px; margin-bottom: 18px; overflow-x: auto; border-bottom: 1px solid var(--rand); scrollbar-width: none; }
.tabs button { margin-bottom: -1px; padding: 10px 14px 9px; border: 0; border-bottom: 2px solid transparent; border-radius: 8px 8px 0 0; background: none; color: var(--muted); font-size: 13px; font-weight: 650; white-space: nowrap; cursor: pointer; transition: color .18s, background-color .18s; }
.tabs button:hover { color: var(--text); background: rgba(238, 242, 247, .8); }
.tabs button.aktiv { color: var(--brand); border-bottom-color: var(--brand); }
.tabs button:focus-visible { outline-offset: -2px; }

/* ---------- Formulare ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.feld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.feld > span { color: var(--muted); font-size: 12px; font-weight: 650; }
.feld small { color: var(--text-3); font-size: 11.5px; line-height: 1.4; }
.feld input, .feld select, .feld textarea, .eingabe {
  width: 100%; padding: 8px 11px; border: 1px solid var(--rand-feld); border-radius: 10px;
  background-color: var(--card); color: var(--text); transition: border-color .15s, box-shadow .15s;
}
.feld select:not([multiple]), select.eingabe:not([multiple]) {
  appearance: none; -webkit-appearance: none; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2344566E' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 10px 6px;
}
.feld input::placeholder, .feld textarea::placeholder, .eingabe::placeholder { color: var(--text-3); }
.feld input:focus, .feld select:focus, .feld textarea:focus, .eingabe:focus { outline: none; border-color: var(--brand-2); box-shadow: var(--fokus-ring); }
.feld input[readonly], .feld textarea[readonly] { background-color: var(--ice); }
/* gesperrt = „nur lesen“ (felder() sperrt Auswahllisten mit readonly): Wert muss lesbar bleiben, Chrome dimmt sonst mit opacity .7 */
.feld input:disabled, .feld select:disabled, .feld textarea:disabled, .eingabe:disabled { opacity: 1; background-color: var(--ice); color: var(--muted); border-color: #A9B6C7; cursor: default; }
.feld input[type=file] { padding: 6px 8px; }
.feld-check { flex-direction: row; align-items: center; gap: 9px; }
.feld-check input { width: 16px; height: 16px; }
.feld-check span { color: var(--text); font-size: 13px; font-weight: 500; }
.span2 { grid-column: span 2; }
.pflicht { color: var(--rot); }
.form-section { padding: 14px 0 6px; border-bottom: 1px solid var(--rand); font-family: var(--font-mono); font-size: 10px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: var(--brand-2); }
.form-info { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.inline-form .feld { min-width: 140px; }

/* ---------- Dialog ---------- */
.modal-hinter { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; background: rgba(7, 16, 31, .55); backdrop-filter: blur(3px); animation: hinter-ein .18s ease-out; }
.modal { display: flex; flex-direction: column; max-width: 96vw; max-height: 88vh; background: var(--card); color: var(--text); border-radius: var(--radius); box-shadow: var(--shadow), 0 0 0 1px rgba(15, 26, 43, .08); animation: dialog-ein .22s cubic-bezier(.2, .7, .2, 1); }
.modal-kopf { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 16px 13px 22px; border-bottom: 1px solid var(--rand-2); }
.modal-kopf h3 { margin: 0; font-family: var(--font-head); font-size: 25px; font-weight: 400; line-height: 1.1; color: var(--text); }
.modal-kopf .x { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; }
.modal-kopf .x:hover { background: var(--ice); color: var(--text); }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-fuss { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--rand-2); background: var(--paper); border-radius: 0 0 var(--radius) var(--radius); }
@keyframes dialog-ein { from { opacity: 0; transform: translateY(10px) scale(.985); } }
@keyframes hinter-ein { from { opacity: 0; } }

/* ---------- Meldungen unten rechts ---------- */
#toasts { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: baseline; gap: 10px; max-width: 420px; padding: 11px 16px 11px 14px;
  background: var(--night); color: var(--on-dark); border: 1px solid var(--line); border-left: 3px solid var(--amber); border-radius: 12px;
  box-shadow: var(--shadow); font-weight: 550; line-height: 1.45; transition: opacity .4s, transform .4s;
}
.toast::before { flex: none; font-weight: 800; }
.toast-ok { border-left-color: #43C383; } .toast-ok::before { content: '✓'; color: #7FDDAE; }
.toast-fehler { border-left-color: #F0796D; } .toast-fehler::before { content: '!'; color: #FFA59C; }
.toast-info { border-left-color: var(--amber); } .toast-info::before { content: 'i'; color: var(--amber-soft); font-family: var(--font-head); font-style: italic; font-weight: 400; }
.toast.weg { opacity: 0; transform: translateY(8px); }

/* ---------- Detailansichten ---------- */
.dl { display: grid; grid-template-columns: 170px 1fr; gap: 7px 16px; margin: 0; }
.dl dt { color: var(--muted); font-weight: 550; }
.dl dd { margin: 0; overflow-wrap: anywhere; min-width: 0; color: var(--text); }
.kanban { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 14px; align-items: start; }
.kanban-spalte { min-height: 200px; padding: 10px; background: var(--ice); color: var(--text); border: 1px solid var(--rand-2); border-radius: 12px; }
.kanban-spalte h3 { display: flex; justify-content: space-between; align-items: center; margin: 2px 4px 10px; font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.kanban-karte { margin-bottom: 8px; padding: 10px 12px; background: var(--card); color: var(--text); border: 1px solid var(--rand-2); border-left: 3px solid var(--rand); border-radius: 10px; box-shadow: var(--schatten-karte); cursor: pointer; }
.kanban-karte.Hoch { border-left-color: var(--orange); } .kanban-karte.Dringend { border-left-color: var(--rot); }
.kanban-karte .t { margin-bottom: 4px; font-weight: 650; }
.kanban-karte .m { color: var(--muted); font-size: 11.5px; }
.kanban-spalte.drop { outline: 2px dashed var(--brand-2); outline-offset: -2px; }
.balken { height: 8px; overflow: hidden; background: var(--ice); border-radius: 99px; }
.balken > div { height: 100%; background: var(--brand-2); border-radius: 99px; }
.dropzone { padding: 28px; text-align: center; color: var(--muted); background: var(--paper); border: 1.5px dashed #A9B6C7; border-radius: 12px; cursor: pointer; transition: border-color .18s, background-color .18s, color .18s; }
.dropzone:hover, .dropzone.drueber { border-color: var(--brand-2); background: #EDF2F9; color: var(--brand); }
.editor { min-height: 260px; padding: 14px 16px; overflow-y: auto; background: var(--card); color: var(--text); border: 1px solid var(--rand-feld); border-radius: 10px; line-height: 1.55; }
.editor:focus { outline: none; border-color: var(--brand-2); box-shadow: var(--fokus-ring); }
.werkzeugleiste { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.werkzeugleiste button { min-width: 30px; padding: 4px 9px; background: var(--card); color: var(--text); border: 1px solid var(--rand-knopf); border-radius: 8px; cursor: pointer; }
.werkzeugleiste button:hover { border-color: var(--brand-2); color: var(--brand); background: var(--paper); }
.platzhalter-liste { display: flex; flex-wrap: wrap; gap: 5px; }
.platzhalter-liste code { padding: 2px 7px; background: var(--ice); color: var(--brand-2); border: 1px solid var(--rand-2); border-radius: 6px; font-family: var(--font-mono); font-size: 11.5px; cursor: pointer; }
.platzhalter-liste code:hover { background: var(--blau-hell); border-color: #C6D4E6; }

/* ---------- Schmale Bildschirme ---------- */
@media (max-width: 900px) {
  #seitenleiste { position: fixed; top: 0; bottom: 0; left: 0; z-index: 90; width: min(300px, 86vw); visibility: hidden; transform: translateX(-102%); transition: transform .25s ease, visibility .25s; box-shadow: var(--shadow); }
  body.nav-offen #seitenleiste { visibility: visible; transform: none; }
  #schleier { display: block; position: fixed; inset: 0; z-index: 85; background: rgba(7, 16, 31, .5); opacity: 0; pointer-events: none; transition: opacity .25s; }
  body.nav-offen #schleier { opacity: 1; pointer-events: auto; }
  #menue-knopf { display: inline-flex; }
  #kopfzeile { gap: 12px; padding: 0 14px; }
  #brotkrumen { flex: 1; }
  #schnellsuche { width: 200px; }
  #suchergebnisse { width: min(440px, calc(100vw - 28px)); }
  #inhalt { padding: 20px 16px 64px; }
  .page-header h1 { font-size: 29px; }
  .form-grid { grid-template-columns: 1fr; } .span2 { grid-column: auto; }
  .raster-2, .raster-3, .raster-4 { grid-template-columns: 1fr; }
  .kanban { overflow-x: auto; }
  .dl { grid-template-columns: 128px 1fr; }
  .tbl-suche { width: auto; min-width: 0; flex: 1 1 140px; }
}
@media (max-width: 640px) {
  #brotkrumen { display: none; }
  .kopf-rechts { flex: 1; }
  #schnellsuche { width: 100%; }
  .modal-hinter { padding: 0; }
  .modal { width: 100% !important; max-width: 100vw; max-height: 100vh; min-height: 100vh; border-radius: 0; }
  .modal-fuss { border-radius: 0; flex-wrap: wrap; }
  #toasts { left: 12px; right: 12px; bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after { animation: none !important; transition: none !important; }
}
@media print {
  body { display: block; overflow: visible; background: #fff; }
  #seitenleiste, #kopfzeile, #schleier, #toasts { display: none !important; }
  #haupt, #inhalt { display: block; overflow: visible; padding: 0; background: #fff; }
  .card, .kpi { box-shadow: none; }
}
