:root {
  --bg: #0d1420;
  --bg2: #131c2b;
  --panel: #172234;
  --line: #24324a;
  --text: #e6edf7;
  --muted: #8d9bb3;
  --up: #22c55e;
  --down: #ef4444;
  --accent: #f5b301;
  --accent-ink: #1a1300;
  --blue: #3b82f6;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { min-height: 100vh; }
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.up { color: var(--up); }
.down { color: var(--down); }
.row { display: flex; align-items: center; }
.gap { gap: 10px; }
.grow { flex: 1; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 22px 0 8px; color: var(--muted); font-weight: 600; }

/* Buttons und Formulare */
.btn { background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { border-color: #3a4c6b; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.block { width: 100%; margin-top: 10px; padding: 13px; font-size: 16px; }
.btn.icon { padding: 6px 11px; font-size: 18px; }
.btn.small { padding: 5px 9px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 0; }
input, select { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: 16px; }
input:focus, select:focus { outline: 2px solid var(--blue); outline-offset: 0; }
.msg { min-height: 1.4em; margin: 8px 0 0; font-size: 14px; }
.msg.err { color: var(--down); }
.msg.ok { color: var(--up); }
.help { font-size: 12.5px; color: var(--muted); margin-top: 5px; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.login-card .row { margin-top: 16px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: .2px; }
.brand.big { font-size: 22px; margin-bottom: 8px; }
.logo { font-size: 1.2em; }

/* Kopfzeile */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: rgba(13,20,32,.95); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.kpis { display: flex; gap: 22px; flex: 1; justify-content: center; }
.kpi { display: flex; flex-direction: column; line-height: 1.15; }
.kpi > span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.kpi b { font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.top-right { display: flex; align-items: center; gap: 8px; }
.badge { font-size: 11.5px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.badge.live { color: var(--up); border-color: rgba(34,197,94,.4); }
.badge.demo { color: var(--accent); border-color: rgba(245,179,1,.5); }
.badge.err { color: var(--down); border-color: rgba(239,68,68,.5); }
.menu { position: absolute; right: 12px; top: 56px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px; min-width: 220px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.menu-head { padding: 8px 10px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--text); padding: 10px; border-radius: 8px; font: inherit; cursor: pointer; }
.menu button:hover { background: var(--bg2); }

/* Tabs */
.tabs { display: flex; gap: 4px; padding: 8px 12px; overflow-x: auto; border-bottom: 1px solid var(--line); background: var(--bg); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: none; border: 0; color: var(--muted); padding: 8px 12px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.tabs button.active { background: var(--panel); color: var(--text); }
.pill { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; text-align: center; }
main { padding: 12px; max-width: 1500px; margin: 0 auto; }
.tab { display: none; }
.tab.active { display: block; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }

/* Handeln */
.trade-grid { display: grid; grid-template-columns: 290px 1fr 320px; gap: 12px; align-items: start; }
.watch { padding: 8px; max-height: calc(100vh - 140px); overflow: auto; position: sticky; top: 120px; }
.search { position: relative; padding: 4px 4px 8px; }
.search input { margin: 0; }
.search-results { position: absolute; left: 4px; right: 4px; top: 50px; z-index: 10; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; max-height: 320px; overflow: auto; }
.search-results div { padding: 9px 10px; cursor: pointer; border-bottom: 1px solid var(--line); }
.search-results div:hover { background: var(--panel); }
.search-results small { display: block; color: var(--muted); }
.watchlist .w { display: grid; grid-template-columns: minmax(0,1fr) 64px auto 16px; gap: 6px; align-items: center; padding: 8px; border-radius: 9px; cursor: pointer; }
.watchlist .w:hover { background: var(--bg2); }
.watchlist .w.sel { background: var(--bg2); outline: 1px solid var(--line); }
.w-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-sym { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.w-px { text-align: right; font-variant-numeric: tabular-nums; font-size: 13.5px; }
.w-px small { display: block; font-size: 12px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #55627a; display: inline-block; }
.dot.on { background: var(--up); box-shadow: 0 0 6px var(--up); }
.w-del { visibility: hidden; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 14px; padding: 0 2px; }
.w:hover .w-del { visibility: visible; }
.held { font-size: 10px; background: rgba(59,130,246,.2); color: #93c5fd; border-radius: 4px; padding: 0 4px; }
.group-h { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 10px 8px 4px; }

.inst-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.inst-name { font-size: 20px; font-weight: 800; }
.inst-sub { font-size: 13px; color: var(--muted); }
.inst-price { text-align: right; }
.price { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.change { font-size: 14px; font-variant-numeric: tabular-nums; }
.inst-status { font-size: 13px; margin: 6px 0 10px; color: var(--muted); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.chips button { background: var(--bg2); border: 1px solid var(--line); color: var(--muted); padding: 5px 10px; border-radius: 999px; font: inherit; font-size: 13px; cursor: pointer; }
.chips button.active { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.chart { width: 100%; height: 440px; position: relative; }
.small-chart { height: 260px; }
.chart-legend { font-size: 12.5px; color: var(--muted); margin-top: 6px; min-height: 1.3em; font-variant-numeric: tabular-nums; }

.ticket { position: sticky; top: 120px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--bg); padding: 4px; border-radius: 10px; border: 1px solid var(--line); }
.seg button { background: none; border: 0; color: var(--muted); padding: 9px; border-radius: 7px; font: inherit; font-weight: 700; cursor: pointer; }
.seg button.active { background: var(--bg2); color: var(--text); }
.seg button.buy.active { background: var(--up); color: #052e14; }
.seg button.sell.active { background: var(--down); color: #2b0606; }
.seg.small { margin-top: 12px; }
.seg.small button { padding: 6px; font-size: 13px; }
.quick { display: flex; gap: 6px; margin-top: 8px; }
.quick button { flex: 1; background: var(--bg2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 6px; font: inherit; font-size: 13px; cursor: pointer; }
.preview { margin-top: 12px; font-size: 14px; background: var(--bg); border-radius: 10px; padding: 10px 12px; border: 1px solid var(--line); }
.preview .r { display: flex; justify-content: space-between; padding: 2px 0; font-variant-numeric: tabular-nums; }
.preview .r.tot { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 6px; font-weight: 700; }
.preview .warn { color: var(--accent); font-size: 13px; margin-top: 6px; }
.pos-box { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; font-size: 14px; }
.pos-box .r { display: flex; justify-content: space-between; padding: 2px 0; font-variant-numeric: tabular-nums; }

/* Tabellen */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; }
th:first-child, td:first-child { text-align: left; }
td.l { text-align: left; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--bg2); }
tfoot td { font-weight: 700; border-bottom: 0; }
.empty { color: var(--muted); padding: 18px 4px; }
.alloc { display: flex; height: 14px; border-radius: 7px; overflow: hidden; margin-bottom: 8px; background: var(--bg); }
.alloc div { height: 100%; }
.alloc-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.alloc-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }

/* Statistik */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.card span { display: block; font-size: 12px; color: var(--muted); }
.card b { font-size: 20px; font-variant-numeric: tabular-nums; }
.card small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.insight { margin-top: 16px; background: var(--bg2); border-left: 3px solid var(--accent); padding: 12px 14px; border-radius: 8px; font-size: 14.5px; }
.insight p { margin: 0 0 8px; }
.insight p:last-child { margin: 0; }

/* Lexikon */
.lexikon { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.lex { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.lex b { display: block; margin-bottom: 4px; color: var(--accent); }
.lex p { margin: 0; font-size: 14px; }

.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 18px 12px 30px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line); padding: 12px 16px; border-radius: 12px; z-index: 50; box-shadow: 0 10px 30px rgba(0,0,0,.5); max-width: calc(100% - 32px); font-size: 14px; }
.toast.ok { border-color: rgba(34,197,94,.6); }
.toast.err { border-color: rgba(239,68,68,.6); }

/* Mobil */
@media (max-width: 1150px) {
  .trade-grid { grid-template-columns: 260px 1fr; }
  .ticket { grid-column: 1 / -1; position: static; }
}
@media (max-width: 760px) {
  .topbar { gap: 8px; padding: 8px 12px; }
  .brand-text { display: none; }
  .kpis { gap: 14px; justify-content: flex-start; }
  .kpi b { font-size: 14px; }
  .hide-s { display: none; }
  main { padding: 8px; }
  .trade-grid { grid-template-columns: 1fr; }
  .watch { position: static; max-height: 260px; }
  .chart { height: 320px; }
  .inst-name { font-size: 17px; }
  .price { font-size: 20px; }
  .w-del { visibility: visible; }
}

/* Lernen */
.space { margin-top: 12px; }
.tip { display: flex; gap: 12px; align-items: flex-start; background: linear-gradient(90deg, rgba(245,179,1,.14), rgba(245,179,1,.04)); border: 1px solid rgba(245,179,1,.35); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; font-size: 14.5px; }
.tip .tip-text { flex: 1; }
.tip b { color: var(--accent); }
.tip button { background: none; border: 0; color: var(--muted); font-size: 16px; cursor: pointer; }
.tip .link { color: var(--accent); font: inherit; font-size: 13.5px; text-decoration: underline; padding: 0; margin-top: 4px; display: inline-block; }
.chips.ind { margin-top: -2px; align-items: center; font-size: 13px; }
.chips.ind button.on20 { background: rgba(59,130,246,.2); border-color: #3b82f6; color: #bfdbfe; }
.chips.ind button.on50 { background: rgba(168,85,247,.2); border-color: #a855f7; color: #e9d5ff; }
.coach { background: rgba(59,130,246,.1); border: 1px solid rgba(59,130,246,.45); border-radius: 10px; padding: 11px 12px; margin-bottom: 12px; font-size: 14px; }
.coach .c-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; color: #93c5fd; margin-bottom: 4px; }
.coach .c-head button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 15px; }
.coach .c-act { margin-top: 8px; }
.reasons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.reasons button { background: var(--bg2); border: 1px solid var(--line); color: var(--muted); padding: 5px 9px; border-radius: 999px; font: inherit; font-size: 12.5px; cursor: pointer; }
.reasons button.active { background: rgba(245,179,1,.18); border-color: var(--accent); color: var(--text); }
#note { margin-top: 8px; font-size: 14px; padding: 8px 10px; }
.progress { height: 10px; background: var(--bg); border-radius: 5px; overflow: hidden; margin: 8px 0 4px; }
.progress div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--up)); }
.learn-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.learn-head .big { font-size: 18px; font-weight: 800; }
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.lesson-card { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; display: flex; gap: 12px; align-items: flex-start; }
.lesson-card:hover { border-color: #3a4c6b; }
.lesson-card .ic { font-size: 24px; line-height: 1; }
.lesson-card .t { font-weight: 700; }
.lesson-card .s { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.lesson-card.done { border-color: rgba(34,197,94,.45); }
.lesson-view h2 { font-size: 20px; }
.lesson-view p { margin: 0 0 10px; font-size: 15px; }
.lesson-view details { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 12px 0; }
.lesson-view summary { cursor: pointer; font-weight: 700; color: var(--accent); }
.lesson-view details p { margin-top: 8px; }
.mission { background: rgba(34,197,94,.08); border: 1px solid rgba(34,197,94,.35); border-radius: 10px; padding: 10px 14px; margin: 12px 0; }
.mission.open { background: rgba(245,179,1,.08); border-color: rgba(245,179,1,.4); }
.quiz-q { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 10px 0; }
.quiz-q .qq { font-weight: 700; margin-bottom: 6px; }
.quiz-q label { display: flex; gap: 8px; align-items: flex-start; color: var(--text); font-size: 14.5px; margin: 6px 0 0; cursor: pointer; }
.quiz-q input { width: auto; margin: 3px 0 0; display: inline; }
.quiz-q .why { font-size: 13.5px; margin-top: 8px; }
.quiz-q.right { border-color: rgba(34,197,94,.6); }
.quiz-q.wrong { border-color: rgba(239,68,68,.6); }
.coach-item { border-left: 3px solid #3b82f6; padding: 6px 10px; margin: 6px 0; background: var(--bg2); border-radius: 0 8px 8px 0; font-size: 14px; }
.coach-item small { color: var(--muted); display: block; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* Marktleiste */
.marketbar { display: flex; gap: 8px; padding: 8px 12px 0; overflow-x: auto; max-width: 1500px; margin: 0 auto; scrollbar-width: none; }
.marketbar::-webkit-scrollbar { display: none; }
.mb { display: grid; grid-template-columns: auto auto; gap: 0 10px; align-items: baseline; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px 11px; color: var(--text); font: inherit; cursor: pointer; white-space: nowrap; }
.mb.sel { border-color: var(--accent); }
.mb-n { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; grid-column: 1 / -1; }
.mb-v { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.mb-c { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.challenge { background: linear-gradient(90deg, rgba(59,130,246,.16), rgba(59,130,246,.04)); border-color: rgba(59,130,246,.45); }
.challenge b { color: #93c5fd; }
/* Planer */
.plan { margin-top: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.plan summary { cursor: pointer; font-weight: 700; font-size: 14px; }
.plan[open] summary { margin-bottom: 4px; }
.plan-box { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 6px; }
/* Nachrichten */
.news-wrap h3 { margin-top: 16px; }
.news-item { display: block; padding: 9px 0; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.news-item:hover .nt { color: var(--accent); }
.news-item .nt { display: block; font-size: 14.5px; font-weight: 600; }
.news-item .nm { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
/* Abzeichen */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.bdg { display: flex; gap: 12px; align-items: flex-start; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; opacity: .55; }
.bdg .bi { font-size: 26px; line-height: 1; filter: grayscale(1); }
.bdg.got { opacity: 1; border-color: rgba(245,179,1,.5); }
.bdg.got .bi { filter: none; }
.bdg small { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.bdg small.up { color: var(--up); }
/* Elternbereich */
.admin-card { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-top: 12px; }
.ac-head { display: flex; justify-content: space-between; gap: 12px; }
.ac-kpi { text-align: right; display: flex; flex-direction: column; font-weight: 700; font-variant-numeric: tabular-nums; }
.ac-stats { font-size: 13px; color: var(--muted); margin-top: 6px; }
.ac-rules { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 14px; }
.ac-rules .chk { display: flex; gap: 8px; align-items: center; margin-top: 30px; color: var(--text); font-size: 14px; }
.ac-rules .chk input { width: auto; margin: 0; }
.ac-rules .wide { grid-column: 1 / -1; }
.preview .r span:last-child { text-align: right; }
.ac-view { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 4px; }
.trade-grid > * { min-width: 0; }
.chart { overflow: hidden; }

.btn.danger { border-color: rgba(239,68,68,.55); color: #fca5a5; }
.btn.danger:hover { background: rgba(239,68,68,.12); }
