* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: dark; scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: #07131d; color: #eaf5fa; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.55; }
button, input, select { font: inherit; }
button { color: inherit; }
a { color: #7dddf4; }
.skip-link { position: fixed; top: 0.75rem; left: 0.75rem; z-index: 20; padding: 0.75rem 1rem; background: #f4fbfd; color: #07131d; border-radius: 0.5rem; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
.site-header { width: min(1440px, calc(100% - 2rem)); margin: 0 auto; padding: 1.25rem 0; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #274453; }
.brand { color: #edfaff; text-decoration: none; font-weight: 760; letter-spacing: -0.03em; font-size: 1.15rem; }
.review-badge { color: #a4dce9; border: 1px solid #315666; background: #0b202c; border-radius: 999px; padding: 0.3rem 0.7rem; font-size: 0.78rem; }
main { width: min(1440px, calc(100% - 2rem)); margin: 0 auto; }
.hero { padding: clamp(3rem, 8vw, 6.5rem) 0 3.5rem; display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr); gap: clamp(2rem, 6vw, 5rem); align-items: end; }
.eyebrow, .step { margin: 0 0 0.6rem; color: #65d6ee; font-size: 0.76rem; font-weight: 780; letter-spacing: 0.13em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 760px; margin-bottom: 1.1rem; font-size: clamp(3rem, 7vw, 6.4rem); line-height: 0.95; letter-spacing: -0.065em; }
.lede { max-width: 760px; margin-bottom: 0; color: #b8d2dc; font-size: clamp(1.15rem, 2vw, 1.55rem); line-height: 1.45; }
.privacy-card { padding: 1.5rem; border: 1px solid #2a5967; border-radius: 1rem; background: linear-gradient(145deg, #0d2935, #0a1b26); box-shadow: 0 22px 60px rgba(0,0,0,0.18); }
.privacy-card strong { display: block; color: #a8eddd; font-size: 1.05rem; }
.privacy-card p { margin: 0.5rem 0 0; color: #b5ccd5; font-size: 0.9rem; }
.workspace { overflow: hidden; margin-bottom: 5rem; border: 1px solid #294957; border-radius: 1.25rem; background: #0a1a25; box-shadow: 0 30px 80px rgba(0,0,0,0.22); }
.workspace-heading { display: flex; gap: 2rem; align-items: end; justify-content: space-between; padding: 2rem 2rem 1.25rem; }
.workspace-heading h2, .limits h2 { margin-bottom: 0; font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.1; letter-spacing: -0.04em; }
.workspace-heading > p { max-width: 490px; margin-bottom: 0; color: #9db7c2; }
.tool-picker { padding: 0.75rem 2rem 2rem; border-bottom: 1px solid #294957; }
.tool-picker-label { margin-bottom: 0.8rem; color: #c3d7df; font-size: 0.88rem; font-weight: 700; }
.tool-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.75rem; }
.tool-tab { position: relative; min-width: 0; min-height: 160px; padding: 1.2rem; display: grid; grid-template-rows: auto 1fr; gap: 0.9rem; align-items: start; text-align: left; border: 1px solid #315363; border-radius: 0.9rem; background: #0b202b; cursor: pointer; transition: border-color 160ms ease, background 160ms ease, transform 160ms ease; }
.tool-tab:hover { border-color: #4d8092; background: #0e2936; transform: translateY(-2px); }
.tool-tab:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, .drop-zone:focus-within { outline: 3px solid #72e0f4; outline-offset: 2px; }
.tool-tab.is-active { border-color: #67d9ee; background: linear-gradient(145deg, #123745, #0d2935); box-shadow: 0 0 0 1px #67d9ee, 0 12px 30px rgba(0,0,0,0.2); }
.tool-icon { width: 2.5rem; height: 2.5rem; display: grid; place-items: center; color: #83e5f5; border: 1px solid #356878; border-radius: 0.65rem; background: #102f3c; font-size: 1.25rem; font-weight: 800; line-height: 1; }
.tool-copy { min-width: 0; }
.tool-tab strong, .tool-tab small { display: block; }
.tool-tab strong { margin-bottom: 0.3rem; font-size: 1.04rem; }
.tool-tab small { color: #9bb4be; line-height: 1.4; }
.tool-panel { padding: clamp(1.25rem, 4vw, 2.5rem); }
.panel-intro { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 1.5rem; }
.panel-intro h3 { margin-bottom: 0; font-size: clamp(1.35rem, 3vw, 2rem); letter-spacing: -0.035em; }
.panel-intro > p { max-width: 420px; margin-bottom: 0; color: #9db7c2; }
.drop-zone { min-height: 150px; display: grid; place-content: center; gap: 0.35rem; padding: 1.5rem; text-align: center; border: 1.5px dashed #397387; border-radius: 1rem; background: #0b202b; cursor: pointer; transition: 160ms ease; }
.drop-zone:hover { border-color: #6cdaee; background: #0d2632; }
.drop-zone strong { font-size: 1.05rem; }
.drop-zone span { color: #91acb7; font-size: 0.9rem; }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-queue, .page-queue { margin-top: 1rem; display: grid; gap: 0.55rem; }
.queue-item { min-width: 0; display: flex; align-items: center; gap: 0.8rem; padding: 0.8rem 0.9rem; background: #0c222e; border: 1px solid #274b5a; border-radius: 0.75rem; }
.queue-order { width: 1.7rem; color: #64d9ef; font-size: 0.75rem; font-weight: 800; text-align: center; }
.queue-copy { min-width: 0; flex: 1; }
.queue-copy strong, .queue-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-copy small { color: #91abb5; }
.queue-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.queue-actions button { border: 1px solid #356273; border-radius: 0.45rem; background: #102d3a; padding: 0.35rem 0.55rem; cursor: pointer; font-size: 0.78rem; }
.queue-actions button:hover:not(:disabled) { background: #174052; }
.queue-actions button:disabled { opacity: 0.38; cursor: default; }
.queue-actions .remove { color: #ffc2ba; }
.selection-row { margin-top: 1rem; display: grid; grid-template-columns: minmax(240px, 1fr) minmax(180px, 0.5fr); gap: 1rem; align-items: end; }
.selection-row label, .image-options label { display: grid; gap: 0.4rem; color: #bad0d9; font-weight: 650; }
.selection-row input, select { width: 100%; border: 1px solid #386071; border-radius: 0.65rem; background: #081821; color: #edfaff; padding: 0.8rem; }
.selection-row input:disabled { opacity: 0.55; }
.page-count { margin-bottom: 0; padding: 0.82rem; color: #9ab5bf; background: #0b202b; border-radius: 0.65rem; }
.image-options { max-width: 380px; margin: 1rem 0 0; }
.action-row { min-height: 54px; margin-top: 1.5rem; display: flex; align-items: center; gap: 1rem; }
.primary-action { min-width: 210px; border: 0; border-radius: 0.65rem; background: #6cdef0; color: #04202a; padding: 0.82rem 1.1rem; font-weight: 800; cursor: pointer; }
.primary-action:hover:not(:disabled) { background: #a2eef8; }
.primary-action:disabled { background: #36505a; color: #90a4ac; cursor: not-allowed; }
.status { margin-bottom: 0; color: #aad1da; }
.status.is-error { color: #ffc0b7; }
.status.is-success { color: #a4ebd8; }
.secondary-action, .text-action, .page-toolbar button, .annotation-tool { border: 1px solid #356273; border-radius: 0.55rem; background: #102d3a; color: #eaf5fa; padding: 0.6rem 0.75rem; cursor: pointer; font-weight: 700; }
.secondary-action:hover:not(:disabled), .page-toolbar button:hover:not(:disabled), .annotation-tool:hover, .text-action:hover { background: #174052; }
.secondary-action:disabled, .page-toolbar button:disabled { opacity: 0.42; cursor: not-allowed; }
.text-action { padding: 0; border: 0; background: transparent; color: #7dddf4; text-align: left; }
.danger-action { color: #ffc2ba; }
.editor-shell { margin-top: 1.5rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.editor-sidebar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.editor-section { min-width: 0; display: grid; align-content: start; gap: 0.8rem; padding: 1.2rem; border: 1px solid #294957; border-radius: 0.9rem; background: #081821; }
#replace-options.is-guided { border-color: #6de4f5; box-shadow: 0 0 0 2px rgba(109,228,245,0.22), 0 18px 46px rgba(0,0,0,0.28); }
.selection-guide { display: grid; gap: 0.35rem; padding: 0.9rem; border: 1px solid #397f91; border-radius: 0.7rem; background: linear-gradient(145deg, #123846, #0d2935); }
.selection-guide strong { color: #f2fcff; font-size: 1rem; }
.selection-guide p { margin: 0; color: #b9d5dd; font-size: 0.8rem; }
.selection-step { width: max-content; padding: 0.18rem 0.5rem; border-radius: 999px; background: #6de4f5; color: #04202a; font-size: 0.68rem; font-weight: 850; letter-spacing: 0.08em; text-transform: uppercase; }
.read-only-label { margin-left: 0.35rem; padding: 0.12rem 0.38rem; border: 1px solid #456673; border-radius: 999px; color: #90aab4; font-size: 0.64rem; text-transform: uppercase; }
#detected-text[readonly] { border-style: dashed; background: #0b2029; color: #9eb6c0; cursor: not-allowed; }
.replacement-target { display: grid; gap: 0.55rem; padding: 0.85rem; border: 2px solid #6de4f5; border-radius: 0.75rem; background: #0d2935; box-shadow: 0 0 0 4px rgba(109,228,245,0.1); }
.replacement-target textarea { min-height: 92px; border-color: #7de8f7 !important; background: #06141c !important; font-size: 1rem; }
.replacement-target textarea:focus { outline: 3px solid #a8eddd; outline-offset: 2px; }
.preview-instruction { margin: 0; color: #a8eddd; font-size: 0.78rem; font-weight: 700; }
.blank-line-actions { display: grid; gap: 0.45rem; padding: 0.8rem; border: 1px solid #3f7968; border-radius: 0.65rem; background: #0c2925; }
.blank-line-actions strong { color: #a8eddd; }
.blank-line-actions p { margin: 0; color: #b8d5cd; font-size: 0.78rem; }
.apply-changes { border-color: #72e0f4; background: #17485a; }
.save-pdf-prompt { display: grid; gap: 0.75rem; padding: 0.85rem; border: 1px solid #4e9b83; border-radius: 0.7rem; background: #0b2924; }
.save-pdf-prompt div { display: grid; gap: 0.15rem; }
.save-pdf-prompt strong { color: #a8eddd; }
.save-pdf-prompt span { color: #b7d0c8; font-size: 0.78rem; }
.save-pdf-prompt .primary-action { min-width: 0; width: 100%; }
.editor-section label, .field-label { margin: 0; color: #bad0d9; font-size: 0.82rem; font-weight: 700; }
.editor-label { margin: 0; color: #eaf5fa; font-weight: 800; }
.editor-section input[type="text"], .editor-section textarea, .signature-method-panel input[type="text"] { width: 100%; border: 1px solid #386071; border-radius: 0.55rem; background: #07131d; color: #edfaff; padding: 0.65rem; resize: vertical; }
.editor-section textarea:disabled { opacity: 0.55; }
.editor-section input[type="range"] { width: 100%; accent-color: #67d9ee; }
.annotation-tools { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.4rem; }
.annotation-tool { padding: 0.55rem 0.35rem; font-size: 0.78rem; }
.annotation-tool.is-active { border-color: #67d9ee; background: #123745; color: #a8eddd; }
.editor-help { margin: 0; color: #8faab5; font-size: 0.78rem; }
.editor-warning { margin: 0; padding: 0.65rem; border: 1px solid #765e2d; border-radius: 0.5rem; background: #2b2413; color: #f2dca5; font-size: 0.76rem; }
.signature-ready { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.65rem; align-items: center; }
.signature-ready img { width: 100%; max-height: 70px; object-fit: contain; object-position: left center; padding: 0.4rem; background: #edfaff; border-radius: 0.4rem; }
.editor-history { grid-template-columns: 1fr 1fr; }
.editor-history .text-action { grid-column: 1 / -1; }
.editor-workarea { min-width: 0; border: 1px solid #294957; border-radius: 0.9rem; background: #061018; overflow: hidden; }
.page-toolbar { min-height: 52px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.6rem; border-bottom: 1px solid #294957; background: #0b202b; }
.page-toolbar button { padding: 0.42rem 0.65rem; font-size: 0.78rem; }
.page-toolbar span { min-width: 68px; color: #bad0d9; font-size: 0.82rem; text-align: center; }
.page-toolbar .toolbar-divider { min-width: 1px; width: 1px; height: 24px; margin: 0 0.25rem; background: #315363; }
.placement-hint { margin: 0; padding: 0.65rem 1rem; color: #9db7c2; border-bottom: 1px solid #294957; font-size: 0.82rem; text-align: center; }
.pdf-stage-scroll { min-height: 680px; max-height: 920px; padding: 2rem; overflow: auto; background-color: #101a20; background-image: linear-gradient(45deg, rgba(255,255,255,0.025) 25%, transparent 25%), linear-gradient(-45deg, rgba(255,255,255,0.025) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.025) 75%), linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.025) 75%); background-size: 24px 24px; background-position: 0 0, 0 12px, 12px -12px, -12px 0; }
.pdf-stage { position: relative; width: max-content; margin: 0 auto; background: white; box-shadow: 0 15px 50px rgba(0,0,0,0.42); }
#pdf-canvas { display: block; max-width: none; }
.annotation-layer { position: absolute; inset: 0; z-index: 3; pointer-events: none; touch-action: none; }
.text-edit-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.editable-text { position: absolute; min-width: 8px; min-height: 8px; padding: 0; border: 1px solid transparent; background: transparent; color: transparent; cursor: text; pointer-events: auto; }
.text-edit-layer.is-active .editable-text { border: 1px dashed rgba(3, 123, 153, 0.48); background: rgba(67, 215, 239, 0.08); }
.editable-text:hover, .editable-text:focus-visible, .editable-text.is-selected { border: 2px solid #09aeca; background: rgba(67, 215, 239, 0.2); outline: 0; }
.placed-object { position: absolute; display: grid; place-items: center; min-width: 28px; min-height: 20px; user-select: none; touch-action: none; cursor: move; transform-origin: top left; pointer-events: auto; }
.placed-object.is-selected { outline: 2px solid #09aeca; outline-offset: 3px; }
.object-resize-handle { display: none; position: absolute; right: -8px; bottom: -8px; width: 13px; height: 13px; border: 2px solid #04202a; border-radius: 50%; background: #72e0f4; cursor: nwse-resize; pointer-events: auto; touch-action: none; }
.placed-object.is-selected .object-resize-handle { display: block; }
.placed-object.object-text { justify-items: start; color: #10212a; font-weight: 650; white-space: pre-wrap; overflow-wrap: anywhere; }
.placed-object.object-stamp { padding: 0.25rem 0.5rem; border: 3px solid #bd2734; border-radius: 0.35rem; background: rgba(255,255,255,0.82); color: #a71928; font-weight: 900; letter-spacing: 0.07em; line-height: 1; text-transform: uppercase; }
.placed-object.object-replacement { justify-items: start; padding: 0 2px; background: #fff; color: #111; font-family: Arial, Helvetica, sans-serif; line-height: 1.05; white-space: pre; overflow: hidden; }
.replacement-preview { opacity: 0.82; outline: 2px dashed #00aeca; outline-offset: 3px; pointer-events: none; }
.replacement-preview::before { content: "Live preview"; position: absolute; left: 0; bottom: calc(100% + 7px); padding: 0.16rem 0.38rem; border-radius: 0.3rem; background: #007f98; color: #fff; font: 700 10px/1.2 Inter, ui-sans-serif, system-ui, sans-serif; white-space: nowrap; }
.placed-object.object-signature img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.signature-dialog { width: min(680px, calc(100% - 2rem)); max-height: calc(100vh - 2rem); padding: 0; border: 1px solid #3a6a7a; border-radius: 1rem; background: #0a1a25; color: #eaf5fa; box-shadow: 0 30px 100px rgba(0,0,0,0.6); }
.signature-dialog::backdrop { background: rgba(1,8,12,0.8); backdrop-filter: blur(4px); }
.signature-dialog form { display: grid; gap: 1rem; padding: 1.25rem; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.dialog-heading h2 { margin-bottom: 0; font-size: clamp(1.45rem, 4vw, 2rem); }
.dialog-close { border: 0; background: transparent; color: #7dddf4; cursor: pointer; }
.signature-methods { display: flex; flex-wrap: wrap; gap: 0.7rem 1.1rem; padding: 0.9rem; border: 1px solid #315363; border-radius: 0.65rem; }
.signature-methods legend { padding: 0 0.35rem; color: #bad0d9; font-size: 0.82rem; font-weight: 700; }
.signature-methods label { display: flex; align-items: center; gap: 0.35rem; }
.signature-method-panel { display: grid; gap: 0.6rem; }
#signature-canvas { width: 100%; height: 190px; border: 1px solid #4f7d8d; border-radius: 0.65rem; background: #f7fbfc; cursor: crosshair; touch-action: none; }
.signature-upload { display: grid; place-items: center; min-height: 110px; padding: 1rem; border: 1.5px dashed #397387; border-radius: 0.75rem; background: #0b202b; color: #eaf5fa; cursor: pointer; text-align: center; }
.signature-upload input { margin-top: 0.6rem; max-width: 100%; }
#signature-image-name { margin: 0; color: #9db7c2; font-size: 0.82rem; }
.dialog-actions { display: flex; justify-content: end; gap: 0.7rem; }
.dialog-actions .primary-action { min-width: 170px; }
.limits { display: grid; grid-template-columns: minmax(250px, 0.65fr) minmax(0, 1fr); gap: clamp(2rem, 8vw, 7rem); padding-bottom: 5rem; }
.limits ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 1rem; }
.limits li { padding: 0 0 1rem; color: #a8c0ca; border-bottom: 1px solid #294957; }
.limits strong { color: #eaf5fa; }
footer { width: min(1440px, calc(100% - 2rem)); margin: 0 auto; padding: 1.5rem 0 2.5rem; display: flex; justify-content: space-between; gap: 1rem; color: #829da8; border-top: 1px solid #294957; font-size: 0.9rem; }
footer p { margin-bottom: 0; }

@media (max-width: 1180px) {
  .editor-sidebar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .hero, .limits { grid-template-columns: 1fr; }
  .hero { align-items: start; }
  .privacy-card { max-width: 620px; }
  .tool-tabs { grid-template-columns: repeat(2, 1fr); }
  .editor-sidebar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pdf-stage-scroll { min-height: 460px; }
  .workspace-heading, .panel-intro { align-items: start; flex-direction: column; gap: 0.75rem; }
}

@media (max-width: 560px) {
  main, .site-header, footer { width: min(100% - 1rem, 1180px); }
  .site-header { padding: 1rem 0.25rem; }
  .hero { padding: 2.6rem 0.25rem 2.5rem; }
  h1 { font-size: clamp(2.65rem, 14vw, 4.1rem); }
  .workspace-heading, .tool-panel { padding: 1.25rem; }
  .tool-picker { padding: 0.5rem 1.25rem 1.25rem; }
  .tool-tabs { grid-template-columns: 1fr; }
  .tool-tab { min-height: 0; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 0.35rem 0.9rem; }
  .tool-icon { grid-row: 1 / 3; }
  .editor-sidebar { grid-template-columns: 1fr; }
  .editor-panel { padding-inline: 0.75rem; }
  .pdf-stage-scroll { min-height: 420px; padding: 0.75rem; }
  .page-toolbar .toolbar-divider { display: none; }
  .signature-methods { display: grid; }
  .dialog-actions { align-items: stretch; flex-direction: column-reverse; }
  .dialog-actions .primary-action, .dialog-actions .secondary-action { width: 100%; }
  .selection-row { grid-template-columns: 1fr; }
  .queue-item { align-items: flex-start; flex-wrap: wrap; }
  .queue-copy { width: calc(100% - 3rem); }
  .queue-actions { width: 100%; padding-left: 2.5rem; }
  .action-row { align-items: stretch; flex-direction: column; }
  .primary-action { width: 100%; }
  footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
