/* ============================================================================
 * theme-dealworthit-notify.css
 * Unified toast notifications + confirmation modal, ported from the approved
 * design (notifications-redesign.html). Drives dwi-notify.js.
 *
 * Self-contained palette (mirrors the design file) so it reads identically
 * regardless of the cyan/emerald token wiring; emerald #0E6E59 is the brand
 * success/primary accent. Typeface is the app's IBM Plex Sans.
 * ==========================================================================*/
:root{
  --dwin-emerald:#0E6E59; --dwin-emerald-tint:#E7F1ED; --dwin-emerald-line:#CADFD7;
  --dwin-ink-900:#10211C; --dwin-ink-700:#3B4641; --dwin-ink-600:#586159; --dwin-ink-500:#727A73; --dwin-ink-300:#B9BEB8;
  --dwin-surface:#FFFFFF; --dwin-surface-2:#FBFBF9;
  --dwin-line:#E9E9E4; --dwin-line-strong:#DEDED7;
  --dwin-sans:"IBM Plex Sans",system-ui,-apple-system,"Segoe UI",sans-serif;
}

/* ============ TOASTS ============ */
.toast-host{
  position:fixed; top:18px; right:18px; z-index:11000;
  display:flex; flex-direction:column; gap:11px;
  width:374px; max-width:calc(100vw - 36px); pointer-events:none;
  font-family:var(--dwin-sans);
}
.toast-host .toast{
  position:relative; display:flex; gap:12px; align-items:flex-start;
  background:var(--dwin-surface); border:1px solid var(--dwin-line);
  border-radius:13px; box-shadow:0 14px 34px -10px rgba(16,33,28,.20), 0 3px 8px rgba(16,33,28,.05);
  padding:13px 12px 14px 14px; overflow:hidden; pointer-events:auto;
  animation:dwin-toastIn .26s cubic-bezier(.2,.85,.25,1);
}
.toast-host .t-ic{
  width:30px; height:30px; border-radius:8px;
  background:var(--accent-bg); color:var(--accent);
  display:grid; place-items:center; flex-shrink:0; margin-left:3px;
}
.toast-host .t-main{ flex:1; min-width:0; padding-top:1px; }
.toast-host .t-title{ font-size:13.5px; font-weight:600; color:var(--dwin-ink-900); line-height:1.35; }
.toast-host .t-desc{ font-size:12.5px; color:var(--dwin-ink-500); margin-top:3px; line-height:1.5; word-wrap:break-word; }
.toast-host .t-actions{ margin-top:11px; display:flex; gap:8px; flex-wrap:wrap; }
.toast-host .t-actions button{
  font-size:12.5px; font-weight:500; padding:6px 11px; border-radius:7px;
  border:1px solid var(--dwin-line-strong); background:var(--dwin-surface);
  color:var(--dwin-ink-700); cursor:pointer; font-family:inherit;
}
.toast-host .t-actions button:hover{ background:var(--dwin-surface-2); }
.toast-host .t-actions button.primary{ color:var(--accent); border-color:var(--accent-line); background:var(--accent-bg); }
.toast-host .t-close{
  width:24px; height:24px; border-radius:6px; border:0; background:transparent;
  color:var(--dwin-ink-300); display:grid; place-items:center; flex-shrink:0; cursor:pointer; padding:0;
}
.toast-host .t-close:hover{ background:var(--dwin-surface-2); color:var(--dwin-ink-600); }
.toast-host .t-bar{ position:absolute; left:0; right:0; bottom:0; height:2.5px; }
.toast-host .t-bar i{
  display:block; height:100%; width:100%; background:var(--accent); opacity:.45;
  transform-origin:left; animation:dwin-shrink var(--dur,4800ms) linear forwards;
}
.toast-host .toast.paused .t-bar i{ animation-play-state:paused; }
.toast-host .toast.leaving{ animation:dwin-toastOut .2s ease forwards; }

/* status accents (shared by toast + confirm modal) */
.s-success{ --accent:#0E6E59; --accent-bg:#E7F1ED; --accent-line:#CADFD7; }
.s-error{   --accent:#9A3526; --accent-bg:#F6E7E3; --accent-line:#E9C9C1; }
.s-warning{ --accent:#8A6212; --accent-bg:#F6EFDD; --accent-line:#E7D8B0; }
.s-info{    --accent:#2C5A8A; --accent-bg:#E6EEF6; --accent-line:#C3D6E8; }
.s-loading{ --accent:#586159; --accent-bg:#F1F1ED; --accent-line:#E0E0DA; }

@keyframes dwin-toastIn{ from{ opacity:0; transform:translateX(18px) scale(.97);} to{ opacity:1; transform:none; } }
@keyframes dwin-toastOut{ to{ opacity:0; transform:translateX(18px); } }
@keyframes dwin-shrink{ from{ transform:scaleX(1);} to{ transform:scaleX(0);} }
.toast-host .spin{ animation:dwin-spin .8s linear infinite; transform-origin:center; }
@keyframes dwin-spin{ to{ transform:rotate(360deg);} }

/* ============ CONFIRMATION MODAL ============ */
.dwi-confirm-overlay{
  position:fixed; inset:0; z-index:11050;
  display:grid; place-items:center; padding:24px;
  background:rgba(16,33,28,.34);
  backdrop-filter:saturate(110%) blur(2px);
  font-family:var(--dwin-sans);
  animation:dwin-overlayIn .18s ease;
}
.dwi-confirm-overlay.leaving{ animation:dwin-overlayOut .16s ease forwards; }
body.dwi-confirm-open{ overflow:hidden; }

.dwi-confirm{
  width:100%; max-width:440px;
  display:flex; gap:14px; align-items:flex-start;
  background:var(--dwin-surface); border:1px solid var(--dwin-line);
  border-radius:16px; box-shadow:0 24px 60px -18px rgba(16,33,28,.40), 0 6px 16px rgba(16,33,28,.10);
  padding:22px 22px 20px; overflow:hidden;
  animation:dwin-cardIn .22s cubic-bezier(.2,.85,.25,1);
}
.dwi-confirm-overlay.leaving .dwi-confirm{ animation:dwin-cardOut .16s ease forwards; }
.dwi-confirm .dc-ic{
  width:38px; height:38px; border-radius:10px;
  background:var(--accent-bg); color:var(--accent);
  display:grid; place-items:center; flex-shrink:0; margin-top:1px;
}
.dwi-confirm .dc-main{ flex:1; min-width:0; }
.dwi-confirm .dc-title{ font-size:16px; font-weight:600; color:var(--dwin-ink-900); line-height:1.3; letter-spacing:-.2px; }
.dwi-confirm .dc-desc{ font-size:13.5px; color:var(--dwin-ink-600); margin-top:7px; line-height:1.55; }
/* Embedded body (raw markup carried over from former Swal `html:` dialogs) */
.dwi-confirm .dc-body{ font-size:13.5px; color:var(--dwin-ink-600); margin-top:9px; line-height:1.55; }
.dwi-confirm .dc-body :last-child{ margin-bottom:0; }
/* Modal inputs (text / checkbox prompts) */
.dwi-confirm .dc-input-text{
  width:100%; margin-top:12px; padding:9px 12px; font-size:13.5px; font-family:inherit;
  color:var(--dwin-ink-900); background:var(--dwin-surface);
  border:1px solid var(--dwin-line-strong); border-radius:9px;
}
.dwi-confirm textarea.dc-input-text{ min-height:80px; resize:vertical; }
.dwi-confirm .dc-input-text:focus{ outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-bg); }
.dwi-confirm .dc-check{ display:flex; align-items:center; gap:9px; margin-top:13px; font-size:13.5px; color:var(--dwin-ink-700); cursor:pointer; }
.dwi-confirm .dc-check input{ width:16px; height:16px; accent-color:var(--dwin-emerald); }
/* Inline validation message (Swal.showValidationMessage parity): shown by a
   preConfirm hook that returns false, so the modal stays open behind it. */
.dwi-confirm .dc-validation{ margin-top:14px; padding:9px 12px; border-radius:8px; font-size:13px; font-weight:500; line-height:1.45; color:#9A3526; background:#F6E7E3; border:1px solid #E9C9C1; }
.dwi-confirm .dc-actions{ margin-top:20px; display:flex; gap:10px; justify-content:flex-end; }
.dwi-confirm .dc-actions button{
  font-size:13.5px; font-weight:600; padding:9px 16px; border-radius:9px;
  cursor:pointer; font-family:inherit; transition:filter .12s, background .12s, border-color .12s;
}
.dwi-confirm .dc-cancel{
  border:1px solid var(--dwin-line-strong); background:var(--dwin-surface); color:var(--dwin-ink-700);
}
.dwi-confirm .dc-cancel:hover{ background:var(--dwin-surface-2); }
.dwi-confirm .dc-confirm{
  border:1px solid var(--dwin-emerald); background:var(--dwin-emerald); color:#fff;
}
.dwi-confirm .dc-confirm:hover{ filter:brightness(.94); }
/* destructive: red confirm regardless of icon accent */
.dwi-confirm.is-destructive .dc-confirm{ background:#9A3526; border-color:#9A3526; }
.dwi-confirm .dc-actions button:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }

/* Unit-mismatch dialog variant (rent-roll add/edit guard + import
   reconciliation — customClass.popup:'dwi-um-pop'). The dialog carries its
   own header chip inside the body markup, so the card's accent icon is
   hidden; the footer spreads "Decide later" (left) / primary (right). */
.dwi-confirm.dwi-um-pop{ max-width:560px; padding:22px 22px 16px; }
.dwi-confirm.dwi-um-pop .dc-ic{ display:none; }
.dwi-confirm.dwi-um-pop .dc-body{ margin-top:0; color:inherit; }
.dwi-confirm.dwi-um-pop .dc-actions{ justify-content:space-between; align-items:center; margin-top:14px; padding-top:13px; border-top:1px solid var(--dwin-line); }
.dwi-confirm.dwi-um-pop .dc-cancel{ border:none; background:transparent; color:var(--dwin-ink-600); padding:9px 6px; font-size:13px; }
.dwi-confirm.dwi-um-pop .dc-cancel:hover{ background:transparent; color:var(--dwin-ink-900); }
.dwi-confirm.dwi-um-pop .dc-confirm{ padding:9px 18px; font-size:13px; border-radius:9px; }

@keyframes dwin-overlayIn{ from{ opacity:0; } to{ opacity:1; } }
@keyframes dwin-overlayOut{ to{ opacity:0; } }
@keyframes dwin-cardIn{ from{ opacity:0; transform:translateY(10px) scale(.97); } to{ opacity:1; transform:none; } }
@keyframes dwin-cardOut{ to{ opacity:0; transform:translateY(6px) scale(.98); } }

/* ============ MOTION-REDUCE ============ */
@media (prefers-reduced-motion: reduce){
  .toast-host .toast, .toast-host .toast.leaving,
  .dwi-confirm-overlay, .dwi-confirm-overlay.leaving,
  .dwi-confirm, .dwi-confirm-overlay.leaving .dwi-confirm,
  .toast-host .spin{ animation:none !important; }
  .toast-host .t-bar i{ animation:dwin-shrink var(--dur,4800ms) linear forwards; } /* keep auto-dismiss timing */
}

@media (max-width:680px){
  .toast-host{ left:18px; right:18px; width:auto; }
}

/* ── Narrow screens: the dialog must never clip its own way out ──────────
   .dc-actions is a NON-WRAPPING flex row justified to flex-end, inside a card
   that carries overflow:hidden (needed for the rounded corners and the entry
   animation). Once the buttons are collectively wider than the row, flex-end
   pins them to the right and the overflow leaves by the LEFT edge — where the
   card clips it away with no scrollbar to recover it. The leftmost button is
   Cancel: the only pointer-operable way to dismiss the dialog.

   At 390px the row is genuinely that narrow. The overlay's 24px padding and the
   card's 22px padding take 92px, the 38px status icon and its 14px gap take 52
   more, leaving about 246px for two buttons whose labels the caller chooses —
   "Keep editing" beside "Discard changes" already exceeds it. Escape still
   closes the dialog, but a touch user has no Escape key, so the dismiss control
   simply is not reachable.

   Wrapping is the narrowest fix: each button takes its own full-width row, both
   stay on screen, and both become comfortable touch targets. DOM order is
   unchanged, so the tab order and the focus trap are unaffected. Every rule here
   is inside the query — desktop rendering is byte-identical. */
@media (max-width:480px){
  .dwi-confirm-overlay{ padding:16px; }
  .dwi-confirm{ padding:18px 16px 16px; gap:12px; }
  .dwi-confirm .dc-actions{ flex-wrap:wrap; }
  .dwi-confirm .dc-actions button{ flex:1 1 100%; min-height:44px; }
  /* The Swal-shim variant spaces its actions apart on wide screens; wrapped,
     that would leave a full-width button pretending to be two. */
  .dwi-confirm.dwi-um-pop .dc-actions{ justify-content:flex-end; }
  .dwi-confirm.dwi-um-pop .dc-cancel{ padding:9px 16px; }
}
