/* =============================================================================
 * vault/states.css: the shared dialog, the toast and the system states (banner, empty, loading) on the PackOS
 * components, as in the approved canvas boards Actions and States (claude.ai artifact 24Xsn7UPqjGSVaytAxq4RL).
 *
 * #modal and #toast keep the markup app.mjs gives them (modal(), toast() and the callers that add to #toast). The rep
 * shell is told apart by body.vui, which the Vault shell (#697) puts on <body> exactly when the rep workspace is on;
 * the classic shell is untouched.
 *
 * Inside #modal, element rules sit in :where() so they weigh the same as styles.css's bare `button`/`dialog h2` and
 * a caller's own class rules still win; the frame, the close button, the toast and the leave dialog are stated
 * with body.vui and their id. The toast's height above sticky bars stays styles.css's (--toast-lift, set by
 * liftToast() at run time); this sheet does not read it. Sizes, radii and colours are tokens (design-drift).
 * ========================================================================== */

/* ── The dialog frame (#modal, filled by modal()) ──────────── */
body.vui #modal{box-sizing:border-box;width:min(560px,calc(100% - 32px));max-width:none;max-height:calc(100vh - 48px);overflow:auto;padding:var(--space-5) var(--space-5) var(--space-5);border:1px solid var(--border-hairline);border-radius:var(--radius-card);background:var(--surface-card);box-shadow:var(--shadow-4);color:var(--text-body);font-family:var(--font-sans);font-size:var(--fs-body-s);line-height:1.5}
body.vui #modal[open]{animation:pk-dialog var(--dur-base) var(--ease-out) both}
body.vui :is(#modal,#unsaved-dialog)::backdrop{background:var(--scrim);backdrop-filter:none}
body.vui #modal>.modal-close{display:inline-grid;place-items:center;float:right;width:30px;height:30px;min-height:0;margin:-6px -6px var(--space-2) var(--space-3);padding:0;border:1px solid var(--border-strong);border-radius:var(--radius-s);background:var(--surface-card);color:var(--text-body);font-size:var(--fs-h3);line-height:1;cursor:pointer}
body.vui #modal>.modal-close:hover{background:var(--surface-sunken)}
:where(body.vui) #modal :is(h2,h3){margin:0 0 var(--space-2);font-size:var(--fs-title);line-height:1.25;font-weight:var(--fw-semibold);letter-spacing:-.015em;color:var(--text-body)}
:where(body.vui) #modal .eyebrow{font-family:var(--font-mono);font-size:var(--fs-label);font-weight:var(--fw-semibold);letter-spacing:var(--tracking-label);text-transform:uppercase;color:var(--text-muted)}
:where(body.vui) #modal :is(.sub,.small,.muted){color:var(--text-muted)}
:where(body.vui #modal) button{min-height:var(--control-h-m);padding:0 var(--space-4);border:1px solid var(--border-strong);border-radius:var(--radius-pill);background:var(--surface-card);color:var(--text-body);font-family:var(--font-sans);font-size:var(--fs-body-s);font-weight:var(--fw-semibold)}
:where(body.vui #modal) button.primary{background:var(--teal-500);border-color:var(--teal-500);color:var(--text-on-accent)}
:where(body.vui #modal) :is(input:not([type=checkbox]):not([type=radio]),select,textarea){border:1px solid var(--border-strong);border-radius:var(--radius-m);background:var(--surface-card);color:var(--text-body)}
:where(body.vui #modal) :is(input,select,textarea):focus{border-color:var(--teal-500);box-shadow:var(--focus-input);outline:none}

/* ── The leave dialog (confirmLeave): the same frame ───────── */
body.vui #unsaved-dialog.leave-dialog{width:min(480px,calc(100% - 32px));padding:var(--space-5);border:1px solid var(--border-hairline);border-radius:var(--radius-card);background:var(--surface-card);box-shadow:var(--shadow-4);color:var(--text-body);font-family:var(--font-sans);font-size:var(--fs-body-s)}
:where(body.vui) #unsaved-dialog h2{margin:0 0 var(--space-2);font-size:var(--fs-title);font-weight:var(--fw-semibold);letter-spacing:-.015em}
:where(body.vui) #unsaved-dialog p{color:var(--text-muted)}
:where(body.vui #unsaved-dialog) button{min-height:var(--control-h-m);padding:0 var(--space-4);border:1px solid var(--border-strong);border-radius:var(--radius-pill);background:var(--surface-card);color:var(--text-body);font-size:var(--fs-body-s);font-weight:var(--fw-semibold)}
:where(body.vui #unsaved-dialog) button.leave-ghost{border-color:transparent;background:transparent}
:where(body.vui #unsaved-dialog) button.primary{background:var(--teal-500);border-color:var(--teal-500);color:var(--text-on-accent)}

/* ── The toast (#toast, filled by toast() and its callers): bottom-right, ink, tone on the left edge ── */
/* Hoverable (styles.css makes a plain confirmation click-through), so hovering can hold it; it is a small card in
   the corner, so it covers little. */
body.vui #toast{pointer-events:auto;left:auto;right:24px;transform:none;box-sizing:border-box;align-items:center;gap:var(--space-3);min-width:280px;max-width:400px;padding:var(--space-3) var(--space-4);border-left:2px solid var(--teal-500);border-radius:var(--radius-m);background:var(--ink-900);color:var(--paper-100);box-shadow:var(--shadow-3);font-family:var(--font-sans);font-size:var(--fs-body-s);line-height:1.45;z-index:var(--z-toast)}
body.vui #toast.error{background:var(--ink-900);border-left-color:var(--coral-500)}
body.vui #toast .toast-text{flex:1 1 auto;min-width:0}
body.vui #toast .toast-undo{flex:none;min-height:0;margin:0 0 0 auto;padding:var(--space-1) var(--space-2);border:0;border-radius:var(--radius-s);background:transparent;color:var(--teal-400);font-size:var(--fs-caption);font-weight:var(--fw-semibold);text-decoration:underline;text-underline-offset:3px}
body.vui #toast .toast-dismiss{flex:none;display:inline-grid;place-items:center;width:28px;height:28px;min-height:0;margin:0 0 0 auto;padding:0;border:0;border-radius:var(--radius-s);background:transparent;color:var(--text-on-ink-muted)}
body.vui #toast :is(.toast-undo,.toast-dismiss):hover{background:var(--ink-700)}
body.vui #toast .toast-reference code{font-family:var(--font-mono);font-size:var(--fs-data-s)}
@media (max-width:760px){
  body.vui #toast{left:16px;right:16px;bottom:calc(16px + env(safe-area-inset-bottom));min-width:0;max-width:none}
  body.vui #toast :is(.toast-undo,.toast-dismiss){min-height:44px;min-width:44px}
}
@media (prefers-reduced-motion:reduce){body.vui #modal[open]{animation:none}}

/* ── Builders in vault/ui.mjs: banner, toast extras ────────── */
.pk-banner{display:flex;align-items:center;gap:var(--space-3);padding:var(--space-3) var(--space-4);border:1px solid var(--border-hairline);border-radius:var(--radius-ctl);background:var(--surface-card);font-size:var(--fs-body-s)}
.pk-banner[data-tone="attention"]{border-color:var(--coral-300);background:var(--status-attention-subtle)}
.pk-banner[data-tone="pending"]{border-color:var(--status-pending-line);background:var(--status-pending-subtle)}
.pk-banner[data-tone="positive"]{border-color:var(--teal-200);background:var(--status-positive-subtle)}
.pk-banner-dot{flex:none;width:8px;height:8px;border-radius:50%;background:var(--status-neutral)}
.pk-banner[data-tone="attention"] .pk-banner-dot{background:var(--status-attention)}
.pk-banner[data-tone="pending"] .pk-banner-dot{background:var(--foil-500)}
.pk-banner[data-tone="positive"] .pk-banner-dot{background:var(--status-positive)}
.pk-banner-text{display:grid;gap:2px;flex:1 1 auto;min-width:0}
.pk-banner-text strong{font-weight:var(--fw-semibold);color:var(--text-body)}
.pk-banner-text span{font-size:var(--fs-caption);color:var(--text-muted)}
.pk-banner .pk-btn{flex:none}
.pk-toast .pk-toast-ref{display:block;margin-top:2px;font-size:var(--fs-caption);color:var(--text-on-ink-muted)}
.pk-toast .pk-toast-ref code{font-family:var(--font-mono);font-size:var(--fs-data-s)}
.pk-toast .pk-toast-undo{flex:none;align-self:center;margin-left:auto;padding:0;border:0;background:none;color:var(--teal-400);font-size:var(--fs-caption);font-weight:var(--fw-semibold);text-decoration:underline;text-underline-offset:3px;cursor:pointer}
@media (max-width:600px){.pk-banner{flex-wrap:wrap}.pk-banner .pk-btn{margin-left:calc(8px + var(--space-3))}}
