/* ============================================================
   PRIO24 v3 · "Research Desk Ledger"
   Editorial dark aesthetic: near-black ink, hairline rules,
   brass accent, IBM Plex Serif headlines, tabular figures.
   ============================================================ */

/* ---------- Fonts (self-hosted) ---------- */
@font-face {
  font-family: "IBM Plex Serif";
  src: url("fonts/ibm-plex-serif-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Serif";
  src: url("fonts/ibm-plex-serif-600-normal.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/ibm-plex-sans-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/ibm-plex-sans-500-normal.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/ibm-plex-sans-600-normal.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}

/* ---------- Design tokens ---------- */
:root {
  --serif: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;

  --wrap: 1240px;
  --r-sm: 3px;
  --r-md: 6px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

:root, [data-theme="light"] {
  color-scheme: light;
  --bg: #f6f5f0;
  --bg-subtle: #efeee8;
  --bg-raised: #fdfcf9;
  --bg-inset: #eceae3;
  --line: #dcdad1;
  --line-strong: #c6c3b8;
  --ink: #1b1a16;
  --ink-2: #5d5c55;
  --ink-3: #8d8b82;
  --brass: #8a6b38;
  --brass-strong: #6e5225;
  --brass-dim: rgba(138, 107, 56, 0.1);
  --up: #1e7a50;
  --up-dim: rgba(30, 122, 80, 0.1);
  --down: #b23a31;
  --down-dim: rgba(178, 58, 49, 0.09);
  --shadow: 0 24px 50px -30px rgba(27, 26, 22, 0.35);
  --grain-opacity: 0.05;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0a0c;
  --bg-subtle: #0d0d10;
  --bg-raised: #121216;
  --bg-inset: #08080a;
  --line: #232329;
  --line-strong: #34343c;
  --ink: #ecebe6;
  --ink-2: #a3a29c;
  --ink-3: #6b6a66;
  --brass: #c8a874;
  --brass-strong: #dfc397;
  --brass-dim: rgba(200, 168, 116, 0.12);
  --up: #58bd8e;
  --up-dim: rgba(88, 189, 142, 0.12);
  --down: #e0645c;
  --down-dim: rgba(224, 100, 92, 0.12);
  --shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.8);
  --grain-opacity: 0.028;
  --tv-theme: dark;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
}

/* Paper grain, barely there */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2000;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2, h3 { margin: 0; font-weight: 600; }
p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 48px);
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

.skip-link {
  position: absolute; left: 16px; top: -48px;
  background: var(--brass); color: #0a0a0c;
  padding: 8px 14px; border-radius: var(--r-sm);
  font-weight: 600; text-decoration: none; z-index: 3000;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 12px; }

::selection { background: var(--brass); color: #0a0a0c; }

/* ---------- Reveal motion ---------- */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s var(--ease) var(--d, 0ms),
              transform 0.7s var(--ease) var(--d, 0ms);
}
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  * { animation: none !important; }
}

/* ---------- Navigation ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.nav-row {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 64px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 14px;
  text-decoration: none;
  min-width: 0;
}

.brand-word {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 21px;
  letter-spacing: 0.04em;
}
.brand-word em {
  font-style: normal;
  color: var(--brass);
}

.brand-claim {
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.nav-links a {
  text-decoration: none;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 6px 14px;
  border-radius: var(--r-sm);
  transition: color 0.2s, background 0.2s;
}
.nav-links a:hover { color: var(--ink); background: var(--brass-dim); }
.nav-links a[aria-current="page"] {
  color: var(--brass);
}

.nav-meta {
  display: flex;
  align-items: center;
  gap: 18px;
}
.nav-stand {
  font-size: 12.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.nav-stand strong { color: var(--ink-2); font-weight: 500; }

.theme-toggle {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--ink-2);
  transition: color 0.2s, border-color 0.2s;
}
.theme-toggle:hover { color: var(--brass); border-color: var(--line-strong); }
.theme-toggle svg { width: 17px; height: 17px; }
[data-theme="dark"] .ico-moon { display: none; }
[data-theme="light"] .ico-sun { display: none; }

/* ---------- Hero ---------- */
.hero {
  border-bottom: 1px solid var(--line);
  padding: clamp(56px, 9vh, 110px) 0 0;
  position: relative;
  overflow: hidden;
}

/* faint ledger columns in the hero backdrop */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    to right,
    transparent 0,
    transparent calc(100% / 6 - 1px),
    var(--line) calc(100% / 6 - 1px),
    var(--line) calc(100% / 6)
  );
  opacity: 0.25;
  mask-image: linear-gradient(to bottom, transparent, black 30%, black 70%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 30%, black 70%, transparent);
}

.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr);
  gap: clamp(40px, 6vw, 96px);
  align-items: end;
  padding-bottom: clamp(48px, 7vh, 88px);
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 26px;
}

.hero-title {
  font-family: var(--serif);
  font-size: clamp(40px, 5.6vw, 76px);
  line-height: 1.06;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.hero-title > span { display: block; }
.hero-title .accent-line { color: var(--brass); }
[data-theme="light"] .hero-title .accent-line { color: var(--ink); }

.hero-title-sub { font-size: clamp(34px, 4.4vw, 58px); }

.hero-lead {
  margin-top: 28px;
  max-width: 640px;
  font-size: clamp(15.5px, 1.35vw, 17.5px);
  color: var(--ink-2);
  text-wrap: pretty;
}
.sentence { display: block; }

/* Rules panel */
.hero-rules {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-top: 2px solid var(--brass);
  border-radius: var(--r-md);
  padding: 26px 26px 20px;
  box-shadow: var(--shadow);
}
.rules-title {
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}
.rules-list {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  gap: 0;
}
.rules-list li {
  display: flex;
  gap: 14px;
  padding: 11px 0;
  font-size: 13.8px;
  color: var(--ink-2);
  border-top: 1px solid var(--line);
  text-wrap: pretty;
}
.rules-list li strong { color: var(--ink); font-weight: 600; }
.rule-no {
  font-family: var(--serif);
  color: var(--brass);
  font-size: 14px;
  min-width: 14px;
  font-variant-numeric: tabular-nums;
}

/* Sector index (anchor nav) */
.sector-index {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: var(--r-md) var(--r-md) 0 0;
  overflow: hidden;
  background: var(--bg-raised);
}
.sector-index-item {
  display: grid;
  gap: 3px;
  padding: 18px 18px 16px;
  text-decoration: none;
  border-right: 1px solid var(--line);
  transition: background 0.25s var(--ease);
  position: relative;
}
.sector-index-item:last-child { border-right: none; }
.sector-index-item::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--brass);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}
.sector-index-item:hover { background: var(--brass-dim); }
.sector-index-item:hover::after { transform: scaleX(1); }

.si-num {
  font-family: var(--serif);
  font-size: 12px;
  color: var(--brass);
  font-variant-numeric: tabular-nums;
}
.si-name {
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: 0.01em;
}
.si-count {
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* ---------- Sector sections ---------- */
.sector { padding: clamp(64px, 9vh, 108px) 0; }
.sector.alt { background: var(--bg-subtle); }
.sector + .sector { border-top: 1px solid var(--line); }

.sector-head {
  display: flex;
  align-items: baseline;
  gap: 22px;
  margin-bottom: clamp(32px, 4.5vh, 52px);
}

.sector-num {
  font-family: var(--serif);
  font-size: clamp(44px, 5vw, 68px);
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px var(--brass);
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
  flex-shrink: 0;
}

.sector-title-block { flex-shrink: 0; }
.sector-title {
  font-family: var(--serif);
  font-size: clamp(24px, 2.6vw, 34px);
  letter-spacing: -0.01em;
}
.sector-meta {
  margin-top: 4px;
  font-size: 13px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.etf-link {
  color: var(--ink-2);
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
  transition: color 0.2s;
}
.etf-link:hover { color: var(--brass); }

.sector-rule {
  flex: 1;
  height: 1px;
  background: var(--line);
  align-self: center;
}

/* ---------- Card grid (kompakt: 3-4 pro Reihe) ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: clamp(14px, 1.6vw, 22px);
}

/* ---------- Stock card (kompakt, Klick öffnet Chart-Modal) ---------- */
.card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease), transform 0.3s var(--ease);
}
.card:hover, .card:focus-visible {
  border-color: color-mix(in srgb, var(--brass) 45%, var(--line));
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.card:focus-visible { outline: 1px solid var(--brass); outline-offset: 2px; }

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.card-id { min-width: 0; }

.card-ticker {
  font-family: var(--serif);
  font-size: 20px;
  letter-spacing: 0.02em;
  line-height: 1.1;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-name {
  margin-top: 2px;
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score {
  text-align: right;
  border-right: 2px solid var(--line-strong);
  padding-right: 10px;
  flex-shrink: 0;
}
.score-num {
  display: block;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.score-label {
  display: block;
  margin-top: 2px;
  font-size: 9.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.score-max {
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0;
}
/* signal tiers: Kauf >= 7, Hold 4-6, Verkauf <= 3 */
.score-buy { border-right-color: var(--up); }
.score-buy .score-num { color: var(--up); }
.score-hold { border-right-color: var(--brass); }
.score-hold .score-num { color: var(--ink); }
.score-sell { border-right-color: var(--down); }
.score-sell .score-num { color: var(--down); }
.score-na .score-num { color: var(--ink-3); }

.card-price {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
}
.price {
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.price .cur {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 400;
  margin-left: 3px;
}
.mom {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 2px 8px;
  border-radius: var(--r-sm);
}
.mom.up { color: var(--up); background: var(--up-dim); }
.mom.down { color: var(--down); background: var(--down-dim); }
.mom-period {
  margin-left: 5px;
  font-weight: 400;
  font-size: 10.5px;
  opacity: 0.75;
}
.hint {
  font-size: 11px;
  color: var(--brass);
  background: var(--brass-dim);
  border: 1px solid color-mix(in srgb, var(--brass) 30%, transparent);
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
}
.src-badge {
  font-size: 9px;
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass);
  border: 1px solid color-mix(in srgb, var(--brass) 35%, transparent);
  padding: 1px 6px;
  border-radius: 999px;
}

/* Sparkline strip */
.card-spark {
  position: relative;
  height: 76px;
  margin: 0 -16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg-inset);
}
.spark {
  position: absolute;
  inset: 6px 0;
  width: 100%;
  height: calc(100% - 12px);
}
.spark-line {
  fill: none;
  stroke: var(--ink-2);
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}
.spark-area { fill: color-mix(in srgb, var(--ink-2) 7%, transparent); }
.spark-dot { fill: var(--brass); }
.spark-empty {
  display: grid;
  place-items: center;
  height: 100%;
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.05em;
}

/* Criteria chips */
.crit-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 11.5px;
  color: var(--ink-2);
}
.crit { display: inline-flex; align-items: center; gap: 6px; cursor: help; }

.card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  min-height: 28px;
}
.foot-cue {
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  transition: color 0.2s;
}
.card:hover .foot-cue { color: var(--brass); }

.tv-link, .modal-tv-link {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-3);
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: color 0.2s;
}
.tv-link:hover, .modal-tv-link:hover { color: var(--brass); }

/* Ticker-Dokument (PDF aus dem Blob, hinter dem Zugangscode) */
.doc-link {
  background: none;
  border: none;
  padding: 0;
  margin-right: 12px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--ink-3);
  cursor: pointer;
  transition: color 0.2s;
}
.doc-link:hover { color: var(--brass); }
.doc-link .arrow { margin-left: 3px; }
.doc-link.doc-error { color: var(--down); }

.hint-warn { color: var(--down); }
.arrow {
  display: inline-block;
  margin-left: 5px;
  transition: transform 0.2s var(--ease);
}
.tv-link:hover .arrow, .modal-tv-link:hover .arrow { transform: translate(2px, -2px); }

.crit-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid var(--ink-3);
}
.crit-dot.pass { background: var(--up); border-color: var(--up); }
.crit-dot.fail { background: transparent; border-color: var(--down); }
.crit-dot.neutral { border-color: var(--line-strong); }

/* Display-only signals: trailing stop, revenue */
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}
.card-meta > span { cursor: help; }
.rev { font-variant-numeric: tabular-nums; }
.flag-stop {
  color: var(--down);
  font-weight: 600;
}
.flag-stop::before {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  border: 1.5px solid var(--down);
  vertical-align: middle;
}

/* ---------- Methodik ---------- */
.methodik {
  border-top: 1px solid var(--line);
  padding: clamp(64px, 9vh, 108px) 0;
  background: var(--bg-subtle);
}
.methodik-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(24px, 3vw, 48px);
}
.m-col h3 {
  font-family: var(--serif);
  font-size: 17px;
  margin-bottom: 10px;
  color: var(--brass);
}
.m-col p {
  font-size: 14px;
  color: var(--ink-2);
  text-wrap: pretty;
}
.methodik-disclaimer {
  margin-top: clamp(28px, 4vh, 44px);
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-3);
  letter-spacing: 0.03em;
}

/* ---------- Portfolio ---------- */
.hero-sub { padding-bottom: clamp(40px, 6vh, 72px); }
.hero-sub .hero-lead { margin-top: 22px; max-width: none; }

.portfolio { padding: clamp(48px, 7vh, 84px) 0 clamp(64px, 9vh, 108px); }

.stat-band {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border: 1px solid var(--line);
  border-top: 2px solid var(--brass);
  border-radius: var(--r-md);
  background: var(--bg-raised);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.stat {
  padding: 22px 24px 20px;
  border-right: 1px solid var(--line);
}
.stat:last-child { border-right: none; }
.stat-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.stat-value {
  font-family: var(--serif);
  font-size: clamp(22px, 2.2vw, 30px);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.stat-unit {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-3);
  margin-left: 6px;
}

.table-note {
  margin: 28px 0;
  padding: 16px 20px;
  border-left: 2px solid var(--brass);
  background: var(--brass-dim);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 13.5px;
  color: var(--ink-2);
  text-wrap: pretty;
}
.table-note strong { color: var(--ink); }

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow-x: auto;
  background: var(--bg-raised);
}
.positions {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 900px;
}
.positions th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
.positions td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: baseline;
}
.positions tbody tr:last-child td { border-bottom: none; }
.positions tbody tr { transition: background 0.15s; }
.positions tbody tr:hover { background: var(--brass-dim); }

.positions .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.positions .muted { color: var(--ink-3); }

.pos-ticker {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 15px;
  margin-right: 10px;
}
.pos-name { color: var(--ink-3); font-size: 12.5px; }
.pos-sector { color: var(--ink-2); white-space: nowrap; }

.status-open {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--up);
  background: var(--up-dim);
  padding: 3px 9px;
  border-radius: 999px;
}

.portfolio-rules { margin-top: clamp(40px, 6vh, 64px); }
.portfolio-rules h2 {
  font-family: var(--serif);
  font-size: 22px;
  margin-bottom: 22px;
}

/* ---------- Legal pages ---------- */
.legal { padding: clamp(56px, 8vh, 96px) 0 clamp(72px, 10vh, 120px); }
.legal-wrap { max-width: 760px; }
.legal-title {
  font-family: var(--serif);
  font-size: clamp(32px, 4vw, 44px);
  margin-bottom: 36px;
}
.legal-body h2 {
  font-family: var(--serif);
  font-size: 18px;
  margin: 34px 0 10px;
  color: var(--brass);
}
.legal-body p, .legal-body li {
  color: var(--ink-2);
  font-size: 14.5px;
  text-wrap: pretty;
}
.legal-body p { margin-bottom: 10px; }
.legal-body strong { color: var(--ink); }
.legal-body ul { margin: 8px 0; padding-left: 20px; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  background: var(--bg-subtle);
  padding: clamp(40px, 6vh, 64px) 0 28px;
}
.footer-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr);
  gap: clamp(28px, 4vw, 72px);
  padding-bottom: 32px;
  border-bottom: 1px solid var(--line);
}
.footer-brand .brand-word { font-size: 19px; }
.footer-colophon {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--ink-3);
  max-width: 300px;
  text-wrap: pretty;
}
.footer-note p {
  font-size: 13px;
  color: var(--ink-2);
  text-wrap: pretty;
}
.footer-note strong { color: var(--ink); }

.footer-base {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 20px;
  font-size: 12.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.footer-base nav { display: flex; gap: 20px; }
.footer-base a {
  color: var(--ink-2);
  text-decoration: none;
  transition: color 0.2s;
}
.footer-base a:hover { color: var(--brass); }

/* ---------- Chart modal ---------- */
.chart-modal {
  width: min(1160px, calc(100vw - 32px));
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--bg-raised);
  color: var(--ink);
  padding: 0;
  box-shadow: 0 40px 120px -20px rgba(0, 0, 0, 0.7);
}
.chart-modal::backdrop {
  background: rgba(5, 5, 7, 0.72);
  backdrop-filter: blur(4px);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
}
.modal-ticker {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 22px;
  margin-right: 12px;
}
.modal-name { color: var(--ink-3); font-size: 13.5px; }
.modal-actions { display: flex; align-items: center; gap: 18px; }
.modal-close {
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--ink-2);
  transition: color 0.2s, border-color 0.2s;
}
.modal-close:hover { color: var(--ink); border-color: var(--line-strong); }
.modal-chart { height: min(64vh, 620px); background: var(--bg-inset); }
.modal-chart > div, .modal-chart iframe { height: 100% !important; }
.modal-foot {
  padding: 12px 22px;
  font-size: 11.5px;
  letter-spacing: 0.05em;
  color: var(--ink-3);
  border-top: 1px solid var(--line);
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .sector-index { grid-template-columns: repeat(3, 1fr); }
  .sector-index-item:nth-child(3n) { border-right: none; }
  .sector-index-item:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .stat-band { grid-template-columns: repeat(3, 1fr); }
  .stat:nth-child(3n) { border-right: none; }
  .stat:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; align-items: start; }
  .hero-rules { max-width: 560px; }
  .card-grid { grid-template-columns: 1fr; }
  .methodik-grid { grid-template-columns: 1fr; gap: 28px; }
  .footer-grid { grid-template-columns: 1fr; }
  .brand-claim { display: none; }
}

@media (max-width: 640px) {
  .nav-row { gap: 16px; }
  .nav-stand { display: none; }
  .sector-index { grid-template-columns: repeat(2, 1fr); }
  .sector-index-item { border-bottom: 1px solid var(--line); }
  .sector-index-item:nth-child(3n) { border-right: 1px solid var(--line); }
  .sector-index-item:nth-child(2n) { border-right: none; }
  .sector-index-item:nth-last-child(-n+2) { border-bottom: none; }
  .sector-head { flex-wrap: wrap; gap: 14px; }
  .sector-rule { display: none; }
  .stat-band { grid-template-columns: 1fr 1fr; }
  .stat { border-bottom: 1px solid var(--line); }
  .stat:nth-child(2n) { border-right: none; }
  .stat:nth-child(3n) { border-right: 1px solid var(--line); }
  .card-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Iteration 2: Buttons, Formulare, Admin, Titel-Auswahl, Trading
   ============================================================ */

/* ---------- Buttons ---------- */
.btn {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  border-radius: var(--r-sm);
  padding: 8px 16px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.15s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-primary {
  background: var(--brass);
  border: 1px solid var(--brass);
  color: #0a0a0c;
}
.btn-primary:hover:not(:disabled) { background: var(--brass-strong); border-color: var(--brass-strong); }
.btn-ghost {
  background: none;
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
}
.btn-ghost:hover:not(:disabled) {
  color: var(--brass);
  border-color: color-mix(in srgb, var(--brass) 50%, transparent);
  background: var(--brass-dim);
}
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-danger:hover:not(:disabled) {
  color: var(--down);
  border-color: color-mix(in srgb, var(--down) 50%, transparent);
  background: var(--down-dim);
}

/* ---------- Form controls ---------- */
input[type="text"], input[type="password"], select {
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--bg-inset);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  transition: border-color 0.2s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--brass);
}
input::placeholder { color: var(--ink-3); }

/* ---------- Status + Hinweise ---------- */
.op-status {
  font-size: 12.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.op-status.busy { color: var(--brass); }
.op-status.busy::before {
  content: "";
  display: inline-block;
  width: 10px; height: 10px;
  margin-right: 7px;
  border: 1.5px solid var(--brass);
  border-top-color: transparent;
  border-radius: 50%;
  animation: p24spin 0.8s linear infinite;
  vertical-align: -1px;
}
@keyframes p24spin { to { transform: rotate(360deg); } }
.op-status.ok { color: var(--up); }
.op-status.err { color: var(--down); }

.notice {
  border: 1px solid var(--line);
  border-left: 2px solid var(--brass);
  background: var(--brass-dim);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 16px 20px;
  font-size: 13.5px;
  color: var(--ink-2);
  margin-bottom: 24px;
}
.notice strong { color: var(--ink); }

.inline-confirm {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 12px;
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, var(--brass) 40%, transparent);
  background: var(--brass-dim);
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--ink);
}

/* ---------- Admin strip ---------- */
.admin-strip {
  display: none;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 12px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
}
.api-on .admin-strip, #ts-app .admin-strip { display: flex; }

/* ---------- Password gate ---------- */
html.locked body > *:not(.gate) { display: none !important; }

.gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: var(--bg);
}
html:not(.locked) .gate { display: none; }

.gate-card {
  width: min(400px, calc(100vw - 48px));
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  border-top: 2px solid var(--brass);
  border-radius: var(--r-md);
  padding: 36px 32px 28px;
  box-shadow: var(--shadow);
  text-align: center;
}
.gate-brand { margin-bottom: 24px; }
.gate-brand .brand-word { font-size: 28px; }
.gate-title { font-family: var(--serif); font-size: 20px; margin-bottom: 6px; }
.gate-hint { font-size: 13.5px; color: var(--ink-2); margin-bottom: 20px; }
.gate-card input { width: 100%; margin-bottom: 14px; }
.gate-btn { width: 100%; }
.gate-error { font-size: 12.5px; color: var(--down); min-height: 1.6em; margin-top: 10px; }

/* ---------- Titel updaten ---------- */
.titel-page { padding: clamp(40px, 6vh, 72px) 0 clamp(64px, 9vh, 108px); }

.ts-root { display: grid; gap: 28px; margin: 28px 0; }
.ts-sector {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-raised);
  overflow: hidden;
}
.ts-sector-title {
  font-family: var(--serif);
  font-size: 17px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}
.ts-cols { display: grid; grid-template-columns: 1fr 1fr; }
.ts-col { padding: 14px 20px 18px; }
.ts-col + .ts-col { border-left: 1px solid var(--line); }
.ts-col h4 {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.ts-col-sug h4 { color: var(--brass); }
.ts-count {
  display: inline-block;
  margin-left: 6px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.ts-col ul { list-style: none; margin: 0; padding: 0; }
.ts-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
}
.ts-item:first-child { border-top: none; }
.ts-ticker { font-family: var(--serif); font-weight: 600; min-width: 56px; }
.ts-name {
  flex: 1;
  color: var(--ink-3);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ts-score {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--brass);
  font-size: 12.5px;
  cursor: help;
}
.ts-score-buy { color: var(--up); }
.ts-score-sell { color: var(--down); }
.ts-remove {
  background: none;
  border: none;
  color: var(--ink-3);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--r-sm);
}
.ts-remove:hover { color: var(--down); background: var(--down-dim); }
.ts-empty { color: var(--ink-3); font-size: 12.5px; padding: 8px 0; }

/* ---------- Universe Editor ---------- */
.universe-section {
  border-top: 1px solid var(--line);
  padding-top: 24px;
  margin-top: 32px;
}
.universe-section > h3 {
  font-family: var(--serif);
  font-size: 17px;
  margin-bottom: 16px;
  color: var(--brass);
}
.uni-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.uni-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-family: var(--mono);
  padding: 3px 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink-2);
}
.uni-rm {
  all: unset;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  color: var(--ink-3);
  padding: 0 2px;
  border-radius: 2px;
}
.uni-rm:hover { color: var(--down); background: var(--down-dim); }

.ts-add {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-raised);
  padding: 16px 20px;
  margin-bottom: 24px;
}
.ts-add h3 { font-family: var(--serif); font-size: 15px; margin-bottom: 12px; }
.ts-add-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ts-add-row input { width: 160px; text-transform: uppercase; }

.ts-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.ts-actions input { flex: 1; min-width: 220px; }
.ts-total { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ts-buttons { display: flex; gap: 10px; }

/* ---------- Archiv ---------- */
.archive-modal {
  width: min(760px, calc(100vw - 32px));
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--bg-raised);
  color: var(--ink);
  padding: 0;
  box-shadow: 0 40px 120px -20px rgba(0, 0, 0, 0.7);
}
.archive-modal::backdrop { background: rgba(5, 5, 7, 0.72); backdrop-filter: blur(4px); }
.arch-list {
  list-style: none;
  margin: 0;
  padding: 8px 22px 18px;
  max-height: 60vh;
  overflow-y: auto;
}
.arch-item { padding: 14px 0; border-bottom: 1px solid var(--line); }
.arch-item:last-child { border-bottom: none; }
.arch-item > div { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.arch-kind {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass);
  border: 1px solid color-mix(in srgb, var(--brass) 35%, transparent);
  padding: 1px 8px;
  border-radius: 999px;
}
.arch-when { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.arch-note { font-size: 12.5px; color: var(--ink-2); }
.arch-tickers {
  margin: 8px 0;
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.arch-actions { display: flex; gap: 8px; }

/* ---------- Portfolio (Trading) ---------- */
.pf-stamp {
  margin: 12px 2px 24px;
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.pf-controls {
  display: grid;
  gap: 18px;
  margin-bottom: 26px;
}
.pf-trade {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-raised);
  padding: 16px 20px;
}
.pf-trade h3 { font-family: var(--serif); font-size: 15px; margin-bottom: 12px; }
.pf-trade-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pf-trade-row input#pf-ticker { width: 120px; text-transform: uppercase; }
.pf-trade-row input#pf-value { width: 130px; }
.pf-quote { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.pf-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.pf-reco { margin-bottom: 26px; }
.pf-reco-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}
.pf-reco-row:first-child { border-top: none; }
.pf-reco-row input { width: 110px; }
.reco-detail { font-size: 13px; color: var(--ink-2); }

.status-stop {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--down);
  background: var(--down-dim);
  padding: 3px 9px;
  border-radius: 999px;
}
td.up, .stat-value.up, span.up { color: var(--up); }
td.down, .stat-value.down, span.down { color: var(--down); }

.pf-log { margin: 22px 2px; font-size: 13px; color: var(--ink-2); }
.pf-log summary { cursor: pointer; color: var(--ink-3); letter-spacing: 0.04em; }
.pf-log ul { list-style: none; margin: 12px 0 0; padding: 0; }
.pf-log li {
  display: flex;
  gap: 16px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
  flex-wrap: wrap;
}

@media (max-width: 760px) {
  .ts-cols { grid-template-columns: 1fr; }
  .ts-col + .ts-col { border-left: none; border-top: 1px solid var(--line); }
  .stat-band { grid-template-columns: 1fr 1fr; }
}

/* ---------- Executive Summary ---------- */
.exec { padding: clamp(28px, 4vh, 44px) 0 0; }
.exec-panel {
  border: 1px solid var(--line);
  border-top: 2px solid var(--brass);
  border-radius: var(--r-md);
  background: var(--bg-raised);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.exec-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 22px 12px;
  border-bottom: 1px solid var(--line);
}
.exec-title {
  font-family: var(--serif);
  font-size: 18px;
  letter-spacing: 0.02em;
}
.exec-sub {
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}
.exec-row {
  display: flex;
  align-items: baseline;
  gap: 18px;
  padding: 12px 22px;
  border-top: 1px solid var(--line);
}
.exec-row:first-of-type { border-top: none; }
.exec-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 96px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.exec-buy .exec-label { color: var(--up); }
.exec-sell .exec-label { color: var(--down); }
.exec-hold .exec-label { color: var(--ink-2); }
.exec-count {
  font-family: var(--serif);
  font-size: 13px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  text-transform: none;
}
.exec-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.exec-chip {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0.03em;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 3px 11px;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.exec-chip:hover {
  color: var(--brass);
  border-color: color-mix(in srgb, var(--brass) 50%, transparent);
  background: var(--brass-dim);
}
.exec-chip.dim { color: var(--ink-3); border-style: dashed; }
.exec-empty { font-size: 12.5px; color: var(--ink-3); }

/* Anchor jump comfort: sticky nav offset + target highlight */
.card { scroll-margin-top: 96px; }
.card:target {
  border-color: var(--brass);
  box-shadow: 0 0 0 1px var(--brass), var(--shadow);
}

@media (max-width: 640px) {
  .exec-row { flex-direction: column; gap: 10px; }
}
