.toast-stack {
  position:fixed; z-index:100; top:76px; right:24px;
  width:min(420px, calc(100vw - 32px)); max-height:calc(100dvh - 110px);
  display:flex; flex-direction:column; gap:12px; overflow-y:auto;
  padding:4px; pointer-events:none;
}
.toast {
  --toast-accent:#30486d;
  position:relative;
  display:flex; align-items:flex-start; gap:14px; flex-shrink:0;
  padding:16px 12px 16px 18px; background:#fff; color:#27303d;
  border:1px solid #d8dee7; border-left:4px solid var(--toast-accent);
  border-radius:12px; box-shadow:0 8px 28px #161f2d24;
  font-size:14px; line-height:1.5; pointer-events:auto;
  animation:toast-arrive 180ms ease-out both;
  overflow:hidden;
}
.toast-life {
  position:absolute; left:0; right:0; bottom:0; height:3px;
  background:var(--toast-accent); opacity:.55;
  transform-origin:left center; transform:scaleX(1);
  pointer-events:none;
}
.toast.success { --toast-accent:#3b547a; background:#f5f8fc; }
.toast.warning { --toast-accent:#ae7417; background:#fffbef; }
.toast.error { --toast-accent:#bd454a; background:#fff6f6; }
.toast.info { --toast-accent:#477bb1; background:#f6faff; }
.toast-content { flex:1; min-width:0; overflow-wrap:anywhere; }
.toast .toast-close {
  flex:0 0 36px; width:36px; height:36px; min-height:36px;
  padding:0; margin:-6px 0 -6px; border:0; border-radius:8px;
  background:transparent; color:inherit; font-size:24px; line-height:1; cursor:pointer;
}
.toast .toast-close:hover { background:#27303d10; }
.toast .toast-close:focus-visible { outline:2px solid var(--toast-accent); outline-offset:2px; }
.toast.toast-leaving { animation:toast-depart 150ms ease-in forwards; }
@keyframes toast-arrive { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:translateY(0); } }
@keyframes toast-depart { to { opacity:0; transform:translateX(12px); } }
@media(max-width:700px) {
  .toast-stack { top:auto; right:12px; bottom:calc(12px + env(safe-area-inset-bottom)); width:calc(100vw - 24px); max-height:45dvh; }
  .toast .toast-close { flex-basis:44px; width:44px; height:44px; min-height:44px; }
}
@media(prefers-reduced-motion:reduce) { .toast,.toast.toast-leaving { animation:none; } }

.reprocess-action { display:flex; flex-direction:column; align-items:flex-start; gap:6px; margin:0; }
.reprocess-action small { max-width:240px; line-height:1.4; font-size:12px; }

.reading-spinner { display:inline-block; width:16px; height:16px; margin-right:8px; border:2px solid currentColor; border-right-color:transparent; border-radius:50%; vertical-align:middle; animation:reading-spin .8s linear infinite; }
.reading-spinner[hidden] { display:none; }
.reprocess-action { margin-bottom:14px; }
@keyframes reading-spin { to { transform:rotate(360deg); } }
@media(prefers-reduced-motion:reduce) { .reading-spinner { animation:none; } }
