.pdf-shell {
  max-width: 1180px;
}
.pdf-shell [hidden] { display: none !important; }
.pdf-hero { margin: 20px auto 28px; }
.pdf-local { color: var(--muted); padding: 10px 0; }
.pdf-local a { color: var(--link); }
.pdf-workspace {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(250px, 1fr);
  gap: 16px;
  align-items: start;
}
.pdf-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 17px;
  box-shadow: var(--shadow);
  padding: clamp(14px, 2.8vw, 24px);
  min-width: 0;
}
.pdf-panel h2 { font-size: 1.3rem; margin: 0 0 13px; }
.pdf-panel p { margin: 8px 0; }
.pdf-panel + .pdf-panel { margin-top: 14px; }
.pdf-drop {
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
  padding: 25px 12px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
}
.pdf-drop[data-over] { border-color: var(--accent); background: color-mix(in srgb, var(--card), var(--accent) 12%); }
.pdf-toolbar, .pdf-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pdf-toolbar { margin: 12px 0; }
.pdf-files { padding: 0; list-style: none; margin: 12px 0 0; }
.pdf-files li {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding: 9px 0;
}
.pdf-files li:last-child { border-bottom: 0; }
.pdf-file-name { display: block; overflow-wrap: anywhere; max-width: 100%; }
.pdf-meta { color: var(--muted); font-size: .89rem; overflow-wrap: anywhere; }
.pdf-shell button, .pdf-download {
  font: inherit;
  font-size: .88rem;
  font-weight: 650;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 11px;
  min-height: 36px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}
.pdf-shell button:disabled { opacity: .56; cursor: default; }
.pdf-shell button:not(:disabled):hover { border-color: var(--accent); }
.pdf-shell :focus-visible { outline: 3px solid var(--link); outline-offset: 3px; }
.pdf-shell .pdf-action, .pdf-download {
  background: var(--accent-deep);
  color: #fff;
  border-color: var(--accent-deep);
  text-decoration: none;
}
.pdf-shell .pdf-action:hover, .pdf-download:hover { background: var(--accent); }
.pdf-field { margin: 10px 0; display: grid; gap: 5px; min-width: 0; }
.pdf-field span { font-weight: 650; font-size: .91rem; }
.pdf-field select, .pdf-field input:not([type="checkbox"]) {
  width: 100%;
  font: inherit;
  min-width: 0;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 9px;
}
.pdf-field input[type=color] { min-height: 36px; }
.pdf-pages {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 125px),1fr));
  gap: 9px;
}
.pdf-page {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px;
  background: var(--bg-soft);
}
.pdf-page:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--card), var(--accent) 12%); }
.pdf-page button.pdf-preview-button { display: grid; width: 100%; place-items: center; min-height: 106px; padding: 3px; }
.pdf-thumb { width: auto; height: auto; max-width: 100%; max-height: 104px; white-space: normal; }
.pdf-page label { display: flex; gap: 4px; min-height: 34px; align-items: center; font-size: .88rem; }
.pdf-page label input { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--accent); }
.pdf-state { min-height: 1.5em; overflow-wrap: anywhere; }
.pdf-state[data-error] { color: var(--danger); }
.pdf-notice { border-inline-start: 3px solid var(--accent); padding-inline-start: 9px; font-size: .93rem; }
.pdf-panel progress { display: block; width: 100%; margin: 9px 0; accent-color: var(--accent); }
.pdf-dialog {
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  max-width: min(94vw, 960px);
  padding: 17px;
}
.pdf-dialog::backdrop { background: rgb(15 19 19 / .66); }
.pdf-dialog canvas, .pdf-dialog img { display: block; margin: 12px auto; max-width: 100%; max-height: 70vh; object-fit: contain; }
@media (max-width: 760px) {
  .pdf-workspace { grid-template-columns: 1fr; }
}
@media (pointer: coarse) {
  .pdf-shell button, .pdf-download, .pdf-page label { min-height: 44px; }
}
.pdf-notice li + li, .pdf-confirm li + li { margin-top: .5rem; }
.pdf-notice ul, .pdf-confirm ul { padding-inline-start: 1.2rem; overflow-wrap: anywhere; }
.pdf-confirm { width: min(560px, 94vw); max-height: 86vh; overflow: auto; }
.pdf-confirm h2 { margin: 0 0 .6rem; }
