/* Shared application chrome. Colours and the Golos Text font live in theme.css. */
* { box-sizing: border-box; }
html { background: var(--canvas); }
body { width: 430px; max-width: 100%; min-height: 600px; max-height: 800px; margin: 0; overflow-x: hidden; overflow-y: auto; color: var(--ink); background: var(--canvas); font-family: inherit; font-size: 13px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body::-webkit-scrollbar, .pdf-preview::-webkit-scrollbar, .file-list::-webkit-scrollbar { width: 7px; height: 7px; }
body::-webkit-scrollbar-thumb, .pdf-preview::-webkit-scrollbar-thumb, .file-list::-webkit-scrollbar-thumb { border-radius: 5px; background: var(--line); }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
svg { display: block; }
a { color: var(--brand); text-underline-offset: 3px; }
.shell { min-height: 600px; display: flex; flex-direction: column; background: var(--canvas); }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; padding: 16px 18px; border-bottom: 1px solid var(--line); background: var(--surface); }
.brand-mark { width: 32px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border: 0; border-radius: 10px; color: #fff; background: var(--action); }
.brand-mark svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.brand-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.brand-copy strong { font-size: 15px; font-weight: 800; letter-spacing: -.035em; line-height: 1.15; }
.brand-copy span { display: none; }
.header-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 6px; min-width: 0; }
.language-select { width: 100px; min-width: 0; min-height: 36px; padding: 5px 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 11px; cursor: pointer; }
.header-actions .account-toggle { min-height: 36px; }
html:lang(zh) { line-break: strict; }
html:lang(zh) .eyebrow { letter-spacing: 0; }

#catalogView { flex: 1; padding-bottom: 4px; }
.hero { margin: 24px 20px 20px; padding: 0; background: transparent; }
.hero-tag { display: inline-block; margin-bottom: 12px; padding: 3px 7px; border: 1px solid var(--line); border-radius: 5px; color: var(--brand); background: var(--surface); font-size: 11px; font-weight: 500; }
.hero h1 { margin: 0; max-width: 380px; font-size: 29px; font-weight: 600; line-height: 1.15; letter-spacing: -.035em; }
.hero > p { margin: 10px 0 0; max-width: 380px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.eyebrow { margin: 0 0 5px; color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: .035em; text-transform: uppercase; }

.search { min-height: 42px; margin: 0 18px; padding: 0 12px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: var(--surface); }
.search:focus-within { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 2px; }
.search svg { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.search input { width: 100%; min-width: 0; min-height: 40px; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 13px; }
.search input::placeholder { color: var(--muted); }
.filters { display: flex; gap: 3px; padding: 14px 18px; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter { flex: 0 0 auto; min-height: 34px; padding: 6px 9px; border: 1px solid transparent; border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; font-size: 11px; font-weight: 650; }
.filter:hover { color: var(--ink); background: var(--hover); }
.filter.active { color: var(--brand-dark); border-color: transparent; background: var(--brand-soft); }
.tools { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; padding: 0 18px 24px; }
.tool-card { position: relative; min-width: 0; min-height: 134px; padding: 16px; display: flex; flex-direction: column; align-items: flex-start; border: 1px solid var(--line); border-radius: 15px; text-align: left; color: var(--ink); background: var(--surface); cursor: pointer; transition: transform .16s, box-shadow .16s, border-color .16s; }
.tool-card:hover { border-color: var(--brand); background: var(--surface); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.tool-icon { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; color: var(--tool-color,var(--brand)); background: var(--tool-bg,var(--brand-soft)); }
.tool-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.tool-copy { min-width: 0; width: 100%; margin-top: 12px; }
.tool-copy strong { display: block; overflow-wrap: anywhere; font-size: 13px; font-weight: 750; line-height: 1.4; }
.tool-copy > span { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.tool-chevron { position: absolute; top: 22px; right: 16px; color: var(--subtle); font-size: 20px; line-height: 1; }
.tool-card:hover .tool-chevron { color: var(--brand); }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); font-size: 13px; }

.workspace { flex: 1; min-width: 0; padding: 16px 18px 26px; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 5px 7px 5px 0; border: 0; border-radius: 5px; color: var(--muted); background: transparent; cursor: pointer; font-size: 12px; font-weight: 500; }
.back span { display: grid; place-items: center; width: 18px; height: 18px; color: var(--brand); font-size: 20px; line-height: 1; }
.back:hover { color: var(--brand); }
.workspace-heading { display: flex; gap: 12px; align-items: flex-start; margin: 16px 0 20px; }
.workspace-heading > div:last-child { min-width: 0; }
.workspace-heading .tool-icon.large { width: 36px; height: 36px; margin-top: 5px; }
.workspace-heading .tool-icon.large svg { width: 30px; height: 30px; }
.workspace-heading h2 { margin: 0; font-size: 25px; font-weight: 800; line-height: 1.2; letter-spacing: -.035em; overflow-wrap: anywhere; }
.workspace-heading > div:last-child > p:last-child { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.dropzone { min-height: 128px; padding: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px dashed var(--focus); border-radius: 14px; color: var(--ink); background: var(--brand-soft); cursor: pointer; text-align: center; }
.dropzone:hover, .dropzone.dragging { background: var(--hover); border-style: solid; }
.upload-icon { width: 34px; height: 34px; margin-bottom: 10px; display: grid; place-items: center; color: var(--brand); background: transparent; }
.upload-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.dropzone strong { font-size: 14px; font-weight: 600; }
.dropzone > span:last-child { margin-top: 4px; color: var(--muted); font-size: 12px; }
.file-list { min-width: 0; max-height: 164px; margin-top: 10px; overflow: auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; }
.file-row { min-width: 0; max-width: 100%; min-height: 42px; padding: 7px 9px; display: flex; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); font-size: 12px; }
.file-order { width: 21px; height: 24px; flex: 0 0 auto; display: grid; place-items: center; color: var(--muted); font-size: 11px; font-weight: 500; }
.file-name { min-width: 0; flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 500; }
.file-size { flex: 0 0 auto; color: var(--muted); font-size: 11px; }
.file-remove { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; padding: 0; border: 0; border-radius: 5px; color: var(--muted); background: transparent; cursor: pointer; font-size: 18px; line-height: 1; }
.file-remove:hover { color: var(--danger); background: var(--danger-bg); }

.signature-panel, .edit-panel { display: grid; gap: 12px; min-width: 0; margin-top: 12px; }
.signature-block { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.field-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.field-heading > div { min-width: 0; display: flex; flex-direction: column; }
.field-heading strong { font-size: 13px; font-weight: 600; }
.field-heading span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.subtle-button { padding: 6px 9px; min-height: 32px; border: 1px solid var(--line); border-radius: 5px; color: var(--brand); background: var(--surface); cursor: pointer; font-size: 12px; font-weight: 500; }
.subtle-button:hover:not(:disabled) { border-color: var(--brand); background: var(--hover); }
/* White surfaces below represent the document, not the application theme. */
#signatureCanvas { display: block; width: 100%; height: 105px; border: 1px solid var(--line); border-radius: 5px; background: #fff; cursor: crosshair; touch-action: none; }
.placement-controls, .edit-controls { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 9px; }
.placement-controls label, .edit-controls label { min-width: 0; display: flex; flex-direction: column; color: var(--muted); font-size: 11px; font-weight: 500; }
.placement-controls input[type="number"], .edit-controls input[type="number"] { width: 58px; height: 36px; margin-top: 4px; padding: 0 8px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); background: var(--canvas); font-size: 13px; }
.placement-controls input[type="number"]:focus, .edit-controls input[type="number"]:focus { border-color: var(--focus); }
.page-count { margin-bottom: 8px; color: var(--muted); font-size: 11px; }
.size-control { flex: 1; min-width: 0; margin-left: 4px; }
.size-control input { width: 100%; accent-color: var(--brand); }
.pdf-preview { position: relative; min-height: 155px; max-height: 325px; overflow: auto; border: 1px solid var(--line); border-radius: 5px; background: var(--hover); cursor: crosshair; }
.preview-page { position: relative; width: 100%; }
.preview-zoom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 0 10px; }
.preview-zoom > span { color: var(--muted); font-size: 12px; font-weight: 500; }
.zoom-stepper { display: flex; align-items: center; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 5px; background: var(--canvas); }
.preview-zoom button, .preview-zoom select { min-height: 36px; border: 0; border-radius: 4px; background: var(--surface); color: var(--ink); cursor: pointer; }
.zoom-stepper button { min-width: 34px; font-size: 21px; font-weight: 500; }
.zoom-stepper select { width: 76px; padding: 0 4px 0 8px; font-size: 12px; font-weight: 500; }
.preview-zoom .zoom-fit { padding: 0 9px; border: 1px solid var(--line); color: var(--brand); font-size: 12px; font-weight: 500; }
.preview-zoom button:hover:not(:disabled) { background: var(--hover); }
.zoom-help { margin: 8px 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.pdf-preview:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
#pdfPreview, #editPdfPreview { display: block; width: 100%; height: auto; background: white; }
.preview-placeholder { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; color: var(--muted); text-align: center; font-size: 12px; }
.signature-ghost { position: absolute; z-index: 2; height: auto; transform: translate(-50%, -50%); pointer-events: none; }
.placement-hint { margin: 7px 2px 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.edit-text-label { display: flex; flex-direction: column; color: var(--muted); font-size: 12px; font-weight: 500; }
.edit-mode-switch { margin-bottom: 8px; padding: 3px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; border: 1px solid var(--line); border-radius: 5px; background: var(--canvas); }
.edit-mode-switch button { min-height: 36px; padding: 5px; border: 1px solid transparent; border-radius: 4px; color: var(--muted); background: transparent; cursor: pointer; font-size: 12px; font-weight: 500; }
.edit-mode-switch button.active { color: var(--brand); border-color: var(--brand); background: var(--surface); }
.edit-mode-hint { min-height: 25px; margin: 0 2px 8px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.edit-text-label textarea { width: 100%; min-height: 72px; margin-top: 5px; padding: 9px 10px; resize: vertical; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); background: var(--canvas); font-size: 13px; line-height: 1.5; }
.edit-text-label textarea:focus { border-color: var(--focus); }
.edit-controls { margin: 9px 0; }
.edit-controls .size-control { flex: 1; }
.color-control input { width: 36px; height: 36px; margin-top: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 5px; background: var(--canvas); cursor: pointer; }
.edit-preview { cursor: text; }
.edit-preview.replace-mode { cursor: default; }
/* Overlay geometry is deliberately unchanged: CSS dimensions participate in PDF placement. */
.edit-source-masks, .edit-text-layer, .edit-overlays { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.edit-source-mask { position: absolute; background: white; }
.edit-text-hit { position: absolute; z-index: 2; padding: 0; border: 1px solid transparent; border-radius: 2px; color: transparent; background: transparent; pointer-events: auto; cursor: pointer; }
.edit-text-hit:hover, .edit-text-hit:focus-visible { border-color: var(--focus); background: color-mix(in srgb, var(--focus) 14%, transparent); outline: 0; }
.edit-text-hit.selected { visibility: hidden; }
.edit-overlay-item, .edit-draft { position: absolute; z-index: 3; width: max-content; min-height: 0; max-width: calc(100% - 3px); padding: 0 1px; border: 1px solid transparent; white-space: pre-wrap; overflow-wrap: anywhere; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.2; text-align: left; }
.edit-overlay-item { pointer-events: auto; cursor: grab; background: transparent; touch-action: none; }
.edit-overlay-item:hover { border-color: var(--focus); }
.edit-overlay-item.replace { background: white; }
.edit-overlay-item.replace, .edit-draft.replace { white-space: nowrap; overflow: visible; }
.edit-overlay-item:active { cursor: grabbing; }
.edit-draft { pointer-events: none; border-style: dashed; border-color: var(--focus); border-radius: 4px; background: rgba(255,255,255,.88); }
.edit-draft.add { background: rgba(255,255,255,.78); }
.edit-draft.draggable { pointer-events: auto; cursor: grab; touch-action: none; }
.edit-draft.draggable:active, .edit-draft.draggable.dragging { cursor: grabbing; }
.secondary-action { width: 100%; min-height: 40px; margin-top: 8px; padding: 8px 12px; border: 1px solid var(--brand); border-radius: 5px; color: var(--brand); background: var(--surface); cursor: pointer; font-size: 13px; font-weight: 500; }
.secondary-action:hover:not(:disabled) { background: var(--hover); }
.secondary-action:disabled { color: var(--muted); border-color: var(--line); background: var(--canvas); cursor: not-allowed; }
.cancel-edit { width: 100%; min-height: 32px; margin-top: 7px; padding: 6px; border: 0; color: var(--muted); background: transparent; cursor: pointer; font-size: 12px; font-weight: 500; }
.cancel-edit:hover { color: var(--danger); }
.edit-items { overflow: hidden; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
.edit-item { min-height: 46px; padding: 7px 8px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); font-size: 12px; }
.edit-item:last-child { border-bottom: 0; }
.edit-item.selected { background: var(--brand-soft); }
.edit-item-dot { width: 10px; height: 10px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 2px; background: var(--edit-color); }
.edit-item-main { min-width: 0; flex: 1; padding: 3px 2px; display: flex; gap: 9px; align-items: center; border: 0; text-align: left; background: transparent; cursor: pointer; }
.edit-item-copy { min-width: 0; flex: 1; }
.edit-item-copy strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; font-weight: 500; }
.edit-item-copy span { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }

.disclosure { margin: 12px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.disclosure a { color: var(--brand); text-decoration: underline; font-weight: 500; }
.primary { width: 100%; min-height: 48px; margin-top: 14px; border: 0; border-radius: 11px; color: var(--on-action); background: var(--action); cursor: pointer; font-size: 14px; font-weight: 750; }
.primary:hover:not(:disabled) { outline: 1px solid var(--brand); outline-offset: 2px; }
.primary:disabled { color: var(--muted); border-color: var(--line); background: var(--hover); cursor: not-allowed; }
.status { margin-top: 12px; padding: 12px; display: flex; align-items: flex-start; gap: 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
.status.success { border-color: var(--success); background: var(--success-bg); }
.status.error { border-color: var(--danger); background: var(--danger-bg); }
.status > div { min-width: 0; }
.status strong { font-size: 12px; font-weight: 600; }
.status p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.status.error p { color: var(--danger); }
.spinner { width: 19px; height: 19px; margin-top: 1px; flex: 0 0 auto; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .75s linear infinite; }
.status.success .spinner, .status.error .spinner { animation: none; border: 0; display: grid; place-items: center; font-weight: 600; }
.status.success .spinner::after { content: "✓"; color: var(--success); }
.status.error .spinner::after { content: "!"; color: var(--danger); }
@keyframes spin { to { transform: rotate(360deg); } }
footer { margin-top: auto; padding: 16px 20px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); color: var(--muted); background: var(--surface); font-size: 11px; }
footer a { color: var(--muted); text-decoration: none; font-weight: 500; }
footer a:hover { color: var(--brand); text-decoration: underline; }
.footer-links { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.hidden { display: none !important; }
@media (max-width: 359px) { .topbar, footer { padding-right: 16px; padding-left: 16px; } .tools { padding-right: 16px; padding-left: 16px; gap: 8px; } .tool-card { padding: 12px; } .tool-copy strong { font-size: 12px; } .workspace { padding-right: 16px; padding-left: 16px; } .hero { margin-right: 16px; margin-left: 16px; } .search { margin-right: 16px; margin-left: 16px; } .filters { padding-right: 16px; padding-left: 16px; } }
/* Format colours distinguish file families; text labels carry the same meaning. */
.tool-card[data-tool="pdf-to-word"], .tool-card[data-tool="word-to-pdf"] { --tool-color:#2860d6; --tool-bg:#edf3ff; }
.tool-card[data-tool="pdf-to-excel"], .tool-card[data-tool="excel-to-pdf"] { --tool-color:#137545; --tool-bg:#eaf8f0; }
.tool-card[data-tool="pdf-to-pptx"], .tool-card[data-tool="pptx-to-pdf"] { --tool-color:#be532a; --tool-bg:#fff2e9; }
.tool-card[data-tool="merge-pdf"], .tool-card[data-tool="split-pdf"], .tool-card[data-tool="compress-pdf"] { --tool-color:#c23841; --tool-bg:#fff0f1; }
.tool-card[data-tool="images-to-pdf"], .tool-card[data-tool="pdf-to-jpg"], .tool-card[data-tool="pdf-to-png"] { --tool-color:#947018; --tool-bg:#fff7df; }
.tool-card[data-tool="sign-pdf"], .tool-card[data-tool="edit-pdf"] { --tool-color:#237885; --tool-bg:#eaf8fb; }
[data-theme="dark"] .tool-card { --tool-bg:var(--hover); }
[data-theme="dark"] .tool-icon { color:var(--ink); }
@media(max-width:400px) { .topbar { padding-inline:14px; gap:6px; } .brand-mark { width:28px; height:32px; } .brand-copy strong { font-size:13px; } .header-actions { gap:4px; } .language-select { width:91px; font-size:10px; } .theme-toggle { width:32px; height:34px; flex-basis:32px; } .header-actions .account-toggle { padding-inline:8px; font-size:10px; } }
