/* Design der Briefing-Seite (Dashboard-Aufbau).
   Mobile-first: Grundlayout für das Smartphone, Anpassungen für größere
   Bildschirme stehen am Ende. Kategoriefarben: Klassen c-politik, c-wirtschaft,
   c-werte, c-versicherung, c-alle, c-highlight, c-kurse. */

:root {
  --bg: #f6f5f1; --card: #ffffff; --text: #1c1c1a; --muted: #6b6a66; --line: #e4e2dc;
  --accent: #1f5f8b; --up: #1e7d4c; --down: #b3322c; --read-opacity: 0.45;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Kategoriefarben: Fläche (bg, nur für Highlight-Karten), Text auf Fläche (fg),
     Akzent (acc, Streifen/Symbole), Text auf neutraler Kachel (text) */
  --politik-bg: #EEEDFE; --politik-fg: #3C3489; --politik-acc: #7F77DD; --politik-text: #534AB7;
  --wirtschaft-bg: #FAECE7; --wirtschaft-fg: #712B13; --wirtschaft-acc: #D85A30; --wirtschaft-text: #993C1D;
  --werte-bg: #E6F1FB; --werte-fg: #0C447C; --werte-acc: #378ADD; --werte-text: #185FA5;
  --versicherung-bg: #E1F5EE; --versicherung-fg: #085041; --versicherung-acc: #1D9E75; --versicherung-text: #0F6E56;
  --alle-bg: #F1EFE8; --alle-fg: #2C2C2A; --alle-acc: #888780; --alle-text: #444441;
  --highlight-bg: #FAEEDA; --highlight-fg: #633806; --highlight-acc: #EF9F27; --highlight-text: #854F0B;
  --kurse-bg: #ffffff; --kurse-fg: #1c1c1a; --kurse-acc: #888780; --kurse-text: #1c1c1a;
  --neutral-bg: #F1EFE8; --neutral-fg: #444441; --neutral-acc: #B4B2A9; --neutral-text: #444441;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131312; --card: #1e1e1c; --text: #ecebe6; --muted: #a09f98; --line: #2e2e2b;
    --accent: #7fb3d9; --up: #5fc48a; --down: #ef7a72;
    --politik-bg: #26215C; --politik-fg: #CECBF6; --politik-acc: #AFA9EC; --politik-text: #CECBF6;
    --wirtschaft-bg: #4A1B0C; --wirtschaft-fg: #F5C4B3; --wirtschaft-acc: #F0997B; --wirtschaft-text: #F5C4B3;
    --werte-bg: #042C53; --werte-fg: #B5D4F4; --werte-acc: #85B7EB; --werte-text: #B5D4F4;
    --versicherung-bg: #04342C; --versicherung-fg: #9FE1CB; --versicherung-acc: #5DCAA5; --versicherung-text: #9FE1CB;
    --alle-bg: #2C2C2A; --alle-fg: #D3D1C7; --alle-acc: #B4B2A9; --alle-text: #D3D1C7;
    --highlight-bg: #412402; --highlight-fg: #FAC775; --highlight-acc: #EF9F27; --highlight-text: #FAC775;
    --kurse-bg: #1e1e1c; --kurse-fg: #ecebe6; --kurse-acc: #888780; --kurse-text: #ecebe6;
    --neutral-bg: #2C2C2A; --neutral-fg: #D3D1C7; --neutral-acc: #888780; --neutral-text: #D3D1C7;
  }
}
/* Jede Kategorie-Klasse setzt drei generische Variablen */
.c-politik { --cbg: var(--politik-bg); --cfg: var(--politik-fg); --cacc: var(--politik-acc); --ctext: var(--politik-text); }
.c-wirtschaft { --cbg: var(--wirtschaft-bg); --cfg: var(--wirtschaft-fg); --cacc: var(--wirtschaft-acc); --ctext: var(--wirtschaft-text); }
.c-werte { --cbg: var(--werte-bg); --cfg: var(--werte-fg); --cacc: var(--werte-acc); --ctext: var(--werte-text); }
.c-versicherung { --cbg: var(--versicherung-bg); --cfg: var(--versicherung-fg); --cacc: var(--versicherung-acc); --ctext: var(--versicherung-text); }
.c-alle { --cbg: var(--alle-bg); --cfg: var(--alle-fg); --cacc: var(--alle-acc); --ctext: var(--alle-text); }
.c-highlight { --cbg: var(--highlight-bg); --cfg: var(--highlight-fg); --cacc: var(--highlight-acc); --ctext: var(--highlight-text); }
.c-kurse { --cbg: var(--kurse-bg); --cfg: var(--kurse-fg); --cacc: var(--kurse-acc); --ctext: var(--kurse-text); }
.c-neutral { --cbg: var(--neutral-bg); --cfg: var(--neutral-fg); --cacc: var(--neutral-acc); --ctext: var(--neutral-text); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.45; }
a { color: inherit; }
.ico { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: none; }

/* Kopfzeile */
.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand { text-decoration: none; }
.top h1 { font-size: 20px; margin: 0; letter-spacing: -0.02em; }
.top .stand { display: block; font-size: 12px; color: var(--muted); }
.toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }

.layout { max-width: 1100px; margin: 0 auto; }
.pane { padding: 14px; }

/* ---------- Startseite ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 8px; text-align: center; text-decoration: none; }
.stat .num { display: block; font-size: 22px; font-weight: 700; line-height: 1.1; }
.stat .lbl { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

h2.group { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 18px 0 8px; }

.tile {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
  background: var(--card); color: var(--ctext, var(--text));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px; margin-bottom: 8px;
  transition: transform 0.08s;
}
.tile:active { transform: scale(0.99); }
.tile .ico { width: 22px; height: 22px; color: var(--cacc, var(--muted)); }
.tile .chev { margin-left: auto; width: 18px; height: 18px; color: var(--cacc, var(--muted)); opacity: 0.8; }
.tile .name { font-weight: 600; font-size: 16px; }
.tile .nr { font-size: 12px; font-weight: 700; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--cacc); color: var(--ctext); display: inline-flex; align-items: center; justify-content: center; }
.tile .counts { font-size: 12px; color: var(--muted); margin-left: auto; white-space: nowrap; }
.tile .counts + .chev { margin-left: 0; }
.tile .badge { font-size: 12px; font-weight: 700; background: var(--cbg); color: var(--cfg); border-radius: 999px; padding: 1px 8px; margin-left: auto; }
.tile .badge + .chev { margin-left: 0; }
.tile.soon { opacity: 0.55; }
.tiles.small .tile { padding: 10px 14px; }
.tiles.small .tile .name { font-size: 14px; font-weight: 500; }

.tile.kurse, .tile.c-highlight { display: block; }
.tile-head { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.tile-head .sub { font-weight: normal; font-size: 12px; color: var(--muted); }
.movers { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 14px; }
.mover .mname { color: var(--muted); }

/* ---------- Ansichten ---------- */
.view { display: none; scroll-margin-top: 70px; }
.view.active { display: block; }
.view-head { display: flex; align-items: center; gap: 10px; margin: -14px -14px 12px; padding: 12px 14px; background: var(--card); color: var(--ctext); border-bottom: 1px solid var(--line); }
.view-head h2 { margin: 0; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.view-head .ico { color: var(--cacc); }
.view-head .back { display: flex; padding: 4px; border-radius: 8px; color: var(--muted); }
.hint, .empty { font-size: 13px; color: var(--muted); margin: 4px 0 10px; }
h3.block-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 12px 0 6px; display: flex; align-items: center; gap: 6px; }
.daygroup { margin: 12px 0 0; }
.daygroup summary.day { position: sticky; top: 54px; z-index: 5; background: var(--bg); font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 6px 0; cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
.daygroup summary.day::-webkit-details-marker { display: none; }
.daygroup summary.day::before { content: ""; width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); transition: transform 0.15s; margin-left: 2px; }
.daygroup[open] summary.day::before { transform: rotate(45deg); }
.daygroup summary.day .n { font-weight: normal; letter-spacing: 0; text-transform: none; border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; font-size: 11px; }

/* Artikel */
.articles { list-style: none; margin: 0; padding: 0; }
.article {
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--cacc, var(--line)); border-radius: 0 var(--radius) var(--radius) 0;
  padding: 10px 12px; margin-bottom: 8px; transition: opacity 0.2s;
}
.article .title { display: block; font-weight: 600; text-decoration: none; font-size: 16px; line-height: 1.3; }
.article .summary { margin: 5px 0 0; font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
body.compact .article .summary { display: none; }
.article .meta { margin-top: 6px; font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.article .meta .source { font-weight: 600; }
.article .meta .also a { color: var(--accent); text-decoration: none; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; border: 1px solid var(--line); }
.tag.pos { border-color: var(--werte-acc); color: var(--werte-fg); background: var(--werte-bg); }

.article .trash { margin-left: auto; background: none; border: 0; padding: 4px; color: var(--muted); opacity: 0.55; cursor: pointer; display: flex; border-radius: 6px; }
.article .trash .ico { width: 17px; height: 17px; }
.article .trash:hover, .article .trash:active { opacity: 1; color: var(--down); background: var(--line); }
.article.dismissed { display: none !important; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 14px; background: var(--text); color: var(--bg); padding: 10px 14px 10px 16px; border-radius: 999px; font-size: 14px; box-shadow: 0 4px 16px rgba(0,0,0,0.25); max-width: calc(100% - 28px); white-space: nowrap; }
.toast[hidden] { display: none; }
.toast button { font: inherit; font-weight: 600; color: inherit; background: none; border: 0; padding: 4px 6px; cursor: pointer; text-decoration: underline; }
.settings .cnt { color: var(--muted); font-size: 13px; }
.article.read { opacity: var(--read-opacity); }
.article.read .title { font-weight: 500; }
body.unread-only .article.read { display: none; }

/* Highlights: warme Fläche, Streifen in Kategoriefarbe */
.stripe-politik { border-left-color: var(--politik-acc) !important; }
.stripe-wirtschaft { border-left-color: var(--wirtschaft-acc) !important; }
.stripe-werte { border-left-color: var(--werte-acc) !important; }
.stripe-versicherung { border-left-color: var(--versicherung-acc) !important; }
.article.highlight { background: var(--cbg); color: var(--cfg); border-color: var(--line); border-left-color: var(--cacc); }
.article.highlight .count { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--cacc); display: flex; align-items: center; gap: 4px; }
.article.highlight .summary { color: var(--cfg); opacity: 0.85; }
.article.highlight .meta { color: var(--cfg); }
.srcchip { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--card); color: var(--text); border: 1px solid var(--line); text-decoration: none; font-size: 12px; }

/* Meine Werte */
.position-block { margin-bottom: 18px; }
.position-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 16px; margin: 14px 0 6px; }
.position-head .pquote { font-size: 13px; font-weight: normal; color: var(--muted); }
.moved { display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 1px 6px; border-radius: 999px; background: var(--highlight-bg); color: var(--highlight-fg); vertical-align: middle; }
.article.via-sector { border-left-style: dashed; }
.article.via-sector .title { font-weight: 500; font-size: 15px; }
.tag.sec { border-color: var(--werte-acc); color: var(--werte-text); background: transparent; }
.mover.is-moved .mname { color: var(--text); font-weight: 600; }

/* Kurse */
.quote-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.quote { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 13px; position: relative; }
.quote .name { font-size: 14px; font-weight: 600; }
.quote .name .sym { font-weight: normal; font-size: 11px; color: var(--muted); margin-left: 4px; }
.quote .price { font-size: 20px; font-weight: 700; margin: 2px 0 6px; font-variant-numeric: tabular-nums; }
.quote .price .cur { font-size: 12px; font-weight: 500; color: var(--muted); }
.quote .price.na { font-size: 14px; color: var(--muted); font-weight: 500; }
.quote .err { font-size: 11px; color: var(--muted); }
.quote .changes { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; font-size: 12px; }
.quote .changes span { display: flex; justify-content: space-between; white-space: nowrap; }
.quote .changes i { font-style: normal; color: var(--muted); }
.quote.error { border-style: dashed; }
.chg { font-variant-numeric: tabular-nums; font-weight: 600; }
.chg.up { color: var(--up); } .chg.down { color: var(--down); } .chg.flat, .chg.na { color: var(--muted); }
.spark { position: absolute; right: 12px; top: 12px; width: 90px; height: 28px; opacity: 0.85; }
.spark polyline { fill: none; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.spark polyline.up { stroke: var(--up); } .spark polyline.down { stroke: var(--down); }

/* Einstellungen */
.settings .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.settings input { width: 20px; height: 20px; accent-color: var(--accent); }
.settings .link { text-decoration: none; }
.settings .ext { font-size: 13px; color: var(--accent); display: flex; align-items: center; gap: 2px; }
.settings button { font: inherit; font-size: 14px; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; }

footer { max-width: 1100px; margin: 0 auto; padding: 20px 14px 40px; font-size: 12px; color: var(--muted); }

/* ---------- Handy: entweder Startseite oder Ansicht ---------- */
@media (max-width: 899px) {
  body:not([data-view="start"]) .start { display: none; }
  body[data-view="start"] .views { display: none; }
}

/* ---------- Laptop: Startseite links, Ansicht rechts ---------- */
@media (min-width: 900px) {
  body { font-size: 15px; }
  .layout { display: grid; grid-template-columns: 340px 1fr; gap: 0 24px; align-items: start; }
  .start { position: sticky; top: 58px; max-height: calc(100vh - 58px); overflow-y: auto; }
  .views { padding-left: 0; }
  .view-head { margin: 0 0 12px; border-radius: var(--radius); border: 1px solid var(--line); }
  .view-head .back { display: none; }
  .daygroup summary.day { top: 58px; }
  .quote-grid { grid-template-columns: 1fr 1fr; }
  .tile.active-tile { border-color: var(--cacc, var(--accent)); box-shadow: inset 0 0 0 1px var(--cacc, var(--accent)); }
}
