/* DepotDESK
 *
 * Diagrammfarben: Kategorienpalette, je Modus eigens gestuft und mit dem Palettenvalidator
 * geprueft (dunkel auf #1a2235, hell auf #ffffff - beide bestanden; im Hellmodus liegen drei
 * Farben unter 3:1, deshalb tragen alle Diagramme Beschriftung und eine Tabelle daneben).
 * Statusfarben sind reserviert und erscheinen nie ohne Symbol und Wort.
 */

:root {
  --dp-s1: #3987e5;
  --dp-s2: #d95926;
  --dp-s3: #199e70;
  --dp-s4: #c98500;
  --dp-s5: #d55181;
  --dp-s6: #008300;
  --dp-s7: #9085e9;
  --dp-s8: #e66767;
  --dp-gut: #0ca30c;
  --dp-warnung: #fab219;
  --dp-kritisch: #d03b3b;
  --dp-plus: #2fbf4a;
  --dp-minus: #f87171;
  --dp-neutral: color-mix(in srgb, var(--text-muted) 70%, var(--bg-2));
  --dp-neutral-2: color-mix(in srgb, var(--text-muted) 38%, var(--bg-2));
  --dp-gitter: rgba(176, 207, 229, 0.08);
  --dp-achse: rgba(176, 207, 229, 0.22);
  --dp-flaeche: color-mix(in srgb, var(--accent) 16%, transparent);
}

[data-theme="light"] {
  --dp-s1: #2a78d6;
  --dp-s2: #eb6834;
  --dp-s3: #1baf7a;
  --dp-s4: #eda100;
  --dp-s5: #e87ba4;
  --dp-s6: #008300;
  --dp-s7: #4a3aa7;
  --dp-s8: #e34948;
  --dp-plus: #006300;
  --dp-minus: #b91c1c;
  --dp-gitter: rgba(14, 60, 120, 0.08);
  --dp-achse: rgba(14, 60, 120, 0.22);
  --dp-flaeche: color-mix(in srgb, var(--accent) 12%, transparent);
}

/* --- Rahmen ------------------------------------------------------------------ */

/* `.btn` setzt display und schlaegt damit das hidden-Attribut - versteckt heisst versteckt */
.dp [hidden] {
  display: none !important;
}

.dp {
  gap: 20px;
}

/* Rasterspalten duerfen schmaler werden als ihr Inhalt - breite Tabellen scrollen in sich,
   nicht die ganze Seite */
.dp,
.dp .stack {
  grid-template-columns: minmax(0, 1fr);
}

.dp .stack > *,
.dp > * {
  min-width: 0;
}

.dp .page-head {
  margin-bottom: 4px;
}

.dp-kopf .button-row {
  flex-wrap: wrap;
}

.dp-reiter {
  display: flex;
  gap: 4px;
  padding: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg-2) 80%, transparent);
  width: fit-content;
  max-width: 100%;
}

.dp-reiter::-webkit-scrollbar {
  display: none;
}

.dp-reiter a {
  flex: none;
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  transition: background 0.2s ease, color 0.2s ease;
}

.dp-reiter a:hover {
  color: var(--text);
}

.dp-reiter a.is-active {
  background: var(--button-secondary-bg-hover);
  color: var(--text);
}

.dp .card {
  padding: 24px;
}

.dp-karte h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.dp-karte .muted {
  margin-top: 4px;
  font-size: 13px;
}

.dp-karte-kopf {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.dp-unterkopf {
  margin: 20px 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}

.dp-zwei {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.dp-zwei--gleich {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* --- Beträge verbergen ------------------------------------------------------- */

.dp-verborgen .betrag,
.dp-verborgen .betrag-svg {
  filter: blur(7px);
  user-select: none;
}

/* --- Hinweise und Meldungen -------------------------------------------------- */

.dp-hinweise {
  border: 1px solid color-mix(in srgb, var(--warning) 45%, transparent);
  background: var(--warning-bg);
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 13.5px;
}

.dp-hinweise ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
}

.dp-hinweise span {
  color: var(--warning);
}

.dp-warnhinweis {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--warning);
}

.dp-warntext {
  color: var(--warning);
}

.dp-meldung {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  max-width: min(420px, calc(100% - 40px));
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  box-shadow: var(--shadow);
  font-size: 14px;
  border-left: 4px solid var(--dp-gut);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.dp-meldung--warnung {
  border-left-color: var(--dp-warnung);
}

.dp-meldung--fehler {
  border-left-color: var(--dp-kritisch);
}

.dp-meldung--weg {
  opacity: 0;
  transform: translateY(8px);
}

/* --- Gesamtvermögen und Kennzahlen ------------------------------------------- */

.dp-held {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 32px;
  align-items: center;
  background:
    radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 55%),
    var(--bg-2);
}

.dp-held-wert {
  font-size: clamp(36px, 5.2vw, 56px);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.05;
  margin: 6px 0;
}

.dp-teile {
  display: flex;
  gap: 2px;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
}

.dp-teil {
  min-width: 4px;
  flex-basis: 0;
}

.dp-teil--depot {
  background: var(--accent);
}

.dp-teil--tagesgeld {
  background: var(--dp-neutral);
}

.dp-teil--trading {
  background: var(--dp-neutral-2);
}

.dp-teil-legende {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.dp-teil-legende li {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto 48px;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.dp-teil-marke {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.dp-teil-wert {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.dp-teil-anteil {
  color: var(--text-muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.dp-kacheln {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}

.dp-kachel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.dp-karte .dp-kachel {
  background: color-mix(in srgb, var(--bg-3) 55%, var(--bg-2));
  box-shadow: none;
}

.dp-kachel-titel {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}

.dp-kachel-wert {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-top: 6px;
  white-space: nowrap;
}

.dp-kachel-unter {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.dp-paar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.dp-plus {
  color: var(--dp-plus);
}

.dp-minus {
  color: var(--dp-minus);
}

/* --- Diagramme --------------------------------------------------------------- */

.dp-diagramm {
  width: 100%;
  min-height: 120px;
}

.dp-diagramm svg {
  display: block;
  overflow: visible;
  touch-action: pan-y;
}

.dp-schalter {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--input-bg);
}

.dp-schalter button {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 500;
}

.dp-schalter button.is-active {
  background: var(--bg-2);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.dp-legende {
  list-style: none;
  display: flex;
  gap: 18px;
  margin: 0 0 8px;
  padding: 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.dp-legende li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.dp-linie {
  display: inline-block;
  width: 16px;
  height: 2px;
  border-radius: 1px;
}

.dp-linie--wert {
  background: var(--accent);
}

.dp-linie--eingezahlt {
  background: var(--text-muted);
}

.dp-marke {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.dp-marke--netto {
  background: var(--accent);
}

.dp-marke--steuer {
  background: var(--dp-neutral-2);
}

.dp-gitter {
  stroke: var(--dp-gitter);
  stroke-width: 1;
}

.dp-gitter.dp-achse {
  stroke: var(--dp-achse);
}

.dp-achsentext {
  fill: var(--text-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.dp-wertmarke {
  fill: var(--text);
  font-size: 11.5px;
  font-weight: 600;
}

.dp-pfad {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.dp-pfad--wert {
  stroke: var(--accent);
}

.dp-pfad--eingezahlt {
  stroke: var(--text-muted);
}

.dp-flaeche {
  fill: var(--dp-flaeche);
}

.dp-endpunkt,
.dp-fadenkreuz-wert {
  fill: var(--accent);
  stroke: var(--bg-2);
  stroke-width: 2;
}

.dp-fadenkreuz-eingezahlt {
  fill: var(--text-muted);
  stroke: var(--bg-2);
  stroke-width: 2;
}

.dp-fadenkreuz-linie {
  stroke: var(--text-muted);
  stroke-width: 1;
}

.dp-balken-netto {
  fill: var(--accent);
}

.dp-balken-steuer {
  fill: var(--dp-neutral-2);
}

.dp-balken:hover .dp-balken-netto,
.dp-balken:hover .dp-balken-steuer {
  filter: brightness(1.15);
}

.dp-tooltip {
  position: fixed;
  z-index: 130;
  pointer-events: none;
  min-width: 170px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  box-shadow: var(--shadow);
  font-size: 13px;
}

.dp-tt-kopf {
  font-weight: 600;
  margin-bottom: 6px;
}

.dp-tt-zeile {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  padding: 1px 0;
}

.dp-tt-zeile b {
  margin-left: auto;
  padding-left: 12px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.dp-tt-summe {
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 5px;
}

/* --- Ist gegen Ziel ---------------------------------------------------------- */

.dp-empfehlung {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  font-size: 13.5px;
}

.dp-empfehlung span {
  color: var(--accent);
  font-weight: 700;
}

.dp-ziel-liste {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.dp-ziel-zeile {
  display: grid;
  grid-template-columns: minmax(120px, 190px) minmax(80px, 1fr) 78px 112px;
  align-items: center;
  gap: 14px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}

.dp-ziel-zeile:last-child {
  border-bottom: 0;
}

.dp-ziel-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  min-width: 0;
}

.dp-ziel-name span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dp-spur {
  position: relative;
  height: 22px;
}

.dp-spur::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 10px;
  height: 2px;
  border-radius: 1px;
  background: var(--dp-gitter);
}

.dp-korridor {
  position: absolute;
  top: 3px;
  bottom: 3px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--text-muted) 20%, transparent);
}

.dp-ist {
  position: absolute;
  left: 0;
  top: 7px;
  height: 8px;
  border-radius: 0 4px 4px 0;
  min-width: 2px;
}

.dp-zielmarke {
  position: absolute;
  top: 1px;
  bottom: 1px;
  width: 2px;
  margin-left: -1px;
  border-radius: 1px;
  background: var(--text);
}

.dp-ziel-zahlen {
  display: grid;
  text-align: right;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

.dp-ziel-zahlen .muted {
  margin: 0;
  font-size: 11.5px;
}

.dp-status {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
  border: 1px solid var(--border);
}

.dp-status span {
  font-weight: 700;
}

.dp-status--gut span {
  color: var(--dp-gut);
}

.dp-status--gut {
  border-color: color-mix(in srgb, var(--dp-gut) 35%, transparent);
}

.dp-status--warnung span {
  color: var(--dp-warnung);
}

.dp-status--warnung {
  border-color: color-mix(in srgb, var(--dp-warnung) 45%, transparent);
  background: color-mix(in srgb, var(--dp-warnung) 10%, transparent);
}

.dp-status--neutral {
  color: var(--text-muted);
}

.dp-punkt {
  display: inline-block;
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* --- Listen und Tabellen ----------------------------------------------------- */

.dp-liste {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}

.dp-liste li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}

.dp-liste li:last-child {
  border-bottom: 0;
}

.dp-liste b {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.dp-karte .dp-liste li > span:first-child {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.dp-liste--drei li {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.dp-karte .dp-liste--drei li > span:first-child {
  color: var(--text);
}

.dp-aufklapp {
  margin-top: 14px;
}

.dp-aufklapp summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  padding: 4px 0;
}

.dp-aufklapp[open] summary {
  margin-bottom: 8px;
}

.dp-ellipse {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dp-veraltet {
  color: var(--warning);
}

.dp-zahl {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dp th,
.dp td {
  padding: 11px 14px;
  font-size: 13.5px;
  vertical-align: middle;
}

.dp tfoot td {
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-3) 45%, transparent);
}

.dp-zelle-name {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-width: 200px;
}

.dp-zelle-name .dp-punkt {
  margin-top: 5px;
}

.dp-zelle-name .muted {
  display: block;
  margin: 2px 0 0;
  font-size: 12px;
}

.dp-mini {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  vertical-align: middle;
}

.dp-aktionen {
  white-space: nowrap;
  text-align: right;
}

.dp-aktionen .btn + .btn {
  margin-left: 6px;
}

/* --- Pflege ------------------------------------------------------------------ */

.dp-eingabetabelle input[data-feld] {
  min-width: 96px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  padding: 8px 10px;
}

.dp-netto {
  margin: 0;
  color: var(--text-muted);
}

.dp-netto b {
  color: var(--text);
}

.dp-filter {
  min-width: 220px;
}

.dp-konto {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: grid;
  gap: 14px;
}

.dp-konto-kopf {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.dp-konto-kopf h3 {
  margin: 0;
  font-size: 16px;
}

.dp-konto-kopf .muted {
  margin: 0;
}

.dp small.muted {
  font-size: 11.5px;
  margin: 0;
}

/* --- schmal ------------------------------------------------------------------ */

@media (max-width: 900px) {
  .dp-zwei,
  .dp-zwei--gleich,
  .dp-held {
    grid-template-columns: minmax(0, 1fr);
  }

  .dp-held {
    gap: 20px;
  }
}

@media (max-width: 640px) {
  .dp .card {
    padding: 18px 16px;
  }

  .dp-kacheln {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .dp-kachel {
    padding: 13px 14px;
  }

  .dp-kachel-wert {
    font-size: 19px;
  }

  .dp-paar {
    grid-template-columns: minmax(0, 1fr);
  }

  .dp-ziel-zeile {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "name zahlen"
      "spur spur"
      "status status";
    gap: 6px 12px;
  }

  .dp-ziel-name {
    grid-area: name;
  }

  .dp-spur {
    grid-area: spur;
  }

  .dp-ziel-zahlen {
    grid-area: zahlen;
  }

  .dp-status {
    grid-area: status;
  }

  .dp .page-head {
    flex-direction: column;
  }

  .dp-teil-legende li {
    grid-template-columns: 12px minmax(0, 1fr) auto 40px;
  }

  .field-grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }
}

.dp-karte > .dp-aufklapp:first-child {
  margin-top: 0;
}

/* --- Dividenden je Wertpapier ------------------------------------------------ */

.dp-div-liste {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}

.dp-div-zeile {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(60px, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.dp-div-zeile:last-child {
  border-bottom: 0;
}

.dp-div-name {
  display: grid;
  min-width: 0;
  font-size: 13.5px;
}

.dp-div-name .muted {
  margin: 1px 0 0;
  font-size: 11.5px;
}

.dp-div-spur {
  display: flex;
  gap: 2px;
  height: 10px;
}

.dp-div-netto {
  background: var(--accent);
  border-radius: 0;
  min-width: 2px;
}

.dp-div-steuer {
  background: var(--dp-neutral-2);
  border-radius: 0 4px 4px 0;
}

.dp-div-wert {
  display: grid;
  text-align: right;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

.dp-div-wert .muted {
  margin: 0;
  font-size: 11.5px;
}

/* --- Verrechnungskonto ------------------------------------------------------- */

.dp-verrechnung {
  display: grid;
  gap: 12px;
  padding-bottom: 6px;
}

.dp-verrechnung-kopf {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 14px;
}

.dp-verrechnung-kopf .muted {
  margin: 0;
  font-size: 12.5px;
}

.dp-diagramm--klein {
  min-height: 110px;
}

.dp-luecke {
  stroke: var(--dp-achse);
  stroke-width: 2;
  stroke-dasharray: 2 3;
}

.dp-jahre {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 18px 0 12px;
  font-size: 13.5px;
  color: var(--text-muted);
}

.dp-jahre b {
  color: var(--text);
  margin-right: 4px;
}

.dp-karte h2 .dp-mini {
  font-weight: 500;
  letter-spacing: 0;
}

/* --- Kontoauszug -------------------------------------------------------------- */

.dp-st {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

p.dp-st {
  margin: 12px 0 0;
}

.dp-st-neu {
  color: var(--success);
}

.dp-st-pruefen {
  color: var(--warning);
}

.dp-st-fehler {
  color: var(--danger);
}

.dp-st-still {
  color: var(--text-muted);
  font-weight: 500;
}

.dp-auszug-still td {
  color: var(--text-muted);
}

.dp-auszug-hinweis {
  font-size: 12px;
}

.dp-auszug-tabelle input[data-feld] {
  min-width: 72px;
  width: 84px;
}

.dp-auszug-neu {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dp-auszug-neu input {
  min-width: 200px;
}

.dp-auszug-schalter {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.dp-auszug-rest {
  margin: 12px 0;
  font-size: 13px;
  color: var(--text-muted);
}

.dp-auszug-rest summary {
  cursor: pointer;
}

/* --- Gehalt ------------------------------------------------------------------- */

.dp-gehalt-ergebnis {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 20px;
}

.dp-gehalt-ergebnis .field {
  min-width: 0;
}

.dp-gehalt-ergebnis input {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  max-width: 220px;
}

.dp-gehalt-ergebnis p {
  margin: 0 0 10px;
  font-size: 13px;
}

.dp-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
