/* =====================================================================
   screener.css — Aktien-Screener (Market Compass)
   Teilt die DNA des Handels-Terminals: dunkles Mission-Control-Cockpit,
   Mono-forward, Haarlinien-Raster, tabellarische Zahlen, kein Neon.
   ===================================================================== */
:root {
  --bg:        #06080b;
  --bg-2:      #090c11;
  --panel:     #0b0f15;
  --panel-2:   #0e131a;
  --rail:      #0a0e13;
  --hair:      #1a212c;
  --hair-2:    #131922;
  --ink:       #cdd6e2;
  --ink-soft:  #8a96a6;
  --ink-dim:   #5b6675;
  --ink-faint: #3a434f;

  --green:     #3ecf8e;
  --green-dim: #1f6b4d;
  --red:       #e0593f;
  --red-dim:   #7a2d20;
  --amber:     #d9a441;
  --cyan:      #4aa8d8;
  --violet:    #8b86d8;

  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --sans: "Space Grotesk", system-ui, sans-serif;

  --cols: 3;   /* per JS / Dichte-Schalter gesetzt */
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  background:
    radial-gradient(1300px 760px at 50% -8%, #0c1119 0%, var(--bg) 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.dim { color: var(--ink-dim); }
.up { color: var(--green); }
.down { color: var(--red); }
.flat { color: var(--ink-dim); }

#app { max-width: 1640px; margin: 0 auto; padding: 0 18px 40px; }

/* ===================== TOP BAR ===================== */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 24px;
  padding: 12px 4px;
  background: linear-gradient(180deg, var(--bg) 70%, rgba(6,8,11,0.86));
  border-bottom: 1px solid var(--hair);
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-link { display: flex; align-items: center; gap: 11px; text-decoration: none; min-width: 0; transition: opacity .15s; }
.brand-link:hover { opacity: 0.78; }
.copy-link { color: inherit; text-decoration: none; }
.copy-link:hover { text-decoration: underline; text-underline-offset: 2px; }
.brand .mc-mono { font-family: "Cormorant Garamond", serif; font-weight: 600; font-size: 17px; letter-spacing: 0.04em; color: #cdd9ee; width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 6px; background: linear-gradient(150deg, #1c2a44 0%, #0e1726 55%, #122242 100%); border: 1px solid #2a3a55; box-shadow: inset 0 1px 0 rgba(255,255,255,0.06); }
.brand .mc-word { font-family: "Cormorant Garamond", serif; font-weight: 600; font-size: 21px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink); white-space: nowrap; }
.brand .sub { font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-dim); white-space: nowrap; align-self: center; padding-left: 10px; border-left: 1px solid var(--hair); }
.topbar .center { text-align: center; }
.topbar .center .ttl { font-size: 10px; letter-spacing: 0.26em; text-transform: uppercase; color: var(--ink-soft); white-space: nowrap; }
.topbar .center .ttl b { color: var(--ink); }
.topbar .right { display: flex; align-items: center; justify-content: flex-end; gap: 16px; }
.utc-clock { text-align: right; }
.utc-clock .t { font-size: 19px; letter-spacing: 0.05em; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1; }
.utc-clock .d { font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-dim); margin-top: 4px; }
.utc-clock .d b { color: var(--cyan); font-weight: 400; }
.feed-state { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; padding-left: 16px; border-left: 1px solid var(--hair); }
.feed-state .lbl { font-size: 8.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-dim); }
.feed-state .pill { display: inline-flex; align-items: center; gap: 7px; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; padding: 3px 9px; border: 1px solid currentColor; border-radius: 2px; color: var(--ink-dim); white-space: nowrap; }
.feed-state .pill.live { color: var(--green); }
.feed-state .pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.feed-state .pill.live .dot { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

/* ===================== EDU / HELP STRIP ===================== */
.help { border: 1px solid var(--hair); border-radius: 3px; background: var(--panel); margin: 16px 0 0; overflow: hidden; }
.help-hd { display: flex; align-items: center; gap: 10px; padding: 11px 15px; cursor: pointer; user-select: none; }
.help-hd .ix { width: 18px; height: 18px; flex: none; border: 1px solid var(--cyan); color: var(--cyan); border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-style: italic; font-family: var(--sans); }
.help-hd .h { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink); }
.help-hd .h b { color: var(--cyan); font-weight: 600; }
.help-hd .chev { margin-left: auto; color: var(--ink-dim); font-size: 11px; transition: transform .2s; }
.help.open .help-hd .chev { transform: rotate(180deg); }
.help-bd { display: none; padding: 4px 15px 16px; border-top: 1px solid var(--hair-2); }
.help.open .help-bd { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--hair-2); }
.help-card { background: var(--panel); padding: 13px 15px 14px; }
.help-card .k { font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--amber); margin-bottom: 7px; display: flex; align-items: center; gap: 7px; }
.help-card .k .num { color: var(--ink-faint); }
.help-card p { margin: 0; font-size: 11.5px; line-height: 1.55; color: var(--ink-soft); }
.help-card p b { color: var(--ink); font-weight: 600; }
.help-card .cmark { color: #aab0bb; } .help-card .cmark.r { color: #d9dde4; }

/* ===================== TOOLBAR ===================== */
.toolbar { display: flex; flex-direction: column; gap: 9px; margin: 16px 0 4px; }
.toolrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tool-grp { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tool-grp > .glabel { font-size: 8.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-dim); white-space: nowrap; }
.spacer { flex: 1 1 auto; }

/* Segmented control */
.seg { display: inline-flex; background: var(--rail); border: 1px solid var(--hair); border-radius: 3px; padding: 2px; gap: 2px; }
.seg button { appearance: none; border: none; background: transparent; color: var(--ink-soft); font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; padding: 5px 11px; border-radius: 2px; cursor: pointer; transition: background .14s, color .14s; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--panel-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--hair); }
.seg.amber button.on { color: var(--amber); box-shadow: inset 0 0 0 1px rgba(217,164,65,0.4); background: rgba(217,164,65,0.08); }
.seg.cyan button.on { color: var(--cyan); box-shadow: inset 0 0 0 1px rgba(74,168,216,0.4); background: rgba(74,168,216,0.08); }

/* Toggle-Button (Overlays) */
.tgl { appearance: none; display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--hair); background: var(--rail); color: var(--ink-soft); font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; padding: 6px 11px; border-radius: 3px; cursor: pointer; transition: border-color .14s, color .14s, background .14s; white-space: nowrap; }
.tgl:hover { color: var(--ink); }
.tgl .dot { width: 7px; height: 7px; border-radius: 2px; background: var(--ink-faint); flex: none; transition: background .14s, box-shadow .14s; }
.tgl.on { color: var(--ink); border-color: var(--ink-dim); background: var(--panel-2); }
.tgl.on .dot { background: var(--cyan); box-shadow: 0 0 5px rgba(74,168,216,0.7); }
.fokus-hint .glabel { color: var(--ink-faint); text-transform: none; letter-spacing: 0.04em; }

/* Sector chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { appearance: none; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--hair); background: var(--rail); color: var(--ink-soft); font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.02em; padding: 5px 10px; border-radius: 2px; cursor: pointer; transition: border-color .14s, color .14s, background .14s; white-space: nowrap; }
.chip:hover { color: var(--ink); }
.chip .sw { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--ink-faint); }
.chip.on { color: var(--ink); border-color: var(--ink-dim); background: var(--panel-2); }

/* Search */
.search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--hair); background: var(--rail); border-radius: 3px; padding: 0 10px; height: 32px; min-width: 190px; }
.search:focus-within { border-color: var(--cyan); }
.search svg { width: 13px; height: 13px; flex: none; color: var(--ink-dim); }
.search input { appearance: none; border: none; background: transparent; outline: none; color: var(--ink); font-family: var(--mono); font-size: 12px; width: 100%; }
.search input::placeholder { color: var(--ink-faint); }

/* Sort select */
.selwrap { display: inline-flex; align-items: center; gap: 0; border: 1px solid var(--hair); background: var(--rail); border-radius: 3px; height: 32px; overflow: hidden; }
.selwrap select { appearance: none; border: none; background: transparent; color: var(--ink); font-family: var(--mono); font-size: 11.5px; padding: 0 26px 0 11px; height: 100%; cursor: pointer; outline: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='6' viewBox='0 0 8 6'%3E%3Cpath d='M0 0h8L4 6z' fill='%235b6675'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; }
.selwrap select option { background: var(--panel); color: var(--ink); }
.dirbtn { appearance: none; border: none; border-left: 1px solid var(--hair); background: transparent; color: var(--ink-soft); width: 30px; height: 100%; cursor: pointer; font-size: 12px; display: grid; place-items: center; transition: color .14s; }
.dirbtn:hover { color: var(--ink); }
.selwrap.locked { opacity: 0.4; pointer-events: none; }

.countline { font-size: 10px; letter-spacing: 0.06em; color: var(--ink-dim); padding: 2px 2px 0; }
.countline b { color: var(--ink-soft); font-weight: 500; }

/* ===================== GRID ===================== */
.grid { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 12px; margin-top: 12px; }

.card { border: 1px solid var(--hair); background: var(--panel); border-radius: 3px; padding: 13px 14px 12px; display: flex; flex-direction: column; gap: 10px; transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--ink-faint); }
.card.hidden { display: none; }

.card-hd { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; }
.card-id { min-width: 0; }
.card-sym { display: flex; align-items: center; gap: 8px; }
.card-sym .star { appearance: none; border: none; background: transparent; color: var(--ink-faint); cursor: pointer; font-size: 13px; line-height: 1; padding: 0; transition: color .14s; }
.card-sym .star:hover { color: var(--ink-soft); }
.card-sym .star.on { color: var(--amber); }
.card-sym .sym { font-family: var(--sans); font-weight: 700; font-size: 16px; letter-spacing: 0.02em; color: var(--ink); }
.card-name { font-size: 11px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.card-sector { display: inline-flex; align-items: center; gap: 6px; font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-dim); margin-top: 6px; }
.card-sector .sw { width: 7px; height: 7px; border-radius: 2px; flex: none; }
.card-px { text-align: right; white-space: nowrap; }
.card-px .px { font-size: 17px; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1; }
.card-px .ch { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; font-size: 11px; font-variant-numeric: tabular-nums; padding: 2px 7px; border-radius: 2px; border: 1px solid transparent; }
.card-px .ch.up { color: var(--green); border-color: rgba(62,207,142,0.32); background: rgba(62,207,142,0.07); }
.card-px .ch.down { color: var(--red); border-color: rgba(224,89,63,0.32); background: rgba(224,89,63,0.07); }
.card-px .ch.flat { color: var(--ink-dim); border-color: var(--hair); }
.card-px .ch .ar { font-size: 9px; }

.chart-wrap { position: relative; height: 178px; cursor: pointer; }
.chart-wrap::after { content: "⤢"; position: absolute; top: 5px; right: 7px; font-size: 11px; color: var(--ink-faint); opacity: 0; transition: opacity .15s; pointer-events: none; }
.card:hover .chart-wrap::after { opacity: 1; }
.chart-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.chart-wrap .tf-badge { position: absolute; top: 6px; left: 7px; font-size: 8.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); pointer-events: none; white-space: nowrap; }

.card-ft { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-top: 9px; border-top: 1px solid var(--hair-2); }
.card-ft .cell { min-width: 0; }
.card-ft .k { font-size: 8px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 3px; white-space: nowrap; }
.card-ft .v { font-size: 11px; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-ft .v b { color: var(--ink); font-weight: 500; }
.card-src { display: flex; align-items: center; gap: 6px; font-size: 8.5px; letter-spacing: 0.06em; color: var(--ink-faint); margin-top: 1px; }
.card-src .d { width: 5px; height: 5px; border-radius: 50%; background: var(--ink-faint); flex: none; }
.card-src.live .d { background: var(--green); box-shadow: 0 0 5px var(--green); }
.card-src.live { color: var(--ink-dim); }

.empty { grid-column: 1 / -1; text-align: center; padding: 50px 20px; color: var(--ink-dim); font-size: 12px; letter-spacing: 0.04em; border: 1px dashed var(--hair); border-radius: 3px; }

/* ===================== FOKUS-CHART ===================== */
.focus[hidden] { display: none; }
.focus { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 32px; background: rgba(3,5,8,0.78); backdrop-filter: blur(4px); }
.focus-box { width: min(1180px, 94vw); height: min(80vh, 780px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--hair); border-radius: 5px; box-shadow: 0 30px 80px rgba(0,0,0,0.6); overflow: hidden; }
.focus-hd { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--hair); }
.focus-hd .fh-id { display: flex; align-items: baseline; gap: 12px; min-width: 0; flex: 1 1 auto; }
.focus-hd .fsym { font-family: var(--sans); font-weight: 700; font-size: 22px; letter-spacing: 0.02em; color: var(--ink); }
.focus-hd .fname { font-size: 13px; color: var(--ink-soft); white-space: nowrap; flex: none; }
.focus-hd .fsec { font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim); white-space: nowrap; }
.focus-hd .fh-px { margin-left: auto; display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.focus-hd .fpx { font-size: 22px; color: var(--ink); font-variant-numeric: tabular-nums; }
.focus-hd .fch { font-size: 12px; padding: 3px 9px; border-radius: 2px; border: 1px solid var(--hair); font-variant-numeric: tabular-nums; }
.focus-hd .fch.up { color: var(--green); border-color: rgba(62,207,142,0.32); background: rgba(62,207,142,0.07); }
.focus-hd .fch.down { color: var(--red); border-color: rgba(224,89,63,0.32); background: rgba(224,89,63,0.07); }
.focus-hd .fch.flat { color: var(--ink-dim); }
.focus-hd .fclose { appearance: none; border: 1px solid var(--hair); background: var(--rail); color: var(--ink-soft); width: 32px; height: 32px; border-radius: 3px; cursor: pointer; font-size: 14px; flex: none; transition: color .14s, border-color .14s; }
.focus-hd .fclose:hover { color: var(--ink); border-color: var(--ink-dim); }
.focus-chart { position: relative; flex: 1 1 auto; padding: 8px 10px; min-height: 0; }
.focus-chart canvas { position: absolute; inset: 8px 10px; width: calc(100% - 20px); height: calc(100% - 16px); display: block; }
.focus-ft { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; border-top: 1px solid var(--hair-2); font-size: 9px; letter-spacing: 0.08em; color: var(--ink-faint); text-transform: uppercase; }
.focus-ft .fmeta { color: var(--ink-dim); }

/* ===================== FOOTER ===================== */
.foot { margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--hair-2); text-align: center; }
.foot .note { font-size: 9px; letter-spacing: 0.08em; color: var(--ink-faint); line-height: 1.6; }
.foot .copy { font-size: 8.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-dim); margin-top: 6px; }
.foot .copy b { color: var(--amber); font-weight: 500; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 1180px) { :root { --cols: 2 !important; } .help.open .help-bd { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) {
  :root { --cols: 1 !important; }
  .topbar { grid-template-columns: 1fr; gap: 10px; }
  .topbar .center, .topbar .right { justify-content: flex-start; text-align: left; }
  .topbar .right { justify-content: flex-start; }
  .help.open .help-bd { grid-template-columns: 1fr; }
}

/* ---- Zeichenwerkzeuge (drawtools.js) ---- */
.dt-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 7px 10px; background: var(--panel, #0c1118); border: 1px solid var(--hair, rgba(255,255,255,0.07)); border-radius: 3px; margin-bottom: 8px; }
.dt-tools { display: flex; gap: 3px; }
.dt-b { font-family: var(--mono); font-size: 13px; line-height: 1; width: 28px; height: 26px; display: grid; place-items: center; background: transparent; color: var(--ink-soft, #aeb6c4); border: 1px solid var(--hair, rgba(255,255,255,0.08)); border-radius: 2px; cursor: pointer; transition: all .12s; padding: 0; }
.dt-b:hover { color: var(--ink, #e8edf4); border-color: var(--ink-dim, #5b6675); }
.dt-b.on { background: var(--ink-soft, #aeb6c4); color: #06080b; border-color: var(--ink-soft, #aeb6c4); }
.dt-b.dt-clr { width: auto; padding: 0 8px; font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; }
.dt-b.dt-del { color: var(--red, #e0593f); }
.dt-cols { display: flex; gap: 4px; }
.dt-sw { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.15); cursor: pointer; padding: 0; transition: transform .12s; }
.dt-sw:hover { transform: scale(1.12); }
.dt-sw.on { box-shadow: 0 0 0 2px var(--bg, #06080b), 0 0 0 3px currentColor; }
.dt-ell-grp { display: flex; align-items: center; gap: 2px; }
.dt-ell-sep { width: 1px; height: 16px; background: var(--hair, rgba(255,255,255,0.12)); margin: 0 4px; }
.dt-ell { font-family: var(--mono); font-size: 12px; min-width: 22px; height: 26px; padding: 0 5px; background: transparent; color: var(--amber, #d9a441); border: 1px dashed var(--ink-dim, #5b6675); border-radius: 2px; cursor: pointer; transition: all .12s; }
.dt-ell:hover { border-style: solid; }
.dt-ell.on { background: var(--amber, #d9a441); color: #06080b; border-style: solid; border-color: var(--amber, #d9a441); }
.dt-ov { cursor: inherit; }
