/* ===========================================================================
   Finanz — Designsystem
   Übernommen aus dem Claude-Design "Finanz App". Die Werte hier sind die
   einzige Quelle für Farbe, Abstand und Radius; im Markup steht kein style=".
   =========================================================================== */

/* ===========================================================================
   Schriften — liegen in css/fonts/ und kommen vom eigenen Server.
   Damit macht die App keinen einzigen Zugriff nach außen: die CSP erlaubt
   weder fonts.googleapis.com noch fonts.gstatic.com, und Google erfährt
   nicht mehr, wann ihr euer Portfolio anseht.

   Mitgeliefert sind nur die Zeichensätze latin und latin-ext (kein Kyrillisch,
   kein Vietnamesisch) – zusammen rund 100 kB. Instrument Sans ist eine
   variable Schrift: eine Datei deckt 400 bis 700 ab. IBM Plex Mono gibt es
   nur in festen Schnitten, daher je eine Datei für 400, 500 und 600.

   Beide stehen unter der SIL Open Font License 1.1.
   Aktualisieren: Dateien aus der Google-Fonts-CSS neu ziehen und hier die
   unicode-range-Angaben übernehmen.
   =========================================================================== */

@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-stretch: 100%;
  /* swap: lieber sofort in der Systemschrift lesen als auf die Datei warten. */
  font-display: swap;
  src: url(fonts/instrument-sans-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-stretch: 100%;
  font-display: swap;
  src: url(fonts/instrument-sans-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-400-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-400-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-500-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-500-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-600-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-600-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* Flächen */
  --bg: #0a0b0d;
  --surface: #13161a;
  --surface-sunken: #0d0f12;
  --surface-raised: #1b1f24;

  /* Text */
  --text: #f2f4f5;
  --text-70: rgba(242, 244, 245, 0.78);
  --text-50: rgba(242, 244, 245, 0.5);
  --text-40: rgba(242, 244, 245, 0.42);
  --text-30: rgba(242, 244, 245, 0.3);

  /* Linien */
  --line: rgba(255, 255, 255, 0.07);
  --line-soft: rgba(255, 255, 255, 0.05);
  --line-strong: rgba(255, 255, 255, 0.12);

  /* Akzente — zugleich die Positionsfarben aus constants.php */
  --accent: #6ee7a8;
  --accent-bright: #a8f3cc;
  --accent-ink: #06130d;
  --gold: #ffc46b;
  --blue: #7fb2ff;
  --violet: #c4a0ff;
  --red: #ff8e80;

  /* Zustände der Bänder: grün im Band, gelb am Rand, rot außerhalb */
  --ok: var(--accent);
  --warn: var(--gold);
  --out: var(--red);

  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
  --sans: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;

  --r-sm: 8px;
  --r-md: 11px;
  --r-lg: 16px;
  --r-xl: 18px;
  --r-2xl: 22px;

  --shell: 1240px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(120% 80% at 80% -10%, rgba(110, 231, 168, 0.07), transparent 60%),
    var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-bright); }
input, select, button, textarea { font-family: inherit; }
input::placeholder { color: var(--text-30); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: var(--r-sm); }
::-webkit-scrollbar-track { background: transparent; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

[hidden] { display: none !important; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.pos { color: var(--accent); }
.neg { color: var(--red); }
.muted { color: var(--text-40); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ============================== Kopfbereich ============================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(14px);
  background: rgba(10, 11, 13, 0.82);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 18px 24px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(150deg, var(--accent), #2fb37b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: var(--accent-ink);
  flex: none;
}
.brand-mark::after { content: "V"; }

.brand-text { display: flex; flex-direction: column; gap: 1px; }
.brand-text h1 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.brand-sub { font-size: 11px; color: var(--text-40); }

.topbar-right { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }

.networth { display: flex; flex-direction: column; gap: 2px; }
.networth-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-40);
}
.networth-row { display: flex; align-items: baseline; gap: 10px; }
.networth-value {
  font-family: var(--mono);
  font-size: 23px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.networth-delta { font-family: var(--mono); font-size: 12.5px; font-weight: 500; }

/* Statusleiste: EUR/USD, letzter Abruf, Aktionen */
.topbar-meta {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 10px 24px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
  font-size: 11.5px;
  color: var(--text-40);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 99px;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
}
.chip .mono { font-size: 11.5px; color: var(--text-70); }

.ws-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  flex: none;
  transition: background 0.2s;
}
.ws-dot.connected { background: var(--accent); }

/* Navigation */
.tabs {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 14px 24px 0;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: none;
  border: none;
  background: none;
  cursor: pointer;
  padding: 9px 14px 13px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-50);
  border-bottom: 2px solid transparent;
  transition: color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.tab-badge {
  margin-left: 7px;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--red);
  color: var(--accent-ink);
  font-size: 10px;
  font-weight: 700;
}

/* ================================ Layout ================================ */

main {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 28px 24px 64px;
}

.tab-panel { display: none; }
.tab-panel.active { display: flex; flex-direction: column; gap: 16px; animation: rise 0.35s ease both; }

.grid { display: grid; gap: 14px; }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid-cards { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.grid-wide { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.span-2 { grid-column: span 2; min-width: 0; }

@media (max-width: 760px) {
  .span-2 { grid-column: span 1; }
  main { padding: 20px 16px 48px; }
  .topbar-inner, .topbar-meta, .tabs { padding-left: 16px; padding-right: 16px; }
}

/* ================================ Karten ================================ */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 20px;
  min-width: 0;
}
.card.flush { padding: 0; overflow: hidden; }

.card-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.card-head h2 { margin: 0; font-size: 14px; font-weight: 600; }
.card-title { display: flex; flex-direction: column; gap: 3px; }
.card-note { margin: 0 0 14px; font-size: 12px; color: var(--text-40); line-height: 1.55; }
.card-sub { font-size: 12px; color: var(--text-50); }

.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-40);
}
.kpi-value {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.kpi-sub { font-size: 12px; font-weight: 500; color: var(--text-40); }

/* ============================== Bedienelemente ============================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  background: none;
  color: var(--text-70);
  cursor: pointer;
  padding: 10px 15px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s, color 0.15s, filter 0.15s;
}
.btn:hover { border-color: rgba(255, 255, 255, 0.24); color: var(--text); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn.primary {
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.btn.primary:hover { filter: brightness(1.08); }

.btn.danger { border-color: rgba(255, 142, 128, 0.4); color: var(--red); }
.btn.danger:hover { background: rgba(255, 142, 128, 0.12); border-color: var(--red); }

.btn.small { padding: 7px 11px; font-size: 12px; border-radius: var(--r-sm); }
.btn.ghost { border-color: transparent; padding: 0; color: var(--accent); }
.btn.ghost:hover { color: var(--accent-bright); border-color: transparent; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row.end { justify-content: flex-end; }

/* Segmentierte Umschalter (Zeitraum) */
.segmented {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.segmented button {
  border: none;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 500;
  background: transparent;
  color: var(--text-50);
}
.segmented button.active { background: rgba(255, 255, 255, 0.1); color: var(--text); }

/* Filter-Pillen */
.pills { display: flex; gap: 7px; flex-wrap: wrap; }
.pill {
  border: 1px solid var(--line-strong);
  cursor: pointer;
  padding: 7px 13px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 500;
  background: transparent;
  color: var(--text-50);
}
.pill:hover { color: var(--text); }
.pill.active { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.22); color: var(--text); }

/* Formulare */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }

label.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-size: 11.5px; color: var(--text-50); }
.field-hint { color: var(--text-30); }

input[type="text"], input[type="password"], input[type="number"],
input[type="date"], input[type="file"], select, textarea {
  background: var(--surface-sunken);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 11px 12px;
  color: var(--text);
  font-size: 13px;
  width: 100%;
  transition: border-color 0.15s;
}
input[type="text"], input[type="number"], input[type="date"] { font-family: var(--mono); }
input:focus, select:focus, textarea:focus { outline: none; border-color: rgba(110, 231, 168, 0.55); }
input[type="file"] { padding: 9px 12px; font-family: var(--sans); font-size: 12.5px; color: var(--text-50); }
input[type="file"]::file-selector-button {
  background: var(--surface-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--text-70);
  padding: 6px 11px;
  margin-right: 10px;
  font-size: 12px;
  cursor: pointer;
}
select { appearance: none; background-image: none; cursor: pointer; }
select option { background: var(--surface-sunken); color: var(--text); }

.form-error { font-size: 12.5px; color: var(--red); margin: 0; }

/* Zusammenfassung im Buchungsdialog */
.summary-box {
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.summary-row { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; align-items: baseline; }
.summary-row.total span:first-child { font-size: 13px; font-weight: 500; color: var(--text); }
.summary-total {
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ============================== Tabellen ============================== */

.table-wrap { overflow-x: auto; }

.rows { display: flex; flex-direction: column; }

.row {
  display: grid;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line-soft);
  align-items: center;
}
.row.head {
  padding: 13px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-40);
}
.row.clickable { cursor: pointer; }
.row.clickable:hover { background: rgba(255, 255, 255, 0.035); }
.rows .row:last-child { border-bottom: none; }

/* Spaltenraster je Tabelle */
.cols-depot { grid-template-columns: minmax(190px, 2.2fr) repeat(4, minmax(84px, 1fr)); }
/* Letzte Spalte: Bearbeiten/Löschen – nur so breit wie die beiden Knöpfe. */
.cols-buchungen { grid-template-columns: minmax(92px, 0.9fr) minmax(96px, 0.9fr) minmax(160px, 2fr) minmax(78px, 0.7fr) minmax(84px, 0.8fr) minmax(96px, 1fr) minmax(170px, auto); }
.cols-rebalance { grid-template-columns: minmax(150px, 1.6fr) minmax(110px, 1fr) minmax(90px, 0.9fr) minmax(100px, 1fr) minmax(150px, 1.6fr); }
.cols-baender { grid-template-columns: minmax(150px, 1.4fr) repeat(3, minmax(76px, 0.8fr)) minmax(160px, 1.6fr) minmax(96px, 1fr); }
.cols-kurse { grid-template-columns: minmax(150px, 1.6fr) minmax(100px, 1fr) minmax(90px, 0.8fr) minmax(150px, 1.4fr); }
.cols-jahre { grid-template-columns: minmax(130px, 1.4fr) minmax(120px, 1fr) minmax(120px, 1fr) minmax(110px, 1fr); }

.tx-actions { justify-content: flex-end; gap: 8px; }

/* Die Zeile über den gesamten Verlauf setzt sich von den Jahren ab. */
.row-total {
  border-top: 1px solid var(--line);
  border-bottom: none;
  background: rgba(255, 255, 255, 0.022);
}

@media (max-width: 900px) {
  .cols-depot, .cols-buchungen, .cols-rebalance, .cols-baender, .cols-kurse, .cols-jahre {
    grid-template-columns: 1fr;
  }
  .tx-actions { justify-content: flex-start; margin-top: 4px; }
  .row.head { display: none; }
  .row { gap: 6px; padding: 14px 16px; }
  .row .num { text-align: left; }
}

.min-w-0 { min-width: 0; }

/* Positionszeile im Depot */
.pos-cell { display: flex; align-items: center; gap: 11px; min-width: 0; }
.pos-bar { width: 4px; height: 30px; border-radius: 3px; flex: none; }
.pos-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pos-name { font-size: 13.5px; font-weight: 500; }
.pos-meta { font-family: var(--mono); font-size: 11px; color: var(--text-40); }

.stack-right { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }

.empty {
  padding: 44px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  font-size: 13.5px;
  color: var(--text-50);
}

/* ============================== Abzeichen ============================== */

.badge {
  display: inline-flex;
  align-items: center;
  flex: none;
  font-size: 10.5px;
  padding: 5px 9px;
  border-radius: 99px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-70);
}
.badge.ok { background: rgba(110, 231, 168, 0.14); color: var(--ok); }
.badge.warn { background: rgba(255, 196, 107, 0.14); color: var(--warn); }
.badge.out { background: rgba(255, 142, 128, 0.14); color: var(--out); }

.action-badge {
  display: inline-flex;
  font-size: 12.5px;
  font-weight: 500;
  text-transform: capitalize;
}

.source-tag {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-50);
  /* In der Buchungszeile steht das Etikett in einer Flex-Spalte – ohne das
     hier zöge es sich über die volle Zellenbreite. */
  align-self: flex-start;
  margin-top: 3px;
}

/* ============================== Diagramme ============================== */

.chart { position: relative; }
.chart svg { width: 100%; height: 200px; display: block; overflow: visible; }

.axis {
  display: flex;
  justify-content: space-between;
  padding: 10px 0 4px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-40);
}

.legend { display: flex; gap: 16px; flex-wrap: wrap; padding: 4px 0 0; font-size: 11.5px; color: var(--text-50); }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-line { width: 14px; height: 2px; border-radius: 2px; background: var(--accent); }
.legend-line.dashed { height: 0; background: none; border-top: 2px dashed var(--text-40); }

/* Donut */
.donut-wrap { display: flex; flex-wrap: wrap; gap: 22px; align-items: center; }
.donut { width: 132px; height: 132px; flex: none; transform: rotate(-90deg); }
.donut-legend { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 150px; }
.donut-row { display: flex; align-items: center; gap: 9px; }
.dot { width: 8px; height: 8px; border-radius: 3px; flex: none; }
.donut-name { font-size: 12.5px; flex: 1; color: var(--text-70); }
.donut-pct { font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* Balken (Dividenden) */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 150px; }
.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  height: 100%;
  justify-content: flex-end;
  min-width: 0;
}
.bar-value { font-family: var(--mono); font-size: 9.5px; color: var(--text-40); }
.bar { width: 100%; border-radius: 5px 5px 2px 2px; background: var(--violet); transition: filter 0.15s; }
.bar-col:hover .bar { filter: brightness(1.25); }
.bar-label { font-size: 10px; color: var(--text-30); }

/* Fortschritt / Beitrag */
.meter { height: 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 4px; }

.contrib { display: flex; flex-direction: column; gap: 7px; }
.contrib-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.contrib-name { font-size: 13px; color: var(--text-70); }
.contrib-value { font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* Band-Anzeige im Strategie-Tab: zeigt Ist-Wert gegen Ziel und Toleranzband */
.gauge {
  position: relative;
  height: 26px;
  border-radius: var(--r-sm);
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  overflow: hidden;
}
.gauge-band { position: absolute; top: 0; bottom: 0; background: rgba(110, 231, 168, 0.14); }
.gauge-target { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--text-40); }
.gauge-marker {
  position: absolute;
  top: 50%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--surface);
}
.gauge-marker.warn { background: var(--warn); }
.gauge-marker.out { background: var(--out); }

/* ============================== Kontenkarten ============================== */

.account-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.account-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.account-name { font-size: 14px; font-weight: 600; }
.account-id { font-family: var(--mono); font-size: 11.5px; color: var(--text-40); }
.account-saldo {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.account-share { display: flex; flex-direction: column; gap: 7px; }
.account-share .meter { height: 5px; }
.account-share span { font-size: 11.5px; color: var(--text-40); }
.account-actions { display: flex; gap: 8px; }

.add-card {
  background: none;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: var(--r-xl);
  padding: 20px;
  cursor: pointer;
  color: var(--text-50);
  font-size: 13.5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 150px;
  transition: border-color 0.15s, color 0.15s;
}
.add-card:hover { border-color: rgba(110, 231, 168, 0.5); color: var(--text); }
.add-card .plus { font-size: 22px; line-height: 1; }

/* ============================== Meldungen ============================== */

.alert-list { display: flex; flex-direction: column; gap: 10px; }

.alert-item {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: space-between;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  border-radius: 13px;
  padding: 14px 16px;
}
.alert-item.acked { border-left-color: var(--line-strong); opacity: 0.62; }
.alert-meta { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 4px; }
.alert-type { font-size: 13px; font-weight: 600; }
.alert-time { font-family: var(--mono); font-size: 11px; color: var(--text-40); }
.alert-msg { font-size: 12.5px; color: var(--text-70); line-height: 1.5; }

/* ============================== Drawer ============================== */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(5, 6, 7, 0.6);
  backdrop-filter: blur(3px);
  display: flex;
  justify-content: flex-end;
  animation: fade 0.2s ease both;
}

.drawer {
  width: min(440px, 100%);
  height: 100%;
  overflow-y: auto;
  background: var(--surface);
  border-left: 1px solid rgba(255, 255, 255, 0.09);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: rise 0.28s ease both;
}
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.drawer-title { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.drawer-title strong { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.drawer-title span { font-family: var(--mono); font-size: 11.5px; color: var(--text-40); }

.icon-btn {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: none;
  color: var(--text-70);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}
.icon-btn:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.24); }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-40);
}
.stat-value {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.drawer-section { display: flex; flex-direction: column; gap: 2px; }
.drawer-section > strong { font-size: 13px; font-weight: 600; margin-bottom: 8px; }

.mini-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-top: 1px solid var(--line-soft);
  font-size: 12.5px;
}
.mini-row .t { width: 68px; flex: none; font-weight: 500; }
.mini-row .d { font-family: var(--mono); font-size: 12px; color: var(--text-50); flex: 1; }
.mini-row .q { font-family: var(--mono); font-size: 12px; color: var(--text-70); }
.mini-row .a { font-family: var(--mono); width: 92px; text-align: right; flex: none; }

.drawer .push-bottom { margin-top: auto; }

/* ============================== Dialog ============================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(5, 6, 7, 0.66);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade 0.18s ease both;
}

.modal {
  width: min(520px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--r-2xl);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: rise 0.26s ease both;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal-title { display: flex; flex-direction: column; gap: 4px; }
.modal-title strong { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.modal-title span { font-size: 12.5px; color: var(--text-50); }

/* Auswahl der Buchungsart */
.type-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.type-option {
  border: 1px solid var(--line-strong);
  cursor: pointer;
  padding: 8px 13px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 500;
  background: transparent;
  color: var(--text-50);
}
.type-option:hover { color: var(--text); }
.type-option.active { background: rgba(255, 255, 255, 0.09); color: var(--text); }

/* ============================== Login ============================== */

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(120% 80% at 80% -10%, rgba(110, 231, 168, 0.07), transparent 60%),
    var(--bg);
}

.login-card {
  width: min(380px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.login-card .brand { margin-bottom: 2px; }

/* ============================== Kurzmeldungen ============================== */

.toast-container {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  padding: 0 16px;
  width: min(520px, 100%);
}

.toast {
  pointer-events: auto;
  background: var(--surface-raised);
  border: 1px solid rgba(110, 231, 168, 0.35);
  border-radius: 13px;
  padding: 12px 18px;
  font-size: 13px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
  animation: rise 0.25s ease both;
  max-width: 100%;
}
/* type="alert" meldet Fehler, type="info" bestätigt eine Aktion. */
.toast.alert { border-color: rgba(255, 142, 128, 0.45); }
.toast-title { font-weight: 600; margin-bottom: 2px; }
.toast-body { color: var(--text-70); line-height: 1.45; font-size: 12.5px; }
.toast-body:empty { display: none; }

/* ============================== Import-Liste ============================== */

.import-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line-soft);
  font-size: 12.5px;
}
.import-count { color: var(--text-40); margin-left: 8px; }
