.hogon-toast-stack {
  position: fixed;
  z-index: 10000;
  top: max(18px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  width: min(390px, calc(100vw - 36px));
  display: grid;
  gap: 11px;
  direction: rtl;
  pointer-events: none;
}

.hogon-toast-stack.hogon-toast-stack-dialog {
  position: absolute;
  top: 14px;
  right: auto;
  left: 50%;
  width: min(390px, calc(100% - 28px));
  transform: translateX(-50%);
}

.hogon-toast {
  --toast-color: #2f8581;
  --toast-soft: #eaf7f5;
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 28px;
  align-items: start;
  gap: 11px;
  overflow: hidden;
  padding: 14px 14px 16px 11px;
  border: 1px solid rgba(63, 167, 163, 0.34);
  border-color: color-mix(in srgb, var(--toast-color) 36%, white);
  border-right: 5px solid var(--toast-color);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 18px 50px rgba(24, 66, 63, 0.2);
  color: #383532;
  font-family: "Vazirmatn", Tahoma, sans-serif;
  pointer-events: auto;
  animation: hogon-toast-enter 220ms ease-out both;
  backdrop-filter: blur(12px);
}

.hogon-toast-success {
  --toast-color: #278269;
  --toast-soft: #e7f6f0;
}

.hogon-toast-warning {
  --toast-color: #b68117;
  --toast-soft: #fff5da;
}

.hogon-toast-error {
  --toast-color: #b44f48;
  --toast-soft: #fdecea;
}

.hogon-toast-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 12px;
  color: var(--toast-color);
  background: var(--toast-soft);
  font-size: 1.3125rem;
  font-weight: 900;
  line-height: 1;
}

.hogon-toast-content {
  min-width: 0;
  padding-top: 1px;
}

.hogon-toast-content strong,
.hogon-toast-content p {
  display: block;
  margin: 0;
}

.hogon-toast-content strong {
  color: var(--toast-color);
  font-size: 0.8125rem;
  font-weight: 900;
}

.hogon-toast-content p {
  margin-top: 4px;
  color: #554f49;
  font-size: 0.78125rem;
  font-weight: 600;
  line-height: 1.85;
  overflow-wrap: anywhere;
}

.hogon-toast-close {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #817a73;
  background: transparent;
  font: 700 1.25rem/1 Arial, sans-serif;
  cursor: pointer;
}

.hogon-toast-close:hover {
  color: var(--toast-color);
  background: var(--toast-soft);
}

.hogon-toast-progress {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
  background: var(--toast-color);
  transform-origin: right center;
  animation: hogon-toast-progress var(--hogon-toast-duration, 4200ms) linear forwards;
}

.hogon-toast.is-paused .hogon-toast-progress {
  animation-play-state: paused;
}

.hogon-toast.is-leaving {
  animation: hogon-toast-leave 220ms ease-in both;
}

input.hogon-field-invalid,
textarea.hogon-field-invalid,
select.hogon-field-invalid {
  border-color: #b44f48 !important;
  background-color: #fff8f7 !important;
  box-shadow: 0 0 0 3px rgba(180, 79, 72, 0.14) !important;
}

input.hogon-field-invalid:focus,
textarea.hogon-field-invalid:focus,
select.hogon-field-invalid:focus {
  border-color: #a43e38 !important;
  box-shadow: 0 0 0 4px rgba(180, 79, 72, 0.2) !important;
}

.hogon-has-field-error {
  color: #963e38 !important;
}

.hogon-field-error {
  display: none;
}

@keyframes hogon-toast-enter {
  from { opacity: 0; transform: translate3d(24px, -8px, 0) scale(0.98); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes hogon-toast-leave {
  from { opacity: 1; transform: translate3d(0, 0, 0); }
  to { opacity: 0; transform: translate3d(24px, -5px, 0); }
}

@keyframes hogon-toast-progress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

@media (max-width: 600px) {
  .hogon-toast-stack {
    top: max(10px, env(safe-area-inset-top));
    right: 10px;
    width: calc(100vw - 20px);
    gap: 8px;
  }

  .hogon-toast-stack.hogon-toast-stack-dialog {
    top: 10px;
    right: auto;
    left: 50%;
    width: calc(100% - 20px);
  }

  .hogon-toast {
    grid-template-columns: 36px minmax(0, 1fr) 26px;
    gap: 9px;
    padding: 12px 11px 14px 9px;
    border-radius: 13px;
  }

  .hogon-toast-icon {
    width: 35px;
    height: 35px;
    font-size: 1.125rem;
  }

  .hogon-toast-content strong { font-size: 0.8125rem; }
  .hogon-toast-content p { font-size: 0.75rem; }
}

@media (max-width: 768px) {
  .hogon-field-error {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 1px;
    color: #9d403a;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.75;
  }

  .hogon-field-error::before {
    content: "!";
    display: inline-grid;
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: #b44f48;
    font: 800 0.75rem/1 Arial, sans-serif;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hogon-toast,
  .hogon-toast-progress {
    animation: none;
  }
}
