.pdf-app { --pdf-green: #a4efdf; --pdf-border: #cbd7d3; padding: 8rem max(1.25rem, 4vw) 3rem; max-width: 1700px; margin: 0 auto; }
.pdf-app [hidden] { display: none !important; }
.pdf-intro { display: flex; justify-content: space-between; align-items: end; gap: 2rem; margin-bottom: 2rem; }
.pdf-intro h1 { margin: 0; font-size: clamp(2rem, 3.6vw, 3.4rem); line-height: 1.05; font-weight: 580; letter-spacing: -.045em; }
.pdf-intro p:not(.eyebrow):not(.pdf-private) { margin: .9rem 0 0; color: #536263; max-width: 650px; }
.pdf-back { white-space: nowrap; padding: .7rem 0; border-bottom: 1px solid #536263; font-size: .9rem; }
.pdf-shell { border: 1px solid var(--pdf-border); border-radius: 10px; overflow: hidden; background: #fff; box-shadow: 0 18px 60px -40px #18372d; }
.pdf-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .8rem; padding: 1rem 1.25rem; background: #132823; color: #f5fbf8; }
.pdf-file { min-width: 0; flex: 1 1 160px; }
.pdf-file strong { display: block; max-width: 48ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.pdf-file span { display: block; font-size: .8rem; color: #a9c9be; margin-top: .2rem; }
.pdf-controls { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.pdf-app button, .pdf-app select, .pdf-app input { min-height: 42px; border: 1px solid #bfcdc7; border-radius: 5px; background: white; color: #193029; font: inherit; }
.pdf-app button { padding: .55rem .85rem; font-size: .875rem; cursor: pointer; font-weight: 600; }
.pdf-app button:hover:not(:disabled) { background: #e2f4ed; border-color: #448170; }
.pdf-app button:disabled { opacity: .45; cursor: not-allowed; }
.pdf-app button:focus-visible, .pdf-app select:focus-visible, .pdf-app input:focus-visible, .pdf-app textarea:focus-visible, .pdf-viewer:focus-visible { outline: 3px solid #3c9b85; outline-offset: 3px; }
.pdf-app .pdf-primary { background: var(--pdf-green); border-color: var(--pdf-green); color: #102a20; }
.pdf-toolbar .pdf-quiet { background: transparent; border-color: #668679; color: white; }
.pdf-toolbar .pdf-quiet:hover:not(:disabled) { background: #244b3e; }
.pdf-empty { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(230px, .7fr); min-height: 460px; }
.pdf-drop { padding: clamp(2rem, 5vw, 5rem); display: flex; flex-direction: column; align-items: flex-start; justify-content: center; border-right: 1px solid var(--pdf-border); background: #f8fbfa; }
.pdf-drop.is-dragging { background: #dcf4eb; box-shadow: inset 0 0 0 3px #3c9b85; }
.pdf-file-icon { width: 62px; height: 72px; border: 1px solid #98b8aa; border-radius: 5px; display: grid; place-items: center; margin-bottom: 1.5rem; color: #3d7561; font-size: .85rem; letter-spacing: .1em; background: #edf6f1; }
.pdf-drop h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); font-weight: 550; letter-spacing: -.04em; line-height: 1.12; margin: 0; }
.pdf-drop p { max-width: 36ch; color: #536263; margin: 1rem 0 1.5rem; }
.pdf-drop .pdf-primary { padding: .8rem 1.5rem; font-size: 1rem; }
.pdf-drop small { color: #5c6b65; font-size: .8rem; margin-top: .85rem; }
.pdf-guide { padding: clamp(1.5rem, 3vw, 3rem); background: #eef4f1; display: flex; flex-direction: column; justify-content: center; }
.pdf-guide ol { list-style: none; padding: 0; margin: 0; counter-reset: pdf-step; }
.pdf-guide li { position: relative; counter-increment: pdf-step; padding: 1.25rem 0 1.25rem 2.5rem; border-bottom: 1px solid #d1ddd6; }
.pdf-guide li:last-child { border-bottom: 0; }
.pdf-guide li::before { content: counter(pdf-step, decimal-leading-zero); position: absolute; left: 0; color: #488470; font-size: .8rem; }
.pdf-guide strong { font-size: 1rem; font-weight: 600; }
.pdf-guide p { margin: .4rem 0 0; font-size: .9rem; color: #53655b; line-height: 1.6; }
.pdf-workarea { display: grid; grid-template-columns: minmax(0, 1fr) 330px; }
.pdf-document { min-width: 0; background: #dfe7e3; }
.pdf-modebar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .75rem 1rem; background: #fff; border-bottom: 1px solid var(--pdf-border); }
.pdf-modebar button[aria-pressed="true"] { background: #d8f5e9; border-color: #3d8069; }
.pdf-modebar span { flex: 1 1 220px; font-size: .8rem; color: #52685b; padding-left: .3rem; }
.pdf-pagebar { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .7rem 1rem; border-bottom: 1px solid var(--pdf-border); background: #eef3f0; }
.pdf-pagebar .pdf-controls { gap: .4rem; }
.pdf-pagebar label { font-size: .85rem; }
.pdf-app #pdf-page-number { width: 3.7rem; padding: .4rem; text-align: center; }
.pdf-app select { padding: .4rem .6rem; max-width: 100%; }
.pdf-pagebar #pdf-page-count { font-size: .85rem; color: #4b6558; }
.pdf-viewer { height: min(78vh, 1050px); min-height: 420px; overflow: auto; scrollbar-gutter: stable; padding: 1.5rem; }
.pdf-page { position: relative; background: white; margin: 0 auto; box-shadow: 0 5px 24px rgba(20,45,32,.13); }
.pdf-page canvas { display: block; width: 100%; height: 100%; max-width: none; }
.pdf-text-targets { position: absolute; inset: 0; }
.pdf-app .pdf-text-target { position: absolute; display: block; min-height: 0; min-width: 0; padding: 0; border: 1px solid transparent; border-radius: 2px; background: transparent; cursor: text; }
.pdf-app button.pdf-text-target:hover:not(:disabled), .pdf-app .pdf-text-target:focus-visible { background: rgba(47,182,137,.13); border-color: #24916b; }
.pdf-app .pdf-text-target.is-selected { background: rgba(47,182,137,.12); outline: 2px solid #258465; outline-offset: 2px; }
.pdf-app button.pdf-place, .pdf-app button.pdf-place:hover:not(:disabled) { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; min-height: 0; border: 0; background: transparent; border-radius: 0; cursor: crosshair; }
.pdf-app button.pdf-place:focus-visible { outline-offset: -4px; }
.pdf-placement { position: absolute; min-height: 24px; border: 1px dashed #258465; background: rgba(47,182,137,.08); pointer-events: none; }
.pdf-placement::before { content: '+'; position: absolute; left: -6px; top: -13px; color: #176349; font-size: 18px; }
.pdf-placement span { display: block; font: 11px/1.4 system-ui, sans-serif; color: #15543f; background: #e0f5ec; width: max-content; max-width: 100%; padding: 2px 5px; }
.pdf-sidebar { min-width: 0; border-left: 1px solid var(--pdf-border); padding: 1.5rem; }
.pdf-sidebar h2 { margin: 0 0 .8rem; font-size: 1.25rem; font-weight: 600; letter-spacing: -.02em; }
.pdf-sidebar p { font-size: .9rem; color: #52685b; line-height: 1.6; }
.pdf-sidebar label:not(.pdf-check) { display: block; margin-top: 1rem; font-size: .8rem; font-weight: 650; color: #365646; }
.pdf-sidebar textarea { width: 100%; min-height: 220px; resize: vertical; border: 1px solid #afc5b8; border-radius: 5px; background: #fff; color: #182b21; font: inherit; font-size: .95rem; line-height: 1.6; padding: .8rem; margin-top: .45rem; }
.pdf-edit-options { display: grid; grid-template-columns: 1fr 1.4fr; gap: .7rem; }
.pdf-edit-options input, .pdf-edit-options select { width: 100%; margin-top: .4rem; padding: .4rem .5rem; font-size: .875rem; }
.pdf-check { display: flex; align-items: center; gap: .6rem; margin: 1rem 0; font-size: .875rem; }
.pdf-check input { accent-color: #287b59; width: 18px; min-height: 18px; margin: 0; }
.pdf-sidebar .pdf-primary { width: 100%; }
.pdf-sidebar .pdf-original { max-height: 130px; overflow: auto; white-space: pre-wrap; background: #f1f5f2; padding: .8rem; border-radius: 4px; font-size: .8rem; margin: .6rem 0; }
.pdf-sidebar details { margin-top: 1rem; color: #52685b; font-size: .8rem; }
.pdf-sidebar summary { cursor: pointer; padding: .3rem 0; }
.pdf-sidebar #pdf-font-info { overflow-wrap: anywhere; font-size: .8rem; }
.pdf-sidebar.is-adding textarea { min-height: 120px; }
.pdf-position-options { border: 0; padding: 0; margin: 1rem 0; min-width: 0; }
.pdf-position-options legend { font-size: .8rem; font-weight: 650; color: #365646; padding: 0; }
.pdf-position-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.pdf-position-options input, .pdf-position-options select { width: 100%; padding: .4rem; margin-top: .4rem; font-size: .85rem; }
.pdf-sidebar .pdf-position-options label { margin-top: .6rem; }
.pdf-sidebar .pdf-cancel { width: 100%; margin-top: .5rem; }
.pdf-status { padding: .8rem 1.25rem; font-size: .875rem; color: #365a48; background: #edf6f0; border-top: 1px solid var(--pdf-border); min-height: 47px; }
.pdf-status.is-error { color: #8b2828; background: #fff0ed; }
.pdf-status.is-busy { color: #3a5f59; background: #e9f5f1; }
.pdf-status a { text-decoration: underline; font-weight: 600; }
.pdf-access { padding: 1rem 1.25rem; background: #fff8e7; color: #614d22; border-bottom: 1px solid #e8d7b1; font-size: .875rem; }
.pdf-access p { margin: 0 0 .65rem; max-width: 78ch; }
.pdf-access p:last-child { margin-bottom: 0; }
.pdf-access button { background: #fff; border-color: #b7a479; color: #403719; }
.pdf-help { margin-top: 1.5rem; border-top: 1px solid var(--pdf-border); padding-top: 1rem; }
.pdf-help summary { padding: .5rem 0; cursor: pointer; font-weight: 600; font-size: .9rem; }
.pdf-help-content { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 2rem; color: #53655b; font-size: .9rem; line-height: 1.7; }
.pdf-help-content strong { color: #264e39; }
.pdf-private { display: flex; gap: .5rem; align-items: flex-start; margin: .85rem 0 0; font-size: .8rem; line-height: 1.5; color: #53665b; }
.pdf-private::before { content: ''; flex: 0 0 6px; height: 6px; margin-top: .5em; border-radius: 50%; background: #338468; }
@media(max-width:1100px) { .pdf-workarea { grid-template-columns: minmax(0,1fr) 295px; } .pdf-sidebar { padding: 1.1rem; } }
@media(max-width:800px) {
  .pdf-app { padding-top: 6.7rem; }
  .pdf-intro { align-items: start; flex-direction: column; gap: .7rem; }
  .pdf-back { font-size: .85rem; }
  .pdf-empty { grid-template-columns: 1fr; }
  .pdf-drop { border-right: 0; border-bottom: 1px solid var(--pdf-border); padding: 2rem 1.5rem; }
  .pdf-file-icon { margin-bottom: 1rem; }
  .pdf-guide { padding: 1rem 1.5rem; }
  .pdf-workarea { grid-template-columns: 1fr; }
  .pdf-sidebar { border-left: 0; border-top: 1px solid var(--pdf-border); padding: 1.25rem; }
  .pdf-viewer { padding: .8rem; min-height: 260px; height: 60vh; }
  .pdf-toolbar { padding: .9rem; }
  .pdf-toolbar > .pdf-controls { width: 100%; }
  .pdf-toolbar #pdf-download { margin-left: auto; }
  .pdf-pagebar { padding: .65rem; }
  .pdf-pagebar button { padding-inline: .7rem; }
  .pdf-help-content { grid-template-columns: 1fr; gap: 0; }
  .pdf-sidebar textarea { min-height: 170px; }
}
@media (prefers-reduced-motion: reduce) { .pdf-app * { scroll-behavior: auto !important; } }

/* Additional PDF tools share the compact, local-first workspace. */
.pdf-app .pdf-new { margin-top: .7rem; background: transparent; }
.pdf-modebar { gap: .4rem; }
.pdf-modebar button { padding: .5rem .65rem; font-size: .8rem; }
.pdf-modebar #pdf-mode-hint { flex-basis: 100%; padding: .2rem 0 0; }
.pdf-sidebar { max-height: calc(min(78vh, 1050px) + 170px); overflow: auto; scrollbar-gutter: stable; }
.pdf-sidebar #pdf-extra-panel select, .pdf-sidebar #pdf-page-tools input { display: block; width: 100%; margin-top: .4rem; padding: .4rem .5rem; }
.pdf-sidebar .pdf-small { font-size: .8rem; line-height: 1.6; }
.pdf-geometry-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .5rem .7rem; }
.pdf-geometry-grid input { width: 100%; margin-top: .4rem; padding: .4rem; }
.pdf-turn { align-self: end; }
.pdf-graphic-actions { margin-top: .6rem; grid-template-columns: 1fr 1fr; }
.pdf-sidebar form { scroll-margin-top: 6rem; }
.pdf-sidebar #pdf-crop-options { padding: .5rem .7rem; background: #f0f6f3; border: 1px solid #d3e0d9; border-radius: 5px; }
.pdf-sidebar #pdf-crop-reset { margin-top: .7rem; }
.pdf-page-group { border: 0; border-top: 1px solid #d3e0d9; padding: .6rem 0 0; margin: 1.6rem 0 0; min-width: 0; }
.pdf-page-group legend { font-size: .9rem; font-weight: 650; padding: 0 .5rem 0 0; }
.pdf-page-group > button { margin-top: .7rem; width: 100%; }
.pdf-page-group p { overflow-wrap: anywhere; }
.pdf-page-group .pdf-edit-options label { margin-top: .35rem; }
.pdf-graphic-targets { position: absolute; inset: 0; }
.pdf-app .pdf-graphic-target { position: absolute; min-height: 10px; min-width: 10px; padding: 0; border: 1px dashed #2d8069; background: transparent; border-radius: 0; }
.pdf-app .pdf-graphic-target:hover:not(:disabled), .pdf-app .pdf-graphic-target.is-selected { background: #35b58a22; outline: 2px solid #258465; }
.pdf-graphic-preview { position: absolute; outline: 1px dashed #246f60; z-index: 2; }
.pdf-graphic-preview::before { content: 'Preview'; position: absolute; bottom: calc(100% + 3px); left: 0; padding: 1px 4px; color: white; background: #246f60; font: 10px/1.5 system-ui; pointer-events: none; }
.pdf-graphic-preview canvas { pointer-events: none; }
.pdf-app #pdf-graphic-move { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 12px; padding: 0; border: 0; border-radius: 0; background: transparent; cursor: move; touch-action: none; }
.pdf-app #pdf-graphic-resize { position: absolute; right: -7px; bottom: -7px; width: 15px; height: 15px; min-height: 0; padding: 0; border: 2px solid white; background: #246f60; border-radius: 3px; cursor: nwse-resize; touch-action: none; box-shadow: 0 0 0 1px #246f60; }
.pdf-app #pdf-graphic-move:focus-visible { outline-offset: 3px; }
.pdf-app .pdf-place { touch-action: none; }
@media(max-width:800px) { .pdf-modebar button { flex: 1 1 auto; min-height: 44px; } .pdf-graphic-preview::before { font-size: 9px; } .pdf-sidebar { max-height: none; overflow: visible; } }
