:root {
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

/* Dunkles Erscheinungsbild - der Auslieferungszustand. */
:root, :root[data-theme="dark"] {
  --bg: #0e1116;
  --surface: #161b23;
  --surface-2: #1d2430;
  --border: #2a323f;
  --text: #e6eaf0;
  --muted: #8d99ab;
  --accent: #4c8dff;
  --win: #2ecc8f;
  --loss: #ff5f6d;
  --warn: #f0b542;
  --on-accent: #fff;
  /* Flaechige Einfaerbungen - je Thema eigene Deckkraft, damit sie auf
     hellem wie dunklem Grund gleich kraeftig wirken. */
  --win-soft: rgba(46, 204, 143, 0.13);
  --win-line: rgba(46, 204, 143, 0.35);
  --loss-soft: rgba(255, 95, 109, 0.13);
  --loss-line: rgba(255, 95, 109, 0.35);
  --accent-soft: rgba(76, 141, 255, 0.10);
  --accent-softer: rgba(76, 141, 255, 0.06);
  --accent-strong: rgba(76, 141, 255, 0.16);
  --overlay: rgba(0, 0, 0, 0.75);
  --shot-btn: rgba(0, 0, 0, 0.7);
  --shadow: none;
}

/* Helles Erscheinungsbild. Gruen und Rot sind dunkler als im dunklen
   Thema - die hellen Toene haetten auf Weiss zu wenig Kontrast. */
:root[data-theme="light"] {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --border: #d7dee8;
  --text: #1b2330;
  --muted: #5d6b7e;
  --accent: #2563eb;
  --win: #0d8f5b;
  --loss: #d02638;
  --warn: #a86a06;
  --on-accent: #fff;
  --win-soft: rgba(13, 143, 91, 0.11);
  --win-line: rgba(13, 143, 91, 0.32);
  --loss-soft: rgba(208, 38, 56, 0.10);
  --loss-line: rgba(208, 38, 56, 0.30);
  --accent-soft: rgba(37, 99, 235, 0.09);
  --accent-softer: rgba(37, 99, 235, 0.05);
  --accent-strong: rgba(37, 99, 235, 0.15);
  --overlay: rgba(20, 26, 36, 0.55);
  --shot-btn: rgba(20, 26, 36, 0.62);
  --shadow: 0 1px 2px rgba(20, 26, 36, 0.05);
}

/* Ohne ausdrueckliche Wahl entscheidet das Betriebssystem. */
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] {
    --bg: #f4f6fa;
    --surface: #ffffff;
    --surface-2: #eef1f6;
    --border: #d7dee8;
    --text: #1b2330;
    --muted: #5d6b7e;
    --accent: #2563eb;
    --win: #0d8f5b;
    --loss: #d02638;
    --warn: #a86a06;
    --on-accent: #fff;
    --win-soft: rgba(13, 143, 91, 0.11);
    --win-line: rgba(13, 143, 91, 0.32);
    --loss-soft: rgba(208, 38, 56, 0.10);
    --loss-line: rgba(208, 38, 56, 0.30);
    --accent-soft: rgba(37, 99, 235, 0.09);
    --accent-softer: rgba(37, 99, 235, 0.05);
    --accent-strong: rgba(37, 99, 235, 0.15);
    --overlay: rgba(20, 26, 36, 0.55);
    --shot-btn: rgba(20, 26, 36, 0.62);
    --shadow: 0 1px 2px rgba(20, 26, 36, 0.05);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  transition: background-color 0.15s ease, color 0.15s ease;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}

/* --- Anmeldung --- */
.auth-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}

.auth-screen[hidden] { display: none; }

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
}

/* --- Startseite -------------------------------------------------------- */

.auth-screen { align-items: flex-start; overflow-y: auto; padding: 0; }

.land { width: 100%; max-width: 1080px; margin: 0 auto; padding: 22px 24px 60px; }

/* Kopfzeile: Marke links, Anmeldung rechts - das Formular klappt darunter
   auf, statt dauerhaft Platz zu belegen. */
.land-kopf {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 58px;
}

.land-knopf { padding: 0 18px; height: 38px; font-size: 14px; }
.land-knopf-gross { padding: 0 22px; height: 44px; font-size: 15px; margin-bottom: 30px; }

.auth-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 20;
  width: 340px;
  animation: panel-auf .14s ease-out;
}
.auth-panel[hidden] { display: none; }
.auth-panel .auth-card { max-width: none; box-shadow: 0 18px 46px rgba(0,0,0,.34); }

@keyframes panel-auf {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

.marke-kopf { display: inline-flex; align-items: center; gap: 12px; }
.marke-zeichen { width: 38px; height: 38px; flex: none; }
.marke-name { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; }
.marke-name span { color: var(--accent); }

.land-buehne {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
  gap: 52px;
  align-items: center;
  margin-bottom: 96px;
}
.land-text { max-width: 56ch; }

/* --- Vorschau in der Schlagzeile: aus denselben Bausteinen wie die App --- */

.vor-karte {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 22px 54px rgba(0, 0, 0, .30);
}

.vor-kopf {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 13px;
}
.vor-konto { font-size: 12px; font-weight: 600; color: var(--text); }
.vor-zeit { font-size: 11px; color: var(--muted); }

.vor-kacheln { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 13px; }

.vor-kachel {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 10px;
}
.vor-titel {
  display: block;
  font-size: 9.5px;
  letter-spacing: .7px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3px;
}
.vor-wert { font-family: var(--mono); font-size: 14px; color: var(--text); }
.vor-wert.gewinn { color: var(--win); }

.vor-chart {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 20px 10px 8px;
  margin-bottom: 13px;
}
.vor-chart svg { display: block; width: 100%; height: 74px; }
.vor-chart-titel {
  position: absolute;
  top: 8px; left: 11px;
  font-size: 9.5px;
  letter-spacing: .7px;
  text-transform: uppercase;
  color: var(--muted);
}

.vor-kalender { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }

.vor-tag {
  font-family: var(--mono);
  font-size: 9.5px;
  text-align: center;
  padding: 6px 2px;
  border-radius: 6px;
  border: 1px solid transparent;
}
.vor-tag.plus-1 { color: var(--win); background: var(--win-soft); border-color: var(--win-line); }
.vor-tag.plus-2 { color: var(--win); background: var(--win-soft); border-color: var(--win-line); opacity: .92; }
.vor-tag.plus-3 { color: var(--win); background: var(--win-soft); border-color: var(--win-line); }
.vor-tag.minus-1 { color: var(--loss); background: var(--loss-soft); border-color: var(--loss-line); }
.vor-tag.leer { background: var(--surface-2); border-color: var(--border); }

.auth-card-titel { display: none; }

.land-schlagzeile {
  font-size: 44px;
  line-height: 1.1;
  letter-spacing: -1.2px;
  margin: 0 0 18px;
}

.land-satz {
  font-size: 17px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0 0 28px;
  max-width: 44ch;
}

.marke-punkte { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.marke-punkte li {
  position: relative; padding-left: 26px;
  font-size: 13.5px; line-height: 1.5; color: var(--muted); max-width: 48ch;
}
.marke-punkte li::before {
  content: ""; position: absolute; left: 3px; top: 5px;
  width: 5px; height: 9px;
  border: solid var(--accent); border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.marke-punkte strong { display: block; color: var(--text); font-weight: 600; margin-bottom: 2px; }

/* --- Einblicke --- */

.land-schau { margin-bottom: 88px; }

.land-marke {
  font-size: 11.5px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 10px;
  font-weight: 600;
}

.land-schau h2, .land-ki h2 {
  font-size: 27px;
  letter-spacing: -0.5px;
  margin: 0 0 12px;
  /* Die App setzt h2 in Versalien - auf der Startseite waere das laut. */
  text-transform: none;
  color: var(--text);
}

.land-schau-satz {
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 26px;
  max-width: 62ch;
}

.land-bild {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
}
.land-bild img { display: block; width: 100%; height: auto; }

.land-fussnote { font-size: 12px; color: var(--muted); margin: 10px 0 0; }

/* --- KI-Teil --- */

.land-ki {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 44px;
  align-items: center;
  background: var(--accent-softer);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 34px;
  margin-bottom: 56px;
}

.land-klarstellung {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  background: var(--surface);
  border-left: 3px solid var(--warn);
  border-radius: 0 8px 8px 0;
  padding: 12px 14px;
  margin: 0;
}
.land-klarstellung strong { color: var(--text); }

.land-ki-probe { display: grid; gap: 10px; }

.probe-zeile {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 11px 13px;
  font-size: 12.5px;
}
.probe-zeile em { font-style: normal; color: var(--text); flex: 1 1 12ch; min-width: 0; }
.probe-zeile em.ohne { color: var(--muted); }

.land-fuss {
  border-top: 1px solid var(--border);
  padding-top: 22px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 900px) {
  .land { padding: 20px 18px 48px; }
  .land-buehne { grid-template-columns: minmax(0, 1fr); gap: 34px; margin-bottom: 64px; }
  .land-schlagzeile { font-size: 33px; }
  .land-vorschau { max-width: 420px; }
  /* In drei schmalen Kacheln bricht ein Betrag sonst um. */
  .vor-wert { font-size: 12.5px; white-space: nowrap; }
  .vor-kachel { padding: 8px; }
  .land-kopf { margin-bottom: 38px; }
  /* Auf schmalen Fenstern nimmt das Feld die volle Breite unter der
     Kopfzeile ein - ein 340px-Kasten am rechten Rand passt dort nicht. */
  .auth-panel { width: auto; left: 0; right: 0; }
  .land-schau { margin-bottom: 58px; }
  .land-schau h2, .land-ki h2 { font-size: 22px; }
  .land-ki { grid-template-columns: minmax(0, 1fr); gap: 26px; padding: 22px; }
  /* Die Aufnahmen sind fuer breite Fenster gemacht - hier waeren sie
     unlesbar klein, also seitlich scrollbar statt geschrumpft. */
  .land-bild { overflow-x: auto; }
  .land-bild img { width: 900px; max-width: none; }
}

.auth-card h1 { font-size: 20px; margin: 0 0 6px; text-align: center; }
.auth-card h1 span { color: var(--accent); }
.auth-card .hint { text-align: center; margin-bottom: 20px; }
.auth-card a { color: var(--accent); text-decoration: none; }
.auth-card a:hover { text-decoration: underline; }

.auth-error {
  background: var(--loss-soft);
  border: 1px solid var(--loss-line);
  color: var(--loss);
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}

.auth-error[hidden] { display: none; }

/* --- Kopfzeile --- */
header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
}

header h1 {
  font-size: 16px;
  margin: 0;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

header h1 span { color: var(--accent); }

nav { display: flex; gap: 4px; }

nav button {
  background: none;
  border: none;
  color: var(--muted);
  padding: 7px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
}

nav button:hover { background: var(--surface-2); color: var(--text); }
nav button.active { background: var(--accent); color: var(--on-accent); }

.spacer { flex: 1; }

.header-stat {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.header-stat b { font-size: 15px; }

.theme-toggle {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  width: 34px;
  height: 32px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0;
}

.theme-toggle:hover { color: var(--text); border-color: var(--muted); }

.account-select {
  width: auto;
  max-width: 220px;
  padding: 6px 10px;
  font-size: 13px;
  background: var(--surface-2);
  border-color: var(--border);
}

/* --- Layout --- */
main { padding: 24px; max-width: 1400px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; }

h2 {
  font-size: 15px;
  margin: 0 0 12px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* --- Dashboard-Raster --- */
#dashboardWidgets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
  align-items: start;
}

.widget[data-span="full"] { grid-column: 1 / -1; }
.widget[hidden] { display: none; }

@media (max-width: 900px) {
  #dashboardWidgets { grid-template-columns: minmax(0, 1fr); }
  .widget[data-span="full"] { grid-column: auto; }
}

/* --- Anordnung der Dashboard-Bausteine --- */
.layout-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  margin-bottom: 6px;
  cursor: grab;
}

.layout-row.dragging { opacity: 0.4; }
.layout-row.over { border-color: var(--accent); }
.layout-row .grip { color: var(--muted); cursor: grab; user-select: none; }
.layout-row .name { flex: 1; font-size: 13px; }
.layout-row.off .name { color: var(--muted); text-decoration: line-through; }
.layout-row button {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  width: 26px;
  height: 24px;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
}
.layout-row button:hover:not(:disabled) { color: var(--text); border-color: var(--muted); }
.layout-row button:disabled { opacity: 0.3; cursor: default; }

/* --- Marktausschau --- */
.markt-raster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.markt-karte {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.markt-kopf { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.markt-kopf .symbol { font-size: 16px; font-weight: 600; }
.markt-kopf .kurs { font-family: var(--mono); font-size: 14px; margin-left: auto; }

.markt-entfernen {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 5px;
  width: 20px;
  height: 20px;
  line-height: 1;
  font-size: 12px;
  padding: 0;
  cursor: pointer;
}
.markt-entfernen:hover { color: var(--loss); border-color: var(--loss); }

.markt-balken {
  display: flex;
  height: 22px;
  border-radius: 6px;
  overflow: hidden;
  margin: 12px 0 6px;
  background: var(--surface-2);
  font-size: 11px;
  font-family: var(--mono);
}

.markt-balken > div {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-accent);
  white-space: nowrap;
}

.markt-balken .auf { background: var(--win); }
.markt-balken .ab { background: var(--loss); }
.markt-balken > div:empty { display: none; }

.markt-kriterien { list-style: none; margin: 10px 0 0; padding: 0; font-size: 12.5px; }
.markt-kriterien li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
  border-top: 1px solid var(--border);
}
.markt-kriterien li:first-child { border-top: none; }
.markt-kriterien .zeichen { width: 14px; text-align: center; }
.markt-kriterien .wert { margin-left: auto; font-family: var(--mono); color: var(--muted); font-size: 11.5px; }

.termin { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; border-top: 1px solid var(--border); font-size: 13px; }
.termin:first-child { border-top: none; }
.termin .zeit { font-family: var(--mono); font-size: 12px; color: var(--muted); min-width: 42px; }
.termin .titel { flex: 1; }
.termin .zahlen { font-family: var(--mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }

.wichtigkeit { font-size: 10px; padding: 1px 6px; border-radius: 20px; border: 1px solid var(--border); }
.wichtigkeit.high { color: var(--loss); border-color: var(--loss-line); }
.wichtigkeit.medium { color: var(--warn); }
.wichtigkeit.low { color: var(--muted); }

/* Feste Zeilenhoehe: eine Meldung mit Marke darf nicht hoeher werden
   als eine ohne, sonst springt der Abstand in der Liste. */
.meldung {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
  line-height: 1.35;
}
.meldung:first-child { border-top: none; }
.meldung a { color: var(--text); text-decoration: none; }
.meldung a:hover { color: var(--accent); text-decoration: underline; }

/* Feste Spaltenbreiten, damit alle Ueberschriften buendig beginnen. */
.meldung .quelle {
  flex: 0 0 52px;
  font-size: 11px;
  color: var(--muted);
  margin-right: 0;
}
.meldung-marken {
  flex: 0 0 104px;
  display: flex;
  gap: 5px;
  margin-right: 0;
}
.meldung .titel { flex: 1 1 auto; min-width: 0; }

.marke {
  display: inline-flex;
  align-items: center;
  height: 18px;
  font-family: var(--mono);
  font-size: 11px;
  padding: 0 6px;
  border-radius: 4px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.marke.auf { color: var(--win); background: var(--win-soft); border-color: var(--win-line); }
.marke.ab  { color: var(--loss); background: var(--loss-soft); border-color: var(--loss-line); }

/* Auf schmalen Fenstern reicht die Breite fuer drei Spalten nicht.
   Quelle und Marken teilen sich dann die erste Zeile, die Ueberschrift
   bekommt die zweite - sonst bricht sie mehrzeilig um und die Liste
   wird wieder ungleichmaessig. */
@media (max-width: 640px) {
  .meldung {
    flex-wrap: wrap;
    row-gap: 3px;
    min-height: 0;
    padding: 8px 0;
  }
  .meldung .quelle,
  .meldung-marken { flex: 0 0 auto; }
  .meldung .titel { flex: 1 0 100%; }
}

/* --- KI-Analyse --- */
.coach-output { font-size: 14px; line-height: 1.65; }
.coach-output h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin: 18px 0 6px;
}
.coach-output h3:first-child { margin-top: 0; }
.coach-output ul { margin: 6px 0; padding-left: 20px; }
.coach-output li { margin-bottom: 5px; }
.coach-output p { margin: 6px 0; }
.coach-output strong { color: var(--text); }
.coach-output code {
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 12.5px;
}

.coach-warn {
  background: var(--loss-soft);
  border-left: 2px solid var(--warn);
  border-radius: 0 7px 7px 0;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 13px;
}

.coach-meta { font-size: 12px; color: var(--muted); margin-top: 14px; }

/* --- P/L-Kalender --- */
.cal-grid {
  display: grid;
  /* Sieben Tage plus die Wochensumme am Zeilenende */
  grid-template-columns: repeat(7, minmax(0, 1fr)) minmax(0, 1.05fr);
  gap: 5px;
}

.cal-grid .cal-head:last-of-type { color: var(--text); }

.cal-week {
  border: 1px solid var(--border);
  border-left: 2px solid var(--muted);
  border-radius: 7px;
  padding: 6px 7px;
  min-height: 62px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cal-week .d { font-size: 10.5px; color: var(--muted); letter-spacing: 0.3px; }
.cal-week .pl { font-family: var(--mono); font-size: 13px; font-weight: 600; white-space: nowrap; }
.cal-week .meta { font-size: 10.5px; color: var(--muted); margin-top: auto; }
.cal-week.empty { opacity: 0.45; }
.cal-week.win { border-left-color: var(--win); }
.cal-week.loss { border-left-color: var(--loss); }

.cal-head {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
  padding-bottom: 4px;
}

.cal-day {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 7px;
  min-height: 62px;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cal-day.empty { background: transparent; border-color: transparent; }

/* Nur Zellen mit Trades reagieren auf Klicks */
.cal-day.clickable, .cal-week.clickable {
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.cal-day.clickable:hover, .cal-week.clickable:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px var(--accent-soft);
  border-color: var(--accent);
}

.cal-day.clickable:active, .cal-week.clickable:active { transform: none; }
.cal-day.today { border-color: var(--accent); }
.cal-day .d { font-size: 11px; color: var(--muted); }
.cal-day .pl { font-family: var(--mono); font-size: 13px; font-weight: 600; white-space: nowrap; }
.cal-day .meta { font-size: 10.5px; color: var(--muted); margin-top: auto; }
.cal-day.win { background: var(--win-soft); border-color: var(--win-line); }
.cal-day.loss { background: var(--loss-soft); border-color: var(--loss-line); }

.cal-summary {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.cal-summary b { font-family: var(--mono); }

/* --- Kennzahlen-Kacheln --- */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(172px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.tile .label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
}

.tile .value { font-size: 20px; font-family: var(--mono); font-weight: 600; }
.tile .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.pos { color: var(--win); }
.neg { color: var(--loss); }
.neutral { color: var(--muted); }
.warn { color: var(--warn); }

/* --- Formulare --- */
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }

input, select, textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 7px;
  font-family: inherit;
  font-size: 14px;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

textarea { min-height: 80px; resize: vertical; }
.field { margin-bottom: 14px; }

.form-row {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

button.primary, button.ghost, button.danger {
  border-radius: 7px;
  padding: 9px 18px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
}

button.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
button.primary:hover { filter: brightness(1.1); }
button.ghost { background: transparent; color: var(--muted); border-color: var(--border); }
button.ghost:hover { color: var(--text); border-color: var(--muted); }
button.danger { background: transparent; color: var(--loss); border-color: var(--loss); }
button.danger:hover { background: var(--loss); color: var(--on-accent); }

.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* --- Tag-Auswahl --- */
.tags { display: flex; flex-wrap: wrap; gap: 7px; }

.tag {
  padding: 5px 11px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  font-size: 12.5px;
  user-select: none;
}

.tag:hover { border-color: var(--muted); }
.tag.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tag.mistake.on { background: var(--loss); border-color: var(--loss); }

/* --- Tabellen --- */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

th {
  text-align: left;
  padding: 9px 10px;
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr:hover { background: var(--surface-2); }
td.num { font-family: var(--mono); text-align: right; }
th.num { text-align: right; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
}

.badge.long { color: var(--win); border-color: var(--win-line); }
.badge.short { color: var(--loss); border-color: var(--loss-line); }

.chip-list { display: flex; gap: 4px; flex-wrap: wrap; max-width: 260px; white-space: normal; }

.chip {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
}

/* --- Mehrfachauswahl in der Trade-Tabelle --- */
.selection-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 12px;
}

.selection-bar span { font-size: 13px; }
td.pick, th.pick { width: 34px; }
td input[type="checkbox"], th input[type="checkbox"] {
  width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent);
}
tr.picked { background: var(--accent-soft); }
tr.picked:hover { background: var(--accent-strong); }

/* --- Fill-Tabelle (Teilpositionen) --- */
#fillTable td { padding: 5px 6px; }
#fillTable input, #fillTable select { padding: 6px 8px; font-size: 13px; }
#fillTable .f-qty, #fillTable .f-price { text-align: right; font-family: var(--mono); }

/* --- Balken in Auswertungstabellen --- */
.bar-cell { min-width: 120px; }

.bar {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
  position: relative;
}

.bar > span { display: block; height: 100%; border-radius: 3px; }

/* --- Screenshots --- */
.shots { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

.shot {
  position: relative;
  width: 150px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
}

.shot img { width: 100%; height: 95px; object-fit: cover; display: block; cursor: zoom-in; }
.shot .cap { font-size: 11px; padding: 4px 7px; color: var(--muted); }

.shot .rm {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--shot-btn);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  cursor: pointer;
  line-height: 1;
  font-size: 13px;
}

.dropzone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.dropzone.hot { border-color: var(--accent); color: var(--accent); background: var(--accent-softer); }

/* --- Detail-Ansicht --- */
.overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 24px;
}

.overlay.open { display: flex; }
.overlay img { max-width: 92vw; max-height: 92vh; border-radius: 8px; }

/* Trade-Listen brauchen mehr Breite als eine Detailansicht */
.modal.wide { max-width: 1150px; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 900px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 22px;
}

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kv .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.kv .val { font-family: var(--mono); font-size: 14px; }

.note {
  background: var(--surface-2);
  border-left: 2px solid var(--accent);
  padding: 10px 12px;
  border-radius: 0 7px 7px 0;
  white-space: pre-wrap;
  font-size: 13.5px;
  margin-top: 6px;
}

.empty { color: var(--muted); text-align: center; padding: 40px 0; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: var(--radius);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  z-index: 60;
}

.toast.show { opacity: 1; }
.toast.err { border-color: var(--loss); color: var(--loss); }

/* --- Chart --- */
.chart { width: 100%; height: 240px; }
.chart text { font-size: 10px; fill: var(--muted); font-family: var(--mono); }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .zero-line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }

@media (max-width: 700px) {
  main { padding: 14px; }
  header { padding: 12px 14px; gap: 10px; }
  .header-stat { display: none; }
}
