/* ═══════════════════════════════════════════
   DESIGN TOKENS – Dark Mode (Standard)
═══════════════════════════════════════════ */
:root {
  --bg:          #0a0b0e;
  --bg-2:        #111318;
  --bg-3:        #181b22;
  --bg-4:        #1e222b;
  --bg-hover:    #242830;

  --border:      #252933;
  --border-2:    #2f3542;

  --txt:         #f0ede8;
  --txt-2:       #9a96a0;
  --txt-3:       #56535e;

  --gold:        #c8a96e;
  --gold-2:      #e8d09a;
  --gold-dim:    rgba(200,169,110,0.10);
  --gold-glow:   rgba(200,169,110,0.20);

  --emerald:     #3db88a;
  --emerald-dim: rgba(61,184,138,0.10);
  --crimson:     #e05c5c;
  --crimson-dim: rgba(224,92,92,0.10);
  --amber:       #e8a83a;
  --amber-dim:   rgba(232,168,58,0.10);
  --sapphire:    #5c8ee0;
  --sapphire-dim:rgba(92,142,224,0.10);

  --shadow-card: 0 2px 12px rgba(0,0,0,0.4);
  --shadow-modal:0 24px 60px rgba(0,0,0,0.6);

  --r-sm: 6px;
  --r:    10px;
  --r-lg: 16px;
  --r-xl: 24px;

  --f-display: 'Cormorant Garamond', serif;
  --f-ui:      'Syne', sans-serif;
  --f-mono:    'JetBrains Mono', monospace;

  --sidebar-w: 272px;
  --nav-h:     54px;
}

/* ═══════════════════════════════════════════
   LIGHT MODE – aktiv wenn html.light-mode
═══════════════════════════════════════════ */
html.light-mode {
  /* Weiße Hauptflächen */
  --bg:          #ffffff;
  --bg-2:        #f8f9fa;
  --bg-3:        #f1f3f5;
  --bg-4:        #e9ecef;
  --bg-hover:    #e2e6ea;

  --border:      #dee2e6;
  --border-2:    #ced4da;

  --txt:         #212529;
  --txt-2:       #495057;
  --txt-3:       #868e96;

  /* Gold bleibt konsistent */
  --gold:        #c8a96e;
  --gold-2:      #e8d09a;
  --gold-dim:    rgba(200,169,110,0.15);
  --gold-glow:   rgba(200,169,110,0.25);

  --emerald:     #2f9e6f;
  --emerald-dim: rgba(47,158,111,0.12);
  --crimson:     #e03131;
  --crimson-dim: rgba(224,49,49,0.10);
  --amber:       #e67700;
  --amber-dim:   rgba(230,119,0,0.10);
  --sapphire:    #1971c2;
  --sapphire-dim:rgba(25,113,194,0.10);

  --shadow-card: 0 1px 4px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.04);
  --shadow-modal:0 20px 60px rgba(0,0,0,0.15);
}

/* ── Light Mode: Sidebar & Topbar anthrazit ── */
html.light-mode #sidebar {
  background: #2d3142 !important;
  border-color: #3d4258 !important;
}
html.light-mode .sb-logo-name,
html.light-mode .sb-logo-sub,
html.light-mode .sb-user-name,
html.light-mode .sb-user-email,
html.light-mode .sb-section-label {
  color: #c8ccd8 !important;
}
html.light-mode .sb-version {
  color: #6b7089 !important;
}
html.light-mode .sb-logout-btn {
  color: #9a9eb8 !important;
}
html.light-mode .sb-logout-btn:hover { color: var(--crimson) !important; }
html.light-mode #sb-admin-btn {
  background: rgba(200,169,110,0.2) !important;
  border-color: var(--gold) !important;
  color: var(--gold) !important;
}
html.light-mode .sb-user-card {
  background: rgba(255,255,255,0.08) !important;
  border-color: rgba(255,255,255,0.12) !important;
}
html.light-mode .proj-item {
  color: #c8ccd8 !important;
}
html.light-mode .proj-item:hover,
html.light-mode .proj-item.active {
  background: rgba(200,169,110,0.15) !important;
  color: var(--gold) !important;
}
html.light-mode .proj-dot { background: #6b7089 !important; }
html.light-mode .proj-item.active .proj-dot { background: var(--gold) !important; }
html.light-mode .btn-new-proj {
  border-color: rgba(200,169,110,0.3) !important;
  color: var(--gold) !important;
}
html.light-mode .btn-new-proj:hover {
  background: rgba(200,169,110,0.15) !important;
}
html.light-mode .sync-row { color: #6b7089 !important; }

/* ── Light Mode: Top-Navigation anthrazit ── */
html.light-mode #main-header,
html.light-mode #area-nav {
  background: #2d3142 !important;
  border-color: #3d4258 !important;
}
html.light-mode .area-tab {
  color: #9a9eb8 !important;
}
html.light-mode .area-tab:hover { color: #c8ccd8 !important; }
html.light-mode .area-tab.active {
  color: var(--gold) !important;
  border-bottom-color: var(--gold) !important;
}

/* ── Light Mode: Karten & Content ── */
html.light-mode .card {
  background: #ffffff;
  border-color: var(--border);
  box-shadow: var(--shadow-card);
}
html.light-mode .fi {
  background: #ffffff;
  border-color: var(--border-2);
  color: var(--txt);
}
html.light-mode .fi:focus {
  border-color: var(--gold);
  background: #ffffff;
}
html.light-mode .mod-tab,
html.light-mode .wealth-tab {
  color: var(--txt-3) !important;
}
html.light-mode .mod-tab.active,
html.light-mode .wealth-tab.active {
  color: var(--txt) !important;
  border-bottom-color: var(--gold) !important;
}
html.light-mode #invest-nav,
html.light-mode #wealth-nav {
  background: #ffffff !important;
  border-color: var(--border) !important;
}

/* Sanfte Übergänge beim Modus-Wechsel */
*, *::before, *::after {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.15s ease;
  box-sizing: border-box; margin: 0; padding: 0;
}
*[class*="anim"], canvas, .sync-dot, .loading-spinner {
  transition: none !important;
}

html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  height: 100%;
  font-family: var(--f-ui);
  background: var(--bg);
  color: var(--txt);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
input, select, textarea, button { font-family: inherit; font-size: inherit; }
button { cursor: pointer; border: none; background: none; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }

/* ═══════════════════════════════════════════
   LOGIN SCREEN
═══════════════════════════════════════════ */
#login-screen {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
  overflow-y: auto;
}
#login-screen::before {
  content: '';
  position: fixed;
  top: -20%; left: 50%;
  transform: translateX(-50%);
  width: 500px; height: 500px;
  background: radial-gradient(circle, var(--gold-glow) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.login-box {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 44px 40px;
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-modal);
}
@media (max-width:480px) {
  .login-box { padding: 36px 24px; border-radius: var(--r-lg); }
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo-mark {
  width: 52px; height: 52px;
  background: var(--gold-dim);
  border: 1px solid var(--gold);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  margin: 0 auto 14px;
}
.login-logo h1 {
  font-family: var(--f-display);
  font-size: 28px;
  color: var(--gold);
  letter-spacing: 0.02em;
  font-weight: 600;
}
.login-logo p {
  font-size: 12px;
  color: var(--txt-3);
  font-family: var(--f-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 4px;
}
.login-tabs {
  display: flex;
  background: var(--bg-3);
  border-radius: var(--r);
  padding: 3px;
  margin-bottom: 28px;
}
.login-tab {
  flex: 1; padding: 8px; text-align: center;
  font-size: 13px; font-weight: 600;
  color: var(--txt-3); border-radius: var(--r-sm);
  cursor: pointer; transition: all 0.2s;
}
.login-tab.active { background: var(--bg-4); color: var(--txt); }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-label {
  display: block; font-size: 11px; font-weight: 600;
  color: var(--txt-3); text-transform: uppercase;
  letter-spacing: 0.06em; margin-bottom: 5px;
}
.login-input {
  width: 100%; background: var(--bg-3);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  color: var(--txt); padding: 12px 14px;
  font-size: 15px; font-family: var(--f-mono);
  transition: border-color 0.15s;
}
.login-input:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}
.btn-login {
  padding: 14px; background: var(--gold); color: #0a0b0e;
  border-radius: var(--r); font-weight: 700; font-size: 14px;
  letter-spacing: 0.04em; text-transform: uppercase;
  transition: all 0.15s; margin-top: 6px;
}
.btn-login:hover { background: var(--gold-2); box-shadow: 0 4px 20px var(--gold-glow); }
.login-error {
  color: var(--crimson); font-size: 12px; text-align: center;
  padding: 8px; background: var(--crimson-dim);
  border-radius: var(--r-sm); display: none;
}
.login-reset {
  text-align: center; font-size: 12px;
  color: var(--txt-3); cursor: pointer; margin-top: 4px;
}
.login-reset:hover { color: var(--gold); }

/* "Angemeldet bleiben" */
.login-remember {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; user-select: none;
}
.login-remember input[type=checkbox] {
  appearance: none; -webkit-appearance: none;
  width: 20px; height: 20px;
  border: 1.5px solid var(--border-2);
  border-radius: 5px; background: var(--bg-3);
  flex-shrink: 0; cursor: pointer; position: relative;
  transition: all 0.15s;
}
.login-remember input[type=checkbox]:checked {
  background: var(--gold); border-color: var(--gold);
}
.login-remember input[type=checkbox]:checked::after {
  content: ''; position: absolute;
  left: 5px; top: 2px; width: 7px; height: 11px;
  border: 2px solid #0a0b0e;
  border-top: none; border-left: none;
  transform: rotate(42deg);
}
.login-remember-lbl { font-size: 13px; color: var(--txt-2); font-weight: 500; }

/* ═══════════════════════════════════════════
   APP SHELL
═══════════════════════════════════════════ */
#app-shell { display: none; height: 100dvh; overflow: hidden; }
#app-shell.desktop-layout { display: flex; flex-direction: row; }
#app-shell.desktop-layout #sidebar { position: relative; height: auto; }
#app-shell.desktop-layout #main { margin-left: 0; }

/* ── Sidebar ── */
#sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  background: var(--bg-2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden; height: 100%;
  position: absolute; top: 0; left: 0; bottom: 0; z-index: 50;
}
.sb-header { padding: 22px 20px 18px; border-bottom: 1px solid var(--border); }
.sb-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.sb-logo-mark {
  width: 34px; height: 34px; background: var(--gold-dim);
  border: 1px solid var(--gold); border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.sb-brand-name {
  font-family: var(--f-display); font-size: 19px;
  color: var(--gold); letter-spacing: 0.02em;
  font-weight: 600; line-height: 1;
}
.sb-brand-sub { font-size: 9px; color: var(--txt-3); font-family: var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.sb-user {
  display: flex; align-items: center; gap: 9px;
  background: var(--bg-3); border-radius: var(--r);
  padding: 9px 10px;
}
.sb-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--gold-dim); border: 1.5px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--gold); flex-shrink: 0;
}
.sb-user-name { font-size: 12px; font-weight: 600; color: var(--txt); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-email { font-size: 10px; color: var(--txt-3); font-family: var(--f-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-logout-btn {
  font-size: 14px; color: var(--txt-3); padding: 3px;
  border-radius: 4px; flex-shrink: 0; transition: all .15s;
}
.sb-logout-btn:hover { color: var(--crimson); background: var(--crimson-dim); }
.sb-section-label {
  font-size: 9px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--txt-3);
  padding: 14px 16px 6px;
}
#project-list { flex: 1; overflow-y: auto; padding: 0 8px; }
.proj-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--r-sm);
  cursor: pointer; transition: background .15s;
  margin-bottom: 2px;
}
.proj-item:hover { background: var(--bg-hover); }
.proj-item.active { background: var(--gold-dim); }
.proj-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--border-2); flex-shrink: 0;
}
.proj-item.active .proj-dot { background: var(--gold); }
.proj-item-name { flex: 1; font-size: 12px; color: var(--txt-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-item.active .proj-item-name { color: var(--gold); font-weight: 600; }
.proj-del {
  font-size: 15px; color: var(--txt-3); opacity: 0;
  transition: opacity .15s; padding: 0 2px;
}
.proj-item:hover .proj-del { opacity: 1; }
.proj-del:hover { color: var(--crimson); }
.btn-new-proj {
  margin: 8px; padding: 10px 12px;
  background: var(--gold-dim); color: var(--gold);
  border: 1px solid var(--gold); border-radius: var(--r-sm);
  font-size: 12px; font-weight: 600; text-align: center;
  transition: all .15s; cursor: pointer;
}
.btn-new-proj:hover { background: var(--gold); color: #0a0b0e; }
.sync-bar {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-top: 1px solid var(--border);
  font-size: 10px; color: var(--txt-3); font-family: var(--f-mono);
}
.sync-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--emerald); box-shadow: 0 0 5px var(--emerald);
}
.sync-dot.syncing { background: var(--amber); box-shadow: 0 0 5px var(--amber); animation: pulse .9s infinite; }
.sync-dot.error { background: var(--crimson); box-shadow: 0 0 5px var(--crimson); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

.sb-footer {
  padding: 6px 14px 10px;
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--border);
}
.sb-version { font-size: 9px; font-family: var(--f-mono); color: var(--txt-3); letter-spacing: .06em; }
.sb-settings-btn {
  font-size: 15px; color: var(--txt-3); padding: 4px 8px;
  border-radius: var(--r-sm); transition: all .15s; cursor: pointer;
}
.sb-settings-btn:hover { color: var(--gold); background: var(--gold-dim); }

/* ── Main + Nav ── */
#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
#module-nav {
  display: flex; background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  padding: 0 20px; gap: 2px; flex-shrink: 0;
}
.mod-tab {
  padding: 14px 16px; font-size: 12px; font-weight: 600;
  color: var(--txt-3); border-bottom: 2px solid transparent;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.mod-tab:hover { color: var(--txt); }
.mod-tab.active { color: var(--gold); border-bottom-color: var(--gold); }

#content { flex: 1; overflow-y: auto; padding: 28px 32px; }

/* ── Pages ── */
.page-title {
  font-family: var(--f-display); font-size: 28px;
  font-weight: 600; color: var(--txt); line-height: 1.1;
  letter-spacing: .01em; margin-bottom: 4px;
}
.page-sub { font-size: 12px; color: var(--txt-3); margin-bottom: 22px; }
.sec-label {
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--txt-3);
  margin: 22px 0 10px;
}
.card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 20px; margin-bottom: 10px;
  box-shadow: var(--shadow-card);
}
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.g3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.g4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; }
.kpi {
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 16px 18px;
}
.kpi.gold   { border-color: var(--gold);    background: var(--gold-dim); }
.kpi.em     { border-color: var(--emerald); background: var(--emerald-dim); }
.kpi.cr     { border-color: var(--crimson); background: var(--crimson-dim); }
.kpi.am     { border-color: var(--amber);   background: var(--amber-dim); }
.kpi.sapphire{ border-color: var(--sapphire); background: var(--sapphire-dim); }
.kpi.crimson { border-color: var(--crimson); background: var(--crimson-dim); }
.kpi.emerald { border-color: var(--emerald); background: var(--emerald-dim); }
.kpi-lbl { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--txt-3); margin-bottom: 6px; }
.kpi-val { font-family: var(--f-mono); font-size: 20px; font-weight: 500; color: var(--txt); line-height: 1; }
.kpi-val.gold    { color: var(--gold-2); }
.kpi-val.em      { color: var(--emerald); }
.kpi-val.cr      { color: var(--crimson); }
.kpi-val.am      { color: var(--amber); }
.kpi-val.sapphire{ color: var(--sapphire); }
.kpi-val.crimson { color: var(--crimson); }
.kpi-val.emerald { color: var(--emerald); }
.kpi-sub { font-size: 10px; color: var(--txt-3); margin-top: 4px; }

/* Form */
.fg { display: flex; flex-direction: column; gap: 5px; }
.fl { font-size: 10px; font-weight: 700; color: var(--txt-2); letter-spacing: .05em; text-transform: uppercase; }
.fl .req { color: var(--gold); margin-left: 2px; }
.fi, .fs, .fta {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--txt);
  padding: 10px 12px; width: 100%;
  font-family: var(--f-mono); font-size: 14px;
  transition: border-color .15s;
}
.fi:focus, .fs:focus, .fta:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}
.fi[type=number]::-webkit-outer-spin-button,
.fi[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }
.fhint { font-size: 11px; color: var(--txt-3); }

/* Toggle */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }
.tgl-lbl { font-size: 13px; }
.tgl-hint { font-size: 11px; color: var(--txt-3); }
.tgl { position: relative; width: 40px; height: 23px; flex-shrink: 0; }
.tgl input { opacity: 0; width: 0; height: 0; }
.tgl-s {
  position: absolute; inset: 0;
  background: var(--border-2); border-radius: 12px; cursor: pointer; transition: .2s;
}
.tgl-s::after {
  content: ''; position: absolute;
  width: 17px; height: 17px; left: 3px; top: 3px;
  background: var(--txt-2); border-radius: 50%; transition: .2s;
}
.tgl input:checked + .tgl-s { background: var(--gold-dim); border: 1px solid var(--gold); }
.tgl input:checked + .tgl-s::after { transform: translateX(17px); background: var(--gold); }

/* Range */
.rng-row { display: flex; align-items: center; gap: 10px; }
.rng-row input[type=range] {
  flex: 1; -webkit-appearance: none;
  height: 4px; background: var(--border-2); border-radius: 2px; cursor: pointer;
}
.rng-row input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--gold); border: 2px solid var(--bg-3);
}
.rng-val { font-family: var(--f-mono); font-size: 13px; color: var(--gold-2); min-width: 46px; text-align: right; }

/* Buttons */
.btn { padding: 9px 18px; border-radius: var(--r-sm); font-size: 13px; font-weight: 600; transition: all .15s; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.btn-primary { background: var(--gold); color: #0a0b0e; }
.btn-primary:hover { background: var(--gold-2); box-shadow: 0 4px 14px var(--gold-glow); }
.btn-ghost { background: var(--bg-hover); color: var(--txt); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--border-2); }
.btn-danger { background: var(--crimson-dim); color: var(--crimson); border: 1px solid var(--crimson); }
.btn-danger:hover { background: var(--crimson); color: #fff; }
.btn-bar { display: flex; gap: 10px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); }

/* Badge */
.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; font-family: var(--f-mono); }
.badge.em { background: var(--emerald-dim); color: var(--emerald); }
.badge.cr { background: var(--crimson-dim); color: var(--crimson); }
.badge.go { background: var(--gold-dim); color: var(--gold-2); }

/* Table */
.tbl-wrap { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--border); -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl th { background: var(--bg-hover); color: var(--txt-3); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 9px 12px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl th:first-child { text-align: left; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: right; font-family: var(--f-mono); color: var(--txt-2); }
.tbl td:first-child { text-align: left; font-family: var(--f-ui); color: var(--txt); }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--bg-hover); }
.tbl .pos { color: var(--emerald); }
.tbl .neg { color: var(--crimson); }
.tbl .hi  { color: var(--gold-2); font-weight: 500; }

/* Chart */
.chart-wrap { background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px; overflow: hidden; }
.chart-lbl { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--txt-3); margin-bottom: 14px; }

/* Info */
.info { background: var(--bg-hover); border: 1px solid var(--border-2); border-left: 3px solid var(--gold); border-radius: var(--r-sm); padding: 11px 14px; font-size: 12px; color: var(--txt-2); line-height: 1.6; margin-top: 10px; }
.info strong { color: var(--txt); }

/* Ampel */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.dot.em { background: var(--emerald); box-shadow: 0 0 5px var(--emerald); }
.dot.am { background: var(--amber);   box-shadow: 0 0 5px var(--amber); }
.dot.cr { background: var(--crimson); box-shadow: 0 0 5px var(--crimson); }

/* Module views */
.mod-view { display: none; }
.mod-view.active { display: block; animation: fadeUp .2s ease; }
@keyframes fadeUp { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:none} }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
#toast {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--bg-3); border: 1px solid var(--emerald); color: var(--emerald);
  padding: 11px 16px; border-radius: var(--r); font-size: 13px; font-weight: 500;
  z-index: 999; opacity: 0; transform: translateY(8px);
  transition: all .25s; pointer-events: none;
}
#toast.show { opacity: 1; transform: none; }
#toast.err { border-color: var(--crimson); color: var(--crimson); }

/* Loading */
#loading-overlay {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 16px; z-index: 1000;
}
.loading-logo { font-family: var(--f-display); font-size: 32px; color: var(--gold); }
.loading-spinner {
  width: 28px; height: 28px;
  border: 2px solid var(--border-2); border-top-color: var(--gold);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}

/* ═══════════════════════════════════════════
   EINSTELLUNGEN MODAL
═══════════════════════════════════════════ */
#settings-overlay {
  display: none; position: fixed; inset: 0; z-index: 400;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(6px);
  align-items: center; justify-content: center; padding: 20px;
}
#settings-overlay.open { display: flex; }
#settings-modal {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-xl); width: 100%; max-width: 480px;
  max-height: 90dvh; overflow-y: auto;
  box-shadow: var(--shadow-modal); animation: fadeUp .2s ease;
}
.set-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 26px 18px; border-bottom: 1px solid var(--border);
}
.set-header h3 { font-family: var(--f-display); font-size: 20px; font-weight: 600; color: var(--txt); }
.set-close {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg-3); color: var(--txt-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; cursor: pointer; transition: all .15s;
}
.set-close:hover { background: var(--crimson-dim); color: var(--crimson); }
.set-body { padding: 24px 26px; display: flex; flex-direction: column; gap: 24px; }
.set-section-title {
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--txt-3); margin-bottom: 12px;
}
.theme-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.theme-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 18px 12px;
  background: var(--bg-3); border: 2px solid var(--border);
  border-radius: var(--r-lg); cursor: pointer; transition: all .2s;
  font-family: var(--f-ui); font-size: 13px; font-weight: 600; color: var(--txt-2);
}
.theme-btn:hover { border-color: var(--border-2); color: var(--txt); }
.theme-btn.active { border-color: var(--gold); background: var(--gold-dim); color: var(--gold); }
.theme-btn .theme-icon {
  width: 52px; height: 36px; border-radius: 8px; border: 1.5px solid var(--border-2);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.theme-btn.dark-btn .theme-icon  { background: linear-gradient(135deg,#0a0b0e 50%,#1e222b 100%); }
.theme-btn.light-btn .theme-icon { background: linear-gradient(135deg,#f6f3ef 50%,#ffffff 100%); }
.set-version {
  text-align: center; font-family: var(--f-mono); font-size: 10px;
  color: var(--txt-3); padding-top: 8px; border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════
   MOBILE  (< 768px)
═══════════════════════════════════════════ */
@media (max-width:767px) {
  #app-shell { display: block; height: 100dvh; position: relative; overflow: hidden; }
  #bottom-nav, #mob-header { display: none; }
  body.app-active #bottom-nav { display: flex; }
  body.app-active #mob-header { display: flex; }

  #sidebar {
    transform: translateX(-110%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow: none;
  }
  #sidebar.open { transform: translateX(0); box-shadow: 8px 0 40px rgba(0,0,0,0.6); }
  #drawer-bg {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.5); z-index: 49; backdrop-filter: blur(3px);
  }
  #drawer-bg.show { display: block; }

  #mob-header {
    align-items: center; justify-content: space-between;
    height: 56px; min-height: 56px; padding: 0 16px;
    background: var(--bg-2); border-bottom: 1px solid var(--border);
    position: relative; z-index: 10; flex-shrink: 0;
  }
  .mob-brand { font-family: var(--f-display); font-size: 22px; color: var(--gold); letter-spacing: .02em; }
  .mob-proj  { font-size: 11px; color: var(--txt-3); font-family: var(--f-mono); margin-top: 1px; }
  #hamburger {
    width: 42px; height: 42px; background: var(--bg-3); border-radius: var(--r);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
    -webkit-tap-highlight-color: transparent;
  }
  #hamburger span { width: 20px; height: 2px; background: var(--txt); border-radius: 1px; display: block; }

  #module-nav { display: none; }
  #main { display: flex; flex-direction: column; height: 100%; }
  #content { flex: 1; padding: 16px; padding-bottom: 80px; overflow-y: auto; -webkit-overflow-scrolling: touch; }

  #welcome > div { height: calc(100dvh - 56px - 60px); min-height: 300px; }
  .welcome-title  { font-size: 28px !important; }
  #welcome .btn   { padding: 16px 28px !important; font-size: 16px !important; margin-top: 12px; }

  #bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 60px; background: var(--bg-2); border-top: 1px solid var(--border);
    z-index: 100; padding-bottom: env(safe-area-inset-bottom);
  }
  .bt {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; font-size: 9px; font-weight: 600; color: var(--txt-3); letter-spacing: .02em;
    -webkit-tap-highlight-color: transparent; cursor: pointer; border: none; background: none;
    padding: 8px 2px; transition: color 0.15s;
  }
  .bt .bi { font-size: 20px; line-height: 1; }
  .bt.active { color: var(--gold); }
  .bt.active .bi { filter: drop-shadow(0 0 4px var(--gold-glow)); }

  .g2,.g3,.g4 { grid-template-columns: 1fr; }
  .g4.kpig    { grid-template-columns: 1fr 1fr; gap: 10px; }
  .g2.chartg  { grid-template-columns: 1fr; }

  .fi,.fs,.fta,.login-input { font-size: 16px !important; }
  .fi,.fs,.fta { padding: 13px 14px; }
  .rng-row input[type=range]::-webkit-slider-thumb { width: 26px; height: 26px; }
  .tgl { width: 48px; height: 27px; }
  .tgl-s::after { width: 21px; height: 21px; }
  .tgl input:checked + .tgl-s::after { transform: translateX(21px); }

  .btn          { padding: 13px 20px; font-size: 14px; min-height: 48px; }
  .btn-bar      { flex-direction: column; gap: 10px; }
  .btn-bar .btn { width: 100%; justify-content: center; }
  .btn-bar .btn-danger { margin-left: 0 !important; }
  .btn-new-proj { padding: 14px 16px; min-height: 50px; font-size: 14px; }

  #toast    { bottom: 72px; right: 12px; left: 12px; text-align: center; }
  .card     { padding: 16px; }
  .kpi      { padding: 14px 16px; }
  .kpi-val  { font-size: 18px; }
  .sync-bar { padding: 10px 16px; }

  @supports (padding-bottom:env(safe-area-inset-bottom)) {
    #bottom-nav { height: calc(60px + env(safe-area-inset-bottom)); }
    #content    { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
    #welcome > div { height: calc(100dvh - 56px - calc(60px + env(safe-area-inset-bottom))); }
  }
}

/* ═══════════════════════════════════════════
   DESKTOP  (≥ 768px)
═══════════════════════════════════════════ */
@media (min-width:768px) {
  #mob-header, #bottom-nav, #drawer-bg { display: none !important; }
  #app-shell { display: flex !important; }
  #sidebar   { position: relative; transform: none !important; box-shadow: none !important; }
}
@media (max-width:960px) { .g3,.g4 { grid-template-columns: 1fr 1fr; } }

/* ═══════════════════════════════════════════════════════════════
   v1.7 – inkl. Light Mode anthrazit, Parqet Charts
═══════════════════════════════════════════════════════════════ */

/* ── Top-Level Bereich-Tabs ── */
#area-nav {
  display: flex;
  background: var(--bg);
  border-bottom: 2px solid var(--border);
  padding: 0 20px;
  gap: 0;
  flex-shrink: 0;
  position: sticky; top: 0; z-index: 20;
}
.area-tab {
  padding: 14px 20px;
  font-size: 13px; font-weight: 700;
  color: var(--txt-3);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  cursor: pointer; transition: all .15s;
  letter-spacing: .02em;
  white-space: nowrap;
}
.area-tab:hover { color: var(--txt); }
.area-tab.active { color: var(--gold); border-bottom-color: var(--gold); }

/* ── Panel-Container ── */
#invest-panel, #wealth-panel, #gcf-panel {
  flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0;
}

/* ── Wealth Modul-Nav ── */
#wealth-nav {
  display: flex;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  padding: 0 20px; gap: 2px; flex-shrink: 0;
}
.wealth-tab {
  padding: 12px 16px; font-size: 12px; font-weight: 600;
  color: var(--txt-3); border-bottom: 2px solid transparent;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.wealth-tab:hover { color: var(--txt); }
.wealth-tab.active { color: var(--gold); border-bottom-color: var(--gold); }

/* Wealth Content */
#wealth-content { flex: 1; overflow-y: auto; padding: 28px 32px; }
.wmod-view { display: none; }
.wmod-view.active { display: block; animation: fadeUp .2s ease; }

/* Globaler CF Content */
#gcf-panel { overflow-y: auto; padding: 28px 32px; }

/* ── Radio-Pills (Art: Einnahme / Ausgabe) ── */
.radio-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--r);
  border: 1.5px solid var(--border);
  background: var(--bg-3); cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--txt-2);
  transition: all .15s; flex: 1; justify-content: center;
  user-select: none;
}
.radio-pill input { display: none; }
.radio-pill:hover { border-color: var(--border-2); color: var(--txt); }
.radio-pill.active { border-color: var(--gold); background: var(--gold-dim); color: var(--gold); }

/* ── Global CF Panel ── */
#gcf-content { max-width: 1200px; }

/* ── Mobile: Bereich-Tabs oben (klein) ── */
@media (max-width:767px) {
  #area-nav { padding: 0 8px; overflow-x: auto; }
  .area-tab  { padding: 12px 14px; font-size: 12px; }
  #wealth-nav { padding: 0 8px; overflow-x: auto; }
  .wealth-tab { padding: 10px 12px; font-size: 11px; }
  #wealth-content { padding: 16px; padding-bottom: 80px; }
  #gcf-panel { padding: 16px; padding-bottom: 80px; }
  .radio-pill { padding: 10px 10px; font-size: 12px; }
  #gcf-content { padding: 0; }
}

/* ── Desktop: Panels füllen die verfügbare Höhe ── */
@media (min-width:768px) {
  #invest-panel { height: 100%; }
  #wealth-panel { height: 100%; }
  #gcf-panel    { height: 100%; overflow-y: auto; }
  #invest-content { padding: 28px 32px; }
}

/* ── Kategorien-Administration ── */
.kat-grp .fi:focus {
  background: var(--bg-hover);
  border-color: var(--gold);
}
/* Dashed-Border Karte für "Neue Gruppe" */
.card[style*="dashed"] {
  border-style: dashed !important;
  background: var(--bg-2);
}

/* ═══════════════════════════════════════════════════════════════
   PARQET-STYLE KPI KARTEN & CHART  –  v1.7
═══════════════════════════════════════════════════════════════ */
.kpi-parqet {
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow .15s;
}
.kpi-parqet:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.kpi-parqet.emerald { border-left: 3px solid var(--emerald); }
.kpi-parqet.crimson { border-left: 3px solid var(--crimson); }

.kpi-parqet-lbl {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--txt-3);
  font-family: var(--f-mono);
}
.kpi-parqet-val {
  font-family: var(--f-display);
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -.01em;
  line-height: 1.1;
}
.kpi-parqet-val.emerald { color: var(--emerald); }
.kpi-parqet-val.crimson { color: var(--crimson); }

/* Chart-Wrapper Parqet-Style */
.chart-wrap-parqet {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  padding-bottom: 16px;
}
.chart-wrap-parqet canvas {
  display: block;
  width: 100% !important;
}

/* Light Mode: Parqet-KPIs heller */
html.light-mode .kpi-parqet {
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
html.light-mode .chart-wrap-parqet {
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* ═══════════════════════════════════════════════════════════════
   CASHFLOW TABELLE (Excel-Style)  –  v1.7
═══════════════════════════════════════════════════════════════ */
.cft-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-family: var(--f-mono);
}
.cft-label-th {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--bg-3);
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--txt-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.cft-month-th {
  padding: 8px 10px;
  text-align: right;
  font-size: 11px;
  font-weight: 700;
  color: var(--txt-2);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  background: var(--bg-3);
  line-height: 1.3;
}
.cft-name-cell {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--bg-2);
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  min-width: 200px;
}
.cft-cell {
  padding: 9px 10px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  color: var(--txt-2);
}
.cft-pos { color: var(--emerald) !important; }
.cft-neg { color: var(--crimson) !important; }

/* Gruppen-Zeile */
.cft-grp-row .cft-name-cell {
  background: var(--bg-3);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--txt-3);
  padding-left: 20px;
}
.cft-grp-cell {
  background: var(--bg-3) !important;
  font-weight: 700 !important;
}
.cft-row .cft-name-cell { padding-left: 28px; }
.cft-row:hover .cft-name-cell,
.cft-row:hover .cft-cell {
  background: var(--bg-hover);
}

/* Section-Header (EINNAHMEN / AUSGABEN) */
.cft-section-row .cft-section-label {
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.cft-ein-section .cft-section-label {
  background: var(--emerald-dim);
  color: var(--emerald);
}
.cft-aus-section .cft-section-label {
  background: var(--crimson-dim);
  color: var(--crimson);
}

/* Total-Zeile */
.cft-total-row .cft-name-cell {
  background: var(--bg-3);
  border-top: 2px solid var(--border);
  font-size: 13px;
}
.cft-total-cell {
  background: var(--bg-3) !important;
  border-top: 2px solid var(--border) !important;
  font-weight: 700 !important;
  font-size: 13px !important;
}

/* Saldo-Zeile */
.cft-saldo-row .cft-name-cell {
  background: var(--gold-dim);
  border-top: 2px solid var(--gold);
  font-size: 13px;
}
.cft-saldo-cell {
  background: var(--gold-dim) !important;
  border-top: 2px solid var(--gold) !important;
  font-weight: 700 !important;
  font-size: 13px !important;
}

/* Admin Navigation Tabs */
.admin-area-tab {
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--txt-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--f-ui);
  transition: color .15s, border-color .15s;
}
.admin-area-tab:hover { color: var(--txt); }
.admin-area-tab.active { color: var(--gold); border-bottom-color: var(--gold); }

/* Admin-Felder */
.admin-field { margin-bottom: 20px; }

/* Light Mode Anpassungen CFT */
html.light-mode .cft-name-cell { background: #f8f9fa; }
html.light-mode .cft-grp-row .cft-name-cell,
html.light-mode .cft-grp-cell,
html.light-mode .cft-total-row .cft-name-cell,
html.light-mode .cft-total-cell { background: #f1f3f5 !important; }
html.light-mode .cft-saldo-row .cft-name-cell,
html.light-mode .cft-saldo-cell { background: rgba(200,169,110,0.12) !important; }
html.light-mode .cft-table { border-color: var(--border); }
html.light-mode .cft-label-th,
html.light-mode .cft-month-th { background: #f1f3f5; }

/* ═══════════════════════════════════════════════════════════════
   TECHNISCHER CHANGELOG (Admin)  –  v1.8
═══════════════════════════════════════════════════════════════ */
.tech-cl-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
}
.tech-cl-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--bg-3);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.cl-v-date { font-size: 11px; color: var(--txt-3); font-family: var(--f-mono); }
.tech-cl-tags { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.tech-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.tech-tag.frontend { background: rgba(59,130,246,.15); color: #60a5fa; border: 1px solid rgba(59,130,246,.3); }
.tech-tag.backend  { background: rgba(34,197,94,.15);  color: #4ade80; border: 1px solid rgba(34,197,94,.3); }
.tech-tag.pwa      { background: rgba(168,85,247,.15); color: #c084fc; border: 1px solid rgba(168,85,247,.3); }
.tech-cl-section {
  padding: 10px 18px 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--txt-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  background: var(--bg-2);
}
.tech-cl-item {
  padding: 7px 18px 7px 28px;
  font-size: 12px;
  color: var(--txt-2);
  line-height: 1.6;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.tech-cl-item::before {
  content: '›';
  position: absolute;
  left: 14px;
  color: var(--gold);
  font-weight: 700;
}
.tech-cl-item:last-child { border-bottom: none; }
.tech-cl-item code {
  font-family: var(--f-mono);
  font-size: 11px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--gold);
}

/* ── DSGVO Consent Checkboxen ── */
#register-consent-group {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  flex-direction: column;
  gap: 10px;
}

/* ── Cashflow-Tabelle Sticky Header fix ── */
.cft-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
}
.cft-table .cft-label-th {
  left: 0;
  z-index: 5; /* Über Spalten-Headers */
}
/* CFT Section-Label als td braucht display:flex nicht – korrigieren */
.cft-section-label {
  display: table-cell !important;
}
.cft-section-label > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Amber für Wartungsmodus */
:root {
  --amber: #f59e0b;
  --amber-dim: rgba(245,158,11,.12);
}
html.light-mode {
  --amber: #d97706;
  --amber-dim: rgba(217,119,6,.1);
}

/* ── Personen-Admin Zeilen ── */
.kat-item-row:hover { background: var(--bg-hover); }
