* { box-sizing: border-box; }
:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #161616;
  background: #f6f7f9;
}
body { margin: 0; min-height: 100vh; background: #f6f7f9; }
.topbar {
  height: 64px; background: #fff; border-bottom: 1px solid #e6e7ea;
  display: flex; align-items: center; justify-content: space-between; padding: 0 28px;
  position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; }
.logo {
  display: grid; place-items: center; width: 42px; height: 42px;
  background: transparent;
}
.lamb-logo { width: 42px; height: 42px; display: block; }
.privacy { font-size: 13px; color: #39704a; font-weight: 650; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.ghost-btn {
  border: 1px solid #dfe1e5; background: #fff; color: #33363c; border-radius: 10px;
  padding: 9px 13px; font: inherit; font-size: 13px; font-weight: 650; cursor: pointer;
}
.ghost-btn:hover { background: #f3f4f6; }
.coffee-btn {
  border: 0; border-radius: 10px; padding: 9px 14px; font: inherit; font-size: 13px; font-weight: 750;
  cursor: pointer; background: #ffb703; color: #161616;
}
.coffee-btn:hover { background: #ffc22e; }

.info-list { margin: 14px 0 4px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 11px; }
.info-list li { position: relative; padding-left: 22px; line-height: 1.5; font-size: 14px; color: #3a3d43; }
.info-list li::before { content: "✓"; position: absolute; left: 0; top: 0; color: #39704a; font-weight: 800; }
.info-list strong { color: #161616; }

.coffee-tiers { display: flex; flex-direction: column; gap: 10px; margin: 16px 0 6px; }
.coffee-tier {
  display: grid; grid-template-columns: auto 1fr auto; column-gap: 12px; row-gap: 1px;
  border: 1px solid #e3e4e8; background: #fff; border-radius: 12px; padding: 12px 14px;
  font: inherit; cursor: pointer; text-align: left; transition: border-color .15s, background .15s, transform .1s;
}
.coffee-tier:hover { border-color: #ffb703; background: #fffaf0; transform: translateY(-1px); }
.coffee-tier .cup-svg { grid-column: 1; grid-row: 1 / 3; align-self: end; justify-self: center; color: #6f4e37; display: block; }
.coffee-tier .cup-s { width: 18px; height: 26px; }
.coffee-tier .cup-m { width: 24px; height: 34px; }
.coffee-tier .cup-l { width: 30px; height: 42px; }
.coffee-tier .size { grid-column: 2; grid-row: 1; font-weight: 750; color: #161616; }
.coffee-tier .pat { grid-column: 2; grid-row: 2; color: #5f6368; font-size: 13px; }
.coffee-tier .amt { grid-column: 3; grid-row: 1 / 3; align-self: center; font-weight: 800; font-size: 18px; color: #161616; }
.coffee-note { margin: 8px 0 0; min-height: 16px; }

@media (max-width: 560px) {
  .ghost-btn { display: none; }
}
.app { max-width: 1120px; margin: 0 auto; padding: 46px 22px 70px; }
.hero { text-align: center; margin-bottom: 28px; }
.hero h1 { margin: 0 0 10px; font-size: clamp(30px, 5vw, 48px); letter-spacing: -1.5px; }
.hero p { max-width: 690px; margin: 0 auto; color: #666c75; line-height: 1.55; }

/* --- tool gallery (home) --- */
.tool-gallery-wrap { margin: 6px 0 10px; }
.tool-gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px;
}
.tool-tile {
  position: relative;
  background: #f4ead0; border: 1px solid #e3d3ac; border-radius: 14px;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.tool-tile:hover { border-color: #c7ab74; box-shadow: 0 10px 24px #7a5a1e22; transform: translateY(-2px); }
.tile-main {
  display: flex; align-items: flex-start; gap: 13px; width: 100%; text-align: left;
  background: none; border: 0; padding: 16px; border-radius: 14px;
  font: inherit; color: inherit; cursor: pointer;
}
.tile-main:focus-visible { outline: 2px solid #161616; outline-offset: 2px; }
.tile-icon { font-size: 24px; line-height: 1.1; flex: none; }
.tile-body { min-width: 0; padding-right: 20px; }
.tile-name { font-weight: 700; font-size: 15px; color: #161616; }
.tile-desc { margin-top: 3px; color: #6f6650; font-size: 13px; line-height: 1.45; }

/* per-tile "?" help popover */
.tile-help {
  position: absolute; right: 10px; bottom: 10px; width: 26px; height: 26px;
  border-radius: 50%; border: 1px solid #cdb587; background: #fbf3df; color: #6f5a2e;
  font: inherit; font-size: 12px; font-weight: 800; line-height: 1; cursor: pointer;
  display: grid; place-items: center; z-index: 2; transition: background .12s, border-color .12s, color .12s;
}
.tile-help:hover, .tile-help[aria-expanded="true"] { background: #161616; color: #fff; border-color: #161616; }
.tile-tip {
  position: absolute; right: 8px; bottom: 40px; width: min(240px, 78vw);
  background: #161616; color: #f4f4f5; padding: 10px 12px; border-radius: 10px;
  font-size: 12.5px; line-height: 1.5; box-shadow: 0 12px 30px #00000030;
  opacity: 0; visibility: hidden; transform: translateY(4px);
  transition: opacity .12s, transform .12s, visibility .12s; z-index: 6; pointer-events: none;
}
.tile-tip::after { content: ""; position: absolute; right: 14px; bottom: -6px; width: 12px; height: 12px; background: #161616; transform: rotate(45deg); }
.tile-help:hover ~ .tile-tip, .tile-help:focus-visible ~ .tile-tip, .tool-tile.tip-open .tile-tip {
  opacity: 1; visibility: visible; transform: translateY(0);
}

/* --- tool-specific upload panel --- */
.upload-panel { margin: 4px 0 8px; }
.upload-head { text-align: center; margin: 4px 0 16px; }
.upload-head h2 { margin: 0 0 6px; font-size: 24px; letter-spacing: -0.5px; }
.upload-head p { margin: 0 auto; max-width: 620px; }
.back-link {
  display: inline-flex; align-items: center; gap: 4px; margin: 0 0 8px;
  background: none; border: 0; color: #33363c; font: inherit; font-weight: 650; font-size: 14px; cursor: pointer;
}
.back-link:hover { color: #161616; text-decoration: underline; }
.drop-zone {
  max-width: 760px; margin: 0 auto; background: #fff; border: 2px dashed #c9ccd2;
  border-radius: 20px; padding: 48px 24px; text-align: center; transition: .18s ease;
}
.drop-zone.over { border-color: #161616; transform: translateY(-2px); box-shadow: 0 12px 35px #00000012; }
.upload-icon {
  width: 50px; height: 50px; border-radius: 14px; background: #f0f1f3;
  display: grid; place-items: center; margin: 0 auto 16px; font-size: 25px;
}
.drop-zone h2 { margin: 0 0 6px; font-size: 21px; }
.drop-zone p { margin: 6px 0; color: #777; }
.drop-zone small { display: block; margin-top: 17px; color: #5f6368; }
.choose-btn, .secondary-btn, .primary-btn {
  border: 0; border-radius: 10px; padding: 11px 16px; font: inherit; font-weight: 700; cursor: pointer;
}
.choose-btn { display: inline-block; background: #161616; color: white; }
.secondary-btn { background: #fff; border: 1px solid #dfe1e5; color: #292b30; }
.primary-btn { background: #161616; color: #fff; min-width: 130px; }
button:disabled { opacity: .45; cursor: not-allowed; }
.workspace { margin-top: 28px; }
/* Full-screen editing page content (converters, Images -> PDF) */
.screen-edit { max-width: 900px; margin: 18px auto 0; display: flex; flex-direction: column; gap: 14px; }
.screen-edit .conv-options, .screen-edit .row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.screen-edit .modal-actions { display: flex; gap: 10px; }
.hidden { display: none !important; }
.toolbar {
  background: #fff; border: 1px solid #e5e6e9; border-radius: 16px; padding: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 15px;
  position: sticky; top: 74px; z-index: 5; box-shadow: 0 5px 20px #00000008;
}
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.muted { color: #5f6368; margin-left: 10px; font-size: 13px; }
.hint { color: #777; font-size: 13px; margin: 14px 2px; }
.page-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 15px;
}
.page-card {
  background: #fff; border: 1px solid #e3e4e8; border-radius: 14px; padding: 10px;
  cursor: grab; position: relative; transition: transform .15s, box-shadow .15s, border-color .15s;
}
.page-card:active { cursor: grabbing; }
.page-card.selected { border-color: #161616; box-shadow: 0 0 0 2px #16161622; }
.page-card.dragging { opacity: .45; transform: scale(.98); }
.page-card.drop-target { outline: 2px dashed #777; }
.thumb {
  aspect-ratio: 0.707; width: 100%; background: #f0f1f3; border-radius: 9px;
  display: grid; place-items: center; overflow: hidden; position: relative;
}
.thumb canvas { max-width: 100%; max-height: 100%; display: block; }
.page-number {
  position: absolute; top: 7px; left: 7px; background: #161616; color: #fff;
  border-radius: 7px; padding: 3px 7px; font-size: 11px; font-weight: 750; z-index: 2;
}
.card-meta { padding: 9px 2px 1px; }
.card-title { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-subtitle { color: #5f6368; font-size: 11px; margin-top: 3px; }
.controls { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.icon-btn {
  flex: 1 1 auto; border: 1px solid #e1e2e5; background: #fafafa; border-radius: 8px;
  padding: 7px 5px; cursor: pointer; font-size: 13px;
}
.icon-btn:hover { background: #f0f1f3; }
.icon-btn.delete { color: #a22; }
/* Touch-friendly drag handle for page reordering. touch-action:none lets a drag
   start on it without the page scrolling; the rest of the card scrolls normally. */
.drag-handle { touch-action: none; cursor: grab; }
.drag-handle:active { cursor: grabbing; }
body.reordering { -webkit-user-select: none; user-select: none; }
.status { text-align: center; margin-top: 18px; color: #555; min-height: 22px; }
.status.error { color: #a22; }
.job-bar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 60; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; row-gap: 6px; width: min(560px, calc(100% - 32px)); padding: 10px 12px 10px 16px; background: #fff; border: 1px solid #d9d4c7; border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.16); }
.job-bar.hidden { display: none; }
.job-text { grid-column: 1; grid-row: 1; min-width: 0; font-size: 14px; color: #333; overflow-wrap: anywhere; }
.job-progress { grid-column: 1; grid-row: 2; width: 100%; height: 8px; accent-color: #161616; }
.job-cancel { grid-column: 2; grid-row: 1 / span 2; min-height: 44px; padding: 8px 14px; }

/* SEO / marketing content below the tool */
.seo-content { max-width: 900px; margin: 56px auto 0; padding: 0 4px; }
.seo-content h2 { font-size: clamp(22px, 3.2vw, 30px); letter-spacing: -.6px; margin: 40px 0 12px; }
.seo-content > p { color: #4a4d53; line-height: 1.7; font-size: 16px; max-width: 720px; }
.seo-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin: 22px 0; }
.seo-features .feature-card { background: #fff; border: 1px solid #e5e6e9; border-radius: 14px; padding: 16px; }
.seo-features .feature-card h3 { margin: 0 0 6px; font-size: 16px; }
.seo-features .feature-card p { margin: 0; color: #6a6e75; font-size: 14px; line-height: 1.55; }
.seo-steps { color: #4a4d53; line-height: 1.7; font-size: 16px; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; max-width: 720px; }
.faq { display: flex; flex-direction: column; gap: 10px; max-width: 720px; }
.faq details { background: #fff; border: 1px solid #e5e6e9; border-radius: 12px; padding: 4px 16px; }
.faq summary { cursor: pointer; font-weight: 650; padding: 12px 0; color: #161616; }
.faq details[open] summary { border-bottom: 1px solid #eef0f2; }
.faq details p { color: #4a4d53; line-height: 1.6; font-size: 15px; margin: 10px 0 14px; }

/* tool landing pages */
.tool-links { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 6px; }
.tool-links a { border: 1px solid #dfe1e5; border-radius: 999px; padding: 8px 16px; text-decoration: none; color: #33363c; font-weight: 650; font-size: 14px; }
.tool-links a:hover { background: #f3f4f6; color: #161616; }
.tool-landing .lead { font-size: 18px; color: #4a4d53; }

/* responsive YouTube embed */
.video-embed { position: relative; width: 100%; max-width: 720px; margin: 22px auto; aspect-ratio: 16 / 9; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 14px; }
.site-footer {
  padding: 26px 22px; border-top: 1px solid #e6e7ea; background: #fff;
  display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
}
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; }
.footer-links a { color: #33363c; text-decoration: none; font-size: 13px; font-weight: 650; }
.footer-links a:hover { color: #161616; text-decoration: underline; }
.footer-tools { gap: 6px 16px; }
.footer-tools a { color: #6a6e75; font-weight: 600; font-size: 12.5px; }
.footer-meta { display: flex; flex-direction: column; gap: 3px; color: #5f6368; font-size: 12px; }

/* brand as a link (sub-pages) */
.brand-link { text-decoration: none; color: inherit; }

/* content / legal pages */
.legal { max-width: 760px; }
.legal h1 { font-size: clamp(26px, 4vw, 38px); letter-spacing: -1px; margin: 0 0 6px; }
.legal .updated { color: #5f6368; font-size: 13px; margin: 0 0 26px; }
.legal h2 { font-size: 20px; margin: 30px 0 10px; }
.legal h3 { font-size: 16px; margin: 20px 0 8px; }
.legal p, .legal li { color: #3a3d43; line-height: 1.65; font-size: 15px; }
.legal ul { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.legal a { color: #1a5fb4; }
.legal .lead { font-size: 17px; color: #4a4d53; }
.legal .callout {
  background: #f0f6f1; border: 1px solid #cfe6d4; border-radius: 12px; padding: 14px 16px;
  color: #2f5d3a; font-size: 14px; margin: 18px 0;
}
.legal .placeholder { background: #fff4d6; padding: 0 4px; border-radius: 4px; }
.legal .feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 18px 0; }
.legal .feature-card { background: #fff; border: 1px solid #e5e6e9; border-radius: 14px; padding: 16px; }
.legal .feature-card h3 { margin: 0 0 6px; }
.legal .feature-card p { margin: 0; font-size: 14px; }
.legal .btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.legal .cta { display: inline-block; text-decoration: none; }
.legal a.primary-btn { color: #fff; } /* buttons keep white text over the link colour */
.text-center { text-align: center; }
.btn-row.center { justify-content: center; }

/* ad slot — hidden until consent.js activates it (ads enabled + consent given) */
.ad-slot { display: none; margin: 26px auto; max-width: 970px; text-align: center; }
.ad-slot.active { display: block; }
.ad-label { font-size: 10px; letter-spacing: .6px; text-transform: uppercase; color: #5f6368; margin-bottom: 4px; }
ins.adsbygoogle { display: block; }

/* cookie-consent banner */
.consent-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: #161616; color: #f4f4f5; box-shadow: 0 -6px 24px #00000026;
}
.consent-inner {
  max-width: 1120px; margin: 0 auto; padding: 14px 22px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: space-between;
}
.consent-text { margin: 0; font-size: 13px; line-height: 1.5; flex: 1; min-width: 240px; }
.consent-text a { color: #ffd166; }
.consent-actions { display: flex; gap: 10px; }
.consent-actions .secondary-btn { background: transparent; color: #f4f4f5; border-color: #4a4a4a; }
.consent-actions .secondary-btn:hover { background: #2a2a2a; }
.consent-actions .primary-btn { background: #ffb703; color: #161616; }

.bug-form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; max-width: 560px; }
.bug-form .field { width: 100%; min-width: 0; }
.bug-form textarea.text-input { resize: vertical; font: inherit; }
.bug-note { min-height: 16px; margin: 0; }
.bug-note.error, .coffee-note.error { color: #a22; }
#reportBugBtn { margin-top: 6px; }

/* --- added: tool strip, options panel, selection, redaction, modal --- */
.tools-bar { display: flex; align-items: center; gap: 12px; margin: 16px 2px 0; flex-wrap: wrap; }
.tools-label { font-size: 11px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; color: #5f6368; }
.tool-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tool-tab {
  border: 1px solid #dfe1e5; background: #fff; color: #33363c; border-radius: 999px;
  padding: 7px 14px; font: inherit; font-size: 13px; font-weight: 650; cursor: pointer;
}
.tool-tab:hover { background: #f3f4f6; }
.tool-tab.active { background: #161616; color: #fff; border-color: #161616; }
.secondary-btn.active { background: #161616; color: #fff; border-color: #161616; }

.out-name { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 650; color: #5f6368; }
.out-name .text-input { width: 150px; padding: 7px 10px; }

.bulk-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 14px 2px 0; }
.link-btn {
  border: 1px solid #e1e2e5; background: #fff; color: #33363c; border-radius: 8px;
  padding: 6px 10px; font: inherit; font-size: 12px; font-weight: 650; cursor: pointer;
}
.link-btn:hover:not(:disabled) { background: #f3f4f6; }
.link-btn.danger { color: #a22; }
.link-btn:disabled { opacity: .4; cursor: not-allowed; }
.bulk-sep { width: 1px; height: 20px; background: #e1e2e5; margin: 0 4px; }

.form-fields { display: flex; flex-direction: column; gap: 10px; width: 100%; max-height: 320px; overflow: auto; padding-right: 4px; }

.tool-panel {
  background: #fff; border: 1px solid #e5e6e9; border-radius: 16px; padding: 18px; margin-top: 14px;
  position: relative;
}
.panel-head h3 { margin: 0 0 4px; font-size: 17px; }
.panel-head .muted { margin: 0; display: block; line-height: 1.5; }
.panel-controls { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.row { display: flex; gap: 12px; flex-wrap: wrap; width: 100%; }
.row.row-center { align-items: center; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 650; color: #4a4d53; flex: 1; min-width: 130px; }
.text-input {
  border: 1px solid #dfe1e5; border-radius: 9px; padding: 9px 11px; font: inherit; font-weight: 500;
  background: #fff; color: #161616;
}
.text-input.color { padding: 4px; height: 40px; }
.text-input.field-error { border-color: #d22; box-shadow: 0 0 0 2px #d2222222; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: #4a4d53; }
.small { font-size: 12px; }
code { background: #f0f1f3; padding: 1px 5px; border-radius: 5px; font-size: 12px; }
.panel-close {
  position: absolute; top: 12px; right: 12px; border: 0; background: transparent;
  font-size: 18px; color: #999; cursor: pointer; line-height: 1;
}

.sel { position: absolute; top: 7px; right: 7px; width: 18px; height: 18px; z-index: 2; cursor: pointer; }
.expand-btn {
  position: absolute; bottom: 7px; right: 7px; z-index: 2; width: 26px; height: 26px;
  border: 0; border-radius: 7px; background: #161616cc; color: #fff; cursor: pointer;
  font-size: 14px; line-height: 1; display: grid; place-items: center;
}
.expand-btn:hover { background: #161616; }

/* full-size viewer / preview modal */
.viewer .viewer-card {
  background: #fff; border-radius: 16px; width: min(1000px, 96vw); height: min(92vh, 1300px);
  margin: auto; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px #00000030;
}
.viewer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid #eef0f2; font-weight: 700; }
.viewer-head .panel-close { position: static; font-size: 20px; color: #666; padding: 2px 10px; border-radius: 8px; }
.viewer-head .panel-close:hover { color: #161616; background: #f0f1f3; }
.viewer-body { flex: 1; overflow: auto; background: #eceef1; padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.viewer-page { position: relative; background: #fff; box-shadow: 0 2px 12px #0000001f; }
.viewer-page canvas { display: block; }
/* Only disable touch scrolling while actually drawing (redact/crop/sign); the
   read-only preview must stay scrollable on touch devices. */
.viewer-page.drawable { cursor: crosshair; touch-action: none; }
.viewer-hint { text-align: center; color: #555; font-size: 13px; }
.page-grid.redact-mode .page-card, .page-grid.sign-mode .page-card { cursor: crosshair; }
.thumb.drawable { touch-action: none; }
.redaction-box, .redaction-live { position: absolute; background: #000; z-index: 1; }
.redaction-live { background: #000000cc; outline: 1px solid #fff; }
.stamp-box, .stamp-live {
  position: absolute; z-index: 1; background-size: contain; background-repeat: no-repeat; background-position: center;
}
.stamp-live { outline: 1px dashed #161616; }
.crop-box, .crop-live {
  position: absolute; z-index: 3; background: transparent;
  border: 2px dashed #2f6feb; box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.28);
  pointer-events: auto; cursor: move; touch-action: none;
}
/* Resize handles on the crop rectangle. */
.crop-handle {
  position: absolute; width: 13px; height: 13px; background: #fff;
  border: 2px solid #2f6feb; border-radius: 50%; z-index: 4;
  pointer-events: auto; touch-action: none;
}
.crop-handle.h-nw { left: 0;    top: 0;    transform: translate(-50%, -50%); cursor: nwse-resize; }
.crop-handle.h-n  { left: 50%;  top: 0;    transform: translate(-50%, -50%); cursor: ns-resize; }
.crop-handle.h-ne { left: 100%; top: 0;    transform: translate(-50%, -50%); cursor: nesw-resize; }
.crop-handle.h-e  { left: 100%; top: 50%;  transform: translate(-50%, -50%); cursor: ew-resize; }
.crop-handle.h-se { left: 100%; top: 100%; transform: translate(-50%, -50%); cursor: nwse-resize; }
.crop-handle.h-s  { left: 50%;  top: 100%; transform: translate(-50%, -50%); cursor: ns-resize; }
.crop-handle.h-sw { left: 0;    top: 100%; transform: translate(-50%, -50%); cursor: nesw-resize; }
.crop-handle.h-w  { left: 0;    top: 50%;  transform: translate(-50%, -50%); cursor: ew-resize; }
body.cropping { -webkit-user-select: none; user-select: none; }

.modal { position: fixed; inset: 0; background: #00000055; display: grid; place-items: center; z-index: 50; }
.modal-card { background: #fff; border-radius: 16px; padding: 22px; width: min(420px, 92vw); box-shadow: 0 20px 60px #00000030; max-height: 92vh; overflow-y: auto; }
.modal-card h3 { margin: 0 0 8px; }
.modal-card .text-input { width: 100%; margin: 12px 0; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* Images → PDF */
.dz-extra { margin-top: 14px; }
.i2p-add { display: flex; align-items: center; gap: 12px; margin: 14px 0 6px; }
.i2p-list { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 14px; max-height: 240px; overflow: auto; }
.i2p-list:empty { display: none; }
.i2p-thumb { position: relative; width: 84px; }
.i2p-thumb img { width: 84px; height: 100px; object-fit: cover; border: 1px solid #e3e4e8; border-radius: 8px; background: #f0f1f3; display: block; }
.i2p-thumb .i2p-remove {
  position: absolute; top: -9px; right: -9px; width: 26px; height: 26px; border: 0; border-radius: 50%;
  background: #161616; color: #fff; cursor: pointer; font-size: 12px; line-height: 1; display: grid; place-items: center;
}
.i2p-thumb .i2p-move { display: flex; justify-content: space-between; margin-top: 3px; }
.i2p-thumb .i2p-move button { border: 1px solid #e1e2e5; background: #fafafa; border-radius: 6px; cursor: pointer; font-size: 13px; min-height: 26px; min-width: 32px; padding: 3px 9px; }
.i2p-note { margin: 8px 0 0; min-height: 16px; }
.i2p-note.error { color: #a22; }

@media (max-width: 700px) {
  .topbar { padding: 0 15px; }
  .privacy { display: none; }
  .toolbar { position: static; top: auto; align-items: flex-start; flex-direction: column; }
  .toolbar-actions { width: 100%; }
  .toolbar-actions > * { flex: 1; text-align: center; }
  .page-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}

/* A phone in landscape also needs its short viewport clear for editing. */
@media (pointer: coarse) and (max-width: 1000px) and (max-height: 600px) {
  .toolbar { position: static; top: auto; }
}

/* --- PDF → Excel / CSV converter modal --- */
.conv-card { max-width: 860px; }
.conv-drop {
  margin: 12px 0; padding: 26px; border: 2px dashed #cfd2d7; border-radius: 12px;
  text-align: center; color: #5f6368; font-weight: 600; background: #fafbfc;
}
.conv-drop.over { border-color: #161616; color: #161616; background: #f3f4f6; }
.conv-files { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.conv-file {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid #e3e4e8; border-radius: 10px; background: #fff;
}
.conv-file.active { border-color: #161616; box-shadow: 0 0 0 2px #16161615; }
.conv-file-name { flex: none; max-width: 40%; border: 0; background: none; font: inherit; font-weight: 650; cursor: pointer; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #161616; }
.conv-file-status { flex: 1; color: #55585f; font-size: 13px; }
.conv-file-rm { border: 0; background: none; cursor: pointer; color: #a22; font-size: 14px; flex: none; }
.conv-detected { font-weight: 750; margin-top: 6px; }
.conv-balance { margin: 4px 0 8px; }
.conv-balance.good { color: #2f7d43; }
.conv-balance.bad { color: #b23; }
.conv-controls { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: end; margin: 8px 0 12px; }
.conv-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.conv-tab { border: 1px solid #dfe1e5; background: #fff; border-radius: 8px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.conv-tab.active { background: #161616; color: #fff; border-color: #161616; }
.conv-preview { max-height: 320px; overflow: auto; border: 1px solid #e6e7ea; border-radius: 10px; }
.conv-preview table { border-collapse: collapse; width: 100%; font-size: 13px; }
.conv-preview th, .conv-preview td { border: 1px solid #eceef1; padding: 5px 9px; text-align: left; vertical-align: top; white-space: nowrap; }
.conv-preview thead th { position: sticky; top: 0; background: #f6f7f9; font-weight: 700; }
.conv-preview tr.mismatch td { background: #fdeaea; }
.col-type { font-size: 10px; font-weight: 600; color: #5f6368; text-transform: uppercase; letter-spacing: .4px; }
.col-type.number { color: #2f6feb; }
.col-type.date { color: #a15; }
.conv-options { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: end; margin-top: 8px; }

/* --- quick-edit tool modal --- */
.tm-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0; }
.tm-chip { background: #eef1f6; border: 1px solid #dfe3ea; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 650; color: #33363c; }
#tmFileBar { display: flex; align-items: center; gap: 12px; }
#tmActions { gap: 8px; }

/* Preview navigation stays reachable on phones; zoomed pages scroll from their left edge. */
.viewer-controls { display:flex; flex-wrap:wrap; align-items:center; gap:8px; padding:10px 16px; border-bottom:1px solid #dde1e5; }
.viewer-controls button { min-width:44px; min-height:44px; }
.viewer-controls input { width:64px; min-height:44px; padding:6px; }
.viewer-body { align-items:flex-start; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }
.viewer-page { flex-shrink:0; margin:0 auto; }
@media (max-width:600px) { .viewer-controls { gap:6px; padding:8px; } .viewer-body { padding:10px; } .viewer-head .panel-close { min-width:44px; min-height:44px; } }

/* Source comparison stays beside editable cells on wide screens. */
.conv-comparison { display:grid; grid-template-columns:minmax(250px, .85fr) minmax(0, 1.15fr); gap:20px; align-items:start; }
.conv-source,.conv-extracted { min-width:0; }
.conv-source-surface { position:relative; line-height:0; user-select:none; }
.conv-source-surface canvas { width:100%; height:auto; }
.conv-region { position:absolute; border:2px solid #765a32; background:rgba(220,190,135,.2); pointer-events:none; box-sizing:border-box; }
.conv-source button,.conv-source select { min-height:44px; margin:4px; }
@media(max-width:850px) { .conv-comparison { grid-template-columns:1fr; } }

.privacy-controls { display:flex; flex-wrap:wrap; align-items:center; gap:12px; margin:16px 0; padding:12px; border:1px solid #d8cbb2; border-radius:12px; background:#faf5eb; }
.privacy-controls label { display:flex; align-items:center; gap:6px; font-size:13px; }
.privacy-badge { color: #1b4d2c; font-weight: 600; text-decoration: none; }
.privacy-badge:hover, .privacy-badge:focus-visible { text-decoration: underline; }
.privacy-controls small { flex-basis:100%; color:#555; }
/* Read PDF tool + output previews use the SDK viewer component */
.read-viewer { margin-top: 12px; height: calc(100vh - 200px); min-height: 420px; }
#editScreen .toolbar, #createScreen .toolbar { position: static; }   /* the editor scrolls inside itself; a sticky bar would cover its tools */
.pdf-editor, .pdf-composer { display: flex; margin-top: 12px; height: calc(100vh - 200px); min-height: 420px; }
@media (max-width: 600px) { .pdf-editor, .pdf-composer { height: calc(100vh - 170px); min-height: 360px; } }
.read-viewer #readAloud { height: 32px; padding: 0 10px; }
.viewer.component-preview .viewer-controls { display: none; }
.viewer-body > lambi-pdf-viewer { align-self: stretch; flex: 1; width: 100%; min-height: 60vh; }
@media (max-width: 600px) { .read-viewer { height: calc(100vh - 170px); min-height: 360px; } }

.restore-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin: 0 0 18px; padding: 12px 16px; background: #eef4ff; border: 1px solid #bcd0f5; border-radius: 12px; color: #1d2b4a; }
.restore-bar.hidden { display: none; }
.restore-actions { display: flex; gap: 8px; }
.restore-actions button { min-width: 0; min-height: 44px; }
.offline-ready { color: #1b6e3a; font-weight: 600; }

/* SDK pages (/sdk/…): product, pricing, download, licence. No ads. */
.sdk-page .sdk-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; }
.sdk-page .sdk-nav a { padding: 6px 12px; border-radius: 999px; text-decoration: none; color: #292b30; background: #f1f2f4; font-size: 14px; }
.sdk-page .sdk-nav a[aria-current=page] { background: #161616; color: #fff; }
.legal a.secondary-btn { color: #292b30; }
.sdk-page .btn-row { gap: 10px; }
.sdk-page pre { background: #f6f7f9; border: 1px solid #e4e6ea; border-radius: 8px; padding: 12px 14px; overflow-x: auto; font-size: 13.5px; line-height: 1.5; }
.sdk-page .feature-grid h3 { margin: 0 0 4px; font-size: 16px; }
.sdk-page .feature-grid > div { background: #fff; border: 1px solid #e4e6ea; border-radius: 10px; padding: 14px 16px; }
.sdk-page .feature-grid p { margin: 0; font-size: 14px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin: 22px 0 8px; }
.plan { display: flex; flex-direction: column; background: #fff; border: 1px solid #e4e6ea; border-radius: 12px; padding: 16px; }
.plan.featured { border-color: #161616; box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.plan h2 { margin: 0; font-size: 18px; }
.plan .price { font-size: 28px; font-weight: 700; margin: 6px 0 4px; }
.plan .price span { font-size: 15px; font-weight: 400; color: #6b6f76; }
.plan ul { padding-left: 18px; margin: 8px 0 14px; font-size: 14px; flex: 1; }
.plan form.buy, .trial-banner form.buy { display: grid; gap: 8px; }
.plan form.buy label, .trial-banner form.buy label { display: grid; gap: 4px; font-size: 13px; color: #4a4e55; }
.plan input, .trial-banner input { font: inherit; padding: 9px 10px; border: 1px solid #cfd2d8; border-radius: 8px; }
.plan .primary-btn, .plan .secondary-btn { text-align: center; min-width: 0; }
.trial-banner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 340px); gap: 16px; align-items: end; background: #eef7f1; border: 1px solid #cfe7d8; border-radius: 12px; padding: 16px 18px; margin: 18px 0; }
.trial-banner h2 { margin: 0 0 6px; }
.trial-banner p { margin: 0; }
.copy-row { display: flex; gap: 8px; align-items: flex-start; }
.copy-row pre { flex: 1; margin: 0; word-break: break-all; white-space: pre-wrap; }
.license-text { white-space: pre-wrap; font-size: 13px; max-height: 70vh; overflow: auto; }
@media (max-width: 640px) { .trial-banner { grid-template-columns: 1fr; } .copy-row { flex-direction: column; } .copy-row button { align-self: flex-start; } }

/* LambiPdf Premium */
html:not([data-premium="active"]) .tool-tile.early-access { display: none; }
.tool-tile.early-access .tile-name::after { content: "Early access"; margin-left: 8px; padding: 1px 7px; border-radius: 999px; background: #fff4d6; color: #7a5200; font-size: 11px; font-weight: 600; vertical-align: middle; }
.premium-badge { margin-left: auto; margin-right: 10px; padding: 4px 10px; border-radius: 999px; background: #fff4d6; color: #7a5200; font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.premium-page .premium-status { background: #fff; border: 1px solid #e4e6ea; border-radius: 12px; padding: 14px 16px; margin: 18px 0; }
.premium-page .premium-status.active { background: #fffaf0; border-color: #f0d9a8; }
.premium-page .premium-status h2 { margin: 0 0 6px; font-size: 18px; }
.premium-page .premium-status .error { color: #b3261e; }
.premium-page .premium-offer { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
/* Checkout (8f): status after returning from the licensing Worker or the provider's checkout. */
.checkout-status { background: #eef7f1; border: 1px solid #cfe7d8; border-radius: 10px; padding: 12px 14px; margin: 14px 0; }
.checkout-status.error { background: #fdf0ef; border-color: #f2cdc9; }
.plan form.buy label.check, .trial-banner form.buy label.check { display: flex; gap: 8px; align-items: flex-start; }
.plan form.buy label.check input { margin-top: 2px; padding: 0; }
.premium-offer form#buy { margin: 0; }
.premium-offer form#buy .primary-btn { width: 100%; }
