/* Fondinsyn – stilmall
   Ljus grå bakgrund med vita kort, systemtypsnitt och Fondinsyns blå som accentfärg.
   Brytpunkter: 1120px (menyn på egen rad) och 760px (mobil med flikrad längst ner). */

:root {
  --canvas: #f4f6f8;
  --bg: #ffffff;
  --bg-subtle: #f8f9fb;
  --bg-hover: #f3f6fa;
  --fg: #101828;
  --fg-soft: #344054;
  --fg-muted: #667085;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --border-muted: #eef0f3;
  --brand: #1f6feb;
  --brand-ink: #1559c9;
  --brand-soft: #eef4ff;
  --logo-ink: #0b1f3a;
  --logo-dot: #2f6bff;
  --seg-bg: #eceff3;
  --seg-active: #ffffff;
  --sk-a: #e8ecf1;
  --sk-b: #f3f5f8;
  --chip-bg: #f2f4f7;
  --tip-bg: #101828;
  --tip-fg: #ffffff;
  --tabbar-bg: rgba(255, 255, 255, 0.94);
  --backdrop: rgba(16, 24, 40, 0.42);
  --brand-border: #b2ccff;
  --warn-border: #fedf89;
  --warn-fg: #7a2e0e;
  --star-bg: #fffaeb;
  --star-fg: #93370d;
  --link: #1559c9;
  --pos: #067647;
  --neg: #d92d20;
  --pos-bg: #ecfdf3;
  --neg-bg: #fef3f2;
  --bar-pos: #17b26a;
  --bar-neg: #f97066;
  --bar-neutral: #98a2b3;
  --warn: #b54708;
  --warn-bg: #fffaeb;
  --dot-warn: #f79009;
  --dot-active: #2e90fa;
  --dot-index: #b0b8c4;
  --zone: rgba(247, 144, 9, 0.10);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: none;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 16px 40px rgba(16, 24, 40, 0.16);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --tabbar-h: 0px;
  color-scheme: light;
}

/* Mörkt läge: väljs med knappen i sidhuvudet och sparas i webbläsaren (data-theme på <html>) */
:root[data-theme="dark"] {
  --canvas: #0b0f15;
  --bg: #121821;
  --bg-subtle: #171e29;
  --bg-hover: #1b2330;
  --fg: #e7ecf3;
  --fg-soft: #c3ccd8;
  --fg-muted: #8a95a7;
  --border: #252e3c;
  --border-strong: #343f50;
  --border-muted: #1d2531;
  --brand: #3d82f6;
  --brand-ink: #7cb0ff;
  --brand-soft: rgba(61, 130, 246, 0.16);
  --link: #7cb0ff;
  --pos: #3ccb7f;
  --neg: #ff6b61;
  --pos-bg: rgba(60, 203, 127, 0.14);
  --neg-bg: rgba(255, 107, 97, 0.14);
  --bar-pos: #2db86c;
  --bar-neg: #e8574e;
  --bar-neutral: #667085;
  --warn: #f5b84a;
  --warn-bg: rgba(245, 184, 74, 0.12);
  --dot-index: #5b6678;
  --zone: rgba(247, 144, 9, 0.12);
  --shadow-sm: none;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.55);
  --logo-ink: #e7ecf3;
  --logo-dot: #4d84ff;
  --seg-bg: #0d121a;
  --seg-active: #2a3445;
  --sk-a: #1a212c;
  --sk-b: #242d3b;
  --chip-bg: #212a37;
  --tip-bg: #e7ecf3;
  --tip-fg: #0b0f15;
  --tabbar-bg: rgba(18, 24, 33, 0.94);
  --backdrop: rgba(0, 0, 0, 0.62);
  --brand-border: rgba(124, 176, 255, 0.35);
  --warn-border: rgba(245, 184, 74, 0.35);
  --warn-fg: #f5c46a;
  --star-bg: rgba(245, 184, 74, 0.12);
  --star-fg: #f5c46a;
  color-scheme: dark;
}
:root[data-theme="dark"] .select-sm { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M2 3.5l3 3 3-3' fill='none' stroke='%238a95a7' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
:root[data-theme="dark"] .btn-primary:hover { background: #2563eb; border-color: #2563eb; }

/* Knappen för ljust/mörkt läge */
.theme-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--fg-soft); }
.theme-btn:hover { background: var(--bg-hover); color: var(--fg); border-color: var(--border-strong); }
.theme-btn svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: block; }
:root[data-theme="dark"] .theme-btn .i-moon { display: none; }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body { margin: 0; background: var(--canvas); color: var(--fg); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 30px; letter-spacing: -0.02em; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--fg-muted); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

.container { max-width: 1280px; margin: 0 auto; padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right)); }

/* ---------- Sidhuvud ---------- */

.topbar { background: var(--bg); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; padding-top: env(safe-area-inset-top); }
.topbar-inner { display: flex; align-items: center; gap: 28px; min-height: 64px; }
/* Loggan: Kvartal-symbolen (en cirkel i fyra delar, senaste kvartalet i blått) och namnet */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; font-size: 21px; line-height: 1; letter-spacing: -0.03em; color: var(--logo-ink); flex: none; }
.brand-mark { width: 1.45em; height: 1.45em; flex: none; fill: var(--logo-ink); }
.brand-mark .bm-a { fill: var(--logo-dot); }
.brand:hover { text-decoration: none; }
.mainnav { display: flex; align-items: stretch; gap: 2px; align-self: stretch; }
.mainnav a, .more-btn { display: inline-flex; align-items: center; gap: 5px; font: inherit; font-size: 15px; font-weight: 500; color: var(--fg-soft); padding: 0 12px; background: none; border: 0; cursor: pointer; white-space: nowrap; position: relative; }
.mainnav a:hover, .more-btn:hover { color: var(--fg); text-decoration: none; }
.mainnav a[aria-current="page"], .more-btn.active { color: var(--fg); font-weight: 650; }
.mainnav a[aria-current="page"]::after, .more-btn.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--brand); }
.more-btn svg { transition: transform 0.15s; }
.more-btn[aria-expanded="true"] { color: var(--fg); }
.more-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; justify-content: flex-end; }
.topbar-right > :not(.search-btn) { flex: none; }

.search-btn { display: inline-flex; align-items: center; gap: 10px; font: inherit; font-size: 14px; color: var(--fg-muted); background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 10px; height: 40px; padding: 0 10px 0 12px; cursor: pointer; min-width: 0; flex: 0 1 300px; overflow: hidden; white-space: nowrap; transition: border-color 0.15s, background 0.15s; }
.search-btn:hover { color: var(--fg-soft); border-color: var(--border-strong); background: var(--bg); }
.search-btn kbd { margin-left: auto; }

.select-sm, .input { font: inherit; font-size: 14px; color: var(--fg); background: var(--bg); border: 1px solid var(--border); border-radius: 10px; height: 40px; padding: 0 12px; min-width: 0; }
.select-sm { padding-right: 32px; appearance: none; -webkit-appearance: none; background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M2 3.5l3 3 3-3' fill='none' stroke='%23667085' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center; cursor: pointer; }
.select-sm:hover, .input:hover { border-color: var(--border-strong); }
.select-sm:focus, .input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.select-sm:disabled { opacity: 0.7; cursor: default; }
.quarter-select { font-weight: 600; }
.input { width: 100%; max-width: 340px; }

/* Rad med sammanfattning och marknadsval */
.subbar { background: var(--bg); border-bottom: 1px solid var(--border); }
.subbar-inner { display: flex; justify-content: space-between; align-items: center; gap: 8px 20px; flex-wrap: wrap; min-height: 52px; padding-top: 8px; padding-bottom: 8px; font-size: 14px; }
.summary { color: var(--fg-muted); }
.summary b { color: var(--fg); font-weight: 650; font-variant-numeric: tabular-nums; }
.summary .pos, .summary .neg { font-weight: 700; }
.subbar-controls { display: flex; align-items: center; gap: 8px 18px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; color: var(--fg-soft); }
.check input { margin: 0; width: 16px; height: 16px; accent-color: var(--brand); }

/* Segmentknappar */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--seg-bg); }
.seg-btn { font: inherit; font-size: 14px; font-weight: 500; color: var(--fg-muted); background: none; border: 0; border-radius: 8px; padding: 5px 14px; cursor: pointer; transition: background 0.15s, color 0.15s; }
.seg-btn:hover { color: var(--fg); }
.seg-btn[aria-pressed="true"] { color: var(--fg); background: var(--seg-active); font-weight: 650; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12); }

/* Mer-menyn: rullgardin på dator, panel nerifrån på mobil */
.more-menu { position: fixed; z-index: 45; background: var(--bg); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; display: flex; flex-direction: column; }
.more-menu a { display: flex; flex-direction: column; padding: 9px 12px; border-radius: 10px; color: var(--fg); }
.more-menu a:hover { background: var(--bg-hover); text-decoration: none; }
.more-menu a b { font-weight: 650; font-size: 15px; }
.more-menu a span { font-size: 13px; color: var(--fg-muted); }
.more-menu a[aria-current="page"] { background: var(--brand-soft); }
.more-menu a[aria-current="page"] b { color: var(--brand-ink); }
.more-menu .m-only, .sheet-handle { display: none; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 44; background: var(--backdrop); }
body.sheet-open { overflow: hidden; }

/* Flikrad på mobil */
.tabbar { display: none; }

/* ---------- Sidlayout ---------- */

main { padding-top: 28px; padding-bottom: 48px; outline: none; min-height: 60vh; }
.page-head { margin-bottom: 20px; display: flex; flex-direction: column; gap: 6px; }
.page-head .meta { color: var(--fg-muted); font-size: 14px; }
.crumbs { font-size: 14px; color: var(--fg-muted); }
.crumbs a { color: var(--fg-muted); }
.crumbs a:hover { color: var(--link); }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; }
.title-row .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
.block { min-width: 0; }
.block-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding-bottom: 10px; }
.block-head .note { font-size: 13px; color: var(--fg-muted); }
.block > .desc { font-size: 14px; color: var(--fg-muted); margin: -4px 0 12px; }
.section-gap { margin-top: 36px; }
.section-title { font-size: 20px; margin: 40px 0 14px; }
.lead { font-size: 16px; line-height: 1.6; max-width: 72ch; color: var(--fg-soft); }
.intro { font-size: 15px; line-height: 1.65; max-width: 80ch; color: var(--fg-soft); margin: 0 0 24px; }
.intro b { color: var(--fg); }
.desc { color: var(--fg-muted); }
.more { display: inline-flex; align-items: center; gap: 4px; margin-top: 12px; font-size: 14px; font-weight: 600; }

/* Startsidans topp */
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 28px; align-items: center; background: var(--bg); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 28px 32px; margin-bottom: 28px; }
.hero h1 { font-size: 32px; margin-bottom: 10px; text-wrap: balance; }
.hero .intro { margin: 0; font-size: 15px; }
.hero-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.hero-kpis div { background: var(--bg-subtle); border: 1px solid var(--border-muted); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.hero-kpis dt { font-size: 13px; color: var(--fg-muted); }
.hero-kpis dd { margin: 2px 0 0; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Nyckeltal */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin: 0 0 24px; overflow: hidden; }
.figures div { padding: 16px 20px; border-right: 1px solid var(--border-muted); min-width: 0; }
.figures div:last-child { border-right: 0; }
.figures dt { font-size: 13px; color: var(--fg-muted); }
.figures dd { margin: 4px 0 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.fig-note { display: block; font-size: 12px; color: var(--fg-muted); margin-top: 2px; }

/* Tabeller */
/* Tabellen anpassar sig efter sin egen bredd (container query), inte skärmens: en smal kolumn på datorn
   får samma kompakta läge som mobilen, så att tabeller aldrig behöver skrollas i sidled. */
.table-wrap { overflow-x: auto; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); container-type: inline-size; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14px; }
th, td { padding: 11px 14px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border-muted); }
th:first-child, td:first-child { padding-left: 18px; }
th:last-child, td:last-child { padding-right: 18px; }
th.l, td.l { text-align: left; }
/* Textkolumner (person, status) får radbrytas, siffror och datum stannar på en rad */
td.l:not(.muted) { white-space: normal; min-width: 8em; }
thead th { background: var(--bg-subtle); font-weight: 600; font-size: 12px; color: var(--fg-muted); letter-spacing: 0.01em; border-bottom: 1px solid var(--border); position: sticky; top: 0; white-space: normal; vertical-align: bottom; }
thead th button { all: unset; cursor: pointer; }
thead th button:hover { color: var(--fg); }
thead th button:focus-visible { outline: 2px solid var(--brand); }
thead th[aria-sort] { color: var(--fg); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background 0.1s; }
tbody tr:hover td { background: var(--bg-hover); }
td.rank { color: var(--fg-muted); width: 1%; font-size: 13px; }
td.name { max-width: 340px; min-width: 9em; white-space: normal; }
td.name > a, td.name > .nm-plain { color: var(--fg); font-weight: 600; display: block; }
td.name > a { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
td.name > a:hover { color: var(--link); }
td.name .sub { font-size: 12px; color: var(--fg-muted); font-weight: 400; margin-top: 2px; }
td.name .sub:not(.show-sm) { display: block; }
td.muted { color: var(--fg-muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
td.empty { text-align: center; color: var(--fg-muted); padding: 28px; white-space: normal; }
.show-sm { display: none; }
.show-sm-i { display: none; }

@container (max-width: 940px) {
  table { font-size: 14px; }
  th, td { padding: 11px 8px; }
  th:first-child, td:first-child { padding-left: 14px; }
  th:last-child, td:last-child { padding-right: 14px; }
  thead th { font-size: 11px; }
  td.name { max-width: none; width: 100%; min-width: 0; overflow-wrap: anywhere; }
  td.name .sub { display: block; font-size: 12px; color: var(--fg-muted); margin-top: 2px; font-weight: 400; }
  td.name .sub .label { font-size: 11px; line-height: 16px; padding: 0 6px; }
  td.l:not(.muted) { min-width: 0; }
  .hide-sm { display: none !important; }
  .show-sm { display: block; }
  .show-sm-i { display: inline; }
  .bar { display: none; }
}
/* Telefonbredd: lite tätare så att tre–fyra kolumner alltid får plats */
@container (max-width: 420px) {
  th, td { padding: 10px 6px; }
  th:first-child, td:first-child { padding-left: 12px; }
  th:last-child, td:last-child { padding-right: 12px; }
  td.muted { font-size: 12.5px; }
  table.cmp-table tbody th { width: auto; font-size: 12.5px; padding-right: 4px; }
}
/* Jämförelsetabellen: ord får brytas så att två fonder alltid får plats bredvid varandra */
table.cmp-table td { overflow-wrap: anywhere; }

.barcell { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.bar { display: inline-block; width: 72px; height: 6px; background: var(--border-muted); border-radius: 3px; overflow: hidden; flex: none; }
.bar i { display: block; height: 100%; border-radius: 3px; }
.bar.pos i { background: var(--bar-pos); }
.bar.neg i { background: var(--bar-neg); }
.bar.neutral i { background: var(--bar-neutral); }

.label { display: inline-block; font-size: 12px; font-weight: 600; line-height: 20px; padding: 0 8px; border-radius: 2em; background: var(--chip-bg); color: var(--fg-soft); vertical-align: middle; }
.label.new, .label.up { color: var(--pos); background: var(--pos-bg); }
.label.out, .label.down { color: var(--neg); background: var(--neg-bg); }
.label.warn { color: var(--warn); background: var(--warn-bg); }

.csv-btn { margin-top: 10px; font: inherit; font-size: 13px; font-weight: 600; color: var(--link); background: none; border: 0; padding: 4px 0; cursor: pointer; }
.csv-btn:hover { text-decoration: underline; }
.csv-btn::before { content: "↓ "; }

/* Verktygsrad ovanför tabeller */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .count { margin-left: auto; color: var(--fg-muted); font-size: 14px; }

/* Knappar */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: 14px; font-weight: 600; color: var(--fg-soft); background: var(--bg); border: 1px solid var(--border-strong); border-radius: 10px; height: 38px; padding: 0 14px; cursor: pointer; box-shadow: var(--shadow-sm); transition: background 0.15s, border-color 0.15s; }
.btn:hover { background: var(--bg-subtle); color: var(--fg); text-decoration: none; }
a.btn { color: var(--fg-soft); }
.btn-primary, a.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }
.star { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 14px; font-weight: 600; color: var(--fg-soft); background: var(--bg); border: 1px solid var(--border-strong); border-radius: 10px; height: 38px; padding: 0 14px; cursor: pointer; box-shadow: var(--shadow-sm); }
.star svg { fill: none; stroke: var(--fg-muted); stroke-width: 1.3; }
.star:hover { background: var(--bg-subtle); }
.star.on { border-color: var(--warn-border); background: var(--star-bg); color: var(--star-fg); }
.star.on svg { fill: #fdb022; stroke: #dc6803; }
.icon-btn { font: inherit; font-size: 14px; line-height: 1; color: var(--fg-muted); background: none; border: 1px solid transparent; border-radius: 8px; padding: 7px 9px; cursor: pointer; }
.icon-btn:hover { color: var(--fg); border-color: var(--border); background: var(--bg-hover); }
.form-msg { font-size: 14px; color: var(--neg); }

.notice { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; color: var(--fg-soft); }
.notice.warn-notice { border-color: var(--warn-border); background: var(--warn-bg); color: var(--warn-fg); margin-bottom: 8px; }
.offer-notice { border-color: var(--brand-border); background: var(--brand-soft); margin-top: 12px; }

/* Text */
.prose { max-width: 760px; display: flex; flex-direction: column; gap: 14px; font-size: 16px; line-height: 1.65; color: var(--fg-soft); }
.prose h2 { margin-top: 14px; color: var(--fg); }
.prose ul { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.prose code { font-family: var(--mono); font-size: 13px; background: var(--chip-bg); padding: 1px 6px; border-radius: 6px; }

.contact-card { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px 20px; max-width: 620px; }
.contact-label { font-size: 13px; color: var(--fg-muted); width: 100%; }
.contact-mail { font-size: 18px; font-weight: 700; word-break: break-all; }
.byline { font-size: 14px; color: var(--fg-muted); margin-top: 10px; }
.byline b { color: var(--fg); font-weight: 650; }

.loading { display: flex; align-items: center; gap: 10px; color: var(--fg-muted); padding: 28px 0; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* ---------- Sidfot ---------- */

.site-footer { background: var(--bg); border-top: 1px solid var(--border); margin-top: 24px; }
.footer-inner { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr); gap: 32px; padding-top: 36px; padding-bottom: 28px; }
.footer-brand p { margin-top: 12px; color: var(--fg-muted); font-size: 14px; max-width: 36ch; }
.footer-brand .brand { font-size: 19px; }
.footer-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.footer-links div { display: flex; flex-direction: column; gap: 8px; }
.footer-links h2 { font-size: 13px; font-weight: 650; color: var(--fg); margin-bottom: 2px; }
.footer-links a { color: var(--fg-muted); font-size: 14px; }
.footer-links a:hover { color: var(--link); }
.footer-bottom { display: flex; flex-wrap: wrap; gap: 6px 24px; padding-top: 16px; padding-bottom: max(20px, env(safe-area-inset-bottom)); border-top: 1px solid var(--border-muted); color: var(--fg-muted); font-size: 13px; }
.footer-bottom a { color: var(--fg-muted); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Översikt ---------- */

.highlights { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.hl { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hl-label { font-size: 13px; color: var(--fg-muted); font-weight: 500; }
.hl-name { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.hl-name:hover { color: var(--link); text-decoration: none; }
.hl-value { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hl-note { font-size: 13px; color: var(--fg-muted); }


.watch { margin-bottom: 28px; }

.streak { display: inline-block; min-width: 28px; text-align: center; font-weight: 700; border-radius: 2em; padding: 1px 9px; font-size: 13px; }
.streak.pos { background: var(--pos-bg); }
.streak.neg { background: var(--neg-bg); }
.pill { font-size: 13px; font-weight: 650; border-radius: 2em; padding: 3px 12px; }
.pill.pos { background: var(--pos-bg); }
.pill.neg { background: var(--neg-bg); }
.block-head .pill { align-self: center; }

/* Sektorrotation */
.divbars { list-style: none; margin: 0; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.divbars li { display: grid; grid-template-columns: 160px minmax(0, 1fr) 96px; align-items: center; gap: 12px; font-size: 14px; }
.db-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-track { position: relative; height: 16px; background: linear-gradient(var(--border-strong), var(--border-strong)) center / 1px 100% no-repeat; }
.db-track i { position: absolute; top: 2px; bottom: 2px; border-radius: 4px; }
.db-track i.pos { background: var(--bar-pos); border-top-left-radius: 0; border-bottom-left-radius: 0; }
.db-track i.neg { background: var(--bar-neg); border-top-right-radius: 0; border-bottom-right-radius: 0; }
.db-val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
table.heat td { font-size: 13px; text-align: center; min-width: 54px; }
table.heat th { text-align: center; }
table.heat th.l, table.heat td.l { text-align: left; }

/* ---------- Diagram ---------- */

.charts { gap: 20px; }
.chart-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px 18px 10px; min-width: 0; }
.chart-title { font-size: 15px; font-weight: 650; margin-bottom: 10px; }
.chart-title span { font-weight: 400; color: var(--fg-muted); font-size: 13px; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; overflow: visible; font-family: var(--font); }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--tip-bg); color: var(--tip-fg); border-radius: 8px; padding: 7px 11px; font-size: 13px; line-height: 1.45; box-shadow: var(--shadow-lg); max-width: 260px; white-space: normal; }
.chart-tip .muted, .chart-tip span { color: inherit; }
.c-axis { fill: var(--fg-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.c-axis-title { fill: var(--fg-muted); font-size: 12px; }
.c-label { fill: var(--fg); font-size: 12px; font-weight: 600; }
.c-grid { stroke: var(--border-muted); stroke-width: 1; }
.c-zero { stroke: var(--border-strong); stroke-width: 1; }
.c-hover { fill: var(--bg-hover); }
.c-pos { fill: var(--bar-pos); }
.c-neg { fill: var(--bar-neg); }
.c-strong { stroke: var(--fg); stroke-width: 1.5; }
.c-line { fill: none; stroke: var(--brand); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.c-area { fill: var(--brand); fill-opacity: 0.08; }
.c-dot { fill: var(--brand); stroke: var(--bg); stroke-width: 2; }
.c-cross { stroke: var(--border-strong); stroke-width: 1; }
.c-pt { stroke: var(--bg); stroke-width: 1.5; }
.c-closet, i.c-closet { fill: var(--dot-warn); background: var(--dot-warn); }
.c-active, i.c-active { fill: var(--dot-active); background: var(--dot-active); }
.c-index, i.c-index { fill: var(--dot-index); background: var(--dot-index); }
.c-other { fill: var(--dot-index); }
.c-ring { fill: none; stroke: var(--fg); stroke-width: 1.5; }
.c-zone { fill: var(--zone); }
.c-zone-label { fill: var(--warn); font-size: 12px; font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--fg-muted); margin-bottom: 10px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ---------- Förvaltare ---------- */

.vote { display: inline-block; min-width: 24px; text-align: center; font-weight: 700; border-radius: 2em; padding: 0 8px; }
.vote.pos { background: var(--pos-bg); }
.vote.neg { background: var(--neg-bg); }
.vote-other { color: var(--fg-muted); font-size: 13px; }
.mgr-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.mgr { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.mgr header { min-width: 0; }
.mgr-name { font-size: 16px; font-weight: 700; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg); }
.mgr-name:hover { color: var(--link); }
.mgr-co { font-size: 13px; color: var(--fg-muted); }
.mgr-stats { display: flex; flex-wrap: wrap; gap: 2px 16px; font-size: 13px; color: var(--fg-muted); border-top: 1px solid var(--border-muted); border-bottom: 1px solid var(--border-muted); padding: 10px 0; }
.mgr-stats b { color: var(--fg); font-weight: 650; font-variant-numeric: tabular-nums; }
.mgr-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.mgr h3 { font-size: 13px; font-weight: 600; color: var(--fg-muted); margin: 0 0 6px; }
.mgr ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 14px; }
.mgr li { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.mgr li a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; color: var(--fg); font-weight: 500; }
.mgr li a:hover { color: var(--link); }
.mgr li > span:last-child { margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 13px; font-weight: 600; }
.mgr li .label { font-size: 10px; line-height: 16px; padding: 0 6px; flex: none; }

/* ---------- Sök ---------- */

kbd { font-family: var(--mono); font-size: 11px; line-height: 18px; padding: 0 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; color: var(--fg-muted); background: var(--bg); }
.search-modal { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: center; align-items: flex-start; padding: max(10vh, env(safe-area-inset-top)) 16px 16px; }
.search-backdrop { position: absolute; inset: 0; background: var(--backdrop); backdrop-filter: blur(2px); }
.search-panel { position: relative; width: 100%; max-width: 640px; background: var(--bg); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; display: flex; flex-direction: column; max-height: 75vh; }
.search-field { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border-muted); color: var(--fg-muted); }
.search-input { flex: 1; min-width: 0; font: inherit; font-size: 17px; color: var(--fg); background: none; border: 0; outline: none; }
.search-input::-webkit-search-cancel-button { display: none; }
.search-close { font-family: var(--mono); font-size: 11px; color: var(--fg-muted); background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 6px; padding: 3px 7px; cursor: pointer; }
.search-results { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.sr-group { font-size: 12px; font-weight: 650; color: var(--fg-muted); padding: 12px 12px 4px; }
.sr-item { display: flex; align-items: baseline; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; min-width: 0; }
.sr-item[aria-selected="true"], .sr-item:hover { background: var(--brand-soft); }
.sr-label { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-sub { font-size: 13px; color: var(--fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-left: auto; }
.sr-empty { padding: 24px 12px; color: var(--fg-muted); text-align: center; }
.search-foot { display: flex; gap: 18px; padding: 10px 18px; border-top: 1px solid var(--border-muted); font-size: 12px; color: var(--fg-muted); background: var(--bg-subtle); }
.search-foot kbd { margin-right: 3px; }
body.modal-open { overflow: hidden; }

/* ---------- Portfölj och jämförelse ---------- */

.pf-form, .cmp-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 16px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.pf-form .input, .cmp-form .input { max-width: none; flex: 1 1 260px; }
.pf-form .pf-amount { flex: 0 1 170px; }
.pf-form .btn, .cmp-form .btn { height: 40px; padding: 0 18px; }
input.pf-edit { width: 130px; height: 34px; text-align: right; padding: 0 10px; font-variant-numeric: tabular-nums; }
.empty-state { margin-top: 20px; padding: 48px 24px; text-align: center; background: var(--bg); border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--fg-muted); }
.empty-state h2 { color: var(--fg); margin-bottom: 8px; }
.empty-state p { max-width: 520px; margin: 0 auto; }
.overlap-notice { border-color: var(--warn-border); background: var(--warn-bg); }
.overlap-notice ul { margin: 6px 0 0; padding-left: 20px; }
.pf-shared { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.more-note { margin-top: 10px; }
.share-url { max-width: 440px; font-size: 14px; }
.sharebars { list-style: none; margin: 0; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.sharebars li { display: grid; grid-template-columns: 150px minmax(0, 1fr) 60px; align-items: center; gap: 12px; font-size: 14px; }
.sb-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-track { height: 8px; background: var(--border-muted); border-radius: 4px; overflow: hidden; }
.sb-track i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.sb-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--fg-muted); font-weight: 600; }

.cmp-hero { display: flex; gap: 28px; align-items: center; background: var(--bg); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 24px 28px; }
.cmp-score { text-align: center; flex: none; }
.cmp-num { font-size: 48px; font-weight: 750; line-height: 1; letter-spacing: -0.03em; color: var(--brand-ink); }
.cmp-cap { font-size: 13px; color: var(--fg-muted); margin-top: 6px; font-weight: 650; }
.cmp-text { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1; }
.cmp-bar { height: 10px; border-radius: 5px; background: var(--border-muted); overflow: hidden; max-width: 440px; }
.cmp-bar i { display: block; height: 100%; background: var(--brand); border-radius: 5px; }
table.cmp-table th, table.cmp-table td { white-space: normal; }
table.cmp-table tbody th { font-weight: 600; color: var(--fg-muted); font-size: 14px; width: 170px; background: none; position: static; text-align: left; }
table.cmp-table thead th { font-size: 14px; color: var(--fg); }

.actions-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 6px; }
.nm-plain { font-weight: 600; }
.short-pct { font-weight: 700; color: var(--neg); }

/* ---------- Kvartalsrapport och nyhetsbrev ---------- */

.report { max-width: 900px; }
.report h1 { font-size: 34px; line-height: 1.15; text-wrap: balance; }
.report .block h2 { font-size: 20px; }
.report p { font-size: 16px; line-height: 1.7; max-width: 70ch; color: var(--fg-soft); }
.report .prose { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 20px 24px; max-width: none; }
.rep-lead { font-size: 17px; display: flex; flex-direction: column; gap: 12px; padding: 20px 24px; background: var(--bg); border: 1px solid var(--border); border-left: 4px solid var(--brand); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.rep-lead p { font-size: 17px; margin: 0; color: var(--fg); }
.rep-list { margin: 0; padding: 14px 18px 14px 40px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.rep-list li { padding-left: 4px; }
.rep-list li a { font-weight: 650; color: var(--fg); }
.rep-list li a:hover { color: var(--link); }
.rep-v { margin-left: 8px; font-variant-numeric: tabular-nums; font-weight: 700; }
.rep-n { margin-left: 8px; font-size: 13px; color: var(--fg-muted); }
.report .block > p { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow-sm); max-width: none; }

.newsletter { display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; padding: 22px 26px; background: var(--brand-soft); border: 1px solid var(--brand-border); border-radius: var(--radius); }
.newsletter h2 { font-size: 18px; margin-bottom: 4px; }
.newsletter .desc { margin: 0; }
.nl-form { display: flex; gap: 8px; flex-wrap: wrap; flex: 1 1 320px; max-width: 440px; }
.nl-form .input { flex: 1 1 200px; max-width: none; }

/* ---------- Ordlista och fondbolag ---------- */

a.term { color: inherit; border-bottom: 1px dotted currentColor; text-decoration: none; }
a.term:hover { color: var(--link); border-bottom-style: solid; }
.glossary-index { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.glossary-index a { font-size: 14px; font-weight: 500; padding: 6px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 2em; color: var(--fg-soft); box-shadow: var(--shadow-sm); }
.glossary-index a:hover { border-color: var(--brand); color: var(--brand-ink); text-decoration: none; }
.glossary { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.g-item { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 16px 20px; scroll-margin-top: 90px; }
.g-item dt { font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.g-item dt a { color: var(--fg); }
.g-item dd { margin: 0; color: var(--fg-soft); line-height: 1.6; }
.g-item.g-active { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.faq { display: flex; flex-direction: column; gap: 10px; max-width: 860px; }
.faq details { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 14px 20px; }
.faq summary { font-weight: 650; cursor: pointer; list-style-position: outside; }
.faq details[open] summary { margin-bottom: 4px; }
.faq p { margin: 8px 0 2px; color: var(--fg-soft); line-height: 1.6; }

/* ---------- Mindre datorskärmar: tätare meny och kortare sökfält så att allt får plats på en rad ---------- */

.topbar-inner { gap: 18px; }
.mainnav a, .more-btn { padding: 0 9px; }
.mainnav a[aria-current="page"]::after, .more-btn.active::after { left: 9px; right: 9px; }
@media (max-width: 1360px) {
  .search-btn kbd { display: none; }
}

/* ---------- Mellanstora skärmar: menyn på egen rad ---------- */

@media (max-width: 1200px) {
  .topbar-inner { flex-wrap: wrap; gap: 0 16px; min-height: 0; padding-top: 10px; }
  .mainnav { order: 3; width: calc(100% + 24px); margin: 4px -12px 0; height: 46px; overflow-x: auto; scrollbar-width: none; }
  .mainnav::-webkit-scrollbar { display: none; }
  .search-btn { min-width: 240px; }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .mgr-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .hero-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-inner { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Mobil ---------- */

@media (max-width: 760px) {
  :root { --tabbar-h: 62px; }
  body { font-size: 15px; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .container { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .hide-sm { display: none !important; }
  .show-sm { display: block; }

  /* Sidhuvud: logga och kvartal, menyn ligger i flikraden */
  .topbar-inner { flex-wrap: nowrap; min-height: 56px; padding-top: 0; gap: 12px; }
  .brand { font-size: 20px; }
  .mainnav, .search-btn { display: none; }
  .select-sm { height: 38px; font-size: 16px; }
  .quarter-select { font-size: 15px; }

  .subbar-inner { min-height: 0; padding-top: 10px; padding-bottom: 10px; font-size: 13px; gap: 10px; }
  .subbar-controls { width: 100%; justify-content: space-between; }
  .seg { flex: none; }
  .seg-btn { padding: 6px 16px; }
  .check { font-size: 14px; }

  /* Flikrad längst ner */
  .tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 46; background: var(--tabbar-bg); backdrop-filter: saturate(1.6) blur(12px); -webkit-backdrop-filter: saturate(1.6) blur(12px); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: var(--tabbar-h); font: inherit; font-size: 11px; font-weight: 600; color: var(--fg-muted); background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a[aria-current="page"], .tabbar button.active, .tabbar button[aria-expanded="true"] { color: var(--brand); }
  .tabbar a[aria-current="page"] svg { stroke-width: 2.1; }

  /* Mer-menyn som panel nerifrån */
  .more-menu.sheet { left: 0 !important; right: 0; top: auto !important; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); width: auto !important; max-height: calc(100vh - var(--tabbar-h) - 80px); overflow-y: auto; border-radius: 20px 20px 0 0; border: 0; border-bottom: 1px solid var(--border); padding: 8px 12px 12px; z-index: 45; animation: sheet-in 0.22s ease-out; }
  .more-menu.sheet .m-only { display: flex; }
  .more-menu.sheet .sheet-handle { display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--border-strong); margin: 4px auto 10px; }
  .more-menu.sheet a { padding: 12px 14px; }
  @keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

  main { padding-top: 20px; padding-bottom: 32px; }
  h1 { font-size: 24px; }
  h2 { font-size: 17px; }
  .page-head { margin-bottom: 16px; }
  .block-head { flex-direction: column; align-items: flex-start; gap: 2px; }
  .grid-2 { gap: 28px; }
  .section-gap { margin-top: 28px; }
  .lead { font-size: 15px; }

  .hero { padding: 20px 18px; border-radius: 14px; gap: 18px; margin-bottom: 20px; }
  .hero h1 { font-size: 24px; }
  .hero .intro { font-size: 14px; }
  .hero-kpis { gap: 10px; }
  .hero-kpis div { padding: 12px 14px; }
  .hero-kpis dd { font-size: 20px; }

  .toolbar { gap: 8px; }
  .toolbar .input { max-width: none; flex: 1 1 100%; }
  .toolbar .select-sm { flex: 1 1 0; min-width: 0; }
  .toolbar .count { margin-left: 0; width: 100%; }
  /* 16px förhindrar att iOS zoomar in när fältet får fokus */
  .input, .select-sm { font-size: 16px; }

  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figures div { border-right: 0; border-bottom: 1px solid var(--border-muted); padding: 12px 14px; }
  .figures div:nth-child(odd) { border-right: 1px solid var(--border-muted); }
  .figures div:nth-last-child(-n+2):nth-child(odd), .figures div:last-child { border-bottom: 0; }
  .figures dd { font-size: 18px; }

  table { font-size: 14px; }
  th, td { padding: 12px 8px; }
  th:first-child, td:first-child { padding-left: 14px; }
  th:last-child, td:last-child { padding-right: 14px; }
  td.name { max-width: none; width: 100%; white-space: normal; }
  td.name > a { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  td.name .sub { font-size: 12px; color: var(--fg-muted); margin-top: 2px; font-weight: 400; }
  td.name .sub .label { font-size: 11px; line-height: 16px; padding: 0 6px; }
  .bar { display: none; }
  thead th { font-size: 11px; white-space: normal; vertical-align: bottom; }

  .highlights { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .hl { padding: 14px 16px; gap: 2px; }
  .hl-name { white-space: normal; font-size: 18px; line-height: 1.3; }

  .mgr-grid { grid-template-columns: minmax(0, 1fr); }
  .chart-card { padding: 14px 10px 8px; }
  .block-head .seg { align-self: stretch; }
  .block-head .seg .seg-btn { flex: 1; }
  .title-row .actions { width: 100%; }
  .title-row .actions .btn, .title-row .actions .star { flex: 1 1 auto; }

  .search-modal { padding: 0; align-items: stretch; }
  .search-panel { max-width: none; max-height: none; height: 100%; border-radius: 0; padding-top: env(safe-area-inset-top); }
  .search-foot { display: none; }
  .sr-item { padding: 12px; }

  .divbars { padding: 12px 14px; }
  .divbars li { grid-template-columns: 100px minmax(0, 1fr) 72px; gap: 8px; font-size: 13px; }
  .sharebars li { grid-template-columns: 110px minmax(0, 1fr) 50px; }
  .cmp-hero { flex-direction: column; align-items: flex-start; gap: 12px; padding: 18px; }
  .pf-form .pf-amount { flex: 1 1 120px; }
  input.pf-edit { width: 100px; }
  table.cmp-table tbody th { width: 110px; }
  table.heat th, table.heat td { min-width: 0; padding: 8px 4px; font-size: 11px; }
  table.heat td.l, table.heat th.l { white-space: normal; padding-left: 10px; }

  .report h1 { font-size: 26px; }
  .report .prose, .rep-lead { padding: 16px; }
  .newsletter { padding: 18px; }
  .glossary { grid-template-columns: minmax(0, 1fr); }

  .site-footer { margin-top: 8px; }
  .footer-inner { padding-top: 28px; gap: 24px; }
  .footer-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-bottom { flex-direction: column; gap: 4px; padding-bottom: 20px; }
}

/* ---------- Detaljer ---------- */

/* Sidhuvudet blir halvgenomskinligt och får skugga när sidan skrollas */
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .topbar { background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px); }
}
.topbar { transition: box-shadow 0.2s; }
body.scrolled .topbar { box-shadow: 0 6px 20px rgba(16, 24, 40, 0.07); }
:root[data-theme="dark"] body.scrolled .topbar { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45); }

/* Mjuk övergång mellan sidor */
#app.fade-in { animation: fade-in 0.14s ease-out; }
@keyframes fade-in { from { opacity: 0.35; } to { opacity: 1; } }

/* Platshållare medan data laddas */
.loading { display: flex; flex-direction: column; gap: 12px; padding: 6px 0 18px; color: var(--fg-muted); }
.sk { border-radius: 8px; background: linear-gradient(90deg, var(--sk-a) 25%, var(--sk-b) 40%, var(--sk-a) 60%); background-size: 300% 100%; animation: sk-shine 1.3s ease-in-out infinite; }
.sk-line { height: 14px; }
.sk-block { height: 160px; border-radius: var(--radius); margin-top: 6px; }
.w40 { width: 40%; } .w70 { width: 70%; } .w90 { width: 90%; }
@keyframes sk-shine { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* Knappar svarar på tryck */
.btn, .star, .seg-btn, .theme-btn, .search-btn, .tabbar a, .tabbar button { transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.08s; }
.btn:active, .star:active, .theme-btn:active, .search-btn:active { transform: scale(0.97); }

.hl { position: relative; }

.hl, .chart-card, .g-item, .mgr { transition: border-color 0.15s, box-shadow 0.15s; }


/* Tydligare tangentbordsfokus */
.mainnav a:focus-visible, .more-btn:focus-visible, .tabbar a:focus-visible, .tabbar button:focus-visible { outline-offset: -2px; }

@media (max-width: 760px) {

  /* Markering bakom den aktiva fliken */
  .tabbar svg { box-sizing: content-box; padding: 3px 16px; border-radius: 14px; transition: background 0.2s; }
  .tabbar a[aria-current="page"] svg, .tabbar button[aria-expanded="true"] svg, .tabbar button.active svg { background: var(--brand-soft); }
  .tabbar a, .tabbar button { gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  #app.fade-in, .sk, .more-menu.sheet { animation: none; }
  .btn:active, .star:active, .theme-btn:active, .search-btn:active { transform: none; }
}

/* Mjuk övergång när man byter mellan ljust och mörkt läge */
body, .topbar, .subbar, .table-wrap, .figures, .hl, .chart-card, .hero, .site-footer { transition-property: background-color, border-color, color, box-shadow; transition-duration: 0.2s; }

/* ---------- Initialbrickor, brödsmulor, klickbara rader och diagrammet i toppen ---------- */

.title-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.title-main h1 { min-width: 0; overflow-wrap: anywhere; }
.avatar { display: inline-grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 12px; font-size: 16px; font-weight: 750; letter-spacing: 0.02em; background: hsl(var(--h) 80% 94%); color: hsl(var(--h) 55% 32%); box-shadow: inset 0 0 0 1px hsl(var(--h) 60% 88%); }
.avatar-sm { width: 30px; height: 30px; border-radius: 9px; font-size: 11px; }
:root[data-theme="dark"] .avatar { background: hsl(var(--h) 30% 20%); color: hsl(var(--h) 75% 78%); box-shadow: inset 0 0 0 1px hsl(var(--h) 30% 28%); }
.sr-item { align-items: center; }

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.crumb-sep { width: 6px; height: 6px; border-top: 1.5px solid var(--border-strong); border-right: 1.5px solid var(--border-strong); transform: rotate(45deg); margin: 0 2px; }

.table-wrap tbody tr:has(td.name a) { cursor: pointer; }
.table-wrap tbody tr:has(td.name a):hover td.name > a { color: var(--link); }

#stockSearch, #fundSearch { padding-left: 38px; background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='4.75' fill='none' stroke='%23667085' stroke-width='1.6'/%3E%3Cpath d='M10.5 10.5L14 14' stroke='%23667085' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 13px center; }

.hero-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.hero-chart { background: var(--bg-subtle); border: 1px solid var(--border-muted); border-radius: var(--radius); padding: 12px 14px 4px; min-width: 0; }
.hero-chart .chart-title { font-size: 13px; margin-bottom: 4px; }
.sk-chart { height: 132px; margin-bottom: 8px; }

@media (max-width: 760px) {
  .avatar { width: 40px; height: 40px; border-radius: 11px; font-size: 14px; }
  .title-main { gap: 12px; }
}

@media (max-width: 760px) {
  /* Knapparna under rubriken i ett jämnt rutnät */
  .title-row .actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
  /* Sökträffar: namnet på egen rad och beskrivningen under */
  .sr-item { flex-wrap: wrap; row-gap: 1px; }
  .sr-label { flex: 1 1 auto; min-width: 0; }
  .sr-sub { flex-basis: 100%; margin-left: 0; }
  .avatar-sm ~ .sr-sub { padding-left: 42px; }
}

/* ---------- Lugnare uttryck: färre rutor, mer luft ---------- */

/* Startsidans topp */
.hero h1 { font-size: 30px; margin-bottom: 6px; }
.hero-sub { color: var(--fg-muted); font-size: 14px; margin-bottom: 14px; }
.hero .intro { max-width: 60ch; }
.hero-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

/* Markeringskorten blir en panel med avdelare i stället för tre lösa kort */
.highlights { gap: 0; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.highlights .hl { border: 0; border-radius: 0; box-shadow: none; background: none; border-right: 1px solid var(--border-muted); padding: 18px 22px; }
.highlights .hl:last-child { border-right: 0; }
.hl-name { font-size: 19px; }

/* Raden under menyn: på startsidan står nyckeltalen redan i toppen */
body[data-page="oversikt"] .summary { display: none; }
.subbar-controls { margin-left: auto; }

@media (max-width: 760px) {
  .hero h1 { font-size: 24px; }
  .hero-links .btn { flex: 1 1 auto; }
  .highlights .hl { border-right: 0; border-bottom: 1px solid var(--border-muted); padding: 14px 16px; }
  .highlights .hl:last-child { border-bottom: 0; }
  body[data-page="oversikt"] .subbar-inner { padding-top: 8px; padding-bottom: 8px; }
}

/* Importera portfölj från banken */

/* Bevakning via mejl på aktiesidan */
.alert-box { margin: 0 0 20px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 18px; }
.alert-box summary { font-weight: 650; cursor: pointer; }
.alert-box[open] summary { margin-bottom: 10px; }
.alert-box .desc { font-size: 13px; margin-top: 8px; max-width: 75ch; }

/* Textsidor (Data och API): tabellerna innehåller text, inte siffror */
.text-page th, .text-page td { text-align: left; white-space: normal; }
.text-page code { font-family: var(--mono); font-size: 13px; background: var(--chip-bg); padding: 1px 6px; border-radius: 6px; }

/* Flikar (fondsidan: innehav och alla affärer) */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab { font: inherit; font-size: 15px; font-weight: 550; color: var(--fg-muted); background: none; border: 0; padding: 10px 14px; cursor: pointer; position: relative; }
.tab:hover { color: var(--fg); }
.tab[aria-selected="true"] { color: var(--fg); font-weight: 650; }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--brand); }

/* Visa alla rader */
.more-rows { display: block; width: 100%; margin-top: 8px; font: inherit; font-size: 14px; font-weight: 600; color: var(--link); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 9px; cursor: pointer; }
.more-rows:hover { background: var(--bg-hover); }
.mgr .more { margin-top: 0; }
