:root {
  color-scheme: light;
  --bg: #eef4f8;
  --panel: #ffffff;
  --panel-2: #f5f8fb;
  --ink: #111827;
  --muted: #64748b;
  --line: #d8e0ea;
  --accent: #075ea8;
  --accent-strong: #064d89;
  --success: #087f5b;
  --danger: #dc2626;
  --shadow: 0 18px 45px rgba(15, 23, 42, .14);
  --topbar-h: 58px;
  --privacy-h: 34px;
  --footer-h: 28px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; min-height: 100%; background: var(--bg); color: var(--ink); overflow: hidden; overscroll-behavior: none; }
button, input, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, canvas:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.hidden { display: none !important; }
.mobile-only { display: none !important; }
.app-shell { height: 100vh; height: 100dvh; min-height: 100svh; display: grid; grid-template-rows: var(--topbar-h) var(--privacy-h) 1fr var(--footer-h); position: relative; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.brand-mark { width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center; }
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 3px 7px rgba(15, 23, 42, .14)); }
.brand strong, .brand span { display: block; line-height: 1.05; }
.brand span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.top-actions::-webkit-scrollbar { display:none; }
button { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; min-height: 36px; padding: 7px 10px; cursor: pointer; }
button:hover:not(:disabled) { background: var(--panel-2); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
button:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn { width: 38px; padding: 0; display: grid; place-items: center; font-size: 18px; }
.primary-btn, .success-btn { border-color: transparent; color: white; font-weight: 700; }
.primary-btn { background: var(--accent); }
.primary-btn:hover:not(:disabled) { background: var(--accent-strong); }
.success-btn { background: var(--success); }
.success-btn:hover:not(:disabled) { filter: brightness(.94); }
.large { min-height: 46px; padding: 11px 18px; }
.divider { width: 1px; height: 24px; background: var(--line); margin: 0 3px; flex: 0 0 auto; }
.zoom-label { min-width: 60px; border: 0; background: transparent; color: var(--muted); }
.privacy-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 18px; font-size: 12px; background: color-mix(in srgb, var(--accent) 8%, var(--panel)); color: var(--muted); border-bottom: 1px solid var(--line); }
.workspace { min-height: 0; display: grid; grid-template-columns: 218px minmax(0, 1fr) 270px; }
.left-panel, .right-panel { min-height: 0; background: var(--panel); display: flex; flex-direction: column; z-index: 10; }
.left-panel { border-right: 1px solid var(--line); }
.right-panel { border-left: 1px solid var(--line); }
.panel-header { min-height: 48px; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.page-actions { display: grid; grid-template-columns: 1fr 38px 38px 38px; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); }
.page-actions button { min-width: 0; padding: 6px; }
.thumbnail-list { min-height: 0; flex: 1; overflow: auto; padding: 12px 10px 24px; }
.thumbnail-item { position: relative; padding: 8px; margin-bottom: 10px; border-radius: 10px; border: 2px solid transparent; background: var(--panel-2); cursor: pointer; user-select: none; }
.thumbnail-item.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--panel)); }
.thumbnail-item.drag-over { border-style: dashed; }
.thumbnail-item canvas { display: block; max-width: 100%; margin: auto; background: white; box-shadow: 0 3px 10px rgba(15,23,42,.15); }
.thumbnail-label { margin-top: 7px; font-size: 12px; color: var(--muted); text-align: center; }
.editor-area { min-width: 0; min-height: 0; position: relative; background: var(--bg); overflow: hidden; }
.empty-state { width: min(650px, calc(100% - 36px)); margin: 8vh auto 0; padding: 44px; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.empty-brand-logo { display:block; width:min(460px, 96%); height:auto; max-height:155px; object-fit:contain; margin:0 auto 12px; }
.empty-state h1 { margin: 22px 0 10px; font-size: clamp(24px, 4vw, 38px); }
.empty-state p { color: var(--muted); line-height: 1.6; }
.drop-zone { margin: 18px auto 10px; border: 2px dashed var(--line); border-radius: 12px; padding: 20px; color: var(--muted); }
.drop-zone.dragging { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.empty-state small { color: var(--muted); }
.document-view { height: 100%; position: relative; }
.canvas-scroller { position: absolute; inset: 0; overflow: auto; padding: 38px 38px 86px; display: block; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; scrollbar-gutter: stable; }
.page-stage { position: relative; width: max-content; margin: 0 auto; background: white; box-shadow: var(--shadow); transform-origin: 0 0; }
.page-stage canvas { position: absolute; inset: 0; display: block; }
#annotationCanvas { cursor: crosshair; touch-action: none; }
#annotationCanvas[data-tool="select"] { cursor: default; touch-action: none; }
#annotationCanvas[data-tool="select"].text-hover { cursor: text; }
#annotationCanvas[data-tool="pan"] { cursor: grab; touch-action: pan-x pan-y; }
#annotationCanvas[data-tool="pan"]:active { cursor: grabbing; }
.page-stage.pinching { will-change: transform; }
.page-nav { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 8; display: flex; gap: 6px; align-items: center; padding: 7px; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(12px); box-shadow: 0 8px 30px rgba(15,23,42,.14); }
.page-nav input { width: 54px; height: 34px; text-align: center; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--ink); }
.no-selection { padding: 20px 14px; color: var(--muted); line-height: 1.5; }
.properties { padding: 14px; overflow: auto; }
.properties label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.properties textarea, .properties input[type="number"] { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: var(--ink); padding: 8px; }
.property-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 10px; margin-top: 14px; }
.property-grid input[type="color"] { width: 100%; height: 38px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); margin: 14px 0; }
.segmented button { border-radius: 0; }
.segmented button:first-child { border-radius: 8px 0 0 8px; }
.segmented button:last-child { border-radius: 0 8px 8px 0; }
.segmented button.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }
.property-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.danger { color: var(--danger); }
.privacy-card { margin: auto 12px 12px; padding: 14px; border-radius: 12px; background: var(--panel-2); color: var(--muted); font-size: 12px; line-height: 1.45; }
.privacy-card strong { color: var(--ink); }
.text-btn { border: 0; background: transparent; color: var(--danger); padding: 5px 0; min-height: 30px; }
.tool-rail { position: absolute; left: 50%; bottom: calc(var(--footer-h) + 12px); transform: translateX(-50%); z-index: 15; display: flex; gap: 3px; max-width: calc(100vw - 540px); overflow-x: auto; padding: 7px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--panel) 94%, transparent); backdrop-filter: blur(14px); box-shadow: 0 10px 30px rgba(15,23,42,.14); scrollbar-width: none; }
.tool-rail::-webkit-scrollbar { display:none; }
.tool { min-width: 50px; height: 48px; display: grid; place-items: center; gap: 0; padding: 3px 7px; font-size: 17px; border-color: transparent; background: transparent; }
.tool span { display: block; font-size: 9px; color: var(--muted); }
.tool.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--panel)); border-color: color-mix(in srgb, var(--accent) 25%, var(--line)); }
footer { display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 11px; color: var(--muted); background: var(--panel); border-top: 1px solid var(--line); }
footer strong { color: var(--ink); }
footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }
dialog { border: 0; border-radius: 16px; color: var(--ink); background: transparent; max-width: min(760px, calc(100vw - 28px)); }
dialog::backdrop { background: rgba(2, 6, 23, .55); backdrop-filter: blur(3px); }
.dialog-card { position: relative; min-width: min(680px, calc(100vw - 56px)); padding: 26px; border-radius: 16px; background: var(--panel); box-shadow: var(--shadow); }
.dialog-close { position: absolute; right: 14px; top: 14px; width: 38px; padding: 0; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.help-grid section { padding: 14px; border-radius: 12px; background: var(--panel-2); }
.help-grid h3 { margin-top: 0; }
kbd { border: 1px solid var(--line); background: var(--panel); border-radius: 5px; padding: 2px 5px; }
.signature-dialog { min-width: min(700px, calc(100vw - 36px)); }
#signatureCanvas { width: 100%; height: auto; background: white; border: 1px solid var(--line); border-radius: 12px; touch-action: none; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.toast { position: fixed; right: 18px; bottom: 52px; z-index: 100; max-width: min(380px, calc(100vw - 36px)); padding: 12px 16px; border-radius: 10px; background: #111827; color: white; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translateY(0); }
.mobile-bar.mobile-only { display: none !important; }

@media (max-width: 1050px) {
  .workspace { grid-template-columns: 190px minmax(0, 1fr); }
  .right-panel { position: fixed; right: 0; top: calc(var(--topbar-h) + var(--privacy-h)); bottom: var(--footer-h); width: 290px; transform: translateX(100%); transition: .2s; box-shadow: var(--shadow); }
  .right-panel.open { transform: translateX(0); }
  .tool-rail { max-width: calc(100vw - 250px); }
  .desktop-only { display: none !important; }
  .mobile-only { display: initial !important; }
  .panel-close.mobile-only { display: grid !important; place-items: center; width: 38px; padding: 0; }
}
@media (max-width: 720px) {
  :root { --topbar-h: 56px; --privacy-h: 32px; --footer-h: 0px; --mobile-dock-h: 54px; }
  html, body { height: 100%; height: 100dvh; }
  .app-shell { height: 100dvh; min-height: 100svh; grid-template-rows: var(--topbar-h) var(--privacy-h) 1fr; }
  .brand { min-width: auto; }
  .brand > div:last-child { display: none; }
  .topbar { padding: 0 max(8px, env(safe-area-inset-left)) 0 max(8px, env(safe-area-inset-right)); }
  .top-actions { gap: 4px; }
  .top-actions .divider, #zoomOutBtn, #zoomLabel, #zoomInBtn, #fitBtn, #mergeBtn, #newBtn { display: none; }
  .success-btn { padding: 7px 9px; font-size: 12px; white-space: nowrap; }
  .privacy-bar { padding: 0 max(10px, env(safe-area-inset-left)) 0 max(10px, env(safe-area-inset-right)); }
  .privacy-bar span:last-child { display: none; }
  .workspace { display: block; min-height: 0; }
  .editor-area { height: 100%; min-height: 0; }
  .document-view { height: 100%; }

  .mobile-bar.mobile-only {
    display: flex !important;
    position: fixed;
    top: calc(var(--topbar-h) + var(--privacy-h));
    left: 0;
    right: 0;
    bottom: auto;
    height: var(--mobile-dock-h);
    z-index: 35;
    align-items: stretch;
    gap: 2px;
    padding: 4px max(6px, env(safe-area-inset-right)) 4px max(6px, env(safe-area-inset-left));
    overflow-x: auto;
    overflow-y: hidden;
    background: rgba(255,255,255,.97);
    border-top: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 5px 18px rgba(15,23,42,.10);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .mobile-bar::-webkit-scrollbar { display: none; }
  .mobile-bar.hidden { display: none !important; }
  .mobile-bar button {
    flex: 0 0 auto;
    min-width: 58px;
    min-height: 44px;
    padding: 6px 10px;
    border-radius: 9px;
    touch-action: manipulation;
    white-space: nowrap;
  }
  .mobile-bar .mobile-icon { min-width: 44px; width: 44px; padding: 0; font-size: 21px; }
  .mobile-zoom-label { min-width: 58px !important; color: var(--accent); font-weight: 800; }
  .mobile-page-label { flex: 0 0 auto; min-width: 58px; display: grid; place-items: center; padding: 0 6px; color: var(--muted); font-size: 12px; font-weight: 700; }

  .left-panel, .right-panel {
    position: fixed;
    top: calc(var(--topbar-h) + var(--privacy-h) + var(--mobile-dock-h));
    bottom: 0;
    width: min(330px, 90vw);
    z-index: 45;
    box-shadow: var(--shadow);
    transition: transform .2s ease;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .left-panel { left: 0; transform: translateX(-105%); }
  .left-panel.open { transform: translateX(0); }
  .right-panel { right: 0; transform: translateX(105%); }
  .right-panel.open { transform: translateX(0); }

  .canvas-scroller {
    top: var(--mobile-dock-h);
    padding: 58px 8px max(92px, calc(28px + env(safe-area-inset-bottom)));
    justify-content: initial;
    scroll-padding: 58px 8px 92px;
    touch-action: pan-x pan-y;
  }
  .page-stage { margin: 0 auto; }
  #annotationCanvas[data-tool="select"] { touch-action: none; }
  #annotationCanvas[data-tool="pan"] { touch-action: pan-x pan-y; }

  .tool-rail {
    position: fixed;
    left: 0;
    right: 0;
    top: calc(var(--topbar-h) + var(--privacy-h) + var(--mobile-dock-h));
    bottom: auto;
    transform: translateY(-135%);
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    max-width: none;
    max-height: 68px;
    border-radius: 0 0 14px 14px;
    transition: transform .2s ease;
    padding: 7px max(7px, env(safe-area-inset-right)) 7px max(7px, env(safe-area-inset-left));
    z-index: 44;
  }
  .tool-rail.open { transform: translateY(0); visibility: visible; opacity: 1; pointer-events: auto; }
  .tool { min-width: 58px; height: 52px; touch-action: manipulation; }

  .empty-state { margin-top: 4vh; padding: 28px 18px; }
  .empty-state p { font-size: 14px; }
  .page-nav { display: none; }
  footer { display: none; }
  .help-grid { grid-template-columns: 1fr; }
  .dialog-card { min-width: calc(100vw - 36px); max-height: calc(100dvh - 36px); overflow: auto; padding: 22px 18px; }
  .signature-dialog { min-width: calc(100vw - 28px); }
  .toast { left: 14px; right: 14px; bottom: max(18px, env(safe-area-inset-bottom)); max-width: none; }
}


/* v1.4 Smart Text */
.smart-text-info { margin-top: 10px; padding: 10px; border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line)); border-radius: 9px; background: color-mix(in srgb, var(--accent) 7%, var(--panel)); color: var(--muted); font-size: 11px; line-height: 1.4; }
.smart-text-status { margin: 10px 0 0; padding-top: 9px; border-top: 1px solid var(--line); }
#smartTextToolBtn { min-width: 64px; }
#ocrTextBtn { min-width: 54px; }
.property-actions:has(#resetTextEditBtn:not(.hidden)) { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 720px) {
  #smartTextToolBtn { min-width: 72px; }
}


/* v1.4.3 Donate */
.donate-btn { display:flex; align-items:center; gap:6px; border-color:#f3b4c3; background:#fff5f7; color:#b4234f; font-weight:800; white-space:nowrap; }
.donate-btn:hover:not(:disabled) { background:#ffe9ef; border-color:#e889a1; }
.donate-btn > span:first-child { font-size:16px; line-height:1; }
.donate-dialog { width:min(520px, calc(100vw - 28px)); }
.donate-card { min-width:0; width:100%; padding:24px; }
.donate-heading { display:flex; align-items:center; gap:12px; padding-right:42px; }
.donate-heart { width:48px; height:48px; border-radius:15px; display:grid; place-items:center; background:#fff0f4; color:#c52959; font-size:24px; box-shadow:inset 0 0 0 1px #f5c7d3; }
.donate-heading small { display:block; color:#b4234f; font-weight:900; font-size:10px; letter-spacing:.12em; }
.donate-heading h2 { margin:2px 0 0; }
.donate-copy { color:var(--muted); line-height:1.5; margin:14px 0 10px; }
.donate-tabs { display:flex; gap:7px; margin:12px 0; }
.donate-tabs button { flex:1; font-weight:800; color:var(--muted); background:var(--panel-2); }
.donate-tabs button.active { background:color-mix(in srgb, var(--accent) 10%, var(--panel)); border-color:color-mix(in srgb, var(--accent) 35%, var(--line)); color:var(--accent); }
.donate-payment { min-height:300px; display:grid; place-items:center; padding:14px; border:1px solid var(--line); border-radius:14px; background:var(--panel-2); }
.donate-panel { width:100%; display:grid; justify-items:center; gap:9px; text-align:center; }
.donate-panel small { color:var(--muted); line-height:1.4; }
.donate-qr-frame { padding:8px; border:1px solid var(--line); border-radius:16px; background:#fff; box-shadow:0 8px 22px rgba(15,23,42,.08); }
.donate-qr-frame img { display:block; width:min(244px, 68vw); height:auto; border-radius:10px; }
.paypal-mark { width:58px; height:58px; border-radius:18px; display:grid; place-items:center; background:#0f55a8; color:#fff; font-size:2rem; font-weight:900; }
.paypal-donate-link { width:min(280px,100%); min-height:42px; display:grid; place-items:center; border-radius:9px; background:#075ea8; color:#fff; font-weight:800; text-decoration:none; padding:10px 14px; }
.paypal-donate-link:hover { background:#064d89; }
.donate-note { margin:12px 0 0; text-align:center; color:var(--muted); font-size:12px; }
@media (max-width:720px) {
  .donate-btn { width:38px; min-width:38px; padding:0; justify-content:center; }
  .donate-label { display:none; }
  .donate-card { padding:20px 16px; }
  .donate-payment { min-height:270px; padding:10px; }
}


/* v1.4.4 mobile interaction fixes */
@media (max-width:720px) {
  #showPropertiesBtn.has-selection {
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
    background: color-mix(in srgb, var(--accent) 9%, var(--panel));
    font-weight: 800;
  }
  #annotationCanvas[data-tool="select"] { cursor: text; }
}


/* v1.4.6 clean-root package; v1.4.5 branding retained */
.brand strong { font-size: 14px; letter-spacing: -.01em; }
@media (max-width:720px) {
  .brand-mark { width: 38px; height: 38px; flex-basis: 38px; }
  .empty-brand-logo { width:min(360px, 100%); max-height:120px; margin-bottom:8px; }
}

/* v1.4.9 analytics compatibility + Help us improve */
.feedback-dialog{width:min(560px,calc(100vw - 28px))}.feedback-card{min-width:0;width:100%}.feedback-intro{margin:4px 42px 4px 0;color:var(--muted);line-height:1.5}.feedback-field{display:grid;gap:6px;margin-top:12px;font-size:12px;font-weight:800;color:var(--ink)}.feedback-field select,.feedback-field textarea{width:100%;border:1px solid var(--line);border-radius:9px;background:var(--panel);color:var(--ink);padding:10px;font:inherit}.feedback-field select{min-height:42px}.feedback-field textarea{min-height:130px;resize:vertical;line-height:1.45}.feedback-privacy{padding:10px 12px;border-radius:10px;background:var(--panel-2);color:var(--muted);font-size:11px;line-height:1.45}.help-grid #helpFeedbackBtn{margin-top:7px}.top-actions #feedbackBtn{font-size:15px}
@media(max-width:720px){.feedback-card{padding:20px 16px}.feedback-field textarea{min-height:160px}}


/* v1.5.0 — DOC/PDF shared header geometry + redundancy cleanup */
:root{--topbar-h:62px;--pdf-header-h:40px;--pdf-header-w:108px;--pdf-header-radius:10px;--pdf-header-gap:7px;--pdf-header-border:#d3dfeb;--pdf-header-text:#294b6b}
.topbar{min-height:62px!important;height:auto!important;padding:9px 14px!important;gap:18px!important;background:#fff!important}.brand-mark,.brand-mark img{width:40px!important;height:40px!important}.brand strong{font-size:16px!important}.brand span{font-size:10px!important}
.top-actions{display:flex!important;align-items:center!important;justify-content:flex-end!important;gap:var(--pdf-header-gap)!important;min-width:0!important;flex-wrap:nowrap!important}.top-actions .divider{height:24px!important;margin:0 1px!important;background:#e2eaf2!important}
.pdf-header-btn,.pdf-zoom-value{height:var(--pdf-header-h)!important;min-height:var(--pdf-header-h)!important;border:1px solid var(--pdf-header-border)!important;border-radius:var(--pdf-header-radius)!important;background:#fff!important;color:var(--pdf-header-text)!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;gap:7px!important;padding:0 10px!important;font-size:12px!important;font-weight:700!important;line-height:1!important;white-space:nowrap!important;box-shadow:0 1px 1px rgba(29,60,90,.025)!important}
.pdf-header-main{flex:0 0 var(--pdf-header-w)!important;width:var(--pdf-header-w)!important;min-width:var(--pdf-header-w)!important;max-width:var(--pdf-header-w)!important}.pdf-header-icon-only{flex:0 0 40px!important;width:40px!important;min-width:40px!important;max-width:40px!important;padding:0!important;font-size:18px!important}.pdf-header-icon{font-size:18px!important;line-height:1!important;min-width:18px;text-align:center}
.pdf-header-btn:hover:not(:disabled),.pdf-zoom-value:hover:not(:disabled){background:#f2f7fc!important;border-color:#b9ccdf!important}.pdf-download-btn{background:#1264d8!important;border-color:#1264d8!important;color:#fff!important}.pdf-download-btn:hover:not(:disabled){background:#0f58c1!important;border-color:#0f58c1!important}.pdf-donate-btn{background:#fff8f7!important;border-color:#eed7d4!important;color:#a7463d!important}.pdf-donate-btn:hover:not(:disabled){background:#fff1ef!important;border-color:#e5c1bc!important}.pdf-header-btn:disabled{opacity:.44!important;filter:saturate(.65)!important}
.pdf-zoom-control{display:inline-flex;align-items:center;height:40px;border:1px solid var(--pdf-header-border);border-radius:var(--pdf-header-radius);overflow:hidden;background:#fff}.pdf-zoom-control .pdf-header-btn,.pdf-zoom-control .pdf-zoom-value{border:0!important;border-radius:0!important;box-shadow:none!important}.pdf-zoom-control .pdf-header-btn{width:34px!important;min-width:34px!important;max-width:34px!important;height:38px!important;min-height:38px!important}.pdf-zoom-value{width:58px!important;min-width:58px!important;padding:0 5px!important;color:#526b86!important}
@media(max-width:1250px){:root{--pdf-header-w:94px}.pdf-header-main{font-size:11px!important;padding-inline:7px!important;gap:4px!important}.top-actions{gap:5px!important}}
@media(max-width:1080px){.topbar{padding:8px 10px!important;gap:10px!important}.brand span{display:none!important}.pdf-header-main{flex:0 0 40px!important;width:40px!important;min-width:40px!important;max-width:40px!important;padding:0!important}.pdf-header-main .pdf-header-label{display:none!important}.top-actions .divider{display:none!important}.pdf-zoom-value{width:54px!important;min-width:54px!important;font-size:11px!important}}
@media(max-width:720px){:root{--topbar-h:58px}.topbar{min-height:58px!important;height:58px!important;padding:0 max(8px,env(safe-area-inset-left)) 0 max(8px,env(safe-area-inset-right))!important}.brand-mark,.brand-mark img{width:38px!important;height:38px!important}.top-actions{gap:5px!important;overflow-x:auto!important;scrollbar-width:none!important}.top-actions::-webkit-scrollbar{display:none!important}#undoBtn,#redoBtn,.pdf-zoom-control,#fitBtn,#mergeBtn,#newBtn,#helpBtn,#feedbackBtn{display:none!important}#openBtn,#donateBtn,#exportBtn{display:inline-flex!important;flex:0 0 40px!important;width:40px!important;min-width:40px!important;max-width:40px!important;height:40px!important;padding:0!important}#openBtn .pdf-header-label,#donateBtn .pdf-header-label,#exportBtn .pdf-header-label{display:none!important}}

/* v1.5.1 — designed command bar: grouped hierarchy, consistent line icons, mobile polish */
:root{
  --pdf-command-h:40px;
  --pdf-command-radius:10px;
  --pdf-group-radius:13px;
  --pdf-command-ink:#254866;
  --pdf-command-muted:#5d7890;
  --pdf-group-bg:#f6f9fc;
  --pdf-group-border:#dbe6ef;
  --pdf-command-hover:#ffffff;
}
.topbar{
  min-height:64px!important;
  padding:9px 14px!important;
  gap:18px!important;
  background:linear-gradient(180deg,#ffffff 0%,#fbfdff 100%)!important;
  border-bottom:1px solid #dce6ef!important;
  box-shadow:0 1px 0 rgba(25,61,91,.025)!important;
}
.top-actions{
  display:flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  gap:8px!important;
  min-width:0!important;
  overflow-x:auto!important;
  overflow-y:hidden!important;
  scrollbar-width:none!important;
  padding:1px 0!important;
}
.top-actions::-webkit-scrollbar{display:none!important}
.pdf-command-group{
  height:42px!important;
  display:inline-flex!important;
  align-items:center!important;
  gap:2px!important;
  padding:3px!important;
  flex:0 0 auto!important;
  border:1px solid var(--pdf-group-border)!important;
  border-radius:var(--pdf-group-radius)!important;
  background:var(--pdf-group-bg)!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.86),0 1px 2px rgba(24,58,87,.03)!important;
}
.pdf-command,.pdf-zoom-readout,.pdf-export-command{
  height:34px!important;
  min-height:34px!important;
  border:0!important;
  border-radius:9px!important;
  box-shadow:none!important;
  margin:0!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  color:var(--pdf-command-ink)!important;
  font-size:12px!important;
  font-weight:700!important;
  line-height:1!important;
  white-space:nowrap!important;
  transition:background .14s ease,color .14s ease,box-shadow .14s ease,transform .08s ease!important;
}
.pdf-command{background:transparent!important;padding:0 9px!important;gap:6px!important}
.pdf-command-labeled{min-width:68px!important}
.pdf-command-icon{width:34px!important;min-width:34px!important;padding:0!important}
.pdf-ui-icon{
  width:18px!important;
  height:18px!important;
  flex:0 0 18px!important;
  fill:none!important;
  stroke:currentColor!important;
  stroke-width:1.8!important;
  stroke-linecap:round!important;
  stroke-linejoin:round!important;
  pointer-events:none!important;
}
.pdf-command:hover:not(:disabled),.pdf-zoom-readout:hover:not(:disabled){
  background:var(--pdf-command-hover)!important;
  color:#0d5fa9!important;
  box-shadow:0 2px 7px rgba(27,77,119,.09)!important;
}
.pdf-command:active:not(:disabled),.pdf-export-command:active:not(:disabled){transform:translateY(1px)!important}
.pdf-command:focus-visible,.pdf-zoom-readout:focus-visible,.pdf-export-command:focus-visible{
  outline:2px solid rgba(18,100,216,.3)!important;
  outline-offset:1px!important;
}
.pdf-command:disabled,.pdf-export-command:disabled{opacity:.42!important;filter:saturate(.55)!important;cursor:not-allowed!important}
.pdf-file-group .pdf-command + .pdf-command{position:relative!important}
.pdf-file-group .pdf-command + .pdf-command::before{
  content:"";position:absolute;left:-1px;top:8px;bottom:8px;width:1px;background:#e0e8ef;
}
.pdf-icon-group .pdf-command + .pdf-command{margin-left:1px!important}
.pdf-zoom-readout{
  width:54px!important;
  min-width:54px!important;
  padding:0 5px!important;
  background:#ffffff!important;
  color:#45647e!important;
  font-variant-numeric:tabular-nums!important;
}
.pdf-view-group .pdf-fit-command{margin-left:2px!important;position:relative!important}
.pdf-view-group .pdf-fit-command::before{
  content:"";position:absolute;left:-2px;top:8px;bottom:8px;width:1px;background:#dce6ee;
}
.pdf-donate-command{color:#a24c43!important;background:#fff8f6!important}
.pdf-donate-command:hover:not(:disabled){background:#fff0ed!important;color:#913d35!important;box-shadow:none!important}
.pdf-support-group .pdf-command-icon{color:#59738a!important}
.pdf-export-command{
  height:42px!important;
  min-height:42px!important;
  min-width:112px!important;
  padding:0 15px!important;
  gap:7px!important;
  flex:0 0 auto!important;
  border:1px solid #1264d8!important;
  border-radius:12px!important;
  background:linear-gradient(135deg,#1264d8,#2479e8)!important;
  color:#fff!important;
  box-shadow:0 4px 12px rgba(18,100,216,.16)!important;
}
.pdf-export-command:hover:not(:disabled){
  background:linear-gradient(135deg,#0f58c1,#1c6ed8)!important;
  box-shadow:0 5px 15px rgba(18,100,216,.22)!important;
}
.pdf-export-command .pdf-ui-icon{width:18px!important;height:18px!important}

@media(max-width:1160px){
  .topbar{gap:10px!important;padding-inline:10px!important}
  .brand span{display:none!important}
  .pdf-command-labeled{width:36px!important;min-width:36px!important;padding:0!important;font-size:0!important;gap:0!important}
  .pdf-command-labeled .pdf-ui-icon{width:19px!important;height:19px!important}
  .pdf-export-command{min-width:104px!important;padding-inline:12px!important}
}
@media(max-width:900px){
  .brand strong{font-size:14px!important}.brand-mark,.brand-mark img{width:38px!important;height:38px!important}
  .pdf-support-group #helpBtn,.pdf-support-group #feedbackBtn{display:none!important}
  .pdf-export-command{width:42px!important;min-width:42px!important;padding:0!important;font-size:0!important}
  .pdf-export-command .pdf-ui-icon{width:20px!important;height:20px!important}
}
@media(max-width:720px){
  :root{--topbar-h:58px}
  .topbar{height:58px!important;min-height:58px!important;padding:0 max(8px,env(safe-area-inset-left)) 0 max(8px,env(safe-area-inset-right))!important;gap:8px!important}
  .brand{min-width:0!important;gap:7px!important}.brand-mark,.brand-mark img{width:36px!important;height:36px!important}.brand strong{font-size:13px!important}.brand span{display:none!important}
  .top-actions{gap:6px!important;padding:0!important}
  .pdf-icon-group,.pdf-view-group{display:none!important}
  .pdf-file-group #newBtn,.pdf-file-group #mergeBtn,.pdf-support-group #helpBtn,.pdf-support-group #feedbackBtn{display:none!important}
  .pdf-command-group{height:40px!important;padding:2px!important;border-radius:11px!important}
  .pdf-file-group,.pdf-support-group{width:40px!important;min-width:40px!important}
  .pdf-file-group #openBtn,.pdf-support-group #donateBtn{display:inline-flex!important;width:34px!important;min-width:34px!important;height:34px!important;padding:0!important;font-size:0!important}
  .pdf-file-group #openBtn::before{display:none!important}
  .pdf-export-command{height:40px!important;min-height:40px!important;width:40px!important;min-width:40px!important;border-radius:11px!important;padding:0!important}
  .pdf-command .pdf-ui-icon,.pdf-export-command .pdf-ui-icon{width:19px!important;height:19px!important}
}


/* v1.5.2 — matched deterministic startup splash */
body.app-starting .app-shell{visibility:hidden!important;pointer-events:none!important}
.app-splash{position:fixed;inset:0;z-index:2147483000;display:grid;place-items:center;background:linear-gradient(145deg,#eef8ff,#f9fcff 58%,#e7f8f6);opacity:1;visibility:visible;transition:opacity .32s ease,visibility .32s ease}
.app-splash.hide{opacity:0;visibility:hidden}
.app-splash .splash-card{display:grid;justify-items:center;gap:9px;padding:20px;text-align:center}
.app-splash .splash-card img{width:min(32vw,132px);height:auto;display:block;filter:drop-shadow(0 18px 28px rgba(22,79,150,.18))}
.app-splash .splash-card strong{font-size:clamp(22px,4vw,30px);letter-spacing:-.03em;color:#173e6b}
.app-splash .splash-card span{font-size:12px;color:#71869e}
.app-splash .splash-loader{width:72px;height:4px;border-radius:999px;background:rgba(18,100,216,.14);overflow:hidden;margin-top:5px}
.app-splash .splash-loader::after{content:"";display:block;width:36%;height:100%;border-radius:inherit;background:#1264d8;animation:splashSlide .9s ease-in-out infinite alternate}
@keyframes splashSlide{from{transform:translateX(0)}to{transform:translateX(178%)}}
@media(max-width:640px){.app-splash .splash-card img{width:108px}.app-splash .splash-card strong{font-size:22px}}


/* v1.5.3 — visual parity with DOC Editor v1.6.7 + export dialog + live thumbnail polish */
:root{
  --topbar-h:62px;
  --header-command-h:40px;
  --header-command-w:108px;
  --header-command-radius:10px;
  --header-command-gap:7px;
  --header-command-border:#d3dfeb;
  --header-command-text:#294b6b;
  --header-command-hover:#f2f7fc;
}
.topbar.app-header{
  min-height:62px!important;
  height:62px!important;
  padding:9px 14px!important;
  gap:18px!important;
  background:#fff!important;
  border-bottom:1px solid #dce6ef!important;
  box-shadow:none!important;
}
.topbar.app-header .brand{flex:0 1 auto!important;gap:9px!important;min-width:205px!important}
.topbar.app-header .brand-mark,.topbar.app-header .brand-mark img{width:40px!important;height:40px!important}
.topbar.app-header .brand strong{font-size:16px!important;line-height:1.15!important}
.topbar.app-header .brand span{font-size:10px!important;line-height:1.2!important;margin-top:2px!important}
.top-actions.header-actions{display:flex!important;align-items:center!important;justify-content:flex-end!important;gap:var(--header-command-gap)!important;min-width:0!important;overflow-x:auto!important;overflow-y:hidden!important;scrollbar-width:none!important;padding:0!important}
.top-actions.header-actions::-webkit-scrollbar{display:none!important}
.pdf-file-group,.pdf-support-group{height:40px!important;padding:0!important;border:0!important;border-radius:0!important;background:transparent!important;box-shadow:none!important;gap:var(--header-command-gap)!important}
.pdf-file-group .pdf-command + .pdf-command::before{display:none!important}
.header-actions .header-action-btn{
  flex:0 0 var(--header-command-w)!important;width:var(--header-command-w)!important;min-width:var(--header-command-w)!important;max-width:var(--header-command-w)!important;
  height:var(--header-command-h)!important;min-height:var(--header-command-h)!important;padding:0 11px!important;
  border:1px solid var(--header-command-border)!important;border-radius:var(--header-command-radius)!important;background:#fff!important;color:var(--header-command-text)!important;
  box-shadow:0 1px 1px rgba(29,60,90,.025)!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;gap:7px!important;
  font-size:12px!important;font-weight:700!important;line-height:1!important;white-space:nowrap!important;transition:background .14s ease,border-color .14s ease,box-shadow .14s ease,transform .08s ease!important;
}
.header-actions .header-action-btn:hover:not(:disabled){background:var(--header-command-hover)!important;border-color:#b9ccdf!important;box-shadow:0 2px 6px rgba(31,70,105,.08)!important;color:#214f7b!important}
.header-actions .header-action-btn:active:not(:disabled){transform:translateY(1px)!important}
.header-actions .header-action-btn:focus-visible{outline:2px solid rgba(18,100,216,.32)!important;outline-offset:2px!important}
.header-actions .header-action-btn:disabled{opacity:.44!important;filter:saturate(.65)!important;box-shadow:none!important}
.header-actions #exportBtn{background:#1264d8!important;border-color:#1264d8!important;color:#fff!important;box-shadow:none!important}
.header-actions #exportBtn:hover:not(:disabled){background:#0f58c1!important;border-color:#0f58c1!important;color:#fff!important}
.header-actions #donateBtn{background:#fff8f7!important;border-color:#eed7d4!important;color:#a7463d!important}
.header-actions #donateBtn:hover:not(:disabled){background:#fff1ef!important;border-color:#e5c1bc!important;color:#9b3e35!important}
.pdf-icon-group,.pdf-view-group{height:40px!important;padding:2px!important;border:1px solid #dbe6ef!important;border-radius:11px!important;background:#f6f9fc!important;box-shadow:none!important}
.pdf-icon-group .pdf-command,.pdf-view-group .pdf-command,.pdf-view-group .pdf-zoom-readout{height:34px!important;min-height:34px!important;border-radius:8px!important}
.pdf-support-group .pdf-command-icon{width:40px!important;min-width:40px!important;height:40px!important;border:1px solid var(--header-command-border)!important;border-radius:10px!important;background:#fff!important}

/* Match secondary button language used by the DOC Editor. */
.page-actions button,.property-actions button,.page-nav button,.mobile-bar button,.panel-close,.text-btn{
  border:1px solid #d3dfeb!important;border-radius:9px!important;background:#fff!important;color:#294b6b!important;box-shadow:none!important;font-weight:650!important;
}
.page-actions button:hover:not(:disabled),.property-actions button:hover:not(:disabled),.page-nav button:hover:not(:disabled),.mobile-bar button:hover:not(:disabled),.panel-close:hover:not(:disabled),.text-btn:hover:not(:disabled){background:#f2f7fc!important;border-color:#b9ccdf!important}
.property-actions .danger,#deletePageBtn{color:#b42318!important;background:#fff8f7!important;border-color:#efd4d0!important}
.tool-rail .tool{border:1px solid transparent!important;border-radius:9px!important;background:transparent!important;color:#365a7a!important;box-shadow:none!important}
.tool-rail .tool:hover{background:#f2f7fc!important;border-color:#dbe6ef!important}.tool-rail .tool.active{background:#edf5ff!important;border-color:#cfe1f4!important;color:#0d5db4!important}

.export-dialog{width:min(470px,calc(100vw - 28px));border:0;padding:0;background:transparent}
.export-dialog::backdrop{background:rgba(13,35,58,.38);backdrop-filter:blur(2px)}
.export-dialog-card{position:relative;width:100%;min-width:0!important;max-width:100%;box-sizing:border-box;overflow:hidden;padding:24px;border:1px solid #dce6ef;border-radius:16px;background:#fff;box-shadow:0 22px 60px rgba(20,47,72,.22)}
.export-dialog-eyebrow{display:block;color:#1264d8;font-size:10px;font-weight:800;letter-spacing:.1em;margin-bottom:6px}
.export-dialog-card h2{margin:0;color:#173e6b;font-size:24px}.export-dialog-copy{margin:7px 0 18px;color:#667b91;line-height:1.45;max-width:100%;overflow-wrap:anywhere}
.export-progress{margin:4px 0 0;padding:16px;border:1px solid #d7e5f2;border-radius:12px;background:#f7fbff;color:#294b6b}.export-progress[hidden]{display:none!important}.export-progress-heading{display:flex;align-items:center;gap:10px;color:#173e6b;font-size:15px}.export-progress p{margin:9px 0 13px;color:#60768d;font-size:13px;line-height:1.45}.export-progress small{display:block;margin-top:9px;color:#60768d;font-size:12px}.export-spinner{width:20px;height:20px;border:3px solid #cfe1f4;border-top-color:#1264d8;border-radius:50%;animation:export-spin .8s linear infinite;flex:0 0 auto}.export-progress-track{height:8px;overflow:hidden;border-radius:999px;background:#dfeaf5}.export-progress-track span{display:block;width:0;height:100%;border-radius:inherit;background:#1264d8;transition:width .18s ease}.export-dialog.is-complete .export-spinner{animation:none;border-color:#2d8a5b;position:relative}.export-dialog.is-complete .export-progress{background:#f5fbf7;border-color:#cfe8d8}.export-dialog.has-error .export-progress{background:#fff8f7;border-color:#efd4d0}.export-dialog.has-error .export-spinner{animation:none;border-color:#c83b2d}@keyframes export-spin{to{transform:rotate(360deg)}}
.export-name-field{display:grid;gap:7px;color:#294b6b;font-size:12px;font-weight:750}.export-name-row{height:42px;display:flex;align-items:center;border:1px solid #cbd9e6;border-radius:10px;background:#fff;overflow:hidden}
.export-name-row:focus-within{border-color:#7fb1e6;box-shadow:0 0 0 3px rgba(18,100,216,.1)}.export-name-row input{min-width:0;flex:1;height:100%;border:0!important;outline:0!important;padding:0 11px!important;font:600 14px/1 system-ui,-apple-system,"Segoe UI",sans-serif;color:#173e6b;background:transparent!important;box-shadow:none!important}.export-name-row span{height:100%;display:flex;align-items:center;padding:0 12px;border-left:1px solid #e2eaf2;background:#f6f9fc;color:#60768d;font-size:13px;font-weight:700}
.export-dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:20px}.export-dialog-actions button{min-height:40px;padding:0 15px;border:1px solid #d3dfeb;border-radius:10px;background:#fff;color:#294b6b;font-weight:700}.export-dialog-actions .primary-btn{background:#1264d8!important;border-color:#1264d8!important;color:#fff!important}.export-dialog-actions button:hover:not(:disabled){background:#f2f7fc}.export-dialog-actions .primary-btn:hover:not(:disabled){background:#0f58c1!important}

@media(max-width:1180px){
  :root{--header-command-w:94px}
  .header-actions .header-action-btn{font-size:11px!important;padding-inline:8px!important;gap:5px!important}
  .topbar.app-header{gap:10px!important;padding-inline:10px!important}
  .topbar.app-header .brand span{display:none!important}
}
@media(max-width:1030px){
  .header-actions .header-action-btn{flex:0 0 40px!important;width:40px!important;min-width:40px!important;max-width:40px!important;height:40px!important;min-height:40px!important;padding:0!important;border-radius:10px!important;font-size:0!important;gap:0!important}
  .header-actions .header-action-label{display:none!important}.header-actions .pdf-ui-icon{width:19px!important;height:19px!important}
  .topbar.app-header .brand strong{font-size:15px!important}.topbar.app-header .brand span{display:none!important}
}
@media(max-width:720px){
  :root{--topbar-h:98px!important}
  .topbar.app-header{display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;height:98px!important;min-height:98px!important;padding:7px 8px 8px!important;gap:7px!important}
  .topbar.app-header .brand{width:100%!important;min-width:0!important;justify-content:center!important;text-align:center!important;gap:7px!important}.topbar.app-header .brand-mark,.topbar.app-header .brand-mark img{width:36px!important;height:36px!important}.topbar.app-header .brand strong{font-size:14px!important}.topbar.app-header .brand span{display:block!important;font-size:9px!important;margin-top:1px!important}
  .top-actions.header-actions{width:100%!important;justify-content:center!important;gap:6px!important;padding:0!important;overflow-x:auto!important}
  .pdf-icon-group,.pdf-view-group,.pdf-support-group #helpBtn,.pdf-support-group #feedbackBtn{display:none!important}
  .pdf-file-group,.pdf-support-group{display:inline-flex!important;width:auto!important;min-width:0!important;height:40px!important;background:transparent!important;border:0!important;padding:0!important;gap:6px!important}
  .pdf-file-group #newBtn,.pdf-file-group #openBtn,.pdf-file-group #mergeBtn,.pdf-support-group #donateBtn,.header-actions #exportBtn{display:inline-flex!important;flex:0 0 40px!important;width:40px!important;min-width:40px!important;max-width:40px!important;height:40px!important;min-height:40px!important;padding:0!important;border-radius:10px!important;font-size:0!important}
  .pdf-file-group #openBtn::before,.pdf-file-group #mergeBtn::before{display:none!important}
  .privacy-bar{font-size:10px!important}
}
