/* Company logo in place of the listing flag (app/company-logos.js). The flag's box is kept
   as it is in every view (no layout shift); the logo is a square as tall as the box,
   centred in it. Dark marks get a light plate in the dark theme, light marks a dark plate
   in the light theme. */
.cwp-company-logo[data-company] {
  position: relative;
  background: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
  overflow: visible;
}
.cwp-company-logo[data-company]::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  aspect-ratio: 1;
  transform: translateX(-50%);
  border-radius: 3px;
  background: var(--cwp-logo) center / contain no-repeat;
}
.cwp-company-logo.cwp-logo-plate[data-company]::before {
  background: var(--cwp-logo) center / 84% no-repeat, #e9eef3;
}
html[data-cardinal-theme="light"] .cwp-company-logo.cwp-logo-plate[data-company]::before {
  background: var(--cwp-logo) center / contain no-repeat;
}
html[data-cardinal-theme="light"] .cwp-company-logo.cwp-logo-plate-light[data-company]::before {
  background: var(--cwp-logo) center / 84% no-repeat, #13212e;
}
/* A brand with only a wordmark: the wordmark fills the flag's whole box instead of a square. */
.cwp-company-logo.cwp-logo-wide[data-company]::before {
  left: 0;
  right: 0;
  aspect-ratio: auto;
  transform: none;
}

/* Bolagsanalys: with a logo, the identity is two columns — a 48 px logo on the left, beside
   the name + ticker and, under the name, country · sector. Flags keep the original row. */
.company-view .company-identity h2>.cwp-heading-ticker {
  flex: none;
  color: var(--app-muted, #9aa8b6);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .02em;
  white-space: nowrap;
}
.company-view .company-identity:has(> h2 > .cwp-company-logo) {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-height: 48px;
  padding-left: 62px;
}
.company-view .company-identity h2>.cwp-company-flag.cwp-company-logo[data-company] {
  position: absolute !important;
  left: 0;
  top: 50%;
  width: 48px !important;
  height: 48px !important;
  margin: 0;
  transform: translateY(-50%);
}
.company-view .company-identity h2>.cwp-company-flag.cwp-company-logo[data-company]::before {
  border-radius: 6px;
}
.company-view .company-identity:has(> h2 > .cwp-company-logo) > h2 {
  align-items: baseline;
  margin: 0;
}
.company-view .company-identity:has(> h2 > .cwp-company-logo) > .cwp-company-market-line {
  margin: 0 !important;
  color: var(--app-muted, #9aa8b6) !important;
  font-size: 12px !important;
  line-height: 16px !important;
  letter-spacing: .01em;
}

/* The Screener's company popup with a logo: as on Bolagsanalys, a 48 px logo on the left, the name with the ticker
   beside it, and country · sector under the name (app/company-logos.js). */
.modal-head > .cwp-dialog-identity {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-height: 48px;
  padding-left: 62px;
}
.modal-head > .cwp-dialog-identity > .eyebrow,
.modal-head > .cwp-dialog-identity > h2 > small {
  display: none !important;
}
.modal-head > .cwp-dialog-identity > h2 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
}
.modal-head > .cwp-dialog-identity > h2 > .cwp-dialog-logo {
  position: absolute;
  left: 0;
  top: 50%;
  width: 48px;
  height: 48px;
  margin: 0;
  transform: translateY(-50%);
}
.modal-head > .cwp-dialog-identity > h2 > .cwp-dialog-logo::before {
  border-radius: 6px;
}
.modal-head .cwp-dialog-ticker {
  flex: none;
  color: var(--app-muted, #9aa8b6);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .02em;
  white-space: nowrap;
}
.modal-head .cwp-dialog-market {
  color: var(--app-muted, #9aa8b6);
  font-size: 12px;
  line-height: 16px;
  letter-spacing: .01em;
}

/* Hem: more room in the company rows, so a logo is 24 px; flags keep their shape in the same 24 px slot. */
.hv-root .hv-who>.hv-flag.cwp-company-logo[data-company] {
  width: 24px;
  height: 24px;
}
.hv-root .hv-who>.hv-flag:not(.cwp-company-logo) {
  margin-inline: 2px;
}

/* Search results: a 24 px logo (was the 22 x 16 flag box); flags keep their size. */
.global-search-panel [role="option"]>.cwp-search-company-flag.cwp-company-logo[data-company] {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  margin-inline: 0 2px;
}
.global-search-panel [role="option"]>.cwp-search-company-flag.cwp-company-logo[data-company]::before {
  border-radius: 4px;
}

/* Screener company cell, as on Bolagsanalys: the logo (32 px) or the flag in a 32 px slot spanning both lines on the
   left, the name above and ticker · country under it (11 px), so names align in every row. */
.company-table td.company-column > button.cwp-has-flag.cwp-has-flag {
  grid-template-columns: 32px minmax(0, 1fr);
  grid-template-rows: 18px 13px;
  column-gap: 10px;
  row-gap: 2px;
}
.company-table td.company-column > button.cwp-has-flag.cwp-has-flag > .cwp-company-flag {
  grid-column: 1;
  grid-row: 1 / span 2;
  justify-self: center;
}
.company-table td.company-column > button.cwp-has-flag.cwp-has-flag > .cwp-company-flag.cwp-company-logo[data-company] {
  width: 32px;
  height: 32px;
  flex-basis: 32px;
}
.company-table td.company-column > button.cwp-has-flag.cwp-has-flag > .cwp-company-flag.cwp-company-logo[data-company]::before {
  border-radius: 5px;
}
.company-table td.company-column > button.cwp-has-flag.cwp-has-flag > .cwp-screener-company-meta {
  grid-column: 2;
  font-size: 11px;
  line-height: 13px;
}

/* Builder holdings, as in the Screener: the logo (36 px) or the flag in a slot spanning the name and the archetype
   line, the name with ticker · country beside it (11 px), so names align in every row. */
.cardinal-minimal-preview .builder-view .holding-row .holding-name {
  container: holding-name / inline-size;
  position: relative !important;
  display: flex !important;
  align-items: baseline;
  gap: 8px !important;
  min-width: 0;
  padding-left: 46px !important;
  overflow: visible !important;
}
.cardinal-minimal-preview .builder-view .holding-row .holding-name > .cwp-company-flag {
  position: absolute !important;
  left: 6px !important;
  top: 16px !important;
  width: 24px;
  height: 18px;
  margin: 0;
}
.cardinal-minimal-preview .builder-view .holding-row .holding-name > .cwp-company-flag.cwp-company-logo[data-company] {
  left: 0 !important;
  top: 3px !important;
  width: 36px;
  height: 36px;
}
.cardinal-minimal-preview .builder-view .holding-row .holding-name > .cwp-company-flag.cwp-company-logo[data-company]::before {
  border-radius: 6px;
}
.cardinal-minimal-preview .builder-view .holding-row .holding-name > strong {
  flex: 0 1 auto;
  min-width: 0;
}
.cardinal-minimal-preview .builder-view .holding-row .holding-name > .holding-company-meta {
  position: static !important;
  display: inline !important;
  flex: none;
  color: var(--muted, #9aa8b6);
  font: 500 11px/18px var(--sans, inherit) !important;
  letter-spacing: .02em;
}
/* In the narrow holdings column (the wide three-column Builder) the ticker gives the name its room. */
@container holding-name (max-width: 260px) {
  .cardinal-minimal-preview .builder-view .holding-row .holding-name > .holding-company-meta {
    display: none !important;
  }
}
.cardinal-minimal-preview .builder-view .holding-row .holding-archetype-tag {
  margin-top: -5px !important;
  padding-left: 46px !important;
}

/* Bevakningslista, as in the Screener: the logo (32 px) or the flag in a slot spanning both lines, the name above and
   ticker · country (11 px, was 9.5 px) under it, so names align in every row. */
.cardinal-minimal-preview .watchlist-view-v3 .watchlist-factor-row .watchlist-company.watchlist-company {
  grid-template-columns: 32px minmax(0, 1fr) !important;
  grid-template-rows: 18px 13px !important;
  gap: 2px 10px !important;
  align-content: center;
}
.cardinal-minimal-preview .watchlist-view-v3 .watchlist-factor-row .watchlist-company.watchlist-company > .cwp-company-flag {
  grid-area: 1 / 1 / span 2 / 2 !important;
  justify-self: center;
  align-self: center;
}
.cardinal-minimal-preview .watchlist-view-v3 .watchlist-factor-row .watchlist-company.watchlist-company > .cwp-company-flag.cwp-company-logo[data-company] {
  width: 32px !important;
  height: 32px !important;
}
.cardinal-minimal-preview .watchlist-view-v3 .watchlist-factor-row .watchlist-company.watchlist-company > .cwp-company-flag.cwp-company-logo[data-company]::before {
  border-radius: 5px;
}
.cardinal-minimal-preview .watchlist-view-v3 .watchlist-factor-row .watchlist-company.watchlist-company .watchlist-company-copy > small {
  grid-area: 2 / 2 !important;
  font: 400 11px/13px var(--sans) !important;
}
