/* Haushaltsplanung — Dark-UI-Fundament (M0, Stil-Muster Immo-WebApp/Atlas)
   Konventionen (Axel): Buttons nie disabled; Hover NUR Rahmen (grün);
   Press nach unten; primary dunkel (--bg3) + weiße Schrift. */
:root {
  --bg1: #14161a;
  --bg2: #1d2026;
  --bg3: #262a32;
  --rand: #343a45;
  --text: #e8e6e0;
  --text-2: #9aa3b2;
  --accent-1: #b85c38;   /* Terra-Kotta (Marke) */
  --accent-2: #6fbf73;   /* grün — Hover-Rahmen */
  --positiv: #6fbf73;
  --negativ: #e06c5a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg1);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Kopf */
.kopf {
  background: var(--bg2);
  border-bottom: 1px solid var(--rand);
}
.kopf-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.8rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.marke { font-weight: 700; font-size: 1.1em; }
.nav a {
  color: var(--text-2);
  text-decoration: none;
  margin-right: 1rem;
  padding: 0.25rem 0.4rem;
  border: 1px solid transparent;
  border-radius: 6px;
}
.nav a:hover { color: var(--text); border-color: var(--accent-2); }

/* Inhalt */
.inhalt {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.2rem 4rem;
  width: 100%;
  flex: 1;
}

/* Karten */
.karte {
  background: var(--bg2);
  border: 1px solid var(--rand);
  border-radius: 10px;
  padding: 1.2rem 1.4rem;
  margin-bottom: 1.2rem;
}

/* Buttons (Konvention: nie disabled, Hover nur Rahmen, Press nach unten) */
.btn-klein {
  display: inline-block;
  background: var(--bg3);
  color: #fff;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.45rem 0.9rem;
  font-size: 0.95em;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.4;
}
.btn-klein:hover { border-color: var(--accent-2); }
.btn-klein:active { transform: translateY(1px); }

/* Hinweise */
.hinweis { margin: 0.25rem 0; }
.hinweis-muted { color: var(--text-2); margin: 0.25rem 0; }
.fehler {
  color: var(--negativ);
  background: rgba(224, 108, 90, 0.08);
  border: 1px solid rgba(224, 108, 90, 0.35);
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
}
.erfolg {
  color: var(--positiv);
  background: rgba(111, 191, 115, 0.08);
  border: 1px solid rgba(111, 191, 115, 0.35);
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
}
.positiv { color: var(--positiv); }

/* Formulare */
.formular { display: flex; flex-direction: column; gap: 0.9rem; max-width: 420px; }
.formular label { display: flex; flex-direction: column; gap: 0.25rem; font-weight: 600; }
.formular input {
  background: var(--bg1);
  color: var(--text);
  border: 1px solid var(--rand);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  font-size: 1em;
}
.formular input:focus { outline: none; border-color: var(--accent-2); }
.formular .btn-klein { align-self: flex-start; margin-top: 0.3rem; font-weight: 600; }

/* Karte mittig (Auth-Seiten) */
.karte-mitte { max-width: 480px; margin: 3rem auto; }

/* Text-Button (Nav-Abmelden) — Hover nur Rahmen, Press nach unten */
.btn-link {
  background: transparent;
  color: var(--text-2);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  font-size: 0.95em;
  cursor: pointer;
  text-decoration: none;
}
.btn-link:hover { color: var(--text); border-color: var(--accent-2); }
.btn-link:active { transform: translateY(1px); }

/* Navigation im Kopf */
.nav { display: flex; align-items: center; gap: 0.25rem; }
.nav .inline { margin: 0; }

/* Liste (Übersicht) */
.liste { color: var(--text-2); padding-left: 1.2rem; line-height: 1.7; }

/* Fußzeile (fixiert, Versionsnummer) */
.fuss {
  background: var(--bg2);
  border-top: 1px solid var(--rand);
  color: var(--text-2);
  text-align: center;
  padding: 0.6rem 1rem;
  font-size: 0.9em;
}

/* ── M3: Tabellen & Finanz-UI ─────────────────────────────────────── */

.tabelle {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.95em;
}
.tabelle th, .tabelle td {
  text-align: left;
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid var(--rand);
  vertical-align: middle;
}
.tabelle th { color: var(--text-2); font-weight: 600; white-space: nowrap; }
.tabelle tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
.tabelle .rechts { text-align: right; white-space: nowrap; }

.betrag-pos { color: var(--posi); }
.betrag-neg { color: var(--negativ); }

.filter-reihe {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin: 0.5rem 0 1rem;
}
.filter-reihe label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.9em; }
.checkbox { flex-direction: row !important; align-items: center; gap: 0.4rem; }

.zwei-spalten {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
@media (max-width: 720px) { .kopf-inner, .zwei-spalten { grid-template-columns: 1fr; } }

.kategorie-liste { list-style: none; padding: 0; margin: 0.5rem 0; }
.kategorie-liste li {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0; border-bottom: 1px solid var(--rand);
}
.kategorie-punkt {
  width: 0.7rem; height: 0.7rem; border-radius: 50%; flex: none;
  display: inline-block;
}
.aktionen { white-space: nowrap; text-align: right; }
.aktionen form { display: inline-flex; gap: 6px; align-items: center; }
.aktionen select, .aktionen label { font-size: 13px; }
.inline-label { display: inline-flex; align-items: center; gap: 4px; }
.dialog { border: 1px solid var(--border-color, #3e4451); border-radius: 10px;
          background: var(--bg2, #282c34); color: var(--text, #abb2bf); padding: 16px; }
.dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
.dialog form { display: flex; flex-direction: column; gap: 10px; }
.dialog-aktionen { display: flex; gap: 8px; justify-content: flex-end; }

.modal-best { position: fixed; inset: 0; z-index: 1000;
              background: rgba(0, 0, 0, 0.55); display: flex;
              align-items: center; justify-content: center; }
.modal-fenster { background: var(--bg2, #282c34); border: 1px solid var(--border-color, #3e4451);
                 border-radius: 10px; padding: 18px; max-width: 420px; width: 90%; }
.modal-text { margin: 0 0 14px; color: var(--text, #abb2bf); }
.modal-aktionen { display: flex; gap: 8px; justify-content: flex-end; }

.btn-gefahr { color: var(--negativ); }
.btn-gefahr:hover { border-color: var(--negativ) !important; }

.formular-dreispaltig {
  display: grid; grid-template-columns: 1fr 1fr auto; gap: 0.75rem;
  align-items: end;
}
@media (max-width: 720px) { .formular-dreispaltig { grid-template-columns: 1fr; } }

/* M7: Auswertungen */
.chart { width: 100%; height: 340px; }
.chart-sankey { height: 460px; }
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 980px) { .chart-grid { grid-template-columns: 1fr; } }
.filterzeile { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filterzeile .spacer { flex: 1; }
.kacheln { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 14px 0; }
@media (max-width: 720px) { .kacheln { grid-template-columns: 1fr; } }
.kachel { background: var(--bg2, #282c34); border: 1px solid var(--border-color, #3e4451); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.kachel-wert { font-size: 22px; font-weight: 700; color: var(--text, #abb2bf); }
.kachel-label { font-size: 12px; color: #6b7280; text-transform: uppercase; letter-spacing: 0.05em; }
.kachel-einahmen .kachel-wert { color: #7ddc8f; }
.kachel-ausgaben .kachel-wert { color: #e06c75; }
.kachel-gut .kachel-wert { color: #7ddc8f; }
.kachel-schlecht .kachel-wert { color: #e06c75; }
.button { display: inline-block; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border-color, #3e4451); background: var(--bg3, #2c313a); color: var(--text, #abb2bf); text-decoration: none; font-size: 14px; cursor: pointer; }
.button:hover { border-color: var(--accent-2, #7ddc8f); }

/* M6: Badges + Vorschlags-Zeilen */
.badge-auto, .badge-vorschlag {
  display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 8px;
  margin-left: 4px; white-space: nowrap;
}
.badge-auto { background: rgba(76, 175, 80, .18); color: var(--accent-2); border: 1px solid rgba(76, 175, 80, .45); }
.badge-vorschlag { background: rgba(255, 193, 7, .12); color: #ffc107; border: 1px solid rgba(255, 193, 7, .45); }
tr.zeile-vorschlag td { background: rgba(255, 193, 7, .06); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.widerspruch { color: var(--rot, #ef5350); }
.kategorie-badge { padding: 1px 8px; border-radius: 8px; border: 1px solid var(--border, #333); }
