/* ParlayDesk shared dialog + toast (2026-10-01) — pairs with /pd-ui.js.
   Chrome (scrim, surface, head, title, close, foot) is /modal.css's
   .pd-modal-*; this file owns only the dialog layout, its buttons/field
   and the toast. Buttons own every box property because apps/styles.css
   resets `button{height:42px;padding:0 12px}` page-wide. */

html.pd-scroll-locked { overflow: hidden; }
html.pd-scroll-locked body { padding-right: var(--pd-scrollbar-gap, 0px); }

.pd-dialog-root {
  position: fixed;
  left: 0;
  right: 0;
  /* Pinned to the visual viewport by pd-ui.js so a phone keyboard shrinks
     the area instead of covering the buttons. */
  top: var(--pd-vv-top, 0px);
  height: var(--pd-vv-h, 100%);
  z-index: 3000; /* above Support (2000), nav menus and other modals */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}
.pd-dialog-scrim { position: absolute; inset: 0; }
.pd-dialog {
  position: relative;
  width: min(440px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  outline: none;
  opacity: 0;
  transform: translateY(8px) scale(.98);
  transition: opacity .15s ease, transform .15s ease;
}
.pd-dialog-in .pd-dialog { opacity: 1; transform: none; }
.pd-dialog-body {
  padding: 16px 20px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  min-height: 0;
}
.pd-dialog-msg p {
  margin: 0 0 10px;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--muted, #cbd5e1);
  overflow-wrap: anywhere;
}
.pd-dialog-msg p:last-child { margin-bottom: 0; }
.pd-dialog-msg + .pd-dialog-label { margin-top: 14px; }
/* A dialog with no header (prompt without a title) keeps its top padding. */
.pd-dialog > .pd-dialog-body:first-child { padding-top: 20px; }

.pd-dialog-label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted, #94a3b8);
}
.pd-dialog-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  height: auto;
  min-height: 44px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .04);
  color: var(--text, #e5e7eb);
  font: inherit;
  font-size: 15px;
  line-height: 1.4;
  resize: vertical;
}
textarea.pd-dialog-input { min-height: 88px; }
.pd-dialog-count { margin-top: 6px; text-align: right; font-size: 11.5px; color: var(--muted, #94a3b8); }

.pd-dialog-btn {
  height: 40px;
  min-width: 88px;
  margin: 0;
  padding: 0 16px;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s ease, border-color .15s ease, filter .15s ease;
}
.pd-dialog-btn:focus { outline: none; box-shadow: none; }
.pd-dialog-btn:focus-visible { outline: 2px solid var(--accent2, #60a5fa); outline-offset: 2px; }
.pd-dialog-btn-ghost {
  background: rgba(255, 255, 255, .04);
  border-color: rgba(255, 255, 255, .12);
  color: var(--text, #e5e7eb);
}
.pd-dialog-btn-primary { background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff; }
.pd-dialog-btn-danger { background: #dc2626; border-color: #ef4444; color: #fff; }
@media (hover: hover) {
  .pd-dialog-btn-ghost:hover { background: rgba(255, 255, 255, .09); }
  .pd-dialog-btn-primary:hover,
  .pd-dialog-btn-danger:hover { filter: brightness(1.08); }
}
.pd-dialog-btn:active { filter: brightness(.94); }

/* Phones: larger touch targets, 16px field (no iOS focus zoom), the
   actions share the row. */
@media (max-width: 560px) {
  .pd-dialog-root { padding: 12px; }
  .pd-dialog-body { padding: 14px 16px 16px; }
  .pd-dialog-input { font-size: 16px; }
  .pd-dialog-foot .pd-dialog-btn { flex: 1 1 0; height: 44px; min-width: 0; }
}

/* ── Toast ── */
.pd-toast-wrap {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 3100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}
.pd-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  box-sizing: border-box;
  padding: 10px 8px 10px 14px;
  border-radius: 12px;
  background: rgba(17, 24, 39, .97);
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
  color: var(--text, #e5e7eb);
  font-size: 14px;
  line-height: 1.4;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease;
}
.pd-toast-in { opacity: 1; transform: none; }
.pd-toast-msg { min-width: 0; overflow-wrap: anywhere; }
.pd-toast-icon { flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent2, #60a5fa); }
.pd-toast-success .pd-toast-icon { background: var(--hit, #22c55e); }
.pd-toast-error { border-color: rgba(239, 68, 68, .45); }
.pd-toast-error .pd-toast-icon { background: var(--missed, #ef4444); }
.pd-toast-close {
  flex: 0 0 auto;
  position: relative;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted, #94a3b8);
  cursor: pointer;
}
.pd-toast-close::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 12px;
  height: 12px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center / contain no-repeat;
}
.pd-toast-close:focus { outline: none; box-shadow: none; }
.pd-toast-close:focus-visible { outline: 2px solid var(--accent2, #60a5fa); outline-offset: 1px; }
@media (max-width: 560px) {
  .pd-toast-wrap { bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: calc(100vw - 32px); }
  .pd-toast { width: 100%; }
}
