.medaliza-ui-mode-toggle[hidden] {
  display: none !important;
}

.medaliza-ui-mode-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  flex: 0 0 188px;
  min-width: 188px;
  padding: 3px;
  border: 1px solid rgba(86, 145, 198, .18);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(239, 247, 255, .92));
  box-shadow: 0 8px 24px rgba(55, 101, 142, .10), inset 0 1px 0 rgba(255, 255, 255, .85);
}

.medaliza-ui-mode-toggle button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: transparent;
  color: #173d70;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.medaliza-ui-mode-toggle button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.medaliza-ui-mode-toggle button:hover:not([aria-pressed="true"]) {
  background: rgba(214, 236, 255, .72);
  color: #0b67c7;
}

.medaliza-ui-mode-toggle button[aria-pressed="true"] {
  border-color: rgba(11, 111, 232, .22);
  background: linear-gradient(135deg, #1587f4, #0b6fe8);
  color: #fff;
  box-shadow: 0 6px 16px rgba(15, 111, 232, .22), inset 0 1px 0 rgba(255, 255, 255, .24);
}

.medaliza-ui-mode-toggle button:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid rgba(21, 135, 244, .72);
  outline-offset: 2px;
}

.app-shell:has([data-billing-page]) .medaliza-ui-mode-toggle {
  display: none !important;
}

@media (max-width: 1100px) {
  .medaliza-ui-mode-toggle {
    flex-basis: 82px;
    min-width: 82px;
  }

  .medaliza-ui-mode-toggle button {
    padding: 0 9px;
  }

  .medaliza-ui-mode-toggle button span {
    display: none;
  }
}

@media (max-width: 760px) {
  .medaliza-ui-mode-toggle {
    display: inline-grid !important;
    flex: 0 0 128px;
    min-width: 128px;
    padding: 2px;
    border-radius: 15px;
  }

  .medaliza-ui-mode-toggle button {
    min-height: 32px;
    gap: 3px;
    padding: 0 4px;
    border-radius: 13px;
    font-size: 9px;
  }

  .medaliza-ui-mode-toggle button span {
    display: inline;
  }

  .medaliza-ui-mode-toggle button svg {
    width: 16px;
    height: 16px;
    flex-basis: 16px;
  }

  .app-shell:has(.med-dashboard, .medaliza-mobile-mock) .medibill-topbar.topbar .search {
    display: none;
  }

  .app-shell:has(.med-dashboard, .medaliza-mobile-mock) .medibill-topbar.topbar .top-actions {
    margin-left: auto;
    min-width: 0;
  }
}

.app-shell:has(.medaliza-mobile-reference-stage) .medaliza-ui-mode-toggle[data-mode="mobile"] {
  grid-template-columns: 1fr;
  flex-basis: 92px;
  min-width: 92px;
}

.app-shell:has(.medaliza-mobile-reference-stage) .medaliza-ui-mode-toggle[data-mode="mobile"] [data-medaliza-ui-mode="mobile"] {
  display: none;
}

.app-shell:has(.medaliza-mobile-reference-stage) .medibill-topbar.topbar .search {
  display: none;
}

.app-shell:has(.medaliza-mobile-reference-stage) .medibill-topbar [aria-label*="more" i],
.app-shell:has(.medaliza-mobile-reference-stage) .medibill-topbar [aria-label*="overflow" i],
.app-shell:has(.medaliza-mobile-reference-stage) .medibill-topbar .topbar-kebab,
.app-shell:has(.medaliza-mobile-reference-stage) .medibill-topbar .more-menu {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .medaliza-ui-mode-toggle button {
    transition: none;
  }
}
