/* ==========================================================================
   FilesPilot design system — "soft gradient"
   Headings: Plus Jakarta Sans (700-800, tight tracking)
   Body/UI: Inter; numbers and file names use tabular figures
   Look: pastel gradient wash, floating frosted header, very rounded
   translucent cards with soft shadows, pill buttons, a gradient per tool.
   ========================================================================== */

:root {
  --ink: #111827;
  --ink-soft: #4B5563;
  --ink-faint: #6B7280;
  --bg: #FBFBFE;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #FFFFFF;
  --surface-muted: #F3F4F6;
  --border: rgba(17, 24, 39, 0.08);
  --border-strong: rgba(17, 24, 39, 0.16);

  /* Brand gradient: decorative text and background accents only. */
  --brand-1: #6366F1;
  --brand-2: #EC4899;
  --brand-ink: #4F46E5;

  /* Tool tone. Buttons and icons draw from these; each .tone-* overrides
     them. Defaults are the darker brand pair so white text stays readable. */
  --tone-a: #4F46E5;
  --tone-b: #7C3AED;

  --success: #047857;
  --success-tint: #ECFDF5;
  --warning: #B45309;
  --warning-tint: #FFFBEB;
  --danger: #DC2626;
  --danger-tint: #FEF2F2;

  --font-display: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-code: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.05);
  --shadow-md: 0 10px 30px rgba(99, 102, 241, 0.08), 0 2px 6px rgba(17, 24, 39, 0.04);
  --shadow-lg: 0 24px 60px rgba(17, 24, 39, 0.16);

  --header-h: 64px;
  --header-gap: 12px;
  --max-w: 1180px;
}

/* Per-tool tones: one rule per line, exact form parsed by tests/test_styles.py.
   Every stop keeps white text at WCAG AA (>= 4.5:1). */
.tone-violet { --tone-a: #7C3AED; --tone-b: #4F46E5; }
.tone-teal { --tone-a: #0F766E; --tone-b: #0E7490; }
.tone-amber { --tone-a: #B45309; --tone-b: #C2410C; }
.tone-rose { --tone-a: #DB2777; --tone-b: #E11D48; }
.tone-green { --tone-a: #15803D; --tone-b: #166534; }
.tone-blue { --tone-a: #2563EB; --tone-b: #4F46E5; }
.tone-sky { --tone-a: #0369A1; --tone-b: #2563EB; }
.tone-fuchsia { --tone-a: #A21CAF; --tone-b: #86198F; }
.tone-slate { --tone-a: #334155; --tone-b: #1E293B; }
.tone-red { --tone-a: #DC2626; --tone-b: #B91C1C; }
.tone-lime { --tone-a: #4D7C0F; --tone-b: #3F6212; }
.tone-orange { --tone-a: #C2410C; --tone-b: #9A3412; }
.tone-cyan { --tone-a: #0E7490; --tone-b: #155E75; }
/* Derived tone colors. Declared on every tone-carrying element (not only
   :root): a custom property that references var() resolves where it is
   declared, so on :root alone these would stay indigo for every tool. */
:root, [class*="tone-"] {
  --tone-tint: color-mix(in srgb, var(--tone-a) 9%, white);
  --tone-glow: color-mix(in srgb, var(--tone-a) 30%, transparent);
}

* { box-sizing: border-box; }
/* components set display:flex etc.; the hidden attribute must still win */
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 480px at 8% -8%, #E0E7FF 0%, transparent 62%),
    radial-gradient(800px 440px at 96% -4%, #FCE7F3 0%, transparent 58%);
  background-attachment: fixed;
  background-repeat: no-repeat;
}

h1, h2, h3, h4 {
  font-family: var(--font-display); font-weight: 700; line-height: 1.15;
  letter-spacing: -0.03em; margin: 0 0 0.5em; color: var(--ink);
}
p { margin: 0 0 1em; color: var(--ink-soft); }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--font-code); }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 2000;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 0 0 12px 0;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 3px solid var(--brand-ink);
  outline-offset: 3px;
  border-radius: 8px;
}

.wrap { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }
@media (max-width: 560px) { .wrap { padding: 0 16px; } }

.text-gradient {
  background: linear-gradient(90deg, var(--brand-ink), #DB2777);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

/* ---------------------------------- Header --------------------------- */
.site-header {
  position: sticky; top: var(--header-gap); z-index: 100;
  margin-top: var(--header-gap); padding: 0 12px;
}
.site-header__bar {
  height: var(--header-h); display: flex; align-items: center; gap: 24px;
  padding: 0 12px 0 18px;
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 18px rgba(17, 24, 39, 0.06);
}
.brand { display: flex; align-items: center; }
.brand:hover { text-decoration: none; }
.brand__logo { height: 34px; width: auto; display: block; }

.main-nav { display: flex; gap: 2px; margin-left: auto; align-items: stretch; }
.nav-dropdown { position: relative; display: flex; }
.nav-dropdown__btn { display: flex; align-items: center; gap: 4px; }
.nav-dropdown__btn i.ti-chevron-down { font-size: 0.75rem; color: var(--ink-faint); transition: transform 0.15s ease; }
.nav-dropdown:hover .nav-dropdown__btn i.ti-chevron-down,
.nav-dropdown:focus-within .nav-dropdown__btn i.ti-chevron-down { transform: rotate(180deg); }

.nav-dropdown__menu {
  display: none; position: absolute; top: 100%; left: 0; margin-top: 10px; min-width: 280px;
  background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); padding: 8px; z-index: 150;
}
.nav-dropdown:hover .nav-dropdown__menu,
.nav-dropdown:focus-within .nav-dropdown__menu,
.nav-dropdown.is-open .nav-dropdown__menu { display: block; }
.nav-dropdown.is-open .nav-dropdown__btn i.ti-chevron-down { transform: rotate(180deg); }
/* Escape / click-to-close beats :hover and :focus-within (see common.js) */
.nav-dropdown.is-suppressed .nav-dropdown__menu { display: none !important; }
.nav-dropdown.is-suppressed .nav-dropdown__btn i.ti-chevron-down { transform: none; }
/* group buttons are <button>s: reset native button styling */
button.main-nav__link { border: 0; background: none; font-family: inherit; cursor: pointer; }
/* a group with many tools shows them in two columns */
.nav-dropdown__menu--wide { min-width: 0; width: 600px; }
.nav-dropdown:hover .nav-dropdown__menu--wide,
.nav-dropdown:focus-within .nav-dropdown__menu--wide,
.nav-dropdown.is-open .nav-dropdown__menu--wide { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
/* invisible bridge so the menu doesn't close when moving the mouse from button to menu */
.nav-dropdown::after { content: ''; position: absolute; top: 100%; left: 0; right: 0; height: 10px; }

.nav-dropdown__item {
  display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px;
  border-radius: var(--radius-sm); color: var(--ink);
}
.nav-dropdown__item:hover { background: var(--surface-muted); text-decoration: none; }
.nav-dropdown__item.is-active { background: var(--tone-tint); }
.nav-dropdown__item.is-active strong { color: var(--ink); }
.nav-dropdown__item-icon {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; font-size: 1rem; color: #fff;
  background: linear-gradient(135deg, var(--tone-a), var(--tone-b));
  display: flex; align-items: center; justify-content: center;
}
.nav-dropdown__item strong { display: block; font-size: 0.9rem; font-weight: 600; }
.nav-dropdown__item-sub { display: block; font-size: 0.78rem; color: var(--ink-faint); margin-top: 1px; }

.main-nav__link {
  color: var(--ink-soft); font-weight: 600; font-size: 0.92rem;
  padding: 8px 11px; border-radius: var(--radius-pill);
}
.main-nav__link:hover { background: rgba(99, 102, 241, 0.08); color: var(--ink); text-decoration: none; }
.main-nav__link.is-active { color: var(--brand-ink); background: #EEF2FF; }

.nav-toggle {
  display: none; margin-left: auto; background: none; border: 0;
  width: 42px; height: 42px; border-radius: var(--radius-sm); cursor: pointer;
}
.nav-toggle:hover { background: var(--surface-muted); }
.nav-toggle span { display: block; width: 20px; height: 2px; margin: 4px auto; background: var(--ink); border-radius: 2px; }

.lang-switcher { position: relative; margin-left: 6px; }
.lang-switcher__btn {
  display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong); background: var(--surface-solid); color: var(--ink);
  font-family: var(--font-body); font-size: 0.85rem; font-weight: 600; cursor: pointer;
}
.lang-switcher__btn:hover { border-color: var(--brand-1); }
.lang-switcher__btn i.ti-world { font-size: 1rem; color: var(--ink-faint); }
.lang-switcher__btn i.ti-chevron-down { font-size: 0.8rem; color: var(--ink-faint); transition: transform 0.15s ease; }
.lang-switcher.is-open .lang-switcher__btn i.ti-chevron-down { transform: rotate(180deg); }
.lang-switcher__menu {
  display: none; position: absolute; top: calc(100% + 10px); right: 0; min-width: 190px;
  background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 200;
}
.lang-switcher.is-open .lang-switcher__menu { display: block; }
.lang-switcher__item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm); color: var(--ink); font-size: 0.9rem; font-weight: 500;
}
.lang-switcher__item:hover { background: var(--surface-muted); text-decoration: none; }
.lang-switcher__item.is-active { color: var(--brand-ink); background: #EEF2FF; }
.lang-switcher__item i { font-size: 0.85rem; color: var(--brand-ink); }

.mobile-nav {
  display: none; flex-direction: column; overflow: hidden;
  max-width: var(--max-w); margin: 8px auto 0;
  background: var(--surface-solid); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
}
.mobile-nav.is-open {
  display: flex;
  /* The menu lives in the sticky header, so it can't scroll with the page:
     scroll it internally or its last links are unreachable on short screens. */
  max-height: calc(100dvh - var(--header-h) - var(--header-gap) * 4);
  overflow-y: auto;
}
.mobile-nav__link { padding: 14px 20px; color: var(--ink); border-bottom: 1px solid var(--border); font-weight: 500; }
.mobile-nav__link:hover { background: var(--surface-muted); text-decoration: none; }
.mobile-nav__link.is-active { color: var(--brand-ink); }
.mobile-nav__link--action { font-weight: 700; }
.mobile-nav__heading {
  display: block; padding: 14px 16px 4px; font-size: 0.74rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint);
}
.mobile-nav__link--sub { padding-left: 36px; font-size: 0.9rem; color: var(--ink-soft); }
.mobile-nav__langs { display: flex; flex-direction: column; border-top: 1px solid var(--border-strong); }
.mobile-nav__langs .mobile-nav__link:last-child { border-bottom: 0; }

@media (max-width: 860px) {
  .main-nav, .lang-switcher { display: none; }
  .nav-toggle { display: block; }
}
/* Set by common.js when the full nav doesn't fit at the current width/language */
.site-header.nav-collapsed .main-nav,
.site-header.nav-collapsed .lang-switcher { display: none; }
.site-header.nav-collapsed .nav-toggle { display: block; }
.main-nav__link { white-space: nowrap; }

/* ---------------------------------- Buttons --------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body); font-weight: 600; font-size: 0.95rem; line-height: 1.25;
  padding: 12px 22px; border-radius: var(--radius-sm); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; text-align: center; max-width: 100%;
  transition: transform 0.12s ease, box-shadow 0.15s ease, filter 0.15s ease, border-color 0.15s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; filter: none; }

.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--tone-a), var(--tone-b));
  box-shadow: 0 8px 20px var(--tone-glow);
}
.btn--primary:hover:not(:disabled) { filter: brightness(1.07); transform: translateY(-1px); box-shadow: 0 12px 26px var(--tone-glow); }
.btn--ghost { background: var(--surface-solid); color: var(--ink); border-color: var(--border-strong); }
.btn--ghost:hover { border-color: var(--tone-a); color: var(--tone-a); }
.btn--danger-ghost { background: var(--surface-solid); color: var(--danger); border-color: var(--danger); }
.btn--sm { padding: 8px 14px; font-size: 0.85rem; border-radius: 10px; }
.btn--lg { padding: 15px 24px; font-size: 1rem; border-radius: 14px; }
.btn--xl { padding: 16px 34px; font-size: 1.05rem; font-weight: 700; }
.btn--pill { border-radius: var(--radius-pill); }
.btn--block { width: 100%; }

/* ---------------------------------- Hero ------------------------------ */
.hero { padding: 56px 0 28px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 800; letter-spacing: -0.035em; max-width: 20ch; }
.hero__intro { max-width: 58ch; font-size: 1.08rem; }

.hero--center { text-align: center; }
.hero--center h1, .hero--center .hero__intro { margin-left: auto; margin-right: auto; }
.hero--home { padding-top: 72px; }
.hero--tool { padding-top: 44px; }
.hero--tool h1 { font-size: clamp(1.85rem, 4.2vw, 2.7rem); }

.hero__chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.8rem; font-weight: 700; color: var(--brand-ink);
  background: rgba(255, 255, 255, 0.85); border: 1px solid #E0E7FF;
  padding: 6px 14px; border-radius: var(--radius-pill); margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.hero__tool-icon {
  width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.9rem;
  background: linear-gradient(135deg, var(--tone-a), var(--tone-b));
  box-shadow: 0 14px 30px var(--tone-glow);
}

.trust-badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.84rem; font-weight: 600; padding: 7px 14px; border-radius: var(--radius-pill);
  margin-top: 4px;
}
.trust-badge--client { color: var(--success); background: var(--success-tint); }
.trust-badge--server { color: var(--warning); background: var(--warning-tint); }
.trust-badge--hybrid { color: var(--brand-ink); background: #EEF2FF; }

/* ---------------------------------- Tool cards ------------------------ */
.tool-grid {
  display: grid; grid-template-columns: 1fr; gap: 16px; padding: 16px 0 8px;
}
@media (min-width: 560px) { .tool-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .tool-grid { grid-template-columns: repeat(4, 1fr); gap: 20px; } }
.tool-grid > article { display: flex; }
.tool-grid > article > .tool-card { flex: 1; }

.tool-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 22px; display: flex; flex-direction: column; gap: 8px; color: var(--ink);
  box-shadow: var(--shadow-md);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
a.tool-card:hover {
  transform: translateY(-3px); text-decoration: none;
  border-color: color-mix(in srgb, var(--tone-a) 25%, transparent);
  box-shadow: 0 18px 40px color-mix(in srgb, var(--tone-a) 16%, transparent);
}
.tool-card__icon {
  width: 46px; height: 46px; border-radius: 14px; margin-bottom: 6px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.35rem;
  background: linear-gradient(135deg, var(--tone-a), var(--tone-b));
  box-shadow: 0 8px 18px var(--tone-glow);
}
.tool-card h2 { font-size: 1.08rem; margin-bottom: 0; }
.tool-card p { font-size: 0.9rem; margin-bottom: 0; }
.tool-card .trust-badge { align-self: flex-start; margin-top: auto; font-size: 0.78rem; }
.tool-card--coming-soon { background: transparent; border: 1.5px dashed var(--border-strong); box-shadow: none; }
.tool-card--coming-soon .tool-card__icon { background: var(--surface-muted); color: var(--ink-faint); box-shadow: none; }

.tool-category-links {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px;
  margin-top: 28px;
}
.tool-category-links__label { font-size: 0.88rem; color: var(--ink-faint); margin-right: 4px; }
.tool-category-links__pill {
  padding: 6px 14px; border-radius: var(--radius-pill); font-size: 0.86rem; font-weight: 600;
  color: var(--ink); background: var(--surface-solid); border: 1px solid var(--border-strong);
}
.tool-category-links__pill:hover { border-color: var(--brand-1); color: var(--brand-ink); text-decoration: none; }

/* ---------------------------------- Sections -------------------------- */
.section { padding: 48px 0; }
.section__title, .section > .wrap > h2 { font-size: 1.75rem; text-align: center; margin-bottom: 28px; }
.section > .wrap > h2 + .faq-list { margin-top: 0; }
.home-tools { padding-top: 4px; }
.section__title { text-align: center; margin-bottom: 28px; }

.why-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; margin-top: 24px; }
.section__title + .why-grid, .section > .wrap > h2 + .why-grid { margin-top: 0; }
.why-grid > * {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 22px; box-shadow: var(--shadow-md);
}
.why-grid h3 { font-size: 1.05rem; }
.why-grid p { font-size: 0.92rem; margin-bottom: 0; }

.faq-list { max-width: 780px; margin: 20px auto 0; display: flex; flex-direction: column; gap: 10px; }
.section__title + .faq-list { margin-top: 0; }
.faq-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px 20px; box-shadow: var(--shadow-sm);
}
.faq-item summary {
  cursor: pointer; font-weight: 700; font-family: var(--font-display); font-size: 1rem;
  list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+'; flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #EEF2FF; color: var(--brand-ink); font-family: var(--font-body); font-weight: 600;
}
.faq-item[open] summary::after { content: '\2212'; }
.faq-item p { margin: 12px 0 0; }

/* ---------------------------------- Text pages (privacy, terms, ...) -- */
.hero--page { padding-bottom: 12px; }
.hero--page .btn { margin-top: 8px; }
.page-updated { font-size: 0.85rem; color: var(--ink-faint); }
.section--page { padding-top: 16px; }
.prose-card {
  max-width: 780px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 8px 32px; box-shadow: var(--shadow-md);
}
.prose-card__section { padding: 24px 0; border-bottom: 1px solid var(--border); }
.prose-card__section:last-child { border-bottom: 0; }
.prose-card h2 { font-size: 1.2rem; margin-bottom: 10px; }
.prose-card p, .prose-card li { color: var(--ink-soft); font-size: 0.97rem; line-height: 1.7; }
.prose-card p:last-child { margin-bottom: 0; }
.prose-card ul { margin: 0; padding-left: 1.25rem; display: flex; flex-direction: column; gap: 6px; }
.prose-card li::marker { color: var(--brand-1); }
.prose-card__links { margin-top: 12px !important; }
.prose-card__links a { font-weight: 600; }
@media (max-width: 560px) { .prose-card { padding: 4px 20px; } }

/* ---------------------------------- Guides ----------------------------- */
.section--tight { padding-top: 8px; }
/* auto-fit + centred tracks: 1, 2 or 5 guides all sit centred on the page */
.guide-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 360px)); justify-content: center; gap: 20px; }
.guide-card {
  display: flex; flex-direction: column; gap: 8px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 22px; box-shadow: var(--shadow-md);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.guide-card:hover {
  transform: translateY(-3px); text-decoration: none;
  border-color: color-mix(in srgb, var(--tone-a) 25%, transparent);
  box-shadow: 0 18px 40px color-mix(in srgb, var(--tone-a) 16%, transparent);
}
/* Section pages often list a single tool / guide: centre it instead of
   leaving one card stranded in the first column of a wide grid. */
.action-tools .tool-grid { display: flex; flex-wrap: wrap; justify-content: center; }
.action-tools .tool-grid > article { width: 100%; max-width: 300px; }
.guide-card h3 { font-size: 1.05rem; margin: 4px 0 0; }
.guide-card p { font-size: 0.9rem; margin: 0; }
.guide-card__more { margin-top: auto; padding-top: 6px; font-size: 0.88rem; font-weight: 700; color: var(--brand-ink); display: inline-flex; align-items: center; gap: 4px; }

.prose-card__steps { margin: 0; padding-left: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 10px; }
.prose-card__steps li { counter-increment: step; position: relative; padding-left: 40px; min-height: 28px; }
.prose-card__steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.82rem; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--tone-a), var(--tone-b));
}
.prose-card p + .prose-card__steps, .prose-card p + ul, .prose-card__steps + ul { margin-top: 12px; }

.guide-cta {
  max-width: 780px; margin: 24px auto 0;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: var(--tone-tint); border: 1px solid color-mix(in srgb, var(--tone-a) 20%, transparent);
  border-radius: var(--radius-lg); padding: 22px 24px;
}
.guide-cta .tool-card__icon { margin: 0; flex-shrink: 0; }
.guide-cta__text { flex: 1; min-width: 200px; }
.guide-cta h2 { font-size: 1.15rem; margin: 0 0 4px; }
.guide-cta p { margin: 0; font-size: 0.92rem; color: var(--ink-soft); }

.guide-link { text-align: center; margin: 24px 0 0; }
.guide-link a { font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }

/* ---------------------------------- Tool workspace --------------------- */
.workspace { padding: 8px 0 72px; }

.upload-zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  max-width: 760px; margin: 0 auto;
  background: rgba(255, 255, 255, 0.78);
  border: 1.5px dashed #C7D2FE; border-radius: var(--radius-lg);
  padding: 44px 24px; text-align: center; cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}
.upload-zone:hover { border-color: var(--tone-a); background: var(--surface-solid); }
.upload-zone.is-dragover {
  border: 2px solid var(--tone-a); background: var(--tone-tint); transform: scale(1.01);
}
.upload-zone__icon { color: var(--tone-a); margin-bottom: 8px; }
.upload-zone__icon i { font-size: 2.6rem; }
.upload-zone h2 { font-size: 1.25rem; margin-bottom: 18px; }
.upload-zone__btn { margin-bottom: 16px; }
.upload-zone p { font-size: 0.9rem; margin: 0 0 4px; }
.upload-zone__hint { font-size: 0.82rem; color: var(--ink-faint); }
.upload-zone input[type="file"] { display: none; }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.workspace-grid--merge { grid-template-columns: minmax(0, 1fr) 320px; }
@media (max-width: 900px) { .workspace-grid, .workspace-grid--merge { grid-template-columns: minmax(0, 1fr); } }

.file-meta-card {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 14px 16px; margin-bottom: 20px; box-shadow: var(--shadow-md);
}
.file-meta-card__icon {
  color: var(--tone-a); background: var(--tone-tint); width: 42px; height: 42px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 1.2rem;
}
.file-meta-card__name { font-weight: 600; word-break: break-all; }
.file-meta-card__sub { font-size: 0.8rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.file-meta-card__remove { margin-left: auto; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar__group { display: flex; gap: 6px; flex-wrap: wrap; }

.thumb-grid { display: flex; flex-wrap: wrap; gap: 18px; }
.thumb-card {
  position: relative; width: 150px; border: 2px solid transparent; border-radius: 14px;
  background: var(--surface-solid); padding: 7px; cursor: grab; user-select: none;
  box-shadow: var(--shadow-md);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.thumb-card:hover { transform: translateY(-2px); }
.thumb-card.is-selected { border-color: var(--tone-a); box-shadow: 0 0 0 4px var(--tone-tint), var(--shadow-md); }
.thumb-card.is-dragging { opacity: 0.4; }
.thumb-card.is-disabled { cursor: default; }
.thumb-card__canvas-wrap { aspect-ratio: 1/1.414; background: var(--surface-muted); border-radius: 8px; overflow: hidden; }
.thumb-card__canvas-wrap canvas, .thumb-card__canvas-wrap img { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumb-card__check {
  position: absolute; top: -9px; left: -9px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--surface-solid); border: 2px solid var(--border-strong); color: transparent;
  display: flex; align-items: center; justify-content: center; font-size: 0.8rem;
}
.thumb-card.is-selected .thumb-card__check { background: var(--tone-a); border-color: var(--tone-a); color: #fff; }
.thumb-card__label { text-align: center; font-size: 0.78rem; color: var(--ink-faint); margin-top: 6px; font-variant-numeric: tabular-nums; }
.thumb-card__remove {
  position: absolute; bottom: 8px; right: 8px; background: var(--surface-solid); border: 1px solid var(--border);
  width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--danger);
}

.side-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px; box-shadow: var(--shadow-md);
  position: sticky; top: calc(var(--header-h) + var(--header-gap) * 3);
}
.side-panel h2 { font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
.split-panel-title { font-size: 1.25rem; margin-bottom: 18px; }

.split-tabs { display: flex; gap: 8px; margin-bottom: 22px; }
.split-tab {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 6px; border: 1.5px solid var(--border); border-radius: 14px;
  background: var(--surface-solid); cursor: pointer; font-family: var(--font-body);
  font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); text-align: center;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.split-tab:hover { border-color: var(--border-strong); }
.split-tab.is-active { border-color: var(--tone-a); background: var(--tone-tint); color: var(--ink); }
.split-tab__icon {
  position: relative; width: 34px; height: 34px; display: flex; align-items: center;
  justify-content: center; font-size: 1.3rem; color: var(--ink-faint);
}
.split-tab.is-active .split-tab__icon { color: var(--tone-a); }
.split-tab__badge {
  position: absolute; top: -6px; right: -8px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--tone-a); color: #fff; display: none; align-items: center; justify-content: center; font-size: 0.6rem;
}
.split-tab.is-active .split-tab__badge { display: flex; }

.split-config { margin-bottom: 6px; }

.toggle-pair { display: flex; gap: 8px; margin-bottom: 16px; }
.toggle-pair__btn {
  flex: 1; padding: 11px 10px; border-radius: var(--radius-sm); border: 1.5px solid var(--border-strong);
  background: var(--surface-solid); font-family: var(--font-body); font-weight: 600; font-size: 0.86rem;
  cursor: pointer; color: var(--ink);
}
.toggle-pair__btn.is-active { border-color: var(--tone-a); background: var(--tone-tint); color: var(--ink); }

.info-box {
  display: flex; gap: 10px; align-items: flex-start; background: var(--tone-tint);
  border-radius: var(--radius-sm); padding: 12px 14px; font-size: 0.85rem; color: var(--ink); margin-top: 6px;
}
.info-box i { color: var(--tone-a); margin-top: 2px; flex-shrink: 0; }

.filename-details { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; }
.filename-details summary { cursor: pointer; font-weight: 600; font-size: 0.85rem; color: var(--ink-soft); list-style: none; }
.filename-details summary::-webkit-details-marker { display: none; }
.filename-details summary::after { content: '+'; float: right; color: var(--tone-a); }
.filename-details[open] summary::after { content: '\2212'; }

.position-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 132px; margin: 8px 0 4px; }
.position-grid__dot {
  width: 100%; aspect-ratio: 1; border-radius: 10px; border: 1.5px solid var(--border-strong);
  background: var(--surface-solid); cursor: pointer; padding: 0;
}
.position-grid__dot:hover { border-color: var(--tone-a); }
.position-grid__dot.is-active { background: linear-gradient(135deg, var(--tone-a), var(--tone-b)); border-color: var(--tone-a); }

.compress-stats { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 10px 0; }
.compress-stats__item { display: flex; flex-direction: column; gap: 4px; }
.compress-stats__label { font-size: 0.78rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.04em; }
.compress-stats__value { font-size: 1.3rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.compress-stats__value--accent { color: var(--tone-a); }
.compress-stats__arrow { color: var(--ink-faint); font-size: 1.2rem; }
.compress-stats__badge {
  margin-left: auto; background: var(--success-tint); color: var(--success); font-weight: 700;
  padding: 8px 16px; border-radius: var(--radius-pill); font-size: 0.95rem;
}

.field-label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 8px; }
.option-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.option-card {
  display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--border); border-radius: 14px;
  padding: 12px 14px; cursor: pointer; background: var(--surface-solid);
}
.option-card:has(input:checked) { border-color: var(--tone-a); background: var(--tone-tint); }
.option-card input { margin-top: 3px; accent-color: var(--tone-a); }
.option-card strong { display: block; font-size: 0.92rem; }
.option-card span.sub { font-size: 0.8rem; color: var(--ink-faint); }

.form-control {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 0.92rem; background: var(--surface-solid); color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:focus { outline: none; border-color: var(--tone-a); box-shadow: 0 0 0 4px var(--tone-tint); }
.form-help { font-size: 0.8rem; color: var(--ink-faint); margin-top: 6px; }
.form-error { font-size: 0.8rem; color: var(--danger); margin-top: 6px; }

.preview-box {
  background: var(--surface-muted); border: 1px dashed var(--border-strong); border-radius: 10px;
  padding: 10px 12px; font-family: var(--font-code); font-size: 0.78rem; word-break: break-all;
}

.panel-footer { border-top: 1px solid var(--border); margin-top: 18px; padding-top: 18px; }

.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button {
  width: 36px; height: 36px; border-radius: 10px; border: 1.5px solid var(--border-strong);
  background: var(--surface-solid); font-size: 1.1rem; cursor: pointer; color: var(--ink);
}
.stepper button:hover { border-color: var(--tone-a); color: var(--tone-a); }
.stepper input { width: 64px; text-align: center; }

/* Merge-specific file list */
.file-list { display: flex; flex-direction: column; gap: 10px; }
.file-row {
  display: flex; align-items: center; gap: 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; cursor: grab;
  box-shadow: var(--shadow-sm);
}
.file-row.is-dragging { opacity: 0.4; }
.file-row__handle { color: var(--ink-faint); }
.file-row__thumb { width: 34px; height: 46px; background: var(--surface-muted); border-radius: 6px; flex-shrink: 0; overflow: hidden; }
.file-row__thumb canvas { width: 100%; height: 100%; object-fit: contain; }
.file-row__name { font-weight: 600; font-size: 0.9rem; word-break: break-all; }
.file-row__sub { font-size: 0.78rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.file-row__remove {
  margin-left: auto; color: var(--danger); background: var(--danger-tint); border: 1px solid transparent;
  cursor: pointer; font-size: 1rem; width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.file-row__remove:hover { border-color: var(--danger); }
/* Organize PDF: page cards with rotate/delete actions, draggable (SortableJS) */
.organizer-card { cursor: grab; width: 160px; }
.organizer-card .thumb-card__canvas-wrap { display: flex; align-items: center; justify-content: center; }
.organizer-card .thumb-card__canvas-wrap canvas { width: 100%; height: 100%; object-fit: contain; transition: transform 0.15s ease; }
.organizer-card__actions { display: flex; justify-content: center; gap: 6px; margin-top: 6px; }
.organizer-card__btn {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border-strong);
  background: var(--surface-solid); color: var(--ink-soft); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.organizer-card__btn:hover { border-color: var(--tone-a); color: var(--tone-a); }
.organizer-card__btn--danger:hover { border-color: var(--danger); color: var(--danger); }
.organizer-grid .sortable-ghost { opacity: 0.35; }
.organizer-grid .sortable-chosen { box-shadow: 0 0 0 4px var(--tone-tint), var(--shadow-md); }

/* Sign PDF */
.sign-page-indicator { font-size: 0.88rem; font-weight: 600; color: var(--ink-soft); padding: 0 6px; align-self: center; font-variant-numeric: tabular-nums; }
.sign-viewer { position: relative; max-width: 100%; margin: 0 auto; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-md); background: #fff; }
.sign-viewer canvas { display: block; max-width: 100%; }
/* No touch-action here: on phones the page fills the screen and must still
   scroll with a swipe (a tap still places a signature). Only the draggable
   boxes below block panning. */
.sign-overlay { position: absolute; inset: 0; }
.sign-viewer.is-placing .sign-overlay { cursor: crosshair; }
.sig-box { position: absolute; border: 1.5px dashed var(--tone-a); border-radius: 6px; cursor: move; touch-action: none; background: color-mix(in srgb, var(--tone-a) 5%, transparent); }
.sig-box img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; user-select: none; }
.sig-box__remove {
  position: absolute; top: -12px; right: -12px; width: 24px; height: 24px; border-radius: 50%;
  border: 0; background: var(--danger); color: #fff; cursor: pointer; font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm);
}
.sig-box__handle {
  position: absolute; right: -7px; bottom: -7px; width: 16px; height: 16px; border-radius: 4px;
  background: var(--tone-a); border: 2px solid #fff; cursor: nwse-resize; touch-action: none;
}
.sign-pad {
  display: block; width: 100%; aspect-ratio: 1 / 0.42; background: #fff; cursor: crosshair;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-sm); touch-action: none;
}
.sign-pad__bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.sign-fonts { display: flex; flex-direction: column; gap: 6px; }
.sign-font {
  text-align: left; padding: 8px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-solid); font-size: 1.7rem; line-height: 1.3; cursor: pointer;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.sign-font.is-active { border-color: var(--tone-a); background: var(--tone-tint); }
.sign-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: -1px; margin-right: 4px; }
.sign-upload-preview { display: block; max-width: 100%; max-height: 90px; margin: 8px auto 0; background: repeating-conic-gradient(#f3f4f6 0% 25%, #fff 0% 50%) 50% / 12px 12px; border-radius: 6px; }
#useSignatureBtn { margin-top: 14px; }
/* Phones: create the signature first, then place it on the page below */
@media (max-width: 900px) { .workspace-grid--sign > .side-panel { order: -1; position: static; } }

/* Row action buttons grouped on the right so they line up in every row */
.file-row__actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.file-row__actions .file-row__remove { margin-left: 4px; }
.file-row > div:nth-child(3) { min-width: 0; }

/* OCR result */
.ocr-lang { margin-bottom: 20px; }
.ocr-result {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; margin-top: 24px; box-shadow: var(--shadow-md);
}
.ocr-result__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; gap: 10px; }
.ocr-result textarea {
  width: 100%; min-height: 260px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 14px; font-family: var(--font-code); font-size: 0.88rem; color: var(--ink); background: var(--surface-solid);
  resize: vertical;
}
.ocr-page-tab {
  display: inline-block; padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-pill);
  font-size: 0.78rem; margin-right: 6px; margin-bottom: 8px; cursor: pointer; font-variant-numeric: tabular-nums;
}
.ocr-page-tab.is-active { background: var(--tone-a); color: #fff; border-color: var(--tone-a); }

/* ---------------------------------- Loading / toast -------------------- */
.overlay {
  position: fixed; inset: 0; background: rgba(17, 24, 39, 0.45);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px;
}
.overlay.is-hidden { display: none; }
.overlay__card {
  background: var(--surface-solid); border-radius: var(--radius-lg); padding: 32px 36px; text-align: center;
  max-width: 360px; box-shadow: var(--shadow-lg);
}
.spinner {
  width: 42px; height: 42px; margin: 0 auto 16px; border-radius: 50%;
  border: 3px solid #E0E7FF; border-top-color: var(--brand-1); border-right-color: var(--brand-2);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast-stack { position: fixed; bottom: 20px; right: 20px; left: 20px; z-index: 1100; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; pointer-events: none; }
.toast {
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; max-width: 420px;
  font-size: 0.9rem; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px;
  animation: toast-in 0.2s ease; pointer-events: auto;
}
.toast--danger { background: var(--danger); }
.toast--success { background: var(--success); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------------------------------- Footer ------------------------------ */
.site-footer {
  margin-top: 72px; padding: 48px 0 0;
  background: rgba(255, 255, 255, 0.6); border-top: 1px solid var(--border);
}
.site-footer__inner { display: flex; justify-content: space-between; gap: 40px; flex-wrap: wrap; padding-bottom: 32px; }
.site-footer__brand { max-width: 300px; }
.site-footer__brand strong { font-family: var(--font-display); font-size: 1.2rem; font-weight: 800; letter-spacing: -0.02em; }
.site-footer__brand p { font-size: 0.88rem; margin-top: 6px; }
.site-footer__cols { display: flex; gap: 60px; flex-wrap: wrap; }
.site-footer__cols h3 { font-family: var(--font-body); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); margin-bottom: 12px; }
.site-footer__cols ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.site-footer__cols a { color: var(--ink-soft); font-size: 0.9rem; }
.site-footer__cols a:hover { color: var(--brand-ink); }
.site-footer__legal { border-top: 1px solid var(--border); padding: 16px 24px; font-size: 0.8rem; color: var(--ink-faint); text-align: center; }

/* Utility */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- page numbers */
.pn-stage { display: flex; flex-direction: column; align-items: center; }
.pn-stage .form-help { align-self: flex-start; }
.pn-preview { position: relative; display: inline-block; max-width: 100%; line-height: 0; }
.pn-preview canvas {
  display: block; max-width: 100%; height: auto; border-radius: 6px;
  box-shadow: var(--shadow-md); border: 1px solid var(--border); background: #fff;
}
.pn-marker {
  position: absolute; line-height: 1.2; padding: 2px 8px; border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--tone-a), var(--tone-b)); color: #fff;
  font-size: 0.78rem; font-weight: 700; white-space: nowrap; pointer-events: none;
}
.pn-marker--top-left { top: 6%; left: 6%; }
.pn-marker--top-center { top: 6%; left: 50%; transform: translateX(-50%); }
.pn-marker--top-right { top: 6%; right: 6%; }
.pn-marker--bottom-left { bottom: 6%; left: 6%; }
.pn-marker--bottom-center { bottom: 6%; left: 50%; transform: translateX(-50%); }
.pn-marker--bottom-right { bottom: 6%; right: 6%; }
.pn-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------------------------------------------------------------- image batch tools */
.file-row__img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-row__result { font-size: 0.8rem; font-weight: 600; color: var(--success); margin-top: 2px; }
.file-row__result.is-kept { color: var(--ink-faint); font-weight: 500; }
.range-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.range-row input[type="range"] { flex: 1; accent-color: var(--tone-a); }
.range-row output { min-width: 3.2em; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.size-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check-row { display: flex; gap: 8px; align-items: center; font-size: 0.88rem; margin: 6px 0; }
.check-row input { accent-color: var(--tone-a); }
