:root {
  --bg: #0f1420;
  --bg-card: #161d2e;
  --border: #2a3350;
  --text: #e7ecf5;
  --text-muted: #8b96ad;
  --accent: #4f8cff;
  --accent-2: #34d399;
  --tag-bond-bg: #3a2e17;
  --tag-bond-text: #e0b76a;
  --tag-equity-bg: #163a2b;
  --tag-equity-text: #6fe0a8;
  --row-alt: #131a29;
  --header-bg: #1c2438;
  --input-bg: #1a2136;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- Basis / Mobile (< 600px) ---------- */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.page-header {
  padding: 1.5rem 1rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.page-header h1 {
  font-size: 1.3rem;
  margin: 0 0 0.5rem;
  line-height: 1.3;
}

.subtitle {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.85rem;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem 2.5rem;
}

.intro {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.intro p {
  margin: 0;
  color: var(--text);
}

section > h2 {
  font-size: 1.05rem;
  margin: 1.75rem 0 0.6rem;
  border-left: 4px solid var(--accent);
  padding-left: 0.6rem;
  line-height: 1.3;
}

/* Filter-Leiste */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 0.6rem;
}

.filter-bar input[type="search"] {
  flex: 1 1 100%;
  min-height: 44px;
  padding: 0 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.95rem;
}

.filter-bar input[type="search"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.filter-count {
  color: var(--text-muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.type-toggle {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  flex: 1 1 100%;
}

.type-btn {
  min-height: 40px;
  padding: 0 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
}

.type-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.empty-state {
  color: var(--text-muted);
  font-style: italic;
  padding: 1rem 0.2rem;
  font-size: 0.9rem;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 10px;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 560px;
  font-size: 0.82rem;
}

thead th {
  position: sticky;
  top: 0;
  background: var(--header-bg);
  text-align: left;
  padding: 0.55rem 0.65rem;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

thead th.sortable {
  cursor: pointer;
  user-select: none;
  padding-right: 1.3rem;
  position: sticky;
  z-index: 2;
}

thead th.sortable:hover,
thead th.sortable:focus-visible {
  color: var(--accent);
}

thead th.sortable::after {
  content: "↕";
  position: absolute;
  margin-left: 0.4rem;
  opacity: 0.35;
  font-size: 0.8em;
}

thead th.sortable[data-sort-dir="asc"]::after {
  content: "↑";
  opacity: 1;
  color: var(--accent);
}

thead th.sortable[data-sort-dir="desc"]::after {
  content: "↓";
  opacity: 1;
  color: var(--accent);
}

tbody td {
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

/* erste Spalte beim horizontalen Scrollen sichtbar halten */
#etfTable td:first-child,
#etfTable th:first-child {
  position: sticky;
  left: 0;
  background: var(--bg-card);
  z-index: 1;
}

tbody tr:nth-child(even) td:first-child {
  background: var(--row-alt);
}

tbody tr:nth-child(even) {
  background: var(--row-alt);
}

tbody tr:hover {
  background: #1d2740;
}

tbody tr:hover td:first-child {
  background: #1d2740;
}

td.num, th:nth-child(3), th:nth-child(4), th:nth-child(5), th:nth-child(6) {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

td.mono {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.8rem;
  white-space: nowrap;
}

td.positions {
  min-width: 280px;
  color: var(--text-muted);
}

.tag {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  white-space: nowrap;
}

.tag-equity {
  background: var(--tag-equity-bg);
  color: var(--tag-equity-text);
}

.tag-bond {
  background: var(--tag-bond-bg);
  color: var(--tag-bond-text);
}

a {
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

a:hover {
  text-decoration: underline;
}

.muted {
  color: var(--text-muted);
}

.note {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 0.5rem;
}

.top-note {
  margin: 0 0 0.6rem;
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
}

.legend-dot {
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  margin-top: 0.35rem;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

tbody tr.top20 {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

tbody tr.top20 td:first-child {
  background: color-mix(in srgb, var(--accent) 20%, var(--bg-card));
}

tbody tr.top20:hover {
  background: color-mix(in srgb, var(--accent) 24%, transparent);
}

.page-footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 1rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  border-top: 1px solid var(--border);
}

/* ---------- Tablet (>= 600px) ---------- */
@media (min-width: 600px) {
  .page-header { padding: 2rem 1.5rem 1.25rem; }
  .page-header h1 { font-size: 1.6rem; }
  .subtitle { font-size: 0.95rem; }
  main { padding: 0 1.5rem 3rem; }
  .intro { padding: 1.25rem 1.5rem; font-size: 1rem; }
  section > h2 { font-size: 1.15rem; margin: 2rem 0 0.75rem; }
  table { font-size: 0.9rem; }
  thead th, tbody td { padding: 0.65rem 0.8rem; }
  .filter-bar input[type="search"] { flex: 1 1 320px; }
  .type-toggle { flex: 0 0 auto; }
}

/* ---------- Desktop (>= 1000px) ---------- */
@media (min-width: 1000px) {
  .page-header h1 { font-size: 2rem; }
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f7fb;
    --bg-card: #ffffff;
    --border: #dde3ee;
    --text: #1b2330;
    --text-muted: #5b6579;
    --header-bg: #eef1f8;
    --row-alt: #f8f9fc;
    --input-bg: #ffffff;
    --tag-bond-bg: #fdf1de;
    --tag-bond-text: #9a6a17;
    --tag-equity-bg: #e3f7ec;
    --tag-equity-text: #1b8a52;
  }
  tbody tr:hover { background: #eef2fb; }
  tbody tr:hover td:first-child { background: #eef2fb; }
}
