@layer reset, base, components, editor, responsive;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; }
  body, h1, h2, h3, p { margin: 0; }
  button, input, select, textarea { font: inherit; }
  button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
  button { cursor: pointer; }
  button:disabled { cursor: default; }
  a { color: inherit; text-decoration: none; }
  [hidden] { display: none !important; }
}

@layer base {
  :root {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #293c32;
    background: #f8f7f3;
    font-synthesis: none;
    --ink: #293c32;
    --muted: #858a80;
    --line: #e6e7df;
    --forest: #293c32;
    --lime: #dde8b5;
    --paper: #fff;
  }
  body { min-width: 0; }
  button { border: 0; background: transparent; color: inherit; }
  svg { display: block; width: 20px; height: 20px; flex-shrink: 0; stroke-width: 1.7; }
  [data-icon] { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
  button, a, input, select, textarea { outline-offset: 4px; }
  :focus-visible { outline: 3px solid #819a55; }
  ::selection { color: #293c32; background: #dde8b5; }
  button { transition: background-color .16s, border-color .16s, box-shadow .16s, color .16s, opacity .16s; }
  button:disabled { opacity: .32; }
}

@layer components {
  .topbar { height: 80px; padding: 0 42px; display: flex; align-items: center; gap: 23px; border-bottom: 1px solid #e6e7df; background: #faf9f6; }
  .brand { display: inline-flex; align-items: center; gap: 10px; font-size: 25px; font-weight: 750; letter-spacing: -1.2px; }
  .brand-icon { width: 34px; height: 37px; border-radius: 9px; background: var(--forest); color: #edf0e2; transform: rotate(-5deg); }
  .brand-icon svg { width: 21px; height: 21px; }
  .brand-light { font-weight: 450; }
  .brand-dot { color: #97a864; }
  .top-divider { height: 23px; width: 1px; background: #dedfd6; }
  .app-name { font-size: 12px; color: #8b8f85; }
  .top-actions { display: flex; align-items: center; margin-left: auto; gap: 23px; }
  .local-badge { display: flex; align-items: center; gap: 8px; color: #7f8779; font-size: 11px; }
  .status-dot { width: 6px; height: 6px; background: #8eaa70; border-radius: 50%; flex-shrink: 0; }
  .icon-button { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; color: #858b7f; border-radius: 7px; flex-shrink: 0; }
  .icon-button svg { width: 18px; height: 18px; }
  .icon-button:hover:not(:disabled) { color: var(--forest); background: #e9ece2; }
  .avatar { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid #d5ddc6; border-radius: 50%; font-size: 12px; font-weight: 600; background: #e9eddf; color: #6e795e; }
  .button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 39px; padding: 0 16px; border: 1px solid transparent; border-radius: 7px; font-size: 12px; font-weight: 600; white-space: nowrap; }
  .button svg { width: 17px; height: 17px; }
  .button-primary { background: var(--forest); color: #fff; box-shadow: 0 2px 3px #293c3210; }
  .button-primary:hover:not(:disabled) { background: #3b5142; box-shadow: 0 3px 9px #293c3226; }
  .button-secondary { background: #fff; border-color: #e0e3d9; color: #5a6655; }
  .button-secondary:hover:not(:disabled) { border-color: #bfc9b0; background: #f6f8f1; }
  .button-danger { background: #fbf3ef; color: #a76051; border-color: #f0ded6; }
  .button-danger:hover:not(:disabled) { background: #f5e7df; }

  .welcome { max-width: 1120px; padding: 49px 32px 24px; margin: 0 auto; }
  .welcome-heading { text-align: center; }
  .eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 9px; letter-spacing: 1.75px; font-weight: 650; color: #828b73; }
  .eyebrow > span { width: 5px; height: 5px; border-radius: 50%; background: #97aa73; }
  h1 { margin: 18px 0 17px; font-size: clamp(40px, 4.2vw, 60px); font-weight: 500; line-height: 1.09; letter-spacing: -2.9px; }
  h1 > span { color: #8a967d; }
  .welcome-heading > p { color: #8c9085; font-size: 12px; line-height: 1.85; }
  .upload-card { position: relative; max-width: 692px; min-height: 323px; margin: 32px auto 0; display: flex; flex-direction: column; align-items: center; border: 1px dashed #cdd4bd; border-radius: 13px; background: #fdfdfa; box-shadow: 0 4px 25px #293c3203; transition: border-color .2s, background .2s, box-shadow .2s; }
  .upload-card.document-drag-over, .document-drag-over .upload-card { background: #f0f4e5; border-color: #6c8650; box-shadow: 0 0 0 5px #dbe4c955; }
  .upload-illustration { position: relative; width: 180px; height: 137px; margin: 17px 0 2px; }
  .upload-illustration::before { content: ""; position: absolute; inset: 19px 14px 1px; border-radius: 50%; background: #f0f2e7; }
  .document-art { position: absolute; top: 12px; left: 47px; width: 91px; height: 109px; border: 1px solid #dfe5d5; border-radius: 5px; background: #fff; box-shadow: -5px 7px 0 #e9ede0, 0 6px 12px #4052350d; transform: rotate(-7deg); padding: 12px 12px; }
  .art-fold { position: absolute; right: -1px; top: -1px; width: 16px; height: 16px; background: #edf0e5; border-bottom: 1px solid #dfe5d5; border-left: 1px solid #dfe5d5; border-radius: 0 5px 0 3px; clip-path: polygon(0 0, 100% 100%, 0 100%); }
  .art-badge { display: inline-block; font-size: 7px; font-weight: 750; letter-spacing: .5px; color: #84916c; background: #eef2e5; border-radius: 3px; padding: 3px 5px; margin-bottom: 9px; }
  .art-line { width: 61px; height: 3px; background: #e9eddf; border-radius: 5px; margin-bottom: 5px; }
  .art-line-short { width: 32px; }
  .art-line-medium { width: 46px; margin-top: 7px; }
  .art-input { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; width: 69px; margin-left: -4px; height: 17px; border: 1px solid #a2b582; border-radius: 3px; padding: 0 4px; background: #f4f7eb; font-size: 5px; color: #778762; }
  .art-caret { height: 8px; width: 1px; background: #8b9f65; }
  .art-signature { position: absolute; right: 6px; bottom: 6px; color: #7f9460; font: italic 12px Georgia, serif; transform: rotate(-5deg); }
  .art-pencil { position: absolute; left: 128px; top: 67px; width: 30px; height: 30px; color: #8eaa62; transform: rotate(-22deg); }
  .art-pencil svg { width: 29px; height: 29px; stroke-width: 1.7; }
  .floating-dot { position: absolute; border-radius: 50%; }
  .dot-one { top: 27px; right: 27px; width: 6px; height: 6px; background: #d6e2b7; }
  .dot-two { bottom: 19px; left: 20px; width: 4px; height: 4px; background: #bfcda5; }
  .upload-card > h2 { font-size: 17px; font-weight: 600; letter-spacing: -.45px; }
  .upload-card > p { color: #979b8e; font-size: 11px; margin: 8px 12px 18px; text-align: center; line-height: 1.5; }
  .upload-main { gap: 12px; min-height: 42px; padding: 0 19px; font-size: 11px; border-radius: 6px; }
  .upload-main > [data-icon="arrow-right"] { margin-left: 12px; }
  .upload-limit { font-size: 9px; color: #aaad9f; margin: 10px 0 16px; }
  .upload-bottom { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; margin-top: auto; min-height: 37px; border-top: 1px solid #eef0e6; color: #a2a698; font-size: 9px; }
  .upload-bottom svg { width: 11px; height: 11px; }
  .demo-link { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 18px auto 0; font-size: 10px; color: #949989; line-height: 1.7; }
  .demo-link strong { font-weight: 500; color: #778767; border-bottom: 1px solid #c4ceb5; }
  .demo-link svg { width: 12px; height: 12px; }
  .demo-link > [data-icon="sparkles"] { color: #9caa81; margin-right: 2px; }
  .demo-link:hover strong { color: #3d5739; border-color: #6e8755; }
  .features { display: grid; grid-template-columns: repeat(3, 1fr); max-width: 833px; margin: 45px auto 0; gap: 32px; }
  .features article { display: flex; align-items: flex-start; gap: 12px; }
  .feature-icon { width: 33px; height: 33px; background: #eef0e6; color: #8b9b72; border-radius: 9px; }
  .feature-icon svg { width: 17px; height: 17px; }
  .features h3 { margin-top: 3px; font-size: 11px; font-weight: 600; letter-spacing: -.1px; }
  .features p { color: #a0a395; font-size: 9px; margin-top: 6px; line-height: 1.7; }
  .welcome-footer { margin: 47px auto 0; padding-top: 17px; max-width: 960px; border-top: 1px solid #e8e9df; display: flex; justify-content: space-between; font-size: 8px; color: #b0b3a5; letter-spacing: 1.3px; }
  .welcome-footer > span:last-child { display: inline-flex; align-items: center; gap: 5px; letter-spacing: .1px; }
  .welcome-footer svg { width: 11px; height: 11px; }
  .restore-banner { display: flex; align-items: center; justify-content: center; gap: 10px; max-width: 692px; margin: 18px auto 0; padding: 11px 12px; background: #edf1e3; border: 1px solid #dce4ce; border-radius: 8px; font-size: 11px; color: #6b7b5d; }
  .restore-banner svg { width: 16px; height: 16px; }
  .restore-banner > button { font-size: 10px; text-decoration: underline; font-weight: 600; }
  .restore-banner > button:last-child { margin-left: auto; }

  .toast-stack { position: fixed; right: 25px; bottom: 24px; z-index: 100; display: grid; gap: 10px; max-width: min(380px, calc(100vw - 32px)); pointer-events: none; }
  .toast { display: flex; align-items: center; gap: 11px; padding: 14px 17px; border-radius: 10px; background: #fff; border: 1px solid #e1e5d9; box-shadow: 0 8px 35px #293c321b; color: #526247; font-size: 12px; line-height: 1.5; animation: toast-in .22s ease-out; pointer-events: auto; }
  .toast svg { width: 18px; height: 18px; color: #829d5c; }
  .toast.error, .toast-error { color: #a45243; border-color: #ecd6cd; background: #fffaf7; }
  .toast.error svg, .toast-error svg { color: #b96f5b; }
  .toast.removing { opacity: 0; transform: translateY(6px); transition: .2s; }
  .busy-overlay { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 13px; z-index: 150; background: #f8f7f3e8; backdrop-filter: blur(4px); }
  .busy-overlay strong { font-size: 17px; font-weight: 500; margin-top: 5px; }
  .busy-overlay > span:last-child { font-size: 12px; color: #929987; }
  .spinner { display: inline-block; width: 24px; height: 24px; border: 2px solid #e0e6d4; border-top-color: #718d50; border-radius: 50%; animation: spin .75s linear infinite; }
  dialog { width: min(480px, calc(100vw - 32px)); padding: 29px; border: 1px solid #e2e6d9; border-radius: 15px; color: var(--forest); background: #fdfdfa; box-shadow: 0 20px 100px #18291f33; }
  dialog::backdrop { background: #22352a55; backdrop-filter: blur(3px); }
  .dialog-title { display: flex; align-items: center; gap: 12px; }
  .dialog-title h2 { font-size: 21px; font-weight: 500; letter-spacing: -.6px; }
  .dialog-title .icon-button { margin-left: auto; }
  dialog ol { margin: 27px 0; padding-left: 23px; display: grid; gap: 20px; }
  dialog li { padding-left: 5px; font-size: 12px; line-height: 1.7; color: #8c9483; }
  dialog li::marker { color: #8c9f6c; font-weight: 600; }
  dialog li strong { display: block; color: #485a40; font-size: 13px; margin-bottom: 2px; font-weight: 600; }
  .help-note { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border-radius: 8px; background: #f0f3e7; color: #7c896d; }
  .help-note svg { width: 16px; height: 16px; margin-top: 1px; }
  .help-note p { font-size: 10px; line-height: 1.7; }
  .help-privacy { display: flex; align-items: flex-start; gap: 7px; color: #9ca38f; font-size: 9px; line-height: 1.6; margin: 15px 0 22px; }
  .help-privacy svg { width: 13px; height: 13px; margin-top: 1px; }
  #help-ok { width: 100%; min-height: 43px; }
  #help-ok [data-icon] { margin-left: auto; }
  #confirm-dialog p { font-size: 12px; color: #8d9582; line-height: 1.8; margin: 17px 0 25px; }
  .confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }
  @keyframes spin { to { transform: rotate(360deg); } }
  @keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
}

@layer editor {
  .editor { height: calc(100dvh - 80px); min-height: 450px; display: flex; flex-direction: column; background: #f8f9f5; overflow: hidden; }
  .document-bar { display: flex; align-items: center; gap: 13px; min-height: 76px; padding: 0 27px; border-bottom: 1px solid var(--line); background: #fdfdfa; }
  .file-meta { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
  .file-meta strong { font-size: 13px; font-weight: 600; max-width: 350px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .file-meta > span { color: #9ba18f; font-size: 10px; }
  .document-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
  .draft-state { display: flex; align-items: center; gap: 6px; color: #9ca48e; margin-right: 12px; font-size: 10px; }
  .editor-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); flex: 1; min-height: 0; position: relative; }
  .editor-layout:has(> .inspector:not([hidden])) { grid-template-columns: 280px minmax(0, 1fr) 240px; }
  .left-panel { background: #fcfcf9; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
  .panel-tabs { display: flex; align-items: stretch; flex-shrink: 0; height: 55px; border-bottom: 1px solid #e8eadf; padding: 0 19px; gap: 22px; }
  .panel-tabs > button { display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 11px; color: #a0a68f; position: relative; padding: 0 3px; }
  .panel-tabs > button[aria-selected="true"] { color: #536448; font-weight: 600; }
  .panel-tabs > button[aria-selected="true"]::after { content: ""; position: absolute; bottom: -1px; left: 0; right: 0; height: 2px; background: #92a875; border-radius: 2px; }
  .panel-tabs > button > span { display: inline-grid; place-items: center; padding: 1px 5px; min-width: 17px; min-height: 16px; border-radius: 4px; background: #e8eddd; font-size: 9px; color: #80936a; }
  .panel-content { padding: 25px 22px 18px; overflow: auto; scrollbar-width: thin; scrollbar-color: #d6ddc9 transparent; }
  .panel-heading h2 { font-size: 13px; font-weight: 600; letter-spacing: -.2px; }
  .panel-heading p { font-size: 10px; line-height: 1.8; color: #a1a68f; margin-top: 7px; max-width: 220px; }
  #form-fields { margin-top: 23px; }
  .field-group { margin-bottom: 18px; }
  .field-label, .field-group > label { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 11px; font-weight: 500; color: #738163; margin-bottom: 7px; line-height: 1.5; }
  .field-label span { overflow: hidden; text-overflow: ellipsis; }
  .field-location { display: block; font-size: 9px; font-weight: 400; color: #b1b6a3; margin-top: 5px; }
  .field-badge { padding: 1px 5px; background: #f0f3e8; border-radius: 4px; font-size: 8px; color: #a0ac8f; }
  .field-group input:not([type="checkbox"]):not([type="radio"]), .field-group textarea, .field-group select { width: 100%; min-height: 35px; padding: 8px 10px; border: 1px solid #dfe5d4; border-radius: 6px; background: #fff; color: #536247; font-size: 11px; line-height: 1.4; }
  .field-group textarea { min-height: 64px; resize: vertical; }
  .field-group input::placeholder, .field-group textarea::placeholder { color: #bcc3af; }
  .field-group input:focus, .field-group textarea:focus, .field-group select:focus { outline: 2px solid #dde8c5; outline-offset: 1px; border-color: #9db77d; }
  .field-group input[type="checkbox"], .field-group input[type="radio"] { width: 15px; height: 15px; accent-color: #78955a; }
  .field-group label:has(input[type="checkbox"]), .field-group label:has(input[type="radio"]) { justify-content: flex-start; gap: 9px; }
  .field-row { display: flex; align-items: center; gap: 9px; }
  .empty-fields { border: 1px dashed #dfe4d4; border-radius: 8px; padding: 17px 14px; text-align: center; color: #9da68c; font-size: 10px; line-height: 1.8; background: #f9faf5; }
  .empty-fields [data-icon] { margin: 0 auto 8px; display: flex; color: #a9b993; }
  .empty-fields strong { display: block; font-weight: 500; color: #7f8b70; margin-bottom: 5px; }
  .empty-fields p { font-size: 10px; }
  .panel-section { margin-top: 26px; padding-top: 23px; border-top: 1px solid #e8ebdf; }
  .section-label { display: block; color: #abb39c; font-size: 8px; font-weight: 600; letter-spacing: 1.3px; margin-bottom: 13px; }
  .empty-overlay { font-size: 10px; color: #b1b9a1; line-height: 1.7; margin: 0 0 12px; }
  .add-field-button { display: flex; justify-content: center; align-items: center; gap: 7px; min-height: 35px; width: 100%; border: 1px dashed #d5dec5; border-radius: 6px; font-size: 10px; color: #869773; background: #f9fbf5; }
  .add-field-button svg { width: 14px; height: 14px; }
  .add-field-button:hover { background: #edf3e3; border-color: #a7bb8b; color: #68864c; }
  .overlay-row { display: flex; align-items: center; width: 100%; min-height: 39px; gap: 9px; padding: 8px 9px; text-align: left; background: #f7f9f2; border: 1px solid #e5eadb; border-radius: 6px; margin-bottom: 8px; font-size: 10px; color: #8b987a; }
  .overlay-row > span:not([data-icon]) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .overlay-row svg { width: 14px; height: 14px; }
  .overlay-row .field-location { margin-left: auto; flex-shrink: 0; font-size: 8px; }
  .overlay-row:hover, .overlay-row.selected { border-color: #b9cba1; background: #edf3e3; color: #6d8456; }
  .overlay-kind { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 4px; background: #e9efdd; color: #8ba671; font-weight: 600; }
  .panel-tip { display: flex; align-items: flex-start; gap: 9px; margin-top: 30px; background: #f3f5ec; border: 1px solid #e8ecdf; border-radius: 8px; padding: 12px; }
  .panel-tip > [data-icon] { color: #a2b285; margin-top: 2px; }
  .panel-tip svg { width: 14px; height: 14px; }
  .panel-tip p { color: #a9b296; font-size: 9px; line-height: 1.8; }
  .panel-tip strong { display: block; color: #8b9a75; font-size: 10px; font-weight: 500; margin-bottom: 3px; }
  .pages-panel { background: #f8f9f4; }
  #thumbnails { display: grid; justify-items: center; gap: 20px; }
  .thumbnail { max-width: 100%; display: flex; flex-direction: column; align-items: center; gap: 9px; font-size: 10px; color: #a0ac8e; padding: 10px; border: 1px solid transparent; border-radius: 8px; }
  .thumbnail:hover { background: #edf2e3; }
  .thumbnail.active { border-color: #c6d5b1; color: #758f58; background: #edf3e3; }
  .thumbnail canvas { display: block; width: 145px; max-width: 100%; height: auto; background: #fff; box-shadow: 0 2px 6px #293c321a; }
  .workspace { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #eceedf; position: relative; }
  .toolbar { min-height: 55px; padding: 0 19px; display: flex; align-items: center; gap: 16px; border-bottom: 1px solid #e2e6d7; background: #fdfdfa; z-index: 3; flex-shrink: 0; }
  .tool-group { display: flex; align-items: center; gap: 4px; }
  .tool { min-height: 33px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 6px; font-size: 10px; color: #8c987d; }
  .tool svg { width: 16px; height: 16px; }
  .tool:hover { background: #f0f3e8; color: #6e835a; }
  .tool.active { background: #eaf0dc; border-color: #dde6cd; color: #6c8255; }
  .toolbar-divider { width: 1px; height: 20px; background: #e5e9db; }
  .toolbar .icon-button { width: 29px; height: 29px; }
  .toolbar .icon-button svg { width: 15px; height: 15px; }
  .toolbar-spacer { flex: 1; }
  .zoom-controls { display: flex; align-items: center; gap: 6px; }
  #zoom-fit { min-width: 45px; font-size: 10px; color: #849673; }
  .tool-hint { min-height: 37px; padding: 8px 25px; display: flex; align-items: center; gap: 7px; background: #f5f7ef; color: #a4b08f; font-size: 9px; line-height: 1.4; border-bottom: 1px solid #e3e8d7; flex-shrink: 0; }
  .tool-hint > [data-icon] { color: #a3b48c; }
  .tool-hint svg { width: 12px; height: 12px; }
  .hint-badge { display: flex; align-items: center; gap: 5px; margin-left: auto; padding: 3px 7px; background: #edf3e1; border: 1px solid #e0e9d1; border-radius: 4px; color: #9caf85; font-size: 8px; white-space: nowrap; }
  .hint-badge::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: #a0b980; }
  .canvas-scroll { overflow: auto; flex: 1; min-height: 0; position: relative; padding: 30px 32px 40px; text-align: center; background-color: #eceee5; background-image: radial-gradient(#bfc7b535 .65px, transparent .65px); background-size: 6px 6px; scrollbar-width: thin; scrollbar-color: #bdc8ad transparent; }
  .page-wrap { position: relative; display: inline-block; text-align: left; background: white; vertical-align: top; box-shadow: 0 3px 5px #293c3207, 0 9px 25px #293c3214; flex-shrink: 0; user-select: none; }
  #pdf-canvas { display: block; }
  .direct-layer, .field-layer, .overlay-layer, .selection-layer, .direct-editor-layer { position: absolute; inset: 0; }
  .direct-layer { z-index: 1; pointer-events: none; }
  .field-layer { z-index: 2; pointer-events: none; }
  .overlay-layer { z-index: 3; pointer-events: none; }
  .selection-layer { pointer-events: none; }
  .field-layer > *, .overlay-layer > * { pointer-events: auto; }
  .selection-layer { z-index: 8; }
  .workspace[data-tool="text"] .page-wrap { cursor: text; }
  .workspace[data-tool="edit"] .page-wrap { cursor: text; }
  .workspace[data-tool="check"] .page-wrap, .workspace[data-tool="whiteout"] .page-wrap { cursor: crosshair; }
  .workspace[data-tool="select"] .page-wrap { cursor: default; }
  .pdf-field { position: absolute; margin: 0; min-width: 0; min-height: 0; padding: 1px 3px; border: 1px solid #a8bd8680; background: #eaf4cf55; color: #293c32; border-radius: 2px; font-family: Helvetica, Arial, sans-serif; line-height: 1.2; resize: none; outline-offset: 0; }
  .pdf-field:hover { background: #ddecbf88; border-color: #9bb779; }
  .pdf-field:focus, .pdf-field.field-focus { border: 1px solid #7d9e55; background: #f2f8e8d9; outline: 2px solid #a3bf7d55; z-index: 2; }
  .pdf-field[type="checkbox"], .pdf-field[type="radio"] { padding: 0; cursor: pointer; accent-color: #6e8b50; }
  select.pdf-field { cursor: pointer; padding: 0; }
  .pdf-overlay { position: absolute; margin: 0; min-width: 0; min-height: 0; border: 0; outline: 1px solid transparent; outline-offset: 0; transform-origin: top left; }
  .pdf-overlay:hover { outline-color: #a3bc7d; }
  .pdf-overlay.selected { outline-color: #88aa62; z-index: 4; }
  .pdf-overlay.dragging { border-color: #718f4e; cursor: grabbing; opacity: .85; }
  .overlay-content { display: block; padding: 0; width: 100%; height: 100%; margin: 0; overflow: hidden; color: inherit; font-family: Helvetica, Arial, sans-serif; line-height: 1.25; white-space: pre-wrap; overflow-wrap: break-word; cursor: text; user-select: text; outline: none; border: 0; background: transparent; resize: none; }
  .overlay-content:empty::before { content: attr(data-placeholder); color: #a7b29c; }
  .overlay-check { display: flex; align-items: center; justify-content: center; cursor: move; width: 100%; height: 100%; }
  .overlay-check svg { width: 100%; height: 100%; stroke-width: 9.5; }
  .overlay-layer.placing, .overlay-layer.placing *, .workspace:not([data-tool="select"]):not([data-tool="edit"]) .field-layer * { pointer-events: none; }
  .workspace[data-tool="edit"] .field-layer { pointer-events: none !important; }
  .workspace[data-tool="edit"] .field-layer > * { pointer-events: auto; }
  .move-handle, .resize-handle { touch-action: none; }
  .overlay-whiteout, .pdf-overlay.whiteout { background: #fff; }
  .pdf-overlay.check .overlay-content, .pdf-overlay.whiteout .overlay-content { cursor: move; }
  .move-handle { display: none; position: absolute; left: -1px; top: -21px; height: 19px; min-width: 24px; padding: 2px 5px; background: #88a963; color: #fff; border-radius: 3px 3px 0 0; cursor: grab; align-items: center; justify-content: center; font-size: 8px; user-select: none; }
  .move-handle svg { width: 12px; height: 12px; }
  .pdf-overlay.selected .move-handle { display: flex; }
  .resize-handle { display: none; position: absolute; width: 8px; height: 8px; bottom: -4px; right: -4px; border: 1px solid #789956; background: #fff; border-radius: 1px; cursor: nwse-resize; z-index: 5; }
  .pdf-overlay.selected .resize-handle { display: block; }
  .resize-preview { position: absolute; border: 1px dashed #89a368; background: #eaf3d844; }
  .page-wash { position: absolute; inset: 0; background: #edf3df88; pointer-events: none; }
  .page-loader { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 13px; position: absolute; inset: 0; font-size: 11px; background: #eceee5cc; color: #95a580; z-index: 9; }
  .page-loader .spinner { width: 22px; height: 22px; }
  .page-navigation { display: flex; align-items: center; min-height: 48px; padding: 0 22px; border-top: 1px solid #e0e5d5; background: #f9fbf3; color: #a4b28f; flex-shrink: 0; position: relative; }
  .page-save-note { display: flex; align-items: center; gap: 5px; font-size: 8px; }
  .page-save-note svg { width: 12px; height: 12px; }
  .page-switch { display: flex; align-items: center; justify-content: center; gap: 8px; margin-left: auto; font-size: 9px; }
  .page-switch .icon-button { width: 27px; height: 27px; }
  .page-switch svg { width: 13px; height: 13px; }
  .page-switch select { padding: 3px 2px 3px 6px; margin: 0 4px; border: 1px solid #e2e9d5; border-radius: 4px; background: #fff; color: #92a278; font-size: 9px; }
  .mobile-panel-toggle { display: none; }
  .inspector { min-width: 0; background: #fcfcf9; border-left: 1px solid #e4e8d9; overflow: auto; }
  .inspector-heading { display: flex; align-items: center; min-height: 55px; padding: 0 15px 0 20px; border-bottom: 1px solid #e6ebdc; gap: 5px; }
  .inspector-heading h2 { font-size: 12px; font-weight: 600; color: #718562; }
  .inspector-heading .icon-button { margin-left: auto; width: 27px; height: 27px; }
  .inspector-heading svg { width: 14px; height: 14px; }
  .inspector-body { padding: 24px 20px; }
  .inspector-body label { display: flex; flex-direction: column; gap: 8px; min-width: 0; color: #96a285; font-size: 10px; line-height: 1.5; }
  .inspector-body input, .inspector-body textarea { width: 100%; min-height: 34px; padding: 8px; border: 1px solid #e0e7d5; border-radius: 5px; background: #fff; color: #728463; font-size: 11px; outline-offset: 1px; }
  .inspector-body textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
  .inspector-body input[type="color"] { padding: 4px; height: 34px; cursor: pointer; }
  .property-row { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin-top: 18px; }
  .property-tip { font-size: 9px; color: #aab79a; line-height: 1.8; margin-top: 21px; }
  .inspector-actions { display: flex; flex-direction: column; gap: 9px; padding-top: 21px; margin-top: 23px; border-top: 1px solid #e8eddf; }
  .inspector-actions .button { min-height: 34px; font-size: 10px; }
  .inspector-actions svg { width: 13px; height: 13px; }

  .original-text-target { position: absolute; display: block; margin: 0; padding: 0; border: 1px solid transparent; border-radius: 2px; background: transparent; color: transparent; font-size: 0; line-height: 1; outline: none; pointer-events: none; cursor: text; appearance: none; }
  .workspace[data-tool="edit"] .original-text-target { pointer-events: auto; }
  .workspace[data-tool="edit"] .original-text-target:hover { background: #c6dc9f35; border-color: #88a66b; box-shadow: 0 0 0 2px #d6e7bf66; }
  .workspace[data-tool="edit"] .original-text-target:focus-visible { outline: 2px solid #83a466; outline-offset: 2px; background: #d4e4b53b; }
  .workspace[data-tool="edit"] .original-text-target.is-edited { border: 1px dotted #88a66b; background: #dfeacb18; }
  .workspace[data-tool="edit"] .original-text-target.is-deleted { border: 1px dashed #a3aa98; background: #e5e9df44; }
  .workspace[data-tool="edit"] .original-text-target.is-edited:hover, .workspace[data-tool="edit"] .original-text-target.is-deleted:hover { border-style: solid; background: #d1e3ae44; }
  .workspace:not([data-tool="edit"]) .original-text-target { background: transparent; border-color: transparent; box-shadow: none; outline: none; }
  .direct-editor-layer { pointer-events: none; z-index: 20; }
  .inline-text-editor { position: absolute; display: flex; flex-direction: column; gap: 0; max-width: calc(100% - 16px); min-width: 0; padding: 0; border: 0; border-radius: 3px; background: transparent; color: #374d30; text-align: left; cursor: default; pointer-events: auto; user-select: text; }
  .inline-editor-toolbar { position: absolute; left: 0; bottom: calc(100% + 8px); display: flex; align-items: center; gap: 12px; width: max-content; min-width: min(100%, 250px); max-width: min(430px, calc(100vw - 32px)); min-height: 44px; padding: 6px 8px 6px 12px; border: 1px solid #d9e1cd; border-radius: 10px; background: #fff; box-shadow: 0 4px 18px #293c321a; font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 12px; line-height: 1.4; }
  .inline-editor-label { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; color: #3d5534; white-space: nowrap; }
  .inline-editor-label svg { width: 16px; height: 16px; }
  .direct-size-control { display: flex; align-items: center; gap: 7px; margin-left: auto; color: #69775e; font-size: 12px; white-space: nowrap; }
  .direct-size-control input { width: 58px; min-height: 34px; padding: 5px 6px; border: 1px solid #dbe3cf; border-radius: 6px; background: #f7f9f2; color: #344b2d; font-size: 14px; }
  .inline-editor-close { display: inline-flex; align-items: center; justify-content: center; width: 36px; min-width: 36px; height: 36px; padding: 0; border-radius: 7px; color: #748169; }
  .inline-editor-close:hover { background: #eef3e5; color: #293c32; }
  .inline-editor-close svg { width: 18px; height: 18px; }
  .inline-editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 25px; color: #577046; font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 12px; font-weight: 600; line-height: 1.5; }
  .inline-editor-heading .icon-button { width: 25px; height: 25px; color: #95a284; margin: -4px -4px -4px 0; }
  .inline-editor-heading .icon-button svg { width: 15px; height: 15px; }
  textarea.input-direct-text { display: block; width: 100%; min-width: 0; min-height: 32px; max-height: min(320px, 45dvh); margin: 0; padding: 0; border: 0; border-radius: 2px; background: #fff; color: #202a20; font-family: Helvetica, Arial, sans-serif; font-size: var(--direct-font-size, 16px); line-height: 1.25; letter-spacing: normal; text-align: left; white-space: pre-wrap; overflow-wrap: break-word; overflow: auto; resize: none; transform: none; outline: 2px solid #7f9e5e; outline-offset: 3px; cursor: text; caret-color: #314a27; user-select: text; -webkit-user-select: text; }
  textarea.input-direct-text:focus { outline: 2px solid #658c42; box-shadow: 0 0 0 5px #dce9c84d; }
  .inline-editor-meta { padding: 9px 10px 7px; border: 1px solid #dce5d0; border-bottom: 0; border-radius: 8px 8px 0 0; margin-top: 12px; background: #fff; color: #6d7d5e; font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 12px; font-weight: 400; line-height: 1.5; letter-spacing: normal; }
  .inline-editor-error { padding: 9px 10px; border: 1px solid #e8d0c3; border-radius: 6px; margin-top: 8px; background: #fff6ef; color: #92573f; font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 12px; font-weight: 400; line-height: 1.5; letter-spacing: normal; }
  .inline-editor-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 8px; border: 1px solid #dce5d0; border-top: 0; border-radius: 0 0 8px 8px; background: #fff; box-shadow: 0 8px 16px #293c3212; }
  .inline-editor-actions .button { min-height: 40px; padding: 0 13px; font-size: 13px; }
  .inline-editor-actions .direct-apply { background: #293c32; border-color: #293c32; color: #fff; }
  .inline-editor-actions .direct-apply:hover:not(:disabled) { background: #577547; border-color: #577547; }
  .inline-editor-actions .direct-cancel { border-color: #dbe4ce; background: #fff; color: #849373; }
  .inline-editor-actions .direct-cancel:hover { background: #f4f7ee; }
  .direct-summary { display: grid; gap: 11px; margin: 20px 0 23px; padding: 14px 13px; border: 1px solid #dbe4cd; border-radius: 8px; background: #f1f5e8; }
  .direct-summary > h3, .direct-summary > strong { color: #657d52; font-size: 12px; font-weight: 600; line-height: 1.5; }
  .direct-summary > p, #direct-status { color: #7c8e6b; font-size: 12px; line-height: 1.6; }
  #direct-status { display: flex; align-items: flex-start; gap: 7px; }
  #direct-status svg { width: 14px; height: 14px; margin-top: 2px; }
  #edit-existing-sidebar { display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%; min-height: 36px; padding: 7px 9px; border: 1px solid #cad9b5; border-radius: 6px; background: #e2eccf; color: #637c4e; font-size: 12px; font-weight: 500; line-height: 1.5; }
  #edit-existing-sidebar:hover:not(:disabled) { border-color: #adbf92; background: #d8e7c2; }
  #edit-existing-sidebar svg { width: 15px; height: 15px; }
  .direct-changes { display: grid; gap: 8px; margin-top: 13px; }
  .direct-change-row { display: flex; align-items: center; justify-content: space-between; gap: 9px; width: 100%; min-height: 40px; padding: 9px 10px; border: 1px solid #e0e8d5; border-radius: 6px; background: #f8faf4; color: #7d8d6a; text-align: left; font-size: 12px; line-height: 1.5; }
  .direct-change-row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .direct-change-row > small { flex-shrink: 0; font-size: 12px; color: #a0ad90; }
  .direct-change-row:hover { border-color: #b7cba1; background: #eef4e4; color: #66844d; }
  .direct-empty-note { color: #9aa98a; font-size: 12px; line-height: 1.7; margin: 10px 0 0; }
}

@layer responsive {
  @media (min-width: 1650px) {
    .welcome { padding-top: 65px; }
    .upload-card { margin-top: 39px; min-height: 352px; }
    .upload-illustration { margin-top: 27px; margin-bottom: 7px; }
    .features { margin-top: 50px; }
    .welcome-footer { margin-top: 55px; }
  }
  @media (max-width: 1100px) {
    .topbar { padding: 0 25px; gap: 18px; }
    .editor-layout, .editor-layout:has(> .inspector:not([hidden])) { grid-template-columns: 250px minmax(0, 1fr); }
    .inspector { position: absolute; top: 55px; right: 0; bottom: 0; width: 240px; z-index: 12; box-shadow: -5px 0 25px #293c3212; }
    .toolbar { padding: 0 12px; gap: 10px; }
    .tool { padding: 0 7px; gap: 5px; }
    .document-bar { padding: 0 19px; }
    .draft-state { display: none; }
    .file-meta strong { max-width: 260px; }
    .tool-hint { padding: 8px 17px; }
    .features { gap: 20px; }
  }
  @media (min-width: 801px) and (max-width: 1000px) {
    .tool { min-width: 34px; padding: 0 8px; }
    .tool > span:not([data-icon]) { display: none; }
  }
  @media (max-width: 800px) {
    .topbar { height: 67px; padding: 0 22px; }
    .top-actions { gap: 15px; }
    .local-badge { font-size: 9px; }
    .brand { font-size: 23px; gap: 8px; }
    .brand-icon { width: 31px; height: 34px; }
    .top-divider, .app-name { display: none; }
    .welcome { padding-top: 38px; }
    h1 { font-size: 51px; }
    .features { gap: 17px; }
    .features article { flex-direction: column; gap: 8px; }
    .features h3 { font-size: 10px; }
    .features p { font-size: 9px; }
    .editor { height: calc(100dvh - 67px); }
    .editor-layout, .editor-layout:has(> .inspector:not([hidden])) { grid-template-columns: minmax(0, 1fr); }
    .left-panel { display: none; position: absolute; top: 55px; bottom: 48px; left: 0; width: 280px; z-index: 15; box-shadow: 5px 0 25px #293c321f; border-top: 1px solid #e0e5d6; }
    .editor.panel-open .left-panel { display: flex; }
    .left-panel .panel-tabs { height: 48px; }
    .document-bar { min-height: 70px; gap: 7px; padding: 0 12px; }
    .file-meta strong { max-width: 200px; font-size: 11px; }
    .document-actions { gap: 7px; }
    .document-actions .button { min-height: 35px; font-size: 10px; padding: 0 10px; gap: 6px; }
    .document-actions .button svg { width: 14px; height: 14px; }
    .document-actions #replace-file { width: 35px; padding: 0; }
    .document-actions #replace-file > span:not([data-icon]) { display: none; }
    .page-navigation { padding: 0 12px; }
    .page-save-note { display: none; }
    .page-switch { margin-left: 0; }
    .mobile-panel-toggle { display: flex; align-items: center; gap: 6px; margin-left: auto; padding: 6px 9px; border: 1px solid #dfe6d3; background: #f1f5e8; border-radius: 5px; font-size: 9px; color: #94a77e; }
    .mobile-panel-toggle svg { width: 13px; height: 13px; }
    .editor.panel-open .mobile-panel-toggle { background: #dfeacb; color: #6b8452; }
    .canvas-scroll { padding: 22px 20px 35px; }
    .inspector { width: 235px; bottom: 48px; }
  }
  @media (max-width: 520px) {
    .topbar { height: 63px; padding: 0 18px; }
    .brand { font-size: 22px; }
    .brand-icon { width: 29px; height: 32px; border-radius: 8px; }
    .brand-icon svg { width: 18px; height: 18px; }
    .top-actions { gap: 11px; }
    .local-badge { display: none; }
    .top-actions .icon-button { width: 28px; height: 28px; }
    .avatar { width: 29px; height: 29px; font-size: 11px; }
    .welcome { padding: 33px 19px 24px; }
    .eyebrow { font-size: 7px; letter-spacing: 1.4px; gap: 6px; }
    h1 { font-size: 43px; line-height: 1.1; letter-spacing: -2px; margin-top: 18px; margin-bottom: 16px; }
    .welcome-heading > p { font-size: 10px; line-height: 1.9; }
    .welcome-heading > p br { display: none; }
    .upload-card { margin-top: 28px; min-height: 323px; border-radius: 11px; }
    .upload-illustration { margin-top: 15px; }
    .upload-card > h2 { font-size: 15px; }
    .upload-card > p { font-size: 10px; margin-bottom: 17px; }
    .upload-main { min-height: 43px; font-size: 11px; }
    .demo-link { flex-wrap: wrap; gap: 3px 5px; font-size: 9px; margin-top: 17px; padding: 0; }
    .demo-link > [data-icon="sparkles"] { width: 13px; }
    .demo-link > [data-icon="arrow-right"] { display: none; }
    .features { grid-template-columns: 1fr; gap: 19px; max-width: 275px; margin-top: 34px; }
    .features article { flex-direction: row; gap: 12px; }
    .features h3 { font-size: 11px; }
    .features p { font-size: 9px; margin-top: 4px; }
    .welcome-footer { margin-top: 29px; justify-content: center; padding-top: 18px; font-size: 7px; }
    .welcome-footer > span:first-child { display: none; }
    .welcome-footer > span:last-child { font-size: 8px; }
    .restore-banner { font-size: 9px; flex-wrap: wrap; text-align: center; gap: 8px; }
    .restore-banner > span:nth-child(2) { flex: 1; }
    .restore-banner > button:first-of-type { flex-basis: 100%; }
    .editor { height: calc(100dvh - 63px); }
    .document-bar { padding: 0 9px; min-height: 64px; }
    .document-bar > .icon-button { width: 29px; height: 29px; }
    .file-meta { gap: 4px; }
    .file-meta strong { max-width: 140px; font-size: 10px; }
    .file-meta > span { font-size: 8px; }
    .document-actions { gap: 5px; }
    .document-actions .button { min-height: 33px; padding: 0 8px; font-size: 9px; gap: 5px; }
    .document-actions #replace-file { width: 30px; }
    .toolbar { gap: 6px; padding: 0 8px; min-height: 50px; }
    .tool-group { gap: 2px; }
    .tool { min-height: 31px; width: 32px; padding: 0; }
    .tool > span:not([data-icon]) { display: none; }
    .tool svg { width: 16px; height: 16px; }
    .toolbar-divider { margin: 0 2px; }
    .toolbar .icon-button { width: 25px; height: 28px; }
    .history-buttons { gap: 0; }
    .zoom-controls { gap: 0; }
    #zoom-fit { min-width: 35px; font-size: 9px; }
    .tool-hint { min-height: 37px; padding: 7px 13px; font-size: 8px; gap: 6px; }
    .hint-badge { display: none; }
    .canvas-scroll { padding: 20px 14px 30px; }
    .left-panel, .inspector { top: 50px; }
    .left-panel { width: min(280px, calc(100vw - 45px)); }
    .toast-stack { right: 16px; bottom: 16px; }
    .toast { padding: 12px 13px; font-size: 11px; }
    dialog { padding: 23px 20px; }
    .dialog-title h2 { font-size: 18px; }
    dialog ol { padding-left: 20px; }
    .confirm-actions { flex-direction: column-reverse; }
  }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  }
}


@layer responsive {
  .welcome-heading > p { font-size: 14px; color: #747e6c; }
  .upload-card > p { font-size: 13px; color: #77816d; }
  .upload-main { font-size: 13px; min-height: 44px; }
  .upload-limit, .upload-bottom { font-size: 11px; color: #7c856f; }
  .demo-link { font-size: 12px; }
  .features h3 { font-size: 13px; }
  .features p { font-size: 11px; color: #7d876f; }
  .panel-heading p { font-size: 12px; color: #7c876f; }
  .panel-tabs > button { font-size: 13px; }
  .field-label, .field-group > label { font-size: 13px; color: #58664e; }
  .field-location { font-size: 10px; color: #899479; margin-top: 0; margin-left: auto; }
  .field-group input:not([type="checkbox"]):not([type="radio"]), .field-group textarea, .field-group select { min-height: 40px; font-size: 14px; color: #374a31; }
  .field-group input[type="checkbox"], .field-group input[type="radio"] { width: 19px; height: 19px; }
  .field-row { align-items: baseline; }
  .empty-fields, .empty-fields p, .empty-overlay, .add-field-button { font-size: 12px; color: #778568; }
  .empty-fields > svg { margin: 0 auto 10px; }
  .overlay-row { font-size: 12px; }
  .overlay-row small { margin-left: auto; flex-shrink: 0; }
  .panel-tip p, .panel-tip strong { font-size: 11px; color: #7b8969; }
  .tool { font-size: 12px; color: #6f7d60; }
  .tool-hint { font-size: 11px; color: #7a8968; }
  .page-switch { font-size: 11px; }
  .page-switch select { font-size: 11px; }
  .help-note p, .help-privacy { font-size: 12px; color: #738062; }
  .overlay-content::placeholder { color: #98a28f; }
  @media (max-width: 520px) {
    .welcome-heading > p { font-size: 13px; }
    .upload-card > p { font-size: 12px; }
    .demo-link { font-size: 11px; }
    .features h3 { font-size: 13px; }
    .features p { font-size: 12px; }
    .document-actions .button { font-size: 10px; min-height: 38px; }
    .tool { width: 34px; min-height: 38px; }
    .tool-hint { font-size: 10px; }
    .mobile-panel-toggle { font-size: 12px; min-height: 34px; }
    .panel-content { padding: 22px 18px; }
    .toolbar { gap: 4px; padding: 0 6px; }
    .tool { width: 30px; min-width: 30px; min-height: 37px; }
    .toolbar-divider { margin: 0; }
    .toolbar .icon-button { width: 23px; }
    .zoom-controls .icon-button { width: 22px; }
    #zoom-fit { min-width: 32px; }
    .inline-text-editor { gap: 10px; padding: 12px; border-radius: 8px; }
    .inline-editor-heading, .inline-editor-meta, .inline-editor-error { font-size: 12px; }
    textarea.input-direct-text { padding: 9px; max-height: min(240px, 35dvh); }
    .inline-editor-actions { gap: 7px; padding-top: 10px; }
    .inline-editor-actions .button { min-height: 37px; padding: 0 10px; }
    .direct-summary { margin-top: 18px; }
  }
}


/* Direct editing keeps the caret on the page; the controls follow the selection. */
@layer responsive {
  .workspace[data-tool="edit"] .original-text-target:not(:disabled) { border-color: #8aab6959; border-style: dotted; }
  .workspace[data-tool="edit"] .original-text-target.is-active { border-color: #668a46; background: #dce9c833; }
  .inline-text-editor { max-width: none; gap: 0; padding: 0; min-width: 0; border: 0; border-radius: 3px; }
  .inline-editor-toolbar { left: var(--control-offset, 0px); width: var(--control-width, 320px); max-width: none; min-width: 0; z-index: 2; gap: 8px; }
  .inline-editor-label { font-size: 12px; }
  .direct-size-control { font-size: 12px; gap: 6px; }
  .direct-size-control input { width: 62px; font-size: 16px; }
  textarea.input-direct-text { padding: 0; line-height: 1.25; min-height: 24px; max-height: 230px; border-radius: 1px; -webkit-user-select: text; touch-action: auto; }
  .inline-editor-meta, .inline-editor-error, .inline-editor-actions { position: relative; left: var(--control-offset, 0px); width: var(--control-width, 320px); }
  .inline-editor-meta { margin-top: 12px; color: #617054; }
  .inline-editor-meta.has-warning { background: #fff8e8; border-color: #e7d6a5; color: #7e622c; }
  .inline-editor-actions { padding: 8px; gap: 8px; }
  .inline-editor-actions .button { min-height: 44px; font-size: 13px; flex: 1; }
  .inline-editor-actions .direct-cancel { color: #5a6d4e; }
  .inline-editor-close { min-width: 40px; width: 40px; height: 40px; }
  .inline-text-editor.toolbar-below .inline-editor-toolbar { position: relative; bottom: auto; order: 1; margin-top: 12px; }
  .inline-text-editor.toolbar-below .inline-editor-meta { order: 2; margin-top: 0; }
  .inline-text-editor.toolbar-below .inline-editor-error { order: 3; }
  .inline-text-editor.toolbar-below .inline-editor-actions { order: 4; }
  .canvas-scroll:has(.inline-text-editor) { padding-bottom: 40px; }
  .canvas-scroll { scrollbar-gutter: stable; }
  .canvas-scroll:has(.inline-text-editor)::after { content: ""; display: block; height: 280px; width: 1px; }
  .tool-hint { color: #637553; }
  .file-meta > span { color: #75816b; }

  @media (max-width: 800px) {
    .topbar { height: 64px; padding: 0 16px; background: #fcfcf8; }
    .top-actions .icon-button { width: 44px; height: 44px; }
    .top-actions { gap: 8px; }
    .brand { font-size: 23px; }
    .editor { height: calc(100dvh - 64px); min-height: 0; }
    .editor.is-text-editing { height: calc(var(--visual-viewport-height, 100dvh) - 64px); min-height: 180px; }
    .document-bar { min-height: 74px; padding: 8px 12px; gap: 6px; background: #fff; flex-shrink: 0; }
    .document-bar > .icon-button { width: 40px; height: 44px; }
    .file-meta { flex: 1; gap: 5px; }
    .file-meta strong { font-size: 12px; max-width: 100%; }
    .file-meta > span { font-size: 11px; }
    .document-actions { gap: 5px; }
    .document-actions .button { min-height: 44px; font-size: 12px; gap: 6px; padding: 0 12px; border-radius: 9px; }
    .document-actions #replace-file { min-width: 40px; width: 40px; }
    .document-actions .button svg { width: 18px; height: 18px; }
    .toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px 12px; min-height: 116px; background: #fbfcf7; }
    .toolbar > .tool-group:first-child { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
    .tool { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; width: auto; min-height: 52px; padding: 5px 1px; gap: 5px; border-radius: 9px; font-size: 10px; line-height: 1.2; color: #5b6c4d; }
    .tool > span:not([data-icon]) { display: block; white-space: nowrap; }
    .tool svg { width: 19px; height: 19px; }
    .tool.active { background: #e3edcf; color: #31492b; box-shadow: inset 0 0 0 1px #b7c99d; }
    .toolbar-divider, .toolbar-spacer { display: none; }
    .history-buttons { gap: 4px; }
    .toolbar .icon-button, .zoom-controls .icon-button { width: 44px; height: 44px; }
    .zoom-controls { justify-self: end; gap: 1px; }
    #zoom-fit { min-width: 48px; min-height: 44px; font-size: 12px; }
    .tool-hint { font-size: 12px; padding: 9px 16px; min-height: 44px; line-height: 1.5; background: #f2f6e9; }
    .is-text-editing .toolbar, .is-text-editing .tool-hint { display: none; }
    .canvas-scroll { padding: 28px 14px 40px; }
    .page-navigation { min-height: 56px; padding: 4px 10px max(4px, env(safe-area-inset-bottom)); background: #fff; }
    .page-switch { font-size: 12px; gap: 2px; }
    .page-switch .icon-button { width: 40px; height: 44px; }
    .page-switch select { min-height: 36px; font-size: 16px; padding: 3px 5px; margin: 0 2px; }
    .mobile-panel-toggle { font-size: 12px; min-height: 44px; padding: 0 12px; color: #516847; border-radius: 8px; gap: 7px; }
    .mobile-panel-toggle svg { width: 17px; height: 17px; }
    .left-panel { top: 0; bottom: 56px; width: min(320px, calc(100vw - 28px)); border-radius: 0 14px 14px 0; }
    .left-panel .panel-tabs { min-height: 54px; }
    .panel-content { padding: 22px 20px; }
    .field-group input:not([type="checkbox"]):not([type="radio"]), .field-group textarea, .field-group select { min-height: 44px; font-size: 16px; }
    .inspector { top: 0; bottom: 56px; width: min(320px, calc(100vw - 28px)); }
    .inspector-body input, .inspector-body textarea { font-size: 16px; min-height: 44px; }
    .inline-editor-toolbar { min-height: 52px; padding: 5px 6px 5px 10px; border-radius: 10px; }
    .direct-size-control input { min-height: 40px; }
    .inline-editor-close { min-height: 44px; }
    textarea.input-direct-text { font-size: max(16px, var(--direct-font-size)); }
    .inline-editor-meta { font-size: 12px; line-height: 1.5; padding: 10px; }
    .toast-stack { bottom: 72px; }
    .welcome { padding: 36px 20px 28px; }
    .eyebrow { font-size: 9px; letter-spacing: 1.3px; }
    h1 { font-size: clamp(40px, 10.5vw, 56px); letter-spacing: -2px; margin: 18px 0; }
    .welcome-heading > p { font-size: 15px; line-height: 1.65; max-width: 390px; margin: auto; color: #67765c; }
    .welcome-heading > p br { display: none; }
    .upload-card { min-height: 320px; margin-top: 28px; border: 1.5px dashed #b2c39a; border-radius: 20px; background: #fff; box-shadow: 0 10px 36px #293c3208; }
    .upload-card > h2 { font-size: 18px; letter-spacing: -.4px; }
    .upload-card > p { font-size: 13px; color: #6e7d61; max-width: 270px; margin-bottom: 18px; }
    .upload-main { min-height: 50px; font-size: 15px; border-radius: 10px; padding: 0 24px; }
    .upload-limit { font-size: 12px; margin: 12px 0 18px; }
    .upload-bottom { font-size: 11px; min-height: 42px; padding: 8px; }
    .demo-link { min-height: 48px; font-size: 12px; padding: 8px 0; }
    .features { grid-template-columns: 1fr; gap: 12px; max-width: 420px; margin-top: 24px; }
    .features article { flex-direction: row; align-items: center; gap: 14px; padding: 14px 16px; background: #f0f3e9; border: 1px solid #e5eadd; border-radius: 13px; }
    .feature-icon { width: 42px; height: 42px; background: #e1e9d2; }
    .features h3 { font-size: 14px; margin-top: 0; }
    .features p { font-size: 12px; line-height: 1.5; margin-top: 4px; }
    .welcome-footer { margin-top: 28px; font-size: 10px; color: #79866c; }
    .welcome-footer > span:last-child { font-size: 10px; }
    .restore-banner { font-size: 13px; padding: 14px; border-radius: 12px; }
    .restore-banner > button { min-height: 44px; font-size: 13px; }
  }
  @media (max-width: 360px) {
    .document-actions #replace-file { display: none; }
    .document-actions .button { padding: 0 10px; }
    .tool { font-size: 9px; }
    .direct-size-control { font-size: 11px; }
    .inline-editor-label { gap: 4px; font-size: 11px; }
    .inline-editor-toolbar { gap: 4px; }
    .direct-size-control input { width: 54px; }
  }
}
