/* =========================================================
   ToolPDF design system
   ========================================================= */

/* Inter (variable, self-hosted, OFL) for the interface */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/vendor/fonts/inter/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/vendor/fonts/inter/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* Unicode fonts for editor text (same files embedded into the PDF). Only downloaded when used. */
@font-face { font-family: "TP Noto Sans"; src: url("/vendor/fonts/NotoSans-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "TP Noto Serif"; src: url("/vendor/fonts/NotoSerif-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "TP Noto Sans Mono"; src: url("/vendor/fonts/NotoSansMono-Regular.ttf") format("truetype"); font-display: swap; }

/* ---------- Tokens ---------- */
:root {
  --bg: #f7f8fc;
  --bg-tint: #eef0ff;
  --surface: #ffffff;
  --surface-2: #f3f4f8;
  --surface-3: #e9ebf2;
  --text: #0f1729;
  --text-2: #334155;
  --muted: #64748b;
  --border: #e3e7ef;
  --border-strong: #cfd5e1;

  --brand: #5b5ce6;
  --brand-hover: #4a4bd4;
  --brand-ink: #ffffff;
  --brand-soft: #eef0ff;
  --brand-ring: rgba(91, 92, 230, .28);
  --grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

  --cat-pdf: #e5484d;     --cat-pdf-soft: #feecee;
  --cat-convert: #2f7cf6; --cat-convert-soft: #e8f1fe;
  --cat-image: #12a37f;   --cat-image-soft: #e3f6f0;

  --ok: #12804e;  --ok-bg: #e7f6ee;  --ok-border: #b5e3c9;
  --warn: #8a5a00; --warn-bg: #fff7e6; --warn-border: #f5d48f;
  --err: #b42318; --err-bg: #fdeeec; --err-border: #f5c2bc;

  --shadow-xs: 0 1px 2px rgba(15, 23, 41, .05);
  --shadow-sm: 0 1px 3px rgba(15, 23, 41, .06), 0 1px 2px rgba(15, 23, 41, .04);
  --shadow-md: 0 8px 24px -6px rgba(15, 23, 41, .10), 0 2px 6px rgba(15, 23, 41, .04);
  --shadow-lg: 0 24px 48px -12px rgba(15, 23, 41, .18);

  --r-xs: 6px; --r-sm: 10px; --r: 14px; --r-lg: 20px; --r-xl: 28px;
  --maxw: 1180px;
  --header-h: 64px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f19;
    --bg-tint: #141a33;
    --surface: #121826;
    --surface-2: #1a2132;
    --surface-3: #232b3f;
    --text: #eef1f7;
    --text-2: #c9d1df;
    --muted: #94a0b6;
    --border: #232b3d;
    --border-strong: #323c52;
    --brand: #8b8cf8;
    --brand-hover: #a5a6fb;
    --brand-ink: #0b0f19;
    --brand-soft: #1d2144;
    --brand-ring: rgba(139, 140, 248, .35);
    --cat-pdf: #ff7a7f;     --cat-pdf-soft: #3a1a1e;
    --cat-convert: #6ea8ff; --cat-convert-soft: #15243f;
    --cat-image: #3fd0a8;   --cat-image-soft: #0f2e27;
    --ok: #4ad295;  --ok-bg: #0f2a1e;  --ok-border: #1e5a3f;
    --warn: #f2c063; --warn-bg: #2c2210; --warn-border: #5c4718;
    --err: #ff8a80; --err-bg: #331614; --err-border: #6b2a24;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .45);
    --shadow-md: 0 8px 24px -6px rgba(0, 0, 0, .55);
    --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .65);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, canvas, svg { max-width: 100%; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--brand-hover); }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.022em; font-weight: 700; }
h1 { font-size: clamp(2rem, 4.6vw, 3.25rem); letter-spacing: -.035em; }
h2 { font-size: clamp(1.35rem, 2.4vw, 1.75rem); }
h3 { font-size: 1.05rem; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
code { font-size: .9em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--brand-ring); }
.i { width: 20px; height: 20px; flex: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; border-radius: var(--r-sm); }
.skip-link:focus { left: 8px; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 920px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden, [hidden] { display: none !important; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; gap: 24px; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 750; font-size: 1.14rem; letter-spacing: -.03em; }
.brand:hover { color: var(--text); }
.brand .logo-mark { width: 32px; height: 32px; filter: drop-shadow(0 4px 10px rgba(99, 102, 241, .35)); }
.brand .accent { color: var(--brand); }
.nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.nav a { color: var(--text-2); text-decoration: none; padding: 8px 12px; border-radius: var(--r-sm); font-size: .935rem; font-weight: 500; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.nav .btn { margin-left: 8px; }
.nav .btn-primary, .nav .btn-primary:hover { color: var(--brand-ink); }
.nav .btn-primary:hover { background: var(--brand-hover); }
.menu { display: none; margin-left: auto; position: relative; }
.menu summary { list-style: none; cursor: pointer; display: grid; place-items: center; width: 42px; height: 42px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); }
.menu summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; right: 0; top: 52px; width: min(300px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 8px; display: grid; }
.menu-panel a { padding: 12px 14px; border-radius: var(--r-sm); color: var(--text); text-decoration: none; font-weight: 500; }
.menu-panel a:hover { background: var(--surface-2); }
.menu-panel .btn { margin-top: 6px; color: var(--brand-ink); }
.menu-panel .btn:hover { background: var(--brand-hover); color: var(--brand-ink); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 9px 18px;
  border-radius: var(--r-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-size: .95rem; font-weight: 600; letter-spacing: -.005em; cursor: pointer; text-decoration: none;
  box-shadow: var(--shadow-xs); transition: background .15s, border-color .15s, box-shadow .15s, transform .15s, color .15s;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn .i { width: 18px; height: 18px; }
.btn-primary { background: var(--brand); border-color: transparent; color: var(--brand-ink); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 6px 16px -6px var(--brand-ring), inset 0 1px 0 rgba(255,255,255,.14); }
.btn-primary:hover { background: var(--brand-hover); color: var(--brand-ink); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-lg { min-height: 52px; padding: 13px 26px; font-size: 1.02rem; border-radius: 12px; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .875rem; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn .i { width: 17px; height: 17px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.icon-btn.danger:hover { color: var(--err); border-color: var(--err-border); background: var(--err-bg); }
.icon-btn[disabled] { opacity: .35; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 20px; }

/* ---------- Home ---------- */
.hero { position: relative; padding: 72px 0 40px; text-align: center; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -40% -10% auto; height: 640px; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40% 50% at 30% 40%, rgba(99, 102, 241, .16), transparent 70%),
    radial-gradient(35% 45% at 72% 30%, rgba(139, 92, 246, .14), transparent 70%),
    radial-gradient(30% 40% at 55% 75%, rgba(47, 124, 246, .08), transparent 70%);
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(60% 60% at 50% 30%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(60% 60% at 50% 30%, #000 20%, transparent 75%);
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs);
  font-size: .85rem; font-weight: 550; color: var(--text-2); margin-bottom: 22px;
}
.eyebrow .dot { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }
.eyebrow .dot .i { width: 13px; height: 13px; }
.hero h1 { max-width: 860px; margin: 0 auto 18px; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .sub { color: var(--muted); max-width: 620px; margin: 0 auto 32px; font-size: clamp(1.02rem, 1.6vw, 1.15rem); }
.search { position: relative; max-width: 560px; margin: 0 auto; }
.search .i { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input[type="search"] {
  width: 100%; height: 56px; padding: 0 18px 0 50px; font: inherit; font-size: 1rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: var(--shadow-md);
  transition: border-color .15s, box-shadow .15s;
}
.search input[type="search"]:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring), var(--shadow-md); }
.trust { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 28px; margin-top: 26px; color: var(--muted); font-size: .9rem; font-weight: 500; }
.trust span { display: inline-flex; align-items: center; gap: 8px; }
.trust .i { width: 18px; height: 18px; color: var(--ok); }

.filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 8px 0 28px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 6px 16px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: inherit; font-size: .9rem; font-weight: 550; cursor: pointer;
  transition: all .15s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip .count { font-size: .78rem; opacity: .65; }

.cat-section { margin-bottom: 40px; }
.cat-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 14px; }
.cat-head h2 { white-space: nowrap; }
.cat-head h2 { font-size: 1.15rem; margin: 0; display: inline-flex; align-items: center; gap: 10px; }
.cat-head h2::before { content: ""; width: 8px; height: 8px; border-radius: 3px; background: var(--c, var(--brand)); }
.cat-head p { margin: 0; color: var(--muted); font-size: .9rem; }
.tool-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }

[data-cat="pdf"] { --c: var(--cat-pdf); --c-soft: var(--cat-pdf-soft); }
[data-cat="convert"] { --c: var(--cat-convert); --c-soft: var(--cat-convert-soft); }
[data-cat="image"] { --c: var(--cat-image); --c-soft: var(--cat-image-soft); }

.tool-card {
  position: relative; display: flex; flex-direction: column; gap: 14px; padding: 20px; min-height: 168px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); text-decoration: none; color: var(--text);
  box-shadow: var(--shadow-xs); transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.tool-card:hover { color: var(--text); transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--c) 35%, var(--border)); }
.tool-card .ico { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: var(--c-soft); color: var(--c); }
.tool-card .ico .i { width: 23px; height: 23px; }
.tool-card strong { display: block; font-size: 1.02rem; font-weight: 650; letter-spacing: -.012em; margin-bottom: 4px; }
.tool-card .desc { color: var(--muted); font-size: .9rem; line-height: 1.5; }
.tool-card .go { position: absolute; top: 20px; right: 18px; color: var(--muted); opacity: 0; transform: translateX(-4px); transition: all .2s; }
.tool-card .go .i { width: 18px; height: 18px; }
.tool-card:hover .go { opacity: 1; transform: none; color: var(--c); }
.no-results { text-align: center; padding: 40px 0; color: var(--muted); }

.section { padding: 72px 0; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 40px; }
.section-head .kicker { display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); margin-bottom: 10px; }
.section-head p { color: var(--muted); font-size: 1.05rem; margin: 0; }
.features { display: grid; gap: 18px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.feature { padding: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); }
.feature .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); margin-bottom: 18px; }
.feature h3 { font-size: 1.08rem; margin-bottom: 8px; }
.feature p { color: var(--muted); margin: 0; font-size: .95rem; }
.steps { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); counter-reset: s; }
.step, .step.card { position: relative; padding: 24px 24px 24px 80px; }
.step.card + .step.card { margin-top: 0; }
.step::before {
  counter-increment: s; content: counter(s); position: absolute; left: 20px; top: 22px; width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; font-weight: 700; color: var(--brand-ink); background: var(--grad); box-shadow: 0 8px 18px -8px rgba(99,102,241,.7);
}
.step h3 { margin-bottom: 6px; }
.step p { margin: 0; color: var(--muted); font-size: .95rem; }
.band {
  position: relative; overflow: hidden; border-radius: var(--r-xl); padding: 48px; color: #fff; background: var(--grad);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; box-shadow: var(--shadow-lg);
}
.band::after { content: ""; position: absolute; right: -80px; top: -80px; width: 320px; height: 320px; border-radius: 50%; background: rgba(255,255,255,.08); }
.band h2 { color: #fff; margin: 0 0 6px; }
.band p { margin: 0; opacity: .85; }
.band .btn { background: #fff; color: #312e81; border-color: transparent; position: relative; z-index: 1; }
.band .btn:hover { background: #eef0ff; color: #312e81; }
.band .btn-ghost-light { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.3); }
.band .btn-ghost-light:hover { background: rgba(255,255,255,.2); color: #fff; }

/* ---------- Tool page ---------- */
.tool-hero { position: relative; padding: 28px 0 8px; }
.tool-hero::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 360px; z-index: -1; pointer-events: none;
  background: radial-gradient(50% 60% at 50% 0%, color-mix(in srgb, var(--c, var(--brand)) 12%, transparent), transparent 75%);
}
.breadcrumbs { font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-bottom: 22px; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--text); }
.breadcrumbs .i { width: 14px; height: 14px; }
.tool-title { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.tool-title .ico { flex: none; width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--c-soft); color: var(--c); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 18%, transparent); }
.tool-title .ico .i { width: 28px; height: 28px; }
.tool-title h1 { font-size: clamp(1.8rem, 3.6vw, 2.5rem); margin: 0; }
.tool-hero .lead { color: var(--muted); font-size: 1.08rem; max-width: 720px; margin: 0 0 18px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; padding: 0; list-style: none; }
.facts li { display: inline-flex; gap: 6px; font-size: .82rem; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; color: var(--muted); }
.facts li b { color: var(--text); font-weight: 600; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 28px; box-shadow: var(--shadow-md); }
.app { margin-bottom: 20px; }

.dropzone {
  position: relative; border: 2px dashed var(--border-strong); border-radius: var(--r-lg); padding: 52px 20px; text-align: center;
  background: linear-gradient(180deg, var(--surface-2), color-mix(in srgb, var(--surface-2) 40%, var(--surface)));
  transition: border-color .2s, background .2s, transform .2s;
}
.dropzone:hover { border-color: color-mix(in srgb, var(--brand) 50%, var(--border-strong)); }
.dropzone.dragover { border-color: var(--brand); background: var(--brand-soft); transform: scale(1.005); }
.dz-icon { width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 18px; display: grid; place-items: center; color: #fff; background: var(--grad); box-shadow: 0 14px 28px -12px rgba(99,102,241,.75); }
.dz-icon .i { width: 28px; height: 28px; }
.dropzone .dz-title { font-weight: 650; font-size: 1.1rem; margin: 0 0 4px; color: var(--text); }
.dropzone .btn { margin-top: 18px; }
.dropzone p { margin: 8px 0 0; color: var(--muted); font-size: .92rem; }
.dropzone .hint { font-size: .82rem; margin-top: 14px; }

.privacy-note { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font-size: .9rem; margin-bottom: 8px; }
.privacy-note .i { color: var(--ok); margin-top: 1px; }

.options { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--border); }
.field label, .field legend { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; color: var(--text); }
.field .help { font-size: .8rem; color: var(--muted); margin-top: 6px; }
fieldset.field { border: 0; padding: 0; margin: 0; min-width: 0; }
select, input[type="text"], input[type="number"], input[type="email"], input[type="search"], textarea {
  width: 100%; min-height: 42px; padding: 8px 12px; border-radius: var(--r-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-size: .94rem; transition: border-color .15s, box-shadow .15s;
}
select { appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; }
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
input[type="range"] { width: 100%; accent-color: var(--brand); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); }
input[type="color"] { width: 40px; height: 34px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); padding: 3px; cursor: pointer; }
.radio-row { display: flex; flex-wrap: wrap; gap: 8px; }
.radio-row label {
  display: inline-flex; align-items: center; gap: 8px; font-weight: 500; font-size: .9rem; margin: 0;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm); padding: 8px 14px; cursor: pointer; background: var(--surface);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.radio-row label:hover { border-color: var(--brand); }
.radio-row label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand) inset; color: var(--text); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; font-size: .9rem; }

.status { display: none; align-items: flex-start; gap: 10px; margin-top: 18px; padding: 12px 16px; border-radius: var(--r); font-size: .93rem; border: 1px solid transparent; }
.status.show { display: flex; }
.status::before { content: ""; flex: none; width: 18px; height: 18px; margin-top: 2px; background: currentColor;
  -webkit-mask: var(--status-icon) center / contain no-repeat; mask: var(--status-icon) center / contain no-repeat; }
.status.info { background: var(--surface-2); border-color: var(--border); color: var(--text-2);
  --status-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4M12 8h.01'/%3E%3C/svg%3E"); }
.status.ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok);
  --status-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m8 12 3 3 5-6'/%3E%3C/svg%3E"); }
.status.warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn);
  --status-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0zM12 9v4M12 17h.01'/%3E%3C/svg%3E"); }
.status.err { background: var(--err-bg); border-color: var(--err-border); color: var(--err);
  --status-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m15 9-6 6M9 9l6 6'/%3E%3C/svg%3E"); }
.progress { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; margin-top: 12px; display: none; }
.progress.show { display: block; }
.progress > div { height: 100%; width: 0; background: var(--grad); border-radius: 999px; transition: width .25s; }

.result { margin-top: 20px; padding: 24px; border-radius: var(--r-lg); border: 1px solid var(--ok-border); background: var(--ok-bg); display: none; gap: 18px; align-items: center; }
.result.show { display: flex; flex-wrap: wrap; }
.result .result-icon { flex: none; width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--ok); color: #fff; }
.result .result-icon .i { width: 26px; height: 26px; }
.result .result-text { flex: 1; min-width: 200px; }
.result h2 { margin: 0 0 2px; font-size: 1.15rem; color: var(--text); letter-spacing: -.01em; }
.result p { margin: 0; color: var(--text-2); font-size: .92rem; word-break: break-word; }
.result .actions { margin: 0; }

/* file list */
.list-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 22px; }
.list-head .summary { font-size: .88rem; color: var(--muted); font-weight: 500; margin: 0; }
.file-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.file-item { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.file-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.file-item .thumb { width: 42px; height: 52px; flex: 0 0 42px; border-radius: 6px; background: var(--surface-2); object-fit: cover; border: 1px solid var(--border); }
.file-item .doc-ico { width: 42px; height: 52px; flex: 0 0 42px; border-radius: 8px; display: grid; place-items: center; background: var(--cat-pdf-soft); color: var(--cat-pdf); font-size: .62rem; font-weight: 800; letter-spacing: .04em; }
.file-item .meta { flex: 1; min-width: 0; }
.file-item .name { font-weight: 600; font-size: .93rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .sub { font-size: .8rem; color: var(--muted); }
.file-item .ctrl { display: flex; gap: 6px; }
.file-item .pos { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: .78rem; font-weight: 700; color: var(--muted); background: var(--surface-2); }

/* page grid (organize) */
.toolbar-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar-row .summary { margin-left: auto; font-size: .88rem; color: var(--muted); font-weight: 500; }
.page-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); margin: 18px 0 0; padding: 0; list-style: none; }
.page-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 10px; display: flex; flex-direction: column; gap: 8px; position: relative; cursor: grab; transition: box-shadow .15s, border-color .15s, transform .15s; }
.page-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.page-card.dragging { opacity: .4; }
.page-card.drop-target { outline: 2px dashed var(--brand); outline-offset: 2px; }
.page-card .pv { aspect-ratio: 3 / 4; display: grid; place-items: center; background: var(--surface-2); border-radius: 8px; overflow: hidden; color: var(--muted); }
.page-card .pv canvas, .page-card .pv .blank { max-width: 92%; max-height: 92%; transition: transform .25s ease; box-shadow: 0 1px 4px rgba(15,23,41,.15); background: #fff; border-radius: 2px; }
.page-card .pv .blank { width: 66%; aspect-ratio: 1 / 1.414; }
.page-card .label { font-size: .8rem; text-align: center; color: var(--muted); font-weight: 500; }
.page-card .label b { color: var(--text); }
.page-card .ctrl { display: flex; justify-content: center; gap: 4px; flex-wrap: wrap; }
.page-card .ctrl .icon-btn { width: 30px; height: 30px; border-radius: 8px; }
.page-card .ctrl .icon-btn .i { width: 15px; height: 15px; }

/* editor */
.editor-toolbar {
  position: sticky; top: calc(var(--header-h) + 10px); z-index: 15; display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
  padding: 6px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px);
  border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-md);
}
.editor-toolbar .sep { width: 1px; align-self: stretch; background: var(--border); margin: 4px 4px; }
.tool-btn {
  min-height: 38px; padding: 6px 11px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--text-2);
  font: inherit; font-size: .86rem; font-weight: 550; cursor: pointer; display: inline-flex; gap: 7px; align-items: center; transition: background .15s, color .15s;
}
.tool-btn .i { width: 17px; height: 17px; }
.tool-btn:hover { background: var(--surface-2); color: var(--text); }
.tool-btn[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); border-color: color-mix(in srgb, var(--brand) 30%, transparent); }
.tool-btn[disabled] { opacity: .4; cursor: not-allowed; }
.prop { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 550; color: var(--muted); padding: 0 4px; }
.prop select, .prop input[type="number"] { width: auto; min-height: 34px; padding: 4px 8px; font-size: .85rem; }
.prop select { padding-right: 30px; background-position: right 6px center; }
.editor-toolbar .btn-primary { margin-left: auto; }
.editor-hint { margin: 12px 2px 0; color: var(--muted); font-size: .85rem; }
.pages { display: flex; flex-direction: column; align-items: center; gap: 32px; margin-top: 28px; padding: 28px 12px; background: var(--surface-2); border-radius: var(--r-lg); }
.page-wrap { position: relative; box-shadow: 0 4px 24px rgba(15, 23, 41, .14), 0 0 0 1px rgba(15,23,41,.06); background: #fff; border-radius: 2px; }
.page-wrap canvas { display: block; }
.page-wrap .overlay { position: absolute; inset: 0; }
.page-wrap .page-no { position: absolute; top: -22px; left: 0; font-size: .75rem; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.overlay.mode-create { cursor: crosshair; touch-action: none; }
.overlay.mode-text { cursor: text; }
.el { position: absolute; touch-action: none; }
.el.selected { outline: 2px solid var(--brand); outline-offset: 2px; }
.overlay:not(.mode-select) .el { pointer-events: none; }
.el.text { white-space: pre; line-height: 1.2; min-width: 8px; cursor: move; color: #000; }
.el.text[contenteditable="true"] { cursor: text; outline: 2px dashed var(--brand); }
.el img, .el svg { width: 100%; height: 100%; display: block; pointer-events: none; }
.el .handle { position: absolute; right: -8px; bottom: -8px; width: 16px; height: 16px; background: var(--brand); border: 2px solid #fff; border-radius: 50%; cursor: nwse-resize; display: none; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.el.selected .handle { display: block; }
.draft { position: absolute; border: 1.5px dashed var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent); pointer-events: none; }

/* modal */
dialog { border: 1px solid var(--border); border-radius: var(--r-xl); padding: 0; background: var(--surface); color: var(--text); width: min(580px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(10, 14, 26, .55); backdrop-filter: blur(4px); }
.modal-body { padding: 28px; }
.modal-body h2 { font-size: 1.3rem; }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 12px; margin-bottom: 18px; }
.tabs button { flex: 1; background: none; border: 0; border-radius: 9px; padding: 8px 12px; font: inherit; font-size: .9rem; font-weight: 550; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--text); background: var(--surface); box-shadow: var(--shadow-sm); }
.sig-pad { width: 100%; height: 190px; border: 1px dashed var(--border-strong); border-radius: var(--r); background: #fff; touch-action: none; display: block; cursor: crosshair; }
.sig-type-preview { font-family: "Segoe Script", "Brush Script MT", "Lucida Handwriting", cursive; font-size: 2.4rem; padding: 14px 18px; background: #fff; color: #111; border-radius: var(--r); min-height: 96px; border: 1px dashed var(--border-strong); overflow: hidden; white-space: nowrap; }

/* crop */
.crop-stage-wrap { overflow: hidden; text-align: center; margin-top: 22px; padding: 20px; background: var(--surface-2); border-radius: var(--r-lg);
  background-image: linear-gradient(45deg, var(--surface-3) 25%, transparent 25%), linear-gradient(-45deg, var(--surface-3) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--surface-3) 75%), linear-gradient(-45deg, transparent 75%, var(--surface-3) 75%);
  background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0; }
.crop-stage { position: relative; display: inline-block; max-width: 100%; touch-action: none; user-select: none; vertical-align: top; }
.crop-stage canvas { display: block; max-width: 100%; height: auto; }
.crop-box { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(10,14,26,.55); cursor: move; outline: 1px solid rgba(0,0,0,.5);
  background-image: linear-gradient(to right, transparent calc(33.33% - .5px), rgba(255,255,255,.5) calc(33.33% - .5px), rgba(255,255,255,.5) calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), rgba(255,255,255,.5) calc(66.66% - .5px), rgba(255,255,255,.5) calc(66.66% + .5px), transparent calc(66.66% + .5px)),
    linear-gradient(to bottom, transparent calc(33.33% - .5px), rgba(255,255,255,.5) calc(33.33% - .5px), rgba(255,255,255,.5) calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), rgba(255,255,255,.5) calc(66.66% - .5px), rgba(255,255,255,.5) calc(66.66% + .5px), transparent calc(66.66% + .5px)); }
.crop-box .h { position: absolute; width: 18px; height: 18px; background: #fff; border: 2px solid var(--brand); border-radius: 50%; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.crop-box .h.nw { left: -10px; top: -10px; cursor: nwse-resize; }
.crop-box .h.ne { right: -10px; top: -10px; cursor: nesw-resize; }
.crop-box .h.sw { left: -10px; bottom: -10px; cursor: nesw-resize; }
.crop-box .h.se { right: -10px; bottom: -10px; cursor: nwse-resize; }

/* tool page content */
.tool-content { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: start; margin-top: 48px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 28px; box-shadow: var(--shadow-xs); }
.card + .card { margin-top: 20px; }
.card h2 { font-size: 1.2rem; margin: 0 0 16px; }
.how { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; counter-reset: h; }
.how li { position: relative; padding-left: 46px; min-height: 32px; color: var(--text-2); }
.how li::before { counter-increment: h; content: counter(h); position: absolute; left: 0; top: -2px; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: .85rem; font-weight: 700; background: var(--brand-soft); color: var(--brand); }
.notes { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.notes li { position: relative; padding-left: 30px; color: var(--text-2); font-size: .95rem; }
.notes li::before { content: ""; position: absolute; left: 4px; top: .5em; width: 8px; height: 8px; border-radius: 3px; background: var(--c, var(--brand)); opacity: .8; }
.faq-list { display: grid; gap: 10px; }
details.faq { border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); padding: 0 18px; transition: border-color .15s, box-shadow .15s; }
details.faq[open] { border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
details.faq summary { cursor: pointer; padding: 16px 0; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary .i { color: var(--muted); transition: transform .2s; }
details.faq[open] summary .i { transform: rotate(180deg); }
details.faq p { margin: 0 0 16px; color: var(--text-2); }
.aside { position: sticky; top: calc(var(--header-h) + 20px); display: grid; gap: 20px; }
.aside .card { padding: 22px; }
.aside h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin-bottom: 12px; }
.related { display: grid; gap: 6px; }
.related a { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; text-decoration: none; color: var(--text); font-weight: 550; font-size: .93rem; transition: background .15s; }
.related a:hover { background: var(--surface-2); color: var(--text); }
.related .ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--c-soft); color: var(--c); flex: none; }
.related .ico .i { width: 18px; height: 18px; }
.related .chev { margin-left: auto; color: var(--muted); width: 16px; height: 16px; }
.trust-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; font-size: .9rem; color: var(--text-2); }
.trust-list li { display: flex; gap: 10px; align-items: flex-start; }
.trust-list .i { color: var(--ok); width: 18px; height: 18px; margin-top: 2px; }

/* prose pages */
.page-head { padding: 56px 0 24px; }
.page-head p { color: var(--muted); font-size: 1.08rem; max-width: 640px; }
.prose, .prose-page { max-width: 808px; }
.prose-page { padding-top: 56px; }
.prose-page h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin-bottom: .6em; }
.prose-page > p.muted:first-of-type { margin-top: -.6em; }
.prose h2, .prose-page h2 { margin-top: 2em; font-size: 1.3rem; }
.prose ol, .prose ul, .prose-page ol, .prose-page ul { padding-left: 1.3em; }
.prose li, .prose-page li { margin: .35em 0; color: var(--text-2); }
.prose p, .prose-page p { color: var(--text-2); }
.callout { display: flex; gap: 12px; border: 1px solid var(--warn-border); background: var(--warn-bg); color: var(--text); padding: 14px 18px; border-radius: var(--r); margin: 18px 0; font-size: .93rem; }
.callout .i { color: var(--warn); margin-top: 2px; }
.callout.info { border-color: color-mix(in srgb, var(--brand) 25%, var(--border)); background: var(--brand-soft); }
.callout.info .i { color: var(--brand); }

/* ---------- Footer ---------- */
.site-footer { margin-top: 96px; border-top: 1px solid var(--border); background: var(--surface); padding: 56px 0 28px; font-size: .9rem; }
.footer-grid { display: grid; gap: 32px; grid-template-columns: 1.6fr repeat(4, 1fr); }
.footer-brand p { color: var(--muted); margin: 14px 0 16px; max-width: 280px; }
.badge-ok { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--ok-bg); color: var(--ok); font-size: .8rem; font-weight: 600; border: 1px solid var(--ok-border); }
.badge-ok .i { width: 15px; height: 15px; }
.site-footer h2 { font-size: .78rem; text-transform: uppercase; letter-spacing: .09em; color: var(--text); margin: 4px 0 14px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1020px) {
  .features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tool-content { grid-template-columns: 1fr; }
  .aside { position: static; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .nav { display: none; }
  .menu { display: block; }
}
@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .tool-grid { gap: 10px; }
  .tool-card { flex-direction: row; align-items: center; min-height: 0; padding: 14px 16px; gap: 14px; border-radius: var(--r); }
  .tool-card .ico { flex: none; width: 42px; height: 42px; }
  .tool-card .go { position: static; opacity: 1; transform: none; margin-left: auto; }
  .tool-card strong { font-size: .97rem; margin-bottom: 1px; }
  .tool-card .desc { font-size: .85rem; }
  .features { grid-template-columns: 1fr; }
  .hero { padding: 48px 0 28px; }
  .panel { padding: 16px; border-radius: var(--r-lg); }
  .card { padding: 20px; }
  .dropzone { padding: 36px 16px; }
  .band { padding: 32px 24px; }
  .section { padding: 48px 0; }
  .tool-title .ico { width: 48px; height: 48px; }
  .editor-toolbar { top: calc(var(--header-h) + 6px); flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .editor-toolbar > * { flex: 0 0 auto; }
  .editor-toolbar .tool-btn span { display: none; }
  .editor-toolbar [data-run] { position: sticky; right: 0; }
  .pages { padding: 24px 6px; margin-left: -8px; margin-right: -8px; }
  .file-item .pos { display: none; }
  .result { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
