@charset "UTF-8";
/* ==========================================================================
   PMNM.in design system
   One stylesheet, no framework, no web fonts (system stack = zero LCP cost).
   Order: tokens → reset → layout → typography → components → pages → utilities
   ========================================================================== */

/* ------------------------------------------------------------------ tokens */
:root {
  /* Brand: a deep teal-green reads as money/trust without the generic SaaS blue */
  --c-primary: #0d7a63;
  --c-primary-600: #0a6553;
  --c-primary-700: #085243;
  --c-primary-50: #e8f5f1;
  --c-primary-100: #cfe9e1;

  --c-accent: #b4620a;
  --c-accent-50: #fdf3e6;

  --c-ink: #10221f;
  --c-body: #33484a;
  --c-muted: #64777c;
  --c-faint: #8a9aa0;

  --c-bg: #f5f8f8;
  --c-surface: #ffffff;
  --c-surface-2: #f0f5f4;
  --c-border: #dde6e5;
  --c-border-strong: #c3d3d1;

  --c-ok: #0f7a44;
  --c-ok-bg: #e9f7ef;
  --c-warn: #92610a;
  --c-warn-bg: #fdf4e3;
  --c-err: #b3261e;
  --c-err-bg: #fdecea;
  --c-info: #0c5c8f;
  --c-info-bg: #e9f2f9;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;
  --sp-12: 48px; --sp-16: 64px; --sp-20: 80px;

  --shadow-1: 0 1px 2px rgba(16, 34, 31, .06), 0 1px 3px rgba(16, 34, 31, .04);
  --shadow-2: 0 2px 6px rgba(16, 34, 31, .07), 0 8px 20px -8px rgba(16, 34, 31, .10);
  --shadow-3: 0 12px 32px -12px rgba(16, 34, 31, .22);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          "Noto Sans", "Noto Sans Devanagari", Arial, sans-serif;
  --font-num: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;

  --wrap: 1200px;
  --wrap-narrow: 760px;
  --header-h: 60px;
  --t-fast: 140ms;
  --t: 220ms;
  --ease: cubic-bezier(.2, .7, .3, 1);
}

/* Dark palette. Declared once and applied two ways:
   1. :root[data-theme="dark"] — set by the inline script in <head> from the
      saved preference or the OS setting, before first paint.
   2. the media query below — a no-JavaScript fallback only, scoped with
      :not([data-theme]) so it never fights an explicit user choice. */
:root[data-theme="dark"] {
  --c-primary: #3fbfa2;
  --c-primary-600: #2fa88c;
  --c-primary-700: #268f77;
  --c-primary-50: #122b27;
  --c-primary-100: #16352f;

  --c-accent: #e2a355;
  --c-accent-50: #2c2113;

  --c-ink: #e8f0ee;
  --c-body: #c1d0cd;
  --c-muted: #94a7a5;
  --c-faint: #74898a;

  --c-bg: #0c1615;
  --c-surface: #12201e;
  --c-surface-2: #172a27;
  --c-border: #223936;
  --c-border-strong: #305049;

  --c-ok: #4ecb8b;   --c-ok-bg: #102a1e;
  --c-warn: #e0b063; --c-warn-bg: #2a2214;
  --c-err: #f18b82;  --c-err-bg: #2d1817;
  --c-info: #7bbde8; --c-info-bg: #12242f;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 2px 8px rgba(0, 0, 0, .45);
  --shadow-3: 0 14px 34px -14px rgba(0, 0, 0, .7);

  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

/* No prefers-color-scheme fallback: the site opens light for every visitor,
   whatever their device is set to. Dark is opt-in via the header toggle and
   is remembered in localStorage once chosen. */

/* ------------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--c-body);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  /* No overflow-x:hidden here. It would mask real layout bugs, and it makes
     <body> the scroll container, which silently breaks window.scrollTo() and
     scroll-margin. Overflow is fixed at the component level instead — see the
     "responsive hardening" section at the end of this file. */
}
img, svg, canvas { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { color: var(--c-ink); line-height: 1.25; margin: 0 0 var(--sp-3); font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 1.25rem + 1.6vw, 2.25rem); }
h2 { font-size: clamp(1.25rem, 1.1rem + .8vw, 1.55rem); }
h3 { font-size: 1.08rem; }
p  { margin: 0 0 var(--sp-4); }
ul, ol { margin: 0 0 var(--sp-4); padding-left: 1.25em; }
li { margin-bottom: var(--sp-2); }
a { color: var(--c-primary-600); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--c-primary-700); }
hr { border: 0; border-top: 1px solid var(--c-border); margin: var(--sp-8) 0; }
code { font-family: var(--font-num); font-size: .92em; background: var(--c-surface-2); padding: .1em .35em; border-radius: 5px; }
table { border-collapse: collapse; width: 100%; }
:target { scroll-margin-top: calc(var(--header-h) + 20px); }

:focus-visible {
  outline: 3px solid var(--c-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

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

/* ------------------------------------------------------------------ layout */
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--sp-4); }
.wrap--narrow { max-width: var(--wrap-narrow); }
.site-main { display: block; min-height: 50vh; padding-bottom: var(--sp-16); }
.section { margin: var(--sp-10) 0; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; }
.section__more { font-size: .9rem; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.section__more:hover { text-decoration: underline; }
.section__lead { color: var(--c-muted); max-width: 70ch; margin-top: -4px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--c-primary); color: #fff; padding: 10px 16px; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------------ header */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--c-surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--c-border);
}
.site-header__inner { display: flex; align-items: center; gap: var(--sp-4); min-height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--c-ink); font-weight: 800; letter-spacing: -.02em; }
.brand__mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(150deg, var(--c-primary), var(--c-primary-700)); color: #fff;
}
.brand__text { font-size: 1.12rem; }
.brand__dot { color: var(--c-primary); }

.nav { margin-left: auto; display: none; }
.nav__list { display: flex; align-items: center; gap: 2px; list-style: none; margin: 0; padding: 0; }
.nav__item { position: relative; margin: 0; }
.nav__link {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: .93rem; font-weight: 600; color: var(--c-body);
  text-decoration: none; background: none; border: 0; cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.nav__link:hover { background: var(--c-surface-2); color: var(--c-ink); }
.nav__chev { transform: rotate(90deg); transition: transform var(--t-fast) var(--ease); }
.nav__toggle[aria-expanded="true"] .nav__chev { transform: rotate(-90deg); }

.menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 70;
  width: min(560px, 80vw); padding: var(--sp-3);
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-3);
}
.menu[hidden] { display: none; }
.menu__list { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; list-style: none; margin: 0 0 var(--sp-2); padding: 0; }
.menu__list li { margin: 0; }
.menu__link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); text-decoration: none; color: var(--c-body); }
.menu__link:hover { background: var(--c-primary-50); color: var(--c-ink); }
.menu__link strong { display: block; font-size: .9rem; font-weight: 650; }
.menu__link small { color: var(--c-faint); font-size: .78rem; }
.menu__icon { color: var(--c-primary); flex: none; }
.menu__all { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; font-size: .88rem; font-weight: 600; text-decoration: none; }

.site-header__actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px;
  background: none; border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--c-body); cursor: pointer; transition: background var(--t-fast) var(--ease);
}
.icon-btn:hover { background: var(--c-surface-2); }
.icon-btn--sm { width: 32px; height: 32px; }

.header-search { border-top: 1px solid var(--c-border); background: var(--c-surface); padding: var(--sp-3) 0; }
.header-search[hidden] { display: none; }

.mobile-nav { border-top: 1px solid var(--c-border); background: var(--c-surface); padding: var(--sp-4) 0 var(--sp-6); max-height: 75vh; overflow-y: auto; }
.mobile-nav[hidden] { display: none; }
.mobile-nav__head { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--c-faint); font-weight: 700; margin: var(--sp-3) 0 var(--sp-2); }
.mobile-nav__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.mobile-nav__list li { margin: 0; }
.mobile-nav__list--plain a { display: block; padding: 10px; border-radius: var(--radius-sm); text-decoration: none; color: var(--c-body); font-weight: 600; }
.mobile-nav__list--plain a:hover { background: var(--c-surface-2); }

@media (min-width: 1000px) {
  .nav { display: block; }
  .nav__burger { display: none; }
  .site-header__actions { margin-left: 0; }
}

/* ------------------------------------------------------------------ search */
.search { position: relative; }
.search__form { display: flex; align-items: center; gap: var(--sp-2); position: relative; }
.search__icon { position: absolute; left: 14px; color: var(--c-faint); pointer-events: none; display: grid; }
.search__input {
  flex: 1; min-width: 0; padding: 12px 14px 12px 44px;
  border: 1.5px solid var(--c-border-strong); border-radius: var(--radius);
  background: var(--c-surface); color: var(--c-ink);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.search__input::placeholder { color: var(--c-faint); }
.search__input:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 4px var(--c-primary-50); }
.search--lg .search__input { padding: 16px 16px 16px 48px; font-size: 1.05rem; border-radius: var(--radius-lg); }
.search__submit { flex: none; }
@media (max-width: 560px) { .search__submit { display: none; } }

.search__results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 80;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-3);
  max-height: min(60vh, 460px); overflow-y: auto; padding: 6px;
}
.search__results[hidden] { display: none; }
.sr-item {
  display: flex; align-items: flex-start; gap: 10px; width: 100%;
  padding: 10px; border-radius: var(--radius-sm); text-decoration: none; color: var(--c-body);
  border: 0; background: none; text-align: left; cursor: pointer;
}
.sr-item:hover, .sr-item.is-active { background: var(--c-primary-50); }
.sr-item.is-active { outline: 2px solid var(--c-primary); outline-offset: -2px; }
.sr-item__icon { color: var(--c-primary); flex: none; margin-top: 2px; }
.sr-item__name { display: block; font-weight: 650; color: var(--c-ink); font-size: .95rem; }
.sr-item__desc { display: block; font-size: .84rem; color: var(--c-muted); }
.sr-item__cat { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--c-primary); margin-top: 2px; }
.sr-item mark { background: var(--c-accent-50); color: inherit; border-radius: 3px; padding: 0 1px; }
.sr-empty { padding: var(--sp-5); text-align: center; color: var(--c-muted); font-size: .92rem; }
.sr-foot { padding: 8px 10px; border-top: 1px solid var(--c-border); font-size: .8rem; color: var(--c-faint); }

/* -------------------------------------------------------------------- hero */
.hero {
  background:
    radial-gradient(1000px 380px at 15% -10%, var(--c-primary-50), transparent 60%),
    radial-gradient(700px 300px at 92% 0%, var(--c-accent-50), transparent 55%);
  border-bottom: 1px solid var(--c-border);
  padding: var(--sp-12) 0 var(--sp-10);
}
.hero__inner { max-width: 800px; text-align: center; }
.hero__eyebrow {
  display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .02em;
  color: var(--c-primary-700); background: var(--c-surface);
  border: 1px solid var(--c-primary-100); padding: 5px 12px; border-radius: var(--radius-pill);
  margin-bottom: var(--sp-4);
}
.hero__title { font-size: clamp(1.85rem, 1.2rem + 3vw, 3rem); margin-bottom: var(--sp-3); }
.hero__lead { font-size: clamp(1rem, .95rem + .3vw, 1.14rem); color: var(--c-body); max-width: 62ch; margin: 0 auto var(--sp-6); }
.hero__search { max-width: 620px; margin: 0 auto; text-align: left; }
.hero__chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 0; margin: var(--sp-5) 0 0; }
.hero__chips li { margin: 0; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; }
.chips li { margin: 0; }
.chip {
  display: inline-block; padding: 6px 13px; border-radius: var(--radius-pill);
  background: var(--c-surface); border: 1px solid var(--c-border);
  font-size: .86rem; color: var(--c-body); text-decoration: none;
  transition: border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.chip:hover { border-color: var(--c-primary); color: var(--c-primary-700); transform: translateY(-1px); }

/* ------------------------------------------------------------------- cards */
.grid { display: grid; gap: var(--sp-4); }
.grid--tools { grid-template-columns: 1fr; }
.grid--cats { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid--why { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--sp-5); }
@media (min-width: 560px) { .grid--tools { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .grid--tools { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1180px) { .grid--tools { grid-template-columns: repeat(4, 1fr); } }

.card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius-lg); transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease), transform var(--t) var(--ease);
}
.card:hover { border-color: var(--c-primary-100); box-shadow: var(--shadow-2); transform: translateY(-2px); }
.card__link { display: flex; gap: var(--sp-3); padding: var(--sp-4); text-decoration: none; color: inherit; height: 100%; align-items: flex-start; }
.card__icon {
  flex: none; display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 10px; background: var(--c-primary-50); color: var(--c-primary-700);
}
.card__icon--lg { width: 44px; height: 44px; }
.card__body { min-width: 0; }
.card__title { display: block; font-weight: 700; color: var(--c-ink); font-size: .98rem; line-height: 1.35; margin-bottom: 3px; }
.card__desc { display: block; font-size: .87rem; color: var(--c-muted); line-height: 1.5; }
.card__meta { display: block; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--c-primary); margin-top: 8px; }
.badge { display: inline-block; margin-left: 6px; font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 2px 6px; border-radius: 5px; vertical-align: middle; }
.badge--new { background: var(--c-accent-50); color: var(--c-accent); }

.why__item h3 { margin: var(--sp-3) 0 var(--sp-2); }
.why__item p { color: var(--c-muted); font-size: .93rem; margin: 0; }
.why__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: var(--c-primary-50); color: var(--c-primary-700); }

/* ----------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--radius); border: 1.5px solid transparent;
  font-size: .95rem; font-weight: 650; line-height: 1; text-decoration: none; cursor: pointer;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--c-primary); color: #fff; box-shadow: var(--shadow-1); }
.btn--primary:hover { background: var(--c-primary-600); color: #fff; }
.btn--ghost { background: var(--c-surface); border-color: var(--c-border-strong); color: var(--c-body); }
.btn--ghost:hover { border-color: var(--c-primary); color: var(--c-primary-700); }
.btn--lg { padding: 14px 24px; font-size: 1rem; }
.btn--sm { padding: 7px 12px; font-size: .85rem; border-radius: var(--radius-sm); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; pointer-events: none; }

/* ------------------------------------------------------------------- forms */
.fields { display: grid; grid-template-columns: 1fr; gap: var(--sp-4); }
@media (min-width: 620px) { .fields { grid-template-columns: repeat(2, 1fr); } }
.field { min-width: 0; }
.field--full, .field--list, .field--radio, .field--textarea { grid-column: 1 / -1; }
.field[hidden] { display: none; }
.field__label { display: block; font-size: .9rem; font-weight: 650; color: var(--c-ink); margin-bottom: 6px; }
.field__unit { font-weight: 600; color: var(--c-muted); font-size: .85em; }
.field__opt { font-weight: 500; color: var(--c-faint); font-size: .85em; }
.field__control { position: relative; display: flex; align-items: stretch; }
.input {
  width: 100%; min-width: 0; padding: 11px 13px;
  border: 1.5px solid var(--c-border-strong); border-radius: var(--radius);
  background: var(--c-surface); color: var(--c-ink);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.input:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 4px var(--c-primary-50); }
.input--select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364777c' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px;
  padding-right: 36px;
}
.input--area { resize: vertical; min-height: 92px; line-height: 1.55; }
.field__addon {
  display: grid; place-items: center; padding: 0 12px; flex: none;
  background: var(--c-surface-2); border: 1.5px solid var(--c-border-strong);
  color: var(--c-muted); font-weight: 650; font-size: .95rem;
}
.field__addon--pre { border-right: 0; border-radius: var(--radius) 0 0 var(--radius); }
.field__addon--pre + .input { border-radius: 0 var(--radius) var(--radius) 0; }
.field__addon--suf { border-left: 0; border-radius: 0 var(--radius) var(--radius) 0; }
.field__control:has(.field__addon--suf) .input { border-radius: var(--radius) 0 0 var(--radius); }
.field__control:has(.field__addon--pre):has(.field__addon--suf) .input { border-radius: 0; }
.field__help { font-size: .8rem; color: var(--c-muted); margin: 5px 0 0; line-height: 1.45; }
.field__words { font-size: .78rem; color: var(--c-primary-700); margin: 5px 0 0; font-weight: 600; min-height: 1.1em; }
.field__error { font-size: .82rem; color: var(--c-err); margin: 5px 0 0; font-weight: 600; display: flex; gap: 5px; }
.field__error::before { content: "!"; display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--c-err); color: #fff; font-size: .7rem; font-weight: 800; flex: none; margin-top: 2px; }
.field__error[hidden] { display: none; }
.field.is-invalid .input { border-color: var(--c-err); }
.field.is-invalid .input:focus { box-shadow: 0 0 0 4px var(--c-err-bg); }

.fieldset { border: 1px solid var(--c-border); border-radius: var(--radius-lg); padding: var(--sp-4); margin: 0 0 var(--sp-4); }
.fieldset__legend { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--c-primary-700); padding: 0 8px; }

.radios { display: grid; gap: 8px; }
@media (min-width: 620px) { .radios { grid-auto-flow: column; grid-auto-columns: 1fr; } }
.radio, .check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding: 10px 12px; border: 1.5px solid var(--c-border); border-radius: var(--radius); background: var(--c-surface); transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease); }
.radio:hover, .check:hover { border-color: var(--c-border-strong); }
.radio input, .check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.radio__box, .check__box { flex: none; width: 20px; height: 20px; border: 2px solid var(--c-border-strong); background: var(--c-surface); display: grid; place-items: center; margin-top: 1px; color: transparent; }
.radio__box { border-radius: 50%; }
.check__box { border-radius: 6px; }
.radio input:checked ~ .radio__box { border-color: var(--c-primary); box-shadow: inset 0 0 0 4px var(--c-primary); }
.check input:checked ~ .check__box { border-color: var(--c-primary); background: var(--c-primary); color: #fff; }
.radio:has(input:checked), .check:has(input:checked) { border-color: var(--c-primary); background: var(--c-primary-50); }
.radio input:focus-visible ~ .radio__box, .check input:focus-visible ~ .check__box { outline: 3px solid var(--c-primary); outline-offset: 2px; }
.radio__text, .check__text { font-size: .92rem; line-height: 1.4; }
.radio__text small, .check__text small { display: block; color: var(--c-muted); font-size: .8rem; }

/* repeatable rows */
.rows { display: grid; gap: 8px; margin-bottom: var(--sp-3); }
.rows__head, .rows__row { display: grid; grid-template-columns: repeat(var(--cols, 2), 1fr) 36px; gap: 8px; align-items: center; }
.rows__head { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--c-faint); }
.rows__cell { min-width: 0; }
.rows__del { color: var(--c-muted); }
.rows__del:hover { color: var(--c-err); background: var(--c-err-bg); }
@media (max-width: 620px) {
  .rows__head { display: none; }
  .rows__row { grid-template-columns: 1fr 1fr 36px; }
}

.tool-form__actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-5); }
.tool-form__hint { font-size: .8rem; color: var(--c-faint); margin: var(--sp-3) 0 0; }
.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.site-form { margin: var(--sp-6) 0; }
.form-status { margin-top: var(--sp-3); font-weight: 600; font-size: .92rem; }
.form-status.is-ok { color: var(--c-ok); }
.form-status.is-err { color: var(--c-err); }

/* ------------------------------------------------------------- tool layout */
/* Tool pages are a single centred column. The tool is the page. */
.tool-layout { display: block; padding-top: var(--sp-4); }
.tool-main { min-width: 0; max-width: 860px; margin: 0 auto; }

.crumbs { margin: var(--sp-4) 0; font-size: .84rem; }
.crumbs__list { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; color: var(--c-muted); }
.crumbs__item { margin: 0; display: flex; align-items: center; gap: 6px; }
.crumbs__item + .crumbs__item::before { content: "/"; color: var(--c-faint); }
.crumbs a { color: var(--c-muted); text-decoration: none; }
.crumbs a:hover { color: var(--c-primary-700); text-decoration: underline; }
.crumbs [aria-current] { color: var(--c-ink); font-weight: 600; }

/* The tool comes first. Title, one line of explanation, then the tool itself —
   nothing between the visitor and the thing they came to use. */
.tool-head { text-align: center; margin: 0 0 var(--sp-4); }
.tool-head h1 { margin-bottom: 8px; font-size: clamp(1.7rem, 1.2rem + 2.2vw, 2.6rem); letter-spacing: -.02em; }
.tool-head__lead { color: var(--c-muted); margin: 0 auto; max-width: 56ch; font-size: 1.05rem; }

.trust {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: var(--sp-2) var(--sp-5);
  list-style: none; margin: 0 0 var(--sp-5); padding: 0;
  font-size: .82rem; color: var(--c-muted);
}
.trust li { display: flex; align-items: center; gap: 6px; margin: 0; }
.trust svg { color: var(--c-primary); flex: none; }

.tool-intro { max-width: 72ch; }
.tool-intro p { color: var(--c-body); }

.tool-panel {
  display: grid; grid-template-columns: 1fr; gap: 0;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-1);
  margin: var(--sp-5) 0;
}
@media (min-width: 860px) { .tool-panel { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); } }
/* Widgets that render their own result get the full width. */
.tool-panel--solo { grid-template-columns: 1fr !important; }
.tool-panel__form { padding: var(--sp-5); }
.tool-panel__result { padding: var(--sp-5); background: var(--c-surface-2); border-top: 1px solid var(--c-border); }
@media (min-width: 860px) { .tool-panel__result { border-top: 0; border-left: 1px solid var(--c-border); } }
.tool-panel__title { font-size: .82rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--c-primary-700); margin-bottom: var(--sp-4); }

/* ------------------------------------------------ studio tools (invoice, QR) */
/* Form on the left, live output on the right. One column on small screens,
   with the form first — you cannot preview what you have not typed yet. */
.studio { display: grid; grid-template-columns: 1fr; gap: var(--sp-6); }
@media (min-width: 1000px) {
  .studio { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .studio__stage { position: sticky; top: calc(var(--header-h) + 12px); }
}
.studio__form { min-width: 0; display: grid; gap: var(--sp-5); }
.studio__side { min-width: 0; }

.sblock {
  border: 1px solid var(--c-border); border-radius: var(--radius-lg);
  background: var(--c-surface); overflow: hidden;
}
.sblock__h {
  margin: 0; padding: var(--sp-3) var(--sp-4);
  font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
  color: var(--c-primary-700); background: var(--c-surface-2);
  border-bottom: 1px solid var(--c-border);
}
.sblock__body { padding: var(--sp-4); display: grid; gap: var(--sp-4); }
.sblock__body > .field { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: var(--sp-4); }
@media (min-width: 560px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.studio__stage {
  border: 1px solid var(--c-border); border-radius: var(--radius-lg);
  background: var(--c-surface); overflow: hidden;
}
.studio__bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--c-border);
  background: var(--c-surface-2);
}
.studio__bar-h { margin: 0; font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--c-primary-700); }
.studio__actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); padding: var(--sp-4); border-top: 1px solid var(--c-border); }
.studio__actions .btn { flex: 1 1 auto; }
@media (min-width: 520px) { .studio__actions .btn { flex: 0 0 auto; } }

/* image picker */
.imgpick__row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.imgpick__btn { cursor: pointer; }
.imgpick__thumb { max-height: 44px; max-width: 120px; width: auto; border: 1px solid var(--c-border); border-radius: var(--radius-sm); background: #fff; padding: 2px; }

/* invoice item cards */
.items { display: grid; gap: var(--sp-3); }
.item { border: 1px solid var(--c-border); border-radius: var(--radius); padding: var(--sp-3); background: var(--c-surface-2); }
.item__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-2); }
.item__n { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--c-primary-50); color: var(--c-primary-700); font-size: .75rem; font-weight: 750; }
.item__del { font-size: 1.1rem; line-height: 1; }
.item__del:hover { color: var(--c-err); background: var(--c-err-bg); }
.item__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); margin-top: var(--sp-3); }
@media (min-width: 620px) { .item__grid { grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); } }
.item__amt { margin: var(--sp-3) 0 0; font-size: .85rem; color: var(--c-muted); text-align: right; }
.item__amt strong { color: var(--c-ink); font-size: .95rem; }

/* the invoice sheet itself — always light, because it is paper */
/* The sheet is fluid by default so it always fits its column. "Actual size"
   switches to a true 794px A4 width, which then scrolls horizontally inside
   its own wrapper — the page itself never scrolls sideways. */
.paper-wrap { padding: var(--sp-4); background: var(--c-surface-2); overflow-x: auto; }
.paper {
  width: 100%; margin: 0 auto; padding: 30px;
  background: #ffffff; color: #16211f;
  box-shadow: 0 2px 14px rgb(0 0 0 / .14); border-radius: 4px;
  font-size: 12px; line-height: 1.5;
}
.paper-wrap.is-actual .paper { width: 794px; max-width: none; padding: 34px; font-size: 13px; }
@media (max-width: 860px) {
  /* Below this the invoice table cannot compress any further without the
     columns colliding, so the whole sheet keeps a workable width and the
     wrapper scrolls it. The sheet stays a sheet — the table never spills
     off the white. */
  .paper { padding: 18px; font-size: 11.5px; min-width: 540px; }
}

.inv__top { display: flex; gap: 20px; justify-content: space-between; flex-wrap: wrap; }
.inv__brand { display: flex; gap: 14px; align-items: flex-start; min-width: 0; }
.inv__logo { max-width: 120px; max-height: 62px; width: auto; height: auto; }
.inv__biz { margin: 0 0 4px; font-size: 16px; font-weight: 700; color: #0d1a18; }
.inv__lines { margin: 0 0 3px; color: #4a5654; font-size: 12px; white-space: normal; }
.inv__meta { text-align: right; margin-left: auto; }
.inv__title { margin: 0 0 8px; font-size: 22px; letter-spacing: -.01em; color: #0d7a63; }
.inv__metatable { border-collapse: collapse; margin-left: auto; }
.inv__metatable td { padding: 2px 0 2px 12px; font-size: 12px; }
.inv__metatable td:first-child { color: #4a5654; }
.inv__metatable td:last-child { font-weight: 650; }

.inv__parties { margin: 18px 0; padding-top: 14px; border-top: 1px solid #dfe5e4; }
.inv__party h2 { margin: 0 0 5px; font-size: 10px; letter-spacing: .09em; text-transform: uppercase; color: #4a5654; }
.inv__pname { margin: 0 0 3px; font-weight: 700; font-size: 14px; color: #0d1a18; }

.inv__items { width: 100%; border-collapse: collapse; margin: 6px 0 14px; }
.inv__items th { background: #f1f5f4; color: #4a5654; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; padding: 7px 6px; text-align: left; }
.inv__items td { padding: 7px 6px; border-bottom: 1px solid #e8edec; vertical-align: top; font-size: 12px; }
.inv__items .r, .inv__items th.r { text-align: right; }
.inv__items .c, .inv__items th.c { text-align: center; }
.inv__ph { color: #9aa5a3; font-style: italic; }

.inv__sums { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.inv__sums table { border-collapse: collapse; min-width: 240px; }
.inv__sums td { padding: 3px 0; font-size: 12.5px; }
.inv__sums td:first-child { color: #4a5654; padding-right: 26px; }
.inv__sums td:last-child { text-align: right; font-weight: 650; }
.inv__grand td { border-top: 1.5px solid #cfd8d6; padding-top: 7px; font-size: 15px; font-weight: 800; color: #0d1a18; }
.inv__words { margin: 4px 0 0; font-size: 11.5px; color: #4a5654; text-align: right; max-width: 340px; }

.inv__foot { display: grid; grid-template-columns: 1fr; gap: 18px; margin-top: 20px; padding-top: 14px; border-top: 1px solid #dfe5e4; }
@media (min-width: 620px) { .inv__foot { grid-template-columns: 1.4fr 1fr; } }
.inv__foot h2 { margin: 0 0 5px; font-size: 10px; letter-spacing: .09em; text-transform: uppercase; color: #4a5654; }
.inv__foot h2 + table, .inv__foot h2 + p { margin-bottom: 12px; }
.inv__pay { border-collapse: collapse; }
.inv__pay td { padding: 2px 0; font-size: 12px; }
.inv__pay td:first-child { color: #4a5654; padding-right: 16px; }
.inv__footcol--right { text-align: right; }
.inv__qr img { width: 104px; height: 104px; margin-left: auto; }
.inv__qr p { margin: 4px 0 12px; font-size: 11px; color: #4a5654; }
.inv__sign img { max-width: 140px; max-height: 52px; margin-left: auto; }
.inv__signgap { height: 34px; }
.inv__sign p { margin: 0; padding-top: 5px; border-top: 1px solid #cfd8d6; display: inline-block; min-width: 150px; font-size: 12px; font-weight: 650; }
.inv__signbiz { border: 0 !important; padding-top: 2px !important; font-weight: 400 !important; color: #4a5654; font-size: 11px; }
.inv__legal { margin: 16px 0 0; font-size: 10.5px; color: #7c8886; text-align: center; }

/* QR studio */
.qrtypes { display: flex; flex-wrap: wrap; gap: 6px; }
.qrtype {
  border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-body);
  border-radius: 999px; padding: 8px 15px; font-size: .87rem; font-weight: 600; cursor: pointer;
  min-height: 40px; transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.qrtype:hover { border-color: var(--c-primary); color: var(--c-primary-700); }
.qrtype.is-on { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.qrtype:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
.qrpanel { display: grid; gap: var(--sp-4); }
.qrpanel[hidden] { display: none; }

.qrstage { display: grid; place-items: center; padding: var(--sp-6) var(--sp-4); background: var(--c-surface-2); min-height: 260px; }
.qrstage__canvas { width: 260px; height: 260px; max-width: 100%; image-rendering: pixelated; border-radius: 4px; box-shadow: 0 2px 12px rgb(0 0 0 / .12); }
.qrstage__canvas[hidden] { display: none; }
.qrstage__empty { margin: 0; color: var(--c-muted); font-size: .9rem; text-align: center; max-width: 30ch; }
.qrstage__meta { margin: 0; padding: var(--sp-3) var(--sp-4) 0; font-size: .82rem; color: var(--c-muted); text-align: center; }
.qrstage__warn { margin: var(--sp-3) var(--sp-4) 0; }
.colour { display: flex; align-items: center; gap: var(--sp-3); }
.colour input[type="color"] { width: 52px; height: 40px; padding: 2px; border: 1px solid var(--c-border); border-radius: var(--radius-sm); background: var(--c-surface); cursor: pointer; }
.colour output { font-size: .85rem; color: var(--c-muted); font-variant-numeric: tabular-nums; }
.field__control input[type="range"] { flex: 1 1 auto; min-width: 0; padding: 0; height: 34px; accent-color: var(--c-primary); }
.field__control:has(input[type="range"]) { display: flex; align-items: center; gap: var(--sp-3); }
.field__control output { font-size: .85rem; color: var(--c-muted); min-width: 3.5ch; text-align: right; font-variant-numeric: tabular-nums; }
.input-group { display: flex; align-items: stretch; }
.input-group__pre { display: grid; place-items: center; padding: 0 10px; border: 1px solid var(--c-border); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--c-surface-2); color: var(--c-muted); font-size: .9rem; }
.input-group .input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* Printing: the invoice sheet is the page, everything else disappears. */
@media print {
  .studio__form, .studio__bar, .studio__actions, .tool-learn, .trust, .tool-head__lead { display: none !important; }
  .studio, .studio--qr { display: block !important; }
  .studio__stage { position: static !important; border: 0 !important; }
  .paper-wrap { padding: 0 !important; background: #fff !important; overflow: visible !important; }
  .paper { width: auto !important; max-width: none !important; box-shadow: none !important; padding: 0 !important; border-radius: 0 !important; }
  .inv__items thead { display: table-header-group; }
  .inv__items tr, .item { break-inside: avoid; }
  /* The sheet is the page when printing: no card border around it, and no
     minimum width forced by the small-screen rule. */
  .tool-panel:has(.studio) { border: 0 !important; box-shadow: none !important; }
  .paper { min-width: 0 !important; }
}

/* ------------------------------------------------------ folded explanation */
/* Everything that explains the tool lives below it, collapsed. The text stays
   in the DOM — crawlable and findable with find-in-page — but costs no screen
   space until the visitor asks for it. */
.tool-learn { margin-top: var(--sp-9); border-top: 1px solid var(--c-border); padding-top: var(--sp-6); }
.tool-learn__h { font-size: 1.15rem; color: var(--c-muted); font-weight: 700; margin-bottom: var(--sp-4); }
.tool-learn .tool-intro { margin-bottom: var(--sp-5); }

.fold { border-bottom: 1px solid var(--c-border); }
.fold:first-of-type { border-top: 1px solid var(--c-border); }
.fold__q {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4) 0; cursor: pointer; list-style: none;
}
.fold__q::-webkit-details-marker { display: none; }
.fold__q::after {
  content: ""; flex: none; margin-left: auto;
  width: 9px; height: 9px; border-right: 2px solid var(--c-muted); border-bottom: 2px solid var(--c-muted);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .18s ease;
}
.fold[open] > .fold__q::after { transform: rotate(-135deg) translate(-3px, -3px); }
.fold__q:hover .fold__h { color: var(--c-primary-700); }
.fold__q:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 3px; border-radius: var(--radius-sm); }
.fold__h { margin: 0; font-size: 1.02rem; font-weight: 650; }
.fold__a { padding-bottom: var(--sp-5); max-width: 74ch; }
.fold__a > :last-child { margin-bottom: 0; }
.fold__sub { font-size: .95rem; margin-top: var(--sp-5); margin-bottom: var(--sp-3); }
@media (prefers-reduced-motion: reduce) { .fold__q::after { transition: none; } }

/* Once a result exists the download button is the primary action, so the run
   button steps back rather than competing with it. */
body.has-result .widget__run .btn--primary {
  background: transparent; color: var(--c-body);
  border: 1px solid var(--c-border-strong); box-shadow: none;
}
body.has-result .widget__run .btn--primary:hover { border-color: var(--c-primary); color: var(--c-primary-700); }

/* Workbench: once a file is loaded, everything explanatory steps aside so the
   controls own the screen. Reversed by "Start over". */
body.is-working .tool-learn,
body.is-working .ad,
body.is-working .faq,
body.is-working .related,
body.is-working .share,
body.is-working .tool-foot,
body.is-working .side-related--row { display: none; }
body.is-working .crumbs { margin-bottom: var(--sp-2); }
body.is-working .tool-head { margin-bottom: var(--sp-3); }
body.is-working .tool-head h1 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.8rem); }
body.is-working .tool-head__lead,
body.is-working .trust { display: none; }

/* ----------------------------------------------------------------- results */
.result { min-height: 160px; }
.result__empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; color: var(--c-faint); padding: var(--sp-8) var(--sp-3); font-size: .92rem; }
.result__empty-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--c-surface); border: 1px dashed var(--c-border-strong); transform: rotate(90deg); }
.result__empty p { margin: 0; max-width: 34ch; }
.result__inner[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .result__inner:not([hidden]) { animation: reveal var(--t) var(--ease); }
  @keyframes reveal { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}

.res-primary { background: var(--c-surface); border: 1.5px solid var(--c-primary-100); border-radius: var(--radius-lg); padding: var(--sp-5); text-align: center; margin-bottom: var(--sp-4); }
.res-primary__label { display: block; font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--c-muted); margin-bottom: 6px; }
.res-primary__value { display: block; font-size: clamp(1.7rem, 1.2rem + 2.4vw, 2.4rem); font-weight: 800; color: var(--c-primary-700); line-height: 1.15; letter-spacing: -.02em; overflow-wrap: anywhere; }
.res-primary__sub { display: block; font-size: .9rem; color: var(--c-muted); margin-top: 6px; }
.res-primary--warn { border-color: var(--c-warn); background: var(--c-warn-bg); }
.res-primary--warn .res-primary__value { color: var(--c-warn); }
.res-primary--ok { border-color: var(--c-ok); background: var(--c-ok-bg); }
.res-primary--ok .res-primary__value { color: var(--c-ok); }
.res-primary--bad { border-color: var(--c-err); background: var(--c-err-bg); }
.res-primary--bad .res-primary__value { color: var(--c-err); }

.res-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--sp-2); margin-bottom: var(--sp-4); }
.res-tile { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: var(--sp-3); }
.res-tile__label { display: block; font-size: .76rem; color: var(--c-muted); margin-bottom: 3px; }
.res-tile__value { display: block; font-weight: 750; color: var(--c-ink); font-size: 1.02rem; overflow-wrap: anywhere; }

.res-table { width: 100%; font-size: .92rem; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); overflow: hidden; margin-bottom: var(--sp-4); }
.res-table th, .res-table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--c-border); }
.res-table th { font-weight: 650; color: var(--c-muted); font-size: .85rem; }
.res-table td:last-child, .res-table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.res-table tr:last-child td { border-bottom: 0; }
.res-table .is-strong td { font-weight: 750; color: var(--c-ink); background: var(--c-surface-2); }
.res-table .is-neg td:last-child { color: var(--c-err); }
.res-table__note { display: block; font-size: .78rem; color: var(--c-faint); font-weight: 400; }

.res-bars { display: grid; gap: 10px; margin-bottom: var(--sp-4); }
.res-bar__top { display: flex; justify-content: space-between; font-size: .85rem; margin-bottom: 4px; }
.res-bar__track { height: 9px; background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: var(--radius-pill); overflow: hidden; }
.res-bar__fill { height: 100%; background: var(--c-primary); border-radius: var(--radius-pill); transition: width var(--t) var(--ease); }
.res-bar--alt .res-bar__fill { background: var(--c-accent); }

.res-note { font-size: .87rem; color: var(--c-muted); margin: 0 0 var(--sp-2); padding-left: 18px; position: relative; }
.res-note::before { content: ""; position: absolute; left: 4px; top: .55em; width: 6px; height: 6px; border-radius: 50%; background: var(--c-border-strong); }
.res-warn { display: flex; gap: 8px; font-size: .87rem; color: var(--c-warn); background: var(--c-warn-bg); border: 1px solid color-mix(in srgb, var(--c-warn) 30%, transparent); border-radius: var(--radius); padding: 10px 12px; margin-bottom: var(--sp-3); }
.res-error { display: flex; gap: 10px; align-items: flex-start; background: var(--c-err-bg); border: 1px solid color-mix(in srgb, var(--c-err) 35%, transparent); color: var(--c-err); border-radius: var(--radius); padding: var(--sp-4); font-weight: 600; }

.tool-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: var(--sp-4); }
.tool-actions[hidden] { display: none; }
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid var(--c-border); }
.share__label { font-size: .82rem; color: var(--c-muted); font-weight: 600; }

/* --------------------------------------------------------- tool page misc */
.tool-side { display: grid; gap: var(--sp-5); }
.onthispage__h { font-size: .76rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--c-faint); margin-bottom: var(--sp-3); }
.onthispage ul, .side-related ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.onthispage li, .side-related li { margin: 0; }
.onthispage a, .side-related a { display: block; padding: 7px 10px; border-radius: var(--radius-sm); font-size: .89rem; text-decoration: none; color: var(--c-body); border-left: 2px solid transparent; }
.onthispage a:hover, .side-related a:hover { background: var(--c-surface-2); border-left-color: var(--c-primary); color: var(--c-ink); }
/* "Recently used" reads as a row of chips at the foot of a tool page. */
.side-related--row { margin-top: var(--sp-7); }
.side-related--row ul { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.side-related--row a {
  border: 1px solid var(--c-border); border-left-width: 1px; border-radius: 999px;
  padding: 6px 14px; background: var(--c-surface);
}
.side-related--row a:hover { border-left-width: 1px; border-color: var(--c-primary); }

.tool-foot { margin-top: var(--sp-10); padding-top: var(--sp-5); border-top: 1px solid var(--c-border); }
.tool-foot__meta { font-size: .84rem; color: var(--c-faint); margin-bottom: 6px; }
.tool-foot__disc { font-size: .84rem; color: var(--c-muted); margin: 0; }

.steps { counter-reset: s; list-style: none; padding: 0; display: grid; gap: var(--sp-3); }
.steps li { counter-increment: s; position: relative; padding-left: 40px; margin: 0; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 0;
  display: grid; place-items: center; width: 27px; height: 27px; border-radius: 50%;
  background: var(--c-primary-50); color: var(--c-primary-700); font-weight: 750; font-size: .85rem;
}
.list { padding-left: 1.15em; }
.list li::marker { color: var(--c-primary); }

.formula {
  font-family: var(--font-num); font-size: .93rem; background: var(--c-surface);
  border: 1px solid var(--c-border); border-left: 3px solid var(--c-primary);
  border-radius: var(--radius); padding: var(--sp-4); margin: 0 0 var(--sp-4);
  overflow-x: auto; white-space: pre-wrap; line-height: 1.7; color: var(--c-ink);
}
.formula strong { color: var(--c-primary-700); }
.example-box { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-lg); padding: var(--sp-5); overflow-x: auto; }
.example-box h3 { font-size: .95rem; margin-top: 0; }
.example-box table { font-size: .92rem; margin-bottom: var(--sp-3); }
.example-box th, .example-box td { padding: 7px 10px; border-bottom: 1px solid var(--c-border); text-align: left; }
.example-box td:last-child, .example-box th:last-child { text-align: right; font-variant-numeric: tabular-nums; }

.note { display: flex; gap: 10px; border-radius: var(--radius); padding: var(--sp-3) var(--sp-4); margin: 0 0 var(--sp-4); font-size: .9rem; }
.note--info { background: var(--c-info-bg); color: var(--c-info); border: 1px solid color-mix(in srgb, var(--c-info) 25%, transparent); }
.note--warn { background: var(--c-warn-bg); color: var(--c-warn); border: 1px solid color-mix(in srgb, var(--c-warn) 30%, transparent); }
.note--tip { background: var(--c-ok-bg); color: var(--c-ok); border: 1px solid color-mix(in srgb, var(--c-ok) 25%, transparent); }
.note__icon { flex: none; margin-top: 2px; }
.note__body { min-width: 0; }
.note__body p:last-child { margin-bottom: 0; }
.note a { color: inherit; }

/* --------------------------------------------------------------------- FAQ */
.faq__list { display: grid; gap: var(--sp-2); }
.faq__item { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); overflow: hidden; }
.faq__q { display: flex; align-items: flex-start; gap: 10px; padding: var(--sp-4); font-weight: 650; color: var(--c-ink); cursor: pointer; list-style: none; }
.faq__q::-webkit-details-marker { display: none; }
.faq__q::after { content: "+"; margin-left: auto; font-size: 1.3rem; font-weight: 400; color: var(--c-primary); line-height: 1; transition: transform var(--t-fast) var(--ease); }
.faq__item[open] .faq__q::after { transform: rotate(45deg); }
.faq__q:hover { background: var(--c-surface-2); }
.faq__a { padding: 0 var(--sp-4) var(--sp-4); color: var(--c-body); font-size: .94rem; }
.faq__a p:last-child, .faq__a ul:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------------------- ad */
.ad { display: block; margin: var(--sp-8) 0; text-align: center; }
.ad__label { display: block; font-size: .66rem; text-transform: uppercase; letter-spacing: .14em; color: var(--c-faint); margin-bottom: 6px; }
.ad__box { display: grid; place-items: center; width: 100%; overflow: hidden; }
.ad--placeholder .ad__box { background: var(--c-surface-2); border: 1px dashed var(--c-border-strong); border-radius: var(--radius); }
.ad__note { font-size: .8rem; color: var(--c-faint); }
.ad--toolSidebar { margin-top: 0; }
@media (max-width: 1079px) { .ad--toolSidebar { display: none; } }

/* ------------------------------------------------------------- page chrome */
.page-head { display: flex; gap: var(--sp-4); align-items: flex-start; margin: var(--sp-4) 0 var(--sp-5); }
.page-head__icon { flex: none; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 15px; background: var(--c-primary-50); color: var(--c-primary-700); }
.page-head__lead { color: var(--c-muted); margin: 0; font-size: 1.02rem; }

.prose { max-width: 72ch; }
.prose--intro { font-size: 1.02rem; }
.prose h2 { margin-top: var(--sp-8); }
.prose h3 { margin-top: var(--sp-5); }
.prose ul li::marker { color: var(--c-primary); }
.meta-line { font-size: .84rem; color: var(--c-faint); border-top: 1px solid var(--c-border); padding-top: var(--sp-4); margin-top: var(--sp-8); }

.cat-list { display: grid; gap: var(--sp-5); }
.cat-list__item { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-lg); padding: var(--sp-5); }
.cat-list__head { display: flex; gap: var(--sp-3); align-items: flex-start; margin-bottom: var(--sp-4); }
.cat-list__head h2 { font-size: 1.15rem; margin: 0 0 2px; }
.cat-list__head h2 a { text-decoration: none; color: var(--c-ink); }
.cat-list__head h2 a:hover { color: var(--c-primary-700); }
.cat-list__head p { margin: 0; color: var(--c-muted); font-size: .9rem; }
.cat-list__tools { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2px; padding: 0; margin: 0; }
.cat-list__tools li { margin: 0; }
.cat-list__tools a { display: block; padding: 7px 10px; border-radius: var(--radius-sm); font-size: .9rem; text-decoration: none; color: var(--c-body); }
.cat-list__tools a:hover { background: var(--c-primary-50); color: var(--c-primary-700); }

.tools-search { max-width: 620px; margin-bottom: var(--sp-6); }
.search-page { margin-top: var(--sp-5); }
.search-page__count { color: var(--c-muted); font-size: .92rem; margin-bottom: var(--sp-4); }

.notfound { text-align: center; padding: var(--sp-12) 0 var(--sp-6); }
.notfound__code { font-size: 4rem; font-weight: 800; color: var(--c-primary-100); margin: 0; line-height: 1; }
.notfound__lead { color: var(--c-muted); max-width: 48ch; margin: 0 auto var(--sp-6); }
.notfound .search { max-width: 520px; margin: 0 auto; text-align: left; }
.notfound__foot { display: flex; gap: var(--sp-3); justify-content: center; flex-wrap: wrap; margin-top: var(--sp-8); }

/* ------------------------------------------------------------ image tools */
.widget { display: grid; gap: var(--sp-5); }
.dropzone {
  display: grid; place-items: center; gap: 6px; text-align: center;
  padding: var(--sp-8) var(--sp-4); cursor: pointer;
  border: 2px dashed var(--c-border-strong); border-radius: var(--radius-lg);
  background: var(--c-surface); transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.dropzone:hover, .dropzone.is-over { border-color: var(--c-primary); background: var(--c-primary-50); }
.dropzone__icon { color: var(--c-primary); }
.dropzone__title { margin: 0; font-weight: 650; color: var(--c-ink); }
.dropzone__link { color: var(--c-primary-700); text-decoration: underline; }
.dropzone__hint { margin: 0; font-size: .84rem; color: var(--c-faint); }
/* Once files are loaded the dropzone has done its job. It shrinks to a slim
   "add more" bar so the file list and the action button move up the screen. */
body.is-working .dropzone { padding: var(--sp-4); gap: 2px; }
body.is-working .dropzone__icon,
body.is-working .dropzone__hint { display: none; }
body.is-working .dropzone__title { font-size: .92rem; font-weight: 600; color: var(--c-muted); }

.privacy-line { display: flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--c-ok); margin: 0; }
.widget__controls[hidden], .preview[hidden] { display: none; }
.preview { display: grid; gap: var(--sp-4); }
.preview__stage { display: grid; place-items: center; padding: var(--sp-4); background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: var(--radius-lg); }
.preview__canvas { max-height: 420px; width: auto; box-shadow: var(--shadow-2); background: #fff; }
.preview__stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--sp-3); margin: 0; }
.preview__stats div { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: var(--sp-3); }
.preview__stats dt { font-size: .75rem; color: var(--c-muted); }
.preview__stats dd { margin: 2px 0 0; font-weight: 700; color: var(--c-ink); }
.preview__actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.preview__hint { font-size: .85rem; color: var(--c-muted); margin: 0; }
.widget__error { color: var(--c-err); background: var(--c-err-bg); border: 1px solid color-mix(in srgb, var(--c-err) 30%, transparent); border-radius: var(--radius); padding: var(--sp-3) var(--sp-4); font-weight: 600; font-size: .9rem; }
.widget__error[hidden] { display: none; }

/* ------------------------------------------------------------------ footer */
.site-footer { background: var(--c-surface); border-top: 1px solid var(--c-border); padding: var(--sp-12) 0 var(--sp-6); margin-top: var(--sp-16); }
.site-footer__grid { display: grid; grid-template-columns: 1fr; gap: var(--sp-8); }
@media (min-width: 700px) { .site-footer__grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .site-footer__grid { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.site-footer__blurb { font-size: .9rem; color: var(--c-muted); max-width: 44ch; margin: var(--sp-3) 0; }
.site-footer__contact a { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; font-weight: 600; text-decoration: none; }
.site-footer__head { font-size: .76rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--c-faint); margin: 0 0 var(--sp-3); }
.site-footer__head + .site-footer__list + .site-footer__head { margin-top: var(--sp-6); }
.site-footer__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.site-footer__list li { margin: 0; }
.site-footer__list a { font-size: .89rem; color: var(--c-body); text-decoration: none; }
.site-footer__list a:hover { color: var(--c-primary-700); text-decoration: underline; }
.site-footer__bottom { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); border-top: 1px solid var(--c-border); margin-top: var(--sp-8); padding-top: var(--sp-5); }
.site-footer__bottom p { font-size: .82rem; color: var(--c-faint); margin: 0; max-width: 80ch; }

.to-top {
  position: fixed; right: 16px; bottom: 16px; z-index: 50;
  width: 42px; height: 42px; display: grid; place-items: center;
  background: var(--c-surface); border: 1px solid var(--c-border-strong);
  border-radius: 50%; box-shadow: var(--shadow-2); cursor: pointer; color: var(--c-body);
}
.to-top[hidden] { display: none; }
.to-top__icon { transform: rotate(-90deg); }
.to-top:hover { border-color: var(--c-primary); color: var(--c-primary-700); }

/* ============================================================ PDF widget ===
   Shared by every PDF and document tool. Built mobile-first: single column by
   default, wider layouts only where there is room.
   ======================================================================= */

.widget--pdf { gap: var(--sp-5); }
.widget__controls-title {
  font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
  color: var(--c-primary-700); margin: 0 0 var(--sp-3);
}

/* ---- selected files ---- */
.filelist { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-lg); padding: var(--sp-4); }
.filelist[hidden] { display: none; }
.filelist__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.filelist__title { font-size: .82rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--c-primary-700); margin: 0; }
.filelist__items { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.filelist__item {
  display: grid; grid-template-columns: 26px minmax(0, 1fr) auto auto; align-items: center; gap: 10px;
  margin: 0; padding: 10px; background: var(--c-surface-2);
  border: 1px solid var(--c-border); border-radius: var(--radius);
}
.filelist__num { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--c-primary-50); color: var(--c-primary-700); font-size: .78rem; font-weight: 750; }
.filelist__info { min-width: 0; display: grid; }
.filelist__name { font-size: .9rem; font-weight: 600; color: var(--c-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filelist__size { font-size: .78rem; color: var(--c-muted); }
.filelist__move { display: flex; gap: 2px; }
.filelist__move .icon-btn { font-size: 1rem; line-height: 1; }
.filelist__move .icon-btn[disabled] { opacity: .3; pointer-events: none; }
.filelist__remove:hover { color: var(--c-err); background: var(--c-err-bg); }
.filelist__hint { font-size: .8rem; color: var(--c-faint); margin: var(--sp-3) 0 0; }
/* The filename truncates, so the row stays a single line at any width —
   wrapping the controls onto their own row made each entry three times
   taller than it needed to be. */
@media (max-width: 420px) {
  .filelist__item { gap: 6px; padding: 8px; }
  .filelist__move .icon-btn, .filelist__remove { width: 32px; height: 32px; }
}

/* ---- page thumbnails ---- */
.pagegrid-wrap { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-lg); padding: var(--sp-4); }
.pagegrid-wrap[hidden] { display: none; }
.pagegrid__bar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.pagegrid__actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pagegrid__hint { font-size: .82rem; color: var(--c-muted); margin: 0 0 var(--sp-3); }
.pagegrid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--sp-3);
  max-height: 460px; overflow-y: auto; overscroll-behavior: contain;
}
@media (min-width: 600px) { .pagegrid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); } }
.pagecard { margin: 0; border: 2px solid var(--c-border); border-radius: var(--radius); overflow: hidden; background: var(--c-surface-2); transition: border-color var(--t-fast) var(--ease); }
.pagecard.is-selected { border-color: var(--c-primary); }
.pagecard__thumb { display: grid; place-items: center; background: #fff; aspect-ratio: 3 / 4; overflow: hidden; }
.pagecard__thumb canvas { max-width: 100%; max-height: 100%; }
.pagecard__bar { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 8px; }
.pagecard__num { font-size: .78rem; font-weight: 700; color: var(--c-muted); }
.pagecard__check { display: inline-flex; align-items: center; cursor: pointer; }
.pagecard__check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pagecard__check span:not(.visually-hidden) {
  width: 20px; height: 20px; border: 2px solid var(--c-border-strong);
  border-radius: 5px; background: var(--c-surface); display: block;
}
.pagecard__check input:checked + span { border-color: var(--c-primary); background: var(--c-primary); box-shadow: inset 0 0 0 3px var(--c-surface); }
.pagecard__check input:focus-visible + span { outline: 3px solid var(--c-primary); outline-offset: 2px; }

/* ---- run + progress ---- */
.widget__run { display: grid; gap: 8px; }
.widget__run[hidden] { display: none; }
.widget__run .btn { width: 100%; }
@media (min-width: 520px) { .widget__run .btn { width: auto; justify-self: start; } }
.widget__run-note { font-size: .82rem; color: var(--c-muted); margin: 0; }

/* The action button sticks to the bottom of the screen while work is in
   progress, so it is reachable however long the options list gets. It stops
   being sticky once a result exists — the download button takes over. */
@media (max-width: 859px) {
  body.is-working .widget__run:not([hidden]) {
    position: sticky; bottom: 0; z-index: 20;
    margin: 0 calc(var(--sp-4) * -1) calc(var(--sp-4) * -1);
    padding: var(--sp-3) var(--sp-4) calc(var(--sp-3) + env(safe-area-inset-bottom));
    background: var(--c-surface);
    border-top: 1px solid var(--c-border);
    box-shadow: 0 -8px 20px -12px rgb(0 0 0 / .35);
  }
  body.is-working.has-result .widget__run { position: static; box-shadow: none; border-top: 0; background: none; }
  body.is-working .widget__run-note { display: none; }
}

.progress { display: grid; gap: 8px; }
.progress[hidden] { display: none; }
.progress__bar { height: 8px; background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: var(--radius-pill); overflow: hidden; }
.progress__fill { height: 100%; width: 0; background: var(--c-primary); border-radius: var(--radius-pill); transition: width 200ms var(--ease); }
.progress__label { font-size: .86rem; color: var(--c-muted); margin: 0; }

/* ---- output ---- */
.output { background: var(--c-ok-bg); border: 1.5px solid color-mix(in srgb, var(--c-ok) 40%, transparent); border-radius: var(--radius-lg); padding: var(--sp-5); display: grid; gap: var(--sp-4); }
.output[hidden] { display: none; }
.output__head { display: flex; gap: var(--sp-3); align-items: flex-start; }
.output__tick { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--c-ok); color: #fff; }
.output__title { margin: 0; font-weight: 750; color: var(--c-ink); font-size: 1.02rem; }
.output__meta { margin: 2px 0 0; font-size: .86rem; color: var(--c-muted); }
.output__body:empty { display: none; }
.output__body { font-size: .9rem; color: var(--c-body); overflow-wrap: anywhere; }
.output__body pre { white-space: pre-wrap; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: var(--sp-3); max-height: 320px; overflow: auto; font-size: .82rem; }
.output__body dl { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 6px var(--sp-4); margin: 0; }
.output__body dt { color: var(--c-muted); font-size: .85rem; }
.output__body dd { margin: 0; font-weight: 600; color: var(--c-ink); font-size: .88rem; overflow-wrap: anywhere; }
/* Separation from the download button so an ad can never sit adjacent to it. */
.output__actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; padding-top: var(--sp-2); }
.output__actions .btn { flex: 1 1 auto; }
@media (min-width: 520px) { .output__actions .btn { flex: 0 0 auto; } }

/* ---------------------------------------------------------- theme toggle -- */
.theme-toggle { position: relative; }
.theme-toggle__sun, .theme-toggle__moon {
  display: grid; place-items: center;
  transition: opacity var(--t-fast) var(--ease), transform var(--t) var(--ease);
}
/* Show the icon for the theme that is currently ON: sun in light, moon in
   dark. The button's label says what pressing it will do. */
.theme-toggle__moon { position: absolute; inset: 0; }
:root[data-theme="light"] .theme-toggle__moon,
:root:not([data-theme]) .theme-toggle__moon { opacity: 0; transform: rotate(45deg) scale(.6); }
:root[data-theme="light"] .theme-toggle__sun,
:root:not([data-theme]) .theme-toggle__sun { opacity: 1; transform: none; }
:root[data-theme="dark"] .theme-toggle__moon { opacity: 1; transform: none; }
:root[data-theme="dark"] .theme-toggle__sun { opacity: 0; transform: rotate(-45deg) scale(.6); }

/* -------------------------------------------------------- result reveal -- */
.result:focus { outline: none; }
.result:focus-visible { outline: 3px solid var(--c-primary); outline-offset: 4px; border-radius: var(--radius); }
@media (prefers-reduced-motion: no-preference) {
  .result.is-revealed .res-primary { animation: resultPulse 1100ms var(--ease); }
  @keyframes resultPulse {
    0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c-primary) 45%, transparent); }
    60%  { box-shadow: 0 0 0 10px color-mix(in srgb, var(--c-primary) 0%, transparent); }
    100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c-primary) 0%, transparent); }
  }
}

/* ================================================= responsive hardening ===
   Root-cause fixes for horizontal overflow rather than clipping the page.
   Every rule below targets a specific component that can exceed its container
   on a 320px screen: wide tables, long unbroken numbers, grid children that
   refuse to shrink, and repeatable form rows.
   ======================================================================= */

/* Grid and flex children default to min-width:auto, which prevents them from
   shrinking below their content. This is the single most common cause of
   overflow in the layout. */
.tool-layout, .tool-main, .tool-panel, .tool-panel__form, .tool-panel__result,
.fields, .field, .field__control, .card__body, .section, .prose,
.res-tiles, .res-tile, .rows, .rows__row, .rows__cell,
.site-footer__grid, .site-footer__col, .grid, .cat-list__item { min-width: 0; }

/* Any table that can exceed the viewport scrolls inside its own container.
   The page itself never scrolls sideways. */
.table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.table-scroll > table { min-width: 340px; }
.table-scroll .res-table { margin-bottom: 0; }

/* Numbers and identifiers with no spaces must wrap rather than push. */
.res-tile__value, .res-primary__value, .res-table td, .res-table th,
.preview__stats dd, .card__title, .breakdown-value { overflow-wrap: anywhere; }

/* Long words in body copy (URLs, slugs) wrap on narrow screens only. */
@media (max-width: 480px) {
  .prose, .tool-intro, .section, .faq__a { overflow-wrap: break-word; }
}

/* Media and embeds never exceed their box. */
img, svg, video, canvas, iframe, table, pre { max-width: 100%; }

/* Buttons wrap instead of forcing a wider row. */
.tool-form__actions, .tool-actions, .share, .preview__actions, .notfound__foot {
  flex-wrap: wrap;
}
.tool-form__actions .btn, .tool-actions .btn { flex: 1 1 auto; min-width: 0; }
@media (min-width: 480px) {
  .tool-form__actions .btn { flex: 0 0 auto; }
}

/* Repeatable rows: a grid on wide screens, stacked labelled cards on mobile.
   Without this, a 5-column invoice row overflows badly at 375px. */
@media (max-width: 700px) {
  .rows__head { display: none; }
  .rows__row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    position: relative;
    padding: var(--sp-4) 44px var(--sp-4) var(--sp-4);
    background: var(--c-surface-2);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
  }
  .rows__cell { display: grid; gap: 4px; }
  /* Surface the column name that the header row would otherwise carry. */
  .rows__cell::before {
    content: attr(data-label);
    font-size: .78rem;
    font-weight: 650;
    color: var(--c-muted);
  }
  .rows__del { position: absolute; top: 8px; right: 8px; }
}

/* Result tiles: two per row at 360px+, one below that. */
@media (max-width: 420px) {
  .res-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 320px) {
  .res-tiles { grid-template-columns: 1fr; }
}

/* Very narrow screens: tighten padding so content keeps its width. */
@media (max-width: 360px) {
  :root { --sp-4: 12px; --sp-5: 16px; }
  .wrap { padding-inline: 12px; }
  .tool-panel__form, .tool-panel__result { padding: var(--sp-4); }
  .res-primary { padding: var(--sp-4); }
  .res-primary__value { font-size: 1.5rem; }
  .fieldset { padding: var(--sp-3); }
  .field__addon { padding: 0 8px; }
}

/* The sticky header must never force a wider page. */
.site-header__inner { min-width: 0; }
.brand__text { white-space: nowrap; }

/* Ad containers are constrained so a wide unit cannot break the layout. */
.ad, .ad__box { max-width: 100%; overflow: hidden; }

/* -------------------------------------------------------------- utilities */
.text-muted { color: var(--c-muted); }
[hidden] { display: none !important; }

@media print {
  .site-header, .site-footer, .ad, .tool-side, .share, .tool-actions,
  .tool-form__actions, .to-top, .crumbs, .search { display: none !important; }
  body { background: #fff; color: #000; }
  .tool-panel { border: 1px solid #ccc; box-shadow: none; }
  .faq__item[open] .faq__a { display: block; }
  a[href]::after { content: ""; }
}
