/* ==========================================================================
   DocEpic design system — loaded after site.css on every page.
   Modern SaaS look (soft #f8fafc canvas, 14–16px cards, micro-shadows, Inter + Plus Jakarta Sans)
   and the two product suites: Image Tools (indigo #6366f1) and Data & Excel Tools (emerald #10b981).

   1. Fonts             2. Tokens & suite themes   3. Typography & base
   4. Header suite tabs 5. Suite landing & homepage strip
   6. Tool workspace (animated dropzone, badges, processing)
   7. Components: card, segmented control, range + value sync, toggle chips,
      skeletons, stat compare, data table & diff colours, crop box
   8. Toasts            9. Motion preferences
   10. Image tools: option controls, result report, before/after slider
   11. Image edit tools: live preview, resize, rotate, border and crop controls
   12. Watermark, filters, blur regions and passport photos
   13. Data & Excel tools: preview toolbar, column chips, result stats
   ========================================================================== */

/* 1. Fonts ------------------------------------------------------------------ */
/* Variable fonts, self-hosted from @fontsource-variable (SIL Open Font License, see /fonts/LICENSE-*.txt).
   Paths match the <link rel="preload"> tags in _Layout.cshtml exactly, so each file downloads once. */
@font-face {
  font-family: "Inter";
  font-style: normal; font-display: swap; font-weight: 100 900;
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal; font-display: swap; font-weight: 100 900;
  src: url("/fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal; font-display: swap; font-weight: 200 800;
  src: url("/fonts/plus-jakarta-sans-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal; font-display: swap; font-weight: 200 800;
  src: url("/fonts/plus-jakarta-sans-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* 2. Tokens & suite themes ---------------------------------------------------- */
:root {
  --bg: #f8fafc;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;

  --suite-image: #6366f1;
  --suite-image-strong: #4f46e5;
  --suite-image-soft: #eef2ff;
  --suite-data: #10b981;
  --suite-data-strong: #047857;
  --suite-data-soft: #ecfdf5;

  /* Data diff colours (Compare sheets) — tinted cells with a strong edge, readable in both themes. */
  --diff-added: #16a34a;
  --diff-removed: #dc2626;
  --diff-changed: #d97706;


  --shadow-xs: 0 1px 2px rgb(15 23 42 / 0.05);
  --shadow-sm: 0 1px 2px rgb(15 23 42 / 0.04), 0 1px 3px rgb(15 23 42 / 0.07);
  --shadow-md: 0 4px 6px -1px rgb(15 23 42 / 0.06), 0 10px 24px -6px rgb(15 23 42 / 0.10);
  --shadow-glow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent), 0 12px 32px -8px color-mix(in srgb, var(--brand) 45%, transparent);

  --radius: 14px;
  --radius-card: 16px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-display: "Plus Jakarta Sans", var(--font);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0f17;
    --surface: #121722;
    --surface-2: #1a2030;
    --border: #262d3d;
    --text: #e8ecf4;
    --text-muted: #94a0b8;
    --suite-image: #818cf8;
    --suite-image-strong: #a5b4fc;
    --suite-image-soft: #1e1b4b;
    --suite-data: #34d399;
    --suite-data-strong: #6ee7b7;
    --suite-data-soft: #052e22;
    --diff-added: #4ade80;
    --diff-removed: #f87171;
    --diff-changed: #fbbf24;
    --shadow-xs: 0 1px 2px rgb(0 0 0 / 0.4);
  }
}
:root[data-theme="dark"] {
  --bg: #0b0f17;
  --surface: #121722;
  --surface-2: #1a2030;
  --border: #262d3d;
  --text: #e8ecf4;
  --text-muted: #94a0b8;
  --suite-image: #818cf8;
  --suite-image-strong: #a5b4fc;
  --suite-image-soft: #1e1b4b;
  --suite-data: #34d399;
  --suite-data-strong: #6ee7b7;
  --suite-data-soft: #052e22;
  --diff-added: #4ade80;
  --diff-removed: #f87171;
  --diff-changed: #fbbf24;
  --shadow-xs: 0 1px 2px rgb(0 0 0 / 0.4);
}

/* Suite pages re-tint the brand: buttons, focus rings, progress bars and drop zones follow the suite accent. */
body.suite-image {
  --brand: var(--suite-image);
  --brand-strong: var(--suite-image-strong);
  --brand-soft: var(--suite-image-soft);
  --suite: var(--suite-image);
}
body.suite-data {
  --brand: var(--suite-data);
  --brand-strong: var(--suite-data-strong);
  --brand-soft: var(--suite-data-soft);
  --suite: var(--suite-data);
}
body.suite-image, body.suite-data {
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--brand) 40%, transparent);
  --shadow-glow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent), 0 12px 32px -8px color-mix(in srgb, var(--brand) 45%, transparent);
}
/* Plain links use the text-safe shade of the accent (emerald text on white would be only 2.5:1).
   :where() keeps specificity at a bare "a", so classed links (buttons, cards, chips) keep their own colours. */
:where(body.suite-image, body.suite-data) a { color: color-mix(in srgb, var(--brand) 65%, var(--text)); }

/* White text needs the deeper shade of each accent to pass WCAG AA (4.5:1); the accent itself is kept for fills. */
body.suite-image .btn--primary, body.suite-data .btn--primary { background: var(--brand-strong); }
body.suite-image .btn--primary:hover, body.suite-data .btn--primary:hover { background: color-mix(in srgb, var(--brand-strong) 85%, #000); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body.suite-data .btn--primary,
  :root:not([data-theme="light"]) body.suite-image .btn--primary { color: #0b0f17; background: var(--brand); }
}
:root[data-theme="dark"] body.suite-data .btn--primary,
:root[data-theme="dark"] body.suite-image .btn--primary { color: #0b0f17; background: var(--brand); }

/* 3. Typography & base -------------------------------------------------------- */
body { font-family: var(--font); font-feature-settings: "cv11", "ss01"; }
h1, h2, h3, .logo, .tool-card__name, .dropzone__title, .done__title, .processing__title, .modal__title {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}
h1 { font-weight: 800; }
h2, h3 { font-weight: 700; }
.hub-search__kbd { font-family: var(--font); }

.tool-card, .ws-panel, .feature, .hub-item--ad { border-radius: var(--radius-card); }
.tool-card { box-shadow: var(--shadow-xs); }
.tool-card:hover { box-shadow: var(--shadow-md); }

.btn { border-radius: 10px; transition: background-color 0.15s, border-color 0.15s, box-shadow 0.2s, transform 0.1s var(--ease-out); }
.btn--primary { box-shadow: 0 1px 2px rgb(15 23 42 / 0.12), inset 0 1px 0 rgb(255 255 255 / 0.12); }
.btn--primary:hover { box-shadow: 0 6px 16px -4px color-mix(in srgb, var(--brand) 55%, transparent); }
.btn:focus-visible, .chip:focus-visible, .nav-link:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.tag--memory { background: color-mix(in srgb, var(--cat, var(--brand)) 14%, transparent); color: color-mix(in srgb, var(--cat, var(--brand)) 65%, var(--text)); }

/* 4. Header suite tabs --------------------------------------------------------- */
/* The line before the suite tabs is drawn by the first tab, so the menu list holds only real items. */
.nav-suite--first::before { content: ""; display: block; flex: none; width: 1px; height: 22px; margin: 0 8px; background: var(--border); }
.nav-suite__tab { position: relative; gap: 8px; }
.nav-suite__dot {
  width: 8px; height: 8px; flex: none; border-radius: 50%;
  background: var(--suite); box-shadow: 0 0 0 3px color-mix(in srgb, var(--suite) 20%, transparent);
}
.nav-suite__tab:hover { background: color-mix(in srgb, var(--suite) 10%, transparent); color: var(--text); }
.nav-suite__tab.is-current { color: color-mix(in srgb, var(--suite) 50%, var(--text)); background: color-mix(in srgb, var(--suite) 10%, transparent); }

.mega .mega__promo {
  display: flex; flex-direction: column; gap: 6px; justify-content: flex-end;
  margin: 0 !important; padding: 18px !important; border-radius: 12px !important;
  background:
    radial-gradient(120% 120% at 100% 0%, color-mix(in srgb, var(--suite) 30%, transparent), transparent 60%),
    color-mix(in srgb, var(--suite) 9%, var(--surface)) !important;
  border: 1px solid color-mix(in srgb, var(--suite) 25%, var(--border));
}
.mega__promo-title { font: 700 1rem/1.2 var(--font-display); color: var(--text); }
.mega__promo-text { color: var(--text-muted); font-size: 0.85rem; line-height: 1.45; }
.mega__promo-cta { margin-top: 4px; color: color-mix(in srgb, var(--suite) 65%, var(--text)); font-weight: 700; font-size: 0.88rem; }

@media (min-width: 1024px) {
  .nav-suite--first { display: flex; align-items: center; }
  .mega--suite { grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(220px, 260px); }
  /* Three quick links don't fit next to five menus on small laptops; they stay in the mobile drawer. */
  .nav-quick { display: none; }
}
@media (min-width: 1360px) { .nav-quick { display: list-item; } }
@media (max-width: 1023.98px) {
  .nav-suite--first::before { width: auto; height: 1px; margin: 8px 12px 4px; }
  .nav-suite__tab { justify-content: flex-start; gap: 10px; }
  .nav-suite__tab .chevron { margin-left: auto; }
  .mega .mega__promo { margin-top: 4px !important; }
}

/* 5. Suite landing & homepage strip --------------------------------------------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px;
  padding: 6px 12px; border-radius: 999px;
  background: color-mix(in srgb, var(--suite, var(--brand)) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--suite, var(--brand)) 22%, var(--border));
  color: color-mix(in srgb, var(--suite, var(--brand)) 65%, var(--text)); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.02em;
}
.eyebrow__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse-dot 2.4s ease-in-out infinite; }
@keyframes pulse-dot { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, currentColor 0%, transparent); opacity: 0.6; } }

.suite-hero {
  position: relative; overflow: hidden; padding: 48px 0 24px; text-align: center;
  background:
    radial-gradient(60% 80% at 50% -10%, color-mix(in srgb, var(--suite) 18%, transparent), transparent 70%),
    linear-gradient(to bottom, transparent, var(--bg));
}
/* Faint grid behind the hero, fading out at the edges. */
.suite-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(color-mix(in srgb, var(--suite) 10%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--suite) 10%, transparent) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(70% 70% at 50% 30%, #000, transparent 75%);
}
.suite-hero__inner { position: relative; max-width: 860px; }
.suite-hero__title { font-size: clamp(1.9rem, 1.2rem + 3vw, 3.1rem); line-height: 1.1; margin-bottom: 14px; }
.suite-hero__lead { max-width: 640px; margin: 0 auto; color: var(--text-muted); font-size: 1.08rem; }
.suite-hero__facts {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px;
  margin: 22px 0 0; padding: 0; list-style: none; color: var(--text-muted); font-size: 0.9rem; font-weight: 500;
}
.suite-hero__facts li { display: inline-flex; align-items: center; gap: 6px; }
.suite-hero__facts svg { width: 18px; height: 18px; fill: none; stroke: var(--suite); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.suite-body { padding-bottom: 24px; }
.suite-jump {
  position: sticky; top: var(--header-h); z-index: 40;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: 0 calc(var(--gutter) * -1) 8px; padding: 12px var(--gutter);
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px);
}
.suite-jump::-webkit-scrollbar { display: none; }
.suite-section { padding-top: 20px; scroll-margin-top: calc(var(--header-h) + 64px); }
.suite-section__title { display: flex; align-items: center; gap: 10px; font-size: 1.25rem; margin-bottom: 14px; }
.suite-section__title::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--suite); }
.suite-infeed { margin-top: 24px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
.suite-infeed .ad-slot { margin: 0; }

.suite-steps { display: grid; gap: 16px; margin: 0; padding: 0; list-style: none; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.suite-steps .card { padding: 22px; }
.suite-steps h3 { margin: 12px 0 6px; font-size: 1.05rem; }
.suite-steps p { margin: 0; color: var(--text-muted); font-size: 0.93rem; }
.suite-steps__num {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: color-mix(in srgb, var(--suite) 14%, transparent); color: color-mix(in srgb, var(--suite) 65%, var(--text));
  font: 800 1rem/1 var(--font-display);
}

/* Homepage: two suite cards between the hero and the PDF hub. */
.suite-strip { padding: 28px 0 4px; }
.suite-strip__grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.suite-card {
  position: relative; display: flex; flex-direction: column; gap: 6px; overflow: hidden;
  padding: 22px 22px 20px; border-radius: var(--radius-card);
  border: 1px solid color-mix(in srgb, var(--suite) 22%, var(--border));
  background:
    radial-gradient(90% 140% at 100% 0%, color-mix(in srgb, var(--suite) 16%, transparent), transparent 60%),
    var(--surface);
  color: var(--text); box-shadow: var(--shadow-xs);
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s, border-color 0.2s;
}
.suite-card:hover { text-decoration: none; transform: translateY(-3px); border-color: var(--suite); box-shadow: 0 14px 32px -12px color-mix(in srgb, var(--suite) 50%, transparent); }
.suite-card__badge {
  position: absolute; top: 18px; right: 18px; padding: 3px 9px; border-radius: 999px;
  /* 55 % of the suite colour keeps white text above 4.5:1 for both accents, in light and dark themes. */
  background: color-mix(in srgb, var(--suite) 55%, #000); color: #fff; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase;
}
.suite-card__title { font: 800 1.3rem/1.2 var(--font-display); letter-spacing: -0.02em; }
.suite-card__text { color: var(--text-muted); font-size: 0.93rem; }
.suite-card__tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.suite-card__tool {
  padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600;
  background: color-mix(in srgb, var(--suite) 10%, var(--surface)); color: var(--text);
}
.suite-card__cta { margin-top: 8px; color: color-mix(in srgb, var(--suite) 65%, var(--text)); font-weight: 700; font-size: 0.92rem; }
.suite-card__cta span { display: inline-block; transition: transform 0.2s var(--ease-out); }
.suite-card:hover .suite-card__cta span { transform: translateX(4px); }

/* 6. Tool workspace ------------------------------------------------------------- */
.engine-badge--memory::before { background: var(--suite, var(--brand)); }

/* Animated drop zone: floating icon, breathing border on hover, lift + glow while a file hovers over the page. */
.dropzone {
  position: relative; isolation: isolate;
  transition: background-color 0.2s, border-color 0.2s, transform 0.25s var(--ease-out), box-shadow 0.25s;
}
.dropzone::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: radial-gradient(60% 60% at 50% 40%, color-mix(in srgb, var(--cat, var(--brand)) 12%, transparent), transparent 70%);
  opacity: 0; transition: opacity 0.3s;
}
.dropzone:hover::before, .dropzone:focus-visible::before, body.is-dragging-file .dropzone::before { opacity: 1; }
.dropzone:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.dropzone__icon { animation: dz-float 3.2s ease-in-out infinite; }
.dropzone:hover .dropzone__icon { animation-duration: 1.6s; }
@keyframes dz-float { 50% { transform: translateY(-6px); } }
body.is-dragging-file .dropzone {
  transform: scale(1.01);
  border-color: var(--cat, var(--brand)); border-style: solid;
  box-shadow: var(--shadow-glow);
}
.dropzone__formats { margin: 10px 0 0; color: var(--text-muted); font-size: 0.8rem; }

.drop-overlay { background: color-mix(in srgb, var(--brand) 18%, rgb(10 12 20 / 0.5)); animation: fade-in 0.15s ease-out; }
.drop-overlay__box { animation: pop-in 0.3s var(--ease-spring); }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.94); } }

.ws-panel:not([hidden]) { animation: panel-in 0.28s var(--ease-out); }
@keyframes panel-in { from { opacity: 0; transform: translateY(6px); } }

/* Processing: the spinner gets a soft halo in the suite colour; the bar shimmers while it fills. */
.spinner { border-top-color: var(--brand); box-shadow: 0 0 0 8px color-mix(in srgb, var(--brand) 8%, transparent); }
.progress__bar {
  background:
    linear-gradient(90deg, transparent, rgb(255 255 255 / 0.35), transparent) 0 0 / 40% 100% no-repeat,
    var(--brand);
  animation: bar-shine 1.4s linear infinite;
}
@keyframes bar-shine { from { background-position: -40% 0, 0 0; } to { background-position: 140% 0, 0 0; } }
.done__icon { animation: pop-in 0.4s var(--ease-spring); }

/* 7. Components ----------------------------------------------------------------- */
.card {
  padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-card);
  background: var(--surface); box-shadow: var(--shadow-xs);
}
.card--interactive { transition: transform 0.2s var(--ease-out), box-shadow 0.2s, border-color 0.2s; }
.card--interactive:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); box-shadow: var(--shadow-md); }
.card__title { margin: 0 0 4px; font: 700 1rem/1.3 var(--font-display); }
.card__hint { margin: 0; color: var(--text-muted); font-size: 0.88rem; }

/* Segmented control (base styles in site.css §9c): a hairline border and smooth state changes. */
.segmented { border: 1px solid var(--border); border-radius: 12px; }
.segmented span { transition: background-color 0.15s, color 0.15s, box-shadow 0.15s; }
.segmented span:hover { color: var(--text); }
.segmented input:checked + span { color: var(--text); }

/* Range slider with a synced value: <div class="range-field"><label>…</label><output>80%</output><input type="range" class="range"></div> */
.range-field { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px 12px; }
.range-field > label { font-weight: 600; font-size: 0.9rem; }
.range-field > output {
  min-width: 56px; padding: 3px 9px; border-radius: 8px; text-align: center;
  background: var(--brand-soft); color: color-mix(in srgb, var(--brand) 65%, var(--text)); font-weight: 700; font-size: 0.85rem; font-variant-numeric: tabular-nums;
  transition: transform 0.15s var(--ease-spring);
}
.range-field > output.is-bumped { transform: scale(1.08); }
.range-field > .range { grid-column: 1 / -1; }
.range {
  --pct: 50%;
  width: 100%; height: 22px; margin: 0; background: transparent; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
.range::-webkit-slider-runnable-track {
  height: 6px; border-radius: 999px;
  background: linear-gradient(to right, var(--brand) var(--pct), var(--surface-2) var(--pct));
}
.range::-moz-range-track { height: 6px; border-radius: 999px; background: var(--surface-2); }
.range::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--brand); }
.range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%;
  background: #fff; border: 2px solid var(--brand); box-shadow: var(--shadow-sm);
  transition: transform 0.15s var(--ease-spring), box-shadow 0.15s;
}
.range::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 2px solid var(--brand); box-shadow: var(--shadow-sm);
}
.range:hover::-webkit-slider-thumb, .range:active::-webkit-slider-thumb { transform: scale(1.15); }
.range:focus-visible { outline: none; }
.range:focus-visible::-webkit-slider-thumb { box-shadow: var(--focus-ring); }
.range:focus-visible::-moz-range-thumb { box-shadow: var(--focus-ring); }

/* Toggle chips (column picker): <button class="toggle-chip" aria-pressed="true">Name</button> */
.toggle-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.toggle-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text-muted); font: 600 0.85rem/1.3 var(--font); cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}
.toggle-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toggle-chip::before {
  content: ""; flex: none; width: 14px; height: 14px; border-radius: 4px;
  border: 1.5px solid currentColor; transition: background-color 0.15s;
}
.toggle-chip:hover { border-color: var(--brand); color: var(--text); }
.toggle-chip:active { transform: scale(0.97); }
.toggle-chip[aria-pressed="true"] { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 45%, transparent); color: color-mix(in srgb, var(--brand) 65%, var(--text)); }
.toggle-chip[aria-pressed="true"]::before {
  background: var(--brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat;
  border-color: var(--brand);
}
.toggle-chip:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* Skeleton loaders — use while a preview, table or thumbnail is loading. */
.skeleton {
  display: block; border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-2) 25%, color-mix(in srgb, var(--surface-2) 40%, var(--surface)) 37%, var(--surface-2) 63%) 0 0 / 400% 100%;
  animation: skeleton 1.3s ease-in-out infinite;
}
.skeleton--text { height: 0.85em; margin: 0.45em 0; }
.skeleton--text:last-child { width: 65%; }
.skeleton--thumb { aspect-ratio: 4 / 3; border-radius: 12px; }
.skeleton--row { height: 34px; margin-bottom: 4px; }
@keyframes skeleton { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* Before / after comparison (original vs compressed size). */
.stat-compare { display: grid; gap: 10px; grid-template-columns: 1fr auto 1fr; align-items: center; }
.stat { padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.stat__label { display: block; color: var(--text-muted); font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.stat__value { display: block; margin-top: 2px; font: 800 1.35rem/1.2 var(--font-display); font-variant-numeric: tabular-nums; }
.stat--good .stat__value { color: var(--success); }
.stat-compare__arrow { width: 22px; height: 22px; fill: none; stroke: var(--text-muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.saving-pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); font-weight: 800; font-size: 0.8rem;
}

/* Data table with sticky header — live previews and the sheet diff grid. */
.data-table-wrap {
  max-height: 420px; overflow: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  overscroll-behavior: contain;
}
.data-table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td {
  max-width: 280px; padding: 7px 12px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border);
  text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.data-table th {
  position: sticky; top: 0; z-index: 2; background: var(--surface-2);
  font-weight: 700; font-size: 0.78rem; letter-spacing: 0.02em; color: var(--text);
}
.data-table th:first-child, .data-table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); color: var(--text-muted); text-align: right; }
.data-table th:first-child { z-index: 3; background: var(--surface-2); }
.data-table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
.data-table tbody tr:hover td { background: color-mix(in srgb, var(--brand) 6%, var(--surface)); }
.data-table .is-empty { color: var(--text-muted); font-style: italic; }
.data-table .is-dimmed { opacity: 0.4; text-decoration: line-through; }

.cell--added, .data-table tbody tr td.cell--added { background: color-mix(in srgb, var(--diff-added) 16%, var(--surface)); box-shadow: inset 3px 0 0 var(--diff-added); }
.cell--removed, .data-table tbody tr td.cell--removed { background: color-mix(in srgb, var(--diff-removed) 14%, var(--surface)); box-shadow: inset 3px 0 0 var(--diff-removed); text-decoration: line-through; }
.cell--changed, .data-table tbody tr td.cell--changed { background: color-mix(in srgb, var(--diff-changed) 18%, var(--surface)); box-shadow: inset 3px 0 0 var(--diff-changed); }
.cell__old { display: block; color: var(--text-muted); font-size: 0.78em; text-decoration: line-through; }
.diff-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0 0 10px; padding: 0; list-style: none; font-size: 0.85rem; color: var(--text-muted); }
.diff-legend li { display: inline-flex; align-items: center; gap: 6px; }
.diff-legend li::before { content: ""; width: 12px; height: 12px; border-radius: 3px; background: var(--swatch); }
.diff-legend .is-added { --swatch: var(--diff-added); }
.diff-legend .is-removed { --swatch: var(--diff-removed); }
.diff-legend .is-changed { --swatch: var(--diff-changed); }

/* Image crop box (prefixed "ic-": site.css has the Crop PDF tool's .crop-*): <div class="ic-stage"><img><div class="ic-box"><span class="ic-handle" data-handle="nw">…</div></div> */
.ic-stage { position: relative; display: inline-block; max-width: 100%; user-select: none; -webkit-user-select: none; touch-action: none; }
.ic-stage img { display: block; max-width: 100%; max-height: 70vh; }
.ic-box {
  position: absolute; cursor: move;
  outline: 2px solid #fff; box-shadow: 0 0 0 9999px rgb(10 12 20 / 0.55);
  background-image:
    linear-gradient(to right, transparent calc(33.33% - 0.5px), rgb(255 255 255 / 0.5) calc(33.33% - 0.5px) calc(33.33% + 0.5px), transparent calc(33.33% + 0.5px) calc(66.66% - 0.5px), rgb(255 255 255 / 0.5) calc(66.66% - 0.5px) calc(66.66% + 0.5px), transparent calc(66.66% + 0.5px)),
    linear-gradient(to bottom, transparent calc(33.33% - 0.5px), rgb(255 255 255 / 0.5) calc(33.33% - 0.5px) calc(33.33% + 0.5px), transparent calc(33.33% + 0.5px) calc(66.66% - 0.5px), rgb(255 255 255 / 0.5) calc(66.66% - 0.5px) calc(66.66% + 0.5px), transparent calc(66.66% + 0.5px));
}
.ic-handle {
  position: absolute; width: 18px; height: 18px; margin: -9px; border-radius: 50%;
  background: #fff; border: 2px solid var(--brand); box-shadow: var(--shadow-sm);
}
.ic-handle[data-handle="nw"] { top: 0; left: 0; cursor: nwse-resize; }
.ic-handle[data-handle="ne"] { top: 0; right: 0; cursor: nesw-resize; }
.ic-handle[data-handle="sw"] { bottom: 0; left: 0; cursor: nesw-resize; }
.ic-handle[data-handle="se"] { bottom: 0; right: 0; cursor: nwse-resize; }
@media (pointer: coarse) { .ic-handle { width: 28px; height: 28px; margin: -14px; } }

/* 8. Toasts ---------------------------------------------------------------------- */
.toast {
  position: relative; overflow: hidden; align-items: center;
  border: 1px solid var(--border); border-left: 0; border-radius: 14px;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.35s var(--ease-spring);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.96); } }
.toast.is-leaving { opacity: 0; transform: translateX(24px); transition: opacity 0.2s, transform 0.2s var(--ease-out); }
.toast__icon {
  width: 22px; height: 22px; flex: none; fill: none; stroke: var(--toast-color, var(--text-muted));
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.toast--success { --toast-color: var(--success); }
.toast--error { --toast-color: var(--danger); }
.toast--info { --toast-color: var(--brand); }
.toast__timer {
  position: absolute; left: 0; bottom: 0; height: 3px; width: 100%;
  background: var(--toast-color, var(--text-muted)); opacity: 0.55; transform-origin: left;
  animation: toast-timer linear forwards;
}
.toast:hover .toast__timer { animation-play-state: paused; }
@keyframes toast-timer { to { transform: scaleX(0); } }

/* 9. Motion preferences ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .toast__timer { display: none; }
  .suite-card:hover, .tool-card:hover, body.is-dragging-file .dropzone { transform: none; }
}

/* 10. Image tools ------------------------------------------------------------------- */
fieldset.field { min-width: 0; margin: 0; padding: 0; border: 0; }
.field__legend { margin-bottom: 6px; padding: 0; font-weight: 600; font-size: 0.9rem; }

.segmented--stack { display: grid; grid-template-columns: 1fr 1fr; }
.segmented span small { display: block; margin-top: 2px; font-size: 0.7rem; font-weight: 500; color: var(--text-muted); }

/* Size presets for Compress to KB: big tappable tiles. */
.kb-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.kb-preset { position: relative; }
.kb-preset input { position: absolute; opacity: 0; pointer-events: none; }
.kb-preset span {
  display: flex; align-items: baseline; justify-content: center; gap: 2px; min-height: 44px; padding: 10px 4px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer;
  font: 800 1.05rem/1 var(--font-display); font-variant-numeric: tabular-nums;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s, transform 0.1s;
}
.kb-preset span small { font: 600 0.7rem/1 var(--font); color: var(--text-muted); }
.kb-preset span:hover { border-color: var(--brand); }
.kb-preset input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: color-mix(in srgb, var(--brand) 65%, var(--text)); box-shadow: inset 0 0 0 1px var(--brand); }
.kb-preset input:focus-visible + span { box-shadow: var(--focus-ring); }
.kb-preset:last-child span { font-size: 0.85rem; }

.input-suffix { position: relative; }
.input-suffix .input { padding-right: 44px; }
.input-suffix > span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-weight: 600; font-size: 0.85rem; pointer-events: none; }

/* Result report under the download button. */
.done__report { width: 100%; max-width: 760px; margin-top: 20px; text-align: left; }
.img-report { display: grid; gap: 16px; }
.saving-pill--none { background: var(--surface-2); color: var(--text-muted); }
.img-report__list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.img-report__failed { margin: 0; color: var(--danger); font-size: 0.88rem; font-weight: 600; }
.img-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  animation: panel-in 0.3s var(--ease-out) both;
}
.img-row:nth-child(2) { animation-delay: 40ms; } .img-row:nth-child(3) { animation-delay: 80ms; } .img-row:nth-child(n+4) { animation-delay: 120ms; }
.img-row__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.img-row__sizes { font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 0.9rem; }
.img-row__meta, .img-row__notes { grid-column: 1; color: var(--text-muted); font-size: 0.8rem; }
.img-row__notes { color: color-mix(in srgb, var(--brand) 65%, var(--text)); font-weight: 600; }
.img-row__download { grid-column: 2; grid-row: 2 / span 2; justify-self: end; }
.img-row.is-failed { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); background: color-mix(in srgb, var(--danger) 5%, var(--surface)); }
.img-row__error { grid-column: 1 / -1; color: var(--danger); font-size: 0.85rem; }
.fit-badge { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); font-weight: 700; }
.fit-badge--no { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
@media (max-width: 560px) {
  .img-row { grid-template-columns: minmax(0, 1fr); }
  .img-row__sizes { white-space: normal; }
  .img-row__download { grid-column: 1; grid-row: auto; justify-self: start; }
  .stat-compare { grid-template-columns: 1fr; }
  .stat-compare__arrow { justify-self: center; transform: rotate(90deg); }
}

/* Before/after slider: the original is clipped to the left of --pos, over the result. */
.ba {
  position: relative; width: 100%; max-height: 70vh; margin: 0; overflow: hidden;
  border-radius: 12px; background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 20px 20px;
  box-shadow: var(--shadow-sm); user-select: none; -webkit-user-select: none;
}
.ba__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.ba__img--before { clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.ba__handle {
  position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: #fff;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.25); pointer-events: none;
}
.ba__handle::after {
  content: ""; position: absolute; top: 50%; left: 50%; width: 36px; height: 36px; margin: -18px 0 0 -18px;
  border-radius: 50%; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 7l-5 5 5 5M15 7l5 5-5 5'/%3E%3C/svg%3E") center / 20px no-repeat;
  box-shadow: var(--shadow-md);
}
.ba__range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; touch-action: pan-y; }
.ba:has(.ba__range:focus-visible) .ba__handle::after { box-shadow: var(--focus-ring); }
.ba__label {
  position: absolute; top: 10px; padding: 4px 10px; border-radius: 999px; pointer-events: none;
  background: rgb(15 23 42 / 0.72); color: #fff; font-size: 0.75rem; font-weight: 700; backdrop-filter: blur(4px);
}
.ba__label--before { left: 10px; }
.ba__label--after { right: 10px; }
.ba__hint { margin: 6px 0 0; color: var(--text-muted); font-size: 0.8rem; text-align: center; }

/* 11. Image edit tools ------------------------------------------------------------------ */
.live-preview { margin-bottom: 16px; }
.live-preview__stage {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 160px; overflow: hidden; border-radius: 12px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 60%, var(--surface));
  transition: height 0.25s var(--ease-out);
}
.live-preview__stage.is-transparent,
.live-preview__stage:has(.frame-preview) {
  background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px;
}
.live-preview__stage > img { display: block; max-width: 100%; max-height: 320px; }
.live-preview__stage > img.is-transformed {
  position: absolute; left: 50%; top: 50%; max-width: none; max-height: none;
  transition: transform 0.35s var(--ease-spring);
  box-shadow: 0 4px 16px rgb(15 23 42 / 0.18);
}
.live-preview__stage .skeleton--thumb { width: min(320px, 70%); }
.live-preview__caption { margin: 6px 0 0; color: var(--text-muted); font-size: 0.8rem; text-align: center; }
.live-preview__error { margin: 0; padding: 24px; color: var(--text-muted); text-align: center; }
/* What "Crop" keeps after straightening: everything outside is dimmed. */
.keep-area {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); pointer-events: none;
  outline: 2px dashed #fff; box-shadow: 0 0 0 9999px rgb(10 12 20 / 0.45);
}
.frame-preview { line-height: 0; box-shadow: 0 6px 20px rgb(15 23 42 / 0.2); overflow: hidden; transition: padding 0.2s, border-radius 0.2s, background-color 0.2s; }
.frame-preview > img { display: block; max-width: none; }

/* Resize: width ⛓ height */
.dim-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; align-items: end; }
.dim-row .input { min-width: 0; padding: 0 28px 0 10px; font-variant-numeric: tabular-nums; }
.dim-row .input-suffix > span { right: 9px; font-size: 0.78rem; }
/* Spinner arrows would take a third of these narrow boxes; typing and the arrow keys still work. */
.dim-row .input { -moz-appearance: textfield; appearance: textfield; }
.dim-row .input::-webkit-inner-spin-button, .dim-row .input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.lock-btn {
  display: grid; place-items: center; width: 34px; height: 44px; padding: 0;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text-muted); cursor: pointer;
}
.lock-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.lock-btn[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: color-mix(in srgb, var(--brand) 65%, var(--text)); }
.lock-btn[aria-pressed="false"] svg { opacity: 0.45; }
.lock-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.preset-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.preset-chip, .ratio-chip span {
  display: inline-flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
  font: 700 0.85rem/1.1 var(--font); cursor: pointer; transition: border-color 0.15s, background-color 0.15s;
}
.preset-chip small, .ratio-chip small { font-weight: 500; font-size: 0.68rem; color: var(--text-muted); }
.preset-chip:hover, .ratio-chip span:hover { border-color: var(--brand); }

/* Rotate & flip buttons */
.tool-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tool-btn {
  display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
  font: 600 0.82rem/1.2 var(--font); cursor: pointer; text-align: left;
  transition: border-color 0.15s, background-color 0.15s, transform 0.1s;
}
.tool-btn svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool-btn:hover { border-color: var(--brand); }
.tool-btn:active { transform: scale(0.97); }
.tool-btn[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: color-mix(in srgb, var(--brand) 65%, var(--text)); }
.tool-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* Colour swatches */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  position: relative; width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  background: var(--swatch, conic-gradient(red, yellow, lime, cyan, blue, magenta, red));
  box-shadow: inset 0 0 0 1px rgb(15 23 42 / 0.15); transition: transform 0.15s var(--ease-spring);
}
.swatch:hover { transform: scale(1.1); }
.swatch input[type="radio"] { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.swatch:has(input:checked), .swatch.is-selected { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand); }
.swatch:has(input:focus-visible) { box-shadow: 0 0 0 2px var(--surface), var(--focus-ring); }
.swatch--custom input[type="color"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }

/* Crop */
.ratio-chips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.ratio-chip { position: relative; }
.ratio-chip input { position: absolute; opacity: 0; pointer-events: none; }
.ratio-chip span { width: 100%; align-items: flex-start; }
.ratio-chip input:checked + span { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.ratio-chip input:focus-visible + span { box-shadow: var(--focus-ring); }
.crop-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.crop-fields label { display: grid; gap: 4px; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }
.crop-fields .input { min-height: 38px; }
.workbench__main, .workbench__custom { min-width: 0; }
.workbench__custom:has(.ic-stage) { display: flex; justify-content: center; padding: 12px; border-radius: 12px; background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px; }
.ic-stage { overflow: hidden; align-self: center; line-height: 0; }
.ic-stage img { max-width: none; max-height: none; } /* sized by ic-box.js */
.ic-stage.is-dragging, .ic-stage.is-dragging * { cursor: grabbing; }
.ic-box:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ic-handle[data-handle="n"] { top: 0; left: 50%; cursor: ns-resize; }
.ic-handle[data-handle="s"] { bottom: 0; left: 50%; cursor: ns-resize; }
.ic-handle[data-handle="e"] { top: 50%; right: 0; cursor: ew-resize; }
.ic-handle[data-handle="w"] { top: 50%; left: 0; cursor: ew-resize; }
.ic-handle[data-handle="n"], .ic-handle[data-handle="s"], .ic-handle[data-handle="e"], .ic-handle[data-handle="w"] { border-radius: 4px; width: 14px; height: 14px; margin: -7px; }
.ic-stage.has-aspect .ic-handle:is([data-handle="n"], [data-handle="s"], [data-handle="e"], [data-handle="w"]) { display: none; }
.ic-badge {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); padding: 2px 8px; border-radius: 999px;
  background: rgb(15 23 42 / 0.72); color: #fff; font: 700 0.72rem/1.4 var(--font); white-space: nowrap; pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.ic-loading { width: min(420px, 100%); }
.result-preview {
  margin: 0; padding: 12px; border-radius: 12px; text-align: center;
  background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px;
}
.result-preview__img { max-width: 100%; max-height: 360px; box-shadow: var(--shadow-sm); }

/* 12. Watermark, filters, blur regions, passport photos ---------------------------------- */
.preset-chip.is-active { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.live-preview__note { color: var(--danger); font-weight: 600; }
.wm-layer { position: absolute; pointer-events: none; }
.input--file { padding: 8px; min-height: auto; font-size: 0.85rem; }
.input--file::file-selector-button {
  margin-right: 10px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font: 600 0.82rem var(--font); cursor: pointer;
}

/* 3 × 3 watermark position picker */
.position-grid { display: grid; grid-template-columns: repeat(3, 34px); gap: 4px; padding: 6px; width: max-content; border-radius: 12px; background: var(--surface-2); }
.position-grid label { position: relative; display: grid; place-items: center; width: 34px; height: 26px; border-radius: 6px; background: var(--surface); cursor: pointer; }
.position-grid label::after { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--border); transition: background-color 0.15s, transform 0.15s var(--ease-spring); }
.position-grid input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.position-grid label:has(input:checked)::after { background: var(--brand); transform: scale(1.4); }
.position-grid label:has(input:focus-visible) { box-shadow: var(--focus-ring); }
.position-grid.is-disabled { opacity: 0.4; pointer-events: none; }

/* Blur: marked areas over the picture */
.workbench__custom:has(.re-stage) { display: flex; justify-content: center; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.re-stage { position: relative; align-self: center; line-height: 0; overflow: hidden; cursor: crosshair; touch-action: none; user-select: none; -webkit-user-select: none; }
.re-stage img { display: block; max-width: none; max-height: none; pointer-events: none; }
.re-region {
  position: absolute; cursor: move; outline: 2px solid #fff; box-shadow: 0 0 0 1px rgb(0 0 0 / 0.35), 0 2px 10px rgb(0 0 0 / 0.25);
  backdrop-filter: blur(var(--re-blur, 6px)); -webkit-backdrop-filter: blur(var(--re-blur, 6px));
}
.re-stage[data-mode="fill"] .re-region { backdrop-filter: none; -webkit-backdrop-filter: none; background: #000; }
.re-stage[data-mode="pixelate"] .re-region {
  background-image: linear-gradient(rgb(255 255 255 / 0.08) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / 0.08) 1px, transparent 1px);
  background-size: var(--re-blur, 6px) var(--re-blur, 6px);
}
.re-region:focus-visible { outline: 2px solid var(--brand); }
.re-remove {
  position: absolute; top: -11px; right: -11px; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%;
  background: #fff; color: #0f172a; font: 700 15px/22px var(--font); text-align: center; cursor: pointer; box-shadow: var(--shadow-sm);
}
.re-handle { position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px; border-radius: 3px; background: #fff; border: 2px solid var(--brand); cursor: nwse-resize; }
@media (pointer: coarse) { .re-handle { width: 22px; height: 22px; right: -11px; bottom: -11px; } }
.re-stage.is-whole { cursor: default; }
.re-stage.is-whole::after { content: ""; position: absolute; inset: 0; backdrop-filter: blur(var(--re-blur, 6px)); -webkit-backdrop-filter: blur(var(--re-blur, 6px)); }
.re-stage.is-whole[data-mode="fill"]::after { backdrop-filter: none; background: #000; }
.re-stage.is-whole .re-region { display: none; }
.region-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); font-size: 0.85rem; font-weight: 600; }

/* Passport photo: face guide inside the crop box */
.ratio-chips--wide { grid-template-columns: 1fr; }
.ic-stage.has-face-guide .ic-box::after {
  content: ""; position: absolute; left: 50%; top: 9%; width: 56%; height: 64%; transform: translateX(-50%);
  border: 2px dashed rgb(255 255 255 / 0.85); border-radius: 50%; pointer-events: none;
}
.ic-stage.has-face-guide .ic-box::before {
  content: ""; position: absolute; left: 12%; right: 12%; top: 42%; border-top: 1px dashed rgb(255 255 255 / 0.6); pointer-events: none;
}

/* 13. Data & Excel tools ------------------------------------------------------------------ */
.data-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 10px; }
.data-toolbar__sheet { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.85rem; }
.data-toolbar__summary { margin-left: auto; padding: 4px 10px; border-radius: 999px; background: var(--brand-soft); color: color-mix(in srgb, var(--brand) 65%, var(--text)); font-size: 0.8rem; font-weight: 700; }
.data-toolbar__summary:empty { display: none; }
.check--inline { display: inline-flex; align-items: center; font-size: 0.88rem; }
.input--sm { min-height: 34px; padding: 0 8px; font-size: 0.85rem; }
.data-table__more { margin: 6px 0 0; color: var(--text-muted); font-size: 0.8rem; }
.data-table-wrap .skeleton--row { margin: 8px; }
.data-table th.is-key { background: color-mix(in srgb, var(--brand) 16%, var(--surface-2)); color: color-mix(in srgb, var(--brand) 65%, var(--text)); }
.data-table th.is-key::before { content: "🔑 "; font-size: 0.75em; }
.data-table tbody tr.is-removed td:first-child { color: var(--diff-removed); text-decoration: line-through; }
.data-table .col--removed, .data-table th.col--removed { opacity: 0.45; background-image: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--diff-removed) 14%, transparent) 6px 8px); }
.data-table td[title] { cursor: help; }

.col-chips__bar { display: flex; gap: 12px; margin-bottom: 6px; font-size: 0.8rem; font-weight: 600; }
.col-chips__bar .link-btn { color: color-mix(in srgb, var(--brand) 65%, var(--text)); }
.col-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; max-height: 260px; overflow: auto; }
.col-chip { display: inline-flex; align-items: center; max-width: 100%; }
.col-chip .toggle-chip { max-width: 220px; }
.col-chips--sortable .col-chip { gap: 2px; padding-left: 2px; border-radius: 999px; background: var(--surface-2); }
.col-chip__grip { display: grid; place-items: center; width: 18px; height: 28px; color: var(--text-muted); cursor: grab; touch-action: none; }
.col-chip__grip svg { width: 14px; height: 14px; fill: currentColor; }
.col-chip.is-dragging { opacity: 0.9; box-shadow: var(--shadow-md); }

.data-report { display: grid; gap: 10px; }
.data-report__grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.data-report__size { margin: 0; color: var(--text-muted); font-size: 0.85rem; text-align: center; }
.stat__note { display: block; margin-top: 2px; color: var(--text-muted); font-size: 0.78rem; }

/* Data tools, Step 6: merge, split, CSV ↔ Excel, JSON */
.live-preview--table { margin-bottom: 16px; }
.data-table tbody tr.is-band td { background: color-mix(in srgb, var(--brand) 5%, var(--surface)); }
.data-table td.is-missing { background-image: repeating-linear-gradient(135deg, transparent 0 5px, color-mix(in srgb, var(--text-muted) 12%, transparent) 5px 6px); }
.data-table td.is-source { color: var(--text-muted); font-size: 0.78rem; }
.data-table td.type-number { text-align: right; color: color-mix(in srgb, var(--brand) 70%, var(--text)); }
.data-table td.type-date { color: #b45309; }
.type-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 0; list-style: none; font-size: 0.8rem; color: var(--text-muted); }
.type-legend li::before { content: "Aa"; margin-right: 5px; font-weight: 700; color: var(--text); }
.type-legend .is-number::before { content: "12"; color: color-mix(in srgb, var(--brand) 70%, var(--text)); }
.type-legend .is-date::before { content: "📅"; }

/* Compare Excel Sheets: colour-coded result */
.done__report:has(.diff-report) { max-width: none; }
/* min-width: 0 lets the wide table scroll inside its box instead of stretching the page on phones. */
.done__report { min-width: 0; }
.diff-report { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.diff-report > * { min-width: 0; }
.diff-report__files { margin: 0; text-align: center; color: var(--text-muted); overflow-wrap: anywhere; }
.diff-report__cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.diff-stat { border-left: 4px solid var(--swatch, var(--border)); }
.diff-stat--added { --swatch: var(--diff-added); }
.diff-stat--removed { --swatch: var(--diff-removed); }
.diff-stat--changed { --swatch: var(--diff-changed); }
.diff-report__line { margin: 0; text-align: center; font-weight: 600; }
.diff-report__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.diff-report__bar .diff-legend { margin: 0; }
.diff-filter { width: auto; }
.diff-filter span { padding: 6px 12px; }
.diff-grid { max-height: 560px; }
.diff-grid .diff-mark { font-weight: 800; text-align: center; }
.diff-grid tr.diff-added .diff-mark { color: var(--diff-added); }
.diff-grid tr.diff-removed .diff-mark { color: var(--diff-removed); }
.diff-grid tr.diff-changed .diff-mark { color: var(--diff-changed); }
.diff-grid tr.diff-removed td:not(.diff-mark) { text-decoration: line-through; color: var(--text-muted); }
.diff-grid tr.diff-gap td { padding: 6px; text-align: center; color: var(--text-muted); font-style: italic; background: var(--surface-2); }
.data-table th.col--added { background: color-mix(in srgb, var(--diff-added) 22%, var(--surface-2)); }
.data-table th.col--added::after { content: " new"; font-size: 0.7em; color: var(--diff-added); }
.data-table th.col--removed::after { content: " gone"; font-size: 0.7em; color: var(--diff-removed); }
.compare-order { padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.notice--warning { margin: 0; }

/* Footer: suite column titles are links to their hubs */
.footer-col__title a { color: inherit; }
.footer-col__title a:hover { color: color-mix(in srgb, var(--brand) 65%, var(--text)); }

/* Brand wordmark: "Doc" in the text colour, "Epic" in the brand gradient */
.logo__text { letter-spacing: -0.02em; }
.logo__accent {
  background: linear-gradient(90deg, #6366f1, #10b981);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
@media (forced-colors: active) { .logo__accent { color: CanvasText; background: none; } }

/* Tool page: the tool's own introduction above "How to use" */
.tool-about { max-width: 760px; margin: 0 0 18px; color: var(--text); font-size: 1.02rem; line-height: 1.65; }


/* Remove Background: preview on a checkerboard + background picker (under the download button) */
.rb { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; width: 100%; max-width: 1080px; margin-top: 8px; text-align: left; }
.rb__stage { display: grid; place-items: center; min-height: 240px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); }
.rb__canvas { display: block; max-width: 100%; max-height: 70vh; height: auto; border-radius: 8px; box-shadow: 0 1px 3px rgb(15 23 42 / .08); }
.rb__canvas.is-transparent { background: repeating-conic-gradient(#e5e7eb 0 25%, #fff 0 50%) 0 0 / 20px 20px; }
.rb__panel { display: flex; flex-direction: column; gap: 14px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); }
.rb__title { margin: 0; font-size: 1rem; }
.rb__tabs { width: 100%; }
.rb__pane { display: flex; flex-direction: column; gap: 10px; }
.rb__swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.rb__swatch { position: relative; cursor: pointer; }
.rb__swatch input[type="radio"] { position: absolute; opacity: 0; }
.rb__swatch > span:first-of-type { display: block; width: 100%; aspect-ratio: 1; border-radius: 10px; border: 1px solid var(--border); }
.rb__swatch input:checked + span { outline: 3px solid var(--suite-image); outline-offset: 2px; }
.rb__swatch input:focus-visible + span { outline: 3px solid var(--suite-image-strong); outline-offset: 2px; }
.rb__presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rb__preset { position: relative; cursor: pointer; }
.rb__preset input { position: absolute; opacity: 0; }
.rb__preset canvas, .rb__preset > span:first-of-type { display: grid; place-items: center; width: 100%; aspect-ratio: 1; border-radius: 10px; border: 1px solid var(--border); overflow: hidden; }
.rb__preset--upload > span:first-of-type { font-size: .72rem; font-weight: 600; text-align: center; color: var(--suite-image-strong); background: var(--suite-image-soft); border-style: dashed; }
.rb__preset--upload img { width: 100%; height: 100%; object-fit: cover; }
.rb__preset input:checked + canvas, .rb__preset input:checked + span { outline: 3px solid var(--suite-image); outline-offset: 2px; }
.rb__preset input:focus-visible + canvas, .rb__preset input:focus-visible + span { outline: 3px solid var(--suite-image-strong); outline-offset: 2px; }
.rb__status { min-height: 1.2em; margin: 0; font-size: .85rem; color: var(--text-muted); }
.rb__download { width: 100%; }
@media (max-width: 760px) {
  .rb { grid-template-columns: minmax(0, 1fr); }
}
/* "Choose any colour": a full-width button; the native colour input covers it invisibly, so any tap opens the picker. */
.rb__picked { margin: 0; font-size: 0.85rem; color: var(--text-muted); }
.rb__custom { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px dashed var(--border); border-radius: 12px; cursor: pointer; }
.rb__custom:hover { border-color: var(--suite-image); background: var(--suite-image-soft); }
.rb__custom input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.rb__custom-swatch { flex: none; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border);
  background: conic-gradient(#ef4444, #f59e0b, #eab308, #22c55e, #06b6d4, #3b82f6, #8b5cf6, #ec4899, #ef4444); }
.rb__custom-text { display: flex; flex-direction: column; gap: 2px; font-size: 0.9rem; }
.rb__custom-text small { color: var(--text-muted); font-family: var(--font-mono, monospace); }
.rb__custom-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.rb__custom:has(input[type="radio"]:checked) { border-style: solid; border-color: var(--suite-image); box-shadow: 0 0 0 2px var(--suite-image); }
.rb__custom:has(.rb__custom-input:focus-visible) { box-shadow: var(--focus-ring); }
.rb__scale { grid-column: 1 / -1; display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--text-muted); margin-top: -4px; }

/* Image report: where the images were processed */
.img-report__where { margin: 4px 0 0; font-size: .85rem; color: var(--text-muted); text-align: center; }
.engine-badge--hybrid::before { background: var(--success); }
