/* Promptly overlays (DESIGN-SYSTEM.md §7 Toast, Bottom sheet, Right drawer, Menu popover, System
 * bar; §4.4 shadows, §4.5 z-order, §5 motion, D-05). The classes behind ui/overlays.js. Lane L0,
 * DECK-202. Loads after ui/primitives.css (it uses .p-scrim and the p-pop-in / p-sheet-up /
 * p-drawer-in / p-fade-in keyframes from there). Every selector starts with a .p- class.
 * Literals marked DS §7 / mock value: have no --p-* token yet.
 */

/* ---- toast-in, copied from the mock; the reduced-motion twin keeps the same lifetime, fade only ---- */
@keyframes p-toast-in {
  0% { transform: translateY(14px); opacity: 0; }
  10% { transform: none; opacity: 1; }
  82% { opacity: 1; }
  100% { transform: translateY(-4px); opacity: 0; }
}
@keyframes p-toast-fade {
  0% { opacity: 0; }
  10% { opacity: 1; }
  82% { opacity: 1; }
  100% { opacity: 0; }
}

/* ---- Toast [renderToast, TOAST] ---- */
.p-toast-wrap {
  position: fixed; left: 0; right: 0; z-index: var(--p-z-toast);
  bottom: calc(108px + env(safe-area-inset-bottom, 0px));
  display: flex; justify-content: center; padding: 0 16px; pointer-events: none;
}
.p-toast-wrap--local { position: absolute; }
.p-toast-wrap--desk { bottom: 40px; }
.p-toast-wrap--setup { bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
.p-toast {
  display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 300px;
  padding: 9px 16px; border-radius: var(--p-r-pill);
  background: var(--p-ink); color: var(--p-on-ink); box-shadow: var(--p-shadow-toast);
  font-family: var(--p-font); font-size: var(--p-fs-caption); font-weight: 600; line-height: 1.2;
  animation: p-toast-in var(--p-dur-toast) ease forwards;
}
.p-toast--setup {
  max-width: 440px; padding: 10px 18px;
  font-size: 13.5px; /* DS §7 / mock value: --p-fs-toast-setup */
  animation-duration: var(--p-dur-toast-setup);
}
.p-toast__dot { width: 8px; height: 8px; }
.p-toast__dot--ink { --d: var(--p-ink); }
.p-toast__dot--do { --d: var(--p-do); }
.p-toast__dot--later { --d: var(--p-later); }
.p-toast__dot--refine { --d: var(--p-refine); }
.p-toast__dot--close { --d: var(--p-close); }
.p-toast__dot--linear { --d: var(--p-toast-linear); }
.p-toast__dot--good { --d: var(--p-good); }
.p-toast__dot--bad { --d: var(--p-bad); }
.p-toast__msg { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* App toasts sit 108 up above the phone tab bar, 40 on the desktop shell (§7). */
@media (min-width: 1024px) {
  .p-toast-wrap--app { bottom: 40px; }
}

/* ---- modal layers: sheet, drawer, menu ---- */
.p-ovl { position: fixed; inset: 0; font-family: var(--p-font); }
.p-ovl--sheet { z-index: var(--p-z-sheet); display: flex; flex-direction: column; justify-content: flex-end; }
.p-ovl--agent { z-index: var(--p-z-agent-sheet); }
.p-ovl--drawer { z-index: var(--p-z-drawer); }
.p-ovl--menu { z-index: var(--p-z-menu); }
.p-scrim--sheet { background: var(--p-scrim-sheet); }
.p-scrim--agent { background: var(--p-scrim-agent); }
.p-scrim--drawer { background: var(--p-scrim-drawer); }
.p-scrim--menu { background: var(--p-scrim-menu); backdrop-filter: none; -webkit-backdrop-filter: none; }

/* ---- Bottom sheet (phone) [sheetWrap, renderAgentSheet, renderComposer] ---- */
.p-sheet {
  position: relative; display: flex; flex-direction: column; gap: 12px; max-height: 92%;
  padding: 14px 18px calc(20px + env(safe-area-inset-bottom, 0px));
  background: var(--p-screen); color: var(--p-ink); border-top: 1px solid var(--p-line);
  border-radius: var(--p-r-sheet) var(--p-r-sheet) 0 0; overflow: hidden;
  animation: p-sheet-up var(--p-dur-sheet) var(--p-ease);
}
.p-sheet--agent { border-radius: var(--p-r-agent-sheet) var(--p-r-agent-sheet) 0 0; }
.p-sheet--tall { height: 92%; }
.p-sheet__grab { flex: 0 0 auto; align-self: center; width: 38px; height: 4px; border-radius: var(--p-r-pill); background: var(--p-line); }
.p-sheet__title { margin: 0; color: var(--p-ink); }
.p-sheet__body { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; }
.p-sheet--tall .p-sheet__body { flex: 1; }
.p-sheet__acts { display: flex; flex-direction: column-reverse; gap: 10px; }
.p-sheet__acts .p-btn { width: 100%; }

/* ---- Right drawer (desktop) [deskLayer] ---- */
.p-drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(var(--p-w-drawer), 100%);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--p-screen); color: var(--p-ink); border-left: 1px solid var(--p-line);
  box-shadow: var(--p-shadow-drawer);
  animation: p-drawer-in var(--p-dur-drawer) var(--p-ease);
}
.p-drawer--wide { width: min(var(--p-w-drawer-wide), 100%); }
.p-drawer__title { margin: 0; padding: 22px 24px 12px; }
.p-drawer__body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }

/* ---- Menu popover [renderMenu] ---- */
.p-menu {
  position: absolute; top: 78px; right: 16px; width: min(var(--p-max-menu), calc(100% - 32px));
  display: flex; flex-direction: column; padding: 8px;
  background: var(--p-card); color: var(--p-ink); border: 1px solid var(--p-line);
  border-radius: 30px; /* DS §7 / mock value: --p-r-menu */
  box-shadow: var(--p-shadow-menu); max-height: calc(100% - 94px); overflow-y: auto;
  animation: p-pop-in var(--p-dur-pop-menu) var(--p-ease);
}
.p-menu__head { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px 10px; }
.p-menu__who { font-size: var(--p-fs-body); font-weight: 600; color: var(--p-ink); }
.p-menu__meta { font-size: var(--p-fs-caption); color: var(--p-muted); }
.p-menu__div { flex: 0 0 auto; height: 1px; margin: 6px 12px; background: var(--p-line); }
.p-menu__row {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: var(--p-h-menu-row); padding: 0 16px;
  border: none; border-radius: 20px; /* DS §7 / mock value: --p-r-menu-row */
  background: transparent; color: var(--p-ink); cursor: pointer; text-align: left;
  font-family: var(--p-font); font-size: 16px;
}
.p-menu__row:hover { background: var(--p-soft); }
.p-menu__row--bad { color: var(--p-bad); }
.p-menu__row .p-icon { flex: 0 0 auto; }
.p-menu__label { flex: 1; min-width: 0; }
.p-menu__hint { font-size: var(--p-fs-caption); color: var(--p-muted); }

/* ---- System bar [SEALBAR] ---- */
.p-sysbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 14px; flex: 0 0 auto; width: 100%;
  padding: 12px 40px; font-family: var(--p-font); box-sizing: border-box;
}
.p-sysbar--attention {
  background: var(--p-attention); color: var(--p-attention-ink);
  --p-focus-color: var(--p-attention-ink); /* the ink ring would vanish on the yellow strip in dark mode */
}
.p-sysbar__title { font-size: var(--p-fs-body); font-weight: 700; }
.p-sysbar__body { flex: 1; min-width: 220px; font-size: var(--p-fs-body-s); }
.p-sysbar__btn {
  height: 38px; padding: 0 18px; border: none; border-radius: var(--p-r-pill); cursor: pointer;
  background: var(--p-attention-ink); color: var(--p-on-attention-ink);
  font-family: var(--p-font); font-size: var(--p-fs-button); font-weight: 600;
}
@media (max-width: 759.98px) {
  .p-sysbar { padding: 12px 20px; }
}

/* D-05: toast fades only; sheet-up / drawer-in / pop-in become fades (primitives.css covers
   .p-sheet / .p-drawer / .p-menu too — repeated here so this file stands alone). */
@media (prefers-reduced-motion: reduce) {
  .p-toast { animation-name: p-toast-fade; }
  .p-sheet, .p-drawer, .p-menu { animation-name: p-fade-in !important; }
}
