/* ============ Salesium Network — Premium UI (folgt dem System: Dunkel & Hell) ============ */
:root {
  color-scheme: dark;
  --bg: #0b0e13;
  --bg-elev: #11151d;
  --bg-card: #151a24;
  --bg-card-hover: #1a2030;
  --border: #232b3b;
  --border-soft: #1c2333;
  --text: #e8ecf4;
  --text-dim: #9aa5b8;
  --text-faint: #6b7689;
  --gold: #e8b64c;
  --gold-soft: rgba(232, 182, 76, 0.12);
  --green: #3ecf8e;
  --green-soft: rgba(62, 207, 142, 0.12);
  --red: #f2555a;
  --red-soft: rgba(242, 85, 90, 0.12);
  --blue: #5b9cf5;
  --blue-soft: rgba(91, 156, 245, 0.12);
  --purple: #a78bfa;
  --bubble-mine: #23282a;
  --hero-grad: linear-gradient(145deg, #171d2a 0%, #12161f 60%, #171a14 100%);
  --topbar-bg: rgba(11, 14, 19, 0.85);
  --tabbar-bg: rgba(17, 21, 29, 0.96);
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar-w: 248px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
/* Heller Modus: gleiche Struktur, helle Palette — folgt automatisch der Systemeinstellung */
/* ============ Design-Modus ============
 * Standard: folgt dem System. In den Einstellungen kann pro Gerät
 * Hell oder Dunkel erzwungen werden (html[data-theme]).
 * WICHTIG: Die beiden hellen Blöcke (Media-Query + data-theme) müssen
 * inhaltlich identisch bleiben.
 */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f4f2ed;
    --bg-elev: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f7f3ea;
    --border: #d9d4c8;
    --border-soft: #e6e2d8;
    --text: #1d2330;
    --text-dim: #4e5866;
    --text-faint: #8a93a2;
    --gold: #a97b1c;
    --gold-soft: rgba(169, 123, 28, 0.12);
    --green: #178f5c;
    --green-soft: rgba(23, 143, 92, 0.12);
    --red: #cf3f44;
    --red-soft: rgba(207, 63, 68, 0.12);
    --blue: #2f6fd0;
    --blue-soft: rgba(47, 111, 208, 0.12);
    --purple: #6d4fe0;
    --bubble-mine: #f1e7cf;
    --hero-grad: linear-gradient(145deg, #ffffff 0%, #faf6ec 60%, #f3ecda 100%);
    --topbar-bg: rgba(244, 242, 237, 0.85);
    --tabbar-bg: rgba(255, 255, 255, 0.96);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f2ed;
  --bg-elev: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f7f3ea;
  --border: #d9d4c8;
  --border-soft: #e6e2d8;
  --text: #1d2330;
  --text-dim: #4e5866;
  --text-faint: #8a93a2;
  --gold: #a97b1c;
  --gold-soft: rgba(169, 123, 28, 0.12);
  --green: #178f5c;
  --green-soft: rgba(23, 143, 92, 0.12);
  --red: #cf3f44;
  --red-soft: rgba(207, 63, 68, 0.12);
  --blue: #2f6fd0;
  --blue-soft: rgba(47, 111, 208, 0.12);
  --purple: #6d4fe0;
  --bubble-mine: #f1e7cf;
  --hero-grad: linear-gradient(145deg, #ffffff 0%, #faf6ec 60%, #f3ecda 100%);
  --topbar-bg: rgba(244, 242, 237, 0.85);
  --tabbar-bg: rgba(255, 255, 255, 0.96);
}

/* ============ Farbschemata (Akzentfarbe, html[data-accent]) ============
 * Standard ist Gold. "ozean" (Blau) und "smaragd" (Grün) übersteuern
 * nur die Akzent-Variablen — dunkel und hell getrennt abgestimmt.
 */
:root[data-accent="ozean"] {
  --gold: #4da3ff;
  --gold-soft: rgba(77, 163, 255, 0.13);
  --bubble-mine: #1c2836;
  --hero-grad: linear-gradient(145deg, #142030 0%, #12161f 60%, #101c26 100%);
}
:root[data-accent="smaragd"] {
  --gold: #34d399;
  --gold-soft: rgba(52, 211, 153, 0.13);
  --bubble-mine: #182b24;
  --hero-grad: linear-gradient(145deg, #14261f 0%, #12161f 60%, #101f1a 100%);
}
@media (prefers-color-scheme: light) {
  :root[data-accent="ozean"]:not([data-theme="dark"]) {
    --gold: #1f6fd6;
    --gold-soft: rgba(31, 111, 214, 0.12);
    --bubble-mine: #dce9fb;
    --hero-grad: linear-gradient(145deg, #ffffff 0%, #eef4fd 60%, #e2edfb 100%);
  }
  :root[data-accent="smaragd"]:not([data-theme="dark"]) {
    --gold: #0e8f5f;
    --gold-soft: rgba(14, 143, 95, 0.12);
    --bubble-mine: #d9f3e6;
    --hero-grad: linear-gradient(145deg, #ffffff 0%, #edf9f2 60%, #e0f3e9 100%);
  }
}
:root[data-theme="light"][data-accent="ozean"] {
  --gold: #1f6fd6;
  --gold-soft: rgba(31, 111, 214, 0.12);
  --bubble-mine: #dce9fb;
  --hero-grad: linear-gradient(145deg, #ffffff 0%, #eef4fd 60%, #e2edfb 100%);
}
:root[data-theme="light"][data-accent="smaragd"] {
  --gold: #0e8f5f;
  --gold-soft: rgba(14, 143, 95, 0.12);
  --bubble-mine: #d9f3e6;
  --hero-grad: linear-gradient(145deg, #ffffff 0%, #edf9f2 60%, #e0f3e9 100%);
}

button { font-family: inherit; cursor: pointer; }
/* Alle Eingabefelder folgen dem Theme — auch ohne .field/.input-Wrapper (z. B. Chat-Eingabe) */
input, select, textarea { font-family: inherit; font-size: 14px; }
/* iOS zoomt bei Eingabefeldern unter 16px automatisch hinein — auf Touch-Geräten deshalb 16px */
@media (max-width: 900px) {
  input, select, textarea { font-size: 16px; }
}
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]), select, textarea {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 13px;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); }
/* Checkboxen & Radios: deutlich sichtbar, einheitlich gold */
input[type="checkbox"], input[type="radio"] {
  width: 22px !important; height: 22px !important;
  min-width: 22px;
  accent-color: var(--gold);
  flex-shrink: 0; margin: 0;
  cursor: pointer;
}
textarea { width: 100%; resize: vertical; }
::placeholder { color: var(--text-faint); opacity: 1; }
a { color: var(--gold); text-decoration: none; }
.hidden { display: none !important; }

#app { display: flex; min-height: 100vh; }

/* ============ Sidebar ============ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-elev);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 40;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border-soft);
}
.brand-mark {
  width: 42px; height: 42px; border-radius: 11px;
  background: linear-gradient(135deg, #e8b64c, #b8862f);
  color: #14100a; font-weight: 800; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: 0.5px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-title { font-weight: 700; font-size: 14px; }
.brand-sub { font-size: 11px; color: var(--text-faint); letter-spacing: 2px; text-transform: uppercase; }

.nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none; background: none;
  color: var(--text-dim);
  font-size: 14px; font-weight: 500;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--bg-card); color: var(--text); }
.nav-item.active { background: var(--gold-soft); color: var(--gold); }
.nav-item svg { flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 1px 7px; border-radius: 99px;
}
.nav-section {
  font-size: 10px; letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--text-faint); padding: 16px 12px 6px;
}

.sidebar-user {
  padding: 14px 16px;
  border-top: 1px solid var(--border-soft);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-user .avatar { flex-shrink: 0; }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-status { font-size: 11px; color: var(--text-faint); }
.logout-btn {
  background: none; border: none; color: var(--text-faint);
  padding: 6px; border-radius: 7px;
}
.logout-btn:hover { color: var(--red); background: var(--red-soft); }

/* ============ Main / Topbar ============ */
.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; min-width: 0; }
.main.no-sidebar { margin-left: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 30;
}
.topbar-title { font-size: 19px; font-weight: 700; }
.topbar-actions { display: flex; gap: 8px; }
.icon-btn {
  position: relative;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-dim);
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { color: var(--text); border-color: var(--text-faint); }
.notif-dot {
  position: absolute; top: 8px; right: 9px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red); border: 2px solid var(--bg);
}

.view { flex: 1; padding: 26px 28px 60px; max-width: 1060px; width: 100%; margin: 0 auto; min-width: 0; }

/* ============ Tabbar (mobile) ============ */
.tabbar {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--tabbar-bg);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-soft);
  z-index: 50;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  justify-content: space-around;
}
.tab-item {
  background: none; border: none;
  color: var(--text-faint);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 600;
  padding: 6px 10px; border-radius: 9px;
  flex: 1; max-width: 84px;
}
.tab-item.active { color: var(--gold); }

/* ============ Cards & general ============ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  min-width: 0;
}
.card-title {
  font-size: 12px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 14px;
  display: flex; align-items: center; justify-content: space-between;
}
.card-link { font-size: 12px; font-weight: 600; color: var(--gold); background: none; border: none; letter-spacing: 0; text-transform: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.page-head { margin-bottom: 22px; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.3px; }
.page-head p { color: var(--text-dim); font-size: 14px; margin-top: 3px; max-width: 560px; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px; font-weight: 600;
  border: 1px solid transparent;
  transition: opacity 0.15s, background 0.15s;
}
.btn-primary { background: linear-gradient(135deg, #e8b64c, #cf9a35); color: #16110a; }
.btn-primary:hover { opacity: 0.9; }
.btn-secondary { background: var(--bg-card); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { border-color: var(--text-faint); }
.btn-ghost { background: none; color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); background: var(--bg-card); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-success { background: var(--green-soft); color: var(--green); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ============ Status badges ============ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase;
  padding: 4px 11px; border-radius: 99px;
  border: 1px solid;
}
.badge-sm { font-size: 10px; padding: 2px 8px; }
.badge.lv-starter    { color: #9aa5b8; border-color: #3a4356; background: rgba(154,165,184,0.08); }
.badge.lv-challenger { color: #d9a066; border-color: #6b4c2a; background: rgba(217,160,102,0.09); }
.badge.lv-performer  { color: #5b9cf5; border-color: #2c4a7a; background: rgba(91,156,245,0.09); }
.badge.lv-elite      { color: #a78bfa; border-color: #4c3d80; background: rgba(167,139,250,0.09); }
.badge.lv-titan      { color: #f57c5b; border-color: #7a3a2c; background: rgba(245,124,91,0.09); }
.badge.lv-legend     { color: #e8b64c; border-color: #7a5f24; background: rgba(232,182,76,0.10); }
.badge.b-neutral { color: var(--text-dim); border-color: var(--border); background: var(--bg-elev); }
.badge.b-green { color: var(--green); border-color: rgba(62,207,142,0.35); background: var(--green-soft); }
.badge.b-red { color: var(--red); border-color: rgba(242,85,90,0.35); background: var(--red-soft); }
.badge.b-gold { color: var(--gold); border-color: rgba(232,182,76,0.4); background: var(--gold-soft); }

/* ============ Avatar ============ */
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff;
  flex-shrink: 0;
}
.avatar-lg { width: 74px; height: 74px; font-size: 24px; }
.avatar-sm { width: 30px; height: 30px; font-size: 11px; }
.avatar.anon { background: #2a3140 !important; color: var(--gold); border: 1px dashed #4a5468; }

/* ============ Home dashboard ============ */
.status-hero {
  background: var(--hero-grad);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 26px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.status-hero::after {
  content: "";
  position: absolute; top: -70px; right: -70px;
  width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(circle, rgba(232,182,76,0.13), transparent 70%);
  pointer-events: none;
}
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.hero-greet { font-size: 14px; color: var(--text-dim); }
.hero-level { font-size: 32px; font-weight: 800; letter-spacing: -0.5px; margin: 2px 0 4px; }
.hero-avg { font-size: 14px; color: var(--text-dim); }
.hero-avg strong { color: var(--text); font-size: 16px; }
.hero-ranks { display: flex; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.rank-chip {
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: 11px; padding: 10px 16px;
  min-width: 130px;
}
.rank-chip .rc-label { font-size: 11px; color: var(--text-faint); letter-spacing: 0.8px; text-transform: uppercase; }
.rank-chip .rc-value { font-size: 19px; font-weight: 800; margin-top: 1px; }
.rank-chip .rc-value span { font-size: 12px; color: var(--text-faint); font-weight: 500; }

.progress-wrap { margin-top: 20px; }
.progress-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-dim); margin-bottom: 7px; }
.progress-labels strong { color: var(--gold); }
.progress-bar {
  height: 9px; border-radius: 99px; background: #232a39; overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #cf9a35, #e8b64c);
  transition: width 0.6s ease;
}

.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-soft);
}
.list-row:last-child { border-bottom: none; padding-bottom: 0; }
.list-row:first-of-type { padding-top: 2px; }
.lr-main { flex: 1; min-width: 0; }
.lr-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lr-sub { font-size: 12px; color: var(--text-faint); }
.lr-end { text-align: right; flex-shrink: 0; }
.lr-amount { font-weight: 700; font-size: 14px; }

/* ============ Ranking table ============ */
.rank-row {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  margin-bottom: 6px;
  background: var(--bg-card);
}
.rank-row.me { border-color: rgba(232,182,76,0.45); background: linear-gradient(90deg, rgba(232,182,76,0.07), var(--bg-card)); }
.rank-pos {
  width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px;
  background: var(--bg-elev); color: var(--text-dim);
  flex-shrink: 0;
}
.rank-pos.top1 { background: linear-gradient(135deg,#e8b64c,#b8862f); color: #16110a; }
.rank-pos.top2 { background: linear-gradient(135deg,#c8d0dc,#8d99ab); color: #16191f; }
.rank-pos.top3 { background: linear-gradient(135deg,#d9a066,#9c6b3a); color: #1c130a; }
.rank-name { font-weight: 600; font-size: 14px; }
.rank-meta { font-size: 12px; color: var(--text-faint); }
.rank-liga { flex-shrink: 0; display: flex; justify-content: center; align-items: center; min-width: 66px; }
.rank-amount { font-weight: 800; font-size: 15px; text-align: right; flex-shrink: 0; min-width: 104px; }
.rank-amount small { display: block; font-size: 11px; color: var(--text-faint); font-weight: 500; }

/* ============ Filters ============ */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip {
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-dim); font-size: 13px; font-weight: 500;
  padding: 7px 14px; border-radius: 99px;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--gold-soft); border-color: rgba(232,182,76,0.5); color: var(--gold); font-weight: 600; }

/* ============ Feed ============ */
.post-card { padding: 18px 20px; }
.post-head { display: flex; align-items: center; gap: 11px; margin-bottom: 11px; }
.post-author { font-weight: 700; font-size: 14px; }
.post-meta { font-size: 12px; color: var(--text-faint); }
.post-body { font-size: 14.5px; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; }
.post-tags { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.post-actions {
  display: flex; gap: 4px; margin-top: 13px; padding-top: 11px;
  border-top: 1px solid var(--border-soft);
}
.post-action {
  background: none; border: none; color: var(--text-faint);
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600;
  padding: 6px 11px; border-radius: 8px;
}
.post-action:hover { background: var(--bg-elev); color: var(--text); }
.post-action.liked { color: var(--gold); }
.post-action.saved { color: var(--blue); }

.comments { margin-top: 12px; padding-top: 4px; }
.comment { display: flex; gap: 9px; padding: 7px 0; }
.comment-bubble {
  background: var(--bg-elev); border-radius: 11px; padding: 8px 13px; flex: 1;
}
.comment-author { font-size: 12.5px; font-weight: 700; }
.comment-text { font-size: 13.5px; }
.comment-input-row { display: flex; gap: 9px; margin-top: 8px; }
.comment-input-row input { flex: 1; }

/* ============ Composer ============ */
.composer { display: flex; gap: 12px; align-items: flex-start; }
.composer-input {
  flex: 1;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 11px; color: var(--text);
  padding: 11px 15px; font-size: 14px;
  text-align: left; cursor: pointer;
}
.composer-input:hover { border-color: var(--text-faint); }
.composer-input.placeholder { color: var(--text-faint); }

/* ============ Forms ============ */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; }
.field .req { color: var(--red); }
.input, .field input[type=text], .field input[type=number], .field input[type=email],
.field input[type=password], .field input[type=date], .field input[type=month],
.field input[type=time], .field select, .field textarea {
  width: 100%;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text);
  padding: 10px 13px;
  outline: none;
  transition: border-color 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--gold); }
.field textarea { resize: vertical; min-height: 84px; }
.field-hint { font-size: 12px; color: var(--text-faint); margin-top: 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.file-drop {
  border: 1.5px dashed var(--border); border-radius: 11px;
  padding: 18px; text-align: center; color: var(--text-faint);
  font-size: 13px; cursor: pointer; transition: border-color 0.15s;
  background: var(--bg-elev);
}
.file-drop:hover { border-color: var(--gold); color: var(--text-dim); }
.file-drop.has-file { border-color: var(--green); color: var(--green); border-style: solid; }

/* ============ Modal ============ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(5, 7, 10, 0.72);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%; max-width: 520px;
  max-height: 88vh; overflow-y: auto;
  padding: 24px;
  animation: slideUp 0.2s ease;
}
.modal-wide { max-width: 640px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-head h2 { font-size: 18px; font-weight: 800; }
.modal-close { background: none; border: none; color: var(--text-faint); font-size: 22px; line-height: 1; padding: 4px 8px; border-radius: 7px; }
.modal-close:hover { color: var(--text); background: var(--bg-elev); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(14px); opacity: 0; } }

/* ============ Toast ============ */
/* Oben statt unten: so verdeckt weder Tastatur noch Tab-Leiste die Meldung */
#toast-root { position: fixed; top: calc(14px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(92vw, 480px); }
@keyframes slideDown { from { transform: translateY(-14px); opacity: 0; } }

/* Kleine Aktivitäts-Popups oben rechts (neue Nachricht, Event …) */
#notif-toast-root { position: fixed; top: calc(12px + env(safe-area-inset-top)); right: calc(12px + env(safe-area-inset-right)); z-index: 320; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; max-width: min(86vw, 330px); pointer-events: none; }
.notif-toast { display: flex; align-items: flex-start; gap: 9px; background: var(--bg-card); border: 1px solid var(--border); border-left: 3px solid var(--gold); border-radius: 12px; padding: 10px 13px; box-shadow: 0 10px 34px rgba(0,0,0,0.42); font-size: 13px; line-height: 1.4; transform: translateX(120%); opacity: 0; transition: transform 0.32s ease, opacity 0.32s ease; }
.notif-toast.show { transform: translateX(0); opacity: 1; }
.notif-toast .nt-icon { flex-shrink: 0; font-size: 15px; line-height: 1.3; }
.notif-toast .nt-text { color: var(--text); }
.toast {
  background: var(--bg-card); border: 1.5px solid var(--border);
  color: var(--text); font-size: 14.5px; font-weight: 600; line-height: 1.45;
  padding: 13px 20px; border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.45);
  animation: slideDown 0.2s ease;
  display: flex; align-items: flex-start; gap: 9px;
  max-width: 100%;
}
.toast.success { border-color: var(--green); }
.toast.error { border-color: var(--red); background: var(--bg-card); color: var(--text); }

/* ============ Login ============ */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 60% 45% at 70% 0%, rgba(232,182,76,0.07), transparent),
    radial-gradient(ellipse 50% 40% at 10% 100%, rgba(91,156,245,0.05), transparent),
    var(--bg);
}
.login-box { width: 100%; max-width: 420px; }
.login-brand { text-align: center; margin-bottom: 30px; }
.login-brand .brand-mark { width: 64px; height: 64px; font-size: 21px; border-radius: 17px; margin: 0 auto 16px; }
.login-brand h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.3px; }
.login-brand p { color: var(--text-dim); font-size: 14px; margin-top: 6px; }
.login-card { background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: 18px; padding: 26px; }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--text-faint); font-size: 12px; }
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.demo-user {
  display: flex; align-items: center; gap: 11px;
  width: 100%;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 11px; padding: 11px 13px; margin-bottom: 8px;
  color: var(--text); text-align: left;
  transition: border-color 0.15s;
}
.demo-user:hover { border-color: var(--gold); }
.demo-user-name { font-weight: 600; font-size: 14px; }
.demo-user-sub { font-size: 12px; color: var(--text-faint); }

/* ============ Onboarding ============ */
.steps { display: flex; gap: 6px; margin-bottom: 26px; }
.step-dot { flex: 1; height: 4px; border-radius: 99px; background: var(--border); }
.step-dot.done { background: var(--gold); }

.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice-card {
  background: var(--bg-elev); border: 1.5px solid var(--border);
  border-radius: 12px; padding: 14px; text-align: left;
  color: var(--text); font-size: 14px; font-weight: 600;
  transition: border-color 0.15s;
}
.choice-card:hover { border-color: var(--text-faint); }
.choice-card.selected { border-color: var(--gold); background: var(--gold-soft); }
.choice-card .cc-sub { display: block; font-size: 12px; color: var(--text-faint); font-weight: 400; margin-top: 3px; }

/* ============ Circles / chat ============ */
.chat-wrap { display: flex; flex-direction: column; height: calc(100vh - 235px); min-height: 380px; }
.chat-wrap.circle-chat { height: calc(100vh - 380px); min-height: 260px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 6px 2px; }
.chat-msg { display: flex; gap: 10px; margin-bottom: 14px; }
.chat-msg.mine { flex-direction: row-reverse; }
.chat-bubble {
  background: var(--bg-card); border: 1px solid var(--border-soft);
  border-radius: 13px; padding: 9px 14px; max-width: 72%;
}
.chat-msg.mine .chat-bubble { background: var(--bubble-mine); border-color: rgba(232,182,76,0.25); }
.chat-author { font-size: 12px; font-weight: 700; color: var(--gold); margin-bottom: 2px; }
.chat-text { font-size: 14px; white-space: pre-wrap; word-wrap: break-word; }
.chat-time { font-size: 10.5px; color: var(--text-faint); margin-top: 3px; }
.chat-report {
  background: none; border: none; padding: 0 0 0 8px;
  font-size: 10.5px; color: var(--text-faint); opacity: 0.55; cursor: pointer;
}
.chat-report:hover { opacity: 1; color: var(--red); }
.chat-input-row { display: flex; gap: 9px; padding-top: 12px; }
.chat-input-row input { flex: 1; }
.pinned-bar {
  background: var(--gold-soft); border: 1px solid rgba(232,182,76,0.3);
  border-radius: 10px; padding: 9px 14px; font-size: 13px;
  margin-bottom: 12px; display: flex; gap: 9px; align-items: center;
  color: var(--gold);
}

/* ============ Misc ============ */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-tile { background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: 13px; padding: 15px 17px; }
.stat-tile .st-value { font-size: 22px; font-weight: 800; }
.stat-tile .st-label { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

/* Zielrechner: alle Zielzahlen gebündelt in einem Kasten, Tippen erklärt die Zahl */
.ziel-kasten .ziel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.ziel-tile { background: var(--bg-elev, var(--bg-card)); border: 1px solid var(--border-soft); border-radius: 12px; padding: 13px 15px; cursor: pointer; transition: border-color .15s, background .15s; }
.ziel-tile:hover { border-color: var(--gold); }
.ziel-tile .st-value { font-size: 21px; font-weight: 800; }
.ziel-tile .st-label { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.ziel-tile .ziel-info { display: none; font-size: 12px; color: var(--text-dim); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border-soft); line-height: 1.4; }
.ziel-tile.offen { border-color: var(--gold); background: var(--gold-soft); }
.ziel-tile.offen .ziel-info { display: block; }

.empty-state { text-align: center; padding: 44px 20px; color: var(--text-faint); }
.empty-state .es-icon { font-size: 34px; margin-bottom: 10px; opacity: 0.7; }
.empty-state p { font-size: 14px; }

/* ---- Mitgliedschafts-Stufen: Badges hinter Namen ---- */
.tier-badge { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; margin-left: 5px; font-weight: 800; line-height: 1; font-size: 9px; letter-spacing: .3px; text-transform: uppercase; padding: 2px 6px; border-radius: 5px; }
.tier-badge.tb-free { background: var(--border-soft, rgba(140,150,170,0.18)); color: var(--text-faint); font-weight: 700; }
.tier-badge.tb-premium { background: var(--gold-soft); color: var(--gold); }
.tier-badge.tb-mentoring { background: linear-gradient(135deg, #f2cd74, #d99b26); color: #0b0e13; }
/* Free-Namen im Ranking dezent ausgegraut */
.is-free-name { color: var(--text-faint) !important; opacity: 0.75; }

/* ---- Gesperrte Bereiche: Mini-Einblick + Verblassen + Schloss ---- */
.gate-wrap { position: relative; }
.gate-preview { max-height: 300px; overflow: hidden; pointer-events: none; user-select: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent 96%);
  mask-image: linear-gradient(to bottom, #000 30%, transparent 96%); }
.gate-lock { text-align: center; margin-top: -40px; position: relative; z-index: 2;
  background: var(--bg-card); border: 1.5px solid var(--gold); border-radius: 16px;
  padding: 22px 20px 24px; max-width: 460px; margin-left: auto; margin-right: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,0.28); }
.gate-lock-icon { font-size: 30px; margin-bottom: 6px; }
.gate-lock-title { font-weight: 800; font-size: 17px; margin-bottom: 6px; }
.gate-lock-text { font-size: 13.5px; color: var(--text-dim); margin: 0 auto 14px; max-width: 380px; line-height: 1.55; }
.gate-lock-ctas { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
/* Schloss-Icon an gesperrten Nav-Einträgen */
.nav-lock { margin-left: auto; font-size: 12px; opacity: 0.6; }

.tag { display: inline-block; font-size: 11.5px; font-weight: 600; color: var(--text-dim); background: var(--bg-elev); border: 1px solid var(--border); padding: 3px 10px; border-radius: 99px; }

table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data-table th { text-align: left; color: var(--text-faint); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.data-table td { padding: 11px 10px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.data-table tr:last-child td { border-bottom: none; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* Mobil: Tabellenzeilen werden zu gestapelten Blöcken — kein seitliches
 * Scrollen und kein Bildschirmdrehen nötig. Desktop bleibt klassische Tabelle. */
@media (max-width: 700px) {
  table.data-table, table.data-table tbody, table.data-table tr, table.data-table td { display: block; width: 100%; }
  table.data-table thead { display: none; }
  table.data-table tr {
    border: 1px solid var(--border-soft); border-radius: 10px;
    padding: 10px 12px; margin-bottom: 10px;
    background: var(--bg-elev);
  }
  table.data-table td { padding: 3px 0; border-bottom: none; font-size: 13.5px; }
  table.data-table td:empty { display: none; }
  table.data-table tr:last-child { margin-bottom: 0; }
}

.notif-item { display: flex; gap: 11px; padding: 12px 4px; border-bottom: 1px solid var(--border-soft); align-items: flex-start; }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread .notif-text { font-weight: 600; }
.notif-icon { width: 34px; height: 34px; border-radius: 10px; background: var(--bg-elev); display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.notif-text { font-size: 13.5px; flex: 1; }
.notif-time { font-size: 11.5px; color: var(--text-faint); }

.detail-list { font-size: 14px; }
.detail-list .dl-row { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--border-soft); }
.detail-list .dl-row:last-child { border-bottom: none; }
.detail-list .dl-label { color: var(--text-faint); flex-shrink: 0; }
.detail-list .dl-value { font-weight: 600; text-align: right; }

.hub-card { display: flex; gap: 14px; align-items: flex-start; }
.hub-icon {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  background: var(--bg-elev); border: 1px solid var(--border);
}
/* Klappbare Ordnerstruktur im Input Hub */
.hub-folder { margin-bottom: 10px; }
.hub-folder-head {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 10px 13px; border-radius: 11px; cursor: pointer;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); font-size: 14.5px; text-align: left;
}
.hub-folder-head:hover { background: var(--bg-elev); border-color: var(--gold); }
.hub-folder .hub-card { margin-bottom: 8px; }

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .sidebar { display: none !important; }
  .main { margin-left: 0; }
  .tabbar { display: flex; }
  .tabbar.hidden { display: none; }
  /* Safe-Area (Notch/Statusleiste/Dynamic Island) in JEDEM Kontext: Web-Safari, PWA & native App.
     env(...) ist 0 ohne Notch → auf normalen Geräten kein Unterschied. */
  .view { padding: 18px calc(16px + env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left)); }
  .topbar { padding: calc(13px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) 13px calc(16px + env(safe-area-inset-left)); }
  .login-wrap { padding-top: calc(24px + env(safe-area-inset-top)); }
  .grid-2, .grid-3, .form-row, .choice-grid { grid-template-columns: 1fr; }
  .status-hero { padding: 20px; }
  .hero-level { font-size: 26px; }
  .chat-wrap { height: calc(100vh - 300px); }
}

/* ============ Ligen & Status-Erlebnis ============ */
.hero-motivation {
  font-size: 13px; color: var(--text-dim); margin-top: 8px;
  font-style: italic;
}
.status-hero.hero-starter::after    { background: radial-gradient(circle, rgba(154,165,184,0.14), transparent 70%); }
.status-hero.hero-challenger::after { background: radial-gradient(circle, rgba(217,160,102,0.15), transparent 70%); }
.status-hero.hero-performer::after  { background: radial-gradient(circle, rgba(91,156,245,0.16), transparent 70%); }
.status-hero.hero-elite::after      { background: radial-gradient(circle, rgba(167,139,250,0.16), transparent 70%); }
.status-hero.hero-titan::after      { background: radial-gradient(circle, rgba(245,124,91,0.16), transparent 70%); }
.status-hero.hero-legend::after     { background: radial-gradient(circle, rgba(232,182,76,0.18), transparent 70%); }
.status-hero:hover { border-color: var(--text-faint); }

.league-card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 13px; padding: 15px 17px; margin-bottom: 11px;
  position: relative; overflow: hidden;
}
.league-card.current {
  border-color: rgba(232,182,76,0.55);
  background: linear-gradient(145deg, rgba(232,182,76,0.07), var(--bg-elev) 55%);
  box-shadow: 0 0 24px rgba(232,182,76,0.08);
}
.league-benefits { list-style: none; padding: 0; margin: 0; }
.league-benefits li {
  font-size: 13px; color: var(--text-dim);
  padding: 2.5px 0 2.5px 20px; position: relative;
}
.league-benefits li::before {
  content: "✦"; position: absolute; left: 2px; color: var(--gold); font-size: 11px;
}

/* ============ Haupt-Tabs (Rankings, Input Hub) ============ */
.main-tabs {
  display: flex; gap: 8px; margin-bottom: 18px;
  background: var(--bg-elev); border: 1px solid var(--border-soft);
  border-radius: 13px; padding: 5px;
}
.main-tab {
  flex: 1; background: none; border: none;
  color: var(--text-dim); font-size: 14px; font-weight: 600;
  padding: 10px 14px; border-radius: 9px;
  transition: background 0.15s, color 0.15s;
}
.main-tab:hover { color: var(--text); }
.main-tab.active {
  background: var(--bg-card); color: var(--gold);
  box-shadow: 0 1px 6px rgba(0,0,0,0.25);
  border: 1px solid rgba(232,182,76,0.3);
}

/* ============ KI-Entwicklungsbereich ============ */
.score-ring {
  width: 62px; height: 62px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; flex-shrink: 0;
  background: var(--bg-elev); border: 3px solid var(--border);
}
.score-ring.good { border-color: var(--green); color: var(--green); }
.score-ring.mid { border-color: var(--gold); color: var(--gold); }
.score-ring.low { border-color: var(--red); color: var(--red); }
.cat-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.cat-bar-label { font-size: 12.5px; color: var(--text-dim); width: 170px; flex-shrink: 0; }
.cat-bar { flex: 1; height: 7px; border-radius: 99px; background: #232a39; overflow: hidden; }
.cat-bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #5b9cf5, #a78bfa); }
.cat-bar-value { font-size: 12px; font-weight: 700; width: 30px; text-align: right; }
.hebel-card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: 10px; padding: 11px 14px; margin-bottom: 9px;
}
.disclaimer {
  background: rgba(91,156,245,0.07); border: 1px solid rgba(91,156,245,0.25);
  border-radius: 10px; padding: 10px 14px; font-size: 12.5px; color: var(--text-dim);
  margin-bottom: 16px;
}

/* ============ Intro / App-Einführung ============ */
.intro-slide { text-align: center; padding: 8px 0 4px; }
.intro-icon { font-size: 46px; margin-bottom: 14px; }
.intro-slide h2 { font-size: 20px; font-weight: 800; margin-bottom: 10px; }
.intro-slide p { font-size: 14px; color: var(--text-dim); max-width: 400px; margin: 0 auto 8px; }
.video-placeholder {
  background: var(--bg-elev); border: 1.5px dashed var(--border);
  border-radius: 14px; padding: 30px 20px; margin: 14px auto;
  max-width: 380px; color: var(--text-faint); font-size: 13px;
}
.video-placeholder .vp-play {
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--gold-soft); border: 1px solid rgba(232,182,76,0.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin: 0 auto 10px; color: var(--gold);
}

/* ============ Profilbilder, Online-Status, Chat-Liste ============ */
img.avatar { object-fit: cover; background: var(--bg-elev); }
.avatar-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
.online-dot {
  position: absolute; bottom: 0; right: 0;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--green); border: 2px solid var(--bg-card);
}
.unread-badge {
  background: var(--gold); color: #16110a;
  font-size: 11px; font-weight: 800;
  min-width: 20px; height: 20px; border-radius: 99px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 6px;
}
.read-receipt { font-size: 10.5px; color: var(--text-faint); text-align: right; margin-top: 2px; }
.read-receipt.read { color: var(--blue); }
.chat-att-img { max-width: 240px; max-height: 240px; border-radius: 10px; display: block; margin-top: 6px; cursor: pointer; }
.chat-att-file {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 9px; padding: 7px 12px; margin-top: 6px;
  font-size: 13px; color: var(--text); text-decoration: none;
}
.status-select {
  background: var(--bg-elev); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; padding: 5px 8px; font-size: 12.5px;
}
.video-embed { position: relative; width: 100%; padding-top: 56.25%; border-radius: 12px; overflow: hidden; background: #000; margin-bottom: 14px; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.prio-hoch { color: var(--red); } .prio-mittel { color: var(--gold); } .prio-niedrig { color: var(--text-faint); }

/* ============ PWA / natives App-Gefühl ============ */
html { -webkit-tap-highlight-color: transparent; }
body { overscroll-behavior-y: none; }
/* Seitliches Verschieben der Gesamtseite komplett unterbinden —
   breite Inhalte scrollen nur in ihren eigenen Containern (.table-scroll) */
html, body { overflow-x: hidden; overscroll-behavior-x: none; max-width: 100vw; }
@media (display-mode: standalone) {
  .topbar { padding-top: calc(13px + env(safe-area-inset-top)); }
  .login-wrap { padding-top: calc(24px + env(safe-area-inset-top)); }
  .sidebar-brand { padding-top: calc(22px + env(safe-area-inset-top)); }
  /* Kein Zoomen/Auswählen von UI-Elementen wie in nativen Apps */
  .nav-item, .tab-item, .btn, .chip, .main-tab { -webkit-user-select: none; user-select: none; }
}
@media (display-mode: standalone) and (max-width: 900px) {
  .view { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
}

/* ============ Native App (Capacitor): Safe-Area wie eine echte iPhone-App ============
   In der nativen App ist display-mode NICHT "standalone", deshalb greifen die Regeln oben
   dort nicht. Über die Klasse .native-app (in app.js gesetzt) holen wir die Abstände nach,
   damit der Titel nicht unter die Statusleiste/Notch rutscht und rechts nichts abschneidet. */
html.native-app .topbar {
  padding-top: calc(13px + env(safe-area-inset-top));
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
}
html.native-app .view {
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}
html.native-app .login-wrap { padding-top: calc(24px + env(safe-area-inset-top)); }
html.native-app .sidebar-brand { padding-top: calc(22px + env(safe-area-inset-top)); }

/* Überlauf-Schutz schmale Screens: lange Beschriftungen umbrechen statt abschneiden */
.progress-labels { flex-wrap: wrap; gap: 2px 12px; }
.progress-labels > span { min-width: 0; }
.status-hero, .card { max-width: 100%; }
.hero-top, .hero-ranks, .progress-wrap { max-width: 100%; }
