.toggle {
  position: relative;
  display: inline-block;
  width: 2.75rem;
  height: 1.5rem;
  -moz-appearance: none;
       appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  border-radius: 9999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.92);
  transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
  vertical-align: middle;
}

.toggle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0.1875rem;
  width: 1rem;
  height: 1rem;
  border-radius: 9999px;
  background: linear-gradient(180deg, #ffffff, #e2e8f0);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.35);
  transform: translate(0, -50%);
  transition: transform 180ms ease, background-color 180ms ease;
}

.toggle:hover:not(:disabled) {
  border-color: rgba(251, 113, 133, 0.45);
  box-shadow: 0 0 0 4px rgba(244, 63, 94, 0.12);
}

.toggle:checked {
  border-color: rgba(244, 63, 94, 0.55);
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.95), rgba(249, 115, 22, 0.95));
}

.toggle:checked::after {
  transform: translate(1.1875rem, -50%);
}

.toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(244, 63, 94, 0.18);
}

.toggle:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.toggle-xs {
  width: 2.25rem;
  height: 1.25rem;
}

.toggle-xs::after {
  width: 0.875rem;
  height: 0.875rem;
}

.toggle-xs:checked::after {
  transform: translate(0.9375rem, -50%);
}

.permission-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  flex-shrink: 0;
  width: 2.5rem;
  min-width: 2.5rem;
  height: 1.4rem;
  min-height: 1.4rem;
  padding: 0.125rem;
  margin: 0 auto;
  -moz-appearance: none;
       appearance: none;
  -webkit-appearance: none;
  border-style: solid;
  border-width: 1px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 9999px;
  background: rgba(30, 41, 59, 0.72);
  box-shadow: inset 0 1px 1px rgba(15, 23, 42, 0.38);
  transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
  vertical-align: middle;
  overflow: hidden;
  font-size: 0;
  line-height: 1;
  color: transparent;
  cursor: pointer;
}

.permission-switch:hover:not(:disabled) {
  border-color: rgba(251, 113, 133, 0.45);
  box-shadow: 0 0 0 4px rgba(244, 63, 94, 0.12);
}

.permission-switch:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(244, 63, 94, 0.18);
}

.permission-switch:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.permission-switch-on {
  justify-content: flex-end;
  border-color: rgba(244, 63, 94, 0.42);
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.9), rgba(249, 115, 22, 0.9));
}

.permission-switch-off {
  background: rgba(15, 23, 42, 0.88);
}

.permission-switch-thumb {
  display: block;
  flex-shrink: 0;
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 9999px;
  background: linear-gradient(180deg, #ffffff, #e2e8f0);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.35);
  transition: transform 180ms ease;
}

.toast-host {
  position: fixed;
  z-index: 90;
  pointer-events: none;
  width: min(24rem, calc(100vw - 2rem));
}

.toast-host--bottom-right {
  right: 1rem;
  bottom: 1rem;
}

.toast-host--top-center {
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
}

.toast-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast-item {
  position: relative;
  overflow: hidden;
  pointer-events: auto;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 1rem;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(17, 24, 39, 0.94));
  color: #f8fafc;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(14px);
  animation: toast-enter 180ms ease-out;
}

.toast-item:focus-visible {
  outline: 2px solid rgba(251, 113, 133, 0.7);
  outline-offset: 2px;
}

.toast-item--info {
  border-color: rgba(56, 189, 248, 0.26);
}

.toast-item--success {
  border-color: rgba(74, 222, 128, 0.28);
}

.toast-item--warning {
  border-color: rgba(251, 191, 36, 0.3);
}

.toast-item--error {
  border-color: rgba(248, 113, 113, 0.34);
}

.toast-item--leaving {
  animation: toast-exit 140ms ease-in forwards;
}

.toast-header-row {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 1rem 1rem 0.875rem;
}

.toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  font-size: 0.95rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
}

.toast-item--info .toast-icon {
  color: #7dd3fc;
  background: rgba(14, 165, 233, 0.16);
}

.toast-item--success .toast-icon {
  color: #86efac;
  background: rgba(34, 197, 94, 0.16);
}

.toast-item--warning .toast-icon {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.18);
}

.toast-item--error .toast-icon {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.18);
}

.toast-content {
  min-width: 0;
  flex: 1;
}

.toast-title {
  margin-bottom: 0.2rem;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.25rem;
}

.toast-message {
  font-size: 0.92rem;
  line-height: 1.4rem;
  color: rgba(226, 232, 240, 0.94);
  word-break: break-word;
}

.toast-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  margin: -0.25rem -0.25rem 0 0;
  border: 0;
  border-radius: 9999px;
  background: transparent;
  color: rgba(226, 232, 240, 0.82);
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.toast-close:focus-visible {
  outline: 2px solid rgba(251, 113, 133, 0.7);
  outline-offset: 2px;
}

.toast-progress-track {
  height: 0.2rem;
  background: rgba(255, 255, 255, 0.05);
}

.toast-progress {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  animation-name: toast-progress;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

.toast-progress--info {
  background: linear-gradient(90deg, #38bdf8, #22d3ee);
}

.toast-progress--success {
  background: linear-gradient(90deg, #22c55e, #4ade80);
}

.toast-progress--warning {
  background: linear-gradient(90deg, #f59e0b, #facc15);
}

.toast-progress--error {
  background: linear-gradient(90deg, #ef4444, #fb7185);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes toast-enter {
  from {
    opacity: 0;
    transform: translateY(0.5rem) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-exit {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateY(0.25rem) scale(0.98);
  }
}

@keyframes toast-progress {
  from {
    transform: scaleX(1);
  }

  to {
    transform: scaleX(0);
  }
}

@media (max-width: 640px) {
  .toast-host,
  .toast-host--top-center {
    top: 1rem;
    right: 1rem;
    left: 1rem;
    bottom: auto;
    width: auto;
    transform: none;
  }
}
