/* PDF toolkit */
.pdfx { --pa: var(--brand-primary-dark, #00826a); --pt: color-mix(in srgb, var(--pa) 9%, #fff); --pl: var(--line, #dde3e0); }
#pdfx { margin: 1rem 0; }
#pdfx .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }


.pdfx-drop { display: grid; justify-items: center; gap: .35rem; text-align: center; padding: 2.2rem 1rem; border: 2px dashed color-mix(in srgb, var(--pa) 45%, var(--pl)); border-radius: 20px; background: var(--pt); cursor: pointer; transition: background-color .2s, border-color .2s, transform .2s; }
.pdfx-drop:hover, .pdfx-drop:focus-visible { border-color: var(--pa); outline: none; }
.pdfx-drop:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--pa) 35%, transparent); }
.pdfx-drop.is-over { background: color-mix(in srgb, var(--pa) 18%, #fff); border-color: var(--pa); transform: scale(1.01); }
.pdfx-drop.is-compact { padding: .9rem 1rem; }
@media (min-width: 640px) { .pdfx-drop.is-compact { grid-auto-flow: column; justify-content: center; gap: .8rem; } }
.pdfx-drop.is-compact .pdfx-private, .pdfx-drop.is-compact .pdfx-drop-ico { display: none; }
.pdfx-drop-ico { font-size: 2.4rem; line-height: 1; }
.pdfx-drop-title { font-size: 1.15rem; }
.pdfx-drop-sub { color: var(--ink-soft, #55655f); }
.pdfx-drop-sub u { color: var(--pa); font-weight: 600; text-underline-offset: 3px; }
.pdfx-private { margin-top: .5rem; font-size: .85rem; color: var(--ink-soft, #55655f); }

.pdfx-msgs { display: grid; gap: .5rem; margin: .8rem 0 0; }
.pdfx-msg { padding: .65rem .9rem; border-radius: 12px; font-size: .93rem; background: #eef4f2; }
.pdfx-msg-warn { background: #fff4e0; border: 1px solid #f0d9a0; }
.pdfx-link { border: 0; background: none; padding: 0; font: inherit; color: var(--pa); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.pdfx-h { margin: 0 0 .3rem; font-size: 1.2rem; }
.pdfx-sub { margin: 0 0 .9rem; }
.pdfx-suggest { margin-top: 1.2rem; }
.pdfx-cards { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.pdfx-card { position: relative; display: grid; gap: .3rem; align-content: start; text-align: left; padding: 1rem; border: 1px solid var(--pl); border-radius: 16px; background: var(--surface, #fff); color: inherit; font: inherit; cursor: pointer; transition: transform .2s, border-color .2s, box-shadow .2s; animation: pdfx-rise .45s cubic-bezier(.2, .7, .2, 1) backwards; }
.pdfx-card:nth-child(2) { animation-delay: .06s; } .pdfx-card:nth-child(3) { animation-delay: .12s; } .pdfx-card:nth-child(n+4) { animation-delay: .18s; }
.pdfx-card:hover { transform: translateY(-3px); border-color: var(--pa); box-shadow: 0 14px 24px -18px var(--pa); }
.pdfx-card.is-primary { border-color: var(--pa); background: var(--pt); }
.pdfx-card-ico { font-size: 1.6rem; }
.pdfx-badge { position: absolute; top: .7rem; right: .7rem; font-style: normal; font-size: .72rem; font-weight: 700; padding: .12rem .55rem; border-radius: 999px; background: var(--pa); color: #fff; }
@keyframes pdfx-rise { from { opacity: 0; transform: translateY(12px); } }

.pdfx-list { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .5rem; }
.pdfx-item { display: flex; align-items: center; gap: .75rem; padding: .55rem .7rem; border: 1px solid var(--pl); border-radius: 14px; background: var(--surface, #fff); }
.pdfx-item[draggable="true"] { cursor: grab; }
.pdfx-item.is-drag { opacity: .45; }
.pdfx-thumb { flex: none; display: grid; place-items: center; width: 48px; height: 60px; border-radius: 8px; overflow: hidden; background: var(--pt); border: 1px solid var(--pl); }
.pdfx-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pdfx-pdfico { font-size: .7rem; font-weight: 800; color: #b3261e; letter-spacing: .04em; }
.pdfx-name { flex: 1; min-width: 0; display: grid; }
.pdfx-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdfx-item-actions { display: flex; gap: .3rem; }
.pdfx-item-actions button, .pdfx-pbtns button { min-width: 36px; min-height: 36px; border: 1px solid var(--pl); border-radius: 10px; background: var(--surface, #fff); color: inherit; font: inherit; cursor: pointer; transition: background-color .15s, border-color .15s; }
.pdfx-item-actions button:hover:not(:disabled), .pdfx-pbtns button:hover:not(:disabled) { border-color: var(--pa); background: var(--pt); }
.pdfx-item-actions button:disabled, .pdfx-pbtns button:disabled { opacity: .35; cursor: default; }
.pdfx-item-actions [data-act="rm"] { color: #a11d1d; }

.pdfx-panel { margin-top: 1.2rem; padding: 1.1rem; border: 1px solid var(--pl); border-radius: 18px; background: var(--surface, #fff); }
.pdfx-fs { border: 0; padding: 0; margin: 0 0 .9rem; display: grid; gap: .35rem; }
.pdfx-radio, .pdfx-check { display: flex; align-items: flex-start; gap: .55rem; font-weight: 500; cursor: pointer; padding: .25rem 0; }
.pdfx-radio input, .pdfx-check input { width: auto; margin-top: .3rem; }
.pdfx-sub-opts.is-off { opacity: .45; }
.pdfx-sub-opts { margin: .3rem 0 .9rem 1.6rem; }
.pdfx-preview { min-height: 1.3em; margin: .2rem 0 0; }
.pdfx-preview.is-bad { color: #a11d1d; }
.pdfx-note { padding: .6rem .8rem; border-radius: 10px; background: #fff7e0; border: 1px solid #f0d9a0; }
.pdfx-run { min-width: 180px; }

.pdfx-pbar { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .8rem; }
.pdfx-pages { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.pdfx-page { display: grid; gap: .35rem; padding: .5rem; border: 1px solid var(--pl); border-radius: 14px; background: var(--surface, #fff); transition: opacity .2s, border-color .2s, transform .2s; }
.pdfx-page:hover { border-color: var(--pa); }
.pdfx-page.is-drag { opacity: .4; }
.pdfx-page.is-del { opacity: .45; border-style: dashed; }
.pdfx-page.is-del .pdfx-pimg::after { content: "Deleted"; position: absolute; inset: auto 0 .4rem; text-align: center; font-size: .75rem; font-weight: 700; color: #a11d1d; }
.pdfx-pimg { position: relative; display: grid; place-items: center; aspect-ratio: 3 / 4; overflow: hidden; border-radius: 8px; background: var(--pt); }
.pdfx-pimg img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform .25s ease; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .15); }
.pdfx-plabel { text-align: center; font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pdfx-pbtns { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .25rem; }
.pdfx-pbtns button { min-width: 0; min-height: 40px; padding: 0; font-size: .9rem; }
.pdfx-pdel { position: absolute; top: .3rem; right: .3rem; width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(255,255,255,.92); color: #a11d1d; font-size: .95rem; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.pdfx-pdel:hover { background: #fde3e3; }

.pdfx-progress { margin-top: 1rem; }
.pdfx-bar { height: 8px; border-radius: 999px; background: var(--pt); overflow: hidden; }
.pdfx-bar i { display: block; height: 100%; background: var(--pa); transform-origin: 0 50%; transform: scaleX(.03); transition: transform .25s ease; }
.pdfx-progress span { display: block; margin-top: .35rem; font-size: .88rem; color: var(--ink-soft, #55655f); }

.pdfx-result { margin-top: 1.2rem; padding: 1.1rem; border: 1px solid color-mix(in srgb, var(--pa) 40%, var(--pl)); border-radius: 18px; background: var(--pt); animation: pdfx-rise .4s cubic-bezier(.2, .7, .2, 1) backwards; }
.pdfx-done { display: flex; gap: .8rem; align-items: flex-start; }
.pdfx-done-ico { font-size: 1.6rem; line-height: 1.2; }
.pdfx-done p { margin: .15rem 0; }
.pdfx-dl .btn small { opacity: .8; font-weight: 500; }
.pdfx-text { width: 100%; box-sizing: border-box; margin-top: .8rem; padding: .7rem; border: 1px solid var(--pl); border-radius: 12px; font: inherit; font-size: .92rem; background: #fff; color: inherit; resize: vertical; }
.pdfx-imgs { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); margin-top: .8rem; }
.pdfx-imgbtn { display: grid; gap: .25rem; padding: .35rem; border: 1px solid var(--pl); border-radius: 12px; background: #fff; color: inherit; cursor: pointer; font: inherit; transition: border-color .2s, transform .2s; }
.pdfx-imgbtn:hover { border-color: var(--pa); transform: translateY(-2px); }
.pdfx-imgbtn img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; }
.pdfx-next { margin: .6rem 0 0; }
.pdfx-next .pdfx-link { margin-right: .6rem; }

.pdfx.is-busy, #pdfx.is-busy .pdfx-panel, #pdfx.is-busy .pdfx-list { cursor: progress; }
#pdfx.is-busy .pdfx-drop, #pdfx.is-busy .pdfx-list, #pdfx.is-busy .pdfx-pages, #pdfx.is-busy .pdfx-pbar { pointer-events: none; opacity: .7; }

/* hub: tool grid shown under the tool on its own page */

html[data-theme="dark"] .pdfx { --pt: color-mix(in srgb, var(--pa) 16%, #161f22); --pl: #27353a; }
html[data-theme="dark"] .pdfx-panel, html[data-theme="dark"] .pdfx-item, html[data-theme="dark"] .pdfx-card, html[data-theme="dark"] .pdfx-page, html[data-theme="dark"] .pdfx-imgbtn { background: #161f22; }
html[data-theme="dark"] .pdfx-text { background: #161f22; }

@media (prefers-reduced-motion: reduce) {
  .pdfx-card, .pdfx-result { animation: none; }
  .pdfx-card, .pdfx-tc, .pdfx-drop, .pdfx-pimg img, .pdfx-imgbtn, .pdfx-bar i { transition: none; }
}

#pdfx [hidden] { display: none !important; }

/* Tool cards (under every PDF tool) */
.pdfx-gridh { margin: 1.6rem 0 .7rem; }
.pdfx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 165px), 1fr)); gap: .7rem; }
.pdfx-tc { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: .25rem; text-align: left; padding: .8rem .8rem .75rem; border: 1px solid var(--line, #dde3e0); border-radius: 16px; background: var(--surface, #fff); color: inherit; font: inherit; text-decoration: none; cursor: pointer; transition: border-color .2s, transform .2s, box-shadow .2s, background-color .2s; }
.pdfx-tc:hover, .pdfx-tc:focus-visible { border-color: var(--brand-primary-dark, #00826a); transform: translateY(-2px); box-shadow: 0 10px 22px -16px rgba(0,0,0,.45); outline: none; }
.pdfx-tc:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary-dark, #00826a) 35%, transparent); }
.pdfx-tc.is-on { border: 2px solid var(--brand-primary-dark, #00826a); padding: calc(.8rem - 1px) calc(.8rem - 1px) calc(.75rem - 1px); background: color-mix(in srgb, var(--brand-primary-dark, #00826a) 10%, var(--surface, #fff)); }
.pdfx-tc.is-on::after { content: "You are here"; position: absolute; top: .55rem; right: .55rem; padding: .05rem .5rem; border-radius: 999px; background: var(--brand-primary-dark, #00826a); color: #fff; font-size: .68rem; font-weight: 700; }
.pdfx-tc-ico { display: grid; place-items: center; flex: none; width: 42px; height: 42px; margin-bottom: .2rem; border-radius: 12px; background: color-mix(in srgb, var(--brand-primary-dark, #00826a) 12%, var(--surface, #fff)); font-size: 1.35rem; line-height: 1; }
.pdfx-tc-name { font-weight: 700; font-size: .98rem; line-height: 1.25; }
.pdfx-tc-d { font-size: .86rem; line-height: 1.4; }
.pdfx-tc-u { font-size: .78rem; line-height: 1.35; color: var(--ink-soft, #55655f); }
.pdfx-tc-io { margin-top: auto; padding-top: .45rem; display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .3rem; font-size: .72rem; color: var(--ink-soft, #55655f); }
.pdfx-tc-io b { padding: .1rem .45rem; border-radius: 999px; background: color-mix(in srgb, var(--brand-primary-dark, #00826a) 12%, var(--surface, #fff)); color: var(--brand-primary-dark, #00826a); font-weight: 600; }
.pdfx-tc-io i { font-style: normal; }
/* active tool banner (hub) */
#pdfx-toolbar[hidden] { display: none; }
.pdfx-now { display: flex; align-items: center; gap: .75rem; margin-bottom: .8rem; padding: .7rem .8rem; border: 2px solid var(--pa); border-radius: 16px; background: var(--pt); }
.pdfx-now .pdfx-tc-ico { margin: 0; }
.pdfx-now-t { flex: 1; min-width: 0; display: grid; gap: .1rem; font-size: .86rem; line-height: 1.35; }
.pdfx-now-t strong { font-size: 1rem; }
.pdfx-now-x { flex: none; padding: .4rem .8rem; border: 1px solid var(--pl); border-radius: 999px; background: var(--surface, #fff); color: inherit; font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; }
.pdfx-now-x:hover { border-color: var(--pa); }

/* Web page to PDF */
#w2p { margin: 1rem 0; --w2p-fs: 1rem; }
#w2p .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#w2p [hidden] { display: none !important; }
.w2p-form { display: flex; gap: .5rem; flex-wrap: wrap; }
.w2p-form input { flex: 1 1 240px; min-width: 0; min-height: 48px; padding: .6rem .9rem; border: 1px solid var(--pl, #dde3e0); border-radius: 14px; font: inherit; background: var(--surface, #fff); color: inherit; }
.w2p-form input:focus { outline: 2px solid var(--pa, #00826a); outline-offset: 1px; }
.w2p-form .btn { min-height: 48px; }
.w2p-alt { margin: .6rem 0 0; }
.w2p-paste { display: grid; gap: .6rem; margin-top: .6rem; justify-items: start; }
.w2p-work { margin-top: 1rem; }
.w2p-bar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding: .5rem; margin: 0 -.25rem; border: 1px solid var(--pl, #dde3e0); border-radius: 14px; background: var(--surface, #fff); box-shadow: 0 6px 16px -14px rgba(0,0,0,.4); }
.w2p-sep { flex: 1 1 0; }
.w2p-bar .btn:disabled { opacity: .45; }
.w2p-opts { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; margin: .7rem 0 .2rem; font-size: .92rem; }
.w2p-opts select { margin-left: .3rem; padding: .25rem .4rem; border: 1px solid var(--pl, #dde3e0); border-radius: 8px; font: inherit; background: var(--surface, #fff); color: inherit; }
.w2p-opts .pdfx-check { padding: 0; }
.w2p-info { margin: .3rem 0 .6rem; color: var(--ink-soft, #55655f); }
.w2p-sheet { padding: 1.1rem 1rem 1.4rem; border: 1px solid var(--pl, #dde3e0); border-radius: 16px; background: #fff; color: #111; font-size: var(--w2p-fs); line-height: 1.65; max-height: 75vh; overflow: auto; -webkit-overflow-scrolling: touch; }
.w2p-sheet.is-serif { font-family: Georgia, "Times New Roman", serif; }
.w2p-title { margin: 0 0 .2rem; font-size: 1.45em; line-height: 1.3; outline: none; }
.w2p-title:empty::before { content: attr(data-ph); color: #999; font-weight: 500; }
.w2p-title.is-off, .w2p-source.is-off { opacity: .35; text-decoration: line-through; }
.w2p-source { margin: 0 0 1rem; word-break: break-all; }
.w2p-b { position: relative; display: flex; align-items: flex-start; gap: .4rem; padding: .25rem .3rem .25rem .4rem; margin: 0 -.3rem; border-radius: 10px; transition: background-color .15s; }
.w2p-b:hover, .w2p-b:focus-within { background: #f1f6f4; }
.w2p-b.is-del { display: none; }
.w2p-x { flex: 1; min-width: 0; outline: none; white-space: pre-wrap; word-break: break-word; }
.w2p-t-h2 .w2p-x { font-size: 1.25em; font-weight: 700; margin-top: .5em; }
.w2p-t-h3 .w2p-x { font-size: 1.08em; font-weight: 700; margin-top: .3em; }
.w2p-t-li .w2p-x::before { content: "•"; position: absolute; margin-left: -.9em; }
.w2p-t-li { padding-left: 1.3rem; }
.w2p-t-q .w2p-x { font-style: italic; border-left: 3px solid #bbb; padding-left: .8rem; }
.w2p-t-pre .w2p-x { font: .85em/1.45 Menlo, Consolas, monospace; background: #f4f4f4; padding: .4rem .6rem; border-radius: 6px; }
.w2p-imgbox { text-align: center; white-space: normal; }
.w2p-imgbox img { max-width: 100%; max-height: 420px; height: auto; border-radius: 8px; background: #f1f1f1; min-height: 40px; }
.w2p-sheet.no-img .w2p-t-img { opacity: .3; }
.w2p-t-img { align-items: center; }
.w2p-ctl { flex: none; display: flex; gap: .25rem; }
.w2p-del { width: 36px; height: 36px; border: 1px solid #e3c9c9; border-radius: 50%; background: #fff; color: #a11d1d; font-size: .95rem; line-height: 1; cursor: pointer; opacity: .75; }
.w2p-del:hover, .w2p-del:focus-visible { background: #fde3e3; opacity: 1; }
.w2p-below { color: #6b4a00; border-color: #e6d6a8; }
@media (hover: hover) and (min-width: 700px) { .w2p-ctl { opacity: 0; } .w2p-b:hover .w2p-ctl, .w2p-b:focus-within .w2p-ctl { opacity: 1; } }
@media (max-width: 520px) { .w2p-del { width: 34px; height: 34px; } .w2p-bar .btn { flex: 1 1 auto; } }
html[data-theme="dark"] .w2p-form input, html[data-theme="dark"] .w2p-bar, html[data-theme="dark"] .w2p-opts select { background: #161f22; }
