/* === Toasts ===============================================================
   Aviso flutuante, fora do fluxo da página.

   O sistema antigo (faixa de mensagens no topo do <main>) ocupava altura real:
   numa tela de altura fixa como o detalhe do chamado do N2, cada aviso empurrava
   o conteúdo e os botões do rodapé saíam da área visível. Toast não empilha
   layout — aparece por cima, some sozinho e não desloca nada.

   Tokens próprios porque os três shells usam mecanismos de tema diferentes:
   :root.dark/.light (N1 e N2) e [data-theme="dark"] (layout clássico).
   ========================================================================= */

.toasts {
  --toast-bg: rgba(255, 255, 255, .94);
  --toast-brd: rgba(15, 40, 70, .14);
  --toast-ink: #14293f;
  --toast-ink2: #5b7288;
  --toast-shadow: 0 12px 32px rgba(12, 30, 50, .16), 0 2px 8px rgba(12, 30, 50, .08);
  --toast-success: #0aa877;
  --toast-error: #e0525f;
  --toast-warning: #c78908;
  --toast-info: #3d7fd6;

  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(380px, calc(100vw - 28px));
  pointer-events: none;   /* o clique atravessa a área vazia da pilha */
}

:root.dark .toasts,
:root[data-theme="dark"] .toasts,
[data-theme="dark"] .toasts {
  --toast-bg: rgba(16, 27, 42, .94);
  --toast-brd: rgba(150, 200, 230, .18);
  --toast-ink: #eaf6ff;
  --toast-ink2: #94aac6;
  --toast-shadow: 0 14px 36px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .3);
  --toast-success: #33e6b0;
  --toast-error: #ff6b7d;
  --toast-warning: #ffcb52;
  --toast-info: #6fb2ff;
}

.toast {
  --cor: var(--toast-info);
  position: relative;
  display: grid;
  grid-template-columns: 18px 1fr 18px;
  align-items: start;
  gap: 10px;
  padding: 12px 13px 13px;
  border: 1px solid var(--toast-brd);
  border-left: 3px solid var(--cor);
  border-radius: 12px;
  background: var(--toast-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--toast-shadow);
  color: var(--toast-ink);
  font-size: .855rem;
  line-height: 1.45;
  pointer-events: auto;
  overflow: hidden;
  animation: toast-in .22s cubic-bezier(.2, .8, .3, 1);
}

.toast.success { --cor: var(--toast-success); }
.toast.error   { --cor: var(--toast-error); }
.toast.warning { --cor: var(--toast-warning); }
.toast.info,
.toast.debug   { --cor: var(--toast-info); }

.toast .ic {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  color: var(--cor);
  flex: 0 0 auto;
}
.toast .ic svg { width: 100%; height: 100%; display: block; }

.toast .tx { min-width: 0; word-wrap: break-word; }
.toast .tx a { color: var(--cor); }

.toast .qtd {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--cor) 20%, transparent);
  color: var(--cor);
  font-size: .72rem;
  font-weight: 600;
  vertical-align: 1px;
}

.toast .x {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--toast-ink2);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  opacity: .7;
}
.toast .x:hover { opacity: 1; background: color-mix(in srgb, var(--toast-ink) 8%, transparent); }
.toast .x:focus-visible { outline: 2px solid var(--cor); outline-offset: 1px; }

/* Régua do tempo restante: o aviso não some sem avisar que vai sumir. */
.toast .bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  transform-origin: left;
  background: var(--cor);
  opacity: .45;
  animation: toast-bar linear forwards;
}
.toast:hover .bar,
.toast:focus-within .bar { animation-play-state: paused; }

.toast.saindo {
  animation: toast-out .18s ease forwards;
}

@keyframes toast-in  { from { opacity: 0; transform: translateY(-10px) scale(.98); } }
@keyframes toast-out { to   { opacity: 0; transform: translateX(14px); } }
@keyframes toast-bar { to   { transform: scaleX(0); } }

@media (max-width: 560px) {
  .toasts { top: 10px; right: 10px; left: 10px; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .toast, .toast.saindo { animation: none; }
  .toast .bar { animation-duration: 0s; }
}

@media print { .toasts { display: none; } }

/* A carga vinda do servidor é só dado para o JS — nunca ocupa espaço. */
#djangoToasts { display: none !important; }
