/* =====================================================================
   Notifications (toasts) and the consent dialog. Brand: cream cards, gold accent,
   semantic icon colours. Top-right on desktop, full width under the app bar on phones.
   ===================================================================== */

/* ---------- toasts ---------- */
.toasts { position: fixed; z-index: 2000; top: 1rem; right: 1rem; width: min(400px, calc(100vw - 2rem)); display: flex; flex-direction: column; gap: .65rem; pointer-events: none; }
.toast-card {
  --tone: var(--brand-forest); --tone-soft: #eef4f1; --ms: 6000ms;
  position: relative; overflow: hidden; pointer-events: auto;
  display: grid; grid-template-columns: auto 1fr auto; gap: .8rem; align-items: start;
  padding: .85rem .8rem .95rem .9rem; background: #fff; border: 1px solid var(--border-color); border-left: 5px solid var(--tone);
  border-radius: 16px; box-shadow: 0 14px 36px rgba(33, 60, 56, .22), 0 2px 6px rgba(33, 60, 56, .08);
  animation: toast-in .42s var(--ease) both;
}
.toast-card--success { --tone: #1f8a52; --tone-soft: #e6f4ea; }
.toast-card--info { --tone: #2d6d96; --tone-soft: #e9f1f6; }
.toast-card--warning { --tone: #c98d4a; --tone-soft: #fff3df; }
.toast-card--error { --tone: #c0392b; --tone-soft: #fdeeed; }
.toast-card__icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--tone-soft); color: var(--tone); font-size: 1.15rem; }
.toast-card--warning .toast-card__icon { color: #9a6425; }
.toast-card__body { min-width: 0; padding-top: .05rem; }
.toast-card__body strong { display: block; font-size: .92rem; line-height: 1.25; color: var(--brand-forest); }
.toast-card__body p { margin: .2rem 0 0; font-size: .86rem; line-height: 1.4; color: var(--text-body); white-space: pre-line; overflow-wrap: anywhere; }
.toast-card__close { width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--text-muted); cursor: pointer; transition: background .15s, color .15s; }
.toast-card__close:hover { background: #f1e9da; color: var(--brand-forest); }
.toast-card__bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--tone); opacity: .55; transform-origin: left; animation: toast-bar var(--ms) linear forwards; }
.toast-card.is-paused .toast-card__bar { animation-play-state: paused; }
.toast-card.is-leaving { animation: toast-out .3s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(28px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(28px) scale(.97); } }
@keyframes toast-bar { from { transform: scaleX(1); } to { transform: scaleX(0); } }

@media (max-width: 767px) {
  .toasts { top: calc(var(--safe-top) + 68px); left: .75rem; right: .75rem; width: auto; }
  @keyframes toast-in { from { opacity: 0; transform: translateY(-16px) scale(.98); } to { opacity: 1; transform: none; } }
  @keyframes toast-out { to { opacity: 0; transform: translateY(-16px) scale(.98); } }
}
.auth-body .toasts { top: 1rem; }
@media (prefers-reduced-motion: reduce) { .toast-card, .toast-card.is-leaving { animation: none; } .toast-card__bar { display: none; } }

/* ---------- consent dialog ---------- */
body.consent-lock { overflow: hidden; }
.consent { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; padding: 1rem; opacity: 0; transition: opacity .18s ease; }
.consent[hidden] { display: none; }
.consent.is-open { opacity: 1; }
.consent__backdrop { position: absolute; inset: 0; background: rgba(27, 55, 50, .55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.consent__dialog {
  --tone: #b3261e; --tone-soft: #fdeeed;
  position: relative; width: min(460px, 100%); max-height: calc(100dvh - 2rem); overflow-y: auto; outline: none;
  padding: 1.6rem 1.5rem 1.3rem; text-align: center; background: var(--brand-cream); border-radius: 26px; box-shadow: 0 34px 90px rgba(33, 60, 56, .45);
  transform: translateY(18px) scale(.96); transition: transform .28s var(--ease);
}
.consent.is-open .consent__dialog { transform: none; }
.consent--warn .consent__dialog { --tone: #c98d4a; --tone-soft: #fff3df; }
.consent--info .consent__dialog { --tone: #0b7551; --tone-soft: #e6f4ea; }
.consent__icon { display: inline-grid; place-items: center; width: 68px; height: 68px; margin-bottom: .7rem; border-radius: 22px; background: var(--tone-soft); color: var(--tone); font-size: 1.9rem; box-shadow: 0 0 0 8px color-mix(in srgb, var(--tone) 12%, transparent); }
.consent--warn .consent__icon { color: #9a6425; }
.consent__title { margin: 0 0 .4rem; font-size: 1.4rem; line-height: 1.2; color: var(--brand-forest); font-family: var(--font-display); }
.consent__msg { margin: 0 0 .9rem; color: var(--text-body); line-height: 1.5; }
.consent__details { list-style: none; margin: 0 0 1rem; padding: .75rem .9rem; text-align: left; background: var(--tone-soft); border: 1px solid color-mix(in srgb, var(--tone) 25%, transparent); border-radius: 14px; display: grid; gap: .35rem; }
.consent__details li { position: relative; padding-left: 1.5rem; font-size: .88rem; color: var(--text-body); }
.consent__details li::before { content: "\F623"; font-family: "bootstrap-icons"; position: absolute; left: 0; top: .02rem; color: var(--tone); }
.consent--warn .consent__details li::before, .consent--info .consent__details li::before { content: "\F26A"; }
.consent__type { text-align: left; margin: 0 0 .9rem; }
.consent__type label { display: block; margin-bottom: .35rem; font-size: .84rem; font-weight: 600; color: var(--brand-brown); }
.consent__type code { padding: .08rem .45rem; border-radius: 8px; background: #f1e9da; color: var(--brand-forest); font-weight: 700; font-size: .92em; }
.consent__type input { width: 100%; min-height: 48px; padding: .55rem .9rem; border: 1.5px solid #d5c9b4 !important; border-radius: 12px !important; background: #fff !important; font-size: 16px; font-family: var(--font-mono); letter-spacing: .04em; }
.consent__type input:focus { border-color: var(--tone) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone) 30%, transparent); outline: none; }
.consent__note { margin: -.2rem 0 1rem; font-size: .8rem; color: var(--text-muted); display: flex; gap: .4rem; justify-content: center; align-items: flex-start; text-align: left; }
.consent__note::before { content: "\F431"; font-family: "bootstrap-icons"; color: var(--brand-green); }
.consent__actions { display: flex; gap: .6rem; }
.consent__actions .btn { flex: 1; min-height: 50px; }
.consent__actions .btn[disabled] { opacity: .45; cursor: not-allowed; }
@media (max-width: 767px) {
  .consent { place-items: end center; padding: 0; }
  .consent__dialog { width: 100%; border-radius: 26px 26px 0 0; padding-bottom: calc(1.3rem + var(--safe-bottom)); transform: translateY(100%); }
  .consent.is-open .consent__dialog { transform: none; }
}
@media (prefers-reduced-motion: reduce) { .consent, .consent__dialog { transition: none; } }
