body { --mley-pdf-header: 70px; --mley-pdf-width: clamp(420px, 44vw, 800px); }
.mley-pdf-toggle { flex: 0 0 auto; white-space: nowrap; font-size: 0.78rem; }
.mley-pdf-toggle[aria-expanded="true"] { background: var(--surface-accent); border-color: var(--accent-color); }
.mley-pdf-panel[hidden], .mley-pdf-panel [hidden], .mley-pdf-resizer[hidden] { display: none !important; }
.mley-pdf-resizer {
  position: fixed; top: var(--mley-pdf-header); bottom: 0;
  right: calc(var(--mley-pdf-width) - 7px); width: 14px; z-index: 991;
  cursor: col-resize; touch-action: none; user-select: none;
}
.mley-pdf-resizer::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 6px; width: 2px;
  background: var(--border-color, #dbe2ea);
}
.mley-pdf-resizer::after {
  content: ""; position: absolute; top: calc(50% - 24px); left: 4px;
  width: 6px; height: 48px; border-radius: 8px;
  background: var(--text-muted, #718096);
  box-shadow: 0 0 0 3px var(--bg-surface, #fff);
}
.mley-pdf-resizer:hover::after,
.mley-pdf-resizer:focus-visible::after,
body.mley-pdf-resizing .mley-pdf-resizer::after { background: var(--accent-color, #356ca5); }
.mley-pdf-resizer:focus-visible { outline: 2px solid var(--accent-color, #356ca5); outline-offset: -2px; }
body.mley-pdf-resizing, body.mley-pdf-resizing * { cursor: col-resize !important; user-select: none !important; }
body.mley-pdf-resizing iframe { pointer-events: none; }
body.mley-pdf-resizing #panel, body.mley-pdf-resizing .mley-pdf-panel { transition: none !important; }
body.mley-pdf-expanded .mley-pdf-resizer { display: none; }
.mley-pdf-panel {
  position: fixed; top: var(--mley-pdf-header); right: 0; bottom: 0;
  z-index: 990; display: grid; width: var(--mley-pdf-width);
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  grid-template-rows: minmax(40px, max-content) auto auto auto minmax(0, 1fr);
  column-gap: 8px; container: mley-pdf / inline-size;
  background: var(--bg-surface, #fff); color: var(--text-color, #1f2d3d);
  border-left: 1px solid var(--border-color, #dbe2ea); box-shadow: -8px 0 24px #162d4710;
  font-size: 0.8rem; overflow: hidden;
}
.mley-pdf-heading { display: contents; }
.mley-pdf-heading h2 { grid-area: 1 / 1; align-self: center; font-size: 0.8rem; margin: 8px 0 8px 12px; font-weight: 700; min-width: 0; max-width: 210px; max-width: min(210px, 38cqi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mley-pdf-heading h2 span { color: var(--text-muted); font-size: 0.8rem; }
.mley-pdf-heading-actions { grid-area: 1 / 5; align-self: center; display: flex; align-items: center; gap: 4px; margin: 8px 12px 8px 0; }
.mley-pdf-panel button, .mley-pdf-panel select { font: inherit; color: inherit; border: 1px solid var(--border-color); background: var(--bg-surface-2); padding: 7px 9px; border-radius: 7px; cursor: pointer; }
.mley-pdf-panel button:hover { background: var(--surface-accent); }
.mley-pdf-panel button:focus-visible, .mley-pdf-panel a:focus-visible, .mley-pdf-panel summary:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }
.mley-pdf-panel button.mley-pdf-icon-button { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border-color: transparent; background: transparent; }
.mley-pdf-panel button.mley-pdf-icon-button:hover { background: var(--surface-accent); }
.mley-pdf-icon-button span { display: inline-flex; }
.mley-pdf-toolbar { display: contents; font-size: 0.7rem; line-height: 1.4; }
.mley-pdf-check { grid-area: 1 / 2; align-self: center; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-muted); }
.mley-pdf-check[data-status="verified"] { color: var(--accent-color); }
.mley-pdf-check[data-status="stale"], .mley-pdf-check[data-status="source_changed"] { color: #936018; }
.mley-pdf-check[data-status="check_failed"] { color: #b34238; }
html[data-theme="dark"] .mley-pdf-check[data-status="stale"], html[data-theme="dark"] .mley-pdf-check[data-status="source_changed"] { color: #edc56f; }
html[data-theme="dark"] .mley-pdf-check[data-status="check_failed"] { color: #ff9b93; }
.mley-pdf-official { grid-area: 1 / 3; align-self: center; white-space: nowrap; font-weight: 600; }
.mley-pdf-toolbar .mley-pdf-more { grid-area: 1 / 4; align-self: center; display: inline-flex; align-items: center; gap: 3px; padding: 4px 6px; font-size: inherit; line-height: inherit; white-space: nowrap; }
.mley-pdf-more[aria-expanded="true"] svg { transform: rotate(180deg); }
.mley-pdf-source-links { display: flex; flex-wrap: wrap; gap: 7px 14px; padding: 8px 14px 12px; border-bottom: 1px solid var(--border-color); }
.mley-pdf-source-links a { font-weight: 600; }
.mley-pdf-provenance { grid-area: 3 / 1 / auto / -1; border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); padding: 8px 14px; max-height: 38vh; overflow: auto; }
.mley-pdf-provenance .mley-pdf-source-links { padding: 0 0 10px; margin-bottom: 10px; }
.mley-pdf-versions { margin: 12px 0 4px; }
#mley-pdf-fingerprint { display: block; overflow-wrap: anywhere; white-space: normal; font-size: 0.65rem; color: inherit; }
.mley-pdf-provenance dl { display: grid; grid-template-columns: 1fr 1.3fr; gap: 7px 12px; margin: 14px 0; }
.mley-pdf-provenance dt { font-weight: 500; color: var(--text-muted); }
.mley-pdf-provenance dd { margin: 0; }
.mley-pdf-provenance p { font-size: 0.72rem; color: var(--text-muted); }
.mley-pdf-provenance label { display: block; margin-bottom: 5px; }
#mley-pdf-version { width: 100%; margin-bottom: 8px; }
#mley-pdf-diff { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg-surface-2); color: var(--text-color); padding: 10px; max-height: 260px; overflow-y: auto; font-size: 11px; }
.mley-pdf-state { grid-area: 4 / 1 / auto / -1; padding: 28px 20px; color: var(--text-muted); text-align: center; }
#mley-pdf-frame { grid-area: 5 / 1 / auto / -1; box-sizing: border-box; width: 100%; height: 100%; min-width: 0; min-height: 0; border: 0; border-top: 1px solid var(--border-color); background: #e4e7eb; }
body.mley-pdf-open:not(.mley-pdf-expanded) #panel { margin-right: var(--mley-pdf-width); }
body[data-page-kind].mley-pdf-open #panel .ley-content-shell { width: 100% !important; max-width: 100% !important; min-width: 0; }
body.mley-pdf-expanded { overflow: hidden; }
body.mley-pdf-expanded .mley-pdf-panel { width: 100%; }
body.mley-pdf-expanded #panel { visibility: hidden; }
body.mley-pdf-open .mley-chatbot-launcher { right: calc(var(--mley-pdf-width) + 16px); }
@media (max-width: 1099px) {
  body.mley-pdf-open { overflow: hidden; }
  body.mley-pdf-open #panel { visibility: hidden; margin-right: 0 !important; }
  .mley-pdf-panel { width: 100%; border-left: 0; }
  .mley-pdf-resizer { display: none; }
  #mley-pdf-expand { display: none; }
}
@media (max-width: 600px) {
  .mley-pdf-toggle { font-size: 0.68rem; padding: 0.35rem 0.4rem; min-width: 0; }
  .mley-pdf-panel { column-gap: 6px; }
  .mley-pdf-heading h2 { margin-left: 10px; }
  .mley-pdf-heading-actions { margin-right: 10px; }
  .mley-pdf-source-links { padding-left: 10px; }
  .mley-pdf-provenance dl { grid-template-columns: 1fr; gap: 3px; }
  .mley-pdf-provenance dd { margin-bottom: 7px; }
}
@container mley-pdf (max-width: 650px) {
  .mley-pdf-heading h2, .mley-pdf-heading h2 span { font-size: 0.75rem; }
  .mley-pdf-sync-label { display: none; }
  #mley-pdf-sync-toggle { min-width: 32px; justify-content: center; }
  .mley-pdf-sync-menu { max-width: calc(100cqi - 24px); }
}
@container mley-pdf (max-width: 480px) {
  .mley-pdf-heading-actions { grid-area: 2 / 1 / auto / -1; justify-content: flex-end; margin: 0 10px 6px; }
}
@media (pointer: coarse) {
  .mley-pdf-panel button.mley-pdf-icon-button { width: 44px; height: 44px; }
  .mley-pdf-toolbar .mley-pdf-more { min-height: 40px; padding-left: 9px; padding-right: 9px; }
}
@media print {
  .mley-pdf-panel, .mley-pdf-toggle, .mley-pdf-resizer { display: none !important; }
  body.mley-pdf-open #panel { margin-right: 0 !important; visibility: visible; }
}
