:root {
  --ib-success: #059669;
  --ib-success-bg: #ecfdf5;
  --ib-success-border: #a7f3d0;
  --ib-error: #dc2626;
  --ib-error-bg: #fef2f2;
  --ib-error-border: #fecaca;
  --ib-warning: #d97706;
  --ib-warning-bg: #fffbeb;
  --ib-warning-border: #fde68a;
  --ib-info: #2563eb;
  --ib-info-bg: #eff6ff;
  --ib-info-border: #bfdbfe;
  --ib-shadow: 0 10px 40px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  --ib-radius: 14px;
}

.ib-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 420px;
  width: 100%;
}

.ib-toast {
  pointer-events: auto;
  background: #fff;
  border-radius: var(--ib-radius);
  box-shadow: var(--ib-shadow);
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  border-left: 4px solid transparent;
  animation: ibSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.ib-toast.ib-out { animation: ibSlideOut 0.25s ease forwards; }

@keyframes ibSlideIn {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes ibSlideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(120%); opacity: 0; }
}

@keyframes ibFadeIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes ibFadeOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.95) translateY(10px); }
}

.ib-toast.ib-success { border-left-color: var(--ib-success); }
.ib-toast.ib-error { border-left-color: var(--ib-error); }
.ib-toast.ib-warning { border-left-color: var(--ib-warning); }
.ib-toast.ib-info { border-left-color: var(--ib-info); }

.ib-toast-icon {
  width: 32px; height: 32px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}

.ib-toast.ib-success .ib-toast-icon { background: var(--ib-success-bg); color: var(--ib-success); }
.ib-toast.ib-error .ib-toast-icon { background: var(--ib-error-bg); color: var(--ib-error); }
.ib-toast.ib-warning .ib-toast-icon { background: var(--ib-warning-bg); color: var(--ib-warning); }
.ib-toast.ib-info .ib-toast-icon { background: var(--ib-info-bg); color: var(--ib-info); }

.ib-toast-body { flex: 1; min-width: 0; }
.ib-toast-title { font-size: 0.88rem; font-weight: 700; color: #0f172a; margin-bottom: 2px; }
.ib-toast-msg { font-size: 0.82rem; color: #475569; line-height: 1.4; }
.ib-toast-close {
  background: none; border: none; color: #94a3b8; cursor: pointer;
  padding: 2px; border-radius: 6px; transition: all 0.15s;
  flex-shrink: 0; line-height: 1;
}
.ib-toast-close:hover { background: #f1f5f9; color: #475569; }

.ib-toast-progress {
  position: absolute; bottom: 0; left: 0; height: 3px;
  border-radius: 0 0 0 var(--ib-radius);
  animation: ibShrink linear forwards;
}
.ib-success .ib-toast-progress { background: var(--ib-success); }
.ib-error .ib-toast-progress { background: var(--ib-error); }
.ib-warning .ib-toast-progress { background: var(--ib-warning); }
.ib-info .ib-toast-progress { background: var(--ib-info); }

@keyframes ibShrink {
  from { width: 100%; }
  to { width: 0%; }
}

.ib-modal-overlay {
  position: fixed; inset: 0; z-index: 99998;
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  animation: ibOverlayIn 0.2s ease;
  overscroll-behavior: contain;
}

@keyframes ibOverlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ib-modal-overlay.ib-out { animation: ibOverlayOut 0.2s ease forwards; }
@keyframes ibOverlayOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.ib-modal {
  background: #fff; border-radius: 18px;
  box-shadow: 0 25px 80px rgba(0,0,0,0.2);
  width: 90%; max-width: 440px;
  animation: ibFadeIn 0.3s cubic-bezier(0.16,1,0.3,1);
  overflow: hidden;
  overscroll-behavior: contain;
}

.ib-modal.ib-out { animation: ibFadeOut 0.2s ease forwards; }

.ib-modal-header {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 24px 0;
}

.ib-modal-icon {
  width: 44px; height: 44px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}

.ib-modal.ib-success .ib-modal-icon { background: var(--ib-success-bg); color: var(--ib-success); }
.ib-modal.ib-error .ib-modal-icon { background: var(--ib-error-bg); color: var(--ib-error); }
.ib-modal.ib-warning .ib-modal-icon { background: var(--ib-warning-bg); color: var(--ib-warning); }
.ib-modal.ib-info .ib-modal-icon { background: var(--ib-info-bg); color: var(--ib-info); }

.ib-modal-title { font-size: 1rem; font-weight: 700; color: #0f172a; }

.ib-modal-body { padding: 8px 24px 20px; font-size: 0.88rem; color: #475569; line-height: 1.5; max-height: 60vh; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; }

.ib-modal-footer {
  padding: 0 24px 20px;
  display: flex; justify-content: flex-end; gap: 10px;
}

.ib-btn {
  border: none; border-radius: 10px; padding: 9px 20px;
  font-size: 0.85rem; font-weight: 600; cursor: pointer;
  transition: all 0.15s; display: inline-flex; align-items: center; gap: 8px;
}

.ib-btn:hover { transform: translateY(-1px); }
.ib-btn:active { transform: translateY(0); }

.ib-btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff; box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}
.ib-btn-primary:hover { box-shadow: 0 6px 20px rgba(37,99,235,0.4); }

.ib-btn-secondary {
  background: #f1f5f9; color: #475569;
}
.ib-btn-secondary:hover { background: #e2e8f0; }

.ib-btn-success {
  background: linear-gradient(135deg, #059669, #047857);
  color: #fff; box-shadow: 0 4px 12px rgba(5,150,105,0.3);
}

.ib-btn-danger {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #fff; box-shadow: 0 4px 12px rgba(220,38,38,0.3);
}
