/* edityourPDF — the app's own styles. Colours and the top bar are in shell.css, shared with the landing page. */
@font-face { font-family: "Liberation Sans"; src: url("/fonts/LiberationSans-Regular.woff2") format("woff2"), url("/fonts/LiberationSans-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Liberation Sans"; src: url("/fonts/LiberationSans-Bold.woff2") format("woff2"), url("/fonts/LiberationSans-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Liberation Sans"; src: url("/fonts/LiberationSans-Italic.woff2") format("woff2"), url("/fonts/LiberationSans-Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Liberation Sans"; src: url("/fonts/LiberationSans-BoldItalic.woff2") format("woff2"), url("/fonts/LiberationSans-BoldItalic.ttf") format("truetype"); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: "Carlito"; src: url("/fonts/Carlito-Regular.woff2") format("woff2"), url("/fonts/Carlito-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Carlito"; src: url("/fonts/Carlito-Bold.woff2") format("woff2"), url("/fonts/Carlito-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Carlito"; src: url("/fonts/Carlito-Italic.woff2") format("woff2"), url("/fonts/Carlito-Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Carlito"; src: url("/fonts/Carlito-BoldItalic.woff2") format("woff2"), url("/fonts/Carlito-BoldItalic.ttf") format("truetype"); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: "Open Sans"; src: url("/fonts/OpenSans-Regular.woff2") format("woff2"), url("/fonts/OpenSans-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Open Sans"; src: url("/fonts/OpenSans-Bold.woff2") format("woff2"), url("/fonts/OpenSans-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Open Sans"; src: url("/fonts/OpenSans-Italic.woff2") format("woff2"), url("/fonts/OpenSans-Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Open Sans"; src: url("/fonts/OpenSans-BoldItalic.woff2") format("woff2"), url("/fonts/OpenSans-BoldItalic.ttf") format("truetype"); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("/fonts/Montserrat-Regular.woff2") format("woff2"), url("/fonts/Montserrat-Regular.otf") format("opentype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("/fonts/Montserrat-Bold.woff2") format("woff2"), url("/fonts/Montserrat-Bold.otf") format("opentype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("/fonts/Montserrat-Italic.woff2") format("woff2"), url("/fonts/Montserrat-Italic.otf") format("opentype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("/fonts/Montserrat-BoldItalic.woff2") format("woff2"), url("/fonts/Montserrat-BoldItalic.otf") format("opentype"); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: "URW Gothic"; src: url("/fonts/URWGothic-Book.woff2") format("woff2"), url("/fonts/URWGothic-Book.otf") format("opentype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "URW Gothic"; src: url("/fonts/URWGothic-Demi.woff2") format("woff2"), url("/fonts/URWGothic-Demi.otf") format("opentype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "URW Gothic"; src: url("/fonts/URWGothic-BookOblique.woff2") format("woff2"), url("/fonts/URWGothic-BookOblique.otf") format("opentype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "URW Gothic"; src: url("/fonts/URWGothic-DemiOblique.woff2") format("woff2"), url("/fonts/URWGothic-DemiOblique.otf") format("opentype"); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: "Liberation Serif"; src: url("/fonts/LiberationSerif-Regular.woff2") format("woff2"), url("/fonts/LiberationSerif-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Liberation Serif"; src: url("/fonts/LiberationSerif-Bold.woff2") format("woff2"), url("/fonts/LiberationSerif-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Liberation Serif"; src: url("/fonts/LiberationSerif-Italic.woff2") format("woff2"), url("/fonts/LiberationSerif-Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Liberation Serif"; src: url("/fonts/LiberationSerif-BoldItalic.woff2") format("woff2"), url("/fonts/LiberationSerif-BoldItalic.ttf") format("truetype"); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: "Caladea"; src: url("/fonts/Caladea-Regular.woff2") format("woff2"), url("/fonts/Caladea-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Caladea"; src: url("/fonts/Caladea-Bold.woff2") format("woff2"), url("/fonts/Caladea-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Caladea"; src: url("/fonts/Caladea-Italic.woff2") format("woff2"), url("/fonts/Caladea-Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Caladea"; src: url("/fonts/Caladea-BoldItalic.woff2") format("woff2"), url("/fonts/Caladea-BoldItalic.ttf") format("truetype"); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: "P052"; src: url("/fonts/P052-Roman.woff2") format("woff2"), url("/fonts/P052-Roman.otf") format("opentype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "P052"; src: url("/fonts/P052-Bold.woff2") format("woff2"), url("/fonts/P052-Bold.otf") format("opentype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "P052"; src: url("/fonts/P052-Italic.woff2") format("woff2"), url("/fonts/P052-Italic.otf") format("opentype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "P052"; src: url("/fonts/P052-BoldItalic.woff2") format("woff2"), url("/fonts/P052-BoldItalic.otf") format("opentype"); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: "URW Bookman"; src: url("/fonts/URWBookman-Light.woff2") format("woff2"), url("/fonts/URWBookman-Light.otf") format("opentype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "URW Bookman"; src: url("/fonts/URWBookman-Demi.woff2") format("woff2"), url("/fonts/URWBookman-Demi.otf") format("opentype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "URW Bookman"; src: url("/fonts/URWBookman-LightItalic.woff2") format("woff2"), url("/fonts/URWBookman-LightItalic.otf") format("opentype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "URW Bookman"; src: url("/fonts/URWBookman-DemiItalic.woff2") format("woff2"), url("/fonts/URWBookman-DemiItalic.otf") format("opentype"); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: "C059"; src: url("/fonts/C059-Roman.woff2") format("woff2"), url("/fonts/C059-Roman.otf") format("opentype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "C059"; src: url("/fonts/C059-Bold.woff2") format("woff2"), url("/fonts/C059-Bold.otf") format("opentype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "C059"; src: url("/fonts/C059-Italic.woff2") format("woff2"), url("/fonts/C059-Italic.otf") format("opentype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "C059"; src: url("/fonts/C059-BdIta.woff2") format("woff2"), url("/fonts/C059-BdIta.otf") format("opentype"); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: "STIX Two Text"; src: url("/fonts/STIXTwoText-Regular.woff2") format("woff2"), url("/fonts/STIXTwoText-Regular.otf") format("opentype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "STIX Two Text"; src: url("/fonts/STIXTwoText-Bold.woff2") format("woff2"), url("/fonts/STIXTwoText-Bold.otf") format("opentype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "STIX Two Text"; src: url("/fonts/STIXTwoText-Italic.woff2") format("woff2"), url("/fonts/STIXTwoText-Italic.otf") format("opentype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "STIX Two Text"; src: url("/fonts/STIXTwoText-BoldItalic.woff2") format("woff2"), url("/fonts/STIXTwoText-BoldItalic.otf") format("opentype"); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: "Liberation Mono"; src: url("/fonts/LiberationMono-Regular.woff2") format("woff2"), url("/fonts/LiberationMono-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Liberation Mono"; src: url("/fonts/LiberationMono-Bold.woff2") format("woff2"), url("/fonts/LiberationMono-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Liberation Mono"; src: url("/fonts/LiberationMono-Italic.woff2") format("woff2"), url("/fonts/LiberationMono-Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Liberation Mono"; src: url("/fonts/LiberationMono-BoldItalic.woff2") format("woff2"), url("/fonts/LiberationMono-BoldItalic.ttf") format("truetype"); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: "Source Code Pro"; src: url("/fonts/SourceCodePro-Regular.woff2") format("woff2"), url("/fonts/SourceCodePro-Regular.otf") format("opentype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Code Pro"; src: url("/fonts/SourceCodePro-Bold.woff2") format("woff2"), url("/fonts/SourceCodePro-Bold.otf") format("opentype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Code Pro"; src: url("/fonts/SourceCodePro-It.woff2") format("woff2"), url("/fonts/SourceCodePro-It.otf") format("opentype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Source Code Pro"; src: url("/fonts/SourceCodePro-BoldIt.woff2") format("woff2"), url("/fonts/SourceCodePro-BoldIt.otf") format("opentype"); font-weight: 700; font-style: italic; font-display: swap; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 0.9375rem/1.5 var(--font); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; outline: none; }
h1, h2, h3 { line-height: 1.2; margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; clip-path: inset(50%); overflow: hidden; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; white-space: nowrap; }
.asset-upload { position: relative; }
.asset-upload-btn { cursor: pointer; }
.asset-upload input:focus-visible + .asset-upload-btn { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 0.8125rem; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

/* ---- footer */
.foot { border-top: 1px solid var(--line); background: var(--surface); margin-top: 48px; padding: 20px 0; color: var(--muted); font-size: 0.8125rem; }
.foot .wrap { display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 0.75rem; }
.pill.ok { color: var(--ok); } .pill.off { color: var(--warn); }

/* ---- buttons / forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; text-decoration: none; color: var(--text); }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.big { padding: 14px 28px; font-size: 1.0625rem; border-radius: 12px; }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 5px 10px; font-size: 0.8125rem; border-radius: 7px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; }
label.field { display: block; margin-bottom: 14px; }
label.field > span, .field-label { display: block; font-weight: 600; font-size: 0.8125rem; margin-bottom: 5px; }
.hint { font-size: 0.75rem; color: var(--muted); margin-top: 4px; }
input[type="text"], input[type="number"], input[type="password"], input[type="url"], input[type="email"], select, textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); min-height: 38px; }
textarea { resize: vertical; min-height: 90px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8125rem; }
input[type="color"] { width: 100%; height: 38px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; }
.check { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 12px; cursor: pointer; }
.check input { margin-top: 3px; flex: none; }
.halves { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 6px; }
.tiles button { padding: 8px 6px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); font-weight: 550; font-size: 0.8125rem; }
.tiles button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cards { display: grid; gap: 8px; }
.cards button { text-align: left; padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); }
.cards button b { display: block; }
.cards button span.card-desc, .cards button > span:not(.cost-tag) { display: block; font-size: 0.78125rem; color: var(--muted); margin-top: 2px; }
.cards button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.cost-tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 0.71875rem; font-weight: 650; line-height: 1.4; letter-spacing: .01em; background: color-mix(in srgb, var(--warn) 14%, var(--surface-2)); border: 1px solid color-mix(in srgb, var(--warn) 42%, var(--line)); color: var(--warn); }
.cost-tag[hidden] { display: none; }
.cards button .cost-tag { margin-top: 7px; }
.cards button[aria-pressed="true"] .cost-tag { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 48%, var(--line)); color: var(--accent); }
.action-cost-tag { margin-bottom: 8px; padding: 5px 10px; border-radius: 8px; text-align: center; font-size: 0.78125rem; font-weight: 650; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 36%, var(--line)); color: var(--accent); }
.action-cost-tag[hidden] { display: none; }
.action-cost-tag.free { background: color-mix(in srgb, var(--ok) 12%, var(--surface-2)); border-color: color-mix(in srgb, var(--ok) 38%, var(--line)); color: var(--ok); }
.ask-ctx-cost { margin-left: auto; flex: none; }
.modal-cost-note { margin: 10px 0 0; padding: 8px 11px; border-radius: 8px; font-size: 0.84375rem; font-weight: 550; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 36%, var(--line)); color: var(--accent); }
.modal-cost-note.free { background: color-mix(in srgb, var(--ok) 12%, var(--surface-2)); border-color: color-mix(in srgb, var(--ok) 38%, var(--line)); color: var(--ok); }
.grid9 { display: grid; grid-template-columns: repeat(3, 36px); gap: 4px; }
.grid9 button { width: 36px; height: 36px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); padding: 0; position: relative; }
.grid9 button::after { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: var(--line-strong); }
.grid9 button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.grid9 button[aria-pressed="true"]::after { background: var(--accent); }

/* ---- home */
.hero { padding: 46px 0 22px; text-align: center; }
.hero h1 { font-size: clamp(1.75rem, 4.2vw, 2.625rem); letter-spacing: -.02em; }
.hero p { color: var(--muted); font-size: 1.0625rem; max-width: 660px; margin: 12px auto 0; text-wrap: pretty; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 22px 0 8px; }
.chip { padding: 7px 15px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; font-size: 0.875rem; }
.chip:hover { background: var(--surface-2); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.search { max-width: 420px; margin: 14px auto 0; position: relative; }
.search input { padding-left: 38px; border-radius: 999px; }
.search .icon { position: absolute; left: 12px; top: 9px; color: var(--muted); }
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 14px; margin-top: 22px; }
.tool { display: flex; flex-direction: column; gap: 8px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--text); position: relative; transition: transform .12s, box-shadow .12s, border-color .12s; }
.tool:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.tool-head { display: flex; align-items: center; gap: 11px; }
.tool:has(.off) .tool-head { padding-right: 78px; }
.tool h3 { font-size: 1rem; }
.tool p { color: var(--muted); font-size: 0.84375rem; text-wrap: pretty; }
.badge { width: 34px; height: 34px; flex: none; border-radius: 9px; display: grid; place-items: center; color: var(--cat); background: color-mix(in srgb, var(--cat) 13%, transparent); }
.badge .icon { width: 19px; height: 19px; }
.tool .off { position: absolute; top: 12px; right: 12px; }
.tool.new { border-style: dashed; align-items: flex-start; }
.tool.new .tool-head { align-items: center; align-self: stretch; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.note { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; }
.note .icon { color: var(--accent); margin-top: 1px; }
.note.warn .icon { color: var(--warn); }
/* Edit PDF: the list of changes, one step each, any of which can be taken back */
.how-to p + p { margin-top: 6px; }
.edit-changes { margin-top: 14px; }
.edit-changes h3 { display: flex; align-items: center; gap: 6px; font-size: 0.8125rem; margin: 0 0 6px; }
.edit-changes h3 .n:not(:empty) { background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; font-size: 0.71875rem; font-weight: 600; color: var(--muted); }
.edit-changes h3 .clear { margin-left: auto; border: 0; background: none; min-height: 24px; min-width: 24px; display: inline-flex; align-items: center; padding: 2px 6px; color: var(--muted); font-size: 0.75rem; font-weight: 550; cursor: pointer; }
.edit-changes h3 .clear:hover { color: var(--text); text-decoration: underline; }
.edit-steps { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.edit-steps li { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 10px; border-top: 1px solid var(--line); }
.edit-steps li:first-child { border-top: 0; }
.edit-steps li.none { color: var(--muted); font-size: 0.78125rem; padding: 9px 10px; }
.edit-steps .i { flex: none; min-width: 16px; color: var(--muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; text-align: right; }
.edit-steps .what { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; border: 0; background: none; padding: 0; text-align: left; color: var(--text); cursor: pointer; }
.edit-steps .what .t { max-width: 100%; font-size: 0.8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edit-steps .what .d { max-width: 100%; font-size: 0.71875rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edit-steps .what:hover .t { text-decoration: underline; }
.edit-steps .x { flex: none; width: 28px; height: 28px; display: inline-grid; place-items: center; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 1.0625rem; line-height: 1; cursor: pointer; }
.edit-steps .x:hover { background: var(--surface-2); color: var(--text); }
/* Edit PDF on a long document: its sections, and the cover shown while one is saved */
.sections { margin-bottom: 14px; }
.section-list { list-style: none; margin: 10px 0 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); max-height: 220px; overflow: auto; }
.section-list li { border-top: 1px solid var(--line); }
.section-list li:first-child { border-top: 0; }
.section-list button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; background: none; color: var(--text); font: inherit; font-size: 0.8125rem; text-align: left; cursor: pointer; }
.section-list button:hover:not(:disabled) { background: var(--surface-2); }
.section-list button:disabled { cursor: default; }
.section-list .r { flex: 1; min-width: 0; }
.section-list .s { flex: none; font-size: 0.71875rem; color: var(--muted); }
.section-list li.open button { font-weight: 600; background: var(--accent-soft); color: var(--accent); }
.section-list li.saved .s { color: var(--ok); }
.side footer .finish { margin-top: 8px; }
.saving { position: fixed; inset: 0; z-index: 55; display: grid; place-content: center; text-align: center; padding: 16px; background: color-mix(in srgb, var(--bg) 70%, transparent); }
.saving p { font-weight: 550; }
/* Fonts the visitor added in Edit PDF */
.added-fonts { margin-top: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.added-fonts h3 { font-size: 0.8125rem; margin: 0; padding: 10px 14px 4px; }
.added-fonts .af { display: flex; gap: 10px; align-items: center; padding: 8px 14px; border-top: 1px solid var(--line); }
.added-fonts .af .name { font-size: 0.9375rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.added-fonts .af .styles { font-size: 0.75rem; color: var(--muted); }
.added-fonts .hint { padding: 0 14px 12px; margin-top: 8px; }
.banner { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 10px; padding: 10px 14px; font-size: 0.84375rem; }
.banner.warn { background: color-mix(in srgb, var(--warn) 12%, transparent); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }

/* ---- tool page: landing */
.landing { text-align: center; padding: 54px 0 30px; }
.landing-head { display: inline-flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; }
.landing .badge { width: 48px; height: 48px; border-radius: 13px; margin: 0; }
.landing .badge .icon { width: 26px; height: 26px; }
.landing h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); letter-spacing: -.02em; }
.landing p.lead { color: var(--muted); font-size: 1.0625rem; max-width: 620px; margin: 10px auto 26px; text-wrap: pretty; }
.drop { border: 2px dashed var(--line-strong); border-radius: 18px; padding: 38px 20px; max-width: 620px; margin: 0 auto; background: var(--surface); transition: border-color .12s, background .12s; }
.drop.over, body.dragging .drop { border-color: var(--accent); background: var(--accent-soft); }
.drop .or { color: var(--muted); margin-top: 12px; font-size: 0.875rem; }
.privacy { margin-top: 18px; font-size: 0.8125rem; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }

/* ---- tool page: work area */
.work { display: grid; grid-template-columns: minmax(0, 1fr) 340px; min-height: calc(100vh - 58px); }
.work.full { grid-template-columns: minmax(0, 1fr); }
.stagewrap { padding: 20px; min-width: 0; position: relative; }
.side { background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 58px; height: calc(100vh - 58px); }
.side header { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.side header h2 { font-size: 1.1875rem; }
.side .body { padding: 16px 18px; overflow: auto; flex: 1; }
.side footer { padding: 14px 18px; border-top: 1px solid var(--line); }
.files { display: flex; flex-wrap: wrap; gap: 16px; align-content: flex-start; justify-content: center; }
.file { width: 172px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; position: relative; text-align: center; user-select: none; }
.file[draggable="true"] { touch-action: pan-y; }
.drag-grip { touch-action: none; cursor: grab; }
.drag-grip:active { cursor: grabbing; }
.file.dragging { opacity: .4; }
.file.drop-before { box-shadow: -4px 0 0 var(--accent); }
.file.drop-after { box-shadow: 4px 0 0 var(--accent); }
.file .thumb { height: 190px; display: grid; place-items: center; background: var(--surface-2); border-radius: 8px; overflow: hidden; position: relative; }
.file .thumb canvas, .file .thumb img { max-width: 100%; max-height: 100%; box-shadow: 0 1px 4px rgba(0, 0, 0, .18); transition: transform .15s; background: #fff; }
.file .name { font-size: 0.78125rem; margin-top: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .meta { font-size: 0.71875rem; color: var(--muted); }
.file .acts { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .12s; z-index: 3; }
.file:hover .acts, .file:focus-within .acts { opacity: 1; }
@media (hover: none), (pointer: coarse) { .file .acts { opacity: 1; } }
.file .acts button { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); display: grid; place-items: center; padding: 0; box-shadow: var(--shadow); }
.file .acts button:disabled { opacity: .4; cursor: default; }
.file .acts button .icon { width: 15px; height: 15px; }
.file .bar { position: absolute; left: 10px; right: 10px; bottom: 54px; height: 5px; background: var(--line); border-radius: 3px; overflow: hidden; }
.file .bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .15s; }
.file.err { border-color: var(--danger); }
.file .lock { position: absolute; inset: 10px 10px auto; height: 190px; z-index: 2; display: grid; place-items: center; background: color-mix(in srgb, var(--surface-2) 92%, transparent); border-radius: 8px; color: var(--muted); }
.file.sel { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
/* The live preview of Watermark, Page numbers and Rotate PDF, under the files */
.pview { margin: 28px auto 0; max-width: 1240px; }
.pv-head { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding-top: 16px; margin-bottom: 14px; }
.pv-head h2 { font-size: 1rem; flex: none; }
.pv-file { flex: 1; min-width: 0; color: var(--muted); font-size: 0.8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-zoom { display: inline-flex; gap: 4px; flex: none; }
.pv-zoom button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); padding: 0; font-size: 1.125rem; line-height: 1; }
.pv-zoom button:hover:not(:disabled) { background: var(--surface-2); }
.pv-zoom button:disabled { opacity: .4; cursor: default; }
.pv-hint { margin: -4px 0 14px; color: var(--warn); }
.pv-status { text-align: center; padding: 22px 0; }
.pv-grid { display: flex; flex-wrap: wrap; gap: 24px 18px; justify-content: center; align-items: flex-start; }
.pv-page { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pv-box { display: grid; place-items: center; }
.pv-sheet { position: relative; isolation: isolate; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2), 0 6px 18px rgba(0, 0, 0, .1); transition: transform .3s ease; }
.pv-sheet canvas { position: absolute; left: 0; top: 0; display: block; }
.pv-sheet .pv-pdf { z-index: 1; }
.pv-sheet .pv-ov { z-index: 2; width: 100%; height: 100%; pointer-events: none; }
.pv-sheet .pv-ov.below { z-index: 0; }
.pv-page figcaption { font-size: 0.75rem; color: var(--muted); line-height: 1.2; }
.pv-page figcaption b { color: var(--accent); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .pv-sheet { transition: none; } }
.addmore { position: absolute; right: 26px; top: 26px; z-index: 5; display: flex; flex-direction: column; gap: 8px; }
.fab { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: var(--shadow); position: relative; }
.fab .count { position: absolute; top: -5px; left: -5px; background: var(--text); color: var(--bg); border-radius: 999px; font-size: 0.6875rem; min-width: 19px; height: 19px; display: grid; place-items: center; padding: 0 4px; font-weight: 700; }
.fab.alt { background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); }
.merge-add-wrap { display: flex; justify-content: center; margin-top: 18px; }
.merge-add-btn { gap: 8px; padding: 11px 20px; min-height: 44px; max-width: 100%; border-radius: 10px; border: 1.5px dashed var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 0.9375rem; transition: background-color .14s, border-color .14s; }
.merge-add-btn:hover { background: color-mix(in srgb, var(--accent) 20%, var(--surface)); border-style: solid; }
.merge-add-btn .icon { width: 18px; height: 18px; }

/* ---- processing / result */
.center { max-width: 640px; margin: 0 auto; padding: 60px 20px; text-align: center; }
.spinner { width: 54px; height: 54px; border-radius: 50%; border: 5px solid var(--line); border-top-color: var(--accent); margin: 0 auto 20px; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } .tool { transition: none; } }
.progress { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; max-width: 360px; margin: 18px auto 0; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.result h1 { font-size: 1.875rem; margin-bottom: 8px; }
.stat { display: inline-flex; flex-wrap: wrap; justify-content: center; max-width: 100%; gap: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 18px; margin: 16px 0; }
.stat b { display: block; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.stat span { font-size: 0.75rem; color: var(--muted); }
.outlist { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin: 18px 0; max-height: 280px; overflow: auto; }
.outlist a { display: flex; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; align-items: center; }
.outlist a:last-child { border-bottom: 0; }
.outlist a:hover { background: var(--surface-2); }
/* A part of a split PDF: download it, or open it on its own in Edit PDF */
.outlist .part { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); }
.outlist .part:last-child { border-bottom: 0; }
.outlist .part > a { border-bottom: 0; }
.outlist .part > a:first-child { flex: 1; min-width: 0; }
.outlist .part .open-part { flex: none; gap: 6px; border-left: 1px solid var(--line); color: var(--accent); font-weight: 550; font-size: 0.8125rem; }
.outlist .sz { color: var(--muted); font-size: 0.78125rem; font-variant-numeric: tabular-nums; }
.next { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
.next a { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); text-decoration: none; font-size: 0.84375rem; font-weight: 550; }
.next a:hover { background: var(--surface-2); }
.next a .icon { width: 16px; height: 16px; color: var(--cat); }
.md { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 22px; margin: 18px 0; overflow-wrap: anywhere; }
.md h1 { font-size: 1.375rem; margin: 0 0 10px; } .md h2 { font-size: 1rem; margin: 16px 0 6px; } .md ul { margin: 6px 0; padding-left: 20px; } .md li { margin: 4px 0; } .md p { margin: 6px 0; }

/* ---- modal / toast */
.modal-back { position: fixed; inset: 0; background: rgba(10, 14, 22, .55); z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--surface); border-radius: 14px; padding: 22px; width: min(480px, 100%); box-shadow: var(--shadow); max-height: 90vh; overflow: auto; }
.modal.wide { width: min(760px, 100%); }
.modal h2 { font-size: 1.1875rem; margin-bottom: 8px; }
.modal .acts { display: flex; gap: 10px; justify-content: flex-end; margin: 18px -22px -22px; padding: 12px 22px 18px; position: sticky; bottom: -22px; background: var(--surface); border-top: 1px solid var(--line); border-radius: 0 0 14px 14px; z-index: 2; flex-wrap: wrap; }
#toasts { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); max-width: min(560px, 92vw); font-size: 0.875rem; }
.toast.err { background: var(--danger-fill); color: var(--danger-ink); }

/* ---- page stage (viewer with overlay) */
:root {
  --ai-fab-bg: linear-gradient(135deg, #2563eb 0%, #6d28d9 54%, #be185d 100%);
  --ai-fab-ink: #ffffff;
  --ai-fab-shadow: 0 4px 16px rgba(15, 18, 24, .45), 0 2px 6px rgba(109, 40, 217, .35);
  --ai-chat-shadow: 0 14px 40px rgba(0, 0, 0, .55), 0 2px 10px rgba(0, 0, 0, .35);
  --dock-shadow: 0 -6px 24px rgba(0, 0, 0, .42), 0 -1px 4px rgba(0, 0, 0, .28);
}
:root[data-theme="light"] {
  --ai-fab-bg: linear-gradient(135deg, #1d4ed8 0%, #7e22ce 54%, #be185d 100%);
  --ai-fab-ink: #ffffff;
  --ai-fab-shadow: 0 6px 20px rgba(31, 111, 235, .28), 0 2px 6px rgba(15, 18, 24, .18);
  --ai-chat-shadow: 0 12px 36px rgba(16, 24, 40, .18), 0 2px 8px rgba(16, 24, 40, .08);
  --dock-shadow: 0 -4px 20px rgba(16, 24, 40, .10), 0 -1px 4px rgba(16, 24, 40, .06);
}
.toolbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px; margin-bottom: 14px; position: sticky; top: 70px; z-index: 6; box-shadow: var(--shadow); }
.editor-toolbar { gap: 5px; }
.editor-toolbar .toolbar-primary > button.t,
.editor-toolbar .toolbar-more-tools > button.t,
.editor-toolbar button.t.shapes-btn { padding: 7px 8px; gap: 5px; }
.editor-toolbar .toolbar-primary, .editor-toolbar .toolbar-more, .editor-toolbar .toolbar-more-tools, .editor-toolbar .toolbar-controls, .editor-toolbar .ctrl-style-group, .editor-toolbar .ctrl-util-group { display: contents; }
.editor-toolbar .toolbar-handle, .editor-toolbar button.t.toolbar-more-btn, .toolbar-scrim, .status-scrim, .editor-side-close { display: none; }
.toolbar .sep { width: 1px; align-self: stretch; background: var(--line); margin: 2px 4px; }
.toolbar .row-break { flex-basis: 100%; height: 0; border-top: 1px solid var(--line); margin: 2px 0; }
.toolbar button.t { display: inline-flex; gap: 6px; align-items: center; padding: 7px 10px; border-radius: 8px; border: 1px solid transparent; background: none; font-weight: 550; font-size: 0.84375rem; }
.toolbar button.t:hover { background: var(--surface-2); }
.toolbar button.t.bold, .toolbar button.t.italic, .toolbar button.t.underline, .toolbar button.t.strike { min-width: 32px; justify-content: center; font-size: 0.9375rem; }
.toolbar button.t.underline span { text-decoration: underline; text-underline-offset: 2px; }
.toolbar button.t.strike span { text-decoration: line-through; }
.toolbar button.t.bold { font-weight: 800; }
.toolbar button.t.italic { font-family: Georgia, "Times New Roman", serif; font-style: italic; font-weight: 600; }
.toolbar button.t[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.toolbar label { display: inline-flex; gap: 5px; align-items: center; font-size: 0.78125rem; color: var(--muted); }
/* Controls share one height and line up along the top, so a control with a line under it (the font
   menu and its "Add your own font" button) leaves the rest of its row where it was. */
.toolbar > label, .toolbar > button.t,
.editor-toolbar .toolbar-primary > button.t,
.editor-toolbar .toolbar-more-tools > button.t,
.editor-toolbar .shapes-btn,
.editor-toolbar .toolbar-controls > label,
.editor-toolbar .toolbar-controls > button.t,
.editor-toolbar .ctrl-style-group > label,
.editor-toolbar .ctrl-style-group > button.t,
.editor-toolbar .ctrl-util-group > button.t { min-height: 2.125rem; }
.editor-toolbar .shapes-drop { position: relative; display: inline-flex; }
.editor-toolbar .shapes-btn .shapes-icon { display: inline-flex; align-items: center; }
.editor-toolbar .shapes-btn .shapes-chev { width: 14px; height: 14px; color: var(--muted); transition: transform .14s ease; }
.editor-toolbar .shapes-btn[aria-expanded="true"] { background: var(--surface-2); }
.editor-toolbar .shapes-btn[aria-expanded="true"] .shapes-chev { transform: rotate(180deg); color: var(--text); }
.editor-toolbar .shapes-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 156px;
  padding: 5px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.editor-toolbar .shapes-menu[hidden] { display: none; }
.editor-toolbar .shapes-menu.align-right { left: auto; right: 0; }
.editor-toolbar .shapes-menu > button.t { width: 100%; justify-content: flex-start; padding: 7px 10px; min-height: 34px; border-radius: 7px; }
.toolbar .font-field { display: inline-grid; grid-template-columns: auto auto auto; grid-template-rows: 2.125rem auto; column-gap: 5px; align-items: center; font-size: 0.78125rem; }
.toolbar .font-field .add-font { grid-column: 2 / 4; justify-self: start; display: inline-flex; gap: 4px; align-items: center; min-height: 24px; margin: 1px 0 0; padding: 2px 2px; border: 0; background: none; color: var(--accent); font-size: 0.75rem; font-weight: 550; cursor: pointer; }
.toolbar .font-field .add-font:hover { text-decoration: underline; }
.toolbar .font-field .add-font .icon { width: 13px; height: 13px; }
.toolbar input[type="number"], .toolbar select { width: auto; min-height: 32px; padding: 4px 6px; }
.toolbar input[type="color"] { width: 34px; height: 32px; }
.toolbar .zoom-ctrl { display: inline-flex; align-items: center; gap: 1px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-2); padding: 1px; min-height: 2.125rem; }
.toolbar .zoom-ctrl button.t { min-height: 28px; padding: 4px 7px; border: 0; border-radius: 6px; font-variant-numeric: tabular-nums; }
.toolbar .zoom-ctrl button.t.zoom-btn { min-width: 28px; justify-content: center; font-size: 1rem; font-weight: 650; line-height: 1; }
.toolbar .zoom-ctrl button.t.zoom-val { min-width: 46px; justify-content: center; font-size: 0.78125rem; color: var(--muted); }
.toolbar .zoom-ctrl button.t.zoom-val.is-zoomed { color: var(--accent); font-weight: 650; }
.toolbar .zoom-ctrl button.t:disabled { opacity: .38; cursor: default; background: none; }
.pages { display: flex; flex-direction: column; align-items: center; gap: 18px; padding-top: 20px; }
.pages.zoomable { align-items: flex-start; overflow-x: auto; padding: 22px 4px 16px; max-width: 100%; box-sizing: border-box; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.pages.zoomable .pg { margin-inline: auto; flex: none; }
.pages.zoomable.zoomed .pg { max-width: none; }
.pg { position: relative; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2), 0 6px 18px rgba(0, 0, 0, .1); line-height: 0; max-width: 100%; }
.pg canvas { display: block; }
.pg .ov { position: absolute; inset: 0; overflow: hidden; touch-action: pan-x pan-y; }
.pg .ov.draw-surface { touch-action: none; }
.pg .num { position: absolute; left: 0; top: -19px; font-size: 0.71875rem; color: var(--muted); line-height: 1; }
.pg.active { outline: 2px solid var(--accent); outline-offset: 3px; }
.el, .el .h, .xt-grip, .xi.sel, .xi .h, .cropbox, .cropbox i { touch-action: none; }
.el { position: absolute; line-height: 1.2; cursor: move; box-sizing: border-box; }
.el.sel { outline: 1.5px dashed var(--accent); outline-offset: 2px; }
.el .h { position: absolute; width: 24px; height: 24px; right: -12px; bottom: -12px; background: var(--accent); border: 5px solid #fff; box-shadow: 0 0 0 1.5px var(--accent); border-radius: 50%; cursor: nwse-resize; display: none; }
.el.sel .h { display: block; }
.el .x { position: absolute; right: -12px; top: -12px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--danger-fill); color: var(--danger-ink); font-size: 0.875rem; line-height: 24px; padding: 0; display: none; z-index: 1; }
.el.sel .x { display: block; }
.el .c { position: absolute; left: -12px; top: -12px; width: 24px; height: 24px; border-radius: 6px; border: 2.5px solid #fff; box-shadow: 0 0 0 1.5px var(--accent), 0 1px 4px rgba(0, 0, 0, .35); cursor: pointer; display: none; z-index: 2; touch-action: manipulation; }
.el.sel .c { display: block; }
.el .c input[type="color"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; padding: 0; border: 0; margin: 0; border-radius: inherit; cursor: pointer; min-height: 0; }
.el[contenteditable="true"] { cursor: text; outline: 1.5px solid var(--accent); }
.el.text { white-space: pre-wrap; word-break: break-word; min-width: 20px; min-height: 1.2em; color: #000; }
.el img { width: 100%; height: 100%; display: block; pointer-events: none; }
.mark { position: absolute; background: rgba(0, 0, 0, .82); cursor: pointer; }
.mark.pending { background: rgba(209, 36, 47, .28); outline: 1.5px solid var(--danger); }
.mark:hover { outline: 2px solid var(--accent); }
.blur-mark { position: absolute; background: rgba(255, 255, 255, .12); outline: 1.5px dashed color-mix(in srgb, var(--accent) 70%, transparent); border-radius: 2px; cursor: move; }
.blur-mark:hover { outline-color: var(--accent); }
.blur-mark.sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.el.stamp { overflow: visible; }
.el.stamp img { width: 100%; height: 100%; object-fit: contain; transform-origin: center center; pointer-events: none; }
.stamp-side-preview { display: grid; place-items: center; padding: 12px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 12px; background: repeating-conic-gradient(var(--surface-2) 0% 25%, var(--surface) 0% 50%) 50% / 16px 16px; min-height: 138px; overflow: hidden; }
.stamp-side-preview img { max-width: 128px; max-height: 128px; width: auto; height: auto; display: block; transition: transform .12s ease, opacity .12s ease; }
.stamp-preset-row { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 14px; }
.stamp-preset-row button { padding: 3px 9px; font-size: 0.71875rem; }
.stamp-preview-box { display: grid; place-items: center; min-height: 212px; padding: 16px; margin-bottom: 14px; border-radius: 12px; border: 1px solid var(--line); background: repeating-conic-gradient(var(--surface-2) 0% 25%, var(--surface) 0% 50%) 50% / 18px 18px; overflow: hidden; }
.stamp-preview-box img { max-width: 188px; max-height: 188px; width: auto; height: auto; display: block; transition: transform .12s ease, opacity .12s ease; user-select: none; }
.stamp-designer.compact .stamp-preview-box { min-height: 164px; }
.stamp-designer.compact .stamp-preview-box img { max-width: 148px; max-height: 148px; }
.stamp-designer .stamp-preset-row { margin-bottom: 12px; gap: 6px; }
.stamp-designer .stamp-preset-row .chip { padding: 4px 10px; font-size: 0.75rem; }
.stamp-swatches { gap: 8px; }
.stamp-swatch { width: 32px; height: 32px; border-radius: 50%; background: var(--swatch); padding: 0; border: 2px solid var(--line-strong); box-shadow: 0 0 0 1px rgba(255, 255, 255, .22) inset; }
.stamp-swatch[aria-pressed="true"] { border: 3px solid var(--accent); box-shadow: 0 0 0 2px var(--surface) inset; }
.stamp-designer input.stamp-color-picker { width: 36px; height: 32px; padding: 1px; border-radius: 7px; cursor: pointer; flex: none; }
.stamp-designer .field { margin-bottom: 12px; }
.stamp-designer .halves .field { margin-bottom: 14px; }
.stamp-placement { margin-top: 4px; }
.stamp-designer .stamp-placement .field { margin-bottom: 12px; }
.stamp-modal-title, .modal .stamp-modal-title { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
@media (prefers-reduced-motion: reduce) { .stamp-preview-box img, .stamp-side-preview img { transition: none; } }
.toolbar .blur-ctrl { display: inline-flex; align-items: center; gap: 5px; font-size: 0.78125rem; color: var(--muted); }
.toolbar .blur-ctrl button.t { padding: 4px 8px; min-height: 28px; font-size: 0.75rem; }
.hl { position: absolute; pointer-events: none; mix-blend-mode: multiply; }
.hl.rem { background: rgba(230, 60, 60, .38); } .hl.add { background: rgba(40, 180, 100, .38); }
.fieldbox { position: absolute; border: 1.5px solid var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 3px; font-size: 0.6875rem; line-height: 1.2; color: var(--field-ink); display: grid; place-items: center; cursor: pointer; overflow: hidden; }
.fieldbox.done { background: transparent; border-style: dashed; }
.fieldbox.other { border-color: #8a94a6; background: rgba(138, 148, 166, .15); cursor: default; }
.fieldbox img { max-width: 100%; max-height: 100%; }
.fin { position: absolute; margin: 0; border: 1px solid #5b7fc7; background: rgba(220, 232, 255, .75); color: #000; font-size: 0.75rem; padding: 1px 3px; border-radius: 2px; min-height: 0; line-height: 1.2; }
select.fin { padding: 0 2px; }
.cropbox { position: absolute; border: 2px solid var(--accent); box-shadow: 0 0 0 9999px rgba(10, 14, 22, .5); cursor: move; }
.cropbox i { position: absolute; width: 24px; height: 24px; background: #fff; border: 3px solid var(--accent); border-radius: 50%; }
.cropbox i.nw { left: -12px; top: -12px; cursor: nwse-resize; } .cropbox i.ne { right: -12px; top: -12px; cursor: nesw-resize; }
.cropbox i.sw { left: -12px; bottom: -12px; cursor: nesw-resize; } .cropbox i.se { right: -12px; bottom: -12px; cursor: nwse-resize; }

/* ---- editing what is already in the PDF */
.xt, .xi { position: absolute; pointer-events: none; box-sizing: border-box; }
.pick .xt { pointer-events: auto; cursor: text; border-radius: 2px; }
.pick .xt:hover { outline: 1px dashed var(--accent); outline-offset: 1px; background: color-mix(in srgb, var(--accent) 7%, transparent); }
.xt.changed { outline: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 1px; }
.xt.gone { outline: 1px dashed var(--danger); min-width: 14px; }
.pick .xt.ocr { outline: 1px dashed color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 1px; }
.pick .xt.ocr.unsure { outline-color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.xt.editing { pointer-events: none; outline: 1.5px solid var(--accent); outline-offset: 1px; background: none; }
.xt-grip { position: absolute; left: -26px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; line-height: 24px; font-size: 0.8125rem; text-align: center; color: #fff; background: var(--accent); border-radius: 4px; cursor: grab; display: none; pointer-events: auto; user-select: none; }
.pick .xt:hover .xt-grip, .xt.editing .xt-grip, .xt.changed:hover .xt-grip { display: block; }
.xt-cover { position: absolute; pointer-events: none; }
.xt-label { position: absolute; white-space: pre; pointer-events: none; outline: none; min-width: 6px; font-kerning: none; }
.xt-label[contenteditable]:not([contenteditable="false"]) { pointer-events: auto; cursor: text; }
.pick .xi { pointer-events: auto; cursor: move; }
.pick .xi:hover { outline: 1px dashed var(--accent); outline-offset: 1px; }
.pick .xi.ocr { outline: 1.5px dashed color-mix(in srgb, var(--info-accent) 60%, transparent); outline-offset: 1px; }
.pick .xi.ocr:hover { outline: 1.5px dashed var(--info-accent); background: color-mix(in srgb, var(--info-accent) 7%, transparent); }
.xi.sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.xi.ocr.sel { outline: 2px solid var(--info-accent); outline-offset: 1px; }
.xi.gone { outline: 1.5px dashed var(--danger); background: repeating-linear-gradient(45deg, transparent 0 8px, color-mix(in srgb, var(--danger) 14%, transparent) 8px 16px); }
.xi canvas, .xi img { width: 100%; height: 100%; display: block; pointer-events: none; }
.xi img { object-fit: contain; }
.xi .h { position: absolute; width: 24px; height: 24px; right: -12px; bottom: -12px; background: var(--accent); border: 5px solid #fff; box-shadow: 0 0 0 1.5px var(--accent); border-radius: 50%; cursor: nwse-resize; }
.xi-bar { position: absolute; left: 0; top: -36px; display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 3px; box-shadow: var(--shadow); white-space: nowrap; z-index: 5; line-height: 1.2; } /* under the .toolbar */
.xi-bar button { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; padding: 4px 8px; border-radius: 6px; font-size: 0.78125rem; font-weight: 600; color: var(--text); }
.xi-bar button:hover { background: var(--surface-2); }
.xi-bar button:disabled { opacity: .6; cursor: progress; }
.ai-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.ai-compare figure { margin: 0; text-align: center; }
.ai-compare canvas, .ai-compare img { max-width: 100%; max-height: 52vh; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.ai-compare figcaption { font-size: 0.78125rem; color: var(--muted); margin-top: 6px; }
.xi-bar .icon { width: 15px; height: 15px; }

/* ---- organize grid */
.ogrid { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.opage { width: 150px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: center; position: relative; user-select: none; cursor: grab; touch-action: pan-y; }
.opage .order { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .12s; z-index: 3; }
.opage:hover .order, .opage:focus-within .order { opacity: 1; }
@media (hover: none), (pointer: coarse) { .opage .order { opacity: 1; } }
.opage .order button { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); display: grid; place-items: center; padding: 0; box-shadow: var(--shadow); }
.opage .order button:disabled { opacity: .4; cursor: default; }
.opage .order button .icon { width: 14px; height: 14px; }
.opage .thumb { height: 170px; display: grid; place-items: center; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.opage canvas { max-width: 100%; max-height: 100%; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .15s; background: #fff; }
.opage .blank { width: 100px; height: 141px; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); display: grid; place-items: center; color: #9aa4b5; font-size: 0.75rem; }
.opage .lbl { font-size: 0.75rem; margin-top: 6px; color: var(--muted); }
.opage .acts { display: flex; justify-content: center; gap: 4px; margin-top: 4px; }
.opage .acts button { border: 0; background: none; min-width: 28px; min-height: 28px; padding: 6px; border-radius: 6px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.opage .acts button:hover { background: var(--surface-2); color: var(--text); }
.opage .acts .icon { width: 16px; height: 16px; }
.opage.dragging { opacity: .35; } .opage.drop-before { box-shadow: -4px 0 0 var(--accent); } .opage.drop-after { box-shadow: 4px 0 0 var(--accent); }
.opage .tag { position: absolute; top: 4px; left: 4px; width: 16px; height: 16px; border-radius: 50%; }

/* ---- compare */
.cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cmp .col { min-width: 0; overflow: auto; max-height: calc(100vh - 170px); background: var(--surface-2); border-radius: 10px; padding: 14px; }
.cmp .col h3 { font-size: 0.8125rem; margin-bottom: 10px; position: sticky; top: -14px; background: var(--surface-2); padding: 6px 0; z-index: 2; }
.cmp .col .pages { padding-top: 14px; }
.cmp.overlay { grid-template-columns: 1fr; }
.changes { list-style: none; margin: 0; padding: 0; }
.changes li { margin-bottom: 8px; padding: 0; border: 0; }
.changes li:not(:has(> button)) { padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 0.8125rem; }
.changes li > button { display: block; width: 100%; text-align: left; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font: inherit; font-size: 0.8125rem; color: inherit; cursor: pointer; }
.changes li > button:hover { border-color: var(--accent); background: var(--surface-2); }
.changes .old { color: var(--danger); text-decoration: line-through; } .changes .new { color: var(--ok); }
.changes .pg-no { font-size: 0.6875rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* ---- chat / summary */
.chat { display: flex; flex-direction: column; gap: 10px; }
.msg { padding: 10px 13px; border-radius: 12px; max-width: 92%; font-size: 0.875rem; }
.msg.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); }
.msg.bot { background: var(--surface-2); }
.msg blockquote { margin: 8px 0 0; padding: 8px 11px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 8px; font-size: 0.8125rem; }
.msg blockquote cite { display: block; font-size: 0.6875rem; color: var(--muted); font-style: normal; margin-top: 3px; }

/* ---- signature pad */
.pad { border: 1.5px dashed var(--line-strong); border-radius: 10px; background: #fff; width: 100%; height: 170px; touch-action: none; display: block; }
.sign-quick-preview { margin: 12px 0; min-height: 84px; display: grid; place-items: center; padding: 12px; border: 1px dashed var(--line-strong); border-radius: 10px; background: #ffffff; }
.sign-quick-preview img { max-height: 76px; max-width: 100%; display: block; }
.sign-quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.sign-quick-actions .btn.primary { grid-column: 1 / -1; }
.sigfonts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sigfonts button { border: 1px solid var(--line-strong); background: #fff; color: #102a83; border-radius: 10px; padding: 12px 8px; font-size: 1.625rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sigfonts button[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; scrollbar-width: thin; }
.tabs button { flex: none; border: 0; background: none; padding: 8px 12px; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--muted); }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.signer { display: flex; gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 8px; }
.signer .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.signer.active { border-color: var(--accent); background: var(--accent-soft); }
.linkrow { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.linkrow input { font-size: 0.78125rem; }

/* ---- workflows */
.wf { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.wf h3 { font-size: 1.0625rem; overflow-wrap: anywhere; }
.steps { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0; }
.step { display: inline-flex; gap: 6px; align-items: center; padding: 5px 10px; border-radius: 8px; background: var(--surface-2); font-size: 0.8125rem; font-weight: 550; }
.step .icon { width: 15px; height: 15px; color: var(--cat); }
.arrow { color: var(--muted); }
.stepcard { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: var(--surface); }
.stepcard > header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 650; }

@media (max-width: 1240px) { .toolbar .sep { display: none; } }

@media (max-width: 860px) {
  .work { display: flex; flex-direction: column; }
  .work > .stagewrap { flex: 1 0 auto; width: 100%; box-sizing: border-box; }
  .work > .side { width: 100%; }
  .stagewrap { padding: 12px; }
  .addmore { position: static; flex-direction: row; justify-content: flex-end; margin-bottom: 10px; }
  .side { position: static; height: auto; border-left: 0; border-top: 1px solid var(--line); }
  .side footer { position: sticky; bottom: 0; background: var(--surface); }
  .cmp { grid-template-columns: 1fr; }
  .toolbar { top: 58px; gap: 4px; padding: 5px; }
  .toolbar .sep, .toolbar .row-break { display: none; }
  .toolbar > label, .toolbar > button.t { min-height: 32px; line-height: 1; }
  .toolbar button.t { padding: 6px 8px; min-height: 32px; line-height: 1; }
  .toolbar .zoom-ctrl { min-height: 32px; }
  .toolbar .zoom-ctrl button.t { min-height: 28px; padding: 4px 7px; }
  .toolbar .font-field { grid-template-columns: auto auto; grid-template-rows: 32px auto; column-gap: 4px; }
  .toolbar .font-field > label { display: none; }
  .toolbar .font-field .add-font { grid-column: 1 / -1; }
  .toolbar select { max-width: min(136px, 42vw); text-overflow: ellipsis; }

  /* Edit PDF mobile bottom dock (Adobe Acrobat-style) & top Status dropdown */
  .work.is-editor { padding-bottom: calc(var(--editor-dock-h, 80px) + env(safe-area-inset-bottom, 0px)); }
  .work.is-editor .stagewrap { padding: 8px 10px 16px; }
  .work.is-editor .pages.zoomable { padding: 18px 2px 12px; }
  .work.is-editor .side { display: none; }
  .work.is-editor.with-status .side {
    display: flex;
    position: fixed;
    top: 58px;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 33dvh;
    height: auto;
    z-index: 22;
    border-left: 0;
    border-top: 0;
    border-bottom: 1px solid var(--line-strong);
    box-shadow: var(--shadow);
  }
  .work.is-editor.with-status .side header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 12px; flex: none; }
  .work.is-editor.with-status .side header h2 { font-size: 0.9375rem; }
  .work.is-editor.with-status .side .editor-side-close { display: inline-flex; padding: 4px; }
  .work.is-editor.with-status .side .editor-side-close .icon { width: 17px; height: 17px; }
  .work.is-editor.with-status .side .body { padding: 8px 12px; min-height: 0; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
  .work.is-editor.with-status .side .body > * { order: 4; }
  .work.is-editor.with-status .side .body > .sections { order: 0; margin-bottom: 4px; }
  .work.is-editor.with-status .side .body > .edit-credits { order: 1; margin-bottom: 4px; }
  .work.is-editor.with-status .side .body > .edit-changes { order: 2; margin-top: 0; }
  .work.is-editor.with-status .side .body > .added-fonts { order: 3; margin-top: 4px; }
  .work.is-editor.with-status .side .body > .how-to { order: 6; }
  .work.is-editor.with-status .side footer { padding: 8px 12px; flex: none; position: static; }
  .work.is-editor.with-status .side footer .btn.big { padding: 9px 16px; font-size: 0.9375rem; }
  .status-scrim { display: block; position: fixed; inset: 58px 0 0 0; z-index: 21; background: rgba(10, 14, 22, .24); }
  .toolbar-scrim { display: block; position: fixed; inset: 0; z-index: 23; background: rgba(10, 14, 22, .38); }
  .editor-toolbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 25;
    margin: 0;
    padding: 0 6px calc(6px + env(safe-area-inset-bottom, 0px));
    border: 0;
    border-top: 1px solid var(--line-strong);
    border-radius: 16px 16px 0 0;
    background: var(--surface);
    box-shadow: var(--dock-shadow);
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0;
    max-width: 100vw;
  }
  .editor-toolbar .toolbar-handle {
    order: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 18px;
    padding: 0;
    border: 0;
    background: none;
    flex: none;
  }
  .editor-toolbar .toolbar-handle-bar {
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: var(--line-strong);
    transition: background-color .14s ease, width .14s ease;
  }
  .editor-toolbar.expanded .toolbar-handle-bar { background: var(--accent); width: 44px; }
  .editor-toolbar .toolbar-primary {
    order: 3;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 2px;
    padding: 2px 0 0;
  }
  .editor-toolbar .toolbar-primary > button.t {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 3px;
    min-width: 0;
    min-height: 52px;
    padding: 6px 2px;
    border-radius: 10px;
    font-size: 0.6875rem;
    font-weight: 550;
    line-height: 1.15;
    color: var(--text);
    position: relative;
  }
  .editor-toolbar .toolbar-primary > button.t .icon { width: 20px; height: 20px; }
  .editor-toolbar .toolbar-primary > button.t .tool-lbl {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
  }
  .editor-toolbar button.t.toolbar-more-btn { display: inline-flex; }
  .editor-toolbar .toolbar-more-btn[aria-expanded="true"] {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  }
  .editor-toolbar .toolbar-more-btn.has-active-tool::after {
    content: "";
    position: absolute;
    top: 6px;
    right: calc(50% - 14px);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
  }
  .editor-toolbar .toolbar-more {
    order: 2;
    display: none;
    flex-direction: column;
    gap: 10px;
    padding: 6px 6px 12px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--line);
    max-height: min(62dvh, 460px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .editor-toolbar.expanded .toolbar-more {
    display: flex;
    animation: editor-tray-in .18s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .editor-toolbar .toolbar-more-tools {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }
  .editor-toolbar .shapes-drop,
  .editor-toolbar .shapes-menu { display: contents; }
  .editor-toolbar .shapes-menu[hidden] { display: contents !important; }
  .editor-toolbar button.t.shapes-btn { display: none; }
  .editor-toolbar .toolbar-more-tools button.t:not(.shapes-btn) {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    min-width: 0;
    min-height: 54px;
    padding: 7px 4px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    font-size: 0.71875rem;
    font-weight: 550;
    line-height: 1.15;
    width: auto;
  }
  .editor-toolbar .toolbar-more-tools button.t:not(.shapes-btn)[aria-pressed="true"] {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  }
  .editor-toolbar .toolbar-more-tools button.t:not(.shapes-btn) .icon { width: 19px; height: 19px; }
  .editor-toolbar .toolbar-more-tools button.t:not(.shapes-btn) .tool-lbl {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .editor-toolbar .toolbar-more > .row-break { display: block; flex-basis: auto; width: 100%; margin: 0; }
  .editor-toolbar .toolbar-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    align-items: center;
  }
  .editor-toolbar .toolbar-controls > .sep { display: none; }
  .editor-toolbar .toolbar-controls > .ctrl-ocr {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    min-width: 0;
  }
  .editor-toolbar .toolbar-controls > .ctrl-ocr select { width: 100%; max-width: 100%; min-width: 0; }
  .editor-toolbar .toolbar-controls > .font-field {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 64px;
    grid-template-rows: 34px auto;
    gap: 4px 6px;
  }
  .editor-toolbar .toolbar-controls > .font-field > label { display: none; }
  .editor-toolbar .toolbar-controls > .font-field select { width: 100%; max-width: 100%; min-width: 0; }
  .editor-toolbar .toolbar-controls > .font-field input[type="number"] { width: 100% !important; min-width: 0; }
  .editor-toolbar .toolbar-controls > .font-field .add-font { grid-column: 1 / -1; }
  .editor-toolbar .toolbar-controls > .ctrl-style-group {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
  }
  .editor-toolbar .toolbar-controls > .ctrl-style-group > button.t {
    min-width: 34px;
    min-height: 34px;
    padding: 4px 6px;
    border: 1px solid var(--line);
    background: var(--surface-2);
  }
  .editor-toolbar .toolbar-controls > .ctrl-style-group > button.t[aria-pressed="true"] {
    background: var(--accent-soft);
    border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  }
  .editor-toolbar .toolbar-controls > .ctrl-style-group > label { min-height: 34px; }
  .editor-toolbar .toolbar-controls > .blur-ctrl,
  .editor-toolbar .toolbar-controls > button.t:not(.undo-btn) {
    grid-column: 1 / -1;
    flex-wrap: wrap;
  }
  .editor-toolbar .toolbar-controls > .ctrl-util-group {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  .editor-toolbar .toolbar-controls > .ctrl-util-group > .sep { display: none; }
  .editor-toolbar .toolbar-controls .undo-btn {
    border: 1px solid var(--line-strong);
    background: var(--surface-2);
    min-height: 34px;
    padding: 6px 12px;
  }
}

@keyframes editor-tray-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 360px) {
  .editor-toolbar { padding-inline: 3px; }
  .editor-toolbar .toolbar-primary > button.t { font-size: 0.625rem; padding: 5px 1px; min-height: 48px; }
  .editor-toolbar .toolbar-primary > button.t .icon { width: 18px; height: 18px; }
  .editor-toolbar .toolbar-more-tools { gap: 4px; }
  .editor-toolbar .toolbar-more-tools button.t:not(.shapes-btn) { font-size: 0.65625rem; padding: 6px 2px; min-height: 50px; }
}

@media (pointer: coarse) {
  .xt.changed .xt-grip, .xt.editing .xt-grip { display: block; }
  .el .h::after, .el .x::after, .el .c::after, .xi .h::after, .cropbox i::after, .xt-grip::after, .iconbtn::after { content: ""; position: absolute; inset: -10px; }
}

/* ---- Ask AI Command Center (Edit PDF) & mobile floating actions */
.editor-fabs { display: contents; }
.editor-fab { display: none; }
.ask-ai-fab {
  position: fixed;
  right: calc(340px + 20px);
  bottom: 20px;
  z-index: 24;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--ai-fab-ink) 20%, transparent);
  background: var(--ai-fab-bg);
  color: var(--ai-fab-ink);
  display: inline-grid;
  place-items: center;
  padding: 0;
  box-shadow: var(--ai-fab-shadow);
  cursor: pointer;
  transition: transform .16s cubic-bezier(0.16, 1, 0.3, 1), box-shadow .16s ease, filter .16s ease, opacity .16s ease;
}
.ask-ai-fab .icon { width: 26px; height: 26px; stroke-width: 1.9; }
.ask-ai-fab:hover { transform: translateY(-2px); filter: brightness(1.06); }
.ask-ai-fab:active { transform: translateY(0) scale(0.96); }
.ask-ai-fab[aria-expanded="true"] { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent), var(--ai-fab-shadow); }
@media (hover: hover) and (min-width: 861px) {
  .ask-ai-fab::before {
    content: attr(data-label);
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(4px);
    padding: 5px 10px;
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow);
    font-size: 0.78125rem;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity .14s ease, transform .14s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .ask-ai-fab:hover::before, .ask-ai-fab:focus-visible::before { opacity: 1; transform: translateY(-50%) translateX(0); }
}

.ask-ai { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; color: var(--text); }
.ask-ai-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex: none; }
.ask-ai-title-wrap { display: flex; align-items: center; gap: 7px; flex: none; }
.ask-ai-title-wrap .icon { width: 18px; height: 18px; color: var(--accent); flex: none; }
.ask-ai-head h2 { font-size: 1.0625rem; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; }
.ask-ai-head-acts { display: flex; align-items: center; gap: 5px; flex: 1; min-width: 0; justify-content: flex-end; }
.ask-ai-head .pill { display: block; min-width: 0; max-width: 148px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-ai-model { width: auto; min-width: 0; max-width: 136px; min-height: 28px; padding: 3px 6px; font-size: 0.75rem; border-radius: 7px; text-overflow: ellipsis; }
.ask-ai-clear { min-height: 28px; padding: 3px 8px; font-size: 0.75rem; color: var(--muted); }
.ask-ai-clear:hover { color: var(--text); }
.ask-ai-close { flex: none; padding: 5px; }
.ask-ai-close .icon { width: 18px; height: 18px; }

.ask-ai-ctx { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.ask-ctx-summary { min-width: 0; }
.ask-ctx-sel { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); color: var(--accent); font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ask-ai-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.ask-setup { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); font-size: 0.84375rem; line-height: 1.5; }
.ask-setup h3 { font-size: 0.9375rem; font-weight: 650; }
.ask-setup code, .ask-answer .md code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.78125rem; padding: 1px 5px; border-radius: 5px; background: var(--surface); border: 1px solid var(--line); }

.ask-empty { display: flex; flex-direction: column; gap: 12px; padding: 2px 0; }
.ask-empty > p { font-size: 0.84375rem; color: var(--muted); line-height: 1.5; text-wrap: pretty; }
.ask-prompts { display: flex; flex-direction: column; gap: 7px; }
.ask-prompt-btn { display: flex; align-items: flex-start; gap: 8px; width: 100%; text-align: left; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--text); font-size: 0.8125rem; line-height: 1.35; transition: background-color 150ms ease, border-color 150ms ease; }
.ask-prompt-btn:hover { background: var(--surface-2); border-color: var(--accent); }
.ask-prompt-btn .icon { width: 15px; height: 15px; color: var(--accent); margin-top: 2px; flex: none; }

.ask-thread { display: flex; flex-direction: column; gap: 12px; }
.ask-turn { display: flex; flex-direction: column; gap: 8px; }
.ask-msg { font-size: 0.84375rem; line-height: 1.5; min-width: 0; word-break: break-word; overflow-wrap: anywhere; }
.ask-msg.me { align-self: flex-end; max-width: 88%; padding: 8px 12px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); white-space: pre-wrap; }
.ask-msg.bot { align-self: stretch; padding: 11px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 9px; }

.ask-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.ask-steps li { display: flex; align-items: flex-start; gap: 7px; font-size: 0.78125rem; color: var(--muted); line-height: 1.35; }
.ask-steps li .icon { width: 14px; height: 14px; color: var(--ok); margin-top: 2px; flex: none; }
.ask-steps li.running { color: var(--text); font-weight: 550; }
.ask-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin: 5px 3px 0; flex: none; }

.ask-shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.ask-shot-btn { display: flex; flex-direction: column; gap: 4px; padding: 5px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); text-align: left; overflow: hidden; transition: border-color 150ms ease; }
.ask-shot-btn:hover { border-color: var(--accent); }
.ask-shot-btn img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #fff; border-radius: 5px; display: block; }
.ask-shot-cap { font-size: 0.71875rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ask-guardrail-flag { display: flex; align-items: flex-start; gap: 7px; padding: 8px 10px; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--text); font-size: 0.78125rem; line-height: 1.4; }
.ask-guardrail-flag .icon { width: 15px; height: 15px; margin-top: 2px; flex: none; color: var(--warn); }

.ask-answer .md { background: none; border: 0; border-radius: 0; padding: 0; margin: 0; font-size: 0.84375rem; }
.ask-answer .md h1, .ask-answer .md h2, .ask-answer .md h3 { font-size: 0.875rem; margin: 8px 0 4px; }
.ask-answer .md p:first-child, .ask-answer .md ul:first-child { margin-top: 0; }
.ask-answer .md p:last-child, .ask-answer .md ul:last-child { margin-bottom: 0; }

.ask-err { display: flex; align-items: flex-start; gap: 7px; padding: 8px 10px; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent); background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); font-size: 0.8125rem; line-height: 1.4; }
.ask-err .icon { width: 15px; height: 15px; margin-top: 2px; flex: none; }

.ask-actions { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; }
.ask-actions li { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 9px; border-top: 1px solid var(--line); }
.ask-actions li:first-child { border-top: 0; }
.ask-actions li.undone .ask-act-title { text-decoration: line-through; color: var(--muted); }
.ask-act-jump { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; border: 0; background: none; padding: 2px 0; text-align: left; color: var(--text); }
.ask-act-jump:disabled { cursor: default; opacity: .7; }
.ask-act-jump:not(:disabled):hover .ask-act-title { color: var(--accent); text-decoration: underline; }
.ask-act-title { max-width: 100%; font-size: 0.78125rem; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-act-meta { max-width: 100%; font-size: 0.71875rem; color: var(--muted); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-act-undo { flex: none; min-height: 28px; padding: 3px 8px; font-size: 0.75rem; gap: 4px; }
.ask-act-undo .icon { width: 13px; height: 13px; }

.ask-meta { font-size: 0.71875rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.ask-ai-foot { padding: 10px 14px 12px; border-top: 1px solid var(--line); background: var(--surface); flex: none; }
.ask-cooldown { display: flex; align-items: flex-start; gap: 8px; padding: 9px 11px; margin-bottom: 8px; border-radius: 9px; border: 1px solid color-mix(in srgb, var(--warn) 48%, transparent); background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--text); font-size: 0.8125rem; line-height: 1.4; }
.ask-cooldown .icon { width: 16px; height: 16px; margin-top: 2px; flex: none; color: var(--warn); }
.ask-cooldown-time { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--warn); }
.ask-ai-form { display: flex; flex-direction: column; gap: 8px; }
.ask-ai-input { min-height: 54px; max-height: 136px; resize: none; font-family: var(--font); font-size: 0.84375rem; line-height: 1.4; padding: 8px 10px; }
.ask-ai-foot-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ask-ai-hint { font-size: 0.71875rem; color: var(--muted); }
.ask-ai-send, .ask-ai-stop { min-height: 34px; padding: 6px 13px; font-size: 0.8125rem; gap: 6px; }
.ask-ai-send .icon, .ask-ai-stop .icon { width: 15px; height: 15px; }

/* Native screenshot preview lightbox */
dialog.ask-shot-dialog { padding: 0; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); width: min(92vw, 960px); max-height: 90vh; overflow: hidden; }
dialog.ask-shot-dialog[open] { display: flex; flex-direction: column; }
dialog.ask-shot-dialog:modal { overscroll-behavior: contain; }
dialog.ask-shot-dialog::backdrop { background: color-mix(in srgb, var(--bg) 72%, transparent); overflow: hidden; overscroll-behavior: contain; }
.ask-shot-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex: none; }
.ask-shot-title { font-size: 1rem; font-weight: 650; margin: 0; }
.ask-shot-fig { margin: 0; padding: 16px; overflow: auto; flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; background: var(--surface-2); }
.ask-shot-fig img { max-width: 100%; max-height: 68vh; height: auto; display: block; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 1px 3px rgba(0, 0, 0, .2), 0 6px 18px rgba(0, 0, 0, .1); }
.ask-shot-fig figcaption { font-size: 0.8125rem; color: var(--muted); text-align: center; }
.ask-shot-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface); flex: none; }

/* Flash highlight when Ask AI updates or locates an element on the PDF page */
.ai-flash { outline: 2px solid var(--accent) !important; outline-offset: 2px; background-color: color-mix(in srgb, var(--accent) 18%, transparent); }
@keyframes ask-ai-flash {
  0% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 45%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); }
}
@keyframes ask-dot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
@keyframes ask-ai-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: no-preference) {
  .ai-flash { animation: ask-ai-flash 1.2s cubic-bezier(0.16, 1, 0.3, 1); }
  .ask-dot { animation: ask-dot-pulse 1.2s ease-in-out infinite; }
}
@media (prefers-reduced-motion: reduce) {
  .ask-prompt-btn, .ask-shot-btn, .editor-fabs, .editor-fab, .ask-ai-fab, .ask-ai-fab::before, .editor-toolbar .toolbar-handle-bar, .editor-toolbar .shapes-btn .shapes-chev { transition: none; }
  .editor-fab:active, .ask-ai-fab:hover, .ask-ai-fab:active { transform: none; }
  .editor-toolbar.expanded .toolbar-more, .ask-ai:not([hidden]) { animation: none; }
  .ai-flash { animation: none; }
  .ask-dot { animation: none; }
}

@media (min-width: 861px) {
  .work.is-editor { --ask-ai-w: clamp(290px, 27vw, 400px); }
  .work.is-editor.with-ask-ai .pages { padding-right: calc(var(--ask-ai-w) + 12px); }
  .work.is-editor.with-ask-ai .ask-ai-fab { opacity: 0; pointer-events: none; transform: scale(0.85); }
  .ask-ai {
    position: fixed;
    right: calc(340px + 16px);
    bottom: 16px;
    top: auto;
    left: auto;
    width: min(var(--ask-ai-w, clamp(290px, 27vw, 400px)), calc(100vw - 340px - 32px));
    height: min(600px, calc(100vh - var(--ask-ai-top-clear, 220px) - 16px));
    min-height: min(320px, calc(100vh - 96px));
    max-height: calc(100vh - var(--ask-ai-top-clear, 220px) - 16px);
    z-index: 25;
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    box-shadow: var(--ai-chat-shadow);
    overflow: hidden;
  }
  .ask-ai:not([hidden]) { animation: ask-ai-pop .18s cubic-bezier(0.16, 1, 0.3, 1); }
  .ask-ai-head { background: var(--surface-2); padding: 11px 14px; }
  .ask-ai-foot { margin-top: auto; }
}

@media (max-width: 860px) {
  .work.with-ask-ai .toolbar { display: none; }
  .ask-ai { position: sticky; top: 58px; left: auto; right: auto; bottom: auto; width: 100%; height: auto; max-height: 33dvh; border-right: 0; border-bottom: 1px solid var(--line-strong); box-shadow: var(--shadow); z-index: 20; flex: none; }
  .ask-ai.has-answer { max-height: 40dvh; }
  .ask-ai-head { padding: 6px 10px; gap: 6px; }
  .ask-ai-head h2 { font-size: 0.9375rem; }
  .ask-ai-head .pill, .ask-ai-model { max-width: min(132px, 34vw); }
  .ask-ai-ctx { padding: 3px 10px; font-size: 0.71875rem; flex-wrap: nowrap; overflow: hidden; }
  .ask-ctx-summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; }
  .ask-ctx-sel { flex: 0 1 42%; }
  .ask-ai-body { padding: 6px 10px; gap: 6px; }
  .ask-ai-foot { padding: 5px 10px 6px; }
  .ask-ai-form { gap: 4px; }
  .ask-ai-input { font-size: 0.9375rem; min-height: 36px; max-height: 58px; padding: 5px 9px; line-height: 1.35; }
  .ask-ai-send, .ask-ai-stop { min-height: 28px; padding: 4px 10px; }
  .editor-fabs {
    position: fixed;
    right: 16px;
    bottom: calc(var(--editor-dock-h, 78px) + env(safe-area-inset-bottom, 0px) + 14px);
    z-index: 24;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: bottom .16s ease, opacity .16s ease, transform .16s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .editor-fab {
    position: relative;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--text);
    display: inline-grid;
    place-items: center;
    padding: 0;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform .16s cubic-bezier(0.16, 1, 0.3, 1), background-color .14s ease, border-color .14s ease, color .14s ease;
  }
  .editor-fab .icon { width: 21px; height: 21px; }
  .editor-fab:hover { background: var(--surface-2); }
  .editor-fab:active { transform: scale(0.95); }
  .editor-fab-save { color: var(--accent); }
  .editor-fab-status[aria-expanded="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
  .editor-status-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
    border: 2px solid var(--bg);
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 14px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
  }
  .ask-ai-fab {
    position: relative;
    right: auto;
    bottom: auto;
    width: 52px;
    height: 52px;
  }
  .ask-ai-fab .icon { width: 25px; height: 25px; }
  .work.editor-more-open .editor-fabs { opacity: 0; pointer-events: none; transform: scale(0.85); }
  .work.with-ask-ai .editor-fabs { bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 600px) {
  .xi-bar { flex-wrap: wrap; white-space: normal; max-width: calc(100vw - 36px); }
}

@media (max-width: 520px) {
  .halves { grid-template-columns: 1fr; }
  .ai-compare { grid-template-columns: 1fr; }
  .sigfonts { grid-template-columns: 1fr; }
  .modal-back { padding: 12px; }
  .modal { padding: 16px; }
  .modal .acts { margin: 16px -16px -16px; padding: 12px 16px 16px; bottom: -16px; }
}

/* ---- accounts, sign-in gate (Google, Microsoft, Email), and Edit PDF credits */
.auth-gate { max-width: 540px; margin: 22px auto 0; padding: 26px 24px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); text-align: left; }
.auth-card-inner { min-width: 0; }
.auth-card-inner h2 { font-size: 1.25rem; margin: 0 0 8px; }
.auth-card-inner > p.muted { margin: 0 0 14px; font-size: 0.9375rem; line-height: 1.5; }
.auth-perks { margin: 0 0 18px; padding: 12px 14px 12px 30px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 0.84375rem; color: var(--text); display: flex; flex-direction: column; gap: 6px; }
.auth-perks li { line-height: 1.4; }
.auth-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; min-width: 0; }
.google-btn, .microsoft-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 44px; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line-strong); background: #ffffff; color: #1f2328; font-weight: 600; font-size: 0.9375rem; text-decoration: none; cursor: pointer; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); transition: background-color .14s, border-color .14s; }
.google-btn:hover, .microsoft-btn:hover { background: #f3f5f8; border-color: var(--accent); color: #1f2328; text-decoration: none; }
.google-btn .g-mark, .microsoft-btn .ms-mark { width: 18px; height: 18px; flex: none; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 4px 0; color: var(--muted); font-size: 0.8125rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.email-auth-box { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.email-auth-tabs-view { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.auth-tab { appearance: none; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); font-size: 0.84375rem; font-weight: 600; padding: 7px 10px; min-height: 34px; cursor: pointer; transition: background-color .14s, color .14s, border-color .14s; }
.auth-tab:hover { color: var(--text); }
.auth-tab[aria-selected="true"] { background: var(--surface); color: var(--text); border-color: var(--line-strong); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.email-auth-form { display: flex; flex-direction: column; gap: 11px; min-width: 0; }
.auth-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.auth-field label { display: flex; align-items: baseline; gap: 6px; font-size: 0.8125rem; font-weight: 600; color: var(--text); }
.auth-field .auth-opt { font-weight: 450; color: var(--muted); font-size: 0.75rem; }
.auth-field input { width: 100%; min-height: 40px; padding: 8px 11px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: 0.9375rem; }
.auth-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 24%, transparent); }
.auth-pass-wrap { position: relative; display: flex; align-items: center; }
.auth-pass-wrap input { padding-right: 42px; }
.auth-pass-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); display: inline-grid; place-items: center; padding: 0; cursor: pointer; }
.auth-pass-toggle:hover { background: var(--surface-2); color: var(--text); }
.auth-pass-toggle svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.email-auth-msg { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 9px 11px; border-radius: 8px; font-size: 0.8125rem; line-height: 1.45; border: 1px solid var(--line); background: var(--surface); color: var(--text); overflow-wrap: anywhere; }
.email-auth-msg.error { background: color-mix(in srgb, var(--danger) 11%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); color: var(--danger); }
.email-auth-msg.warn { background: color-mix(in srgb, var(--warn) 11%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); color: var(--warn); }
.email-auth-msg.ok { background: color-mix(in srgb, var(--ok) 11%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); color: var(--ok); }
.auth-form-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: -2px; }
.auth-link-btn { appearance: none; border: 0; background: none; padding: 4px 2px; color: var(--accent); font-size: 0.8125rem; font-weight: 550; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.auth-link-btn:hover { filter: brightness(1.12); }
.email-verify-sent { display: flex; flex-direction: column; gap: 10px; padding: 4px 2px 2px; text-align: left; }
.email-verify-sent h3 { font-size: 1rem; margin: 0; color: var(--text); }
.email-verify-sent p { font-size: 0.84375rem; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; }
.email-verify-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 2px; }
.auth-forgot-head { display: flex; flex-direction: column; gap: 4px; }
.auth-forgot-head h3 { font-size: 0.96875rem; margin: 0; color: var(--text); }
.auth-forgot-head p { font-size: 0.8125rem; line-height: 1.45; color: var(--muted); }
.auth-reset-modal { display: flex; flex-direction: column; gap: 12px; }
.auth-reset-modal > p.muted { font-size: 0.875rem; line-height: 1.45; }
.auth-privacy { margin: 12px 0 0; text-align: center; }
.dev-auth-form { margin-top: 6px; padding-top: 12px; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 8px; }
.dev-auth-label { font-size: 0.75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.dev-auth-fields { display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 520px) {
  .auth-gate { padding: 20px 16px; }
  .email-auth-box { padding: 12px; }
  .auth-field input { font-size: 1rem; }
}

.edit-credits { margin-bottom: 12px; padding: 11px 12px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.edit-credits[hidden] { display: none; }
.edit-credits.low { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); background: color-mix(in srgb, var(--warn) 8%, var(--surface-2)); }
.edit-credits.empty { border-color: color-mix(in srgb, var(--danger) 48%, var(--line)); background: color-mix(in srgb, var(--danger) 9%, var(--surface-2)); }
.edit-credits .ec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.edit-credits .ec-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.edit-credits .ec-balance { font-size: 0.875rem; font-variant-numeric: tabular-nums; color: var(--accent); }
.edit-credits.low .ec-balance { color: var(--warn); }
.edit-credits.empty .ec-balance { color: var(--danger); }
.edit-credits .ec-meta { font-size: 0.78125rem; color: var(--text); font-variant-numeric: tabular-nums; }
.edit-credits .ec-hint { font-size: 0.71875rem; color: var(--muted); line-height: 1.35; }

.edit-steps .step-tag { flex: none; font-size: 0.6875rem; font-weight: 650; font-variant-numeric: tabular-nums; padding: 1px 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.edit-steps .step-tag[hidden] { display: none; }
.edit-steps .step-tag.ai { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 34%, var(--line)); color: var(--accent); }

