.knav-popover {
  display: inline-block;
  position: relative;
}

.knav-popover__trigger {
  cursor: pointer;
}

.knav-popover__panel {
  background: #fff;
  border: 1px solid #cfd8dc;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(31, 42, 51, 0.18);
  color: #24313a;
  display: block;
  font-size: 14px;
  line-height: 1.45;
  max-width: min(320px, calc(100vw - 32px));
  min-width: 220px;
  padding: 12px 14px;
  position: absolute;
  text-align: left;
  white-space: normal;
  z-index: 1060;
}

.knav-popover__panel[hidden] {
  display: none;
}

.knav-popover__header {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 8px;
}

.knav-popover__title {
  color: #10212b;
  display: block;
  font-weight: 600;
}

.knav-popover__close {
  appearance: none;
  background: transparent;
  border: 0;
  color: #52646f;
  cursor: pointer;
  font-size: var(--icon-height, 34px);
  line-height: 1;
  margin: -2px -4px 0 0;
  padding: 0 4px;
}

.knav-popover__close:hover,
.knav-popover__close:focus {
  color: #10212b;
}

.knav-popover__body {
  display: block;
}

.knav-popover__arrow,
.knav-popover__arrow::after {
  display: block;
  height: 10px;
  position: absolute;
  width: 10px;
}

.knav-popover__arrow::after {
  background: #fff;
  border: 1px solid #cfd8dc;
  content: "";
  transform: rotate(45deg);
}

.knav-popover--under .knav-popover__panel {
  left: 50%;
  margin-top: 10px;
  top: 100%;
  transform: translateX(calc(-50% + var(--knav-popover-shift, 0px)));
}

.knav-popover--under .knav-popover__arrow {
  left: calc(50% + var(--knav-popover-arrow-shift, 0px));
  top: -5px;
  transform: translateX(-50%);
}

.knav-popover--under .knav-popover__arrow::after {
  border-bottom: 0;
  border-right: 0;
}

.knav-popover--right .knav-popover__panel {
  left: 100%;
  margin-left: 10px;
  top: 50%;
  transform: translateY(-50%);
}

.knav-popover--right .knav-popover__arrow {
  left: -5px;
  top: 50%;
  transform: translateY(-50%);
}

.knav-popover--right .knav-popover__arrow::after {
  border-right: 0;
  border-top: 0;
}

.knav-popover--left .knav-popover__panel {
  margin-right: 10px;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
}

.knav-popover--left .knav-popover__arrow {
  right: -5px;
  top: 50%;
  transform: translateY(-50%);
}

.knav-popover--left .knav-popover__arrow::after {
  border-bottom: 0;
  border-left: 0;
}

.knav-popover--account .knav-popover__panel {
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 10px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.18);
  min-width: 360px;
  padding: 16px;
}

.knav-popover--account .knav-popover__header {
  margin-bottom: 0;
}

.knav-popover--account .knav-popover__close {
  display: none;
}

.account-popover {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.account-action__avatar {
  align-items: center;
  background: #e8f1fb;
  border-radius: 7px;
  color: var(--primary) !important;
  display: inline-flex;
  font-size: 14px;
  font-weight: 800;
  height: 100%;
  justify-content: center;
  line-height: 1;
  width: 100%;
}

#header .knav-popover--account,
#header .knav-popover--login-choice,
#header .account-action {
  box-sizing: border-box !important;
  height: var(--item-height, 34px) !important;
  max-height: var(--item-height, 34px) !important;
  max-width: var(--item-height, 34px) !important;
  min-height: var(--item-height, 34px) !important;
  min-width: var(--item-height, 34px) !important;
  padding: 0 !important;
  width: var(--item-height, 34px) !important;
}

#header .knav-popover--account,
#header .knav-popover--login-choice {
  display: inline-flex !important;
  z-index: 40000;
}

#header .knav-popover--account .knav-popover__panel,
#header .knav-popover--login-choice .knav-popover__panel {
  z-index: 40001;
}

/* Keep an open account popover above administration cards and other content. */
#header:has(.knav-popover--open) {
  overflow: visible !important;
  z-index: 50000 !important;
}

#header .knav-popover--open {
  z-index: 50001 !important;
}

#header .knav-popover--open .knav-popover__panel {
  z-index: 50002 !important;
}

#header .account-action .account-action__avatar {
  border-radius: 8px !important;
  font-size: 14px !important;
  height: 100% !important;
  max-height: 100% !important;
  max-width: 100% !important;
  min-height: 100% !important;
  min-width: 100% !important;
  width: 100% !important;
}

.account-action,
.account-action:hover,
.account-action:focus,
.account-action:active,
.account-action .account-action__avatar,
.account-action:hover .account-action__avatar,
.account-action:focus .account-action__avatar,
.account-action:active .account-action__avatar {
  text-decoration: none;
}

.account-popover__label {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.2;
  text-transform: uppercase;
}

.account-popover__identity {
  align-items: center;
  display: flex;
  gap: 12px;
  min-width: 0;
}

.account-popover__avatar {
  align-items: center;
  background: #e8f1fb;
  border: 1px solid #c9dff4;
  border-radius: 8px;
  color: var(--primary-hover);
  display: inline-flex;
  flex: 0 0 44px;
  font-size: 15px;
  font-weight: 700;
  height: 44px;
  justify-content: center;
  line-height: 1;
  width: 44px;
}

.account-popover__text {
  min-width: 0;
}

.account-popover__user {
  color: #0f172a;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-popover__email {
  color: #64748b;
  font-size: 13px;
  line-height: 1.4;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-popover__actions {
  display: flex;
  gap: 10px;
}

.account-popover__catalog,
.account-popover__logout,
.account-popover__suggest {
  align-items: center;
  font-weight: 600;
}

.account-popover__catalog,
.account-popover__logout {
  border-radius: 8px;
  display: inline-flex;
  flex: 1 1 0;
  font-size: 14px;
  justify-content: center;
  line-height: 1.15;
  min-height: var(--button-height, 34px);
  padding: 10px 14px;
  text-align: center;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.account-popover__catalog {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 8px 16px rgba(37, 111, 189, 0.22);
}

.account-popover__catalog:hover,
.account-popover__catalog:focus {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
  box-shadow: 0 10px 20px rgba(37, 111, 189, 0.28);
}

.account-popover__logout {
  border: 1px solid #cbd5e1;
  color: var(--primary);
  text-decoration: none;
}

.account-popover__logout:hover,
.account-popover__logout:focus {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: var(--primary-hover);
  text-decoration: none;
}

.account-popover__suggest {
  align-items: center;
  background: #e8f1fb;
  border: 1px solid var(--primary);
  border-radius: 8px;
  color: var(--primary);
  display: flex;
  font-size: 14px;
  justify-content: center;
  line-height: 1.15;
  min-height: var(--button-height, 34px);
  padding: 10px 14px;
  text-align: center;
  text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
  width: 100%;
}

.account-popover__suggest:hover,
.account-popover__suggest:focus {
  background: #d9e9f8;
  border-color: var(--primary-hover);
  box-shadow: 0 8px 16px rgba(29, 79, 145, 0.12);
  color: var(--primary-hover);
}

.knav-popover--login-choice .knav-popover__panel {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.16);
  min-width: 280px;
  padding: 14px;
}

.knav-popover--login-choice .knav-popover__header {
  margin-bottom: 0;
}

.knav-popover--login-choice .knav-popover__close {
  display: none;
}

.login-choice-popover {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-choice-popover__title {
  color: #0f172a;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
}

.login-choice-popover__role-label {
  color: #0f172a;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
}

.login-choice-popover__actions {
  display: flex;
  gap: 8px;
}

.login-choice-popover__renewal {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 10px 12px;
  text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.login-choice-popover__renewal:hover,
.login-choice-popover__renewal:focus {
  background: #fff;
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
  text-decoration: none;
}

.login-choice-popover__renewal:active {
  background: #f1f5f9;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.12);
}

.login-choice-popover__renewal-text {
  color: #000;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
}

.login-choice-popover__renewal:hover .login-choice-popover__renewal-text,
.login-choice-popover__renewal:focus .login-choice-popover__renewal-text {
  color: #000;
  text-decoration: underline;
}

.login-choice-popover__bankid {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  display: inline-flex;
  flex: 0 0 auto;
  justify-content: center;
  min-height: 0;
  padding: 0;
  text-decoration: none;
  transition: opacity 120ms ease, transform 120ms ease;
}

.login-choice-popover__renewal:hover .login-choice-popover__bankid,
.login-choice-popover__renewal:focus .login-choice-popover__bankid {
  opacity: 0.86;
  text-decoration: none;
  transform: translateY(-1px);
}

.login-choice-popover__bankid img {
  display: block;
  height: auto;
  max-width: 76px;
}

.login-choice-popover__button {
  align-items: center;
  border-radius: 7px;
  display: inline-flex;
  flex: 1 1 0;
  font-size: 14px;
  font-weight: 650;
  justify-content: space-between;
  line-height: 1.15;
  min-height: var(--button-height, 34px);
  padding: 9px 16px 9px 18px;
  text-align: left;
  text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
  min-width: 0;
}

.login-choice-popover__button-text {
  min-width: 0;
}

.login-choice-popover__button .action-btn__icon,
.login-choice-popover__button svg {
  flex: 0 0 auto;
  height: var(--icon-image-height, 17px);
  margin-left: 14px;
  width: var(--icon-image-height, 17px);
}

.login-choice-popover__button.btn-primary {
  background: #e8f1fb;
  border: 1px solid var(--primary);
  box-shadow: none;
  color: var(--primary);
}

.login-choice-popover__button.btn-primary:hover,
.login-choice-popover__button.btn-primary:focus {
  background: #d9e9f8;
  border-color: var(--primary-hover);
  box-shadow: 0 8px 16px rgba(29, 79, 145, 0.12);
  color: var(--primary-hover);
}

.login-choice-popover__button.btn-default {
  background: #f8fafc;
  border: 1px solid transparent;
  color: var(--primary);
  font-size: 13px;
  font-weight: 650;
  min-height: var(--button-height, 34px);
}

.login-choice-popover__button.btn-default:hover,
.login-choice-popover__button.btn-default:focus {
  background: #eef2f7;
  border-color: transparent;
  color: var(--primary-hover);
  text-decoration: none;
}

@media (max-width: 480px) {
  .knav-popover__panel {
    box-sizing: border-box;
    max-width: 90vw;
    min-width: 0;
    width: 90vw;
  }

  .knav-popover--account .knav-popover__panel,
  .knav-popover--login-choice .knav-popover__panel {
    min-width: 0;
  }

  .account-popover__actions {
    flex-direction: row;
  }

  .login-choice-popover__actions {
    flex-direction: row;
  }

  .login-choice-popover__renewal {
    align-items: center;
    flex-direction: row;
  }

  .login-choice-popover__bankid {
    width: auto;
  }
}
