/* NovaInvest - Tactical Telemetry Design.
   Dunkles Terminal: Mono-Typografie fuer alle Daten, harte 90-Grad-Ecken,
   1px-Trennlinien ueber grid-gap, eine Akzentfarbe (Blau), semantisches
   Gruen/Rot fuer Gewinn/Verlust. Chartfarben sind CVD-validiert. */

@font-face {
  font-family: 'JetBrains Mono';
  src: url('/static/fonts/jetbrains-mono-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/static/fonts/jetbrains-mono-500.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/static/fonts/jetbrains-mono-700.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Archivo Black';
  src: url('/static/fonts/archivo-black-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  --bg: #0A0B0E;
  --panel: #0D0F14;
  --panel-2: #10131A;
  --line: #1D2430;
  --line-strong: #2B3648;
  --text: #E8EAED;
  --text-2: #9AA3B2;
  --text-3: #5F6979;
  --accent: #3B8AE0;
  --accent-dim: rgba(59, 138, 224, 0.14);
  --up: #3FB950;
  --up-dim: rgba(63, 185, 80, 0.12);
  --down: #F85149;
  --down-dim: rgba(248, 81, 73, 0.12);
  --warn: #D29922;
  --hazard: #FF2A2A;
  --cat-1: #3B8AE0;
  --cat-2: #B8862B;
  --cat-3: #9C74DB;
  --cat-4: #199B90;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', monospace;
  --display: 'Archivo Black', 'Arial Black', sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { background: var(--bg); }

body {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* Feines statisches Rauschen, fixiert und klickdurchlaessig. */
body::after {
  content: '';
  position: fixed; inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0.022;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--accent); color: #04070C; }

/* ------------------------------------------------------------ Header */

header {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--line-strong);
  background: var(--panel);
  position: sticky; top: 0; z-index: 50;
  height: 52px;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px;
  border-right: 1px solid var(--line);
  white-space: nowrap;
}
.brand .mark {
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: 0.04em;
}
.brand .mark span { color: var(--accent); }

.live {
  display: flex; align-items: center; gap: 6px;
  font-size: 10px; letter-spacing: 0.16em; color: var(--text-3);
  text-transform: uppercase;
}
.live .dot {
  width: 6px; height: 6px; background: var(--up);
  animation: pulse 2.2s var(--ease) infinite;
}
.live.stale .dot { background: var(--warn); animation: none; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }

nav {
  display: flex; flex: 1; overflow-x: auto; scrollbar-width: none;
}
nav::-webkit-scrollbar { display: none; }
nav a {
  display: flex; align-items: center;
  padding: 0 16px;
  color: var(--text-2);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-right: 1px solid var(--line);
  transition: color 0.35s var(--ease), background 0.35s var(--ease), box-shadow 0.35s var(--ease);
  white-space: nowrap;
}
nav a:hover { color: var(--text); text-decoration: none; background: var(--panel-2); }
nav a.active {
  color: var(--text);
  background: var(--accent-dim);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.head-right {
  display: flex; align-items: center; gap: 14px;
  padding: 0 16px;
  border-left: 1px solid var(--line);
  color: var(--text-3); font-size: 11px;
  white-space: nowrap;
}
.head-right button {
  background: none; border: 1px solid var(--line-strong);
  color: var(--text-2); font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 5px 10px; cursor: pointer;
  transition: all 0.3s var(--ease);
}
.head-right button:hover { border-color: var(--text-2); color: var(--text); }

/* ------------------------------------------------------------ Ticker */

.ticker {
  display: flex;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  overflow-x: auto; scrollbar-width: none;
}
.ticker::-webkit-scrollbar { display: none; }
.tick {
  display: flex; align-items: baseline; gap: 8px;
  padding: 7px 16px;
  border-right: 1px solid var(--line);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.3s var(--ease);
}
.tick:hover { background: var(--panel-2); }
.tick .sym { color: var(--text-3); font-size: 10px; letter-spacing: 0.1em; }
.tick .val { color: var(--text); font-weight: 500; }

/* ------------------------------------------------------------ Layout */

main {
  max-width: 1480px;
  margin: 0 auto;
  padding: 18px 16px 60px;
}

.view { animation: viewin 0.55s var(--ease); }
@keyframes viewin {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .view { animation: none; }
  .live .dot { animation: none; }
  * { transition-duration: 0.01ms !important; }
}

.grid {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.panel {
  background: var(--panel);
  padding: 16px 18px;
  min-width: 0;
}
.panel.pad-0 { padding: 0; }

.panel-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 12px; gap: 10px; flex-wrap: wrap;
}
.panel-title {
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-3);
}
.panel-title::before { content: '[ '; color: var(--line-strong); }
.panel-title::after { content: ' ]'; color: var(--line-strong); }

.section-title {
  font-family: var(--display);
  font-size: clamp(20px, 3.2vw, 30px);
  letter-spacing: 0.01em;
  text-transform: uppercase;
  margin: 26px 0 14px;
  line-height: 0.95;
}
.section-title:first-child { margin-top: 4px; }
.section-sub { color: var(--text-3); font-size: 11px; margin: -8px 0 14px; }

/* ------------------------------------------------------------ Zahlen */

.big-number {
  font-size: clamp(30px, 5vw, 46px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.mid-number { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; }

.kv { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kv .k {
  font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-3);
}
.kv .v { font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; }

.up { color: var(--up); }
.down { color: var(--down); }
.dim { color: var(--text-3); }
.muted { color: var(--text-2); }

.flash-up { animation: fup 0.9s var(--ease); }
.flash-down { animation: fdown 0.9s var(--ease); }
@keyframes fup { 0% { background: var(--up-dim); } 100% { background: transparent; } }
@keyframes fdown { 0% { background: var(--down-dim); } 100% { background: transparent; } }

/* ------------------------------------------------------------ Tabellen */

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th {
  text-align: left;
  font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-3); font-weight: 400;
  padding: 6px 10px 6px 0;
  border-bottom: 1px solid var(--line-strong);
}
td {
  padding: 8px 10px 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  vertical-align: baseline;
}
tr:last-child td { border-bottom: none; }
th.num, td.num { text-align: right; padding-left: 12px; white-space: nowrap; }
th.num:last-child, td.num:last-child { padding-right: 0; }
tbody tr { transition: background 0.25s var(--ease); }
tbody tr:hover { background: var(--panel-2); }

/* ------------------------------------------------------------ Buttons & Formulare */

button, .btn {
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-strong);
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.3s var(--ease);
}
button:hover, .btn:hover { border-color: var(--accent); color: var(--accent); }
button:active, .btn:active { transform: translateY(1px); }
button.primary {
  background: var(--accent); border-color: var(--accent); color: #04070C;
  font-weight: 700;
}
button.primary:hover { background: #2F79CB; color: #04070C; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.small { padding: 4px 10px; font-size: 10px; }
button.danger:hover { border-color: var(--down); color: var(--down); }

label { display: block; margin-bottom: 12px; }
label .lbl {
  display: block;
  font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 4px;
}
label .hint { display: block; font-size: 10.5px; color: var(--text-3); margin-top: 3px; }

input[type=text], input[type=password], input[type=number], input[type=date],
input[type=time], select, textarea {
  width: 100%;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  padding: 8px 10px;
  transition: border-color 0.3s var(--ease);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}
input::placeholder { color: var(--text-3); }

.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: auto; accent-color: var(--accent); }

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

.msg { padding: 9px 12px; font-size: 12px; margin: 10px 0; border: 1px solid; }
.msg.ok { border-color: var(--up); color: var(--up); background: var(--up-dim); }
.msg.err { border-color: var(--down); color: var(--down); background: var(--down-dim); }

/* ------------------------------------------------------------ Charts */

.chart-box { position: relative; width: 100%; }
.chart-box .empty-chart {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 11px; letter-spacing: 0.08em;
  text-align: center; padding: 20px;
}

.range-btns { display: flex; gap: 1px; background: var(--line); border: 1px solid var(--line); width: max-content; }
.range-btns button {
  border: none; background: var(--panel); padding: 5px 11px; font-size: 10px;
}
.range-btns button.active { background: var(--accent-dim); color: var(--accent); }

/* Allokations-Balken: 2px Luecken zwischen den Segmenten (Dataviz-Spacer). */
.alloc-bar { display: flex; gap: 2px; height: 22px; background: var(--bg); }
.alloc-bar div { min-width: 2px; transition: width 0.8s var(--ease); }
.legend { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.legend .row { display: flex; align-items: baseline; gap: 8px; font-size: 12px; }
.legend .swatch { width: 9px; height: 9px; flex: none; align-self: center; }
.legend .name { color: var(--text-2); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend .pct { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ Watchlist / Maerkte */

.market-layout { display: grid; grid-template-columns: 290px 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.watchlist { background: var(--panel); max-height: 640px; overflow-y: auto; }
.watch-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.25s var(--ease);
  gap: 8px;
}
.watch-item:hover { background: var(--panel-2); }
.watch-item.active { background: var(--accent-dim); box-shadow: inset 2px 0 0 var(--accent); }
.watch-item .wi-name { font-size: 10px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watch-item .wi-sym { font-weight: 500; font-size: 12px; }
.watch-item .wi-right { text-align: right; font-variant-numeric: tabular-nums; flex: none; }
.wi-controls { display: none; flex: none; gap: 0; margin-left: auto; }
.watch-item:hover .wi-controls { display: flex; }
@media (hover: none) { .wi-controls { display: flex; } }
.wi-controls button {
  border: none; background: none; padding: 2px 4px;
  font-size: 10px; color: var(--text-3); line-height: 1;
}
.wi-controls button:hover { color: var(--accent); }
.wi-controls button[data-act=del] { font-size: 13px; }
.wi-controls button[data-act=del]:hover { color: var(--down); }
.watch-item .wi-price { font-size: 12px; }
.watch-item .wi-chg { font-size: 11px; }

/* ------------------------------------------------------------ News */

.news-item {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.news-item:last-child { border-bottom: none; }
.news-meta { font-size: 10px; color: var(--text-3); line-height: 1.7; }
.news-meta .src { display: block; letter-spacing: 0.08em; text-transform: uppercase; }
.news-title { font-size: 13px; line-height: 1.45; }
.news-title a { color: var(--text); }
.news-title a:hover { color: var(--accent); }
.news-note {
  margin-top: 5px;
  font-size: 12px;
  color: var(--text-2);
  border-left: 2px solid var(--accent);
  padding-left: 9px;
}
.news-note::before { content: 'KI '; font-size: 9px; letter-spacing: 0.14em; color: var(--accent); }

.filter-btns { display: flex; gap: 1px; background: var(--line); border: 1px solid var(--line); width: max-content; }
.filter-btns button { border: none; background: var(--panel); padding: 5px 12px; font-size: 10px; }
.filter-btns button.active { background: var(--accent-dim); color: var(--accent); }

/* ------------------------------------------------------------ Strategie-Karten */

.strat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.strat {
  background: var(--panel);
  padding: 16px;
  cursor: pointer;
  transition: background 0.3s var(--ease);
  display: flex; flex-direction: column; gap: 9px;
}
.strat:hover { background: var(--panel-2); }
.strat.active { background: var(--accent-dim); box-shadow: inset 0 2px 0 var(--accent); }
.strat h3 { font-size: 14px; font-weight: 700; letter-spacing: 0.02em; }
.strat .desc { font-size: 11.5px; color: var(--text-2); flex: 1; }
.strat .weights { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.strat .state { font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-3); }
.strat.active .state { color: var(--accent); }

/* ------------------------------------------------------------ Sonstiges */

.timeline-amount { font-weight: 700; font-size: 14px; }
.badge {
  display: inline-block;
  font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase;
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  padding: 1px 6px;
}
.badge.accent { border-color: var(--accent); color: var(--accent); }
.badge.warn { border-color: var(--warn); color: var(--warn); }

.callout {
  border-left: 2px solid var(--accent);
  padding: 8px 0 8px 12px;
  font-size: 13px;
  background: var(--accent-dim);
}

.disclaimer {
  margin-top: 26px;
  padding: 10px 0 0;
  border-top: 1px solid var(--line);
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.03em;
}

.onboard { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.onboard .step { background: var(--panel); padding: 18px; }
.onboard .n {
  font-family: var(--display); font-size: 26px; color: var(--accent);
  line-height: 1; margin-bottom: 10px;
}
.onboard h3 { font-size: 13px; margin-bottom: 6px; }
.onboard p { font-size: 11.5px; color: var(--text-2); }

.skeleton {
  background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 50%, var(--panel) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
  min-height: 60px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.empty-state { padding: 26px 10px; text-align: center; color: var(--text-3); font-size: 12px; }
.empty-state .es-title { color: var(--text-2); font-size: 13px; margin-bottom: 4px; }

/* ------------------------------------------------------------ Login */

.login-wrap {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.login-box {
  width: 100%; max-width: 360px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  padding: 28px;
}
.login-box .mark { font-family: var(--display); font-size: 19px; margin-bottom: 4px; }
.login-box .mark span { color: var(--accent); }
.login-box .sub { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-3); margin-bottom: 22px; }

/* ------------------------------------------------------------ Responsive */

@media (max-width: 900px) {
  /* Inline gesetzte Spalten-Layouts hart auf eine Spalte zwingen. */
  .grid { grid-template-columns: 1fr !important; }
  .grid.kv-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .market-layout { grid-template-columns: 1fr; }
  .watchlist { max-height: 260px; }
  .news-item { grid-template-columns: 1fr; gap: 4px; }
  .news-meta { display: flex; gap: 10px; }
}
@media (max-width: 640px) {
  main { padding: 12px 10px 50px; }
  .panel { padding: 12px; }
  .brand { padding: 0 12px; }
  .head-right .clock { display: none; }
  nav a { padding: 0 11px; }
}
