/* App toast + confirm modal */

#appAlertStack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(380px, calc(100vw - 24px));
  pointer-events: none;
}

.app-alert {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
  color: #0f172a;
  animation: appAlertIn 0.22s ease;
  overflow: hidden;
}

.app-alert.is-hiding {
  animation: appAlertOut 0.2s ease forwards;
}

.app-alert-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  font-size: 0.9rem;
}

.app-alert-body {
  flex: 1;
  min-width: 0;
}

.app-alert-title {
  font-size: 0.82rem;
  font-weight: 700;
  margin: 0 0 2px;
  letter-spacing: 0.01em;
}

.app-alert-text {
  font-size: 0.9rem;
  line-height: 1.35;
  margin: 0;
  word-break: break-word;
}

.app-alert-close {
  border: 0;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-size: 1rem;
}

.app-alert-close:hover {
  color: #475569;
}

.app-alert.success {
  border-color: #bbf7d0;
  background: linear-gradient(180deg, #f0fdf4 0%, #fff 60%);
}
.app-alert.success .app-alert-icon { background: #16a34a; }
.app-alert.success .app-alert-title { color: #15803d; }

.app-alert.error {
  border-color: #fecaca;
  background: linear-gradient(180deg, #fef2f2 0%, #fff 60%);
}
.app-alert.error .app-alert-icon { background: #dc2626; }
.app-alert.error .app-alert-title { color: #b91c1c; }

.app-alert.warning {
  border-color: #fde68a;
  background: linear-gradient(180deg, #fffbeb 0%, #fff 60%);
}
.app-alert.warning .app-alert-icon { background: #d97706; }
.app-alert.warning .app-alert-title { color: #b45309; }

.app-alert.info {
  border-color: #bfdbfe;
  background: linear-gradient(180deg, #eff6ff 0%, #fff 60%);
}
.app-alert.info .app-alert-icon { background: #2563eb; }
.app-alert.info .app-alert-title { color: #1d4ed8; }

@keyframes appAlertIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes appAlertOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-8px); }
}

/* Confirm modal */
#appConfirmOverlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#appConfirmOverlay.is-open {
  display: flex;
}

.app-confirm-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
  padding: 22px 22px 18px;
  animation: appAlertIn 0.2s ease;
}

.app-confirm-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.app-confirm-head .app-alert-icon {
  background: #d97706;
}

.app-confirm-head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
}

.app-confirm-message {
  margin: 0 0 18px;
  color: #475569;
  font-size: 0.95rem;
  line-height: 1.45;
}

.app-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.app-confirm-actions button {
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
}

.app-confirm-cancel {
  background: #f1f5f9;
  color: #334155;
}

.app-confirm-cancel:hover {
  background: #e2e8f0;
}

.app-confirm-ok {
  background: #4f46e5;
  color: #fff;
}

.app-confirm-ok:hover {
  background: #4338ca;
}

.app-confirm-ok.is-danger {
  background: #dc2626;
}

.app-confirm-ok.is-danger:hover {
  background: #b91c1c;
}

@media (max-width: 576px) {
  #appAlertStack {
    top: 12px;
    right: 12px;
    left: 12px;
    width: auto;
  }
}
