/* PDF geometry and application-state integration only.
   Visual tokens and existing component styles are copied verbatim from MVP. */
/* The dialog title receives initial focus for context, without a control ring. */
#open-dialog-title:focus{outline:none}
/* Native focusVisible options cannot update an already-focused stage. */
#stage.pointer-focus:focus-visible{outline:none}
@font-face{font-family:'Anpdf Note';font-style:normal;font-weight:400;font-display:block;src:url('assets/Montserrat-Regular.ttf') format('truetype')}
/* Keep the reference caption footprint after removing its demo link/copy.
   Its caption wraps below 550px; reserve both layouts without hidden demo content. */
#start>.prototype-note{min-height:58px}
@media(width<550px){#start>.prototype-note{min-height:76px}}
/* Secondary start action reuses the reference .text-button unchanged. */
.last-document{margin-top:16px;min-width:0;display:flex;flex-direction:column;align-items:center;gap:0}
.last-document[hidden]{display:none}
.last-document .text-button{flex:none}
.last-document .notice{align-self:stretch}
.last-document-name{margin:0;min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;font-weight:400;line-height:20px;color:var(--an-color-text-secondary)}
/* Read-only counterpart of the approved document-name control. */
.filename{display:block;width:100%;height:36px;padding:7px 8px;border:1px solid transparent;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--an-text-md);font-weight:var(--an-weight-regular);line-height:20px;color:var(--an-color-text-secondary);max-width:100%}
.pdf-paper{width:100%;height:100%;position:relative}
.pdf-background{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.note-layer{position:absolute;inset:0;pointer-events:none}
.source-layer{position:absolute;inset:0;pointer-events:none;z-index:4}
.source-paint{z-index:3;mix-blend-mode:multiply}
.source-annotation{position:absolute;pointer-events:auto}
.source-annotation img{width:100%;height:100%}
.thumb-content .source-layer{pointer-events:none}
.thumb-content .source-annotation{pointer-events:none}
.pdf-note>svg{width:100%;height:100%;overflow:visible;pointer-events:none}
.pdf-note textarea{font-family:'Anpdf Note';font-kerning:none;font-variant-ligatures:none;white-space:pre;overflow:auto;min-width:100%;min-height:100%}
.note-input{z-index:5;min-width:0}
.document-stage.text-border-hover,.document-stage.text-border-hover *{cursor:move!important}
/* Invisible screen-sized rectangle targets; approved 8px markers stay intact. */
.pdf-note.kind-rectangle.selected{outline:none;box-shadow:none}
.pdf-note.kind-rectangle:focus-visible{outline:2px solid var(--rectangle-color);outline-offset:2px}
.pdf-note.kind-rectangle .handle{z-index:1;border-color:var(--rectangle-color)}
.pdf-note.kind-rectangle .handle::after{content:'';position:absolute;left:50%;top:50%;width:16px;height:16px;transform:translate(-50%,-50%);cursor:inherit}
.document-stage.rectangle-resize,.document-stage.rectangle-resize *{cursor:var(--rectangle-resize-cursor)!important}
.pdf-note.kind-arrow,.pdf-note.kind-arrow.selected{outline:none;box-shadow:none;pointer-events:none}
.pdf-note.kind-arrow .arrow-hit{position:absolute;inset:0;cursor:move}
.pdf-note.kind-arrow .object-toolbar{pointer-events:auto}
.pdf-note.kind-arrow .handle{z-index:1}
.pdf-note.kind-arrow [data-resize=bend]::after{content:'';position:absolute;left:50%;top:50%;width:16px;height:16px;transform:translate(-50%,-50%);cursor:inherit}
.page-state{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;color:var(--an-color-text-secondary);font:var(--an-text-sm)/var(--an-line-md) var(--an-font-sans)}
.thumb-image{position:relative}
.thumb-content{position:relative;width:100%;height:100%;background:white;overflow:hidden}
.thumb-content canvas,.thumb-content svg{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
#toast{display:flex;flex-wrap:wrap;align-items:center;gap:var(--an-space-8,8px);width:480px;max-width:calc(100vw - 32px);max-height:calc(100dvh - 104px);overflow:auto}
#toast-message{flex:1;min-width:0;overflow-wrap:anywhere}
#toast:has(#toast-retry:not([hidden]),#print-fallback:not([hidden])) #toast-message{flex-basis:100%}
#toast .button{white-space:normal;max-width:100%;height:auto;min-height:36px}
/* Keep persistent guidance in the shell flow, outside the scrolling PDF. */
.workspace-caption{position:static;display:flex;flex:none;pointer-events:none;max-width:100%;overflow-wrap:anywhere}
.pdf-note .object-toolbar{--inverse-scale:1}
.text-object-toolbar{width:max-content;justify-content:flex-end}
body[data-view="editor"]{padding-bottom:0}
body[data-view="editor"] #dialog{max-width:calc(100% - 32px)}

/* Bounded PDF surfaces; annotation/editor layers keep their existing geometry. */
.pdf-region{position:absolute;overflow:hidden;pointer-events:none}
.pdf-region .source-paint{mix-blend-mode:normal}
.page-state{z-index:6;pointer-events:none}
.page-state button{pointer-events:auto;white-space:normal;max-width:100%;height:auto;min-height:36px;overflow-wrap:anywhere}

/* Pointer feedback for viewport navigation; approved component styles stay intact. */
.document-stage.pan-cursor .pdf-paper{cursor:grab}
.document-stage.pan-cursor .source-annotation{cursor:auto}
.document-stage.is-panning,.document-stage.is-panning *{cursor:grabbing!important;user-select:none}
/* Annotation geometry and source text hit layer; existing controls/tokens reused. */
.pdf-note .handle{pointer-events:auto}
.pdf-note:is(.kind-highlight,.kind-underline,.kind-strikethrough).selected{outline:none;box-shadow:none}
.pdf-note:is(.kind-highlight,.kind-underline,.kind-strikethrough):focus-visible{outline:2px solid var(--an-color-focus);outline-offset:2px}
.pdf-note:is(.kind-highlight,.kind-underline,.kind-strikethrough):not(.selected){pointer-events:none}
.pdf-note.kind-highlight>svg{pointer-events:visiblePainted}
.pdf-note.selected .object-toolbar{z-index:10}
.pdf-note.note-input>svg{position:absolute;inset:0}
.pdf-note textarea{position:absolute;inset:0;white-space:pre-wrap;word-break:normal;overflow-wrap:anywhere;min-height:0;background:transparent}
.pdf-text-layer{position:absolute;inset:0;transform-origin:0 0;line-height:1;letter-spacing:normal;word-spacing:normal;overflow:clip;pointer-events:none;--min-font-size:1;--text-scale-factor:calc(var(--total-scale-factor)*var(--min-font-size));--min-font-size-inv:calc(1/var(--min-font-size));z-index:1}
.pdf-text-layer :is(span,br){position:absolute;white-space:pre;color:transparent;transform-origin:0 0;user-select:text}
.pdf-text-layer>:not(.markedContent),.pdf-text-layer .markedContent span:not(.markedContent){font-size:calc(var(--text-scale-factor)*var(--font-height));transform:rotate(var(--rotate,0deg)) scaleX(var(--scale-x,1)) scale(var(--min-font-size-inv))}
.pdf-text-layer .markedContent{display:contents}
.highlight-tool .pdf-text-layer{pointer-events:auto;cursor:text;touch-action:none}
.highlight-tool .source-annotation{pointer-events:none}
.highlight-tool .pdf-paper{cursor:text}

.text-hit-testing .note-layer{visibility:hidden}
.text-hit-testing .pdf-text-layer{pointer-events:auto}
.text-hit-testing .source-layer{visibility:hidden}

/* Existing type/buttons/notices composed for durable recovery state. */
/* Unlike the prototype's #draft-error, #file-status has no 16px bottom margin. */
#start #restore-actions{margin-top:var(--an-space-8,8px)}
.document-name{overflow:hidden}
.notice-surface{display:contents}
.pdf-open-surface .save-error{display:flex;align-items:center;justify-content:space-between;gap:var(--an-space-8,8px);flex:none;margin:0}
.save-error span{overflow-wrap:anywhere;min-width:0}
.save-error .button.neutral:not(:hover):not(:active):not(:disabled){color:var(--an-color-text)}
.pdf-print-context{position:fixed;left:-10000px;top:0;width:800px;height:600px;border:0}

/* Blur uses rectangle controls; raster patches occupy their model position. */
.blur-paints{position:absolute;inset:0;pointer-events:none;z-index:0}
.blur-paints canvas{position:absolute;pointer-events:none}
.blur-live{position:absolute;pointer-events:none}
.pdf-note.kind-blur.selected{outline:none;box-shadow:none}
.thumb-content svg[data-notes]{z-index:0}
.pdf-note.kind-blur .handle{z-index:1}
.pdf-note.kind-blur .handle::after{content:'';position:absolute;left:50%;top:50%;width:16px;height:16px;transform:translate(-50%,-50%);cursor:inherit}
.eraser-cursor .source-annotation{pointer-events:none}
.eraser-cursor .pdf-paper,.eraser-cursor .pdf-note,.eraser-cursor .arrow-hit{cursor:url("ui/assets/cursor-eraser.svg") 7 21,crosshair}

/* Pen uses the approved object controls, with hit testing on the stroke only. */
.pdf-note.kind-pen{pointer-events:none}
.pdf-note.kind-pen .pen-hit{position:absolute;inset:0;cursor:move}
.pdf-note.kind-pen .object-toolbar{pointer-events:auto}
.pen-tool .source-annotation{pointer-events:none}
.rectangle-tool .source-annotation{pointer-events:none}
.pen-tool .pdf-note .pen-hit{cursor:crosshair}
.eraser-cursor .pdf-note.kind-pen .pen-hit{cursor:inherit}

/* Model order owns annotation paint; selection controls remain independent. */
.annotation-tool .source-annotation{pointer-events:none}
.pdf-note.kind-highlight>svg{mix-blend-mode:multiply}
.pdf-note.kind-blur .blur-paints{z-index:auto}
.pdf-note.kind-blur canvas{position:absolute;pointer-events:none}

/* Reuse the approved corner marker; enlarge only its invisible hit target. */
.pdf-note.kind-text .handle,.pdf-note.note-input .handle{z-index:1}
.pdf-note.kind-text .handle::after,.pdf-note.note-input .handle::after{content:'';position:absolute;left:50%;top:50%;width:16px;height:16px;transform:translate(-50%,-50%);cursor:inherit}

/* Current design components, integrated with the production document viewport. */
.editor-toolbar.toolbar{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);column-gap:20px;height:64px;min-height:64px;padding:8px 16px;flex-shrink:0;z-index:40}
/* The disabled-color hint stays above the drawer and starts at its anchor. */
#blur-color-tooltip{left:0;transform:none;white-space:normal;max-width:min(260px,calc(100vw - 32px))}
.editor-toolbar .document-identity{grid-column:1;grid-row:1;display:flex;gap:8px;min-width:0;justify-self:start}
.editor-toolbar .document-name{container-type:normal;flex:0 1 auto;min-width:0;height:36px;overflow:hidden}
.editor-toolbar .filename{width:auto;color:var(--text-secondary)}
.editor-toolbar .competitor-toolbar{grid-column:2;grid-row:1;justify-self:center;gap:20px;width:max-content;max-width:none;min-width:0;padding-block:0;flex-wrap:nowrap;transform:translateX(var(--tool-shift,0px));transition:none}
.editor-toolbar .tool-cluster{gap:8px;flex-wrap:nowrap;margin:0}
.editor-toolbar .competitor-history{position:static;padding-right:0;gap:8px;width:auto}
.editor-toolbar .toolbar-zone{width:156px;min-width:156px;flex-shrink:0}
.editor-toolbar .toolbar-settings{gap:16px;width:156px}
.editor-toolbar [hidden]{display:none!important}
.editor-toolbar .toolbar-divider{width:1px;height:24px;flex-shrink:0;margin:0}
.editor-toolbar .document-actions{grid-column:3;grid-row:1;gap:8px;justify-self:end}
.editor-toolbar .document-actions-divider{margin-right:12px}
.editor-toolbar .document-action{width:36px;height:36px;padding:0;border-radius:50%;flex-shrink:0}
.editor-toolbar .document-action span{display:none}
.editor-toolbar .document-actions.with-labels .document-action{width:auto;padding:0 12px;border-radius:var(--radius-8)}
.editor-toolbar .document-actions.with-labels .document-action span{display:inline}
.editor-toolbar .zoom-stepper{flex-shrink:0}
.editor-toolbar .zoom-stepper .icon-button{padding:0;z-index:1}
.editor-toolbar .zoom-stepper .icon-button svg{width:18px;height:18px}
.editor-toolbar #zoom-value{min-width:0}
@media(max-width:1199px){
  .editor-toolbar.toolbar{grid-template-columns:minmax(0,1fr) max-content;height:auto;row-gap:8px}
  .editor-toolbar .competitor-toolbar{grid-column:1/-1;grid-row:2;transform:none;max-width:100%;flex-wrap:wrap;justify-content:center}
  .editor-toolbar .document-actions{grid-column:2;grid-row:1}
}
@media(max-width:760px){.editor-toolbar .tool-cluster{max-width:100%;flex-wrap:wrap}.editor-toolbar .competitor-toolbar{row-gap:8px}}
.editor-toolbar.sidebar-shift .competitor-toolbar{transition:transform 160ms cubic-bezier(0.2,0,0,1)}
.resizing-sidebar .editor-toolbar.sidebar-shift .competitor-toolbar{transition:none}
@media(prefers-reduced-motion:reduce){.editor-toolbar.sidebar-shift .competitor-toolbar{transition:none}}

.editor-toolbar .document-actions.with-labels{gap:4px}
/* Current PageSidebar handle states; width is transient, not document data. */
.sidebar-resizer{outline:none!important}
.sidebar-resizer::after{transition:background 120ms}
.sidebar-resizer:hover::after{background:var(--border)}
.sidebar-resizer:focus-visible::after{background:var(--focus)}
.resizing-sidebar .sidebar-resizer::after{background:var(--field-border)}
@media(prefers-reduced-motion:reduce){.sidebar-resizer::after{transition:none}}
#popover:has([data-zoom-option]){max-height:calc(100vh - var(--zoom-menu-top) - 8px)}
.search-row{display:flex;flex-wrap:wrap;align-items:center;gap:8px;flex:none;padding:0 16px;background:var(--an-color-workspace);min-height:48px}
.search-row[hidden]{display:none}
.search-row .document-search{position:static;flex:0 1 480px}
/* Reset legacy prototype count sizing; the current component reserves its slot. */
.document-search .search-count{min-width:0;text-align:start}
#search-status{font-size:12px;color:var(--an-color-text-secondary);flex:1 1 240px;min-width:0}
.document-search-mark{position:absolute;inset:0;pointer-events:none;z-index:15;overflow:clip}
.document-search-mark>svg{position:absolute;inset:0;overflow:visible}
.document-search-mark polygon{fill:var(--doc-search-match-active,#ffb86b);stroke:var(--doc-search-match-ring,#d68b20);stroke-width:1}
.search-note-box{position:absolute;border:2px solid var(--doc-search-match-ring,#d68b20);background:var(--doc-search-match,#ffe69a)}
.search-measure{pointer-events:none!important}
@media print{.search-row,.document-search-mark,.search-measure{display:none!important}}

/* German confirmation actions wrap within the existing dialog padding. */
html[lang="de"] #dialog .dialog-actions{flex-wrap:wrap}

/* Zoom preview reuses the PDF and note layers; final layout/render follows settle. */
#stage.zoom-preview{overflow:hidden;overflow-anchor:none}
#stage.zoom-preview #pages{will-change:transform}
#zoom-list{position:fixed;overflow:auto;z-index:70;min-width:min(176px,calc(100vw - 16px))}
#zoom-list .menu-item{height:auto;white-space:normal;flex-shrink:0;line-height:20px;justify-content:space-between}
#zoom-list .menu-check{position:static;margin-left:0;width:16px;height:16px;flex:none}
#zoom-list [aria-selected="false"] .menu-check{visibility:hidden}
#zoom-list .menu-rule{flex-shrink:0}

/* Pages footer follows the same thumbnail width policy as PageView. */
.pages-footer{order:2;flex:none;display:flex;align-items:center;justify-content:space-between;border-top:1px solid var(--border);padding-block:12px;gap:0}
.footer-language,.footer-page,.footer-page-wrap input{height:32px;border-radius:8px;padding:0 8px;font-size:12px;font-weight:500;line-height:20px;color:var(--text);font-variant-numeric:tabular-nums}
.footer-language{display:flex;align-items:center;gap:6px;min-width:0;max-width:200px;flex-shrink:1}
.footer-language svg{flex:none}.footer-language span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.footer-language:hover,.footer-page:hover{background:var(--hover);color:var(--primary)}
.footer-language:active,.footer-page:active{background:var(--pressed);color:var(--primary)}
.footer-language[aria-expanded=true]{background:var(--selected);color:var(--primary)}
.footer-page-wrap{position:relative;flex:none;min-width:40px}
.footer-page{display:block;width:100%;min-width:40px;white-space:nowrap;text-align:right}
.footer-page-wrap input{position:absolute;inset:0;width:100%;min-width:0;border:0;outline:none}
.editing-page .footer-page{visibility:hidden}
.language-menu{position:fixed;z-index:46;width:max-content;min-width:min(176px,calc(100vw - 16px));max-width:280px;padding:8px;overflow:auto;overscroll-behavior:contain;box-shadow:var(--shadow-large);border-radius:16px}
.language-menu .menu-item{min-height:40px;height:40px;line-height:20px;font-weight:400;justify-content:space-between;gap:16px;white-space:nowrap}
.language-menu .menu-item svg{visibility:hidden;flex:none}
.language-menu [aria-checked=true]{background:var(--selected);color:var(--primary)}
.language-menu [aria-checked=true] svg{visibility:visible}
.language-menu .menu-item:hover{background:var(--hover);color:var(--primary)}
.language-menu [aria-checked=true]:hover{background:var(--selected)}
.footer-language :lang(ja),.language-menu :lang(ja){font-family:"Hiragino Sans","Noto Sans JP",sans-serif}
.footer-language :lang(ko),.language-menu :lang(ko){font-family:"Apple SD Gothic Neo","Noto Sans KR",sans-serif}

/* Symmetric scrollbar space keeps thumbnail and footer alignment stable. */
.sidebar .page-list{padding-inline:0;scrollbar-gutter:stable both-edges}

/* Text markup uses the approved compact Menu and one stable toolbar slot. */
[data-tool="highlight"]{position:relative}
[data-tool="highlight"] .markup-caret{position:absolute;left:14.5px;bottom:0;width:7px;height:4px;pointer-events:none}
.mark-fill{fill-opacity:.12}
[data-tool="highlight"][aria-pressed="true"] .mark-fill,.text-markup-menu [aria-checked="true"] .mark-fill{fill-opacity:.2}
#popover.text-markup-menu{width:max-content;min-width:176px;padding:8px;border-radius:16px}
.text-markup-menu .menu-item{display:grid;grid-template-columns:20px 1fr 28px;gap:8px;min-height:48px;width:100%;line-height:20px;white-space:nowrap}
.text-markup-menu .menu-item>span{display:flex;align-items:center}
.text-markup-menu .markup-check{margin-left:8px;visibility:hidden}
.text-markup-menu [aria-checked="true"]{background:var(--an-color-selected);color:var(--an-color-primary)}
.text-markup-menu [aria-checked="true"] .markup-check{visibility:visible}
.pdf-note:is(.kind-underline,.kind-strikethrough)>svg{pointer-events:visiblePainted}
