/* ================================
   🌑 Baslayout & Body
   ================================ */

:root {
  --finwiz-tv-font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("/assets/ibm-plex-sans-var-roman-DKYrB2Yq.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
}

html, body {
  margin: 0;
  padding: 0;
  background: #000;
  font-family: var(--finwiz-tv-font, "Segoe UI", sans-serif);
  height: 100vh;
  display: flex;
  flex-direction: column;
}



/* Specifikt för login/index */
body.main-page {

  flex-direction: column;
  display: block !important;     /* var flex i globala CSS:en */
  height: auto !important;       /* överskriv global 100vh */
  padding: 16px;
  align-items: center;
  min-height: 100svh;

  font-family: var(--finwiz-tv-font, "Segoe UI", sans-serif);

  /* Mörkblå till ljusblå gradient */
  background: linear-gradient(to bottom, #002b5c 0%, #3399cc 100%);
  background-repeat: no-repeat;
  background-attachment: scroll;
}
.container {
  padding-top: 32px;
  padding-left: 16px;
  padding-right: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

body.error {
  box-shadow: inset 0 0 0 4px red;
}

.logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%; /* ← Nu centrerat korrekt */
}

.logo {
  max-width: 160px;
  height: auto;
  width: 100%;
}

@media (max-width: 768px) {
  .logo {
    max-width: 120px;
  }

}



.search-input {

  width: 200px;
  min-width: 200px;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 4px 12px;
  margin-left: 10px;
  font-family: var(--finwiz-tv-font, "Segoe UI", sans-serif);
}
.search-input.has-text {
  background: #fffbe3;  /* ljusgul */
}

.marketcap-input {
  width: 11em;
  margin-left: 2px;
  margin-right: 12px;
  background: #fff;
  border: 1px solid #ccc;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 1em;
  transition: border 0.2s;
}
.marketcap-input:focus {
  border: 1.5px solid #f2c700;
  outline: 2px solid rgba(242,199,0,.35);
  background: #fffbe3;
}
.marketcap-input:disabled {
  background-color: #f0f0f0;  /* ljusgrå bakgrund */
  color: #999;                /* ljusare text */
  border: 1px solid #ccc;     /* tunn grå ram */
  cursor: not-allowed;        /* förbjud-symbol på muspekaren */
  opacity: 0.7;               /* lite transparent */
}

.reset-zoom-btn {
  background-color: #191970; /* Midnight Blue */
  color: white;
  font-weight: bold;
  border: none;
  border-radius: 6px;
  padding: 4px 12px;
  margin-left: 10px;
  cursor: pointer;
  font-family: var(--finwiz-tv-font, "Segoe UI", sans-serif);
  transition: background-color 0.3s ease;
}

.reset-zoom-btn:hover {
  background-color: #000080; /* Navy */
}


/* Space to the right of the checkbox */
.toggle-highlight {
  margin-right: 10px; /* adjust as needed */
}

/* ================================
   📦 Wrapper & SVG
   ================================ */
.wrapper {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: visible;
  position: relative;
}




svg {
  flex: 1;
  width: 100%;
  display: block;
  overflow: visible;
}


/* ================================
   🧰 Verktygsrad / Toolbar
   ================================ */
.toolbar {
  background: #000;
  color: #fff;
  padding-top:1px;
  padding-bottom:1px;
  font-size: 14px;
  display: flex;
  gap: 4px 8px;
  align-items: center;
  z-index: 5;
  container-type: inline-size;
  min-height: 32px;
  flex-wrap: wrap;
}
/* Se till att den inladdade .toolbar blir “riktig” toolbar */
#toolbar-container > .toolbar {
  width: 100%;
  display: flex;
  gap: 4px 8px;
  align-items: center;
  flex-wrap: wrap;
}


.toolbar select {
  margin-left: 2px;
  background: #222;
  color: white;
  border: 1px solid #555;
  padding: 2px 8px;
  border-radius: 6px;
}

.toolbar label,
.toolbar select {
 padding-left: 4px;
  line-height: 2;
}

.custom-section {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin-left: 8px;
  flex: 0 1 auto;
}

.custom-section > * {
  flex: 0 0 auto;
}

#toolbar-container > .toolbar.stocks-toolbar {
  align-items: flex-start;
  align-content: flex-start;
  gap: 3px 6px;
}

.toolbar.stocks-toolbar .home-icon,
.toolbar.stocks-toolbar .info-container {
  margin-top: 4px;
}

.toolbar.stocks-toolbar .file-selection-container {
  display: none;
}

.toolbar.stocks-toolbar .custom-section {
  display: flex;
  flex: 1 1 0;
  min-width: 0;
  margin-left: 0;
  padding-right: 48px;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.toolbar.stocks-toolbar .toolbar-control-group,
.toolbar.stocks-toolbar .toolbar-action-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.toolbar.stocks-toolbar .toolbar-control-group {
  flex: 0 0 auto;
}

.toolbar.stocks-toolbar .toolbar-action-group {
  flex: 0 1 auto;
  flex-wrap: wrap;
  margin-left: auto;
}

.toolbar.stocks-toolbar .toolbar-spacer {
  display: none;
}

@media (max-width: 1900px) {
  .toolbar.stocks-toolbar:not(.has-predefined-view) .toolbar-action-group {
    flex: 1 1 100%;
    justify-content: flex-end;
    margin-left: 0;
  }
}

.toolbar.stocks-toolbar.has-predefined-view .toolbar-control-country-select,
.toolbar.stocks-toolbar.has-predefined-view .toolbar-control-category-select,
.toolbar.stocks-toolbar.has-predefined-view .toolbar-control-market-cap-input,
.toolbar.stocks-toolbar.has-predefined-view #showFavoritesBtn {
  display: none;
}

.toolbar.stocks-toolbar.has-predefined-view .custom-section {
  flex-wrap: nowrap;
}

.toolbar.stocks-toolbar.has-predefined-view .toolbar-action-group {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  margin-left: auto;
}

.toolbar.stocks-toolbar.has-predefined-view .toolbar-action-group .toolbar-action-btn {
  width: 28px;
  min-width: 28px;
  margin-left: 0;
  padding: 0;
}

.toolbar.stocks-toolbar.has-predefined-view .toolbar-action-label {
  display: none;
}

@media (max-width: 1450px) {
  .toolbar.stocks-toolbar.has-predefined-view .custom-section {
    flex-wrap: wrap;
  }

  .toolbar.stocks-toolbar.has-predefined-view .toolbar-action-group {
    flex: 1 1 100%;
    justify-content: flex-end;
    margin-left: 0;
  }
}

@media (max-width: 640px) {
  .toolbar.stocks-toolbar .custom-section {
    padding-right: 0;
    gap: 5px 8px;
  }

  .toolbar.stocks-toolbar .toolbar-control-group {
    flex: 1 1 170px;
  }

  .toolbar.stocks-toolbar .toolbar-control-group select,
  .toolbar.stocks-toolbar .toolbar-control-group input {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
  }

  .toolbar.stocks-toolbar .toolbar-action-group {
    gap: 5px;
  }
}

/* ---- Toolbar: högersektion + språkknapp ---- */
/* --- Toolbar: spacer + right group + language toggle --- */
.toolbar-spacer { flex: 1 1 auto; }

.toolbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  align-self: center;
  gap: 8px;
  height: auto;
  padding-top: 0;
  flex: 0 0 auto;         /* krymp inte, wrappa senare om det MÅSTE */
  order: 999;             /* säkerställ sist i raden */
  white-space: nowrap;
}

/* --- Premium compact toolbar polish --- */
#toolbar-container > .toolbar {
  box-sizing: border-box;
  min-height: 32px;
  padding: 2px 8px;
  background:
    radial-gradient(circle at top center, rgba(255, 214, 102, 0.08), transparent 32%),
    linear-gradient(180deg, #040608 0%, #090d12 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

#toolbar-container > .toolbar.toolbar-lang-pinned {
  position: relative;
  padding-right: 56px;
}

#toolbar-container > .toolbar.toolbar-lang-pinned .toolbar-right {
  margin-left: 0;
  position: absolute;
  right: 8px;
  top: 2px;
  align-self: auto;
  height: 28px;
}

.toolbar .toolbar-field-label {
  margin: 0 2px 0 0;
  padding: 0;
  color: #cfd7e6;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1;
  white-space: nowrap;
}

.toolbar .toolbar-field-label-soft {
  color: #90a0b8;
  font-weight: 600;
}

.toolbar select,
.toolbar .search-input,
.toolbar .marketcap-input,
.toolbar button:not(.lang-toggle) {
  box-sizing: border-box;
  height: 28px;
  border-radius: 8px;
  font-size: 12px;
}

.toolbar select {
  min-width: 94px;
  margin-left: 0;
  padding: 0 28px 0 10px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background:
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 8" fill="none"><path d="M1 1.5L6 6.5L11 1.5" stroke="%23dbe6f6" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>') no-repeat right 10px center / 10px 6px,
    linear-gradient(180deg, #1c2230, #121722);
  color: #f5f7fb;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 1px 0 rgba(0,0,0,.15);
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease, transform .05s ease;
}

.toolbar select option,
.toolbar select optgroup {
  color: #0f172a;
  background: #f8fafc;
}

.toolbar select:hover,
.toolbar .search-input:hover,
.toolbar .marketcap-input:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.toolbar select:hover {
  background:
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 8" fill="none"><path d="M1 1.5L6 6.5L11 1.5" stroke="%23ffe38a" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>') no-repeat right 10px center / 10px 6px,
    linear-gradient(180deg, #21293a, #151b27);
}

.toolbar select:focus,
.toolbar .search-input:focus,
.toolbar .marketcap-input:focus {
  outline: none;
  border-color: rgba(255, 214, 102, 0.8);
  box-shadow: 0 0 0 2px rgba(255, 214, 102, 0.14);
}

.toolbar select:focus {
  background:
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 8" fill="none"><path d="M1 1.5L6 6.5L11 1.5" stroke="%23ffe38a" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/></svg>') no-repeat right 10px center / 10px 6px,
    linear-gradient(180deg, #232c3d, #171d29);
}

.toolbar .toolbar-select-country {
  min-width: 92px;
}

.toolbar .toolbar-select-view {
  min-width: 170px;
  max-width: 230px;
}

.toolbar .toolbar-select-category {
  min-width: 140px;
  border-color: rgba(255, 214, 102, 0.34);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 0 0 1px rgba(255, 214, 102, 0.06);
}

.toolbar .toolbar-select-period {
  min-width: 112px;
}

.toolbar .toolbar-select-groupby {
  min-width: 118px;
  margin-right: 6px;
}

.toolbar .toolbar-select-layout {
  min-width: 126px;
}

.toolbar .toolbar-select-subtle {
  border-color: rgba(255,255,255,.08);
  background:
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 8" fill="none"><path d="M1 1.5L6 6.5L11 1.5" stroke="%23b9c5d9" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>') no-repeat right 10px center / 10px 6px,
    linear-gradient(180deg, #161b24, #10151d);
  color: #d7dfec;
}

.toolbar .toolbar-select-subtle:hover {
  background:
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 8" fill="none"><path d="M1 1.5L6 6.5L11 1.5" stroke="%23dbe6f6" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>') no-repeat right 10px center / 10px 6px,
    linear-gradient(180deg, #1b2230, #131924);
}

.toolbar .search-input {
  width: 190px;
  min-width: 190px;
  margin-left: 8px;
  padding: 0 12px 0 34px;
  background:
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="none"><circle cx="8.5" cy="8.5" r="5.5" stroke="%23707f95" stroke-width="1.8"/><path d="M12.8 12.8L17 17" stroke="%23707f95" stroke-width="1.8" stroke-linecap="round"/></svg>') no-repeat 10px center / 14px 14px,
    linear-gradient(180deg, #e9eef6, #dde5f0);
  border: 1px solid rgba(151, 164, 184, 0.65);
  color: #0f172a;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3);
}

.toolbar .search-input.has-text {
  background:
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="none"><circle cx="8.5" cy="8.5" r="5.5" stroke="%23826f20" stroke-width="1.8"/><path d="M12.8 12.8L17 17" stroke="%23826f20" stroke-width="1.8" stroke-linecap="round"/></svg>') no-repeat 10px center / 14px 14px,
    linear-gradient(180deg, #fff3bf, #ffeaa0);
  border-color: rgba(255, 213, 79, 0.7);
}

.toolbar .search-input::placeholder {
  color: #556277;
}

.toolbar .marketcap-input {
  width: 11.3em;
  margin: 0 6px 0 0;
  padding: 0 10px;
  background: linear-gradient(180deg, #d6dce5, #c8d0db);
  border: 1px solid rgba(122, 136, 159, 0.5);
  color: rgba(15, 23, 42, 0.78);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22);
}

.toolbar .marketcap-input:disabled {
  background: linear-gradient(180deg, #d8dde7, #c8ced9);
  color: rgba(15, 23, 42, 0.62);
  border-color: rgba(148, 163, 184, 0.55);
}

.toolbar .marketcap-input::placeholder {
  color: rgba(15, 23, 42, 0.48);
}

.toolbar label[for="marketCapInput"] {
  margin-left: 2px;
  color: #b9c4d6;
}

.toolbar .toolbar-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-left: 4px;
  padding: 0 12px;
  border: 1px solid transparent;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: transform .04s ease, box-shadow .15s ease, border-color .15s ease, filter .15s ease, background-color .15s ease;
}

.toolbar .toolbar-action-btn:hover {
  transform: translateY(-1px);
}

.toolbar .toolbar-action-btn-primary {
  background: linear-gradient(180deg, #2d4a9c, #1b2b68);
  color: #eef4ff;
  border-color: rgba(123, 160, 255, 0.34);
}

.toolbar .toolbar-action-btn-primary:hover {
  box-shadow: 0 8px 18px rgba(17, 36, 84, 0.34);
}

.toolbar .toolbar-action-btn-secondary {
  background: linear-gradient(180deg, #171c25, #10151d);
  color: #edf2fb;
  border-color: rgba(255,255,255,.12);
  border-radius: 999px;
  padding: 0 13px;
}

.toolbar .toolbar-action-btn-secondary:hover {
  border-color: rgba(255, 214, 102, 0.35);
}

.toolbar .toolbar-action-btn-accent {
  background: linear-gradient(180deg, #191d27, #12161f);
  color: #ffe38a;
  border-color: rgba(255, 214, 102, 0.22);
}

.toolbar .toolbar-action-btn-accent:hover {
  box-shadow: 0 8px 20px rgba(0,0,0,.28);
  border-color: rgba(255, 214, 102, 0.38);
}

#showFavoritesBtn.is-active {
  border-color: rgba(255, 214, 102, 0.42);
  background: linear-gradient(180deg, #2a2311, #17130a);
  color: #ffe38a;
  box-shadow: inset 0 0 0 1px rgba(255, 214, 102, 0.08);
}

#showFavoritesBtn.is-inactive {
  opacity: 1;
  color: #d9e2f0;
  border-color: rgba(255,255,255,.14);
  background: linear-gradient(180deg, #161b24, #10151d);
}

#showFavoritesBtn.is-active:hover,
#showFavoritesBtn.is-inactive:hover {
  filter: none;
}

.lang-toggle {
  background: linear-gradient(180deg, #1a1d26, #131722);
  border: 1px solid #3a4155;
  color: #e5e7eb;
  border-radius: 8px;
  height: 100%;
  padding: 0 10px;
  min-width: 42px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .04s ease, box-shadow .15s ease, border-color .15s ease;
  user-select: none;
}
.lang-toggle:hover { border-color: #59627a; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.lang-toggle:active { transform: translateY(1px); }

/* Flag icons (SVG via data: URL) */
.flag {
  display: inline-block;
  width: 22px;
  height: 16px;
  border-radius: 3px;
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  box-shadow: 0 0 0 1px rgba(58,65,85,.9); /* tunn kant */
}

/* Sweden (SE) */
.flag-se {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 10"><rect width="16" height="10" fill="%23006AA7"/><rect x="5" width="2" height="10" fill="%23FECC00"/><rect y="4" width="16" height="2" fill="%23FECC00"/></svg>');
}

/* United Kingdom (GB) — förenklad Union Jack */
.flag-gb {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 10"><rect width="16" height="10" fill="%2300123A"/><path d="M0,0 L16,10 M16,0 L0,10" stroke="%23FFFFFF" stroke-width="2"/><path d="M0,0 L16,10 M16,0 L0,10" stroke="%23C8102E" stroke-width="1"/><rect x="7" width="2" height="10" fill="%23FFFFFF"/><rect y="4" width="16" height="2" fill="%23FFFFFF"/><rect x="7.5" width="1" height="10" fill="%23C8102E"/><rect y="4.5" width="16" height="1" fill="%23C8102E"/></svg>');
}


.home-icon {
  font-size: 16px;
  text-decoration: none;
  color: white;
  margin-right: 2px;
  margin-left: 4px;
  user-select: none;
}

.home-icon:hover {
  color: #ffeb3b;
  text-decoration: none;
}


.info-container {
  position: relative;
  display: inline-block;
  margin-left: 2px;
}
.info-icon {
  font-size: 16px;
  cursor: help;
  margin-left: 2px;
  margin-right: 4px;
  user-select: none;
}


.custom-tooltip {
  width: 400px;

  position: absolute;
  display: none;
  background-color: #333; /* Mörk bakgrund */
  color: white;           /* Vit text */
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.4;
  max-width: 700px;       /* Tillåter radbrytning */
  z-index: 9999;
  white-space: pre-wrap;
  pointer-events: none;   /* Så den inte blockerar musen */
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.info-container:hover .custom-tooltip {
  visibility: visible;
  opacity: 1;
}
/* ================================
   📁 Filuppladdning
   ================================ */
/* Filsektionen blir egen container (så cqw kan mäta mot just den) */
.file-selection-container {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 520px;  /* låt inte filsektionen trycka bort vykontrollerna */
  min-width: 0;     /* tillåt barn att krympa inuti */
  container-type: inline-size; /* <-- viktig! */
}
.custom-file-upload {
  display: inline-flex;
  align-items: center;
  gap: .5em;

  /* Skala mot containerbredd (cqw). clamp ger trevliga tak/golv. */
  font-size: clamp(12px, 1.1cqw + 0.25rem, 14px);
  padding: clamp(6px, 0.7cqw + 2px, 10px) clamp(10px, 1.3cqw + 2px, 14px);
  border-radius: clamp(3px, 0.35cqw, 6px);

  background-color: #222;
  color: #fff;
  border: 1px solid #555;
  cursor: pointer;
  white-space: nowrap;
}
/* Extra spärr för riktigt smala vyer – filsektionen får hela raden */
@media (max-width: 560px) {
  .file-selection-container { flex-basis: 100%; }
}
@media (max-width: 360px) {
  .custom-file-upload {
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 4px;
  }
}

.file-name-display {
  min-width: 0;           /* nyckeln för att få flexitem att krympa */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(520px, 28vw);

  color: #ccc;
  font-style: italic;
  padding-right: .5rem;

  /* Skala även texten lite med containern */
  font-size: clamp(11px, 0.7cqw + 10px, 13px);
}

#fileInput {
  display: none;
}

#fileNameDisplay {
  margin-left: 10px;
  color: #ccc;
  font-style: italic;
  font-size: 13px;
  padding-right: 2rem;
}

/* ================================
   🧱 Treemap Labels
   ================================ */
.label {
  font-family: var(--finwiz-tv-font, "Segoe UI", sans-serif);
  font-weight: 700;
  letter-spacing: 0.1px;
  fill: white;
}

.value-label {
  font-family: var(--finwiz-tv-font, "Segoe UI", sans-serif);
  font-weight: 700;
  fill: white;
  font-size: 16px;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6);
}

/* ================================
   💬 Tooltip
   ================================ */
.tooltip {
  position: absolute;
  background: #333;
  color: #fff;
  padding: 6px 8px;
  font-size: 12px;
  border-radius: 4px;
   pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;

  max-height: 200px;
  overflow-y: auto;
  overflow-x: hidden;

  /* Nytt */
  z-index: 1000;
  white-space: normal; /* Tillåter radbrytning för långa rader */
  line-height: 1.4;
}

/* Valfri scrollbar-stil för WebKit-baserade webbläsare */
.tooltip::-webkit-scrollbar {
  width: 6px;
}
.tooltip::-webkit-scrollbar-thumb {
  background-color: #666;
  border-radius: 3px;
}


/* ================================
   💬 Tooltip
   ================================ */
.tooltip-transactions-list {
  position: absolute;
  min-width: 460px;
  max-width: min(720px, 60vw);
  background: linear-gradient(180deg, rgba(23, 34, 49, 0.97), rgba(10, 17, 27, 0.99));
  color: #f4f8fd;
  padding: 0;
  font-size: 14px;
  border-radius: 16px;
  border: 1px solid rgba(132, 163, 205, 0.22);
  box-shadow: 0 22px 40px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255,255,255,0.05);
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.2s;

  max-height: none;
  overflow-y: visible;
  overflow-x: hidden;

  /* Nytt */
  z-index: 1000;
  white-space: normal; /* Tillåter radbrytning för långa rader */
  line-height: 1.45;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.tooltip-transactions-list::-webkit-scrollbar {
  width: 10px;
}

.tooltip-transactions-list::-webkit-scrollbar-thumb {
  background: rgba(127, 156, 194, 0.42);
  border-radius: 999px;
  border: 2px solid rgba(12, 20, 31, 0.92);
}

.tooltip-transactions-list .txn-tip-card {
  padding: 16px 18px 14px;
  background:
    radial-gradient(circle at top left, rgba(94, 159, 255, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0));
}

.tooltip-transactions-list .txn-tip-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 16px;
  margin-bottom: 12px;
}

.tooltip-transactions-list .txn-tip-head-main {
  flex: 1 1 auto;
  min-width: 0;
  padding-right: 2px;
}

.tooltip-transactions-list .txn-tip-kicker {
  margin-bottom: 4px;
  color: #8fa7c6;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tooltip-transactions-list .txn-tip-title {
  font-size: 20px;
  line-height: 1.2;
  font-weight: 900;
  color: #f7fbff;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.tooltip-transactions-list .txn-tip-head-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.tooltip-transactions-list .txn-tip-summary-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(120, 151, 191, 0.12);
  border: 1px solid rgba(132, 163, 205, 0.16);
  color: #c8d9ed;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.tooltip-transactions-list .txn-tip-net-wrap {
  flex: 0 0 auto;
  min-width: 138px;
  padding: 11px 12px 10px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.025));
  border: 1px solid rgba(132, 163, 205, 0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
  text-align: right;
}

.tooltip-transactions-list .txn-tip-net-label {
  margin-bottom: 6px;
  color: #8fa7c6;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tooltip-transactions-list .txn-tip-net {
  flex: 0 0 auto;
  font-size: 24px;
  line-height: 1;
  font-weight: 900;
  white-space: nowrap;
}

.tooltip-transactions-list .txn-tip-net.is-positive,
.tooltip-transactions-list .txn-tip-amount.is-positive {
  color: #7ff0a7;
}

.tooltip-transactions-list .txn-tip-net.is-negative,
.tooltip-transactions-list .txn-tip-amount.is-negative {
  color: #ff8c8c;
}

.tooltip-transactions-list .txn-tip-body {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(180px, 0.85fr);
  gap: 12px;
  align-items: start;
}

.tooltip-transactions-list .txn-tip-list-wrap {
  min-width: 0;
}

.tooltip-transactions-list .txn-tip-section {
  padding: 10px 10px 9px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.025));
  border: 1px solid rgba(126, 155, 191, 0.15);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.tooltip-transactions-list .txn-tip-section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px 10px;
  margin-bottom: 10px;
  color: #8fa7c6;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.tooltip-transactions-list .txn-tip-section-head > span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.tooltip-transactions-list .txn-tip-section-head > span:last-child {
  justify-self: end;
  color: #7f96b3;
  font-size: 10px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.tooltip-transactions-list .txn-tip-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tooltip-transactions-list .txn-tip-row {
  padding: 7px 10px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.025));
  border: 1px solid rgba(126, 155, 191, 0.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.tooltip-transactions-list .txn-tip-row:hover {
  background: linear-gradient(180deg, rgba(255,255,255,0.065), rgba(255,255,255,0.03));
  border-color: rgba(136, 170, 212, 0.18);
}

.tooltip-transactions-list .txn-tip-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tooltip-transactions-list .txn-tip-row-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.tooltip-transactions-list .txn-tip-source {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(78, 158, 255, 0.18), rgba(78, 158, 255, 0.1));
  border: 1px solid rgba(112, 170, 245, 0.22);
  color: #b4d8ff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.tooltip-transactions-list .txn-tip-type {
  font-size: 12px;
  font-weight: 800;
  color: #edf4fd;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.06);
}

.tooltip-transactions-list .txn-tip-type.is-buy {
  color: #7ff0a7;
  background: rgba(78, 227, 140, 0.1);
  border-color: rgba(78, 227, 140, 0.18);
}

.tooltip-transactions-list .txn-tip-type.is-sell {
  color: #ff9f9f;
  background: rgba(255, 99, 110, 0.11);
  border-color: rgba(255, 99, 110, 0.18);
}

.tooltip-transactions-list .txn-tip-type.is-dividend {
  color: #ffd67f;
  background: rgba(244, 196, 106, 0.12);
  border-color: rgba(244, 196, 106, 0.2);
}

.tooltip-transactions-list .txn-tip-date-inline {
  color: #8ea4bf;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.tooltip-transactions-list .txn-tip-amount {
  font-size: 14px;
  font-weight: 850;
  white-space: nowrap;
}

.tooltip-transactions-list .txn-tip-more {
  margin-top: 6px;
  color: #8ea4bf;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tooltip-transactions-list .txn-tip-brokers {
  padding: 10px 10px 9px;
  border-radius: 14px;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(126, 155, 191, 0.14);
}

.tooltip-transactions-list .txn-tip-section-head-brokers {
  margin-bottom: 8px;
  grid-template-columns: 1fr;
  justify-items: center;
  text-align: center;
  gap: 2px;
}

.tooltip-transactions-list .txn-tip-section-head-brokers > span:last-child {
  justify-self: center;
}

.tooltip-transactions-list .txn-tip-brokers-chart {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
  padding-top: 2px;
}

.tooltip-transactions-list .txn-tip-brokers-chart svg {
  width: 112px;
  height: 112px;
  overflow: visible;
}

.tooltip-transactions-list .txn-tip-brokers-total {
  fill: #f4f8fd;
  font-size: 16px;
  font-weight: 900;
}

.tooltip-transactions-list .txn-tip-brokers-total-label {
  fill: #91a7c2;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tooltip-transactions-list .txn-tip-brokers-legend {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tooltip-transactions-list .txn-tip-broker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #e7eff9;
}

.tooltip-transactions-list .txn-tip-broker-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tooltip-transactions-list .txn-tip-broker-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.tooltip-transactions-list .txn-tip-broker-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.04);
}

.tooltip-transactions-list .txn-tip-broker-code {
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #eef5ff;
}

.tooltip-transactions-list .txn-tip-broker-count {
  color: #8ea4bf;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tooltip-transactions-list .txn-tip-broker-share {
  color: #9fcbff;
  font-weight: 800;
}
/* ================================
   🎨 Legend
   ================================ */
.legend {
  position: relative;
  flex: 0 0 38px;
  height: 38px;
  margin: 0 8px 4px 16px;
  display: flex;
  gap: 6px;
  align-items: center;
  width: fit-content;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  color: #eef3fb;
  white-space: nowrap;
  overflow: hidden;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
  letter-spacing: 0.2px;
  background: linear-gradient(180deg, rgba(15, 20, 31, 0.92), rgba(8, 11, 18, 0.96));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  box-shadow: 0 10px 26px rgba(0,0,0,.24), inset 0 1px 0 rgba(255,255,255,.04);
}
.legend .legend-item {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 3px;
  border-radius: 8px;
}

.legend-color {
  width: 28px;
  height: 10px;
  margin-bottom: 0;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14);
}

.legend-label {
  font-size: 12px;
  font-weight: 700;
  color: #e8eef9;
}

.legend-item-gold .legend-label {
  color: #f5deb0;
}



/* ================================
   🕳 Tomvy (innan data)
   ================================ */
#empty-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #888;
  font-size: 32px;
  text-align: center;
  z-index: 2;
}

/* ================================
   🖋 Fotnot / Credit
   ================================ */
.credit {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  padding: 5px 10px;
  color: #aaa;
  font-size: 11px;
  font-weight: 600;
  opacity: 0.9;
  z-index: 5;
  pointer-events: none;
}





.credit a {
  color: #eee;
  text-decoration: none;
}

.credit a:hover {
  color: #fff;
  text-decoration: underline;
}

/* ================================
   💰 Totalruta
   ================================ */
.total-box {
  position: fixed;
  bottom: 10px;
  right: 24px;
  color: #f8fafc;
  background: rgba(0, 0, 0, 0.78);
  padding: 10px 14px;
  border-radius: 8px;
  z-index: 10;
  min-width: 720px;
  max-width: 900px;
  box-shadow: 0 0 10px rgba(0,0,0,0.35);
  text-shadow: 0 1px 2px rgba(0,0,0,0.85);
}

.total-box .tb-total {
  color: #ffd700;
  font-size: 42px;
  font-weight: 850;
  margin-bottom: 10px;
  white-space: nowrap;
}

.total-box .tb-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 22px;
  align-items: center;
}

.total-box .tb-col {
  display: grid;
  gap: 6px;
  min-width: 132px;
  align-content: end;
}

.total-box .tb-col:first-of-type {
  padding-left: 20px;
  border-left: 1px solid rgba(150, 180, 220, 0.18);
}

.total-box .tb-label {
  color: rgba(210, 226, 244, 0.86);
  font-size: 16px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 0.035em;
  white-space: nowrap;
}

.total-box .tb-value {
  color: #f8fbff;
  font-size: 22px;
  line-height: 1.05;
  font-weight: 950;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 8px rgba(0,0,0,.28);
}

.total-box .tb-value-date {
  color: #dcecff;
  font-size: 20px;
}


/* ================================
   🖋 Transaction summary
   ================================ */

#summary-box {
 position: fixed;     /* istället för absolute */
  bottom: 10px;        /* avstånd från sidans botten */
  right: 24px;         /* avstånd från högra kanten */
  right: 18px;
  color: #ffd700;
  background: rgba(0, 0, 0,0.2);
  padding: 1px 12px;
  font-size: 24px;
  font-weight: bold;
  border-radius: 6px;
  box-shadow: 0 0 4px rgba(255, 215, 0, 0.3);
  z-index: 10;
   display: inline-block; /* så att den inte tar hela bredden */
}


footer {
  margin-top: 60px;
  margin-bottom: 5px;
  font-size: 13px;
  color: #ccc;
}

footer a {
  color: #ccc;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}


/* ================================
   🖋 Feedback button
   ================================ */

.feedback-button {
  background-color: #ffa500;
  color: white;
  font-size: 0.8rem;
  padding: 3px 6px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.feedback-button:hover {
  background-color: #e59400;
}

/* Modal bakgrund */
.modal.hidden {
  display: none;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 6px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh; /* 💡 Lägg till detta */
  overflow-y: auto;  /* 💡 Scrolla om för lång */
  padding: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-close {
  font-size: 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
}

.modal-body {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal-body label {
  font-weight: bold;
}

.modal-body input,
.modal-body textarea {
  width: 100%;
  padding: 0.5rem;
  border-radius: 4px;
  border: 1px solid #ccc;
  font-family: inherit;
  font-size: 0.9rem;
  box-sizing: border-box; /* 💡 Lägg till detta */
}

.modal-body textarea {
  min-height: 100px;
  max-height: 200px;
  resize: vertical;
}

.modal-footer {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.submit-button {
  background-color: #f7c200;
  color: black;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.submit-button:hover {
  background-color: #e6b200;
}

.cancel-button {
  background-color: #ddd;
  color: #333;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.cancel-button:hover {
  background-color: #ccc;
}

.help-text {
  font-size: 0.8rem;
  color: #555;
  margin-top: 0.5rem;
}



.manage-favorites-btn:hover {
  background-color: #3a3a3a;
}


.manage-favorites-btn {
  background-color: #2a2a2a;
  color: white;
  font-weight: bold;
  border: none;
  border-radius: 6px;
  padding: 4px 12px;
  margin-left: 10px;
  cursor: pointer;
  font-family: var(--finwiz-tv-font, "Segoe UI", sans-serif);
  transition: background-color 0.3s ease;
}

/* Open button style (next to reset zoom) */
.manage-favorites-btn {
  background: linear-gradient(180deg, #1a1d26, #131722);
  border: 1px solid var(--fav-border);
  color: var(--fav-text);
  font-weight: bold;
  border: none;
  border-radius: 6px;
  padding: 4px 12px;
  margin-left: 10px;
  cursor: pointer;
  transition: transform .04s ease, box-shadow .15s ease, border-color .15s ease;
}
.manage-favorites-btn:hover {
  border-color: #3a4155;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
}
.manage-favorites-btn:active { transform: translateY(1px); }


/* ----- Favorites Modal (overlay) ----- */
/* ---------- Theme tokens ---------- */
:root {
  --fav-bg: #0f1115;
  --fav-border: #232633;
  --fav-text: #e7e9ee;
  --fav-muted: #b3b8c5;
  --fav-overlay: rgba(10, 12, 16, 0.6);
  --fav-accent: #7cc4ff;
  --fav-danger: #ff5c5c;
  --radius: 14px;
  --shadow: 0 18px 60px rgba(0,0,0,.55);
}

/* No page scroll while modal open */
body.modal-open {
  overflow: hidden;
}

/* ---------- Overlay + enter/exit animation ---------- */
.fav-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--fav-overlay);
  backdrop-filter: saturate(140%) blur(6px);
  -webkit-backdrop-filter: saturate(140%) blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
  z-index: 9999;
}
.fav-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* Dialog with subtle “pop” */
.fav-dialog {
  width: min(92vw, 620px);
  background: linear-gradient(180deg, #11141b 0%, var(--fav-bg) 100%);
  border: 1px solid var(--fav-border);
  border-radius: var(--radius);
  color: var(--fav-text);
  box-shadow: var(--shadow);
  transform: translateY(8px) scale(.98);
  opacity: 0;
  transition: transform .22s ease, opacity .22s ease;
}
.fav-overlay.show .fav-dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Header */
.fav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--fav-border);
}
.fav-title {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: .2px;
  color: var(--fav-text);
}

/* Close buttons */
.fav-close {
  background: transparent;
  border: 0;
  color: var(--fav-muted);
  font-size: 18px;
  cursor: pointer;
  border-radius: 10px;
  padding: 6px 10px;
  transition: background-color .15s ease, color .15s ease;
}
.fav-close:hover { color: var(--fav-text); background: rgba(255,255,255,.05); }

/* Body */
.fav-body {
  max-height: 65vh;
  overflow: auto;
  padding: 8px 0;
}
.fav-empty {
  opacity: .75;
  padding: 18px;
  text-align: center;
}

/* Items */
.fav-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--fav-border);
}
.fav-name {
  font: 500 14px/1.3 var(--finwiz-tv-font);
  color: var(--fav-text);
  letter-spacing: .2px;
}
.fav-ticker {
  display: inline-block;
  font: 600 12px/1 var(--finwiz-tv-font);
  color: var(--fav-accent);
  background: rgba(124,196,255,.12);
  border: 1px solid rgba(124,196,255,.25);
  padding: 4px 8px;
  border-radius: 999px;
  margin-left: 10px;
}

/* Remove pill button */
.fav-remove {
  appearance: none;
  background: transparent;
  border: 1px solid #3a2a2a;
  color: #ffd0d0;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform .04s ease;
}
.fav-remove:hover {
  background: rgba(255, 92, 92, .12);
  border-color: rgba(255, 92, 92, .4);
}
.fav-remove:active { transform: translateY(1px); }

/* Footer */
.fav-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--fav-border);
}
/* Sort control */
.fav-sort {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto; /* skjut mot höger */
}
.fav-sort-select {
  appearance: none;
  background: #171b24;
  color: var(--fav-text, #e7e9ee);
  border: 1px solid var(--fav-border, #232633);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.fav-sort-select:hover {
  border-color: #3a4155;
}
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.fav-banner {
  padding: 10px 16px;
  font: 500 13px/1.3 var(--finwiz-tv-font);
  border-top: 1px solid var(--fav-border, #232633);
  border-bottom: 1px solid var(--fav-border, #232633);
  background: rgba(255, 92, 92, .12);
  color: #ffd0d0;
}


/* Nice scrollbar for modal lists (WebKit) */
.fav-body::-webkit-scrollbar { width: 10px; }
.fav-body::-webkit-scrollbar-track { background: #0d0f14; }
.fav-body::-webkit-scrollbar-thumb {
  background: #2b3142; border-radius: 10px; border: 2px solid #0d0f14;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .fav-overlay, .fav-dialog { transition: none; }
}

/* ---------- Epic favorites modal refresh ---------- */
.fav-dialog {
  width: min(96vw, 1240px);
  max-height: min(90vh, 920px);
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at top right, rgba(124,196,255,.12), transparent 24%),
    linear-gradient(180deg, #121824 0%, #0e131c 100%);
  border: 1px solid rgba(124, 196, 255, 0.16);
  border-radius: 24px;
  box-shadow: 0 28px 90px rgba(0,0,0,.58);
}

.fav-header {
  gap: 16px;
  align-items: flex-start;
  padding: 22px 24px 18px;
}

.fav-title-wrap {
  min-width: 0;
  flex: 1 1 auto;
}

.fav-kicker {
  margin-bottom: 8px;
  color: #8fd1ff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.fav-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.03em;
  color: #f4f8ff;
}

.fav-subtitle {
  margin-top: 8px;
  max-width: 72ch;
  color: #b8c4d6;
  font-size: 14px;
  line-height: 1.45;
}

.fav-sort {
  margin-left: 0;
  align-self: center;
}

.fav-sort-select {
  min-width: 120px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255,255,255,.04);
  border-color: rgba(124,196,255,.14);
}

.fav-close {
  align-self: flex-start;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}

.fav-banner {
  margin: 0 24px;
  border: 1px solid rgba(255, 92, 92, .18);
  border-radius: 14px;
}

.fav-body {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .95fr);
  gap: 18px;
  padding: 0 24px 20px;
  max-height: none;
  overflow: hidden;
}

.fav-panel {
  min-height: 0;
  border: 1px solid rgba(124,196,255,.1);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.015));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.fav-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid rgba(124,196,255,.08);
}

.fav-panel-title {
  color: #f3f7fd;
  font-size: 16px;
  font-weight: 700;
}

.fav-panel-copy {
  margin-top: 4px;
  color: #9fb0c7;
  font-size: 12px;
  line-height: 1.4;
}

.fav-panel-stat {
  color: #8fd1ff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.fav-search-shell {
  padding: 14px 18px 12px;
  border-bottom: 1px solid rgba(124,196,255,.08);
}

.fav-search-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.fav-search-input {
  width: 100%;
  box-sizing: border-box;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(124,196,255,.18);
  background: rgba(255,255,255,.04);
  color: #eef4ff;
  font-size: 14px;
  outline: none;
}

.fav-search-input::placeholder {
  color: #7f8ea4;
}

.fav-search-input:focus {
  border-color: rgba(124,196,255,.38);
  box-shadow: 0 0 0 3px rgba(124,196,255,.12);
}

.fav-search-clear {
  appearance: none;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(124,196,255,.16);
  background: rgba(255,255,255,.045);
  color: #dbe8fb;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.fav-search-clear:hover {
  background: rgba(255,255,255,.08);
  border-color: rgba(124,196,255,.24);
}

.fav-search-info {
  margin-top: 10px;
  color: #8ea1ba;
  font-size: 12px;
}

.fav-results,
.fav-selected-list {
  min-height: 0;
  overflow: auto;
  padding: 8px;
}

.fav-result-item,
.fav-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  transition: background-color .15s ease, border-color .15s ease, transform .05s ease;
}

.fav-result-item:hover,
.fav-item:hover {
  background: rgba(255,255,255,.03);
  border-color: rgba(124,196,255,.12);
}

.fav-result-item.is-favorite {
  background: linear-gradient(180deg, rgba(30,163,102,.08), rgba(30,163,102,.03));
  border-color: rgba(30,163,102,.22);
}

.fav-result-meta,
.fav-item-meta {
  min-width: 0;
}

.fav-result-title,
.fav-name {
  color: #f4f8ff;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
}

.fav-result-sub,
.fav-item-sub {
  margin-top: 5px;
  color: #90a0b6;
  font-size: 12px;
  line-height: 1.35;
}

.fav-action,
.fav-remove {
  appearance: none;
  min-width: 92px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.fav-action-add {
  color: #d7fcea;
  background: rgba(30, 163, 102, .14);
  border: 1px solid rgba(30, 163, 102, .34);
}

.fav-action-add:hover {
  background: rgba(30, 163, 102, .2);
}

.fav-action-remove,
.fav-remove {
  color: #ffd6d1;
  background: rgba(255,92,92,.08);
  border: 1px solid rgba(255,92,92,.24);
}

.fav-action-remove:hover,
.fav-remove:hover {
  background: rgba(255,92,92,.14);
  border-color: rgba(255,92,92,.34);
}

.fav-footer {
  padding: 16px 24px 22px;
}

.fav-footer .fav-close {
  width: auto;
  height: 40px;
  padding: 0 16px;
  border: 1px solid rgba(124,196,255,.12);
  background: rgba(255,255,255,.04);
}

.fav-results::-webkit-scrollbar,
.fav-selected-list::-webkit-scrollbar {
  width: 10px;
}

.fav-results::-webkit-scrollbar-track,
.fav-selected-list::-webkit-scrollbar-track {
  background: transparent;
}

.fav-results::-webkit-scrollbar-thumb,
.fav-selected-list::-webkit-scrollbar-thumb {
  background: rgba(124,196,255,.18);
  border-radius: 999px;
}

@media (max-width: 980px) {
  .fav-dialog {
    width: min(96vw, 860px);
  }

  .fav-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .fav-header {
    padding: 18px 16px 14px;
    flex-wrap: wrap;
  }

  .fav-title {
    font-size: 22px;
  }

  .fav-body {
    padding: 0 16px 16px;
    gap: 14px;
  }

  .fav-banner {
    margin: 0 16px;
  }

  .fav-footer {
    padding: 14px 16px 18px;
  }

  .fav-result-item,
  .fav-item {
    grid-template-columns: 1fr;
  }

  .fav-search-toolbar {
    grid-template-columns: 1fr;
  }

  .fav-action,
  .fav-remove,
  .fav-search-clear {
    width: 100%;
  }
}

.bar-label {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
:root {
  --bar-start: #2f6bbd; /* mörkare botten */
  --bar-end:   #4a90e2; /* ljusare topp */
  --axis-stroke: #6b7280;
  --grid-stroke: #2f3640;
  --label-fill: #fff;
}
.bar { fill: var(--bar-fill); }
.x-axis .domain, .x-axis .tick line,
.y-grid .tick line { stroke: var(--axis-stroke); }



/* 🔒 Scoped till just utdelnings-stapeldiagrammet */
#dividends-tooltip {
  position: fixed; z-index: 9999; pointer-events: none;
  display: none; opacity: 0; transform: translateY(4px) scale(0.98);
  transition: opacity 120ms ease, transform 120ms ease;
  background: linear-gradient(180deg, rgba(22,28,36,0.85), rgba(22,28,36,0.92));
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 8px 28px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.04);
  border-radius: 12px; padding: 10px 12px; color: #eef2f7;
  min-width: 220px; line-height: 1.3; white-space: normal;
  max-width: min(92vw, 1600px);
}
#dividends-tooltip.is-visible { display: block; opacity: 1; transform: translateY(0) scale(1); }
#dividends-tooltip::after {
  content:""; position:absolute; width:10px; height:10px; background:inherit;
  border-left:1px solid rgba(255,255,255,0.08); border-top:1px solid rgba(255,255,255,0.08);
  transform: rotate(45deg); filter: drop-shadow(0 2px 2px rgba(0,0,0,0.25));
}
#dividends-tooltip[data-pos="right"]::after { left:-6px; top:14px; }
#dividends-tooltip[data-pos="left"]::after  { right:-6px; top:14px; transform: rotate(225deg); }

/* Inre delar (bara i denna tooltip) */
#dividends-tooltip .tip-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:6px;}
#dividends-tooltip .tip-title{font-weight:700;letter-spacing:.2px;}
#dividends-tooltip .tip-total{font-weight:600;opacity:.95;margin:2px 0 6px;}
#dividends-tooltip .tip-divider{border:none;border-top:1px solid rgba(255,255,255,0.10);margin:8px 0;}
#dividends-tooltip .pill{display:inline-flex;align-items:center;gap:6px;padding:2px 8px;border-radius:999px;font-size:12px;border:1px solid rgba(255,255,255,0.08);background:rgba(255,255,255,0.06);}
#dividends-tooltip .pill--up{background:rgba(0,200,83,.15);color:#9affb4;}
#dividends-tooltip .pill--down{background:rgba(255,82,82,.18);color:#ff9a9a;}
#dividends-tooltip .pill--flat{background:rgba(255,255,255,.08);color:#cfd8e3;}
#dividends-tooltip .tip-chips{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:6px;}
#dividends-tooltip .chip{font-size:12px;padding:3px 8px;border-radius:999px;border:1px dashed rgba(255,255,255,0.12);background:rgba(255,255,255,0.04);}
/* Alltid EN kolumn i listan */
#dividends-tooltip .tip-list {
  column-count: 2 !important;
  column-gap: 2 !important;
}
#dividends-tooltip .tip-row{break-inside:avoid;opacity:.95;}
@media (min-width:520px){
  #dividends-tooltip .tip-list[data-cols="2"]{column-count:2;}
  #dividends-tooltip .tip-list[data-cols="3"]{column-count:3;}
}










/* ==== FW Modal (namespaced, no conflicts) ==== */
/* ==== FinWiz modal (namespaced, robust i prod/dev) ==== */
#sym-modal[hidden]{ display:none !important; }

#sym-modal.fw-modal-backdrop{
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(3px);
  z-index: 10000;
}

/* Absolut centrerad, immun mot globala .modal-regler */
#sym-modal .fw-modal{
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(1180px, 96vw);
  max-height: min(92vh, 900px);
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 12px;
  box-shadow: 0 20px 48px rgba(0,0,0,.45);
  display: flex; flex-direction: column;
  box-sizing: border-box;
  overflow: hidden; /* innehåll puttar inte modalen */
  font: 400 14px/1.4 var(--finwiz-tv-font);
}

@media (min-width: 1440px) {
  #sym-modal .fw-modal {
    width: min(1280px, 96vw);
  }
}

#sym-modal .fw-modal-header,
#sym-modal .fw-modal-footer{ padding:12px 14px; border-color:#334155; }
#sym-modal .fw-modal-header{ display:flex; align-items:center; gap:10px; border-bottom:1px solid; }
#sym-modal .fw-modal-title { font-weight:750; font-size:20px; color:var(--hindsight-text, #f1f5f9); }
#sym-modal .fw-modal-close { margin-left:auto; background:transparent; border:1px solid #334155; color:#e5e7eb; border-radius:8px; padding:4px 8px; cursor:pointer; }
#sym-modal .fw-modal-footer{ display:flex; justify-content:flex-end; gap:10px; border-top:1px solid; background:#0b1220; }

/* Endast mitten scrollar */
#sym-modal .fw-modal-scroll{ flex:1; min-height:0; overflow:auto; padding:12px 14px; }

#sym-modal .sym-selection-overview{
  display:flex; align-items:flex-start; justify-content:space-between; gap:12px;
  margin-bottom:8px; color:#e5e7eb;
}
#sym-modal .sym-selection-overview > div:first-child{ display:flex; align-items:baseline; gap:8px; flex-wrap:wrap; }
#sym-modal #sym-count{ color:#f8fafc; font-size:15px; }
#sym-modal #sym-limit-hint{ color:#94a3b8; font-size:12px; }
#sym-modal .sym-message{ color:#fbbf24; font-size:12px; font-weight:700; text-align:right; }
#sym-modal .sym-message:empty{ display:none; }
#sym-modal .sym-message.is-error{ color:#fca5a5; }

#sym-modal .sym-selected-chips,
#sym-modal .sym-presets{ display:flex; gap:6px; flex-wrap:wrap; }
#sym-modal .sym-selected-chips{ min-height:34px; margin-bottom:10px; padding:7px; border:1px solid #334155; border-radius:8px; background:#0b1220; }
#sym-modal .sym-presets{ margin-bottom:10px; }
#sym-modal .sym-presets-label,
#sym-modal .sym-search label{ display:block; color:var(--hindsight-muted, #94a3b8); font-size:13px; font-weight:650; margin-bottom:6px; }
#sym-modal .sym-search{ margin:14px 0; }
#sym-modal .sym-search input{ box-sizing:border-box; width:100%; min-height:44px; padding:10px 12px; border:1px solid var(--hindsight-border, #334155); border-radius:8px; background:var(--hindsight-raised, #1e293b); color:var(--hindsight-text, #e5e7eb); font:inherit; }
#sym-modal .sym-search input::placeholder{ color:var(--hindsight-muted, #94a3b8); opacity:1; }
#sym-modal .sym-chip,
#sym-modal .sym-preset{ display:inline-flex; align-items:center; gap:6px; min-height:36px; border:1px solid #475569; border-radius:999px; background:#172033; color:#dbeafe; padding:5px 12px; font-size:13px; font-weight:650; cursor:pointer; }
#sym-modal .sym-chip:hover,
#sym-modal .sym-preset:hover{ border-color:#60a5fa; background:#1e293b; }
#sym-modal .sym-chip-remove{ color:#94a3b8; font-size:14px; line-height:1; }
#sym-modal .sym-selected-empty{ align-self:center; color:#64748b; font-size:12px; }

/* Toolbar i modalen */
#sym-modal .fw-modal-toolbar{ display:flex; align-items:center; gap:8px; margin:8px 0; flex-wrap:wrap; }
#sym-modal .fw-modal-toolbar .sym-filter-result{ margin-left:auto; }
#sym-modal .sym-filter-result{ min-height:18px; color:#94a3b8; font-size:12px; }

/* Sektionerad symbolkarta */
#sym-modal .group-section{ margin:8px 0 10px; background:#111827; border:1px solid #334155; border-radius:8px; overflow:hidden; }
#sym-modal .group-header{ display:flex; align-items:center; gap:8px; background:#1e293b; color:#e5e7eb; font-weight:700; font-size:14px; padding:8px 10px; cursor:pointer; }
#sym-modal .group-header::marker{ color:#60a5fa; }
#sym-modal .group-count{ margin-left:auto; color:#94a3b8; font-size:12px; font-weight:600; }
#sym-modal .group-actions{ display:flex; justify-content:flex-end; gap:6px; padding:6px 10px 0; }
#sym-modal .group-action{ border:0; background:transparent; color:#93c5fd; padding:2px 5px; font-size:11px; font-weight:650; cursor:pointer; }
#sym-modal .group-action:hover{ text-decoration:underline; }
#sym-modal .group-body{ display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; padding:10px; }

#sym-modal .option-row{ display:flex; align-items:center; gap:10px; min-width:0; min-height:64px; box-sizing:border-box; background:#0f172a; border:1px solid #334155; border-radius:8px; padding:10px; font-size:14px; cursor:pointer; }
#sym-modal .option-row[hidden]{ display:none; }
#sym-modal .option-row input{ flex-shrink:0; margin:0; }
#sym-modal .option-copy{ display:flex; flex-direction:column; gap:4px; min-width:0; overflow-wrap:anywhere; }
#sym-modal .option-name{ font-weight:650; color:var(--hindsight-text, #e5e7eb); line-height:1.3; }
#sym-modal .option-meta{ color:var(--hindsight-muted, #94a3b8); font-size:12px; line-height:1.3; }
#sym-modal .option-row:focus-within{ outline:2px solid var(--hindsight-focus, #93c5fd); outline-offset:2px; }

/* Knappar (återanvänder dina .btn/.btn-primary) */
#sym-modal .btn{ background:#1e293b; border:1px solid #3b4252; color:#e5e7eb; padding:5px 12px; border-radius:6px; font-size:13px; cursor:pointer; }
#sym-modal .btn:hover{ background:#2d3748; }
#sym-modal .btn-primary{ background:#1f2937; border-color:#60a5fa; box-shadow:0 0 0 2px rgba(96,165,250,.25) inset; }
#sym-modal .btn:disabled{ cursor:not-allowed; opacity:.45; }

@media (max-width: 640px) {
  #sym-modal .fw-modal{ width:100vw; max-height:100dvh; height:100dvh; border-radius:0; }
  #sym-modal .sym-selection-overview{ display:block; }
  #sym-modal .sym-message{ margin-top:4px; text-align:left; }
  #sym-modal .group-body{ grid-template-columns:repeat(2,minmax(0,1fr)); padding:8px; }
  #sym-modal .option-row{ gap:7px; padding:8px; min-height:76px; font-size:13px; }
  #sym-modal .fw-modal-header, #sym-modal .fw-modal-footer, #sym-modal .fw-modal-scroll{ padding:10px; }
  #sym-modal .fw-modal-footer .btn-primary{ flex:1; }
}
@media (min-width:1440px){ #sym-modal .group-body{ grid-template-columns:repeat(5,minmax(0,1fr)); } }
@media (min-width:641px) and (max-width:900px){ #sym-modal .group-body{ grid-template-columns:repeat(3,minmax(0,1fr)); } }


/* Gör HTML-legendens text tydligare (legend är HTML, inte SVG) */
#legend .legend-item {
  text-shadow: 0 1px 2px rgba(0,0,0,0.65);
}

#legend .legend-identity { display: inline-flex; align-items: baseline; gap: 6px; min-width: 0; }
#legend .legend-symbol { color: #fff; font-size: 15px; }
#legend .legend-name { color: #e2e8f0; font-size: 14px; }
#legend .legend-return { color: #fff; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
#legend .legend-close { color: #cbd5e1; font-size: 12px; font-variant-numeric: tabular-nums; }
.dd-value--negative { color: #f87171; }
.dd-value--neutral { color: #cbd5e1; }

/* StockInfo's public page navigation and accessible controls. */
.hindsight-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  background: #020914;
  border-bottom: 1px solid #334155;
  color: #f8fafc;
}
.hindsight-toolbar-actions { display: flex; align-items: center; gap: 8px; }
.hindsight-toolbar a, .hindsight-toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid #475569;
  border-radius: 8px;
  background: #102038;
  color: #e2e8f0;
  font: 700 15px/1.2 var(--finwiz-tv-font);
  text-decoration: none;
  cursor: pointer;
}
.hindsight-toolbar .hindsight-home { border: 0; background: transparent; color: #93c5fd; font-size: 18px; }
.hindsight-home span { margin-left: 5px; color: #f8fafc; }
.hindsight-toolbar a:hover, .hindsight-toolbar button:hover { background: #1e3a5f; }
.hindsight-toolbar a:focus-visible, .hindsight-toolbar button:focus-visible,
.hindsight-page button:focus-visible, .hindsight-page input:focus-visible,
#sym-modal button:focus-visible, #sym-modal input:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 2px;
}
#sym-modal button, #sym-modal .option-row { min-height: 40px; }
#sym-modal .option-row input { width: 18px; height: 18px; }
.bs-label:focus-visible rect { stroke: #fff; stroke-width: 3; }
@media (max-width: 760px) {
  .hindsight-toolbar { padding: 6px 12px; }
  .hindsight-toolbar .hindsight-home { font-size: 16px; }
  .hindsight-page #empty-state { width: min(90vw, 460px); font-size: 20px; }
  .hindsight-page .wrapper { min-height: 300px; }
}


/* ================================
   ⏳ Fetch Loader Modal
   ================================ */
.fetch-loader-modal.hidden {
  display: none !important;
}

.fetch-loader-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 12, 16, 0.72);
  backdrop-filter: saturate(140%) blur(6px);
  -webkit-backdrop-filter: saturate(140%) blur(6px);
  z-index: 12000;
}

.fetch-loader-card {
  position: relative;
  width: min(92vw, 520px);
  padding: 24px 24px 20px;
  border-radius: 16px;
  background: linear-gradient(180deg, #11141b 0%, #0f1115 100%);
  border: 1px solid #232633;
  color: #e7e9ee;
  box-shadow: 0 18px 60px rgba(0,0,0,.55);
  overflow: hidden;
}

.fetch-loader-glow {
  position: absolute;
  right: -30px;
  bottom: -50px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(124,196,255,.18) 0%, rgba(124,196,255,0) 70%);
  pointer-events: none;
}

.fetch-loader-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.fetch-loader-header h3 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 700;
  color: #f5f7fb;
}

.fetch-loader-header p {
  margin: 0;
  font-size: 13px;
  color: #b3b8c5;
}

.fetch-loader-spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.08);
  border-top-color: #7cc4ff;
  border-right-color: #7cc4ff;
  flex-shrink: 0;
  animation: fetchLoaderSpin .9s linear infinite;
}

@keyframes fetchLoaderSpin {
  to { transform: rotate(360deg); }
}

.fetch-loader-progress-wrap {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.05);
  margin-bottom: 12px;
}

.fetch-loader-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2f6bbd 0%, #4a90e2 55%, #7cc4ff 100%);
  box-shadow: 0 0 18px rgba(124,196,255,.25);
  transition: width 0.9s ease;
}

.fetch-loader-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: #cbd5e1;
}

#fetchLoaderStatus {
  font-weight: 600;
}

#fetchLoaderPercent {
  min-width: 44px;
  text-align: right;
  font-weight: 700;
  color: #7cc4ff;
}

/* In Hindsight: period and selection first, compact results before the chart. */
.hindsight-page .controls {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
  padding: 7px 16px;
}
.hindsight-page .appearance-group,
.hindsight-page .analysis-group { align-self: start; }
/* Expanded controls use the whole row, so a short sibling cannot leave a tall
   empty half beside the day reader or analysis options. */
.hindsight-page .controls > :is(.appearance-group, .analysis-group)[open] { grid-column: 1 / -1; }
.hindsight-page .controls:has(> :is(.appearance-group, .analysis-group)[open]) > :is(.appearance-group, .analysis-group):not([open]) { grid-column: 1 / -1; }
.hindsight-page .controls .analysis-group > summary {
  position: relative;
  padding-right: 30px;
}
.hindsight-page .analysis-loading {
  position: absolute;
  right: 10px;
  top: 50%;
  width: 12px;
  height: 12px;
  transform: translateY(-50%);
  pointer-events: none;
}
.hindsight-page .analysis-loading[hidden] { display: none !important; }
.hindsight-page .recession-coverage-note { flex-basis: 100%; color: var(--hindsight-muted, #a8b8cc); font-size: 12px; }
.hindsight-page .cycle-events { min-width: 0; margin: 6px 16px 0; }
.hindsight-page .cycle-event-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hindsight-page .cycle-key { display: flex; flex-wrap: wrap; gap: 3px 12px; min-width: 0; color: var(--hindsight-muted, #a8b8cc); font-size: 11px; }
.hindsight-page .cycle-key [hidden] { display: none; }
.hindsight-page .cycle-key span::before { content: ''; display: inline-block; width: 9px; height: 9px; margin-right: 5px; border-radius: 2px; background: #94a3b8; }
.hindsight-page .cycle-key .cycle-key-depression::before { background: #c084fc; }
.hindsight-page .cycle-event-list { display: grid; grid-template-columns: repeat(auto-fit,minmax(165px,1fr)); gap: 6px; min-width: 0; padding: 8px 0; }
.hindsight-page .cycle-timeline { position: relative; }
.hindsight-page .cycle-timeline-leaders { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.hindsight-page .cycle-timeline-leaders path { fill: none; stroke: #94a3b8; stroke-width: 1; opacity: .22; }
.hindsight-page .cycle-timeline-leaders path[data-kind="depression"] { stroke: #c084fc; }
.hindsight-page .cycle-period-button,
.hindsight-page .cycle-periods-toggle { min-height: 44px; padding: 5px 9px; border: 1px solid var(--hindsight-border, #475569); border-radius: 7px; background: var(--hindsight-surface, #0b1220); color: var(--hindsight-text, #e2e8f0); font: 600 12px/1.25 var(--finwiz-tv-font); cursor: pointer; }
.hindsight-page .cycle-periods-toggle { flex: 0 0 auto; }
.hindsight-page .cycle-timeline-button { position: absolute; white-space: nowrap; }
.hindsight-page .cycle-period-button[data-kind="depression"] { border-color: color-mix(in srgb, #a78bfa 35%, transparent); }
.hindsight-page .cycle-timeline-button { border-color: transparent; background: transparent; color: var(--hindsight-muted, #a8b8cc); }
.hindsight-page .cycle-period-button:is(:hover,:focus-visible,[aria-expanded="true"]),
.hindsight-page .cycle-period-button.is-active { border-color: var(--hindsight-focus, #93c5fd); background: var(--hindsight-raised, #102038); color: var(--hindsight-text, #e2e8f0); }
.hindsight-page .cycle-timeline-leaders path.is-active { opacity: .8; stroke-width: 1.5; }
.hindsight-page .cycle-period-button[aria-expanded="true"] { box-shadow: inset 0 0 0 1px var(--hindsight-focus, #93c5fd); }
.hindsight-page .cycle-period-button:focus-visible, .hindsight-page .cycle-periods-toggle:focus-visible, .hindsight-page .cycle-popover :focus-visible { outline: 2px solid var(--hindsight-focus, #93c5fd); outline-offset: 2px; }
.hindsight-page .cycle-events[hidden],
.hindsight-page .cycle-events [hidden] { display: none !important; }
.hindsight-page .cycle-band--recession { fill: rgba(148, 163, 184, .16); }
.hindsight-page .cycle-band--depression { fill: rgba(168, 85, 247, .15); }
.hindsight-page .cycle-band--recession.is-active { fill: rgba(148, 163, 184, .30); stroke: #94a3b8; stroke-width: 1; }
.hindsight-page .cycle-band--depression.is-active { fill: rgba(168, 85, 247, .24); stroke: #c084fc; stroke-width: 1; }
.hindsight-page .cycle-approximate-end { stroke: #c084fc; stroke-width: 1.5; stroke-dasharray: 5 4; pointer-events: none; }
.hindsight-page .cycle-popover { position: fixed; z-index: 1100; box-sizing: border-box; overflow: auto; padding: 12px; border: 1px solid var(--hindsight-border, #475569); border-radius: 10px; background: var(--hindsight-raised, #102038); color: var(--hindsight-text, #e2e8f0); box-shadow: 0 12px 36px rgba(0,0,0,.35); font: 13px/1.45 var(--finwiz-tv-font); }
.hindsight-page .cycle-popover[data-kind="depression"] { border-color: #a78bfa; }
.hindsight-page .cycle-popover header { display: flex; align-items: center; gap: 8px; }
.hindsight-page .cycle-popover h3 { flex: 1; margin: 0; font-size: 16px; }
.hindsight-page .cycle-popover button { flex: 0 0 auto; width: 44px; height: 44px; border: 1px solid var(--hindsight-border, #475569); border-radius: 7px; background: transparent; color: inherit; font-size: 23px; cursor: pointer; }
.hindsight-page .cycle-popover p { margin: 8px 0; }
.hindsight-page .cycle-detail-period { font-weight: 650; }
.hindsight-page .cycle-detail-note,
.hindsight-page .cycle-detail-precision,
.hindsight-page .cycle-detail-method { color: var(--hindsight-muted, #a8b8cc); font-size: 12px; }
.hindsight-page .cycle-detail-method { border-left: 2px solid var(--hindsight-border, #475569); padding-left: 8px; }
.hindsight-page .cycle-popover dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 10px 0; }
.hindsight-page .cycle-popover dt { color: var(--hindsight-muted, #a8b8cc); }
.hindsight-page .cycle-popover dd { margin: 0; text-align: right; }
.hindsight-page .cycle-detail-sources { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--hindsight-border, #475569); padding-top: 5px; overflow-wrap: anywhere; }
.hindsight-page .cycle-detail-sources small { display: block; color: var(--hindsight-muted, #a8b8cc); font-size: 11px; }
.hindsight-page .cycle-detail-sources a { display: flex; align-items: center; min-height: 44px; color: var(--hindsight-focus, #93c5fd); text-underline-offset: 3px; }
html[data-hindsight-theme="light"] .hindsight-page .cycle-band--recession { fill: rgba(71, 85, 105, .12); }
html[data-hindsight-theme="light"] .hindsight-page .cycle-band--depression { fill: rgba(139, 92, 246, .13); }
html[data-hindsight-theme="light"] .hindsight-page .cycle-band--recession.is-active { fill: rgba(71, 85, 105, .24); }
html[data-hindsight-theme="light"] .hindsight-page .cycle-band--depression.is-active { fill: rgba(139, 92, 246, .25); }
html[data-hindsight-theme="light"] .hindsight-page .cycle-approximate-end { stroke: #7c3aed; }
@media (max-width: 760px) {
  .hindsight-page .cycle-events { margin: 5px 12px 0; }
  .hindsight-page .cycle-key { flex-direction: column; gap: 3px; }
  .hindsight-page .cycle-timeline { display: none; }
}
.hindsight-page .analysis-loading::before {
  content: '';
  display: block;
  box-sizing: border-box;
  width: 12px;
  height: 12px;
  border: 2px solid #83ccff40;
  border-top-color: #83ccff;
  border-radius: 50%;
  animation: fetchLoaderSpin .9s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .hindsight-page .analysis-loading::before { animation: none; }
}
.hindsight-page .control-primary {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
}
.hindsight-page .control-primary-main { min-width: 0; }
.hindsight-page .preset-navigation { display: flex; align-items: center; gap: 4px; min-width: 0; flex: 1 1 auto; }
.hindsight-page .preset-scroll { min-width: 0; flex: 1 1 auto; }
.hindsight-page .control-primary-main > #sym-open { flex-shrink: 0; }
.hindsight-page .preset-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  box-sizing: border-box;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--hindsight-border, #475569);
  border-radius: 8px;
  background: var(--hindsight-raised, #102038);
  color: var(--hindsight-text, #e2e8f0);
  font: 650 24px/1 var(--finwiz-tv-font);
  cursor: pointer;
}
.hindsight-page .preset-nav:hover:not(:disabled) { background: var(--hindsight-hover, #1e3a5f); }
.hindsight-page .preset-nav:disabled { opacity: .4; cursor: default; }
.hindsight-page .control-label-compact,
.hindsight-page .custom-range-compact { display: none; }
.hindsight-page .btn-preset,
.hindsight-page #sym-open {
  min-height: 42px;
  box-sizing: border-box;
  padding: 7px 11px;
  border: 1px solid #475569;
  border-radius: 8px;
  background: #0b1220;
  color: #e5e7eb;
  font: 700 14px/1.2 var(--finwiz-tv-font);
  white-space: nowrap;
  cursor: pointer;
}
.hindsight-page .btn-preset--active {
  border-color: #60a5fa;
  background: #1e3a5f;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.25) inset;
}
/* Match Fear & Greed's compact desktop period controls; phone rules retain 44px. */
.hindsight-page .btn-preset {
  min-height: 36px;
  padding: 0 8px;
  border-radius: 6px;
  font-weight: 750;
}
.hindsight-page .custom-range,
.hindsight-page .appearance-group {
  min-width: 0;
  border: 1px solid #475569;
  border-radius: 8px;
  background: #0b1220;
}
.hindsight-page .custom-range.is-custom { border-color: #60a5fa; }
.hindsight-page .custom-range[open] { grid-column: 1 / -1; }
.hindsight-page .custom-range > summary,
.hindsight-page .appearance-group > summary,
.hindsight-page .analysis-group > summary {
  min-height: 42px;
  box-sizing: border-box;
  padding: 9px 11px;
  color: #dbeafe;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.hindsight-page .custom-range > summary { white-space: nowrap; }
.hindsight-page .controls :is(.appearance-group, .analysis-group) > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
}
.hindsight-page .controls :is(.appearance-group, .analysis-group) > summary::-webkit-details-marker { display: none; }
.hindsight-page .controls :is(.appearance-group, .analysis-group) > summary::before { content: '▸'; flex: 0 0 auto; }
.hindsight-page .controls :is(.appearance-group, .analysis-group)[open] > summary::before { content: '▾'; }
.hindsight-page .date-controls,
.hindsight-page .appearance-options {
  padding: 9px 10px 10px;
  border-top: 1px solid #334155;
}
.hindsight-page .appearance-options { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; padding: 6px 8px 8px; }
.hindsight-page .appearance-options > .control-label { min-height: 40px; }
.hindsight-page .analysis-options { gap: 4px 14px; padding: 6px 8px 8px; }
.hindsight-page .analysis-options > .control-label { min-height: 32px; white-space: normal; }
.hindsight-page .date-wrap {
  --icon-size: 18px;
  --icon-right: 3px;
  position: relative;
  display: inline-flex;
  align-items: center;
}
.hindsight-page .date-wrap input[type="date"] {
  appearance: none;
  box-sizing: border-box;
  width: 148px;
  height: 40px;
  padding: 0 42px 0 10px;
  border: 1px solid #475569;
  border-radius: 8px;
  background: #0b1220;
  color: #e5e7eb;
  font-size: 13px;
  line-height: 40px;
}
.hindsight-page .date-wrap .date-btn {
  width: 40px;
  height: 40px;
  background-size: 18px 18px;
}
.hindsight-page .view-toolbar { display: flex; align-items: center; gap: 8px; }
.hindsight-page .view-mode-caption { color: #94a3b8; font-size: 13px; font-weight: 700; }
.hindsight-page .view-mode-control { position: relative; display: inline-flex; cursor: pointer; }
.hindsight-page .view-mode-control input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.hindsight-page .view-mode-options { display: inline-flex; padding: 3px; border: 1px solid #475569; border-radius: 9px; background: #0b1220; }
.hindsight-page .view-mode-options span { min-width: 54px; min-height: 32px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; border-radius: 6px; color: #94a3b8; font-size: 14px; font-weight: 700; }
.hindsight-page .view-mode-control input:not(:checked) + .view-mode-options span:first-child,
.hindsight-page .view-mode-control input:checked + .view-mode-options span:last-child { background: #1e3a5f; color: #f8fafc; }
.hindsight-page .view-mode-control input:focus-visible + .view-mode-options { outline: 3px solid #93c5fd; outline-offset: 2px; }
.hindsight-page .zoom-controls { padding-left: 0; border-left: 0; }
.hindsight-page .zoom-controls button { min-width: 40px; min-height: 40px; height: 40px; }
.hindsight-page #chart-scale { box-sizing: border-box; max-width: 100%; min-height: 36px; padding: 0 8px; border: 1px solid #475569; border-radius: 8px; background: #0b1220; color: #e5e7eb; font: 650 13px/1.2 var(--finwiz-tv-font); cursor: pointer; }
.hindsight-page #chart-scale:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.hindsight-page #line-width-input,
.hindsight-page #hl-size-input { width: 60px; min-height: 36px; padding: 0 6px; border: 1px solid #475569; border-radius: 8px; background: #0b1220; color: #e5e7eb; font-size: 13px; }
.hindsight-page .observation-reader { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 4px 12px; flex: 1 1 100%; min-width: 0; padding: 6px 8px; border: 1px solid #334155; border-radius: 9px; background: #0b1220; }
.hindsight-page .observation-reader h3 { margin: 0; color: #e2e8f0; font-size: 13px; font-weight: 750; }
.hindsight-page .observation-reader-controls { display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px auto; align-items: center; gap: 8px; }
.hindsight-page .observation-reader-controls button { min-width: 40px; min-height: 40px; border: 1px solid #475569; border-radius: 8px; background: #16253c; color: #e2e8f0; cursor: pointer; }
.hindsight-page .observation-reader-controls button:disabled { opacity: .45; cursor: default; }
.hindsight-page .observation-reader-controls button:focus-visible,
.hindsight-page .observation-reader-controls input:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.hindsight-page #observation-date-slider { width: 100%; min-width: 0; accent-color: #60a5fa; }
.hindsight-page #observation-date { min-width: 104px; color: #e2e8f0; font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
.hindsight-page .observation-values { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 5px; }
.hindsight-page .observation-value { min-width: 0; padding: 6px 8px; border: 1px solid #334155; border-radius: 7px; color: #cbd5e1; font-size: 12px; }
.hindsight-page .observation-value strong { display: block; color: #f8fafc; font-size: 14px; font-variant-numeric: tabular-nums; }
.hindsight-page .observation-value small { display: block; color: #94a3b8; }
.hindsight-page .top5-choice { grid-column: 1 / -1; padding: 2px 0 3px; }
.hindsight-page .top5-choice label { min-height: 36px; }
.hindsight-page .top5-explainer { margin: 5px 16px 0; padding: 7px 10px; border-left: 3px solid #60a5fa; background: #0b1220; color: #cbd5e1; font-size: 12px; }
.hindsight-page .results-title { margin: 6px 16px 4px; color: #cbd5e1; font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.hindsight-page .results-heading { display: flex; align-items: center; gap: 8px 12px; min-height: 44px; margin: 0 16px 3px; }
.hindsight-page .results-heading[hidden], .hindsight-page.is-bar-view .results-heading { display: none; }
.hindsight-page .results-heading .results-title { margin: 0; }
.hindsight-page .emphasis-hint { flex: 1; color: var(--hindsight-muted, #a8b8cc); font-size: 12px; line-height: 1.3; }
.hindsight-page #emphasis-reset { flex: 0 0 auto; min-height: 44px; padding: 0 10px; margin-left: auto; border: 1px solid var(--hindsight-border, #475569); border-radius: 7px; background: var(--hindsight-raised, #102038); color: var(--hindsight-text, #e2e8f0); font: 650 12px/1.2 var(--finwiz-tv-font); cursor: pointer; }
.hindsight-page #emphasis-reset:disabled { opacity: .55; cursor: default; }
.hindsight-page #emphasis-reset:focus-visible { outline: 2px solid var(--hindsight-focus, #93c5fd); outline-offset: 2px; }
.hindsight-page .wrapper #legend {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  align-items: stretch;
  width: auto;
  height: auto;
  min-height: 0;
  margin: 0 16px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  white-space: normal;
}
.hindsight-page .wrapper #legend:empty,
.hindsight-page.is-bar-view .results-title,
.hindsight-page.is-bar-view .wrapper #legend { display: none !important; }
.hindsight-page #legend .legend-item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  gap: 1px 7px;
  align-items: center;
  align-content: start;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid #334155;
  border-radius: 9px;
  background: #0b1220;
}
.hindsight-page #legend .legend-color { grid-row: 1 / 3; grid-column: 1; width: 11px; height: 11px; border-radius: 3px; }
.hindsight-page #legend .legend-focus-button { grid-row: 1 / 3; grid-column: 1 / -1; display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; grid-template-rows: auto auto; gap: 1px 7px; align-items: center; min-height: 44px; min-width: 0; width: 100%; padding: 0; border: 0; border-radius: 5px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.hindsight-page #legend .legend-focus-button:disabled { cursor: default; }
.hindsight-page #legend .legend-focus-button:focus-visible { outline: 2px solid var(--hindsight-focus, #93c5fd); outline-offset: 3px; }
.hindsight-page #legend .legend-focus-button:hover:not(:disabled) .legend-name { text-decoration: underline; text-underline-offset: 3px; }
html .hindsight-page #legend .legend-item.legend-item--emphasized { border-color: var(--hindsight-accent, #93c5fd); box-shadow: inset 0 0 0 1px var(--hindsight-accent, #93c5fd); }
.hindsight-page #legend .legend-identity { grid-row: 1; grid-column: 2; overflow: hidden; white-space: nowrap; }
.hindsight-page #legend .legend-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hindsight-page #legend .legend-return { grid-row: 1; grid-column: 3; font-size: 18px; }
.hindsight-page #legend .legend-coverage { grid-row: 2; grid-column: 2; color: #a8b8cc; font-size: 12px; white-space: nowrap; }
.hindsight-page #legend .legend-coverage--partial { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.hindsight-page #legend .legend-period-note { grid-row: 4; grid-column: 1 / -1; min-width: 0; color: var(--hindsight-muted, #a8b8cc); font-size: 12px; line-height: 1.25; }
.hindsight-page #legend .legend-cagr { grid-row: 3; grid-column: 2 / -1; min-width: 0; color: var(--hindsight-muted, #a8b8cc); font-size: 12px; line-height: 1.35; }
.hindsight-page #legend .legend-cagr > summary { display: flex; align-items: center; gap: 6px; min-height: 24px; width: fit-content; max-width: 100%; cursor: pointer; list-style: none; font-variant-numeric: tabular-nums; }
.hindsight-page #legend .legend-cagr[data-status="available"] > summary { color: var(--hindsight-accent, #93c5fd); font-weight: 650; }
.hindsight-page #legend .legend-cagr > summary::-webkit-details-marker { display: none; }
.hindsight-page #legend .legend-cagr > summary::after { content: '▾'; font-size: 11px; }
.hindsight-page #legend .legend-cagr[open] > summary::after { content: '▴'; }
.hindsight-page #legend .legend-cagr > summary:focus-visible { outline: 2px solid var(--hindsight-focus, #93c5fd); outline-offset: 2px; border-radius: 3px; }
.hindsight-page #legend .legend-cagr p { margin: 3px 0 6px; overflow-wrap: anywhere; }
.hindsight-page #legend .legend-cagr-period { font-variant-numeric: tabular-nums; }
.hindsight-page:lang(sv) #legend .legend-item:not(.legend-item--missing) .legend-coverage::before { content: 't.o.m. '; }
.hindsight-page:lang(en) #legend .legend-item:not(.legend-item--missing) .legend-coverage::before { content: 'through '; }
.hindsight-page:lang(sv) #legend .legend-item:not(.legend-item--missing) .legend-coverage--partial::before,
.hindsight-page:lang(en) #legend .legend-item:not(.legend-item--missing) .legend-coverage--partial::before { content: none; }
.hindsight-page #legend .legend-close { grid-row: 2; grid-column: 3; font-size: 12px; white-space: nowrap; }
.hindsight-page #legend .legend-item--missing .legend-return { color: #94a3b8; }
.hindsight-page .chart-notes { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 16px; min-height: 28px; margin: 5px 16px 2px; }
.hindsight-page .chart-caveat { margin: 0; color: #a8b8cc; font-size: 12px; line-height: 1.3; }
.hindsight-page .market-flag { position: relative; display: inline-flex; width: 1.066667em; height: .8em; vertical-align: -.1em; }
.hindsight-page .market-flag img { display: block; width: 100%; height: 100%; object-fit: contain; }
.hindsight-page .market-flag-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.hindsight-page .market-flag-image { pointer-events: none; }
.hindsight-page .chart-scale-note { color: var(--hindsight-muted, #a8b8cc); font-size: 12px; line-height: 1.3; }
.hindsight-page .zoom-context { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; color: #a8b8cc; font-size: 12px; line-height: 1.3; }
.hindsight-page .zoom-context[data-zoomed="true"] { color: #dbeafe; }
.hindsight-page .zoom-context button { min-height: 40px; padding: 5px 10px; border: 1px solid #60a5fa; border-radius: 7px; background: #16314f; color: #f8fafc; font: 700 12px/1.2 var(--finwiz-tv-font); cursor: pointer; }
.hindsight-page.is-bar-view .zoom-context { display: none; }
.hindsight-page .methodology-strip p { margin: 0 0 8px; }
.hindsight-page .methodology-strip p:last-child { margin-bottom: 0; }
.hindsight-page .dd-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 10px; margin-bottom: 8px; }
.hindsight-page .dd-heading-title { color: #e5e7eb; font-weight: 750; }
.hindsight-page .dd-heading-help { margin: 0; color: #94a3b8; font-size: 12px; line-height: 1.35; }
.hindsight-page .custom-range > summary:focus-visible,
.hindsight-page .appearance-group > summary:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
@media (max-width: 760px) {
	.hindsight-page .observation-reader { grid-template-columns: minmax(0, 1fr); gap: 6px; }
	.hindsight-page .observation-reader-controls { grid-template-columns: 40px minmax(0, 1fr) 40px; }
	.hindsight-page #observation-date { grid-column: 1 / -1; min-width: 0; text-align: center; }
	.hindsight-page .observation-values { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hindsight-page .controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 116px; padding: 4px 12px; gap: 2px 4px; }
  .hindsight-page .overview-header { gap: 4px; padding: 4px 12px; }
  /* The title and selected period carry the visible mobile context. */
  .hindsight-page .overview-eyebrow { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .hindsight-page .overview-context { font-size: 12px; }
  .hindsight-page .overview-data-status { padding: 4px 8px; gap: 6px; font-size: 12px; }
  /* Keep the healthy title accessible while the detail and green dot carry the compact row. */
  .hindsight-page .overview-data-status[data-state="current"] strong {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }
  .hindsight-page .preset-scroll { scrollbar-width: none; }
  .hindsight-page .preset-scroll::-webkit-scrollbar { display: none; }
  .hindsight-page .appearance-group > summary,
  .hindsight-page .analysis-group > summary { box-sizing: border-box; padding: 6px; gap: 4px; font-size: 13px; }
  .hindsight-page .controls .analysis-group > summary { padding-right: 26px; }
  .hindsight-page .zoom-context[data-zoomed="false"] { display: none; }
  .hindsight-page .control-primary { display: contents; }
  .hindsight-page .control-primary-main { display: contents; }
  .hindsight-page .preset-navigation { grid-column: 1 / -1; grid-row: 1; width: 100%; }
  .hindsight-page .preset-scroll { width: auto; padding: 2px 3px; scrollbar-color: #60a5fa #0b1220; }
  .hindsight-page .preset-scroll.can-scroll-left { mask-image: linear-gradient(to right, transparent, #000 12px, #000 100%); }
  .hindsight-page .preset-scroll.can-scroll-right { mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 12px), transparent); }
  .hindsight-page .preset-scroll.can-scroll-left.can-scroll-right { mask-image: linear-gradient(to right, transparent, #000 12px, #000 calc(100% - 12px), transparent); }
  .hindsight-page #sym-open { grid-column: 1 / 3; grid-row: 2; width: 100%; padding: 6px 8px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
  .hindsight-page .view-toolbar { grid-column: 3; grid-row: 2; }
  .hindsight-page .view-mode-options span { min-width: 44px; min-height: 36px; padding: 0 3px; }
  .hindsight-page .custom-range { grid-column: 1; grid-row: 3; }
  .hindsight-page .appearance-group { grid-column: 2; grid-row: 3; }
  .hindsight-page .analysis-group { grid-column: 3; grid-row: 3; }
  /* Open panels follow the compact summaries, so all other controls remain reachable. */
  .hindsight-page .custom-range[open] { grid-column: 1 / -1; grid-row: 4; }
  .hindsight-page .appearance-group[open] { grid-column: 1 / -1; grid-row: 5; }
  .hindsight-page .analysis-group[open] { grid-column: 1 / -1; grid-row: 6; }
  .hindsight-page .controls:has(> :is(.appearance-group, .analysis-group)[open]) > .appearance-group:not([open]) { grid-column: 2; }
  .hindsight-page .controls:has(> :is(.appearance-group, .analysis-group)[open]) > .analysis-group:not([open]) { grid-column: 3; }
  .hindsight-page .top5-choice { grid-column: 1 / -1; grid-row: 7; }
  .hindsight-page .control-label-full,
  .hindsight-page .custom-range-description { display: none; }
  .hindsight-page .control-label-compact,
  .hindsight-page .custom-range-compact { display: inline; }
  .hindsight-page .custom-range > summary { padding: 6px; font-size: 13px; line-height: 1.2; white-space: normal; }
  .hindsight-page .controls :is(.custom-range, .appearance-group, .analysis-group) > summary { display: flex; align-items: center; gap: 4px; list-style: none; }
  .hindsight-page .controls :is(.custom-range, .appearance-group, .analysis-group) > summary::-webkit-details-marker { display: none; }
  .hindsight-page .controls :is(.custom-range, .appearance-group, .analysis-group) > summary::before { content: '▸'; flex: 0 0 auto; }
  .hindsight-page .controls :is(.custom-range, .appearance-group, .analysis-group)[open] > summary::before { content: '▾'; }
  .hindsight-page .btn-preset,
  .hindsight-page #sym-open { min-height: 44px; }
  .hindsight-page .custom-range > summary,
  .hindsight-page .appearance-group > summary,
  .hindsight-page .analysis-group > summary { min-height: 44px; }
  .hindsight-page .view-mode-caption { display: none; }
  .hindsight-page .view-toolbar { justify-content: flex-end; }
  .hindsight-page .zoom-controls { gap: 3px; padding-left: 0; }
  .hindsight-page .zoom-controls button { min-width: 44px; min-height: 44px; height: 44px; padding: 0 5px; }
  .hindsight-page #line-width-input,
  .hindsight-page #hl-size-input,
  .hindsight-page #chart-scale { min-height: 44px; }
  .hindsight-page .appearance-options > .control-label,
  .hindsight-page .analysis-options > .control-label { min-height: 44px; }
  .hindsight-page .observation-reader-controls { grid-template-columns: 44px minmax(0, 1fr) 44px; }
  .hindsight-page .observation-reader-controls button { min-width: 44px; min-height: 44px; }
  .hindsight-page .date-wrap input[type="date"] { width: 100%; height: 44px; line-height: 44px; }
  .hindsight-page .date-wrap .date-btn { width: 44px; height: 44px; }
  .hindsight-page .wrapper #legend { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin: 0 12px; }
  .hindsight-page #legend .legend-item { display: flex; flex-direction: column; align-items: stretch; gap: 1px; min-height: 64px; box-sizing: border-box; padding: 5px 6px; position: relative; }
  .hindsight-page #legend .legend-focus-button { display: flex; flex-direction: column; align-items: stretch; gap: 1px; }
  .hindsight-page #legend .legend-color { position: absolute; top: 7px; left: 6px; width: 9px; height: 9px; }
  .hindsight-page #legend .legend-identity { display: flex; min-width: 0; padding-left: 12px; gap: 3px; }
  .hindsight-page #legend .legend-symbol { font-size: 13px; }
  .hindsight-page #legend .legend-name { font-size: 12px; }
  .hindsight-page #legend .legend-return { font-size: 16px; line-height: 1.1; }
  .hindsight-page #legend .legend-coverage { font-size: 12px; }
  .hindsight-page #legend .legend-coverage::before { display: none; }
  .hindsight-page #legend .legend-close { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .hindsight-page #legend .legend-cagr > summary { width: 100%; min-height: 44px; }
  .hindsight-page .results-title { margin: 4px 12px 3px; }
  .hindsight-page .results-heading { margin: 1px 12px 3px; gap: 8px; }
  .hindsight-page .results-heading .results-title { margin: 0; min-width: 0; }
  .hindsight-page .emphasis-hint { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .hindsight-page .chart-notes { margin: 4px 12px 2px; }
  .hindsight-page .zoom-context button { min-height: 44px; }
  .hindsight-page .top5-explainer { margin: 4px 12px 0; }
}

@media (max-width: 640px) {
  .hindsight-page .wrapper #legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hindsight-page #legend .legend-item { min-height: 58px; padding: 3px 6px; }
  .hindsight-page #legend .legend-item:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .hindsight-page #legend .legend-identity,
  .hindsight-page #legend .legend-coverage { line-height: 1.2; }
  .hindsight-page #legend .legend-symbol { font-size: 13px; }
  .hindsight-page #legend .legend-name { font-size: 12px; }
  .hindsight-page #legend .legend-return { font-size: 17px; }
  .hindsight-page #legend .legend-coverage { font-size: 12px; }
}

/* Primary comparison controls stay visible. Secondary settings retain their
   existing disclosure panels; all heights can grow for long/localized text. */
.hindsight-page .comparison-toolbar { grid-column:1 / -1; display:flex; align-items:center; flex-wrap:wrap; gap:5px 16px; }
.hindsight-page .comparison-toolbar .control-label { display:flex; align-items:center; gap:7px; }
.hindsight-page .comparison-toolbar select { max-width:100%; min-height:44px; box-sizing:border-box; padding:0 9px; border:1px solid var(--hindsight-border); border-radius:7px; background:var(--hindsight-raised); color:var(--hindsight-text); font:650 14px var(--finwiz-tv-font); }
.hindsight-page .comparison-toolbar select:focus-visible { outline:3px solid var(--hindsight-focus); outline-offset:2px; }
.hindsight-page .comparison-toolbar select:disabled { opacity:.65; }
.hindsight-page .comparison-help { color:var(--hindsight-muted); font-size:13px; }
.hindsight-page .comparison-context { margin:4px 16px 0; color:var(--hindsight-muted); font-size:13px; line-height:1.35; }
.hindsight-page .comparison-context--warning { color:var(--hindsight-accent); }
.hindsight-page .comparison-recover { min-height:44px; margin:8px 16px; padding:0 12px; border:1px solid var(--hindsight-accent); border-radius:8px; color:var(--hindsight-text); background:var(--hindsight-raised); font:650 14px var(--finwiz-tv-font); cursor:pointer; }
.hindsight-page #legend .legend-period-note { display:none; } /* Dates + shared visible warning carry this information. */
.hindsight-page #legend .legend-item { padding:5px 10px; }
.hindsight-page .results-heading { margin-bottom:0; min-height:30px; }
.hindsight-page #emphasis-reset { min-height:44px; }
.hindsight-page .chart-notes { margin-top:2px; gap:2px 12px; min-height:0; }
.hindsight-page .cycle-events { margin-top:2px; margin-bottom:0; }
.hindsight-page .cycle-event-header { min-height:44px; }
.hindsight-page .cycle-timeline { margin-top:0; }
.hindsight-page .controls { row-gap:4px; }
.hindsight-page .cycle-key { font-size:12px; }
@media (min-width: 1100px) {
  .hindsight-page .controls { grid-template-columns:minmax(0,1fr) auto auto; }
  .hindsight-page .comparison-toolbar { grid-column:1; }
  .hindsight-page .appearance-group { grid-column:2; min-width:175px; }
  .hindsight-page .analysis-group { grid-column:3; min-width:175px; }
  .hindsight-page .appearance-group[open], .hindsight-page .analysis-group[open] { grid-column:1 / -1; }
  .hindsight-page .analysis-hint { display:none; }
}
@media (max-width:760px) {
  .hindsight-page .comparison-toolbar { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:5px 8px; }
  .hindsight-page .comparison-toolbar .control-label { display:flex; flex-direction:column; align-items:stretch; gap:3px; }
  .hindsight-page .comparison-help { grid-column:1 / -1; }
  .hindsight-page .comparison-toolbar select { width:100%; min-width:0; }
  .hindsight-page .wrapper #legend { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .hindsight-page #legend .legend-item:last-child:nth-child(odd) { grid-column:auto; }
  .hindsight-page #legend .legend-coverage { white-space:normal; overflow-wrap:anywhere; }
  .hindsight-page #legend .legend-close { position:static; width:auto; height:auto; overflow:visible; clip-path:none; white-space:normal; color:var(--hindsight-muted); }
  .hindsight-page .comparison-context { margin-left:12px; margin-right:12px; }
  .hindsight-page .chart-scale-note { width:100%; }
}

/* Presentation-only broadcast overrides; retain warning and control semantics. */
.hindsight-page.mode-broadcast .overview-header { flex-wrap: wrap; gap: 6px 18px; }
.hindsight-page.mode-broadcast .overview-heading-wrap { flex: 1 1 45%; }
.hindsight-page.mode-broadcast .overview-data-status {
  margin-left: auto;
  max-width: 46%;
  flex-wrap: wrap;
  justify-content: flex-end;
  border-radius: 8px;
  font-size: clamp(14px, .9vw, 18px);
}
.hindsight-page.mode-broadcast .overview-data-status strong { white-space: normal; }
.hindsight-page.mode-broadcast .overview-data-status[data-presentation-state="current"] {
  padding: 0;
  border: 0;
  background: transparent;
}
.hindsight-page.mode-broadcast .overview-data-status[data-presentation-state="current"]::before { display: none; }
.hindsight-page.mode-broadcast .overview-header::after { display: none; }
.hindsight-page.mode-broadcast .emphasis-hint,
.hindsight-page.mode-broadcast .zoom-context[data-zoomed="false"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.hindsight-page.mode-broadcast #emphasis-reset:disabled { display: none; }
.hindsight-page.mode-broadcast .results-heading { min-height: 28px; }
.hindsight-page.mode-broadcast .chart-notes,
.hindsight-page.mode-broadcast .cycle-events { flex-shrink: 0; }
@media (hover: hover) and (pointer: fine) {
  .hindsight-page.mode-broadcast:not(.broadcast-controls-open) .cycle-events:not(:hover):not(:focus-within) .cycle-periods-toggle {
    opacity: 0;
    pointer-events: none;
  }
}
@media (min-width: 761px) {
  .hindsight-page.mode-broadcast .results-title { font-size: clamp(14px, .85vw, 17px); }
  .hindsight-page.mode-broadcast #legend .legend-item { padding: 8px 12px; }
  .hindsight-page.mode-broadcast #legend .legend-identity {
    overflow: visible;
    white-space: normal;
    flex-wrap: wrap;
  }
  .hindsight-page.mode-broadcast #legend .legend-symbol,
  .hindsight-page.mode-broadcast #legend .legend-name {
    font-size: clamp(15px, 1vw, 20px);
    line-height: 1.2;
  }
  .hindsight-page.mode-broadcast #legend .legend-name {
    overflow: visible;
    overflow-wrap: anywhere;
    white-space: normal;
  }
  .hindsight-page.mode-broadcast #legend .legend-return { font-size: clamp(22px, 1.65vw, 32px); }
  .hindsight-page.mode-broadcast #legend .legend-coverage,
  .hindsight-page.mode-broadcast #legend .legend-cagr,
  .hindsight-page.mode-broadcast #legend .legend-close { font-size: clamp(14px, .85vw, 17px); }
  .hindsight-page.mode-broadcast .comparison-context,
  .hindsight-page.mode-broadcast .chart-caveat,
  .hindsight-page.mode-broadcast .zoom-context { font-size: clamp(14px, .95vw, 19px); line-height: 1.3; }
  /* Ordinary per-series differences and the simple currency note are included
     in the heading; exceptional warnings and detailed source notes stay here. */
  .hindsight-page.mode-broadcast #comparison-context[data-broadcast-compact="true"],
  .hindsight-page.mode-broadcast #chart-caveat[data-broadcast-compact="true"] { display: none; }
  .hindsight-page.mode-broadcast .chart-notes:has(#chart-caveat[data-broadcast-compact="true"]) { margin-top: 0; margin-bottom: 0; }
  .hindsight-page.mode-broadcast .comparison-context--warning {
    box-sizing: border-box;
    padding: 5px 10px;
    border-left: 3px solid var(--hindsight-accent);
    border-radius: 3px 6px 6px 3px;
    background: var(--hindsight-raised);
    font-weight: 700;
  }
  .hindsight-page.mode-broadcast .chart-notes { margin-top: 5px; margin-bottom: 4px; }
  .hindsight-page.mode-broadcast .dd-heading-title { font-size: clamp(16px, 1vw, 20px); }
  .hindsight-page.mode-broadcast .dd-heading-help,
  .hindsight-page.mode-broadcast #dd-panel table { font-size: clamp(14px, .85vw, 17px); line-height: 1.3; }
}
@media (max-width: 760px) {
  .hindsight-page #hindsight-broadcast-button { display: none; }
  .hindsight-page.mode-broadcast .overview-heading-wrap { flex-basis: 100%; }
  .hindsight-page.mode-broadcast .overview-data-status { max-width: 100%; margin-left: 0; justify-content: flex-start; }
  .hindsight-page.mode-broadcast .overview-data-status[data-presentation-state="current"] strong {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    clip: auto;
    clip-path: none;
    white-space: normal;
  }
}

/* Mobile is a compact overview; the desktop controls retain their original DOM. */
.hindsight-page .mobile-chart-info,
.hindsight-page .legend-mobile-details { display: none; }
@media (max-width: 760px) {
  .hindsight-page .preset-navigation { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 70px; gap: 6px; }
  .hindsight-page .preset-navigation::after { content: '▾'; position: absolute; top: 50%; right: 8px; transform: translateY(-50%); color: var(--hindsight-text); font-size: 12px; pointer-events: none; }
  .hindsight-page .preset-nav { display: none !important; }
  .hindsight-page .preset-scroll { min-width: 0; overflow: visible; padding: 0; mask-image: none !important; }
  .hindsight-page #range-presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; width: 100%; }
  .hindsight-page #range-presets .btn-preset:not(.mobile-preset) { display: none; }
  .hindsight-page #range-presets .btn-preset { min-width: 0; width: 100%; min-height: 44px; padding: 3px; white-space: normal; font-size: 12px; line-height: 1.15; }
  .hindsight-page #mobile-range-more { appearance: none; -webkit-appearance: none; display: block; box-sizing: border-box; min-width: 0; width: 100%; height: 44px; min-height: 44px; padding: 0 22px 0 7px; border: 1px solid var(--hindsight-border); border-radius: 7px; background: var(--hindsight-raised); color: var(--hindsight-text); font: 650 16px var(--finwiz-tv-font); }
  .hindsight-page .mobile-settings { grid-column: 1 / -1; grid-row: 3; min-width: 0; border: 1px solid var(--hindsight-border); border-radius: 8px; background: var(--hindsight-surface); }
  .hindsight-page .mobile-settings > summary,
  .hindsight-page .mobile-chart-info > summary { display: flex; align-items: center; gap: 6px; min-height: 44px; box-sizing: border-box; padding: 0 10px; color: var(--hindsight-muted); font-size: 13px; font-weight: 650; cursor: pointer; list-style: none; }
  .hindsight-page :is(.mobile-settings, .mobile-chart-info) > summary::-webkit-details-marker { display: none; }
  .hindsight-page :is(.mobile-settings, .mobile-chart-info) > summary::before { content: '▸'; }
  .hindsight-page :is(.mobile-settings, .mobile-chart-info)[open] > summary::before { content: '▾'; }
  .hindsight-page .mobile-settings-body { display: grid; gap: 8px; padding: 0 8px 8px; }
  .hindsight-page .mobile-settings-body > :is(.custom-range, .comparison-toolbar, .appearance-group, .analysis-group) { grid-column: auto; grid-row: auto; width: auto; min-width: 0; margin: 0; }
  .hindsight-page .mobile-settings-body .comparison-help { display: none; }
  .hindsight-page .mobile-settings-body select,
  .hindsight-page .mobile-settings-body input[type='date'] { font-size: 16px; }
  .hindsight-page .top5-choice { grid-row: auto; }
  .hindsight-page #emphasis-reset:disabled { display: none; }
  .hindsight-page .results-heading { min-height: 24px; }
  .hindsight-page .wrapper #legend { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .hindsight-page #legend .legend-item { position: relative; display: block; min-height: 0; padding: 0 6px; }
  .hindsight-page #legend .legend-focus-button { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; grid-template-rows: auto; align-content: center; gap: 2px 5px; width: calc(100% - 44px); min-height: 44px; }
  .hindsight-page #legend .legend-color { position: static; grid-row: 1; grid-column: 1; }
  .hindsight-page #legend .legend-identity { grid-row: 1; grid-column: 2; padding-left: 0; font-size: 13px; white-space: normal; }
  .hindsight-page #legend .legend-symbol { display: none; }
  .hindsight-page #legend .legend-name { font-size: 13px; white-space: normal; overflow-wrap: anywhere; }
  .hindsight-page #legend .legend-return { grid-row: 1; grid-column: 3; font-size: 17px; white-space: nowrap; }
  .hindsight-page #legend .legend-focus-button .legend-close,
  .hindsight-page #legend .legend-item:not(.legend-item--missing) .legend-focus-button .legend-coverage,
  .hindsight-page #legend .legend-cagr { display: none; }
  .hindsight-page #legend .legend-item--missing .legend-coverage { grid-row: 3; grid-column: 1 / -1; }
  .hindsight-page #legend .legend-period-note { display: block; padding-bottom: 5px; }
  .hindsight-page .legend-mobile-details { display: block; min-width: 0; color: var(--hindsight-muted); font-size: 12px; }
  .hindsight-page .legend-mobile-details > summary { position: absolute; top: 0; right: 4px; box-sizing: border-box; width: 44px; height: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; cursor: pointer; list-style: none; font-size: 0; }
  .hindsight-page .legend-mobile-details > summary::-webkit-details-marker { display: none; }
  .hindsight-page .legend-mobile-details > summary::after { content: '▾'; font-size: 14px; }
  .hindsight-page .legend-mobile-details[open] > summary::after { content: '▴'; }
  .hindsight-page .legend-mobile-details[open] { border-top: 1px solid var(--hindsight-border); padding: 8px 2px 2px; }
  .hindsight-page .legend-mobile-details p,
  .hindsight-page .mobile-chart-info p { margin: 0 0 7px; font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
  .hindsight-page .mobile-chart-info { display: block; width: 100%; color: var(--hindsight-muted); }
  .hindsight-page .mobile-chart-info > summary { padding-left: 0; }
  .hindsight-page .chart-caveat,
  .hindsight-page .comparison-context:not(.comparison-context--warning) { display: none; }
  .hindsight-page #mobile-range-more:focus-visible,
  .hindsight-page :is(.mobile-settings, .mobile-chart-info, .legend-mobile-details) > summary:focus-visible { outline: 3px solid var(--hindsight-focus); outline-offset: 2px; border-radius: 5px; }
}
/* Page palettes. Series identity and financial gain/loss colors remain independent.
   LP colors and gradients match filings13f.html's body[data-theme="lp"] palette. */
:root {
  color-scheme: dark;
  --hindsight-gold-100: #f0dcaa;
  --hindsight-gold-200: #e2c891;
  --hindsight-gold-300: #c6a75e;
  --hindsight-gold-400: #a58549;
  --hindsight-bg: #04101d;
  --hindsight-surface: #0a1828;
  --hindsight-raised: #10263a;
  --hindsight-hover: #1a3651;
  --hindsight-border: rgba(112, 164, 224, .26);
  --hindsight-text: #eef6ff;
  --hindsight-muted: #c8dcf2;
  --hindsight-accent: var(--hindsight-gold-100);
  --hindsight-focus: #8fd1ff;
  --hindsight-selected-bg: #202c35;
  --hindsight-primary-bg: #ffd15c;
  --hindsight-primary-text: #17263a;
  --hindsight-header: radial-gradient(circle at 0% 0%, rgba(92, 169, 255, .16), transparent 32%), linear-gradient(135deg, rgba(13, 35, 58, .92), rgba(7, 18, 31, .98));
}
:root[data-hindsight-theme="dark"] {
  --hindsight-bg: #000;
  --hindsight-surface: #0b1220;
  --hindsight-raised: #102038;
  --hindsight-hover: #1e3a5f;
  --hindsight-border: #475569;
  --hindsight-text: #e2e8f0;
  --hindsight-muted: #a8b8cc;
  --hindsight-accent: #93c5fd;
  --hindsight-focus: #93c5fd;
  --hindsight-selected-bg: #1e314c;
  --hindsight-header: #020914;
}
:root[data-hindsight-theme="light"] {
  color-scheme: light;
  --hindsight-bg: #f3f6fa;
  --hindsight-surface: #fff;
  --hindsight-raised: #eaf0f7;
  --hindsight-hover: #dce7f3;
  --hindsight-border: #a9bace;
  --hindsight-text: #172c43;
  --hindsight-muted: #4b6077;
  --hindsight-accent: #835b00;
  --hindsight-focus: #1260a2;
  --hindsight-selected-bg: #fff2c7;
  --hindsight-header: linear-gradient(110deg, #fff, #e7eef8);
}
html { background: var(--hindsight-bg); }
.hindsight-page { flex: 0 0 auto; background: var(--hindsight-bg); color: var(--hindsight-text); }
.hindsight-page:not(.mode-broadcast) { height: auto; min-height: 100svh; }
.hindsight-page > :is(.overview-header, .controls, .rate-context-strip, .methodology-strip, .top5-explainer) { flex: 0 0 auto; }
.hindsight-page .hindsight-credit {
  display: flex;
  justify-content: center;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 6px;
  box-sizing: border-box;
  color: var(--hindsight-muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}
.hindsight-page .hindsight-credit strong { color: var(--hindsight-text); font-weight: 600; }
.hindsight-page.mode-broadcast .hindsight-credit { margin: 0; font-size: 11px; }
/* Normal footer stays in document flow after the complete analysis content. */
.hindsight-page:not(.mode-broadcast) .hindsight-credit {
  position: static;
  inset: auto;
  flex: 0 0 auto;
  padding: 12px 16px;
  margin: 8px 16px 0;
  border-top: 1px solid var(--hindsight-border);
  z-index: auto;
}

.hindsight-page .hindsight-toolbar {
  flex: 0 0 auto;
  box-sizing: border-box;
  min-height: 72px;
  margin: 12px 16px 0;
  padding: 10px 14px;
  border: 1px solid var(--hindsight-border);
  border-radius: 14px;
  background: var(--hindsight-header);
}
.hindsight-page .hindsight-toolbar .hindsight-home {
  justify-content: flex-start;
  gap: 10px;
  min-width: 0;
  min-height: 44px;
  padding: 0;
  color: var(--hindsight-text);
  font-size: 18px;
}
.hindsight-page .hindsight-home img { flex: 0 0 40px; width: 40px; height: 40px; object-fit: contain; }
.hindsight-page .hindsight-home span { margin: 0; color: inherit; }
.hindsight-page .hindsight-home:hover { background: transparent; color: var(--hindsight-accent); }
.hindsight-page .hindsight-toolbar-actions { flex-wrap: wrap; justify-content: flex-end; }
.hindsight-header-menu { position: relative; }
.hindsight-header-menu > summary { display: none; }
.hindsight-page.mode-broadcast .wrapper { overflow-x: hidden; overflow-y: auto; width: 100%; }
.hindsight-page.mode-broadcast .wrapper:focus-visible { outline: 2px solid var(--hindsight-focus); outline-offset: -2px; }
.hindsight-theme-control { position: relative; display: inline-flex; align-items: center; color: var(--hindsight-muted); }
.hindsight-theme-control > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.hindsight-theme-control::before {
  content: '';
  position: absolute;
  z-index: 1;
  left: 10px;
  width: 24px;
  height: 16px;
  box-sizing: border-box;
  border: 1px solid color-mix(in srgb, var(--hindsight-text) 24%, transparent);
  border-radius: 3px;
  background: linear-gradient(135deg, #04101d 0 58%, #c6a75e 58% 76%, #a8a8a8 76%);
  pointer-events: none;
}
[data-hindsight-theme="dark"] .hindsight-theme-control::before { background: linear-gradient(135deg, #080d13 0 58%, #f7f9fb 58% 76%, #55a7ff 76%); }
[data-hindsight-theme="light"] .hindsight-theme-control::before { background: linear-gradient(135deg, #f4f7fa 0 58%, #18232d 58% 76%, #2879bd 76%); }
.hindsight-page .hindsight-toolbar a:not(.hindsight-home),
.hindsight-page .hindsight-toolbar button,
.hindsight-theme-control select {
  box-sizing: border-box;
  min-height: 44px;
  border: 1px solid var(--hindsight-border);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--hindsight-raised);
  color: var(--hindsight-text);
  font: 650 14px/1.2 var(--finwiz-tv-font);
  cursor: pointer;
}
.hindsight-theme-control select { min-width: 200px; padding-left: 44px; padding-right: 24px; font-size: 12px; font-weight: 750; }
.hindsight-page .hindsight-toolbar #hindsight-language-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-end;
  flex: 0 0 auto;
  width: 44px;
  padding: 0;
}
#hindsight-language-flag { display: block; width: 24px; height: 18px; object-fit: contain; }
.hindsight-page .hindsight-toolbar a:not(.hindsight-home):hover,
.hindsight-page .hindsight-toolbar button:hover,
.hindsight-theme-control select:hover { background: var(--hindsight-hover); }
.hindsight-page .hindsight-toolbar :is(button, a:not(.hindsight-home), select):focus-visible { outline: 2px solid var(--hindsight-focus); outline-offset: 2px; }

/* LP and light share surface rules; their palette variables provide the colors. */
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page .overview-header,
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page .controls {
  background: var(--hindsight-bg);
  border-bottom-color: var(--hindsight-border);
}
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page :is(.overview-eyebrow, .results-title, .rate-context-title, .dd-heading-title) { color: var(--hindsight-accent); }
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page :is(.overview-context, .overview-data-status span, .analysis-hint, .view-mode-caption, .chart-caveat, .zoom-context, .dd-heading-help, .methodology-strip, .rate-context-change, .legend-coverage, .legend-close, .observation-value small, .zoom-state) { color: var(--hindsight-muted); }
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page :is(.overview-data-status, .appearance-group, .analysis-group, .custom-range, .view-mode-options, .observation-reader, .methodology-strip, .rate-context-strip, .top5-explainer),
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page #legend .legend-item {
  background: var(--hindsight-surface);
  border-color: var(--hindsight-border);
}
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page :is(.btn-preset, #sym-open, .date-wrap input[type="date"], #line-width-input, #hl-size-input, #chart-scale, .zoom-controls button, .observation-reader-controls button, .zoom-context button) {
  background: var(--hindsight-raised);
  border-color: var(--hindsight-border);
  color: var(--hindsight-text);
}
.hindsight-page #chart-scale:hover:not(:disabled) { background: var(--hindsight-hover); }
.hindsight-page #chart-scale:focus-visible { outline-color: var(--hindsight-focus); }
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page :is(.btn-preset, #sym-open, .zoom-controls button, .observation-reader-controls button):hover:not(:disabled) { background: var(--hindsight-hover); }
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page #range-presets .btn-preset--active {
  background: var(--hindsight-raised) !important;
  border-color: var(--hindsight-accent) !important;
  color: var(--hindsight-accent);
  box-shadow: inset 0 -3px var(--hindsight-accent);
}
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page .custom-range.is-custom,
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page .zoom-context button { border-color: var(--hindsight-accent); }
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page .view-mode-control input:not(:checked) + .view-mode-options span:first-child,
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page .view-mode-control input:checked + .view-mode-options span:last-child {
  background: var(--hindsight-hover);
  color: var(--hindsight-accent);
}
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page :is(.date-controls, .appearance-options, .analysis-options, .observation-value, .rate-context-item) { border-color: var(--hindsight-border); }
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page .rate-context-item { background: var(--hindsight-raised); }
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page .top5-explainer { border-left-color: var(--hindsight-accent); }
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page :is(input[type="checkbox"], input[type="range"]) { accent-color: var(--hindsight-accent); }
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page :is(.preset-scroll) { scrollbar-color: var(--hindsight-focus) var(--hindsight-surface); }
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page #market-overview :is(.x-axis, .y-axis) text { fill: var(--hindsight-text); }
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page #market-overview :is(.x-axis, .y-axis) :is(.domain, .tick line) { stroke: #7e99b3; }
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page #market-overview .grid line { stroke: #7e99b3; opacity: .28; }

/* Modal and overlays are part of the same palette; error and drawdown colors stay semantic. */
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page #sym-modal :is(.fw-modal, .fw-modal-footer, .sym-selected-chips, .group-section, .option-row),
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page #tooltip {
  background: var(--hindsight-surface);
  border-color: var(--hindsight-border);
  color: var(--hindsight-text);
}
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page #sym-modal :is(.group-header, .sym-chip, .sym-preset, .btn, .fw-modal-toolbar input) { background: var(--hindsight-raised); border-color: var(--hindsight-border); color: var(--hindsight-text); }
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page #sym-modal .btn-primary { border-color: var(--hindsight-accent); color: var(--hindsight-accent); box-shadow: none; }
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page #sym-modal :is(.sym-limit-hint, .sym-filter-result, .group-count, .option-row .label) { color: var(--hindsight-muted); }
.hindsight-page #dd-panel { background: var(--hindsight-surface); border-color: var(--hindsight-border); }
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page.mode-broadcast { background: var(--hindsight-bg); }
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page.mode-broadcast .hindsight-broadcast-drawer { background: var(--hindsight-bg); border-bottom-color: var(--hindsight-accent); }
:is([data-hindsight-theme="lp"], [data-hindsight-theme="light"]) .hindsight-page.mode-broadcast .overview-header::after { color: var(--hindsight-accent); border-color: var(--hindsight-border); background: var(--hindsight-raised); }

/* Shared dialog states retain the LP gold treatment in every palette. */
.hindsight-page #sym-modal .option-row.is-selected {
  background: var(--hindsight-selected-bg);
  border-color: var(--hindsight-accent);
}
:is([data-hindsight-theme="lp"], [data-hindsight-theme="dark"], [data-hindsight-theme="light"]) .hindsight-page #sym-modal .sym-preset.is-active {
  background: var(--hindsight-selected-bg);
  border-color: var(--hindsight-accent);
  color: var(--hindsight-text);
}
.hindsight-page #sym-modal #sym-apply {
  font-weight: 700;
  background: var(--hindsight-primary-bg);
  color: var(--hindsight-primary-text);
  border-color: var(--hindsight-primary-bg);
  box-shadow: none;
}
.hindsight-page #sym-modal #sym-apply:hover:not(:disabled) { filter: brightness(.95); }
.hindsight-page #sym-modal :is(.option-name, .fw-modal-title, #sym-count) { color: var(--hindsight-text); }
.hindsight-page #sym-modal :is(.option-meta, .sym-search, .sym-chip-remove, .sym-selected-empty) { color: var(--hindsight-muted); }
.hindsight-page #sym-modal #sym-limit-hint { color: var(--hindsight-muted); }
.hindsight-page #sym-modal :is(.fw-modal-header, .fw-modal-footer, .fw-modal-close) { border-color: var(--hindsight-border); }
.hindsight-page #sym-modal .fw-modal-close { color: var(--hindsight-text); }
.hindsight-page #sym-modal .group-action { color: var(--hindsight-focus); }
.hindsight-page #sym-modal :is(.sym-chip, .sym-preset, .btn):hover:not(:disabled) { background: var(--hindsight-hover); }
.hindsight-page #sym-modal input::placeholder { color: var(--hindsight-muted); opacity: 1; }

/* The LP treatment is scoped so Light and Dark retain their own palettes. */
[data-hindsight-theme="lp"] .hindsight-page {
  background: radial-gradient(circle at 16% 0%, rgba(92, 169, 255, .13), transparent 34%), linear-gradient(225deg, rgba(240, 220, 170, .08), transparent 30%), var(--hindsight-bg);
}
[data-hindsight-theme="lp"] .hindsight-page :is(.overview-header, .controls) { background: transparent; }
[data-hindsight-theme="lp"] .hindsight-page .hindsight-toolbar {
  border-color: rgba(112, 164, 224, .18);
  box-shadow: 0 16px 38px rgba(0, 8, 22, .36), 0 1px 0 rgba(255, 255, 255, .05) inset;
}
[data-hindsight-theme="lp"] .hindsight-page .overview-title,
[data-hindsight-theme="lp"] .hindsight-page #sym-modal #sym-modal-title {
  width: fit-content;
  background: linear-gradient(180deg, var(--hindsight-gold-100) 0%, var(--hindsight-gold-200) 42%, var(--hindsight-gold-300) 72%, var(--hindsight-gold-400) 100%);
  color: var(--hindsight-gold-100);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 10px 28px rgba(198, 167, 94, .18);
}
[data-hindsight-theme="lp"] .hindsight-page :is(.appearance-group, .analysis-group, .methodology-strip, .rate-context-strip, .top5-explainer, #dd-panel),
[data-hindsight-theme="lp"] .hindsight-page #sym-modal .fw-modal {
  background: radial-gradient(circle at top right, rgba(92, 169, 255, .12), transparent 34%), linear-gradient(180deg, rgba(13, 35, 58, .88), rgba(7, 18, 31, .98));
  border-color: rgba(112, 164, 224, .18);
  box-shadow: 0 18px 44px rgba(0, 8, 22, .34), 0 1px 0 rgba(255, 255, 255, .04) inset;
}
[data-hindsight-theme="lp"] .hindsight-page #legend .legend-item,
[data-hindsight-theme="lp"] .hindsight-page #sym-modal :is(.option-row, .sym-selected-chips) {
  background: linear-gradient(180deg, rgba(255, 255, 255, .040), rgba(255, 255, 255, .018)), rgba(7, 18, 31, .28);
  border-color: rgba(112, 164, 224, .18);
}
[data-hindsight-theme="lp"] .hindsight-page #sym-modal .option-row.is-selected,
[data-hindsight-theme="lp"] .hindsight-page #sym-modal .sym-preset.is-active,
[data-hindsight-theme="lp"] .hindsight-page #range-presets .btn-preset--active {
  background: radial-gradient(circle at 0% 0%, rgba(240, 220, 170, .10), transparent 48%), linear-gradient(180deg, rgba(255, 255, 255, .050), rgba(255, 255, 255, .020)), rgba(7, 18, 31, .38) !important;
  border-color: rgba(240, 220, 170, .34) !important;
  color: #fff7db;
}
[data-hindsight-theme="lp"] .hindsight-page #sym-modal #sym-apply {
  background: rgba(124, 196, 255, .12);
  border-color: rgba(143, 209, 255, .34);
  color: #dff2ff;
}
[data-hindsight-theme="lp"] .hindsight-page #sym-modal #sym-apply:hover:not(:disabled) {
  background: rgba(240, 220, 170, .10);
  border-color: rgba(240, 220, 170, .34);
  color: #fff7db;
  filter: none;
}
[data-hindsight-theme="lp"] .hindsight-page.mode-broadcast #dd-panel {
  background: radial-gradient(circle at top right, rgba(92, 169, 255, .12), transparent 34%), linear-gradient(180deg, rgba(13, 35, 58, .88), rgba(7, 18, 31, .98)) !important;
}
[data-hindsight-theme="lp"] .hindsight-page.mode-broadcast .hindsight-credit { background: var(--hindsight-bg); }

/* Light mode also covers legacy hard-coded text and SVG presentation attributes.
   Curve identity, colored endpoint badges, and gain/loss bar gradients stay intact. */
[data-hindsight-theme="light"] .hindsight-page :is(.overview-title, .overview-data-status strong, .control-label, .custom-range > summary, .appearance-group > summary, .analysis-group > summary, .methodology-strip > summary, .rate-context-name, .rate-context-value, .observation-reader h3, #observation-date, .observation-value, .observation-value strong, .top5-explainer, #legend .legend-symbol, #legend .legend-name, #legend .legend-return, .view-mode-options span) { color: var(--hindsight-text); }
[data-hindsight-theme="light"] .hindsight-page :is(.zoom-controls, .date-controls, .appearance-options, .analysis-options) { border-color: var(--hindsight-border); }
[data-hindsight-theme="light"] .hindsight-page :is(button, input, summary, a):focus-visible,
[data-hindsight-theme="light"] .hindsight-page .view-mode-control input:focus-visible + .view-mode-options { outline-color: var(--hindsight-focus); }
[data-hindsight-theme="light"] .hindsight-page #legend .legend-item--missing .legend-return { color: var(--hindsight-muted); }
[data-hindsight-theme="light"] .hindsight-page #legend .legend-item { text-shadow: none; }
[data-hindsight-theme="light"] .hindsight-page #legend :is(.legend-coverage, .legend-close) { color: var(--hindsight-muted); }
[data-hindsight-theme="light"] .hindsight-page #market-overview .series-line { filter: brightness(.78); }
[data-hindsight-theme="light"] .hindsight-page #empty-state { color: var(--hindsight-muted); }
[data-hindsight-theme="light"] .hindsight-page .date-wrap .date-btn { filter: brightness(.35); }
[data-hindsight-theme="light"] .hindsight-page .analysis-loading::before { border-color: #cadbec; border-top-color: var(--hindsight-focus); }
[data-hindsight-theme="light"] .hindsight-page :is(.layer-status, #start-date-error, #end-date-error) { color: #a41928 !important; }
[data-hindsight-theme="light"] .hindsight-page .layer-status { background: #fff0f0; border-color: #ce8690; }
[data-hindsight-theme="light"] .hindsight-page #sym-modal .sym-message { color: #835b00; }
[data-hindsight-theme="light"] .hindsight-page #sym-modal .sym-message.is-error { color: #a41928; }
[data-hindsight-theme="light"] .hindsight-page #sym-modal.fw-modal-backdrop { background: #172c4373; }
[data-hindsight-theme="light"] .hindsight-page #tooltip { box-shadow: 0 5px 20px #172c4330; }
[data-hindsight-theme="light"] .hindsight-page #market-overview :is(.tick text, text[fill="#e5e7eb"], .bar-label-name, .bar-label-percent) { fill: var(--hindsight-text); }
[data-hindsight-theme="light"] .hindsight-page #market-overview .bar-label {
  fill: var(--hindsight-text) !important;
  stroke: var(--hindsight-surface) !important;
  stroke-width: 3px !important;
  stroke-opacity: .85 !important;
  paint-order: stroke;
}
[data-hindsight-theme="light"] .hindsight-page #market-overview :is(text[fill="#9ca3af"], text[fill="#94a3b8"]) { fill: var(--hindsight-muted); }
[data-hindsight-theme="light"] .hindsight-page #market-overview :is(.x-axis, .y-axis) :is(.domain, .tick line) { stroke: #637f9c; }
[data-hindsight-theme="light"] .hindsight-page #market-overview .grid line { stroke: #637f9c; opacity: .25; }
[data-hindsight-theme="light"] .hindsight-page #market-overview .rec-top-label rect { fill: var(--hindsight-raised); stroke: var(--hindsight-border); }
[data-hindsight-theme="light"] .hindsight-page #market-overview .rec-top-label text { fill: var(--hindsight-text); }
/* Drawdown rows contain legacy inline colors; override only their text, not values. */
[data-hindsight-theme="light"] .hindsight-page #dd-panel :is(th, td:not(.dd-value), div[style*="color:"]) { color: var(--hindsight-text) !important; }
[data-hindsight-theme="light"] .hindsight-page #dd-panel td:nth-child(3) { color: var(--hindsight-muted) !important; }
[data-hindsight-theme="light"] .hindsight-page .dd-value--negative { color: #b42332; }
[data-hindsight-theme="light"] .hindsight-page .dd-value--neutral { color: var(--hindsight-muted); }
[data-hindsight-theme="light"] .hindsight-page.mode-broadcast #dd-panel { background: var(--hindsight-surface) !important; }
[data-hindsight-theme="light"] .hindsight-page.mode-broadcast .hindsight-credit { background: var(--hindsight-bg); }

/* Two compact header rows leave more room for the financial chart.
   Keep the logo and 44px controls; mobile and Broadcast retain their layouts. */
@media (min-width: 761px) {
  .hindsight-page:not(.mode-broadcast) .hindsight-toolbar {
    min-height: 54px;
    margin-top: 6px;
    padding-top: 4px;
    padding-bottom: 4px;
  }
  .hindsight-page:not(.mode-broadcast) .overview-header { padding-top: 6px; padding-bottom: 6px; }
  .hindsight-page:not(.mode-broadcast) .overview-heading-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 12px;
  }
  .hindsight-page:not(.mode-broadcast) .overview-title { order: 0; font-size: clamp(20px, 1.8vw, 26px); }
  .hindsight-page:not(.mode-broadcast) .overview-eyebrow { order: 1; margin: 0; }
  .hindsight-page:not(.mode-broadcast) .overview-context { order: 2; flex-basis: 100%; margin: 0; font-size: 13px; line-height: 1.35; }
}

@media (min-width: 761px) and (max-height: 850px) {
  .hindsight-page:not(.mode-broadcast) .controls { padding-top: 6px; padding-bottom: 6px; }
  .hindsight-page:not(.mode-broadcast) #legend .legend-item { padding-top: 8px; padding-bottom: 8px; }
}

@media (max-width: 760px) {
  .hindsight-page .hindsight-toolbar { flex-wrap: nowrap; gap: 6px; min-height: 54px; margin: 4px 12px 0; padding: 4px 8px; }
  .hindsight-page .hindsight-toolbar .hindsight-home { font-size: 16px; }
  .hindsight-page .hindsight-home img { flex-basis: 32px; width: 32px; height: 32px; }
  .hindsight-header-menu { flex: 0 0 auto; }
  .hindsight-header-menu > summary { display: flex; align-items: center; justify-content: center; box-sizing: border-box; min-height: 44px; padding: 0 10px; border: 1px solid var(--hindsight-border); border-radius: 8px; background: var(--hindsight-raised); color: var(--hindsight-text); font-size: 13px; font-weight: 650; cursor: pointer; list-style: none; }
  .hindsight-header-menu > summary::-webkit-details-marker { display: none; }
  .hindsight-header-menu > summary:focus-visible { outline: 3px solid var(--hindsight-focus); outline-offset: 2px; }
  .hindsight-header-menu[open] > summary { border-color: var(--hindsight-accent); }
  .hindsight-page .hindsight-toolbar-actions { position: absolute; z-index: 9998; top: calc(100% + 8px); right: 0; width: 260px; max-width: calc(100vw - 32px); box-sizing: border-box; padding: 12px; display: flex; flex-direction: column; align-items: stretch; gap: 8px; border: 1px solid var(--hindsight-border); border-radius: 10px; background: var(--hindsight-surface); box-shadow: 0 12px 30px #0008; }
  .hindsight-theme-control > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .hindsight-theme-control select { min-width: 0; width: 100%; font-size: 16px; }
  .hindsight-page .hindsight-toolbar a:not(.hindsight-home), .hindsight-page .hindsight-toolbar button { padding: 0 9px; font-size: 13px; }
  .hindsight-page.mode-broadcast .wrapper { overflow: visible; }
  /* The outer Broadcast drawer already scrolls: keep its mobile menu in flow. */
  .hindsight-page.mode-broadcast .hindsight-toolbar:has(.hindsight-header-menu[open]) { flex-wrap: wrap; }
  .hindsight-page.mode-broadcast .hindsight-header-menu[open] { width: 100%; }
  .hindsight-page.mode-broadcast .hindsight-header-menu > summary { width: max-content; margin-left: auto; }
  .hindsight-page.mode-broadcast .hindsight-toolbar-actions { position: static; width: 100%; margin-top: 8px; box-shadow: none; }
  .hindsight-page .overview-data-status[data-state="current"] { padding: 2px 0; border-color: transparent; background: transparent; }
  .hindsight-page .controls :is(.custom-range, .appearance-group, .analysis-group):not([open]) { background: transparent; border-color: transparent; }
  .hindsight-page .controls :is(.custom-range, .appearance-group, .analysis-group):not([open]) > summary { font-weight: 600; }
  .hindsight-page .controls :is(.appearance-group, .analysis-group):not([open]) > summary { color: var(--hindsight-muted); }
  .hindsight-page .controls :is(.custom-range, .appearance-group, .analysis-group):not([open]) > summary:hover { background: var(--hindsight-hover); border-radius: 7px; }
  .hindsight-page .controls .custom-range.is-custom:not([open]) { border-color: var(--hindsight-accent); }
}
@media (max-width: 360px) {
  .hindsight-page .hindsight-toolbar .hindsight-home { gap: 6px; font-size: 14px; }
}
