/* ─── Delivery's file preview (plan 2026-09-28-008 U5) ───
   A right side panel like the hosted request drawer: no backdrop, the page is
   inset while it is open, full width on a phone. One right panel at a time. */
.pd-preview {
  position: fixed; top: 60px; right: 0; bottom: 0; z-index: 50;
  display: flex; flex-direction: column;
  width: var(--pw-drawer-width); margin: 0;
  border-left: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: 13px var(--font);
  box-shadow: -18px 0 40px rgba(17, 35, 47, .1);
}
.pd-preview[hidden] { display: none; }
/* Nested review keeps the Request mounted. Wide screens show both work
   surfaces; small screens cover (and JS inerts) the underlying Request. */
.pd-nested-preview .pd-preview { z-index: 53; }
.pd-nested-preview .pw-drawer-resize { display: none; }
@media (min-width: 1200px) {
  .pd-nested-preview .pd-preview { width: min(var(--pd-preview-width, 50vw), calc(100vw - 440px)); }
  .pd-nested-preview .trq-hosted .trq-detail {
    right: min(var(--pd-preview-width, 50vw), calc(100vw - 440px));
    width: min(var(--pw-drawer-custom-width, var(--pw-drawer-width)), calc(100vw - min(var(--pd-preview-width, 50vw), calc(100vw - 440px))));
  }
}
@media (max-width: 1199px) {
  .pd-nested-preview .pd-preview { width: 100vw; }
  .pd-nested-preview .pd-preview-resize, .pd-nested-preview .pd-preview-expand { display: none; }
}
[data-theme="dark"] .pd-preview { box-shadow: -18px 0 40px rgba(0, 0, 0, .35); }
/* The content wrapper (renderPreview rewrites only this) and the resize handle
   on the left edge (plan 2026-09-29-011): made once, it survives re-renders. */
.pd-preview-content { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.pd-preview-resize { position: absolute; top: 0; bottom: 0; left: -5px; z-index: 2; width: 10px; cursor: col-resize; touch-action: none; background: transparent; }
.pd-preview-resize::after { content: ""; position: absolute; top: 0; bottom: 0; left: 4px; width: 2px; background: transparent; transition: background .12s; }
.pd-preview-resize:hover::after, .pd-preview.resizing .pd-preview-resize::after { background: color-mix(in srgb, var(--accent) 55%, transparent); }
.pd-preview-resize:focus { outline: none; }
.pd-preview-resize:focus-visible { outline: 2px solid var(--practice-ink); outline-offset: -2px; border-radius: 3px; }
.pd-preview-resize:focus-visible::after { background: var(--accent); }
.pd-preview-resize[hidden], .pd-preview-expand[hidden] { display: none; }
/* During a drag the frame cannot swallow the pointer, and no text is selected. */
.pd-preview.resizing { user-select: none; -webkit-user-select: none; }
.pd-preview.resizing iframe { pointer-events: none; }
.pd-preview-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line-soft); }
.pd-preview-heading { min-width: 0; }
.pd-preview-kicker { margin: 0 0 4px; color: var(--muted); font: 700 10px var(--font-mono); letter-spacing: .06em; }
.pd-preview-head h2 { margin: 0; font-size: 17px; line-height: 1.3; overflow-wrap: anywhere; }
.pd-preview-head h2:focus { outline: none; }
.pd-preview-head h2:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 3px; border-radius: 4px; }
.pd-preview-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; flex: none; }
.pd-preview-actions .button { min-height: 30px; padding: 0 10px; font-size: 12px; }
.pd-preview-close { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
.pd-preview-close:hover { border-color: var(--line); color: var(--text); }
.pd-preview-tabs { display: flex; gap: 4px; padding: 8px 12px; overflow-x: auto; border-bottom: 1px solid var(--line-soft); background: var(--surface-2); }
.pd-preview-tab { display: inline-flex; align-items: center; gap: 6px; max-width: 260px; padding: 5px 10px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; white-space: nowrap; cursor: pointer; flex: none; }
.pd-preview-tab:hover { color: var(--text); }
.pd-preview-tab[aria-selected="true"] { border-color: var(--line); background: var(--surface); color: var(--text); }
.pd-preview-tab:focus-visible { outline: 2px solid var(--practice-ink); outline-offset: 1px; }
.pd-preview-tab-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pd-preview-tab .pd-drill-chip { margin: 0; padding: 1px 6px; font-size: 10px; }
.pd-preview-body { position: relative; flex: 1 1 auto; min-height: 0; overflow: auto; }
.pd-preview-body .dv-frame { display: block; width: 100%; height: 100%; min-height: 400px; border: 0; background: #fff; }
.pd-preview-message { margin: 0; padding: 18px; color: var(--muted); }
.pd-preview-message.warn { color: var(--amber); }
.pd-preview-native { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 32px 24px; text-align: center; }
.pd-preview-native img { width: 42px; height: 42px; }
.pd-preview-native h3 { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
.pd-preview-native p { max-width: 380px; margin: 0; color: var(--muted); }
body:has(#pdPreview:not([hidden])) .adrw-fab, body:has(#pdPreview:not([hidden])) .pw-finney-seat-note { right: calc(var(--pw-drawer-width) + 20px); }
/* A custom width (--pd-preview-width, set on <html> by practice-delivery.js
   while the preview is open) is read only above the phone breakpoint; at
   760px and below every rule keeps --pw-drawer-width and the full-width layout. */
@media (min-width: 761px) {
  .pd-preview { width: var(--pd-preview-width, var(--pw-drawer-width)); }
  body:has(#pdPreview:not([hidden])) .adrw-fab, body:has(#pdPreview:not([hidden])) .pw-finney-seat-note { right: calc(var(--pd-preview-width, var(--pw-drawer-width)) + 20px); }
  body:has(#pdPreview:not([hidden])) .practice-shell { padding-right: calc(var(--pd-preview-width, var(--pw-drawer-width)) + 28px); }
}
@media (min-width: 761px) and (max-width: 850px) {
  body:has(#pdPreview:not([hidden])) .practice-shell { padding-right: calc(var(--pd-preview-width, var(--pw-drawer-width)) + 12px); }
}
@media (max-width: 760px) {
  body:has(#pdPreview:not([hidden])) .adrw-fab, body:has(#pdPreview:not([hidden])) .pw-finney-seat-note { display: none; }
  .pd-preview-resize, .pd-preview-expand { display: none; }
}
@media (max-width: 650px) {
  .pd-preview { left: 0; width: 100vw; border-left: 0; box-shadow: none; }
  .pd-preview-head { flex-direction: column; }
  .pd-preview-actions { justify-content: flex-start; }
}
