/**
 * Dark Mode: bessere Lesbarkeit von Text, Labels und Formularfeldern
 * auf dunklem Hintergrund (Settings, Cards, Hilfetexte).
 */

[data-pc-theme="dark"] {
  --bs-body-color: #d4dce6;
  --bs-secondary-color: #a8b8c8;
  --bs-heading-color: #f3f6f9;
}

[data-pc-theme="dark"] .text-muted,
[data-pc-theme="dark"] .form-text,
[data-pc-theme="dark"] small.text-muted,
[data-pc-theme="dark"] .small.text-muted {
  color: #a8b8c8 !important;
}

[data-pc-theme="dark"] .form-label,
[data-pc-theme="dark"] .form-label strong,
[data-pc-theme="dark"] .col-form-label,
[data-pc-theme="dark"] .form-check-label {
  color: #e8eef5 !important;
}

[data-pc-theme="dark"] .form-control,
[data-pc-theme="dark"] .form-select,
[data-pc-theme="dark"] .datatable-input,
[data-pc-theme="dark"] .custom-select {
  color: #e8eef5 !important;
  background-color: #263240;
}

[data-pc-theme="dark"] .form-control::placeholder,
[data-pc-theme="dark"] .form-select::placeholder,
[data-pc-theme="dark"] .datatable-input::placeholder,
[data-pc-theme="dark"] .custom-select::placeholder {
  color: #8fa0b0 !important;
  opacity: 1;
}

[data-pc-theme="dark"] .form-control:disabled,
[data-pc-theme="dark"] .form-control[readonly],
[data-pc-theme="dark"] .form-select:disabled {
  color: #b8c4d0 !important;
  opacity: 0.85;
}

[data-pc-theme="dark"] code,
[data-pc-theme="dark"] .card code,
[data-pc-theme="dark"] p code {
  color: #c5d4e8;
  background-color: rgba(255, 255, 255, 0.08);
}

[data-pc-theme="dark"] .card .card-body,
[data-pc-theme="dark"] .card .card-text {
  color: #d4dce6;
}

[data-pc-theme="dark"] .nav-pills .nav-link:not(.active) {
  color: #c5d0dc;
}

[data-pc-theme="dark"] .breadcrumb .breadcrumb-item,
[data-pc-theme="dark"] .breadcrumb .breadcrumb-item a {
  color: #a8b8c8;
}

[data-pc-theme="dark"] .breadcrumb .breadcrumb-item.active {
  color: #e8eef5;
}

/*
 * Badges / Tags / Chips im Dark Mode
 * ----------------------------------
 * .card .bg-light wird im Theme absichtlich abgedunkelt (rgba-schwarz).
 * Früher erzwangen wir dort dunkle Schrift → unlesbar (z. B. Kategorie „Sonstiges“).
 * Soft-Badges bekommen daher hellen Text + leicht aufgehellten Hintergrund.
 * Warning/Info behalten dunkle Schrift nur auf ihrem hellen Farbton.
 */

/* Soft / Neutral-Tags (bg-light, text-bg-light, bordered pills) */
[data-pc-theme="dark"] .badge.bg-light,
[data-pc-theme="dark"] .badge.bg-light.text-dark,
[data-pc-theme="dark"] .badge.text-bg-light,
[data-pc-theme="dark"] .card .badge.bg-light,
[data-pc-theme="dark"] .card .badge.bg-light.text-dark,
[data-pc-theme="dark"] span.badge.rounded-pill.bg-light {
  background-color: rgba(255, 255, 255, 0.14) !important;
  color: #e8eef5 !important;
  border-color: rgba(255, 255, 255, 0.22) !important;
}

/* bg-light-dark: Theme setzt sonst #131920 auf dunklem Tint → unlesbar */
[data-pc-theme="dark"] .badge.bg-light-dark {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #e8eef5 !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

/* Secondary soft badges: etwas hellere Schrift auf dunklem Tint */
[data-pc-theme="dark"] .badge.bg-light-secondary {
  color: #c5d0dc !important;
}

[data-pc-theme="dark"] .badge.bg-secondary.bg-opacity-25,
[data-pc-theme="dark"] .badge.bg-secondary.bg-opacity-75 {
  color: #e8eef5 !important;
}

/* Warning: dunkle Schrift nur auf gelbem Badge-Hintergrund */
[data-pc-theme="dark"] .badge.bg-warning,
[data-pc-theme="dark"] .badge.bg-warning.text-dark,
[data-pc-theme="dark"] .badge.text-bg-warning {
  color: #1a1408 !important;
}

/* Info: dunkle Schrift nur wenn Hintergrund hell-cyan bleibt */
[data-pc-theme="dark"] .badge.bg-info:not(.bg-opacity-25):not(.bg-opacity-15),
[data-pc-theme="dark"] .badge.bg-info.text-dark,
[data-pc-theme="dark"] .badge.text-bg-info {
  color: #04161c !important;
}

/* Generische Chip-/Tag-Klassen (Modul-CSS), falls Text-dark erzwungen wurde */
[data-pc-theme="dark"] .todo-tag.text-dark,
[data-pc-theme="dark"] .st-chip.text-dark,
[data-pc-theme="dark"] .ls-chip.text-dark {
  color: #e8eef5 !important;
}

.hs-life-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.hs-life-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}
.hs-life-step {
  text-align: center;
  padding: 0.65rem 0.4rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  min-width: 0;
}
.hs-life-step.is-done {
  background: rgba(25, 135, 84, 0.18);
}
.hs-life-step.is-now {
  background: rgba(13, 202, 240, 0.16);
}
.hs-life-step .hs-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  margin: 0 auto 0.35rem;
  background: #6c757d;
}
.hs-life-step.is-done .hs-dot { background: #22c55e; }
.hs-life-step.is-now .hs-dot { background: #38bdf8; }
.hs-chip-row .btn.active {
  pointer-events: none;
}
@media (max-width: 767.98px) {
  .hs-life-steps {
    grid-template-columns: repeat(2, 1fr);
  }
}
.hs-kpi {
  border-radius: 0.85rem;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.06);
  padding: 0.9rem 1rem;
  height: 100%;
}
[data-pc-theme="dark"] .hs-kpi {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.06);
}
.hs-live-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.35rem;
  background: #6c757d;
}
.hs-live-dot.is-on { background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2); }
.hs-live-dot.is-off { background: #94a3b8; }
.hs-live-dot.is-warn { background: #f59e0b; }
.hs-usage {
  height: 0.4rem;
  border-radius: 99px;
  background: rgba(15, 23, 42, 0.08);
  overflow: hidden;
}
[data-pc-theme="dark"] .hs-usage {
  background: rgba(255, 255, 255, 0.08);
}
.hs-usage > span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: #38bdf8;
}
.hs-usage > span.is-warn { background: #f59e0b; }
.hs-usage > span.is-hot { background: #ef4444; }
.hs-copy { cursor: pointer; }
.hs-note { min-height: 5.5rem; }
.hs-nav-pills .nav-link {
  color: inherit;
  background: transparent;
  border: 1px solid transparent;
}
.hs-nav-pills .nav-link.active {
  background: var(--bs-primary);
  color: #fff;
}

/* Finanz-Endergebnis (Gewinn / Verlust) – nur die Ergebniszeile/Kachel */
.finance-result-row > th,
.finance-result-row > td {
  vertical-align: middle;
  padding-top: 0.85rem !important;
  padding-bottom: 0.85rem !important;
  border-top: 2px solid rgba(15, 23, 42, 0.18) !important;
  background: #f1f5f9 !important;
  color: #0f172a !important;
}
.finance-result-amount {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a !important;
}
.finance-result-card {
  border: 1px solid rgba(15, 23, 42, 0.12) !important;
  background: #f8fafc;
}
.finance-result-card .finance-result-label {
  color: #475569;
}
.finance-result-card .finance-result-amount {
  color: #0f172a !important;
}
.finance-result-card.is-profit {
  border-color: rgba(22, 163, 74, 0.35) !important;
  background: #f0fdf4;
}
.finance-result-card.is-loss {
  border-color: rgba(220, 38, 38, 0.3) !important;
  background: #fef2f2;
}
.finance-result-row.is-profit > th,
.finance-result-row.is-profit > td {
  background: #ecfdf5 !important;
  border-top-color: rgba(22, 163, 74, 0.35) !important;
}
.finance-result-row.is-loss > th,
.finance-result-row.is-loss > td {
  background: #fef2f2 !important;
  border-top-color: rgba(220, 38, 38, 0.3) !important;
}

[data-pc-theme="dark"] .finance-result-row > th,
[data-pc-theme="dark"] .finance-result-row > td {
  background: rgba(255, 255, 255, 0.08) !important;
  border-top: 2px solid rgba(255, 255, 255, 0.22) !important;
  color: #f8fafc !important;
}
[data-pc-theme="dark"] .finance-result-row .finance-result-amount,
[data-pc-theme="dark"] .finance-result-card .finance-result-amount {
  color: #ffffff !important;
}
[data-pc-theme="dark"] .finance-result-card {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.22) !important;
}
[data-pc-theme="dark"] .finance-result-card .finance-result-label {
  color: #e2e8f0;
}
[data-pc-theme="dark"] .finance-result-card.is-profit,
[data-pc-theme="dark"] .finance-result-row.is-profit > th,
[data-pc-theme="dark"] .finance-result-row.is-profit > td {
  background: rgba(34, 197, 94, 0.14) !important;
  border-color: rgba(74, 222, 128, 0.45) !important;
}
[data-pc-theme="dark"] .finance-result-card.is-loss,
[data-pc-theme="dark"] .finance-result-row.is-loss > th,
[data-pc-theme="dark"] .finance-result-row.is-loss > td {
  background: rgba(248, 113, 113, 0.14) !important;
  border-color: rgba(252, 165, 165, 0.45) !important;
}
[data-pc-theme="dark"] .finance-result-row.is-profit > th,
[data-pc-theme="dark"] .finance-result-row.is-profit > td,
[data-pc-theme="dark"] .finance-result-row.is-loss > th,
[data-pc-theme="dark"] .finance-result-row.is-loss > td {
  border-top-color: inherit !important;
}
