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

:root {
  --finwiz-tv-font: "Twemoji Country Flags", "Source Sans 3", "Atkinson Hyperlegible", "Aptos", "Trebuchet MS", "Segoe UI", Arial, sans-serif;
}

@font-face {
  font-family: "Source Sans 3";
  src: url("/fonts/SourceSans3-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Source Sans 3";
  src: url("/fonts/SourceSans3-Italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Source Sans 3";
  src: url("/fonts/SourceSans3-Semibold.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Source Sans 3";
  src: url("/fonts/SourceSans3-Bold.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/fonts/AtkinsonHyperlegible-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/fonts/AtkinsonHyperlegible-Italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/fonts/AtkinsonHyperlegible-Bold.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/fonts/AtkinsonHyperlegible-BoldItalic.woff2") format("woff2");
  font-style: italic;
  font-weight: 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 system-ui, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--fav-text);
  letter-spacing: .2px;
}
.fav-ticker {
  display: inline-block;
  font: 600 12px/1 system-ui, Segoe UI, Roboto, Arial, sans-serif;
  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 system-ui, Segoe UI, Roboto, Arial, sans-serif;
  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(1200px, 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 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

@media (min-width: 1440px) {
  #sym-modal .fw-modal {
    width: min(1320px, 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:16px; color:#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{ min-height:18px; color:#fbbf24; font-size:12px; font-weight:700; text-align:right; }
#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-chip,
#sym-modal .sym-preset{ display:inline-flex; align-items:center; gap:6px; min-height:28px; border:1px solid #475569; border-radius:999px; background:#172033; color:#dbeafe; padding:3px 9px; font-size:12px; 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-bottom:6px; flex-wrap:wrap; }
#sym-modal .fw-modal-toolbar .spacer{ flex:1; }
#sym-modal .fw-modal-toolbar input{
  background:#0b1220; border:1px solid #334155; color:#e5e7eb;
  border-radius:8px; width:min(320px, 100%); height:32px; padding:0 10px; font-size:13px;
}
#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(auto-fill, minmax(190px,1fr)); gap:6px 10px; padding:8px 10px; }

#sym-modal .option-row{ display:flex; align-items:center; gap:6px; background:#0f172a; border:1px solid #334155; border-radius:6px; padding:4px 6px; font-size:13px; }
#sym-modal .option-row .sym{ font-weight:500; color:#e5e7eb; }
#sym-modal .option-row .label{ color:#9ca3af; font-weight:400; }

/* 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 .fw-modal-toolbar .spacer{ display:none; }
  #sym-modal .fw-modal-toolbar input{ order:-1; flex:1 0 100%; width:100%; }
  #sym-modal .group-body{ grid-template-columns: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);
}

/* 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 14px/1.2 "Source Sans 3", "Segoe UI", sans-serif;
  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;
}
.hindsight-page .btn-preset, .hindsight-page #sym-open,
.hindsight-page .zoom-controls button, .hindsight-page .date-btn,
.hindsight-page .control-label input[type="date"] { min-height: 40px !important; }
.hindsight-page .date-wrap .date-btn { width: 40px; background-size: 18px 18px; }
.hindsight-page .date-wrap input[type="date"] { height: 40px !important; line-height: 40px !important; padding-right: 44px !important; }
#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; }
}


/* ================================
   ⏳ 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;
}
