/* Tradingjournal - Oberflaeche. Nur Systemschriften, keine externen Ressourcen. */
:root {
  --bg: #f3f4f1; --surface: #ffffff; --surface-2: #f7f8f6; --ink: #16201f; --muted: #566462; --line: #dde2de;
  --accent: #0a6b68; --accent-ink: #ffffff; --accent-soft: #e2f1ef; --pos: #17703a; --neg: #b42318; --warn: #8a5a00;
  --focus: #1456c5; --shadow: 0 1px 2px rgba(20, 32, 30, .06), 0 4px 16px rgba(20, 32, 30, .04);
  --radius: 14px; --tabbar-h: 3.6rem;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1312; --surface: #151d1c; --surface-2: #1a2423; --ink: #e8efed; --muted: #9bb0ac; --line: #263430;
    --accent: #4fd1c5; --accent-ink: #04201e; --accent-soft: #14312f; --pos: #52c98a; --neg: #ff8d7d; --warn: #f0b955;
    --focus: #8ab4ff; --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
a { color: var(--accent); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6rem; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
p { margin: .4rem 0 .8rem; }
small, .muted { color: var(--muted); }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: .5rem 1rem; z-index: 50; }
.skip:focus { left: .5rem; top: .5rem; }

/* --- Kopfzeile und Navigation --- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 74rem; margin: 0 auto; padding: .55rem 1rem; display: flex; align-items: center; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.brand-mark { width: 1.6rem; height: 1.6rem; border-radius: 8px; background: var(--accent); display: grid; place-items: center; }
.brand-mark svg { width: 1.05rem; height: 1.05rem; stroke: var(--accent-ink); fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.spacer { flex: 1; }
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .7rem;
  border: 1px solid var(--line); border-radius: 99px; background: var(--surface); font-size: .9rem; max-width: 14rem; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-panel { position: absolute; right: 0; top: calc(100% + .4rem); min-width: 15rem; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow), 0 8px 30px rgba(0, 0, 0, .15); padding: .8rem; z-index: 30; }
.menu-panel p { margin: 0 0 .5rem; font-size: .9rem; word-break: break-all; }
.menu-panel form { margin: .6rem 0 0; }
.menu-panel .btn { width: 100%; }

.nav { display: flex; gap: .25rem; }
.nav a { display: flex; align-items: center; justify-content: center; gap: .4rem; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .92rem;
  padding: .4rem .75rem; border-radius: 10px; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.nav svg { width: 1.35rem; height: 1.35rem; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 47.99rem) {
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding: .25rem .25rem env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line); gap: 0; }
  .nav a { flex: 1; flex-direction: column; gap: .1rem; font-size: .68rem; padding: .25rem 0; border-radius: 8px; min-width: 0; }
  .nav a[aria-current="page"] { background: transparent; }
  .nav a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-in { padding: .5rem .75rem; }
}
@media (min-width: 48rem) { body { padding-bottom: 0; } .nav svg { display: none; } }

/* --- Seitenrahmen --- */
main { max-width: 74rem; margin: 0 auto; padding: 1rem; }
@media (min-width: 48rem) { main { padding: 1.5rem 1.25rem 3rem; } }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; justify-content: space-between; margin: .25rem 0 1rem; }
.page-head h1 { margin: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: 0 0 1rem; box-shadow: var(--shadow); }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.card-head h2, .card-head h3 { margin: 0; }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 62rem) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-2 > .card { margin-bottom: 0; } }

/* --- Meldungen --- */
.msg { padding: .65rem .9rem; border-radius: 10px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); margin: 0 0 1rem; }
.msg.error { background: color-mix(in srgb, var(--neg) 10%, var(--surface)); border-color: color-mix(in srgb, var(--neg) 45%, var(--line)); }
.msg.warning { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }

/* --- Formulare --- */
input, select, textarea, .btn, button { font: inherit; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=file], select, textarea {
  width: 100%; min-height: 2.6rem; padding: .5rem .7rem; color: var(--ink); background: var(--surface); border: 1px solid color-mix(in srgb, var(--muted) 55%, var(--line));
  border-radius: 10px; }
textarea { min-height: 6rem; }
input[type=checkbox], input[type=radio] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); vertical-align: -.2rem; }
.btn, button { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 2.6rem; padding: .5rem 1rem; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font-weight: 600; text-decoration: none; }
.btn:hover, button:hover { filter: brightness(1.07); }
.btn.secondary, button.secondary { background: var(--surface); color: var(--ink); border-color: color-mix(in srgb, var(--muted) 55%, var(--line)); }
.btn.small, button.small { min-height: 2rem; padding: .2rem .6rem; font-size: .9rem; }
.btn[disabled], button[disabled] { opacity: .5; cursor: not-allowed; }
.field { margin: 0 0 .9rem; }
.field label, label.lbl { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .25rem; color: var(--muted); }
.field .help, .helptext { display: block; font-size: .82rem; color: var(--muted); margin-top: .2rem; }
.errorlist { list-style: none; margin: .25rem 0; padding: 0; color: var(--neg); font-size: .9rem; font-weight: 600; }
.inline { display: inline; margin: 0; }
.filters { display: grid; gap: .6rem; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
.filters label { display: flex; flex-direction: column; gap: .2rem; font-size: .8rem; font-weight: 600; color: var(--muted); min-width: 0; }
.filters label.check { flex-direction: row; align-items: center; gap: .5rem; min-height: 2.6rem; }
.filters .actions { grid-column: 1 / -1; display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
@media (min-width: 48rem) { .filters { grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); } .filters .actions { grid-column: auto; } }

/* --- Tabellen --- */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.t th, table.t td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--line); vertical-align: baseline; }
table.t thead th, table.t tr:first-child th { position: sticky; top: 0; background: var(--surface-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); white-space: nowrap; }
table.t th a { color: inherit; text-decoration: none; }
table.t th a:hover { color: var(--accent); text-decoration: underline; }
table.t tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
table.t .n, table.t th.n, table.t td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t tfoot td { font-weight: 700; background: var(--surface-2); }
.pos { color: var(--pos); } .neg { color: var(--neg); }
@media (max-width: 39.99rem) {
  table.stack, table.stack tbody { display: block; }
  table.stack thead, table.stack tr.head { display: none; }
  table.stack tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem .9rem; padding: .7rem .9rem; border-bottom: 1px solid var(--line); }
  table.stack td { display: block; border: 0; padding: 0; text-align: left; white-space: normal; min-width: 0; overflow-wrap: anywhere; }
  table.stack td::before { content: attr(data-label); display: block; color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .03em; }
  table.stack td.n { white-space: normal; text-align: left; }
  table.stack td.empty { grid-column: 1 / -1; }
  table.stack td.empty::before { content: none; }
}
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .2rem .1rem .65rem; border: 1px solid var(--line); border-radius: 99px; background: var(--surface-2); font-size: .88rem; margin: 0 .3rem .3rem 0; }
.chip form { display: inline-flex; margin: 0; }
.chip button { min-height: 1.6rem; width: 1.6rem; padding: 0; border-radius: 99px; background: transparent; color: var(--muted); border: 0; font-size: 1.1rem; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: .05rem .5rem; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; padding: .8rem; }

/* --- Umschalter --- */
.seg { display: inline-flex; flex-wrap: nowrap; max-width: 100%; overflow-x: auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; }
.seg a, .seg button { min-height: 2.2rem; padding: .25rem .8rem; border-radius: 9px; border: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: .9rem; text-decoration: none; white-space: nowrap; }
.seg a:hover, .seg button:hover { color: var(--ink); filter: none; }
.seg a[aria-current="true"], .seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
@media (prefers-color-scheme: dark) { .seg a[aria-current="true"], .seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); box-shadow: none; } }

/* --- Statusseite --- */
.hero { padding: 1.1rem 1.1rem .4rem; }
.hero-label { color: var(--muted); font-size: .85rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.hero-value { font-size: clamp(2rem, 8vw, 3rem); font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; margin: .15rem 0; }
.hero-value .cur { font-size: .5em; font-weight: 600; color: var(--muted); margin-left: .25rem; }
.hero-delta { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-variant-numeric: tabular-nums; font-weight: 600; }
.tiles { display: grid; gap: .75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0 0 1rem; }
@media (min-width: 40rem) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 64rem) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem .9rem; box-shadow: var(--shadow); min-width: 0; }
.tile-label { color: var(--muted); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.tile-value { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; overflow-wrap: anywhere; }
.tile-sub { color: var(--muted); font-size: .8rem; }
.chart { position: relative; min-height: 12rem; }
.chart-svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .ax { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .val { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--accent); opacity: .12; }
.chart .net { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart .cross { stroke: var(--muted); stroke-width: 1; }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .45rem .65rem; font-size: .82rem;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .18); min-width: 12rem; z-index: 3; }
.tip-row { display: flex; justify-content: space-between; gap: 1rem; font-variant-numeric: tabular-nums; }
.tip-row span:first-child { color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .82rem; color: var(--muted); margin-top: .4rem; }
.legend i { display: inline-block; width: 1.4rem; height: 0; border-top: 2.5px solid var(--accent); vertical-align: middle; margin-right: .35rem; }
.legend i.dash { border-top: 2px dashed var(--muted); }
.empty-state { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.empty-state .btn { margin-top: .5rem; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: .35rem 1rem; margin: 0; font-variant-numeric: tabular-nums; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; font-weight: 600; }
.bar-cell { position: relative; }
.mbar { display: block; height: .35rem; border-radius: 99px; background: var(--pos); margin-top: .2rem; min-width: 1px; }
.mbar.neg { background: var(--neg); }

/* --- Anmelde- und 2FA-Seiten --- */
.auth { max-width: 26rem; margin: 2rem auto; }
.auth .card { padding: 1.4rem; }
.auth h1 { font-size: 1.35rem; }
.auth table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
.auth th, .auth td { display: block; text-align: left; padding: 0; }
.auth th { font-size: .85rem; font-weight: 600; color: var(--muted); padding-bottom: .25rem; }
.auth td { padding-bottom: .9rem; }
.auth .actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: space-between; align-items: center; }
.auth img { max-width: 100%; height: auto; background: #fff; padding: .5rem; border-radius: 10px; }
.auth ul { padding-left: 1.2rem; }
.auth hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }
@media print { .topbar, .nav, .skip { display: none; } body { padding: 0; background: #fff; } }

.mt-s { margin-top: .4rem; } .mt-m { margin-top: .6rem; } .strong { font-weight: 700; } .nowrap { white-space: nowrap; }
.hide { display: none; }
.pad-t { padding: 1rem 1rem 0; } .pad-x { padding: 0 1rem; }
.mbar.w0 { width: 0%; }
.mbar.w1 { width: 1%; }
.mbar.w2 { width: 2%; }
.mbar.w3 { width: 3%; }
.mbar.w4 { width: 4%; }
.mbar.w5 { width: 5%; }
.mbar.w6 { width: 6%; }
.mbar.w7 { width: 7%; }
.mbar.w8 { width: 8%; }
.mbar.w9 { width: 9%; }
.mbar.w10 { width: 10%; }
.mbar.w11 { width: 11%; }
.mbar.w12 { width: 12%; }
.mbar.w13 { width: 13%; }
.mbar.w14 { width: 14%; }
.mbar.w15 { width: 15%; }
.mbar.w16 { width: 16%; }
.mbar.w17 { width: 17%; }
.mbar.w18 { width: 18%; }
.mbar.w19 { width: 19%; }
.mbar.w20 { width: 20%; }
.mbar.w21 { width: 21%; }
.mbar.w22 { width: 22%; }
.mbar.w23 { width: 23%; }
.mbar.w24 { width: 24%; }
.mbar.w25 { width: 25%; }
.mbar.w26 { width: 26%; }
.mbar.w27 { width: 27%; }
.mbar.w28 { width: 28%; }
.mbar.w29 { width: 29%; }
.mbar.w30 { width: 30%; }
.mbar.w31 { width: 31%; }
.mbar.w32 { width: 32%; }
.mbar.w33 { width: 33%; }
.mbar.w34 { width: 34%; }
.mbar.w35 { width: 35%; }
.mbar.w36 { width: 36%; }
.mbar.w37 { width: 37%; }
.mbar.w38 { width: 38%; }
.mbar.w39 { width: 39%; }
.mbar.w40 { width: 40%; }
.mbar.w41 { width: 41%; }
.mbar.w42 { width: 42%; }
.mbar.w43 { width: 43%; }
.mbar.w44 { width: 44%; }
.mbar.w45 { width: 45%; }
.mbar.w46 { width: 46%; }
.mbar.w47 { width: 47%; }
.mbar.w48 { width: 48%; }
.mbar.w49 { width: 49%; }
.mbar.w50 { width: 50%; }
.mbar.w51 { width: 51%; }
.mbar.w52 { width: 52%; }
.mbar.w53 { width: 53%; }
.mbar.w54 { width: 54%; }
.mbar.w55 { width: 55%; }
.mbar.w56 { width: 56%; }
.mbar.w57 { width: 57%; }
.mbar.w58 { width: 58%; }
.mbar.w59 { width: 59%; }
.mbar.w60 { width: 60%; }
.mbar.w61 { width: 61%; }
.mbar.w62 { width: 62%; }
.mbar.w63 { width: 63%; }
.mbar.w64 { width: 64%; }
.mbar.w65 { width: 65%; }
.mbar.w66 { width: 66%; }
.mbar.w67 { width: 67%; }
.mbar.w68 { width: 68%; }
.mbar.w69 { width: 69%; }
.mbar.w70 { width: 70%; }
.mbar.w71 { width: 71%; }
.mbar.w72 { width: 72%; }
.mbar.w73 { width: 73%; }
.mbar.w74 { width: 74%; }
.mbar.w75 { width: 75%; }
.mbar.w76 { width: 76%; }
.mbar.w77 { width: 77%; }
.mbar.w78 { width: 78%; }
.mbar.w79 { width: 79%; }
.mbar.w80 { width: 80%; }
.mbar.w81 { width: 81%; }
.mbar.w82 { width: 82%; }
.mbar.w83 { width: 83%; }
.mbar.w84 { width: 84%; }
.mbar.w85 { width: 85%; }
.mbar.w86 { width: 86%; }
.mbar.w87 { width: 87%; }
.mbar.w88 { width: 88%; }
.mbar.w89 { width: 89%; }
.mbar.w90 { width: 90%; }
.mbar.w91 { width: 91%; }
.mbar.w92 { width: 92%; }
.mbar.w93 { width: 93%; }
.mbar.w94 { width: 94%; }
.mbar.w95 { width: 95%; }
.mbar.w96 { width: 96%; }
.mbar.w97 { width: 97%; }
.mbar.w98 { width: 98%; }
.mbar.w99 { width: 99%; }
.mbar.w100 { width: 100%; }

/* Klassen der Bibliothek django-two-factor-auth */
.btn-secondary, .btn-link, .btn-info, .btn-warning, .btn-sm.btn-warning { background: var(--surface); color: var(--ink); border-color: color-mix(in srgb, var(--muted) 55%, var(--line)); }
.btn-link { border-color: transparent; background: transparent; color: var(--accent); }
.btn-block { width: 100%; }
.btn-sm { min-height: 2rem; padding: .2rem .6rem; font-size: .9rem; }
.float-right { order: 2; }
.auth form > .btn, .auth form > button { margin-right: .4rem; }
.field ul { list-style: none; padding: 0; margin: 0; }
.field ul li { margin: .2rem 0; }
.field ul label { display: inline; font-weight: 400; color: var(--ink); font-size: 1rem; }
@media (max-width: 39.99rem) { .hide-s { display: none; } table.t th, table.t td { padding: .5rem .45rem; } }
@media (max-width: 39.99rem) { table.stack td:empty { display: none; } }
table.t abbr { text-decoration: none; cursor: help; }
.inline-form { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin: 0; }
.inline-form select { max-width: 16rem; }

/* Phase 6a: Team, Datenschutz */
.btn.danger, button.danger { background: var(--surface); color: var(--neg); border-color: color-mix(in srgb, var(--neg) 55%, var(--line)); }
button.danger:hover, .btn.danger:hover { background: color-mix(in srgb, var(--neg) 10%, var(--surface)); }
.danger-zone { border-color: color-mix(in srgb, var(--neg) 45%, var(--line)); }
.member { padding: .9rem 1rem; border-top: 1px solid var(--line); }
.member:first-of-type { border-top: 0; }
.member-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem; }
.member-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.access { margin-top: .6rem; }
.access fieldset { border: 1px solid var(--line); border-radius: 10px; padding: .5rem .8rem; margin: 0 0 .5rem; }
.access legend { font-size: .85rem; font-weight: 600; color: var(--muted); padding: 0 .3rem; }
.check { display: inline-flex; align-items: center; gap: .4rem; margin: .2rem 1rem .2rem 0; }
.field ul label.check, .field ul label { display: inline; }
