/* ============================================================
   PDFKaj — professional design system
   Brand red on a cool neutral canvas, generous spacing, soft depth
   ============================================================ */

:root {
  --brand: #e11927;
  --brand-dark: #b40f1b;
  --brand-soft: #fdecec;
  --brand-ring: rgba(225, 25, 39, 0.16);

  --ink: #0d1017;
  --ink-2: #2c3240;
  --muted: #5d6675;
  --muted-2: #838b98;
  --line: #e6e8ec;
  --line-strong: #d3d7de;
  --bg: #f6f7f9;
  --bg-tint: #eef0f4;
  --card: #ffffff;
  --dark: #101319;

  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;

  --shadow-xs: 0 1px 2px rgba(13, 16, 23, 0.05);
  --shadow-sm: 0 2px 6px rgba(13, 16, 23, 0.06);
  --shadow-md: 0 12px 28px rgba(13, 16, 23, 0.09);
  --shadow-lg: 0 24px 60px rgba(13, 16, 23, 0.12);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --container: 1160px;
  --header-h: 72px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.18;
  letter-spacing: -0.022em;
  font-weight: 800;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 6px;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

/* Moved out of the way with a transform rather than `left: -9999px`.
   An off-canvas horizontal offset becomes scrollable overflow in the
   right-to-left languages, which gave /ar/, /fa/ and /ur/ a ~10,000px wide
   empty area to pan into — the page looked blank on a phone. */
.skip-link {
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  transform: translateY(-150%);
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-end-end-radius: var(--radius-xs);
  z-index: 100;
  transition: transform 0.15s ease;
}
.skip-link:focus { transform: translateY(0); }

/* ============================ Header ============================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 850;
  font-size: 19px;
  letter-spacing: -0.03em;
  flex: none;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--brand);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 850;
  letter-spacing: 0;
  box-shadow: 0 6px 14px var(--brand-ring);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.site-nav a {
  position: relative;
  padding: 9px 12px;
  border-radius: var(--radius-xs);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink-2);
  transition: color 0.15s ease, background 0.15s ease;
}
.site-nav a:hover { color: var(--ink); background: var(--bg-tint); }
.site-nav a[aria-current="page"] { color: var(--brand); }

/* Header dropdown menus */
.nav-menu { position: relative; }
.nav-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  border: 0;
  background: none;
  border-radius: var(--radius-xs);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.nav-menu-btn:hover { color: var(--ink); background: var(--bg-tint); }
.nav-menu-btn .caret { font-size: 10px; color: var(--muted-2); transition: transform 0.15s ease; }
.nav-menu.open .nav-menu-btn .caret { transform: rotate(180deg); }
.nav-menu.open .nav-menu-btn { color: var(--brand); background: var(--brand-soft); }

.nav-menu-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 70;
  display: none;
  grid-template-columns: repeat(2, 224px);
  gap: 4px 16px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.nav-menu.open .nav-menu-panel { display: grid; }
.nav-menu-group { min-width: 0; }
.nav-menu-title {
  margin: 8px 0 6px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.nav-menu-panel a {
  display: block;
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}
.nav-menu-panel a:hover { color: var(--brand-dark); background: var(--brand-soft); }
.nav-menu-panel .nav-menu-all {
  grid-column: 1 / -1;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  border-radius: 0;
  text-align: center;
  color: var(--brand);
  font-weight: 700;
}

/* Compression level presets */
.preset-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.preset-select {
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  background: #fff;
  font-size: 13.5px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
}
.preset-chips { margin-top: 12px; }
.preset-hints {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 13px;
}
.preset-hints li { margin: 3px 0; }


.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.lang-select {
  appearance: none;
  padding: 9px 34px 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  background: #fff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235d6675' d='M6 8.5 1.8 4.3l1-1L6 6.5l3.2-3.2 1 1z'/%3E%3C/svg%3E")
    no-repeat right 11px center;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
}
.lang-select:hover { border-color: var(--muted-2); }

/* Mobile drawer backdrop + close button, injected by wireMenu(). */
.nav-scrim,
.nav-drawer-close { display: none; }

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  background: #fff;
  cursor: pointer;
  padding: 11px 10px;
  flex-direction: column;
  justify-content: space-between;
}
.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================ Buttons ============================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 13px 22px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease,
    box-shadow 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 10px 22px var(--brand-ring);
}
.btn-primary:hover { background: var(--brand-dark); transform: translateY(-1px); }

.btn-ghost {
  background: #fff;
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn-ghost:hover { border-color: var(--ink-2); transform: translateY(-1px); }

.btn-dark { background: var(--dark); color: #fff; }
.btn-dark:hover { background: #000; transform: translateY(-1px); }

.btn-lg { padding: 15px 28px; font-size: 16px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* ============================ Hero ============================ */
.hero {
  position: relative;
  overflow: hidden;
  padding: 84px 0 64px;
  background:
    radial-gradient(50% 60% at 15% 0%, rgba(225, 25, 39, 0.09), transparent 70%),
    radial-gradient(45% 55% at 90% 10%, rgba(16, 19, 25, 0.07), transparent 70%),
    linear-gradient(180deg, #ffffff, var(--bg));
  border-bottom: 1px solid var(--line);
}

.hero-inner { max-width: 880px; margin: 0 auto; text-align: center; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 15px;
  border: 1px solid #f3c4c8;
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1 {
  font-size: clamp(38px, 5.6vw, 64px);
  letter-spacing: -0.035em;
  margin: 22px 0 18px;
}
.hero h1 em { font-style: normal; color: var(--brand); }

.hero .lead {
  max-width: 660px;
  margin: 0 auto;
  font-size: 18.5px;
  color: var(--muted);
}

.hero-cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 30px;
}

.hero-chips {
  display: flex;
  gap: 18px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 34px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
}
.hero-chips span { display: inline-flex; align-items: center; gap: 7px; }

/* ============================ Sections ============================ */
.section { padding: 72px 0; }
.section.tight { padding: 52px 0; }
.section.alt { background: var(--bg-tint); border-block: 1px solid var(--line); }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.section-title { font-size: clamp(26px, 3vw, 34px); }
.section-sub { margin: 8px 0 0; color: var(--muted); font-size: 15.5px; }

/* How it works */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.step {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow-xs);
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  margin-bottom: 16px;
}
.step h3 { font-size: 17px; margin-bottom: 6px; }
.step p { margin: 0; color: var(--muted); font-size: 14.5px; }

/* Trust strip */
.trust-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.trust {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-xs);
}
.trust-badge {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--brand-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
}
.trust strong { display: block; font-size: 15px; }
.trust span { color: var(--muted); font-size: 14px; }
.trust-link {
  display: inline-block;
  margin-top: 9px;
  font-size: 14px;
  font-weight: 700;
  color: var(--brand);
}
.trust-link:hover { text-decoration: underline; }
.trust-list {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}
.trust-list li {
  position: relative;
  padding-left: 28px;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.6;
}
.trust-list li::before {
  content: '✓';
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  color: var(--brand);
  font-weight: 800;
}

/* ============================ Reduced motion ============================ */
/* Nothing on this site animates for its own sake, so the few transitions and
   the mobile drawer are simply switched off when asked. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================ Tool cards ============================ */
.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.search {
  min-width: 250px;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  background: #fff;
  font-size: 14.5px;
}
.search:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 999px;
  padding: 10px 17px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s ease;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  min-height: 216px;
  box-shadow: var(--shadow-xs);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.tool-card:hover {
  transform: translateY(-4px);
  border-color: #f2b6ba;
  box-shadow: var(--shadow-md);
}
.tool-card[hidden] { display: none; }

.tool-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tool-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
}
.pill {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 5px 11px;
}
.tool-card h3 { margin: 20px 0 7px; font-size: 17.5px; }
.tool-card p { margin: 0 0 18px; color: var(--muted); font-size: 14.5px; flex: 1; }
.tool-link { font-size: 14px; font-weight: 700; color: var(--brand); display: inline-flex; gap: 6px; align-items: center; }
.tool-card:hover .tool-link { text-decoration: underline; }

/* ============================ Popular actions ============================ */
.popular-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 26px;
}
.popular-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-xs);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.popular-card:hover {
  transform: translateY(-3px);
  border-color: #f2b6ba;
  box-shadow: var(--shadow-md);
}
.popular-name { font-weight: 700; font-size: 15.5px; line-height: 1.35; }
.popular-go { font-size: 13.5px; font-weight: 700; color: var(--brand); }
.popular-card:hover .popular-go { text-decoration: underline; }
.section-sub.center { margin-inline: auto; max-width: 640px; }

/* Anchored sections must clear the sticky header. */
#popular, #tools, #languages { scroll-margin-top: calc(var(--header-h) + 16px); }

/* The drop zone is a label wrapping a real file input, so it also lights up
   when that input is reached with the keyboard. */
.drop:focus-within { border-color: var(--brand); background: #fffafa; }

/* A failed run should not look like a neutral status line. */
.status.is-error { color: #b3261e; }

.empty-state {
  grid-column: 1 / -1;
  padding: 44px;
  text-align: center;
  color: var(--muted);
  background: var(--card);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

/* ============================ FAQ ============================ */
.faq { max-width: 860px; margin: 0 auto; }
.faq-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  overflow: hidden;
}
.faq-item summary {
  cursor: pointer;
  padding: 18px 22px;
  font-weight: 700;
  font-size: 15.5px;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-size: 20px;
  font-weight: 700;
  color: var(--muted);
  transition: transform 0.2s ease;
}
.faq-item[open] summary::after { transform: rotate(45deg); color: var(--brand); }
.faq-item p { margin: 0; padding: 0 22px 20px; color: var(--muted); font-size: 14.5px; }

/* ============================ CTA band ============================ */
.cta-band {
  background: var(--dark);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 48px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.cta-band h2 { font-size: clamp(24px, 3vw, 32px); }
.cta-band p { color: rgba(255, 255, 255, 0.72); max-width: 560px; margin: 12px auto 26px; }

/* ============================ Tool page ============================ */
.page-shell { padding: 40px 0 84px; }

.crumbs {
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 22px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.crumbs a:hover { color: var(--brand); }
.crumbs span { color: var(--muted-2); }

.page-hero { max-width: 780px; margin-bottom: 30px; }
.page-hero h1 { font-size: clamp(30px, 4.2vw, 44px); margin: 16px 0 12px; }
.page-hero .lead { margin: 0; color: var(--muted); font-size: 17.5px; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.drop {
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fcfdff, #f8f9fb);
  padding: 46px 24px;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.drop:hover, .drop.dragover { border-color: var(--brand); background: #fffafa; }
.drop input[type="file"] { display: none; }
.drop label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 13px 22px;
  font-weight: 700;
  font-size: 14.5px;
  cursor: pointer;
  box-shadow: 0 10px 20px var(--brand-ring);
  transition: background 0.15s ease, transform 0.15s ease;
}
.drop label:hover { background: var(--brand-dark); transform: translateY(-1px); }
.drop p { margin: 14px 0 0; color: var(--muted); font-size: 13.5px; }

.hint { margin: 14px 0 0; font-size: 13.5px; color: var(--ink-2); font-weight: 600; word-break: break-word; }

/* ---- Selected files panel ----
   Built by src/tool-runtime.js on top of the #fileNames line every tool page
   ships, so the markup stays in one place instead of 29 duplicated panels. */
.drop.has-files { border-style: solid; border-color: var(--brand); background: #fffafa; }
.drop.has-files label { background: var(--ink); box-shadow: none; }

.filepick { margin-top: 16px; }
.filepick .hint { margin-top: 0; }

.file-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow-sm);
}
.file-badge {
  flex: none;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.file-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-size { flex: none; color: var(--muted); font-size: 13px; font-weight: 600; }
.file-remove {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.file-remove:hover { background: #b3261e; border-color: #b3261e; color: #fff; }

.filepick-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.ghost {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  border-radius: var(--radius-xs);
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.ghost:hover { border-color: var(--brand); background: #fffafa; }
.ghost[hidden] { display: none; }

/* The offline notice, shown once the service worker has cached the shell. */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 60;
  background: var(--dark);
  color: #fff;
  padding: 13px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  max-width: min(92vw, 520px);
  text-align: center;
}
.toast[hidden] { display: none; }

.opts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}
.opts label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}
.opts input, .opts select {
  width: 100%;
  margin-top: 7px;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  background: #fff;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
}
.opts input:focus, .opts select:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

.action-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 24px; }

.run {
  border: 0;
  background: var(--brand);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 14px 26px;
  font-size: 15.5px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 24px var(--brand-ring);
  transition: background 0.15s ease, transform 0.15s ease;
}
.run:hover { background: var(--brand-dark); transform: translateY(-1px); }
.run:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.status { margin: 0; color: var(--ink-2); font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.status.is-warning { color: #8a4b00; background: #fff4db; border: 1px solid #f0d18a; border-radius: 8px; padding: 10px 12px; }
.status.is-error { overflow-wrap: anywhere; }

.result { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }

.download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--dark);
  color: #fff;
  border-radius: var(--radius-xs);
  padding: 12px 18px;
  font-weight: 700;
  font-size: 14px;
  transition: background 0.15s ease, transform 0.15s ease;
}
.download:hover { background: #000; transform: translateY(-1px); }

.textout {
  width: 100%;
  min-height: 300px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  padding: 16px;
  font: 13.5px/1.65 var(--mono);
  resize: vertical;
  color: var(--ink);
  background: #fff;
}

/* Content blocks */
.content {
  margin-top: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px;
  box-shadow: var(--shadow-xs);
}
.content h2 { font-size: 20px; margin: 28px 0 10px; }
.content h2:first-child { margin-top: 0; }
.content p { color: var(--ink-2); }
.content p:last-child { margin-bottom: 0; }
.content code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--bg-tint);
  padding: 2px 6px;
  border-radius: 5px;
}
.content ol, .content ul { color: var(--ink-2); padding-left: 22px; }
.content li { margin: 7px 0; }

.note {
  background: var(--brand-soft);
  border: 1px solid #f2c7c9;
  border-radius: var(--radius-xs);
  padding: 15px 18px;
  font-size: 14px;
  color: #7c1d21;
  margin-top: 20px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 18px;
}
.related-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  font-weight: 700;
  font-size: 14.5px;
  transition: border-color 0.15s ease, transform 0.15s ease, color 0.15s ease;
}
.related-link:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-2px); }

/* ============================ Footer ============================ */
.site-footer {
  margin-top: 40px;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 56px 0 26px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 36px;
}
.footer-brand p { margin: 14px 0 0; color: var(--muted); font-size: 14px; max-width: 320px; }
.site-footer h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-2);
  margin-bottom: 14px;
}
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 9px; }
.site-footer ul a { color: var(--ink-2); font-size: 14px; font-weight: 500; }
.site-footer ul a:hover { color: var(--brand); }
.footer-bottom {
  margin-top: 40px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

/* ===================== Language picker, grid & suggestion ===================== */
.lang-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}
.lang-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  font-weight: 650;
  font-size: 15px;
  line-height: 1.35;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.lang-link span { color: var(--muted); font-size: 12px; font-weight: 500; }
.lang-link:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.lang-link.active { border-color: var(--brand); background: var(--brand-soft); }

.footer-langs { margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--line); }
.footer-langs > span { display: block; font-size: 11.5px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 12px; }
.footer-langs ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.footer-langs a { color: var(--muted); font-size: 13px; }
.footer-langs a:hover { color: var(--brand); }

.lang-suggest { background: var(--dark); color: #fff; }
.lang-suggest-inner { display: flex; align-items: center; gap: 14px; padding: 10px 0; flex-wrap: wrap; }
.lang-suggest p { margin: 0; font-size: 14.5px; font-weight: 550; }
.lang-suggest-icon { font-size: 18px; }
.lang-suggest-actions { display: flex; gap: 8px; margin-left: auto; }
.lang-suggest .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, .35); }
.lang-suggest .btn-ghost:hover { background: rgba(255, 255, 255, .12); border-color: #fff; }
.btn-sm { padding: 8px 16px; font-size: 14px; border-radius: var(--radius-xs); }
.section-title.center, h2.center { text-align: center; }

/* ============================ PDF editor ============================ */
.editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 22px;
}
.editor-grid:empty { display: none; }
.page-card {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.page-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background: var(--bg-tint);
  min-height: 150px;
}
.page-thumb img { max-height: 180px; width: auto; box-shadow: var(--shadow-sm); transition: transform .2s ease; }
.page-meta { padding: 9px 11px 11px; border-top: 1px solid var(--line); }
.page-num { display: block; font-size: 12.5px; font-weight: 700; }
.page-num small { display: block; color: var(--muted-2); font-size: 11px; font-weight: 500; }
.page-actions { display: flex; gap: 5px; margin-top: 8px; }
.page-actions button {
  flex: 1;
  min-width: 0;
  height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.page-actions button:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.page-actions button:disabled { opacity: .4; cursor: not-allowed; }

/* ===================== Page organizer ===================== */
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.editor-toolbar .hint { margin: 0; }
.editor-toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.page-card { cursor: grab; }
.page-card.dragging { opacity: .45; cursor: grabbing; }
.page-card.drop-before { box-shadow: -4px 0 0 0 var(--brand); }
.page-card.drop-after { box-shadow: 4px 0 0 0 var(--brand); }
.page-thumb.blank {
  width: 100%;
  max-height: 180px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  background: #fff;
}

/* ===================== PDF text editor ===================== */
 .pedit-bar {
  position: sticky;
  top: 8px;
  z-index: 30;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--card) 96%, transparent);
  box-shadow: 0 4px 14px rgba(0,0,0,.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding: 12px 14px;
  background: var(--bg-tint);
  border-radius: var(--radius-sm);
}
.pedit-bar-label {
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-inline-end: 4px;
}
.pedit-bar .chip { padding: 8px 15px; }

.pedit-options {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 2fr;
  gap: 14px;
  margin-top: 16px;
}
.pedit-options label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}
.pedit-options input[type="text"],
.pedit-options input[type="number"],
.pedit-options input[type="file"] {
  width: 100%;
  margin-top: 7px;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  background: #fff;
  font-size: 14.5px;
  font-weight: 500;
}
.pedit-options input[type="color"] {
  width: 100%;
  height: 42px;
  margin-top: 7px;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  background: #fff;
  cursor: pointer;
}
.opts-check {
  display: flex !important;
  align-items: center;
  gap: 9px;
  align-self: end;
  padding: 11px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}
.opts-check input { width: 17px; height: 17px; accent-color: var(--brand); margin: 0; }

 .pedit-hint-row {
  position: sticky;
  top: 64px;
  z-index: 29;
  padding: 8px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--card) 96%, transparent);
  box-shadow: 0 3px 12px rgba(0,0,0,.07);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.pedit-hint {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
}
.pedit-hint.is-text, .pedit-hint.is-image, .pedit-hint.is-erase { color: var(--brand); }
.pedit-hint-row .editor-toolbar-actions { margin-left: 0; }

.pedit-pages { display: grid; gap: 22px; margin-top: 20px; }
.pedit-pages:empty { display: none; }
.pe-page {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.pe-page-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-tint);
  font-size: 13px;
  font-weight: 700;
}
.pe-page-size { color: var(--muted-2); font-weight: 500; }
.pe-stage {
  position: relative;
  line-height: 0;
  background: var(--bg-tint);
  touch-action: none;
  user-select: none;
  cursor: default;
}
.pe-stage:has(.pe-item) { cursor: grab; }
.pe-bg { width: 100%; height: auto; }
.pe-item {
  position: absolute;
  line-height: 1.25;
  white-space: pre;
  cursor: grab;
}
.pe-item:focus { outline: 2px solid var(--brand); }
.pe-text { transform: translateY(-6%); }
.pe-image img { width: 100%; height: 100%; object-fit: contain; }
.pe-erase { background: #fff; border: 1px dashed rgba(225, 25, 39, .55); cursor: crosshair; }
.pe-item.is-selected { outline: 1.5px solid var(--brand); outline-offset: 1px; }
.pe-handle {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--brand);
  box-shadow: 0 0 0 2px #fff;
  cursor: nwse-resize;
}
.pe-text:not(.is-selected) .pe-handle,
.pe-image:not(.is-selected) .pe-handle { display: none; }

/* ===================== SEO copy blocks ===================== */
.seo-copy h2 { margin-bottom: 12px; }
.seo-links { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; }
.seo-links a { color: var(--brand); font-weight: 600; font-size: 14.5px; }
.seo-links a:hover { text-decoration: underline; }

/* ============================ RTL support ============================ */
[dir="rtl"] body { text-align: right; }
[dir="rtl"] .site-nav a { letter-spacing: 0; }
[dir="rtl"] .lang-suggest-actions { margin-left: 0; margin-right: auto; }
[dir="rtl"] .footer-bottom { flex-direction: row-reverse; }

/* ============================ Responsive ============================ */
@media (max-width: 1024px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  .related-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .steps-grid { grid-template-columns: 1fr; }
  .nav-toggle { display: flex; }
  body.nav-open { overflow: hidden; }

  /* Mobile header: menu button on the left, logo centred, language on the right.
     The two side columns are equal, so the brand lands dead centre. */
  .header-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
  }
  .header-actions { display: contents; }
  .nav-toggle { grid-column: 1; justify-self: start; }
  .brand { grid-column: 2; justify-self: center; }
  .lang-select { grid-column: 3; justify-self: end; max-width: 100%; }

  /* Backdrop behind the drawer — closes the menu when tapped. */
  .nav-scrim {
    display: block;
    position: absolute;
    top: 100%;
    inset-inline: 0;
    height: calc(100vh - var(--header-h));
    height: calc(100dvh - var(--header-h));
    background: rgba(13, 16, 23, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
  }
  body.nav-open .nav-scrim { opacity: 1; visibility: visible; }

  /* Left-side drawer menu (anchored to the inline start, so RTL mirrors). */
  .site-nav {
    position: absolute;
    top: 100%;
    inset-inline-start: 0;
    z-index: 5;
    display: none;
    width: min(84vw, 320px);
    max-width: 100%;
    max-height: calc(100vh - var(--header-h));
    max-height: calc(100dvh - var(--header-h));
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 10px 12px calc(24px + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-inline-end: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  body.nav-open .site-nav { display: flex; animation: nav-drawer-in 0.24s ease both; }
  [dir="rtl"] body.nav-open .site-nav { animation-name: nav-drawer-in-rtl; }
  @keyframes nav-drawer-in { from { transform: translateX(-100%); } to { transform: none; } }
  @keyframes nav-drawer-in-rtl { from { transform: translateX(100%); } to { transform: none; } }

  .nav-drawer-close {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 40px;
    height: 40px;
    margin: 0 0 6px auto;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-xs);
    background: #fff;
    font-size: 18px;
    line-height: 1;
    color: var(--ink-2);
    cursor: pointer;
  }
  [dir="rtl"] .nav-drawer-close { margin: 0 auto 6px 0; }
  .nav-drawer-close:hover { color: var(--brand); border-color: var(--brand-ring); background: var(--brand-soft); }

  .site-nav a { padding: 13px 12px; font-size: 15.5px; }
  .nav-menu { position: static; width: 100%; }
  .nav-menu-btn { width: 100%; justify-content: space-between; padding: 13px 12px; font-size: 15.5px; }

  /* Dropdowns expand in place below their button, inside the drawer. */
  .nav-menu-panel {
    position: static;
    display: none;
    grid-template-columns: 1fr;
    gap: 2px;
    width: 100%;
    padding: 4px 0 8px;
    background: none;
    border: 0;
    box-shadow: none;
  }
  .nav-menu.open .nav-menu-panel { display: grid; }
  .nav-menu-panel a { padding: 10px 12px; font-size: 14.5px; border-radius: var(--radius-xs); }
  .nav-menu-title { margin: 12px 0 2px; padding: 0 12px; }
  .nav-menu-panel .nav-menu-all { margin-top: 4px; padding-top: 10px; }
}

@media (max-width: 700px) {
  .hero { padding: 56px 0 44px; }
  .section { padding: 52px 0; }
  .opts { grid-template-columns: 1fr; }
  .panel, .content { padding: 20px; }
  .cta-band { padding: 32px 22px; }
  .search { min-width: 0; width: 100%; }
  .section-head { align-items: stretch; }
}

@media (max-width: 1024px) {
  .lang-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 700px) {
  .lang-grid { grid-template-columns: repeat(3, 1fr); }
  .editor-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .pedit-options { grid-template-columns: 1fr 1fr; }
  .editor-toolbar-actions { margin-left: 0; }
}

@media (max-width: 560px) {
  .lang-grid { grid-template-columns: repeat(2, 1fr); }
  .container { padding: 0 18px; }
  .header-inner { gap: 8px; }
  .lang-select { padding: 8px 26px 8px 10px; font-size: 12.5px; }
  .brand { gap: 8px; font-size: 18px; }
  .grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 34px; }
  .tool-card { min-height: 0; }
  .filters { width: 100%; }
}


/* ===================== 2026 visual refresh ===================== */
/* A calm, app-like surface system: stronger hierarchy, cleaner cards and
   higher-contrast controls without changing the site's existing markup. */
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

:root {
  --bg: #f4f6f8;
  --bg-tint: #edf0f3;
  --card: #ffffff;
  --line: #e1e5ea;
  --line-strong: #cbd1d9;
  --ink: #0b0e14;
  --ink-2: #303746;
  --muted: #667080;
  --muted-2: #8b94a2;
  --shadow-xs: 0 1px 2px rgba(13,16,23,.04);
  --shadow-sm: 0 6px 18px rgba(13,16,23,.06);
  --shadow-md: 0 18px 42px rgba(13,16,23,.10);
  --shadow-lg: 0 28px 70px rgba(13,16,23,.16);
}

html[data-theme="dark"] {
  --brand: #ff5662;
  --brand-dark: #ff737c;
  --brand-soft: rgba(255,86,98,.12);
  --brand-ring: rgba(255,86,98,.22);
  --ink: #f4f6f8;
  --ink-2: #d3d8e1;
  --muted: #a5adba;
  --muted-2: #7f8998;
  --line: #2b313b;
  --line-strong: #414956;
  --bg: #0e1117;
  --bg-tint: #171b23;
  --card: #151922;
  --dark: #f4f6f8;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.25);
  --shadow-sm: 0 8px 22px rgba(0,0,0,.24);
  --shadow-md: 0 20px 44px rgba(0,0,0,.32);
  --shadow-lg: 0 30px 80px rgba(0,0,0,.42);
}

body { transition: background-color .2s ease, color .2s ease; }

.site-header {
  background: color-mix(in srgb, var(--card) 86%, transparent);
  border-bottom-color: var(--line);
}

.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.theme-toggle {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-2);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.theme-toggle:hover { transform: translateY(-1px); border-color: var(--brand); background: var(--brand-soft); }

.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 80% 15%, var(--brand-soft), transparent 34%),
    linear-gradient(180deg, var(--card), var(--bg));
}
.hero::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  right: -220px;
  bottom: -260px;
  border-radius: 50%;
  border: 1px solid var(--line);
  pointer-events: none;
}

.hero-inner { position: relative; z-index: 1; }
.hero h1 { max-width: 850px; font-size: clamp(42px, 6vw, 72px); letter-spacing: -.045em; }
.hero .lead { max-width: 720px; font-size: 18px; }
.hero-cta .btn { box-shadow: var(--shadow-sm); }
.hero-chips { gap: 9px; }
.hero-chips > span {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 82%, transparent);
  box-shadow: var(--shadow-xs);
  backdrop-filter: blur(8px);
}

.popular-card, .tool-card, .panel, .content, .related-link, .page-card, .pe-page {
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease, background-color .18s ease;
}
.popular-card, .tool-card {
  border-color: var(--line);
  box-shadow: var(--shadow-xs);
}
.popular-card:hover, .tool-card:hover {
  border-color: color-mix(in srgb, var(--brand) 45%, var(--line));
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}
.tool-card h3 { letter-spacing: -.028em; }
.tool-card p { color: var(--muted); }

.section.alt { background: var(--bg-tint); border-block: 1px solid var(--line); }

.panel {
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}
.drop {
  position: relative;
  min-height: 210px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 34px 24px 48px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--brand-soft) 28%, var(--card)), var(--card));
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.drop:hover, .drop:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 5px var(--brand-ring);
}
.drop label {
  padding: 13px 22px;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 10px 24px var(--brand-ring);
  font-weight: 800;
  cursor: pointer;
}
.drop > p { margin: 12px 0 0; color: var(--muted); }
.drop-privacy {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 24px);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
}
.drop-privacy strong { color: var(--ink-2); }

.file-row {
  background: var(--card);
  border-color: var(--line);
  box-shadow: var(--shadow-xs);
}
.file-remove, .ghost, .opts input, .opts select, .textout,
.page-actions button, .pedit-options input {
  background: var(--card);
  color: var(--ink);
  border-color: var(--line-strong);
}
.run { box-shadow: 0 12px 26px var(--brand-ring); }
.download { background: var(--brand); color: #fff; box-shadow: 0 10px 24px var(--brand-ring); }
.download:hover { background: var(--brand-dark); }

.status {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--bg-tint);
  color: var(--ink-2);
}

.note {
  background: var(--brand-soft);
  border-color: color-mix(in srgb, var(--brand) 28%, var(--line));
  color: var(--ink-2);
}

.lang-link, .related-link { background: var(--card); }
.nav-menu-panel {
  background: var(--card);
  border-color: var(--line);
  box-shadow: var(--shadow-lg);
}
.nav-menu-panel a:hover { background: var(--bg-tint); }

.site-footer { background: var(--card); border-top-color: var(--line); }
.footer-langs, .footer-bottom { border-top-color: var(--line); }

.crumbs { color: var(--muted); }
.page-hero { padding-bottom: 30px; }
.page-hero h1 { letter-spacing: -.04em; }

.opts {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-tint);
}
.opts label { color: var(--ink-2); }

.editor-grid { gap: 16px; }
.page-card { border-color: var(--line); }

@media (max-width: 700px) {
  .hero { padding-top: 62px; }
  .hero h1 { font-size: clamp(36px, 10vw, 50px); }
  .hero .lead { font-size: 16px; }
  .hero-cta { display: grid; grid-template-columns: 1fr; }
  .hero-cta .btn { width: 100%; justify-content: center; }
  .drop { min-height: 190px; padding-inline: 18px; }
  .drop label { width: min(100%, 290px); text-align: center; }
  .drop-privacy { font-size: 11.5px; }
  .opts { padding: 14px; }
  .action-row {
    position: sticky;
    bottom: 10px;
    z-index: 20;
    padding: 10px;
    margin-inline: -10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: color-mix(in srgb, var(--card) 92%, transparent);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-md);
  }
  .action-row .run { flex: 1 1 180px; }
  .status { flex: 1 1 100%; }
  .theme-toggle { width: 36px; height: 36px; }
}

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


/* Mobile header: keep menu, brand, language and theme control on one aligned row. */
@media (max-width: 860px) {
  .header-inner {
    position: relative;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto 36px;
    align-items: center;
    gap: 8px;
    min-height: 76px;
    height: auto;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .header-actions { display: contents; }
  .nav-toggle { grid-column: 1; grid-row: 1; justify-self: start; width: 40px; height: 40px; }
  .brand { grid-column: 2; grid-row: 1; justify-self: center; min-width: 0; gap: 7px; font-size: 18px; }
  .brand-mark { width: 34px; height: 34px; }
  .lang-select { grid-column: 3; grid-row: 1; justify-self: end; width: auto; min-width: 0; max-width: 112px; padding: 8px 23px 8px 8px; font-size: 12px; }
  .theme-toggle {
    position: static;
    grid-column: 4;
    grid-row: 1;
    justify-self: end;
    width: 36px;
    height: 36px;
    transform: none;
  }
  .theme-toggle:hover { transform: none; }
}
@media (max-width: 380px) {
  .header-inner { grid-template-columns: 38px minmax(0, 1fr) auto 32px; gap: 5px; }
  .nav-toggle { width: 36px; height: 36px; }
  .brand { font-size: 16px; gap: 5px; }
  .brand-mark { width: 30px; height: 30px; font-size: 13px; }
  .lang-select { max-width: 94px; font-size: 11px; }
  .theme-toggle { width: 32px; height: 32px; }
}/* Founder profile on the About page */
.founder-profile {
  display: flex;
  align-items: center;
  gap: 26px;
  margin: 0 auto 34px;
  padding: 24px;
  max-width: 850px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.founder-photo {
  display: block;
  flex: 0 0 180px;
  width: 180px;
  height: 180px;
  object-fit: cover;
  object-position: center 35%;
  border-radius: 18px;
  border: 1px solid var(--line);
}
.founder-details h2 { margin: 8px 0; }
.founder-details p { color: var(--muted); }
.founder-details .founder-role { color: var(--ink-2); font-weight: 700; }
@media (max-width: 600px) {
  .founder-profile { flex-direction: column; align-items: flex-start; gap: 16px; padding: 18px; }
  .founder-photo { width: 150px; height: 150px; flex-basis: 150px; }
}


/* Founder profile: left-aligned on desktop, centered and balanced on mobile. */
.founder-profile {
  margin-top: 12px;
  justify-content: flex-start;
  text-align: left;
}
.founder-details { min-width: 0; }
.founder-details .eyebrow { display: inline-flex; }
.founder-details h2 { line-height: 1.15; }
.founder-details p { line-height: 1.7; }
@media (max-width: 600px) {
  .founder-profile {
    align-items: center;
    text-align: center;
    gap: 14px;
    padding: 24px 20px;
  }
  .founder-photo {
    width: 156px;
    height: 156px;
    flex-basis: 156px;
    margin-inline: auto;
  }
  .founder-details { width: 100%; }
  .founder-details .eyebrow { justify-content: center; }
  .founder-details h2 { font-size: clamp(25px, 7vw, 30px); }
  .founder-details p { margin-inline: auto; }
}


/* Searchable language picker in the footer */
.footer-language-picker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  max-width: 620px;
}
.footer-language-picker input,
.footer-language-picker select {
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
}
.footer-language-picker input { flex: 1 1 210px; min-width: 150px; }
.footer-language-picker select { flex: 1 1 190px; min-width: 150px; }
.footer-language-picker button {
  min-height: 42px;
  padding: 9px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.footer-langs > label { display: block; font-weight: 700; }


/* Compact searchable language controls in header and footer */
.header-actions .lang-search {
  width: 118px;
  min-width: 70px;
  height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
}
.header-actions .lang-select {
  max-width: 130px;
  min-width: 74px;
}
.footer-language-picker button { display: none; }
.footer-language-picker { max-width: 560px; }
.footer-language-picker input,
.footer-language-picker select { flex: 1 1 220px; min-width: 160px; }
@media (max-width: 600px) {
  .header-actions .lang-search { width: 88px; }
  .header-actions .lang-select { max-width: 100px; }
}


/* Dark-mode contrast fixes: prevent legacy hard-coded light surfaces and
   dark text from becoming unreadable when the theme is switched to dark. */
html[data-theme="dark"] body,
html[data-theme="dark"] main {
  color: var(--ink);
}
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .search,
html[data-theme="dark"] .preset-select,
html[data-theme="dark"] .chip,
html[data-theme="dark"] .btn-ghost,
html[data-theme="dark"] .nav-toggle,
html[data-theme="dark"] .nav-drawer-close,
html[data-theme="dark"] .opts input,
html[data-theme="dark"] .opts select,
html[data-theme="dark"] .pedit-options input,
html[data-theme="dark"] .pedit-options select,
html[data-theme="dark"] .pedit-options textarea,
html[data-theme="dark"] .textout,
html[data-theme="dark"] .ghost,
html[data-theme="dark"] .page-actions button {
  background-color: var(--card);
  color: var(--ink);
  border-color: var(--line-strong);
}
html[data-theme="dark"] .chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
html[data-theme="dark"] .drop,
html[data-theme="dark"] .drop:hover,
html[data-theme="dark"] .drop:focus-within,
html[data-theme="dark"] .drop.has-files {
  background: linear-gradient(180deg, var(--bg-tint), var(--card));
  color: var(--ink);
}
html[data-theme="dark"] .drop label,
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .run,
html[data-theme="dark"] .download {
  color: #fff;
}
html[data-theme="dark"] .drop.has-files label {
  background: var(--brand);
  color: #fff;
}
html[data-theme="dark"] .site-nav,
html[data-theme="dark"] .nav-menu-panel,
html[data-theme="dark"] .footer-language-picker input,
html[data-theme="dark"] .footer-language-picker select {
  background-color: var(--card);
  color: var(--ink);
}
html[data-theme="dark"] .site-nav a,
html[data-theme="dark"] .nav-menu-btn,
html[data-theme="dark"] .nav-menu-panel a,
html[data-theme="dark"] .preset-hints,
html[data-theme="dark"] .trust-list li,
html[data-theme="dark"] .hint,
html[data-theme="dark"] .pedit-options label,
html[data-theme="dark"] .opts label {
  color: var(--ink-2);
}
html[data-theme="dark"] .step-num {
  background: var(--brand);
  color: #fff;
}
html[data-theme="dark"] .pe-erase {
  background: var(--bg-tint);
  color: var(--ink);
  border-color: var(--line-strong);
}
html[data-theme="dark"] .drop-privacy strong {
  color: var(--ink);
}


/* Single searchable language combobox (no separate search + select controls). */
.header-actions #langSelect.lang-search {
  width: 170px;
  min-width: 0;
  max-width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}
.footer-language-picker #footerLangSelect {
  display: block;
  width: 100%;
  max-width: 360px;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
@media (max-width: 860px) {
  .header-actions #langSelect.lang-search {
    width: 135px;
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    font-size: 12px;
  }
}
@media (max-width: 380px) {
  .header-actions #langSelect.lang-search { width: 112px; }
}


/* Mobile camera-to-PDF capture */
.mobile-camera-shortcut { display: none; }
.camera-capture-panel { margin-bottom: 18px; }
.camera-capture-panel h2 { margin: 0 0 8px; font-size: 1.2rem; }
.camera-previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; margin-top: 14px; }
.camera-preview { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.camera-preview img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.camera-preview span { display: block; padding: 6px; font-size: 12px; color: var(--muted); }
@media (max-width: 768px), (pointer: coarse) {
  .mobile-camera-shortcut { display: inline-flex; }
}


/* ================= Complete searchable tools mega-menu ================= */
.nav-mega-menu { position: static; }
.nav-mega-panel {
  position: fixed;
  top: calc(var(--header-h) + 10px);
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: min(980px, calc(100vw - 32px));
  max-height: min(76vh, 720px);
  overflow: auto;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  padding: 0;
  border-color: var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(13, 16, 23, .18);
}
.nav-mega-panel[hidden] { display: none !important; }
.nav-mega-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #fff, #fafbfc);
}
.nav-mega-head strong { display: block; font-size: 18px; letter-spacing: -.02em; }
.nav-mega-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.nav-menu-search {
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(320px, 42%);
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
}
.nav-menu-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.nav-menu-search > span { font-size: 22px; line-height: 1; }
.nav-menu-search input {
  width: 100%;
  min-width: 0;
  padding: 8px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13.5px;
}
.nav-mega-groups {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px 18px;
  padding: 18px 22px 22px;
}
.nav-mega-panel .nav-menu-group { min-width: 0; }
.nav-mega-panel .nav-menu-title {
  margin: 0 0 9px;
  padding: 0 8px;
  color: var(--brand-dark);
  font-size: 10.5px;
  letter-spacing: .075em;
}
.nav-mega-panel a[role="menuitem"] {
  padding: 7px 9px;
  font-size: 13px;
  font-weight: 550;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.nav-mega-panel a[role="menuitem"][hidden],
.nav-mega-panel .nav-menu-group[hidden] { display: none !important; }
.nav-mega-panel .nav-menu-all {
  margin: 0;
  padding: 15px 20px;
  background: var(--bg);
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.nav-menu-empty {
  margin: 0;
  padding: 20px 24px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}
.nav-menu-empty[hidden] { display: none; }

@media (max-width: 1100px) and (min-width: 861px) {
  .nav-mega-groups { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .header-inner { gap: 14px; }
  .site-nav { gap: 2px; }
  .site-nav > a, .nav-menu-btn { padding-inline: 8px; font-size: 13.5px; }
}
@media (max-width: 860px) {
  .nav-mega-menu { position: static; }
  .nav-mega-panel {
    position: static;
    left: auto;
    right: auto;
    transform: none;
    width: 100%;
    max-height: none;
    overflow: visible;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }
  .nav-mega-head {
    display: block;
    padding: 14px 10px;
    background: transparent;
    border-bottom: 1px solid var(--line);
  }
  .nav-mega-head strong { font-size: 16px; }
  .nav-mega-head p { margin-bottom: 12px; }
  .nav-menu-search { width: 100%; }
  .nav-mega-groups { grid-template-columns: 1fr; gap: 10px; padding: 10px 0; }
  .nav-mega-panel .nav-menu-title { margin: 8px 0 3px; padding: 0 12px; }
  .nav-mega-panel a[role="menuitem"] { padding: 10px 12px; font-size: 14px; }
  .nav-mega-panel .nav-menu-all { margin-top: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .nav-mega-panel, .nav-menu-btn .caret { transition: none; }
}


/* Accessible contact form */
.contact-form {
  display: grid;
  gap: 10px;
  max-width: 760px;
  margin: 20px 0 36px;
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}
.contact-form label { margin-top: 6px; font-size: 14px; font-weight: 750; color: var(--ink-2); }
.contact-form input,
.contact-form select,
.contact-form textarea {
  width: 100%;
  min-width: 0;
  padding: 12px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  background: var(--bg);
}
.contact-form textarea { resize: vertical; }
.contact-form .btn { justify-self: start; }
.contact-form .note { font-size: 13px; }
@media (max-width: 560px) {
  .contact-form { padding: 16px; }
  .contact-form .btn { width: 100%; }
}


/* Searchable language picker: show matching languages first and keep every
   available language visible below them instead of relying on native datalist filtering. */
.language-picker {
  position: relative;
  min-width: 0;
}
.language-picker-list {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 8px);
  z-index: 10050;
  width: min(340px, 90vw);
  max-height: min(360px, 65vh);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border, #d9dee8);
  border-radius: 12px;
  background: var(--surface, #fff);
  color: var(--text, #172033);
  box-shadow: 0 14px 36px rgba(0, 0, 0, .18);
  overscroll-behavior: contain;
}
.language-picker-list[hidden] { display: none !important; }
.language-picker-option {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  text-align: start;
  cursor: pointer;
}
.language-picker-option:hover,
.language-picker-option.is-active {
  background: var(--surface-hover, #eef3fb);
}
.language-picker-option.is-match .language-picker-option-name {
  font-weight: 700;
}
.language-picker-option-name {
  min-width: 0;
  overflow-wrap: anywhere;
}
.language-picker-option-meta {
  flex: 0 0 auto;
  color: var(--muted, #687386);
  font-size: .78em;
}
.footer-language-picker .language-picker {
  width: 100%;
}
.footer-language-picker .language-picker-list {
  top: auto;
  bottom: calc(100% + 8px);
  width: min(560px, 90vw);
}
@media (max-width: 600px) {
  .header-actions .language-picker { min-width: 0; }
  .header-actions .language-picker-list { width: min(320px, 92vw); }
}


/* ===================== PDF workspace polish ===================== */
/* The quick switcher behaves like a compact app dock and respects theme/safe areas. */
body:has(.pdf-workspace-toolbar) { padding-bottom: 112px; }
.pdf-workspace-toolbar {
  position: fixed;
  z-index: 1000;
  inset-inline: 0;
  bottom: 0;
  padding: 12px max(18px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px));
  background: color-mix(in srgb, var(--card) 92%, transparent);
  border-top: 1px solid var(--line);
  box-shadow: 0 -12px 34px rgba(13, 16, 23, .12);
  backdrop-filter: blur(18px) saturate(145%);
}
.pdf-workspace-toolbar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 18%, transparent));
}
.pdf-workspace-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr) minmax(180px, 240px) auto auto;
  align-items: center;
  gap: 10px;
}
.pdf-workspace-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: .1em;
  white-space: nowrap;
  color: var(--brand);
}
.pdf-workspace-label::before {
  content: "PDF";
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 34px;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand);
  letter-spacing: -.04em;
  font-size: 11px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 16%, transparent);
}
.pdf-workspace-status {
  min-width: 0;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pdf-workspace-select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 9px 34px 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--card);
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  box-shadow: var(--shadow-xs);
}
.pdf-workspace-select:focus-visible { outline: 3px solid var(--brand-ring); outline-offset: 1px; border-color: var(--brand); }
.pdf-workspace-go, .pdf-workspace-clear {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 11px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.pdf-workspace-go {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  box-shadow: 0 6px 16px var(--brand-ring);
}
.pdf-workspace-go::after { content: "↗"; font-size: 15px; line-height: 1; }
.pdf-workspace-clear {
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--ink-2);
}
.pdf-workspace-go:hover, .pdf-workspace-clear:hover { transform: translateY(-1px); }
.pdf-workspace-go:hover { background: var(--brand-dark); box-shadow: 0 8px 20px var(--brand-ring); }
.pdf-workspace-clear:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

/* Tool workspace surfaces: consistent spacing, readable file queue, clear actions. */
.page-shell:has(.pdf-workspace-toolbar) { padding-top: 32px; }
.page-shell:has(.pdf-workspace-toolbar) .page-hero { margin-bottom: 24px; }
.page-shell:has(.pdf-workspace-toolbar) .panel { padding: clamp(18px, 3vw, 30px); }
.page-shell:has(.pdf-workspace-toolbar) .drop { margin-bottom: 4px; }
.filepick { margin-top: 18px; text-align: start; }
.filepick .hint { font-size: 13px; line-height: 1.5; }
.file-list { gap: 9px; }
.file-row {
  min-width: 0;
  padding: 11px 12px;
  gap: 11px;
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--brand);
  border-radius: 12px;
  box-shadow: var(--shadow-xs);
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.file-row:hover { border-color: color-mix(in srgb, var(--brand) 32%, var(--line)); background: color-mix(in srgb, var(--brand-soft) 20%, var(--card)); }
.file-badge { width: 29px; height: 29px; border-radius: 9px; }
.file-name { line-height: 1.35; }
.file-size { font-variant-numeric: tabular-nums; white-space: nowrap; }
.file-remove { width: 32px; height: 32px; font-size: 12px; }
.filepick-actions { gap: 8px; }
.filepick-actions .ghost { min-height: 40px; padding: 9px 13px; font-size: 13px; }
.opts { gap: 16px; margin-top: 22px; }
.opts label { line-height: 1.45; }
.opts input, .opts select { min-height: 42px; }
.action-row { gap: 12px; }
.action-row .run { min-height: 46px; }
.status { max-width: 100%; line-height: 1.45; }
.status.is-warning, .status.is-error { border-radius: 12px; }
.result { align-items: flex-start; }
.result .download { min-height: 44px; border-radius: 11px; }
.result .textout { flex-basis: 100%; }
.previous-pdf {
  align-items: center;
  padding: 13px 15px !important;
  border-color: var(--line) !important;
  background: var(--card);
  box-shadow: var(--shadow-xs);
  color: var(--ink-2);
}
.previous-pdf span { font-size: 13px; line-height: 1.45; }
.previous-pdf .ghost { min-height: 40px; }
html[data-theme="dark"] .pdf-workspace-toolbar { box-shadow: 0 -12px 34px rgba(0, 0, 0, .32); }
html[data-theme="dark"] .pdf-workspace-clear { color: var(--ink-2); }
@media (max-width: 900px) {
  body:has(.pdf-workspace-toolbar) { padding-bottom: 148px; }
  .pdf-workspace-inner { grid-template-columns: auto minmax(0, 1fr) minmax(150px, 220px) auto; }
  .pdf-workspace-status { grid-column: 2 / -1; grid-row: 1; }
  .pdf-workspace-label { grid-column: 1; grid-row: 1; }
  .pdf-workspace-select { grid-column: 1 / 3; grid-row: 2; }
  .pdf-workspace-go { grid-column: 3; grid-row: 2; }
  .pdf-workspace-clear { grid-column: 4; grid-row: 2; }
}
@media (max-width: 600px) {
  body:has(.pdf-workspace-toolbar) { padding-bottom: 174px; }
  .pdf-workspace-toolbar { padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .pdf-workspace-inner { grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; }
  .pdf-workspace-label { grid-column: 1; grid-row: 1; }
  .pdf-workspace-status { grid-column: 1 / -1; grid-row: 2; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .pdf-workspace-select { grid-column: 1 / -1; grid-row: 3; min-height: 42px; }
  .pdf-workspace-go { grid-column: 2; grid-row: 1; padding-inline: 11px; }
  .pdf-workspace-clear { grid-column: 3; grid-row: 1; padding-inline: 10px; }
  .page-shell:has(.pdf-workspace-toolbar) { padding-top: 24px; }
  .page-shell:has(.pdf-workspace-toolbar) .panel { padding: 16px; }
  .file-row { gap: 8px; padding: 9px; }
  .file-size { font-size: 11.5px; }
  .file-name { font-size: 13px; }
  .filepick-actions .ghost { flex: 1 1 auto; }
  .previous-pdf { gap: 8px !important; }
  .previous-pdf .ghost { flex: 1 1 auto; }
}
@media (max-width: 360px) {
  .pdf-workspace-label { font-size: 10px; letter-spacing: .06em; }
  .pdf-workspace-go, .pdf-workspace-clear { font-size: 11.5px; padding-inline: 8px; }
}


/* Existing PDF text selection and replacement controls */
.pedit-existing-help { display:flex; align-items:center; flex-wrap:wrap; gap:8px 14px; margin-top:16px; padding:14px 16px; border:1px solid color-mix(in srgb,var(--brand) 26%,var(--line)); border-radius:12px; background:color-mix(in srgb,var(--brand-soft) 38%,var(--card)); color:var(--ink-2); font-size:13px; line-height:1.55; }
.pedit-existing-help strong { color:var(--ink); }
.pedit-existing-help span { flex:1 1 360px; }
.pedit-existing-help button { flex:0 0 auto; }
.pe-pdf-text-layer { position:absolute; inset:0; z-index:1; pointer-events:none; user-select:text; line-height:normal; }
.pe-pdf-text { position:absolute; display:block; overflow:hidden; color:transparent; background:transparent; border-radius:2px; line-height:1; white-space:pre; pointer-events:auto; cursor:text; user-select:text; font-size:10px; transform-origin:top left; }
.pe-pdf-text:hover { background:rgba(35,116,255,.15); outline:1px solid rgba(35,116,255,.42); }
.pe-pdf-text.is-text-target { background:rgba(35,116,255,.22); outline:2px solid #2374ff; }
.pe-pdf-text.is-inline-editing { color:#111 !important; background:#fff !important; outline:2px solid #2374ff; box-shadow:0 1px 5px rgba(0,0,0,.18); cursor:text; user-select:text; white-space:pre; padding:0 2px; }
.pe-stage { user-select:text; }
.pe-item { user-select:none; z-index:2; }
@media(max-width:600px) { .pedit-existing-help { align-items:stretch; padding:12px; } .pedit-existing-help span { flex-basis:100%; } .pedit-existing-help button { width:100%; } }

@media(max-width:700px) {
  .pedit-bar { top: 4px; gap: 6px; }
  .pedit-bar .chip { padding: 7px 10px; }
  .pedit-hint-row { top: 56px; }
}

/* Footer utility row: connection state, privacy inspector and PWA install. */
.footer-utility-controls { display:flex; justify-content:center; min-width:0; }
.pwa-status-bar {
  display:flex; align-items:center; justify-content:center; flex-wrap:wrap; gap:10px;
  width:100%; max-width:900px; margin:12px auto 0; padding:10px 12px;
  border:1px solid #b8e0c5; border-radius:14px; background:#e9f8ee; color:#14532d;
  font-size:12px; line-height:1.4;
}
.pwa-network-status { display:flex; align-items:center; gap:8px; }
.pwa-status-dot { width:8px; height:8px; flex:0 0 8px; border-radius:50%; background:#16a34a; }
.pwa-status-bar.is-offline { background:#e6f8ec; border-color:#22a05a; }
.pwa-status-bar.is-offline .pwa-status-dot { background:#15803d; box-shadow:0 0 0 3px rgba(21,128,61,.14); }
.pwa-install-button { border:0; border-radius:999px; background:#166534; color:#fff; padding:7px 12px; font-weight:700; white-space:nowrap; cursor:pointer; }
.pwa-install-button[hidden] { display:none; }
.pwa-inspector-button { border:1px solid #b7c2d2; background:var(--card); color:var(--ink); border-radius:999px; padding:7px 10px; font-size:12px; font-weight:700; cursor:pointer; white-space:nowrap; }
.privacy-inspector-panel { position:fixed; z-index:1001; right:16px; bottom:16px; width:min(560px,calc(100vw - 32px)); max-height:min(70vh,640px); overflow:auto; padding:18px; border:1px solid var(--line-strong); border-radius:16px; background:var(--card); box-shadow:var(--shadow-lg); color:var(--ink); }
.privacy-inspector-panel[hidden] { display:none; }
.privacy-inspector-head { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.privacy-inspector-head h2 { font-size:20px; }
.privacy-inspector-panel p { font-size:13px; line-height:1.5; color:var(--muted); }
.privacy-inspector-stats { display:flex; flex-wrap:wrap; gap:14px; padding:10px 0; font-size:13px; }
.privacy-inspector-panel ol { padding-left:24px; max-height:220px; overflow:auto; font-size:12px; overflow-wrap:anywhere; }
.privacy-inspector-panel li { margin:5px 0; }
.privacy-inspector-panel button,.privacy-inspector-panel a { display:inline-block; border:1px solid var(--line-strong); border-radius:8px; padding:8px 10px; margin:4px 6px 4px 0; background:var(--bg); color:var(--ink); cursor:pointer; font-size:12px; }
@media(max-width:600px) {
  .pwa-status-bar { justify-content:flex-start; border-radius:12px; padding:9px 10px; font-size:11px; }
  .pwa-install-button { padding:7px 9px; }
  .privacy-inspector-panel { right:8px; bottom:8px; width:calc(100vw - 16px); }
}
